ClanLib  2.3.7
List of all members
CL_Color Class Reference

Color description class. More...

#include <color.h>

Public Member Functions

Construction
 CL_Color ()
 Constructs a color. More...
 
 CL_Color (const CL_Colord &)
 
 CL_Color (const CL_Colorf &)
 
 CL_Color (unsigned int red, unsigned int green, unsigned int blue, unsigned int alpha=255)
 Constructs a color. More...
 
 CL_Color (const CL_StringRef &hexstr)
 Constructs a color. More...
 
Operations
void set_alpha (unsigned int value)
 Set alpha color component, in the range 0-255. More...
 
void set_red (unsigned int value)
 Set red color component, in the range 0-255. More...
 
void set_green (unsigned int value)
 Set green color component, in the range 0-255. More...
 
void set_blue (unsigned int value)
 Set blue color component, in the range 0-255. More...
 
void set_alpha_d (float value)
 Set alpha color component, in the range 0-1. More...
 
void set_red_d (float value)
 Set red color component, in the range 0-1. More...
 
void set_green_d (float value)
 Set green color component, in the range 0-1. More...
 
void set_blue_d (float value)
 Set blue color component, in the range 0-1. More...
 
void set_color (unsigned int red, unsigned int green, unsigned int blue, unsigned int alpha=255)
 Set color based on rgba color components in the range 0-255. More...
 
void set_color_d (float red, float green, float blue, float alpha=1.0)
 Set color based on rgba color components in the range 0-1. More...
 

Attributes

unsigned int color
 Color in ARGB8888 format. More...
 
unsigned int get_alpha () const
 Returns the alpha color component, in the range 0-255. More...
 
unsigned int get_red () const
 Returns the red color component, in the range 0-255. More...
 
unsigned int get_green () const
 Returns the green color component, in the range 0-255. More...
 
unsigned int get_blue () const
 Returns the blue color component, in the range 0-255. More...
 
double get_alpha_d () const
 Returns the alpha color component, in the range 0-1. More...
 
double get_red_d () const
 Returns the red color component, in the range 0-1. More...
 
double get_green_d () const
 Returns the green color component, in the range 0-1. More...
 
double get_blue_d () const
 Returns the blue color component, in the range 0-1. More...
 
float get_alpha_f () const
 Returns the alpha color component, in the range 0-1. More...
 
float get_red_f () const
 Returns the red color component, in the range 0-1. More...
 
float get_green_f () const
 Returns the green color component, in the range 0-1. More...
 
float get_blue_f () const
 Returns the blue color component, in the range 0-1. More...
 
bool operator== (const CL_Color &c) const
 Color == Color operator (deep compare) More...
 
bool operator!= (const CL_Color &c) const
 Color != Color operator (deep compare) More...
 

Statics

static CL_Color aliceblue
 
static CL_Color antiquewhite
 
static CL_Color aqua
 
static CL_Color aquamarine
 
static CL_Color azure
 
static CL_Color beige
 
static CL_Color bisque
 
static CL_Color black
 
static CL_Color blanchedalmond
 
static CL_Color blue
 
static CL_Color blueviolet
 
static CL_Color brown
 
static CL_Color burlywood
 
static CL_Color cadetblue
 
static CL_Color chartreuse
 
static CL_Color chocolate
 
static CL_Color coral
 
static CL_Color cornflowerblue
 
static CL_Color cornsilk
 
static CL_Color crimson
 
static CL_Color cyan
 
static CL_Color darkblue
 
static CL_Color darkcyan
 
static CL_Color darkgoldenrod
 
static CL_Color darkgray
 
static CL_Color darkgreen
 
static CL_Color darkgrey
 
static CL_Color darkkhaki
 
static CL_Color darkmagenta
 
static CL_Color darkolivegreen
 
static CL_Color darkorange
 
static CL_Color darkorchid
 
static CL_Color darkred
 
static CL_Color darksalmon
 
static CL_Color darkseagreen
 
static CL_Color darkslateblue
 
static CL_Color darkslategray
 
static CL_Color darkslategrey
 
static CL_Color darkturquoise
 
static CL_Color darkviolet
 
static CL_Color deeppink
 
