Files Class List
Color Class Reference

Detailed Description

RGB color class with 3 float components.

#include <cyColor.h>

Public Member Functions

Constructors
 Color (Color const &c)
 
 Color (float _r, float _g, float _b)
 
 Color (float const *c)
 
 Color (float rgb)
 
 Color (ColorA const &c)
 
 Color (Color24 const &c)
 
 Color (Color32 const &c)
 
Set & Get value functions
void SetBlack ()
 Sets r, g and b components as zero.
 
void SetWhite ()
 Sets r, g and b components as one.
 
void Set (float _r, float _g, float _b)
 Sets r, g and b components as given.
 
void Set (float const *v)
 Sets r, g and b components using the values in the given array.
 
void GetValue (float *v) const
 Puts r, g and b values into the array.
 
Gray-scale functions
float Sum () const
 Returns true if all components are exactly zero.
 
float Gray () const
 Returns true if all components are exactly zero.
 
float Luma1 () const
 Returns true if all components are exactly zero.
 
float Luma2 () const
 Returns true if all components are exactly zero.
 
bool IsBlack () const
 Returns true if all components are exactly zero.
 
float Min () const
 Returns true if all components are exactly zero.
 
float Max () const
 Returns true if all components are exactly zero.
 
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+ (Color const &c) const
 
Color operator- (Color const &c) const
 
Color operator* (Color const &c) const
 
Color operator/ (Color const &c) const
 
Color operator+ (float const &n) const
 
Color operator- (float const &n) const
 
Color operator* (float const &n) const
 
Color operator/ (float const &n) const
 
Assignment operators
Coloroperator+= (Color const &c)
 
Coloroperator-= (Color const &c)
 
Coloroperator*= (Color const &c)
 
Coloroperator/= (Color const &c)
 
Coloroperator+= (float const &n)
 
Coloroperator-= (float const &n)
 
Coloroperator*= (float const &n)
 
Coloroperator/= (float const &n)
 
Test operators
bool operator== (Color const &c) const
 
bool operator!= (Color const &c) const
 
Access operators
float & operator[] (int i)
 
float operator[] (int i) const
 

Static Public Member Functions

Static Methods
static Color Black ()
 Returns a black color.
 
static Color White ()
 Returns a white color.
 

Public Attributes

Color components
float r
 
float g
 
float b
 

Friends

Color operator+ (float const &v, Color const &c)
 Addition with a constant.
 
Color operator- (float const &v, Color const &c)
 Subtraction from a constant.
 
Color operator* (float const &v, Color const &c)
 Multiplication with a constant.