A class representing a colour specification.
![]() | StandardColours Codes for specification of standard, most common colours. |
![]() | PColour ( StandardColours col = Black ) Create a standard colour specification. |
![]() | PColour ( BYTE r, BYTE g, BYTE b, BYTE a = 0xff ) Create a colour of the specified RGB values and alpha channel. |
![]() | PColour ( const PString & description ) Create a colour from a description string. |
![]() | Clone () const Create a copy of the colour. |
![]() | Compare ( const PObject & obj ) const Determine if the two colours are the same, ie have the save values for all of the components. |
![]() | HashFunction () const Default hash function for putting colours into dictionaries. |
![]() | GetDescription () const Get the colour description string. |
![]() | SetRed ( BYTE r ) Set the red component of the colour specification. |
![]() | GetRed () const Get the red component of the colour specification. |
![]() | SetGreen ( BYTE g ) Set the green component of the colour specification. |
![]() | GetGreen () const Get the greeen component of the colour specification. |
![]() | SetBlue ( BYTE b ) Set the blue component of the colour specification. |
![]() | GetBlue () const Get the blue component of the colour specification. |
![]() | SetAlpha ( BYTE a ) Set the alpha (opacity) component of the colour specification. |
![]() | GetAlpha () const Get the opaqueness component of the colour specification. |
![]() | operator[] ( PINDEX component ) const Get the component specified by the index. |
![]() | GetDistance ( const PColour & other ) const Calculate a distance metric between the two colours in RGB colour space. |
![]() | Overrides from class PObject |
![]() | New functions for class |
![]() | Component indexes for \Ref{operator[]} access method. |
![]() | component [NumComponents] Components of the colour |
Run Time Type functions
Comparison functions
I/O functions
Miscellaneous functions
A class representing a colour specification. This class provides encapsulation for a 4 component colour. These are the amount of Red, Green, Blue and transparency (Alpha).This class allows for the representation of an arbitrary colour which may not be able to be realised on the particular drawing canvas. A descendent from this class called a PRealColour always represents a colour that actually can be displayed. For example, for a typical printer canvas the only two colours possible are Black and White.
It is up the application and its colour needs to determine if simply using the PColour or translating it to a PRealColour first is required.
Note that for target drawing systems that do not support the opaqueness to transparency as a continuous value, zero indicates transparent and non-zero indicates full opaque, ie solid colour with no background.
Red
Green
Yellow
Blue
Magenta
Cyan
White
LightGrey
Grey
PColour( BYTE r, BYTE g, BYTE b, BYTE a = 0xff )
g - Green component
b - Blue component
a - Opaqueness, 0=fully transparent, 255=fully opaque PColour( const PString & description )
Overrides from class PObject
virtual PObject* Clone() const
virtual Comparison Compare( const PObject & obj ) const
virtual PINDEX HashFunction() const
((Red ^ 0x55) + (Green ^ 0xaa) + (Blue ^ 0xc3))%51
New functions for class
PString GetDescription() const
virtual void SetRed( BYTE r )
BYTE GetRed() const
virtual void SetGreen( BYTE g )
BYTE GetGreen() const
virtual void SetBlue( BYTE b )
BYTE GetBlue() const
virtual void SetAlpha( BYTE a )
BYTE GetAlpha() const
Component indexes for \Ref{operator[]} access method.
BYTE operator[]( PINDEX component ) const
long GetDistance( const PColour & other ) const
Alphabetic index HTML hierarchy of classes or Java