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 () CY_CLASS_FUNCTION_DEFAULT Color32(Color32 const &c)
 
 Color32 (uint8_t _r, uint8_t _g, uint8_t _b, uint8_t _a=255)
 
 Color32 (Color const &c, float _a=1.0f)
 
 Color32 (ColorA const &c)
 
 Color32 (Color24 const &c, uint8_t _a=255)
 
Conversion Methods
Color ToColor () const
 
ColorA ToColorA () const
 
Set & Get value functions
void SetBlack (uint8_t _a=255)
 Sets r, g, and b components as zero and a component as given.
 
void SetWhite (uint8_t _a=255)
 Sets r, g, and b components as 255 and a component as given.
 
void Set (uint8_t _r, uint8_t _g, uint8_t _b, uint8_t _a)
 Sets r, g, b and a components as given.
 
void Set (uint8_t const *v)
 Sets r, g, b and a components using the values in the given array.
 
void GetValue (uint8_t *v) const
 Puts r, g, b and a values into the array.
 
Gray-scale functions
int Sum () const
 Returns true if the r, g, and b components are exactly zero.
 
uint8_t Gray () 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.
 
uint8_t Min () const
 Returns true if the r, g, and b components are exactly zero.
 
uint8_t Max () const
 Returns true if the r, g, and b 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== (Color32 const &c) const
 
bool operator!= (Color32 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
 
uint8_t a
 

Static Methods

static Color32 Black (uint8_t alpha=255)
 Returns a black color.
 
static Color32 White (uint8_t alpha=255)
 Returns a white color.
 
static uint8_t FloatToByte (float r)
 Returns a black color.
 
static uint8_t ClampInt (int v)
 Returns a black color.