Files Class List
Color Class Reference

Detailed Description

RGB color class with 3 float components.

#include <cyColor.h>

Public Member Functions

 Color ()
 Color (const Color &c)
 Color (float _r, float _g, float _b)
 Color (const float *c)
 Color (float rgb)
 Color (const ColorA &c)
 Color (const Color24 &c)
 Color (const Color32 &c)
Set & Get value functions
void SetBlack ()
void SetWhite ()
void Set (float _r, float _g, float _b)
void Set (const float *v)
void GetValue (float *v) const
Gray-scale functions
float Sum () const
float Gray () const
float Luma1 () const
float Luma2 () const
Limit functions
void Clamp (float limitMin=0.0f, float limitMax=1.0f)
void ClampMin (float limitMin=0.0f)
void ClampMax (float limitMax=1.0f)
void Abs ()
Unary operators
Color operator- () const
Binary operators
Color operator+ (const Color &c) const
Color operator- (const Color &c) const
Color operator* (const Color &c) const
Color operator/ (const Color &c) const
Color operator+ (float n) const
Color operator- (float n) const
Color operator* (float n) const
Color operator/ (float n) const
Assignment operators
Coloroperator+= (const Color &c)
Coloroperator-= (const Color &c)
Coloroperator*= (const Color &c)
Coloroperator/= (const Color &c)
Coloroperator+= (float n)
Coloroperator-= (float n)
Coloroperator*= (float n)
Coloroperator/= (float n)
Test operators
bool operator== (const Color &c) const
bool operator!= (const Color &c) const
Access operators
float & operator[] (int i)
float operator[] (int i) const

Static Public Member Functions

Static Methods
static Color Black ()
static Color White ()

Public Attributes

Color components
float r
float g
float b


Color operator+ (const float v, const Color &c)
Color operator- (const float v, const Color &c)
Color operator* (const float v, const Color &c)

Member Function Documentation

§ SetBlack()

void SetBlack ( )

Sets r, g and b components as zero.

§ SetWhite()

void SetWhite ( )

Sets r, g and b components as one.

§ Set() [1/2]

void Set ( float  _r,
float  _g,
float  _b 

Sets r, g and b components as given.

§ Set() [2/2]

void Set ( const float *  v)

Sets r, g and b components using the values in the given array.

§ GetValue()

void GetValue ( float *  v) const

Puts r, g and b values into the array.

§ Black()

static Color Black ( )

Returns a black color.

§ White()

static Color White ( )

Returns a white color.

Friends And Related Function Documentation

§ operator+

Color operator+ ( const float  v,
const Color c 

Addition with a constant.

§ operator-

Color operator- ( const float  v,
const Color c 

Subtraction from a constant.

§ operator*

Color operator* ( const float  v,
const Color c 

Multiplication with a constant.