Files Class List
ColorA Class Reference

Detailed Description

RGBA color class with 4 float components.

#include <cyColor.h>

Public Member Functions

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

Static Public Member Functions

Static Methods
static ColorA Black (float alpha=1.0f)
 Returns a black color.
 
static ColorA White (float alpha=1.0f)
 Returns a white color.
 

Public Attributes

Color components
float r
 
float g
 
float b
 
float a
 

Friends

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