Applications that use these functions will not work correctly on a version of EPOC earlier than ER5.
For an introduction to the TRgb class, see The TRgb class.
In each display mode, as enumerated by TDisplayMode, a unique index can represent each physical colours supported, and which can be mapped onto a full RGB value. The mappings are as follows:
- 16-colour displays use the EGA colour set: black, white, and then both light and dark versions of grey, red, green, blue, cyan, magenta and yellow
- 256-colour displays support 216 colours made up of 6x6x6 RGB values, each containing all possible multiples of 51 for R,G,B values. Additionally, all remaining 10 shades of pure red, green, blue and grey are represented, by adding all remaining multiples of 17. This use of 256 colours is sometimes known as the Netscape colour cube.
- 4096-colour displays effectively support RGB values with 4 bits per primary colour
- 64k-colour displays effectively support RGB values with 5 bits allocated to red, 6 to green and 5 to blue
- 16 million-colour displays support true colour with 8 bits allocated to each primary colour
The TRgb class has been augmented in ER5 to include mapping functions and also reverse mapping functions from RGB to the nearest physical colour index value. The corresponding greyscale and low-colour functions were present in previous EPOC releases.
The new functions are as follows:
static TRgb Color256(TInt aColor256);
- Takes an 8 bit index into a colour palette and returns the TRgb value which it represents.
static TRgb Color4K(TInt aColor4K);
- Takes a 12 bit index into a colour palette and returns the TRgb value which it represents.
static TRgb Color64K(TInt aColor64K);
- Takes a 16 bit index into a colour palette and returns the TRgb value which it represents.
static TRgb Color16M(TInt aColor16M);
- Takes an 24 bit index into a colour palette and returns the TRgb value which it represents exactly.
TInt Color256() const;
- Converts a TRgb value to an 8 bit index into a colour palette.
TInt Color4K() const;
- Converts a TRgb value to a 12 bit index into a colour palette.
TInt Color64K() const;
- Converts a TRgb value to a 16 bit index into a colour palette.
TInt Color16M() const;
- Converts a TRgb value to a 24 bit index into a colour palette.