Container class for (r,g,b) color. Each component is an integer (in [0,255]) More...
Public Member Functions | |
| color () | |
| empty constructor (0,0,0) | |
| color (const int &gray) | |
| direct constructor with gray value (r,b,g)=(gray,gray,gray) | |
| color (const int &r, const int &g, const int &b) | |
| direct constructor with (r,b,g) value | |
| void | set (const int &r, const int &g, const int &b) |
| set color value | |
| const int & | r () const |
| get red value | |
| int & | r () |
| get red value | |
| const int & | g () const |
| get green value | |
| int & | g () |
| get green value | |
| const int & | b () const |
| get blue value | |
| int & | b () |
| get blue value | |
| color | clamped () const |
| return the clamped version of the color (between 0 and 255) | |
| color & | operator+= (const color &c) |
| add a color to the current one | |
| color & | operator*= (const double &alpha) |
| internal scaling by a scalar | |
Static Public Member Functions | |
| static color | interpolate_linear (const color &c1, const color &c2, const double &alpha) |
| linear interpolation of colors | |
| static color | interpolate_linear (const std::vector< color > &v_color, const std::vector< double > &weights) |
| linear interpolation of colors | |
Private Attributes | |
| int | internal_r |
| internal red component | |
| int | internal_g |
| internal green component | |
| int | internal_b |
| internal blue component | |
Friends | |
| color | operator+ (const color &c0, const color &c1) |
| sum two colors | |
| color | operator* (const double &alpha, const color &c) |
| scale color by a scalar value | |
| color | operator* (const color &c, const double &alpha) |
| scale color by a scalar value | |
| std::ostream & | operator<< (std::ostream &stream, const color &c) |
| standard output | |
Container class for (r,g,b) color. Each component is an integer (in [0,255])
empty constructor (0,0,0)
Referenced by clamped(), and interpolate_linear().
| cpe::color::color | ( | const int & | gray | ) |
direct constructor with gray value (r,b,g)=(gray,gray,gray)
| cpe::color::color | ( | const int & | r, |
| const int & | g, | ||
| const int & | b | ||
| ) |
direct constructor with (r,b,g) value
| const int & cpe::color::b | ( | ) | const |
get blue value
References internal_b.
Referenced by interpolate_linear(), operator+=(), cpe::operator<<(), and set().
| int & cpe::color::b | ( | ) |
get blue value
References internal_b.
| color cpe::color::clamped | ( | ) | const |
return the clamped version of the color (between 0 and 255)
References color(), internal_b, internal_g, and internal_r.
Here is the call graph for this function:| const int & cpe::color::g | ( | ) | const |
get green value
References internal_g.
Referenced by interpolate_linear(), operator+=(), cpe::operator<<(), and set().
| int & cpe::color::g | ( | ) |
get green value
References internal_g.
| color cpe::color::interpolate_linear | ( | const color & | c1, |
| const color & | c2, | ||
| const double & | alpha | ||
| ) | [static] |
| color cpe::color::interpolate_linear | ( | const std::vector< color > & | v_color, |
| const std::vector< double > & | weights | ||
| ) | [static] |
| color & cpe::color::operator*= | ( | const double & | alpha | ) |
internal scaling by a scalar
References internal_b, internal_g, and internal_r.
add a color to the current one
References b(), g(), internal_b, internal_g, internal_r, and r().
Here is the call graph for this function:| const int & cpe::color::r | ( | ) | const |
get red value
References internal_r.
Referenced by interpolate_linear(), operator+=(), cpe::operator<<(), and set().
| int & cpe::color::r | ( | ) |
get red value
References internal_r.
| void cpe::color::set | ( | const int & | r, |
| const int & | g, | ||
| const int & | b | ||
| ) |
set color value
References b(), g(), internal_b, internal_g, internal_r, and r().
Here is the call graph for this function:| std::ostream& operator<< | ( | std::ostream & | stream, |
| const color & | c | ||
| ) | [friend] |
standard output
int cpe::color::internal_b [private] |
internal blue component
Referenced by b(), clamped(), operator*=(), operator+=(), and set().
int cpe::color::internal_g [private] |
internal green component
Referenced by clamped(), g(), operator*=(), operator+=(), and set().
int cpe::color::internal_r [private] |
internal red component
Referenced by clamped(), operator*=(), operator+=(), r(), and set().