static CL_Color deepskyblue
 
static CL_Color dimgray
 
static CL_Color dimgrey
 
static CL_Color dodgerblue
 
static CL_Color firebrick
 
static CL_Color floralwhite
 
static CL_Color forestgreen
 
static CL_Color fuchsia
 
static CL_Color gainsboro
 
static CL_Color ghostwhite
 
static CL_Color gold
 
static CL_Color goldenrod
 
static CL_Color gray
 
static CL_Color grey
 
static CL_Color green
 
static CL_Color greenyellow
 
static CL_Color honeydew
 
static CL_Color hotpink
 
static CL_Color indianred
 
static CL_Color indigo
 
static CL_Color ivory
 
static CL_Color khaki
 
static CL_Color lavender
 
static CL_Color lavenderblush
 
static CL_Color lawngreen
 
static CL_Color lemonchiffon
 
static CL_Color lightblue
 
static CL_Color lightcoral
 
static CL_Color lightcyan
 
static CL_Color lightgoldenrodyellow
 
static CL_Color lightgray
 
static CL_Color lightgreen
 
static CL_Color lightgrey
 
static CL_Color lightpink
 
static CL_Color lightsalmon
 
static CL_Color lightseagreen
 
static CL_Color lightskyblue
 
static CL_Color lightslategray
 
static CL_Color lightslategrey
 
static CL_Color lightsteelblue
 
static CL_Color lightyellow
 
static CL_Color lime
 
static CL_Color limegreen
 
static CL_Color linen
 
static CL_Color magenta
 
static CL_Color maroon
 
static CL_Color mediumaquamarine
 
static CL_Color mediumblue
 
static CL_Color mediumorchid
 
static CL_Color mediumpurple
 
static CL_Color mediumseagreen
 
static CL_Color mediumslateblue
 
static CL_Color mediumspringgreen
 
static CL_Color mediumturquoise
 
static CL_Color mediumvioletred
 
static CL_Color midnightblue
 
static CL_Color mintcream
 
static CL_Color mistyrose
 
static CL_Color moccasin
 
static CL_Color navajowhite
 
static CL_Color navy
 
static CL_Color oldlace
 
static CL_Color olive
 
static CL_Color olivedrab
 
static CL_Color orange
 
static CL_Color orangered
 
static CL_Color orchid
 
static CL_Color palegoldenrod
 
static CL_Color palegreen
 
static CL_Color paleturquoise
 
static CL_Color palevioletred
 
static CL_Color papayawhip
 
static CL_Color peachpuff
 
static CL_Color peru
 
static CL_Color pink
 
static CL_Color plum
 
static CL_Color powderblue
 
static CL_Color purple
 
static CL_Color red
 
static CL_Color rosybrown
 
static CL_Color royalblue
 
static CL_Color saddlebrown
 
static CL_Color salmon
 
static CL_Color sandybrown
 
static CL_Color seagreen
 
static CL_Color seashell
 
static CL_Color sienna
 
static CL_Color silver
 
static CL_Color skyblue
 
static CL_Color slateblue
 
static CL_Color slategray
 
static CL_Color slategrey
 
static CL_Color snow
 
static CL_Color springgreen
 
static CL_Color steelblue
 
static CL_Color tan
 
static CL_Color teal
 
static CL_Color thistle
 
static CL_Color tomato
 
static CL_Color turquoise
 
static CL_Color violet
 
static CL_Color wheat
 
static CL_Color white
 
static CL_Color whitesmoke
 
static CL_Color yellow
 
static CL_Color yellowgreen
 
static CL_Color transparent
 rgba(0, 0, 0, 0). More...
 
static CL_Color gray10
 
static CL_Color gray20
 
static CL_Color gray30
 
static CL_Color gray40
 
static CL_Color gray50
 
static CL_Color gray60
 
static CL_Color gray70
 
static CL_Color gray80
 
static CL_Color gray90
 
static CL_Color find_color (const CL_StringRef &name)
 Find and returns the static color matching a string. More...
 
static std::vector< CL_String8 > & get_names ()
 Returns the names of static colors defined. More...
 

Detailed Description

Color description class.

Constructor & Destructor Documentation

