Files Class List
Color32 Class Reference

Detailed Description

32-bit RGBA color class with 4 unsigned byte components

#include <cyColor.h>

Public Member Functions

Constructors
 Color32 ()
 
 Color32 (const Color32 &c)
 
 Color32 (unsigned char _r, unsigned char _g, unsigned char _b, unsigned char _a=255)
 
 Color32 (const Color &c, float _a=1.0f)
 
 Color32 (const ColorA &c)
 
 Color32 (const Color24 &c, unsigned char _a=255)
 
Conversion Methods
Color ToColor () const
 
ColorA ToColorA () const
 
Set & Get value functions
void SetBlack (unsigned char _a=255)
 
void SetWhite (unsigned char _a=255)
 
void Set (unsigned char _r, unsigned char _g, unsigned char _b, unsigned char _a)
 
void Set (const unsigned char *v)
 
void GetValue (unsigned char *v) const
 
Gray-scale functions
int Sum () const
 
unsigned char Gray () const
 
Limit functions
void Clamp (unsigned char limitMin=0, unsigned char limitMax=255)
 
void ClampMin (unsigned char limitMin=0)
 
void ClampMax (unsigned char limitMax=255)
 
Test operators
bool operator== (const Color32 &c) const
 
bool operator!= (const Color32 &c) const
 
Access operators
unsigned char & operator[] (int i)
 
unsigned char operator[] (int i) const
 

Public Attributes

Color components
unsigned char r
 
unsigned char g
 
unsigned char b
 
unsigned char a
 

Static Methods

static Color32 Black (unsigned char alpha=255)
 
static Color32 White (unsigned char alpha=255)
 
static unsigned char FloatToByte (float r)
 
static unsigned char ClampInt (int v)
 

Member Function Documentation

§ SetBlack()

void SetBlack ( unsigned char  _a = 255)

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

§ SetWhite()

void SetWhite ( unsigned char  _a = 255)

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

§ Set() [1/2]

void Set ( unsigned char  _r,
unsigned char  _g,
unsigned char  _b,
unsigned char  _a 
)

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

§ Set() [2/2]

void Set ( const unsigned char *  v)

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

§ GetValue()

void GetValue ( unsigned char *  v) const

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

§ Black()

static Color32 Black ( unsigned char  alpha = 255)
static

Returns a black color.

§ White()

static Color32 White ( unsigned char  alpha = 255)
static

Returns a white color.

§ FloatToByte()

static unsigned char FloatToByte ( float  r)
staticprotected

Returns a black color.

§ ClampInt()

static unsigned char ClampInt ( int  v)
staticprotected

Returns a black color.