Files Class List
Color24 Class Reference

Detailed Description

24-bit RGB color class with 3 unsigned byte components

#include <cyColor.h>

Public Member Functions

Constructors
 Color24 ()
 
 Color24 (const Color24 &c)
 
 Color24 (unsigned char _r, unsigned char _g, unsigned char _b)
 
 Color24 (const Color &c)
 
 Color24 (const ColorA &c)
 
 Color24 (const Color32 &c)
 
Conversion Methods
Color ToColor () const
 
ColorA ToColorA () const
 
Set & Get value functions
void SetBlack ()
 
void SetWhite ()
 
void Set (unsigned char _r, unsigned char _g, unsigned char _b)
 
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 Color24 &c) const
 
bool operator!= (const Color24 &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
 

Static Methods

static Color24 Black ()
 
static Color24 White ()
 
static unsigned char FloatToByte (float r)
 
static unsigned char ClampInt (int v)
 

Member Function Documentation

§ SetBlack()

void SetBlack ( )

Sets r, g, and b components as zero.

§ SetWhite()

void SetWhite ( )

Sets r, g, and b components as 255.

§ Set() [1/2]

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

Sets r, g, and b components as given.

§ Set() [2/2]

void Set ( const unsigned char *  v)

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

§ GetValue()

void GetValue ( unsigned char *  v) const

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

§ Black()

static Color24 Black ( )
static

Returns a black color.

§ White()

static Color24 White ( )
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.