CL_Color::CL_Color ( )
inline

Constructs a color.

CL_Color::CL_Color ( const CL_Colord )
explicit
CL_Color::CL_Color ( const CL_Colorf )
explicit
CL_Color::CL_Color ( unsigned int  red,
unsigned int  green,
unsigned int  blue,
unsigned int  alpha = 255 
)
inline

Constructs a color.

Color components are specified in the range 0 to 255.
An alpha value of 0 means complete transparency, while 255 means completely opaque (solid).

Parameters
redRed color component.
greenGreen color component.
blueBlue color component.
alphaAlpha (transparency) color component.
CL_Color::CL_Color ( const CL_StringRef hexstr)

Constructs a color.

Color components are specified in the range 0 to 255.
An alpha value of 0 means complete transparency, while 255 means completely opaque (solid).

Parameters
hexstrThe colors rgba components as a hexadecimal string of the format "#rrggbbaa", where the '#' and "aa" parts are optional.

Member Function Documentation

static CL_Color CL_Color::find_color ( const CL_StringRef name)
static

Find and returns the static color matching a string.

Parameters
nameName of color to match, eg. "blue".
Returns
Reference to matching static color, or transparent (rgba(0,0,0,0)) if there was no match.

Referenced by CL_Colord::CL_Colord(), and CL_Colorf::CL_Colorf().

unsigned int CL_Color::get_alpha ( ) const
inline

Returns the alpha color component, in the range 0-255.

Referenced by CL_Image::set_color(), and CL_Sprite::set_color().

double CL_Color::get_alpha_d ( ) const
inline

Returns the alpha color component, in the range 0-1.

float CL_Color::get_alpha_f ( ) const
inline

Returns the alpha color component, in the range 0-1.

unsigned int CL_Color::get_blue ( ) const
inline

Returns the blue color component, in the range 0-255.

Referenced by CL_Image::set_color(), and CL_Sprite::set_color().

double CL_Color::get_blue_d ( ) const
inline

Returns the blue color component, in the range 0-1.

float CL_Color::get_blue_f ( ) const
inline

Returns the blue color component, in the range 0-1.

unsigned int CL_Color::get_green ( ) const
inline

Returns the green color component, in the range 0-255.

Referenced by CL_Image::set_color(), and CL_Sprite::set_color().

double CL_Color::get_green_d ( ) const
inline

Returns the green color component, in the range 0-1.

float CL_Color::get_green_f ( ) const
inline

Returns the green color component, in the range 0-1.

static std::vector<CL_String8>& CL_Color::get_names ( )
static

Returns the names of static colors defined.

unsigned int CL_Color::get_red ( ) const
inline

Returns the red color component, in the range 0-255.

Referenced by CL_Image::set_color(), and CL_Sprite::set_color().

double CL_Color::get_red_d ( ) const
inline

Returns the red color component, in the range 0-1.

float CL_Color::get_red_f ( ) const
inline

Returns the red color component, in the range 0-1.

bool CL_Color::operator!= ( const CL_Color c) const
inline

Color != Color operator (deep compare)

References color.

bool CL_Color::operator== ( const CL_Color c) const
inline

Color == Color operator (deep compare)

References color.

void CL_Color::set_alpha ( unsigned int  value)
inline

Set alpha color component, in the range 0-255.

void CL_Color::set_alpha_d ( float  value)
inline

Set alpha color component, in the range 0-1.

void CL_Color::set_blue ( unsigned int  value)
inline

Set blue color component, in the range 0-255.

void CL_Color::set_blue_d ( float  value)
inline

Set blue color component, in the range 0-1.

void CL_Color::set_color ( unsigned int  red,
unsigned int  green,
unsigned int  blue,
unsigned int  alpha = 255 
)
inline

Set color based on rgba color components in the range 0-255.

void CL_Color::set_color_d ( float  red,
float  green,
float  blue,
float  alpha = 1.0 
)
inline

Set color based on rgba color components in the range 0-1.

void CL_Color::set_green ( unsigned int  value)
inline

Set green color component, in the range 0-255.

void CL_Color::set_green_d ( float  value)
inline

Set green color component, in the range 0-1.

