28#ifndef _COLOURVALUE_H__
29#define _COLOURVALUE_H__
70 float alpha = 1.0f ) :
r(red),
g(green),
b(blue),
a(alpha)
144 inline float operator [] (
const size_t i )
const
152 inline float& operator [] (
const size_t i )
165 inline const float*
ptr()
const
176 kSum.
r =
r + rkVector.
r;
177 kSum.
g =
g + rkVector.
g;
178 kSum.
b =
b + rkVector.
b;
179 kSum.
a =
a + rkVector.
a;
188 kDiff.
r =
r - rkVector.
r;
189 kDiff.
g =
g - rkVector.
g;
190 kDiff.
b =
b - rkVector.
b;
191 kDiff.
a =
a - rkVector.
a;
234 assert( fScalar != 0.0 );
238 float fInv = 1.0f / fScalar;
251 kProd.
r = fScalar * rkVector.
r;
252 kProd.
g = fScalar * rkVector.
g;
253 kProd.
b = fScalar * rkVector.
b;
254 kProd.
a = fScalar * rkVector.
a;
291 assert( fScalar != 0.0 );
293 float fInv = 1.0f / fScalar;
324 o <<
"ColourValue(" << c.r <<
", " << c.g <<
", " << c.b <<
", " << c.a <<
")";
static const ColourValue Green
void setAsRGBA(const RGBA val)
Sets colour as RGBA.
void setAsABGR(const ABGR val)
Sets colour as ABGR.
BGRA getAsBGRA(void) const
Retrieves colour as BGRA.
ABGR getAsABGR(void) const
Retrieves colours as ABGR.
void getHSB(Real *hue, Real *saturation, Real *brightness) const
Convert the current colour to Hue, Saturation and Brightness values.
void saturate(void)
Clamps colour value to the range [0, 1].
ARGB getAsARGB(void) const
Retrieves colour as ARGB.
void setHSB(Real hue, Real saturation, Real brightness)
Set a colour value from Hue, Saturation and Brightness.
float * ptr()
Pointer accessor for direct copying.
void setAsARGB(const ARGB val)
Sets colour as ARGB.
RGBA getAsRGBA(void) const
Retrieves colour as RGBA.
bool operator!=(const ColourValue &rhs) const
static const ColourValue Blue
bool operator==(const ColourValue &rhs) const
static const ColourValue Black
const float * ptr() const
Pointer accessor for direct copying.
static const ColourValue White
ColourValue saturateCopy(void) const
As saturate, except that this colour value is unaffected and the saturated colour value is returned a...
static const ColourValue Red
static const ColourValue ZERO
ColourValue(float red=1.0f, float green=1.0f, float blue=1.0f, float alpha=1.0f)
void setAsBGRA(const BGRA val)
Sets colour as BGRA.
float Real
Software floating point type.