Public Member Functions | |
color () | |
Generate a color, value=(0,0,0)=black. | |
color (octet r, octet g, octet b) | |
Direct constructor with values. | |
color (int r, int g, int b) | |
Direct constructor with values as integer (truncated in [0,255]) | |
int | red () const |
get the red value | |
int | green () const |
get the green value | |
int | blue () const |
get the blue value | |
octet & | red () |
set the red value | |
octet & | green () |
set the green value | |
octet & | blue () |
set the blue value | |
std::string | to_string () const |
convert the color into string | |
Static Public Member Functions | |
static double | norm (const color &c1, const color &c2) |
Compute the norm between two colors. | |
Private Attributes | |
octet | r |
internal storage for red component | |
octet | g |
internal storage for green component | |
octet | b |
internal storage for blue component | |
Storage class for a color Store the color as (r,g,b) value. Each component belongs in [0,255]
cpe::color::color | ( | int | r, |
int | g, | ||
int | b | ||
) |
int cpe::color::blue | ( | ) | const |
int cpe::color::green | ( | ) | const |
int cpe::color::red | ( | ) | const |
std::string cpe::color::to_string | ( | ) | const |
convert the color into string
Referenced by cpe::operator<<().
|
private |
internal storage for blue component
Referenced by blue(), color(), and to_string().
|
private |
internal storage for green component
Referenced by color(), green(), and to_string().
|
private |
internal storage for red component
Referenced by color(), red(), and to_string().