void CL_Color::set_red ( unsigned int  value)
inline

Set red color component, in the range 0-255.

void CL_Color::set_red_d ( float  value)
inline

Set red color component, in the range 0-1.

Member Data Documentation

CL_Color CL_Color::aliceblue
static

rgb(240, 248, 255).

CL_Color CL_Color::antiquewhite
static

rgb(250, 235, 215).

CL_Color CL_Color::aqua
static

rgb( 0, 255, 255).

CL_Color CL_Color::aquamarine
static

rgb(127, 255, 212).

CL_Color CL_Color::azure
static

rgb(240, 255, 255).

CL_Color CL_Color::beige
static

rgb(245, 245, 220).

CL_Color CL_Color::bisque
static

rgb(255, 228, 196).

CL_Color CL_Color::black
static

rgb( 0, 0, 0).

CL_Color CL_Color::blanchedalmond
static

rgb(255, 235, 205).

CL_Color CL_Color::blue
static

rgb( 0, 0, 255).

CL_Color CL_Color::blueviolet
static

rgb(138, 43, 226).

CL_Color CL_Color::brown
static

rgb(165, 42, 42).

CL_Color CL_Color::burlywood
static

rgb(222, 184, 135).

CL_Color CL_Color::cadetblue
static

rgb( 95, 158, 160).

CL_Color CL_Color::chartreuse
static

rgb(127, 255, 0).

CL_Color CL_Color::chocolate
static

rgb(210, 105, 30).

unsigned int CL_Color::color

Color in ARGB8888 format.

Referenced by operator!=(), and operator==().

CL_Color CL_Color::coral
static

rgb(255, 127, 80).

CL_Color CL_Color::cornflowerblue
static

rgb(100, 149, 237).

CL_Color CL_Color::cornsilk
static

rgb(255, 248, 220).

CL_Color CL_Color::crimson
static

rgb(220, 20, 60).

CL_Color CL_Color::cyan
static

rgb( 0, 255, 255).

CL_Color CL_Color::darkblue
static

rgb( 0, 0, 139).

CL_Color CL_Color::darkcyan
static

rgb( 0, 139, 139).

CL_Color CL_Color::darkgoldenrod
static

rgb(184, 134, 11).

CL_Color CL_Color::darkgray
static

rgb(169, 169, 169).

CL_Color CL_Color::darkgreen
static

rgb( 0, 100, 0).

CL_Color CL_Color::darkgrey
static

rgb(169, 169, 169).

CL_Color CL_Color::darkkhaki
static

rgb(189, 183, 107).

CL_Color CL_Color::darkmagenta
static

rgb(139, 0, 139).

CL_Color CL_Color::darkolivegreen
static

rgb( 85, 107, 47).

CL_Color CL_Color::darkorange
static

rgb(255, 140, 0).

CL_Color CL_Color::darkorchid
static

rgb(153, 50, 204).

CL_Color CL_Color::darkred
static

rgb(139, 0, 0).

CL_Color CL_Color::darksalmon
static

rgb(233, 150, 122).

CL_Color CL_Color::darkseagreen
static

rgb(143, 188, 143).

CL_Color CL_Color::darkslateblue
static

rgb( 72, 61, 139).

CL_Color CL_Color::darkslategray
static

rgb( 47, 79, 79).

CL_Color CL_Color::darkslategrey
static

rgb( 47, 79, 79).

CL_Color CL_Color::darkturquoise
static

rgb( 0, 206, 209).

CL_Color CL_Color::darkviolet
static

rgb(148, 0, 211).

CL_Color CL_Color::deeppink
static

rgb(255, 20, 147).

CL_Color CL_Color::deepskyblue
static

rgb( 0, 191, 255).

CL_Color CL_Color::dimgray
static

rgb(105, 105, 105).

CL_Color CL_Color::dimgrey
static

rgb(105, 105, 105).

CL_Color CL_Color::dodgerblue
static

rgb( 30, 144, 255).

CL_Color CL_Color::firebrick
static

rgb(178, 34, 34).

CL_Color CL_Color::floralwhite
static

rgb(255, 250, 240).

CL_Color CL_Color::forestgreen
static

rgb( 34, 139, 34).

