ARGoS
3
A parallel, multi-engine simulator for swarm robotics
|
The basic color type. More...
#include <color.h>
Classes | |
struct | TChannels |
Public Member Functions | |
CColor () | |
Class constructor. | |
CColor (const UInt8 un_red, const UInt8 un_green, const UInt8 un_blue, const UInt8 un_alpha=255) throw () | |
Class constructor. | |
Real | ToGrayScale () const throw () |
Returns the color in grayscale. | |
UInt8 | GetRed () const throw () |
Returns the red channel of the color. | |
void | SetRed (const UInt8 un_red) throw () |
Sets the red channel of the color. | |
UInt8 | GetGreen () const throw () |
Returns the green channel of the color. | |
void | SetGreen (const UInt8 un_green) throw () |
Sets the green channel of the color. | |
UInt8 | GetBlue () const throw () |
Returns the blue channel of the color. | |
void | SetBlue (const UInt8 un_blue) throw () |
Sets the blue channel of the color. | |
UInt8 | GetAlpha () const throw () |
Returns the alpha channel of the color. | |
void | SetAlpha (const UInt8 un_alpha) throw () |
Sets the alpha channel of the color. | |
void | Set (const UInt8 un_red, const UInt8 un_green, const UInt8 un_blue, const UInt8 un_alpha=255) throw () |
Sets the RGBA values of the color. | |
void | Set (const std::string &str_color) |
Sets the RGBA values of the color from a string. | |
operator UInt32 () | |
Cast operator. | |
bool | operator== (const CColor &c_color2) const throw () |
Returns true if the given color is identical to the current. | |
bool | operator!= (const CColor &c_color2) const throw () |
Returns true if the given color is different from the current. | |
Static Public Attributes | |
static CColor | BLACK |
static CColor | WHITE |
static CColor | RED |
static CColor | GREEN |
static CColor | BLUE |
static CColor | MAGENTA |
static CColor | CYAN |
static CColor | YELLOW |
static CColor | ORANGE |
static CColor | GRAY10 |
static CColor | GRAY20 |
static CColor | GRAY30 |
static CColor | GRAY40 |
static CColor | GRAY50 |
static CColor | GRAY60 |
static CColor | GRAY70 |
static CColor | GRAY80 |
static CColor | GRAY90 |
Friends | |
std::ostream & | operator<< (std::ostream &os, const CColor &c_color) |
Output stream operator. | |
std::istream & | operator>> (std::istream &is, CColor &c_color) |
Input stream operator. |
The basic color type.
In ARGoS, color is encoded into the RGBA schema.
argos::CColor::CColor | ( | ) | [inline] |
argos::CColor::CColor | ( | const UInt8 | un_red, |
const UInt8 | un_green, | ||
const UInt8 | un_blue, | ||
const UInt8 | un_alpha = 255 |
||
) | throw () [inline, explicit] |
UInt8 argos::CColor::GetAlpha | ( | ) | const throw () [inline] |
UInt8 argos::CColor::GetBlue | ( | ) | const throw () [inline] |
UInt8 argos::CColor::GetGreen | ( | ) | const throw () [inline] |
UInt8 argos::CColor::GetRed | ( | ) | const throw () [inline] |
argos::CColor::operator UInt32 | ( | ) | [inline] |
bool argos::CColor::operator!= | ( | const CColor & | c_color2 | ) | const throw () [inline] |
bool argos::CColor::operator== | ( | const CColor & | c_color2 | ) | const throw () [inline] |
void argos::CColor::Set | ( | const UInt8 | un_red, |
const UInt8 | un_green, | ||
const UInt8 | un_blue, | ||
const UInt8 | un_alpha = 255 |
||
) | throw () [inline] |
void argos::CColor::Set | ( | const std::string & | str_color | ) | [inline] |
Sets the RGBA values of the color from a string.
The input stringcan contain predefined color names, such as red
. The color can be also input as a tuple <r,g,b,a>
.
str_color | the input string. |
CARGoSException | in case of a parse error. |
void argos::CColor::SetAlpha | ( | const UInt8 | un_alpha | ) | throw () [inline] |
void argos::CColor::SetBlue | ( | const UInt8 | un_blue | ) | throw () [inline] |
void argos::CColor::SetGreen | ( | const UInt8 | un_green | ) | throw () [inline] |
void argos::CColor::SetRed | ( | const UInt8 | un_red | ) | throw () [inline] |
Real argos::CColor::ToGrayScale | ( | ) | const throw () [inline] |
std::ostream& operator<< | ( | std::ostream & | os, |
const CColor & | c_color | ||
) | [friend] |
Output stream operator.
Operator to serialize a color into a C++ output stream. When a color corresponds to one of the predefined constants (such as argos::CColor::RED) it streams the color name. For instance, if the current color is argos::CColor::RED, the output is a string containing red
. Otherwise, the color is output as a tuple <r,g,b,a>
.
os | the C++ output stream. |
c_color | the color to stream. |
std::istream& operator>> | ( | std::istream & | is, |
CColor & | c_color | ||
) | [friend] |
Input stream operator.
Operator to get a color from a C++ input stream. The input stream value can contain predefined color names, such as red
. The color can be also input as a tuple <r,g,b,a>
.
is | the C++ input stream. |
c_color | the color to fill. |
CColor argos::CColor::BLACK [static] |
CColor argos::CColor::BLUE [static] |
CColor argos::CColor::CYAN [static] |
CColor argos::CColor::GRAY10 [static] |
CColor argos::CColor::GRAY20 [static] |
CColor argos::CColor::GRAY30 [static] |
CColor argos::CColor::GRAY40 [static] |
CColor argos::CColor::GRAY50 [static] |
CColor argos::CColor::GRAY60 [static] |
CColor argos::CColor::GRAY70 [static] |
CColor argos::CColor::GRAY80 [static] |
CColor argos::CColor::GRAY90 [static] |
CColor argos::CColor::GREEN [static] |
CColor argos::CColor::MAGENTA [static] |
CColor argos::CColor::ORANGE [static] |
CColor argos::CColor::RED [static] |
CColor argos::CColor::WHITE [static] |
CColor argos::CColor::YELLOW [static] |