class TRgb |
24-bit RGB colour value with 8 bits each for red, green and blue.
All Graphics drawing functions are specified in terms of a 32-bit TRgb colour containing the three colour values plus 8 bits for alpha channel. For hardware which does not support 24-bit colour, a mapping from TRgb to display colours is performed.
Generally, the convention for the alpha blending fact is 0 = transparent, 255 = opaque, unless otherwise stated. The exception to this are the TRgb constructor taking a single value, where the top byte of the passed in parameter is used for alpha information and the function Value(), which returns alpha information in the top byte. In both these cases, 0 means opaque, 255 means transparent.
The supported display modes are enumerated in the TDisplayMode type. In each display mode 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
DynamicPalette
Private Attributes | |
---|---|
TUint32 | iValue |
TRgb | ( | TUint32 | aValue | ) | [inline] |
Constructs a TRgb directly from a single 32-bit integer.
The integer is of the form 0xaabbggrr, where bb is the hex number for blue, gg is the hex number for green, rr is the hex number for red, and aa is the hex number for "transparency" alpha (0 means opaque, 255 means transparent).
This constructor is deprecated. The byte order of Red ,Green and Blue does not match other constructors and methods in this class, and the meaning of alpha is reversed compared to current convention.
For example, TRgb(0x00080402) using this constructor can be replaced with the 3 colour constructor TRgb(2,4,8). The equivalent explicit alpha constructors are TRgb(0x020408,0xff) and TRgb(2,4,8,255). The equivalent call to SetInternal is SetInternal(0xff020408).
This constructor is deprecated. Use other constructors or SetInternal() instead.
TUint32 aValue | Integer representing colour value. Takes form 0x00bbggrr. |
TRgb | ( | TUint32 | aInternalValue, |
TInt | aAlpha | ||
) | [inline] |
Constructs a TRgb from a 32-bit integer (which corresponds to a colour) and from an alpha value.
The first parameter is of the form 0x00rrggbb, where rr is the hex number for red, gg is the hex number for green, and bb is the hex number for blue.
The second parameter corresponds to an alpha channel (0 means transparent, 255 means opaque).
For example, TRgb(2,4,8,255) using the 3 colour+alpha constructor is equal to TRgb(0x00020408, 255) using this constructor.
This constructor, which implements alpha in the conventional way, replaces TRgb( TUint32 aValue ) which is deprecated.
TRgb | ( | TInt | aRed, |
TInt | aGreen, | ||
TInt | aBlue | ||
) | [inline] |
Constructs a TRgb from its three component colours.
Each colour has a value between 0 and 255. The alpha component is always set to opaque (255)
TRgb | ( | TInt | aRed, |
TInt | aGreen, | ||
TInt | aBlue, | ||
TInt | aAlpha | ||
) | [inline] |
Constructs a TRgb from its three colour components and alpha component.
Each component has a value between 0 and 255. The fourth parameter corresponds to an alpha channel (0 means transparent, 255 means opaque).
This constructor, which implements alpha in the conventional way, replaces TRgb( TUint32 aValue ) which is deprecated.
IMPORT_C TInt | Difference | ( | const TRgb & | aColor | ) | const |
const TRgb & aColor |
IMPORT_C void | ExternalizeL | ( | RWriteStream & | aStream | ) | const |
RWriteStream & aStream |
IMPORT_C void | InternalizeL | ( | RReadStream & | aStream | ) |
RReadStream & aStream |
void | SetInternal | ( | TUint32 | aInternal | ) | [inline] |
Sets the 32-bit value of the TRgb as a 32-bit integer.
TUint32 aInternal | Colour internal representation. Has the form 0xaarrggbb. |
TUint32 | Value | ( | ) | const [inline] |
Gets the 32-bit value of the TRgb as an integer. This function is deprecated. Use Internal() instead. Note: the order of Red, Green and Blue components returned by this method is reversed compared to all other methods. The alpha value is also reversed in meaning compared to current convention, such that 0 represents opaque and 0xff represents transparent.
The 32 bit value of the TRgb. Has the form 0xaabbggrr, where bb is the hex number for blue, gg is the hex number for green, rr is the hex number for red, and aa is the hex number for "transparency" alpha (0 means opaque, 255 means transparent).
TRgb | _Color16M | ( | TInt | aColor16M | ) | [static, inline] |
TInt aColor16M | 24 bit index into a colour palette |
TRgb | _Color16MA | ( | TUint | aARGB | ) | [static, inline] |
TUint aARGB | The color - A, R, G, B bytes. / BGR0 - little endian format / |
TRgb | _Color16MU | ( | TInt | a0RGB | ) | [static, inline] |
TInt a0RGB | The color - 0, R, G, B bytes. / BGR0 - little endian format / |
TRgb | _Color4K | ( | TInt | aColor4K | ) | [static, inline] |
TInt aColor4K | 12 bit index into a colour palette |
TRgb | _Color64K | ( | TInt | aColor64K | ) | [static, inline] |
TInt aColor64K | 16 bit index into a colour palette |
TRgb | _Gray16 | ( | TInt | aGray16 | ) | [static, inline] |
TInt aGray16 | Grayscale value to be converted. |
TRgb | _Gray2 | ( | TInt | aGray2 | ) | [static, inline] |
TInt aGray2 | Grayscale value to be converted. |
TRgb | _Gray256 | ( | TInt | aGray256 | ) | [static, inline] |
TInt aGray256 | Grayscale value to be converted. |
TRgb | _Gray4 | ( | TInt | aGray4 | ) | [static, inline] |
TInt aGray4 | Grayscale value to be converted. |
TBool | operator!= | ( | const TRgb & | aColor | ) | const [inline] |
Compares this colour with the specified colour for inequality.
Two colours are unequal if one at least one of their red, green and blue components are unequal.
ETrue, if the colours are not equal; EFalse, otherwise.
const TRgb & aColor | Colour to be compared. |
TRgb | operator& | ( | const TRgb & | aColor | ) | [inline] |
Bitwise logical AND operator.
Contains results of logical AND.
const TRgb & aColor | Colour to be compared. |
TRgb & | operator&= | ( | const TRgb & | aColor | ) | [inline] |
Logical AND assignment operator.
The operator ANDs the first operand with the second and then assigns the result back to the first operand.
Note:
This operates in the TRgb domain. Graphics defines logical operations for drawing primitives which operate in the device colour domain.
First operand-contains result of logical AND.
const TRgb & aColor | Colour to be compared. |
TBool | operator== | ( | const TRgb & | aColor | ) | const [inline] |
Compares this colour with the specified colour for equality.
For two colours to be equal, their red, green and blue components must all be equal.
ETrue. if the colours are equal; EFalse, otherwise.
const TRgb & aColor | Colour to be compared. |
TRgb | operator^ | ( | const TRgb & | aColor | ) | [inline] |
Bitwise EXCLUSIVE OR operator
Contains results of logical EXCLUSIVE OR.
const TRgb & aColor | Colour to be compared. |
TRgb & | operator^= | ( | const TRgb & | aColor | ) | [inline] |
Logical EXCLUSIVE OR assignment operator.
The operator Exclusive ORs the first operand with the second and then assigns the result back to the first operand.
Note:
This operates in the TRgb domain. Graphics defines logical operations for drawing primitives which operate in the device colour domain.
First operand contains result of logical Exclusive OR.
const TRgb & aColor | Colour to be compared. |
TRgb | operator| | ( | const TRgb & | aColor | ) | [inline] |
Bitwise logical OR operator.
Contains results of logical OR.
const TRgb & aColor | Colour to be compared. |
TRgb & | operator|= | ( | const TRgb & | aColor | ) | [inline] |
Logical OR assignment operator.
The operator ORs the first operand with the second and then assigns the result back to the first operand.
Note:
This operates in the TRgb domain. Graphics defines logical operations for drawing primitives which operate in the device colour domain.
First operand- contains result of logical OR.
const TRgb & aColor | Colour to be compared. |
TRgb | operator~ | ( | ) | const [inline] |
Bitwise logical inversion operator.
Contains results of logical inversion.