SkColorTable Class Reference

#include <SkBitmap.h>

Inherits SkRefCnt.

Collaboration diagram for SkColorTable:
Collaboration graph
[legend]

List of all members.

Public Types

enum  Flags { kColorsAreOpaque_Flag = 0x01 }

Public Member Functions

 SkColorTable (const SkColorTable &src)
 SkColorTable (int count)
 SkColorTable (SkFlattenableReadBuffer &)
 SkColorTable (const SkPMColor colors[], int count)
virtual ~SkColorTable ()
unsigned getFlags () const
void setFlags (unsigned flags)
bool isOpaque () const
void setIsOpaque (bool isOpaque)
int count () const
SkPMColor operator[] (int index) const
SkPMColorlockColors ()
void unlockColors (bool changed)
const uint16_t * lock16BitCache ()
void unlock16BitCache ()
void flatten (SkFlattenableWriteBuffer &) const

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.

Definition at line 488 of file SkBitmap.h.


Member Enumeration Documentation

Enumerator:
kColorsAreOpaque_Flag 

if set, all of the colors in the table are opaque (alpha==0xFF)

Definition at line 501 of file SkBitmap.h.


Constructor & Destructor Documentation

SkColorTable::SkColorTable ( const SkColorTable src  ) 

Makes a deep copy of colors.

SkColorTable::SkColorTable ( int  count  )  [explicit]

Preallocates the colortable to have 'count' colors, which are initially set to 0.

SkColorTable::SkColorTable ( SkFlattenableReadBuffer  )  [explicit]
SkColorTable::SkColorTable ( const SkPMColor  colors[],
int  count 
)
virtual SkColorTable::~SkColorTable (  )  [virtual]

Member Function Documentation

int SkColorTable::count (  )  const [inline]

Returns the number of colors in the table.

Definition at line 516 of file SkBitmap.h.

void SkColorTable::flatten ( SkFlattenableWriteBuffer  )  const
unsigned SkColorTable::getFlags (  )  const [inline]

Returns the flag bits for the color table. These can be changed with setFlags().

Definition at line 506 of file SkBitmap.h.

bool SkColorTable::isOpaque (  )  const [inline]

Definition at line 511 of file SkBitmap.h.

const uint16_t* SkColorTable::lock16BitCache (  ) 

Similar to lockColors(), lock16BitCache() returns the array of RGB16 colors that mirror the 32bit colors. However, this function will return null if kColorsAreOpaque_Flag is not set. Also, unlike lockColors(), the returned array here cannot be modified.

SkPMColor* SkColorTable::lockColors (  )  [inline]

Specify the number of colors in the color table. This does not initialize the colors to any value, just allocates memory for them. To initialize the values, either call setColors(array, count), or follow setCount(count) with a call to lockColors()/{set the values}/unlockColors(true). Return the array of colors for reading and/or writing. This must be balanced by a call to unlockColors(changed?), telling the colortable if the colors were changed during the lock.

Definition at line 538 of file SkBitmap.h.

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).

Definition at line 521 of file SkBitmap.h.

void SkColorTable::setFlags ( unsigned  flags  ) 

Set the flags for the color table. See the Flags enum for possible values.

void SkColorTable::setIsOpaque ( bool  isOpaque  ) 
void SkColorTable::unlock16BitCache (  )  [inline]

Balancing call to lock16BitCache().

Definition at line 554 of file SkBitmap.h.

void SkColorTable::unlockColors ( bool  changed  ) 

Balancing call to lockColors(). If the colors have been changed, pass true.


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

Generated on Tue Oct 20 11:03:42 2009 for Skia by  doxygen 1.6.1