Symbian Developer Library

SYMBIAN OS V6.1 EDITION FOR C++

[Index] [Glossary] [Previous] [Next]



Location: gdi.h
Link against: gdi.lib

Class TColor256Util

TColor256Util

Support

Supported from 6.1

Description

Enables conversion, in both directions, between a TRgb object and an index into an arbitrary 256 colour palette.

Defined in TColor256Util:
Color256(), Construct(), Default(), iColorTable, iInverseColorTable


Construction and destruction


Construct()

void Construct(const CPalette& aPalette);

Description

Initialises the two lookup tables using the specified palette.

Parameters

const CPalette& aPalette

The palette of colours used to initialise the colour lookup tables.


Color256()

TInt Color256(TRgb aRgb) const;

Description

Gets the entry from the inverse colour lookup table for the colour that most closely matches the specified TRgb value.

Entries in the inverse colour lookup table are indices into the palette that the object was created with. Essentially, this function matches aRgb to the index of the nearest colour in the palette.

Parameters

TRgb aRgb

The conversion colour.

Return value

TInt

The index of the nearest colour to aRgb in the palette.


Color256()

void Color256(TUint8* aDestination,const TRgb* aSource,TInt aNumPixels) const;

Description

Gets the entries from the inverse colour lookup table for the colours that most closely match the specified TRgb values.

Parameters

TUint8* aDestination

On return, a pointer to a buffer containing the entries from the inverse colour lookup table.

const TRgb* aSource

Pointer to the first TRgb value to match.

const TInt aNumPixels

The number of TRgb values to match.


Color256()

TRgb Color256(TInt aColor256) const;

Description

Gets the TRgb value of the entry at the specified index in the colour lookup table.

Parameters

TInt aColor256

The index into the colour lookup table.

Return value

TRgb

The TRgb value of the entry at the specified index.


Default()

static const TColor256Util* Default();

Description

Returns a pointer to the system default 256 colour palette.

Return value

TColor256Util*

Pointer to the system default 256 colour palette.

[Top]


Data members


iColorTable

TUint32    iColorTable[256];

Description

256 colour lookup table.

Each entry is a 32 bit value which corresponds to a TRgb value in the palette passed to Construct(). If there are more than 256 colours in the palette, the first 256 colours are used in this table. If there are fewer than 256 entries, the remaining entries in the table are set to zero.


iInverseColorTable

TUint8 iInverseColorTable[0x1000];

Description

Inverse colour lookup table.

It has 4096 entries. Each entry is the index of a colour in the palette that the object was created with (see Construct()) that most closely matches the 4096 degrees of intensity of red, green and blue on a uniform 16x16x16 colour cube.

It is called "inverse" because iColorTable maps indices (0..255) to TRgb values, but this table maps TRgb values to palette indices.