CPalette Class Reference

class CPalette : public CBase

Provides user-definable palette support to the GDI.

A palette is a user-defined set of colours, which is a subset of the full range of 24-bit colours. This allows users the advantages of having a low bpp colour mode whilst being able to specify the colours available in that mode. To give an example, the EColor16 mode provides a palette of 16 colours as it provides a mapping between an integer index and a TRgb colour (see the table EGA Low-colour constants). Only a palette of 16 colour enables you to change the palette. Palettes are also used to allow 24-bit bitmaps to be stored in a more compressed form by finding the actual number of different colours used in the bitmap, creating a palette to allow the mapping of these colours to a smaller index space, and encoding the bitmaps pixels using indexes to this new index space.

A palette has a size which is set at its creation and cannot be altered the number of entries in the palette. Each entry in a palette is a mapping between that entrys index and a TRgb value. Palette entries can be got and set at any time between the palettes creation and destruction. The GDIs palette support also provides functions to find the nearest palette colour to a requested TRgb colour.

Inherits from

Constructor & Destructor Documentation

CPalette()

IMPORT_CCPalette()[protected]

~CPalette()

IMPORT_C~CPalette()

Member Functions Documentation

Clear()

IMPORT_C voidClear()

ConstructL(TInt)

voidConstructL(TIntaNumberOfEntries)[protected]

Parameters

TInt aNumberOfEntries

Entries()

TInt Entries()const [inline]

Gets the number of entries in the palette

The number of entries in the palette.

GetDataPtr(TInt, TInt, TPtr8 &)

IMPORT_C voidGetDataPtr(TIntaFirstColor,
TIntaNumColors,
TPtr8 &aPtr
)

Parameters

TInt aFirstColor
TInt aNumColors
TPtr8 & aPtr

GetEntry(TInt)

IMPORT_C TRgbGetEntry(TIntaPaletteIndex)const

Parameters

TInt aPaletteIndex

NearestEntry(const TRgb &)

IMPORT_C TRgbNearestEntry(const TRgb &aColor)const

Parameters

const TRgb & aColor

NearestIndex(const TRgb &)

IMPORT_C TIntNearestIndex(const TRgb &aColor)const

Parameters

const TRgb & aColor

NewDefaultL(TDisplayMode)

IMPORT_C CPalette *NewDefaultL(TDisplayModeaDispMode)[static]

Parameters

TDisplayMode aDispMode

NewL(TInt)

IMPORT_C CPalette *NewL(TIntaNumberOfEntries)[static]

Parameters

TInt aNumberOfEntries

SetEntry(TInt, const TRgb &)

IMPORT_C voidSetEntry(TIntaPaletteIndex,
const TRgb &aPaletteEntry
)

Parameters

TInt aPaletteIndex
const TRgb & aPaletteEntry

Member Data Documentation

TRgb * iArray

TRgb *iArray[protected]

TInt iNumEntries

TInt iNumEntries[protected]