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 () CY_CLASS_FUNCTION_DEFAULT Color24(Color24 const &c)
 
 Color24 (uint8_t _r, uint8_t _g, uint8_t _b)
 
 Color24 (Color const &c)
 
 Color24 (ColorA const &c)
 
 Color24 (Color32 const &c)
 
Conversion Methods
Color ToColor () const
 
ColorA ToColorA () const
 
Set & Get value functions
void SetBlack ()
 Sets r, g, and b components as zero.
 
void SetWhite ()
 Sets r, g, and b components as 255.
 
void Set (uint8_t _r, uint8_t _g, uint8_t _b)
 Sets r, g, and b components as given.
 
void Set (uint8_t const *v)
 Sets r, g, and b components using the values in the given array.
 
void GetValue (uint8_t *v) const
 Puts r, g, and b values into the array.
 
Gray-scale functions
int Sum () const
 Returns true if all components are exactly zero.
 
uint8_t Gray () const
 Returns true if all components are exactly zero.
 
bool IsBlack () const
 Returns true if all components are exactly zero.
 
uint8_t Min () const
 Returns true if all components are exactly zero.
 
uint8_t Max () const
 Returns true if all components are exactly zero.
 
Limit functions
void Clamp (uint8_t limitMin=0, uint8_t limitMax=255)
 
void ClampMin (uint8_t limitMin=0)
 
void ClampMax (uint8_t limitMax=255)
 
Test operators
bool operator== (Color24 const &c) const
 
bool operator!= (Color24 const &c) const
 
Access operators
uint8_t & operator[] (int i)
 
uint8_t operator[] (int i) const
 

Public Attributes

Color components
uint8_t r
 
uint8_t g
 
uint8_t b
 

Static Methods

static Color24 Black ()
 Returns a black color.
 
static Color24 White ()
 Returns a white color.
 
static uint8_t FloatToByte (float r)
 Returns a black color.
 
static uint8_t ClampInt (int v)
 Returns a black color.