CL_Color CL_Color::fuchsia
static

rgb(255, 0, 255).

CL_Color CL_Color::gainsboro
static

rgb(220, 220, 220).

CL_Color CL_Color::ghostwhite
static

rgb(248, 248, 255).

CL_Color CL_Color::gold
static

rgb(255, 215, 0).

CL_Color CL_Color::goldenrod
static

rgb(218, 165, 32).

CL_Color CL_Color::gray
static

rgb(128, 128, 128).

CL_Color CL_Color::gray10
static
CL_Color CL_Color::gray20
static
CL_Color CL_Color::gray30
static
CL_Color CL_Color::gray40
static
CL_Color CL_Color::gray50
static
CL_Color CL_Color::gray60
static
CL_Color CL_Color::gray70
static
CL_Color CL_Color::gray80
static
CL_Color CL_Color::gray90
static
CL_Color CL_Color::green
static

rgb( 0, 128, 0).

CL_Color CL_Color::greenyellow
static

rgb(173, 255, 47).

CL_Color CL_Color::grey
static

rgb(128, 128, 128).

CL_Color CL_Color::honeydew
static

rgb(240, 255, 240).

CL_Color CL_Color::hotpink
static

rgb(255, 105, 180).

CL_Color CL_Color::indianred
static

rgb(205, 92, 92).

CL_Color CL_Color::indigo
static

rgb( 75, 0, 130).

CL_Color CL_Color::ivory
static

rgb(255, 255, 240).

CL_Color CL_Color::khaki
static

rgb(240, 230, 140).

CL_Color CL_Color::lavender
static

rgb(230, 230, 250).

CL_Color CL_Color::lavenderblush
static

rgb(255, 240, 245).

CL_Color CL_Color::lawngreen
static

rgb(124, 252, 0).

CL_Color CL_Color::lemonchiffon
static

rgb(255, 250, 205).

CL_Color CL_Color::lightblue
static

rgb(173, 216, 230).

CL_Color CL_Color::lightcoral
static

rgb(240, 128, 128).

CL_Color CL_Color::lightcyan
static

rgb(224, 255, 255).

CL_Color CL_Color::lightgoldenrodyellow
static

rgb(250, 250, 210).

CL_Color CL_Color::lightgray
static

rgb(211, 211, 211).

CL_Color CL_Color::lightgreen
static

rgb(144, 238, 144).

CL_Color CL_Color::lightgrey
static

rgb(211, 211, 211).

CL_Color CL_Color::lightpink
static

rgb(255, 182, 193).

CL_Color CL_Color::lightsalmon
static

rgb(255, 160, 122).

CL_Color CL_Color::lightseagreen
static

rgb( 32, 178, 170).

CL_Color CL_Color::lightskyblue
static

rgb(135, 206, 250).

CL_Color CL_Color::lightslategray
static

rgb(119, 136, 153).

CL_Color CL_Color::lightslategrey
static

rgb(119, 136, 153).

CL_Color CL_Color::lightsteelblue
static

rgb(176, 196, 222).

CL_Color CL_Color::lightyellow
static

rgb(255, 255, 224).

CL_Color CL_Color::lime
static

rgb( 0, 255, 0).

CL_Color CL_Color::limegreen
static

rgb( 50, 205, 50).

CL_Color CL_Color::linen
static

rgb(250, 240, 230).

CL_Color CL_Color::magenta
static

rgb(255, 0, 255).

CL_Color CL_Color::maroon
static

rgb(128, 0, 0).

CL_Color CL_Color::mediumaquamarine
static

rgb(102, 205, 170).

CL_Color CL_Color::mediumblue
static

rgb( 0, 0, 205).

CL_Color CL_Color::mediumorchid
static

rgb(186, 85, 211).

CL_Color CL_Color::mediumpurple
static

rgb(147, 112, 219).

CL_Color CL_Color::mediumseagreen
static

rgb( 60, 179, 113).

CL_Color CL_Color::mediumslateblue
static

rgb(123, 104, 238).

CL_Color CL_Color::mediumspringgreen
static

rgb( 0, 250, 154).

CL_Color CL_Color::mediumturquoise
static

rgb( 72, 209, 204).

