Location:
gdi.h
Link against: gdi.lib
TRgb
Supported from 5.0
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 unused bits.
For hardware which does not support 24-bit colour, a mapping from
TRgb
to display colours is performed.
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
Defined in TRgb
:
Blue()
, Color16()
, Color16M()
, Color256()
, Color4K()
, Color64K()
, Difference()
, ExternalizeL()
, Gray16()
, Gray2()
, Gray256()
, Gray4()
, Green()
, InternalizeL()
, Red()
, SetBlue()
, SetGreen()
, SetRed()
, TRgb()
, Value()
, operator!=()
, operator&()
, operator&=()
, operator==()
, operator^()
, operator^=()
, operator|()
, operator|=()
, operator~()
TRgb(TUint32 aValue);
Constructs a TRgb
directly from a single 32-bit
integer.
The integer is of the form 0x00bbggrr
, where bb is
the hex number of blue, gg is the hex number for green, and rr is the hex
number for red. For example, TRgb(2,4,8)
using the 3 colour
constructor is equal to TRgb(0x00080402)
using this
constructor.
|
TRgb(TInt aRed,TInt aGreen,TInt aBlue);
Constructs a TRgb
from its three component
colours.
Each colour has a value between 0 and 255.
|
void SetRed(TInt aRed);
Sets the red component.
|
void SetGreen(TInt aGreen);
Sets the green component.
|
void SetBlue(TInt aBlue);
Sets the blue component.
|
TInt Blue() const;
Gets the blue component.
|
TInt Red() const;
Gets the red component.
|
TInt Green() const;
Gets the green component.
|
TUint32 Value() const;
Gets the 24-bit value of the TRgb
as a 32-bit
integer.
|
static TRgb Gray2(TInt aGray2);
Gets TRgb
from 2 level grayscale.
The function takes a grayscale argument and return a
TRgb
whose red, green and blue values are set to an appropriate
level.
|
|
static TRgb Gray4(TInt aGray4);
Gets TRgb
from 4 level grayscale.
The function takes a grayscale argument and return a
TRgb
whose red, green and blue values are set to an appropriate
level.
|
|
static TRgb Gray16(TInt aGray16);
Gets TRgb
from 16 level grayscale.
The function takes a grayscale argument and return a
TRgb
whose red, green and blue values are set to an appropriate
level.
|
|
static TRgb Gray256(TInt aGray256);
Gets TRgb
from 256 level grayscale.
The function takes a grayscale argument and return a
TRgb
whose red, green and blue values are set to an appropriate
level.
|
|
static TRgb Color16(TInt aColor16);
Gets TRgb
from 4 bit colour index.
The function takes a 4 bit index into a colour palette and
returns a TRgb
whose red, green and blue values are set to an
appropriate level.
|
|
static TRgb Color256(TInt aColor256);
Gets TRgb
from 8 bit colour index.
The function takes an 8 bit index into a colour palette and
returns a TRgb
whose red, green and blue values are set to an
appropriate level.
|
|
static TRgb Color4K(TInt aColor4K);
Gets TRgb
from 4K colour index.
The function takes a 12 bit index into a colour palette and
returns a TRgb
whose red, green and blue values are set to an
appropriate level.
|
|
static TRgb Color64K(TInt aColor64K);
Gets TRgb
from 64K colour index.
The function takes a 16 bit index into a colour palette and
returns a TRgb
whose red, green and blue values are set to an
appropriate level.
|
|
static TRgb Color16M(TInt aColor16M);
Gets TRgb
from 16M colour index.
The function takes a 24 bit index into a colour palette and
returns the TRgb
whose red, green and blue values represent it
exactly.
|
|
TInt Gray2() const;
Gets a 2 level grayscale value from this TRgb
.
|
TInt Gray4() const;
Gets a 4 level grayscale value from this
TRgb
.
|
TInt Gray16() const;
Gets a 16 level grayscale value from this
TRgb
.
|
TInt Gray256() const;
Gets a 256 level grayscale value from this
TRgb
.
|
TInt Color16() const;
Gets a 4 bit index into a colour palette from this
TRgb
.
|
TInt Color256() const;
Gets an 8 bit index into a colour palette from this
TRgb
.
|
TInt Color4K() const;
Gets a 12 bit index into a colour palette from this
TRgb
.
|
TInt Color16M() const;
Gets a 16 bit index into a colour palette from this
TRgb
.
|
TInt Color64K() const;
Gets a 24 bit index into a colour palette from this
TRgb
.
|
TBool operator==(const TRgb& aColor) const;
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.
|
|
TBool operator!=(const TRgb& aColor) const;
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.
|
|
TInt Difference(const TRgb& aColor) const;
Gets the difference between two TRgb
s.
This difference is defined as the sum of the absolute values of the difference in the red, green and blue components.
|
|
TRgb operator&(const TRgb& aColor);
Bitwise logical AND operator.
|
|
TRgb operator|(const TRgb& aColor);
Bitwise logical OR operator.
|
|
TRgb operator^(const TRgb& aColor);
Bitwise EXCLUSIVE OR operator
|
|
TRgb operator~() const;
Bitwise logical inversion operator.
|
TRgb& operator&=(const TRgb& aColor);
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.
|
|
TRgb& operator|=(const TRgb& aColor);
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.
|
|
TRgb& operator^=(const TRgb& aColor);
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.
|
|
void InternalizeL(RReadStream& aStream);
Internalises a TRgb
object from a stream.
The presence of this function means that the standard templated
stream operator>>()
is available to internalise objects of
this class.
|
void ExternalizeL(RWriteStream& aStream) const;
Externalises a TRgb
object to a stream.
The presence of this function means that the standard templated
stream operator<<()
is available to externalise objects of
this class.
|