Color Class Reference

Description

Color represented as 4 components, each being a floating point value ranging from 0 to 1.

Color components are red, green, blue and alpha.

Methods

 Color (float red=1.0f, float green=1.0f, float blue=1.0f, float alpha=1.0f)
 
bool operator== (const Color &rhs) const
 
bool operator!= (const Color &rhs) const
 
RGBA getAsRGBA (void) const
 
ARGB getAsARGB (void) const
 
BGRA getAsBGRA (void) const
 
ABGR getAsABGR (void) const
 
void setAsRGBA (const RGBA val)
 
void setAsARGB (const ARGB val)
 
void setAsBGRA (const BGRA val)
 
void setAsABGR (const ABGR val)
 
void saturate ()
 Clamps colour value to the range [0, 1]. More...
 
Color saturateCopy () const
 Clamps colour value to the range [0, 1]. More...
 
float operator[] (const UINT32 i) const
 
float & operator[] (const UINT32 i)
 
float * ptr ()
 Pointer accessor for direct copying. More...
 
const float * ptr () const
 Pointer accessor for direct copying. More...
 
Color operator+ (const Color &rhs) const
 
Color operator- (const Color &rhs) const
 
Color operator* (const float rhs) const
 
Color operator* (const Color &rhs) const
 
Color operator/ (const Color &rhs) const
 
Color operator/ (const float rhs) const
 
Coloroperator+= (const Color &rhs)
 
Coloroperator-= (const Color &rhs)
 
Coloroperator*= (const float rhs)
 
Coloroperator/= (const float rhs)
 
void setHSB (float hue, float saturation, float brightness)
 Set a colour value from Hue, Saturation and Brightness. More...
 
void getHSB (float *hue, float *saturation, float *brightness) const
 Convert the current color to Hue, Saturation and Brightness values. More...
 

Fields

float r
 
float g
 
float b
 
float a
 

Static fields

static const Color ZERO
 
static const Color Black
 
static const Color White
 
static const Color Red
 
static const Color Green
 
static const Color Blue
 

Method documentation

void getHSB ( float *  hue,
float *  saturation,
float *  brightness 
) const

Convert the current color to Hue, Saturation and Brightness values.

Parameters
[in]hueOutput hue value, scaled to the [0,1] range.
[in]saturationOutput saturation level, [0,1].
[in]brightnessOutput brightness level, [0,1].
float* ptr ( )

Pointer accessor for direct copying.

const float* ptr ( ) const

Pointer accessor for direct copying.

void saturate ( )

Clamps colour value to the range [0, 1].

Color saturateCopy ( ) const

Clamps colour value to the range [0, 1].

Returned saturated color as a copy.

void setHSB ( float  hue,
float  saturation,
float  brightness 
)

Set a colour value from Hue, Saturation and Brightness.

Parameters
[in]hueHue value, scaled to the [0,1] range.
[in]saturationSaturation level, [0,1].
[in]brightnessBrightness level, [0,1].