Skia
2DGraphicsLibrary
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SkColorTable Class Reference

SkColorTable holds an array SkPMColors (premultiplied 32-bit colors) used by 8-bit bitmaps, where the bitmap bytes are interpreted as indices into the colortable. More...

#include <SkColorTable.h>

Inheritance diagram for SkColorTable:
SkRefCnt SkRefCntBase

Public Member Functions

 SkColorTable (const SkPMColor colors[], int count)
 Copy up to 256 colors into a new SkColorTable.
 
int count () const
 Returns the number of colors in the table.
 
SkPMColor operator[] (int index) const
 Returns the specified color from the table. More...
 
const SkPMColorreadColors () const
 Return the array of colors for reading.
 
const uint16_t * read16BitCache () const
 read16BitCache() returns the array of RGB16 colors that mirror the 32bit colors.
 
void writeToBuffer (SkWriteBuffer &) const
 
- Public Member Functions inherited from SkRefCntBase
 SkRefCntBase ()
 Default construct, initializing the reference count to 1.
 
virtual ~SkRefCntBase ()
 Destruct, asserting that the reference count is 1.
 
int32_t getRefCnt () const
 Return the reference count. More...
 
void validate () const
 
bool unique () const
 May return true if the caller is the only owner. More...
 
void ref () const
 Increment the reference count. More...
 
void unref () const
 Decrement the reference count. More...
 

Static Public Member Functions

static sk_sp< SkColorTableMake (const SkPMColor colors[], int count)
 
static sk_sp< SkColorTableCreate (SkReadBuffer &)
 

Private Types

enum  AllocatedWithMalloc { kAllocatedWithMalloc }
 
typedef SkRefCnt INHERITED
 

Private Member Functions

 SkColorTable (SkPMColor *colors, int count, AllocatedWithMalloc)
 
void init (const SkPMColor *colors, int count)
 
void dangerous_overwriteColors (const SkPMColor newColors[], int count)
 

Private Attributes

SkPMColorfColors
 
uint16_t * f16BitCache = nullptr
 
SkOnce f16BitCacheOnce
 
int fCount
 

Friends

class SkImageGenerator
 
class SkBitmapRegionCodec
 

Additional Inherited Members

- Protected Member Functions inherited from SkRefCntBase
void internal_dispose_restore_refcnt_to_1 () const
 Allow subclasses to call this if they've overridden internal_dispose so they can reset fRefCnt before the destructor is called or if they choose not to call the destructor (e.g. More...
 

Detailed Description

SkColorTable holds an array SkPMColors (premultiplied 32-bit colors) used by 8-bit bitmaps, where the bitmap bytes are interpreted as indices into the colortable.

SkColorTable is thread-safe.

Member Function Documentation

SkPMColor SkColorTable::operator[] ( int  index) const
inline

Returns the specified color from the table.

In the debug build, this asserts that the index is in range (0 <= index < count).


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