Files Class List
ColorA Class Reference

Detailed Description

RGBA color class with 4 float components.

#include <cyColor.h>

Public Member Functions

Constructors
 ColorA ()
 
 ColorA (const ColorA &c)
 
 ColorA (float _r, float _g, float _b, float _a=1)
 
 ColorA (const float *c)
 
 ColorA (float rgb, float _a=1)
 
 ColorA (const Color &c, float _a=1)
 
 ColorA (const Color24 &c, float _a=1)
 
 ColorA (const Color32 &c)
 
Set & Get value functions
void SetBlack (float alpha=1.0f)
 
void SetWhite (float alpha=1.0f)
 
void Set (float _r, float _g, float _b, float _a=1)
 
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
ColorA operator- () const
 
Binary operators
ColorA operator+ (const ColorA &c) const
 
ColorA operator- (const ColorA &c) const
 
ColorA operator* (const ColorA &c) const
 
ColorA operator/ (const ColorA &c) const
 
ColorA operator+ (float n) const
 
ColorA operator- (float n) const
 
ColorA operator* (float n) const
 
ColorA operator/ (float n) const
 
Assignment operators
ColorAoperator+= (const ColorA &c)
 
ColorAoperator-= (const ColorA &c)
 
ColorAoperator*= (const ColorA &c)
 
ColorAoperator/= (const ColorA &c)
 
ColorAoperator+= (float n)
 
ColorAoperator-= (float n)
 
ColorAoperator*= (float n)
 
ColorAoperator/= (float n)
 
Test operators
bool operator== (const ColorA &c) const
 
bool operator!= (const ColorA &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)
 
static ColorA White (float alpha=1.0f)
 

Public Attributes

Color components
float r
 
float g
 
float b
 
float a
 

Friends

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

Member Function Documentation

§ SetBlack()

void SetBlack ( float  alpha = 1.0f)

Sets r, g, and b components as zero and a component as given.

§ SetWhite()

void SetWhite ( float  alpha = 1.0f)

Sets r, g, and b components as one and a component as given.

§ Set() [1/2]

void Set ( float  _r,
float  _g,
float  _b,
float  _a = 1 
)

Sets r, g, b and a components as given.

§ Set() [2/2]

void Set ( const float *  v)

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

§ GetValue()

void GetValue ( float *  v) const

Puts r, g, b and a values into the array.

§ Black()

static ColorA Black ( float  alpha = 1.0f)
static

Returns a black color.

§ White()

static ColorA White ( float  alpha = 1.0f)
static

Returns a white color.

Friends And Related Function Documentation

§ operator+

ColorA operator+ ( const float  v,
const ColorA c 
)
friend

Addition with a constant.

§ operator-

ColorA operator- ( const float  v,
const ColorA c 
)
friend

Subtraction from a constant.

§ operator*

ColorA operator* ( const float  v,
const ColorA c 
)
friend

Multiplication with a constant.