Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Friends | List of all members
SkColorTable Class Reference

#include <SkColorTable.h>

Inheritance diagram for SkColorTable:
SkRefCnt SkRefCntBase

Public Member Functions

const uint8_t * alphaTable () const
 
const uint8_t * redTable () const
 
const uint8_t * greenTable () const
 
const uint8_t * blueTable () const
 
void flatten (SkWriteBuffer &buffer) const
 
- Public Member Functions inherited from SkRefCntBase
 SkRefCntBase ()
 
virtual ~SkRefCntBase ()
 
bool unique () const
 
void ref () const
 
void unref () const
 

Static Public Member Functions

static sk_sp< SkColorTableMake (const uint8_t table[256])
 
static sk_sp< SkColorTableMake (const uint8_t tableA[256], const uint8_t tableR[256], const uint8_t tableG[256], const uint8_t tableB[256])
 
static sk_sp< SkColorTableDeserialize (SkReadBuffer &buffer)
 

Friends

class SkTableColorFilter
 

Detailed Description

SkColorTable holds the lookup tables for each channel (ARGB) used to define the filter behavior of SkColorFilters::Table, and provides a way to share the table data between client code and the returned SkColorFilter. Once created, an SkColorTable is immutable.

Definition at line 25 of file SkColorTable.h.

Member Function Documentation

◆ alphaTable()

const uint8_t * SkColorTable::alphaTable ( ) const
inline

Definition at line 41 of file SkColorTable.h.

41{ return fTable.getAddr8(0, 0); }
uint8_t * getAddr8(int x, int y) const
Definition SkBitmap.h:1270

◆ blueTable()

const uint8_t * SkColorTable::blueTable ( ) const
inline

Definition at line 44 of file SkColorTable.h.

44{ return fTable.getAddr8(0, 3); }

◆ Deserialize()

sk_sp< SkColorTable > SkColorTable::Deserialize ( SkReadBuffer buffer)
static

Definition at line 45 of file SkColorTable.cpp.

45 {
46 uint8_t argb[4*256];
47 if (buffer.readByteArray(argb, sizeof(argb))) {
48 return SkColorTable::Make(argb+0*256, argb+1*256, argb+2*256, argb+3*256);
49 }
50 return nullptr;
51}
static sk_sp< SkColorTable > Make(const uint8_t table[256])
static const uint8_t buffer[]

◆ flatten()

void SkColorTable::flatten ( SkWriteBuffer buffer) const

Definition at line 41 of file SkColorTable.cpp.

41 {
42 buffer.writeByteArray(fTable.getAddr8(0, 0), 4 * 256);
43}

◆ greenTable()

const uint8_t * SkColorTable::greenTable ( ) const
inline

Definition at line 43 of file SkColorTable.h.

43{ return fTable.getAddr8(0, 2); }

◆ Make() [1/2]

static sk_sp< SkColorTable > SkColorTable::Make ( const uint8_t  table[256])
inlinestatic

Definition at line 29 of file SkColorTable.h.

29 {
30 return Make(table, table, table, table);
31 }
SI F table(const skcms_Curve *curve, F v)

◆ Make() [2/2]

sk_sp< SkColorTable > SkColorTable::Make ( const uint8_t  tableA[256],
const uint8_t  tableR[256],
const uint8_t  tableG[256],
const uint8_t  tableB[256] 
)
static

Definition at line 14 of file SkColorTable.cpp.

17 {
18 if (!tableA && !tableR && !tableG && !tableB) {
19 return nullptr; // The table is the identity
20 }
21
23 if (!table.tryAllocPixels(SkImageInfo::MakeA8(256, 4))) {
24 return nullptr;
25 }
26 uint8_t *a = table.getAddr8(0,0),
27 *r = table.getAddr8(0,1),
28 *g = table.getAddr8(0,2),
29 *b = table.getAddr8(0,3);
30 for (int i = 0; i < 256; i++) {
31 a[i] = tableA ? tableA[i] : i;
32 r[i] = tableR ? tableR[i] : i;
33 g[i] = tableG ? tableG[i] : i;
34 b[i] = tableB ? tableB[i] : i;
35 }
36 table.setImmutable();
37
39}
static bool b
struct MyStruct a[10]
static SkImageInfo MakeA8(int width, int height)

◆ redTable()

const uint8_t * SkColorTable::redTable ( ) const
inline

Definition at line 42 of file SkColorTable.h.

42{ return fTable.getAddr8(0, 1); }

Friends And Related Symbol Documentation

◆ SkTableColorFilter

friend class SkTableColorFilter
friend

Definition at line 51 of file SkColorTable.h.


The documentation for this class was generated from the following files: