The color class can describe one of two types of color: direct color, or indexed color.
Indexed color is an index value into a palette and direct color is an set of red, green, blue and alpha values.
Color objects are typically used with surface and console routines Surface::clear(const Color &color) and Console::clear(const Color &color).
Default constructor.
index, r, g, b and a are all set to zero.
Creates an indexed color object referring to the palette color at index.
For 8 bit indexed modes the palette has 256 entries, therefore the index value should be in the range of [ 0, 255 ].
Creates a direct color object with specific red, green, blue and alpha values.
The r, g, b and a values should all be set in the range of [ 0.0f, 1.0f ] where 0.0f represents minimum intensity and 1.0f represents maximum intensity.
For example, a color created with Color(0.0f,0.0f,0.0f) represents black, and a color created by Color(1.0f,1.0f,1.0f) represents white.
Copy constructor.
Destructor.
Gets the palette index value of the color.
The palette index is only valid if the color is indexed.
A color object is an indexed color if it was created by the Color::Color(int index) constructor.
If the color object is not indexed color then the index value is always zero.
Gets the red color component of the color object.
The red color component is only valid if the color object is direct color.
A color object is direct color if it was created by the Color::Color(float r,float g,float b,float a) constructor.
If the color object is not direct color then the red component is always zero.
Gets the green color component of the color object.
The green color component is only valid if the color object is direct color.
A color object is direct color if it was created by the Color::Color(float r,float g,float b,float a) constructor.
If the color object is not direct color then the green component is always zero.
Gets the blue color component of the color object.
The blue color component is only valid if the color object is direct color.
A color object is direct color if it was created by the Color::Color(float r,float g,float b,float a) constructor.
If the color object is not direct color then the blue component is always zero.
Gets the alpha color component of the color object.
The alpha color component is only valid if the color object is direct color.
A color object is direct color if it was created by the Color::Color(float r,float g,float b,float a) constructor.
If the color object is not direct color then the alpha component is always zero.
Checks if the color is direct color.
A color object is direct color if it was created by the Color::Color(float r,float g,float b,float a) constructor.
Checks if the color is indexed color.
A color object is indexed color if it was created by the Color::Color(int index) constructor.
Assignment operator.
Equality operator.
Inequality operator.