CL_Color CL_Color::mediumvioletred
static

rgb(199, 21, 133).

CL_Color CL_Color::midnightblue
static

rgb( 25, 25, 112).

CL_Color CL_Color::mintcream
static

rgb(245, 255, 250).

CL_Color CL_Color::mistyrose
static

rgb(255, 228, 225).

CL_Color CL_Color::moccasin
static

rgb(255, 228, 181).

CL_Color CL_Color::navajowhite
static

rgb(255, 222, 173).

CL_Color CL_Color::navy
static

rgb( 0, 0, 128).

CL_Color CL_Color::oldlace
static

rgb(253, 245, 230).

CL_Color CL_Color::olive
static

rgb(128, 128, 0).

CL_Color CL_Color::olivedrab
static

rgb(107, 142, 35).

CL_Color CL_Color::orange
static

rgb(255, 165, 0).

CL_Color CL_Color::orangered
static

rgb(255, 69, 0).

CL_Color CL_Color::orchid
static

rgb(218, 112, 214).

CL_Color CL_Color::palegoldenrod
static

rgb(238, 232, 170).

CL_Color CL_Color::palegreen
static

rgb(152, 251, 152).

CL_Color CL_Color::paleturquoise
static

rgb(175, 238, 238).

CL_Color CL_Color::palevioletred
static

rgb(219, 112, 147).

CL_Color CL_Color::papayawhip
static

rgb(255, 239, 213).

CL_Color CL_Color::peachpuff
static

rgb(255, 218, 185).

CL_Color CL_Color::peru
static

rgb(205, 133, 63).

CL_Color CL_Color::pink
static

rgb(255, 192, 203).

CL_Color CL_Color::plum
static

rgb(221, 160, 221).

CL_Color CL_Color::powderblue
static

rgb(176, 224, 230).

CL_Color CL_Color::purple
static

rgb(128, 0, 128).

CL_Color CL_Color::red
static

rgb(255, 0, 0).

CL_Color CL_Color::rosybrown
static

rgb(188, 143, 143).

CL_Color CL_Color::royalblue
static

rgb( 65, 105, 225).

CL_Color CL_Color::saddlebrown
static

rgb(139, 69, 19).

CL_Color CL_Color::salmon
static

rgb(250, 128, 114).

CL_Color CL_Color::sandybrown
static

rgb(244, 164, 96).

CL_Color CL_Color::seagreen
static

rgb( 46, 139, 87).

CL_Color CL_Color::seashell
static

rgb(255, 245, 238).

CL_Color CL_Color::sienna
static

rgb(160, 82, 45).

CL_Color CL_Color::silver
static

rgb(192, 192, 192).

CL_Color CL_Color::skyblue
static

rgb(135, 206, 235).

CL_Color CL_Color::slateblue
static

rgb(106, 90, 205).

CL_Color CL_Color::slategray
static

rgb(112, 128, 144).

CL_Color CL_Color::slategrey
static

rgb(112, 128, 144).

CL_Color CL_Color::snow
static

rgb(255, 250, 250).

CL_Color CL_Color::springgreen
static

rgb( 0, 255, 127).

CL_Color CL_Color::steelblue
static

rgb( 70, 130, 180).

CL_Color CL_Color::tan
static

rgb(210, 180, 140).

CL_Color CL_Color::teal
static

rgb( 0, 128, 128).

CL_Color CL_Color::thistle
static

rgb(216, 191, 216).

CL_Color CL_Color::tomato
static

rgb(255, 99, 71).

CL_Color CL_Color::transparent
static

rgba(0, 0, 0, 0).

CL_Color CL_Color::turquoise
static

rgb( 64, 224, 208).

CL_Color CL_Color::violet
static

rgb(238, 130, 238).

CL_Color CL_Color::wheat
static

rgb(245, 222, 179).

CL_Color CL_Color::white
static

rgb(255, 255, 255).

CL_Color CL_Color::whitesmoke
static

rgb(245, 245, 245).

CL_Color CL_Color::yellow
static

rgb(255, 255, 0).

CL_Color CL_Color::yellowgreen
static

rgb(154, 205, 50).


The documentation for this class was generated from the following file: