Warning: include(php/utility.php): Failed to open stream: No such file or directory in /home/argos/argos3/doc/api/embedded/a02306.php on line 2

Warning: include(): Failed opening 'php/utility.php' for inclusion (include_path='.:/usr/lib64/php') in /home/argos/argos3/doc/api/embedded/a02306.php on line 2
The ARGoS Website

The basic color type. More...

#include <color.h>

Collaboration diagram for argos::CColor:

Public Member Functions

 CColor ()
 Class constructor. More...
 
 CColor (UInt8 un_red, UInt8 un_green, UInt8 un_blue, UInt8 un_alpha=255) throw ()
 Class constructor. More...
 
Real ToGrayScale () const throw ()
 Returns the color in grayscale. More...
 
UInt8 GetRed () const throw ()
 Returns the red channel of the color. More...
 
void SetRed (UInt8 un_red) throw ()
 Sets the red channel of the color. More...
 
UInt8 GetGreen () const throw ()
 Returns the green channel of the color. More...
 
void SetGreen (UInt8 un_green) throw ()
 Sets the green channel of the color. More...
 
UInt8 GetBlue () const throw ()
 Returns the blue channel of the color. More...
 
void SetBlue (UInt8 un_blue) throw ()
 Sets the blue channel of the color. More...
 
UInt8 GetAlpha () const throw ()
 Returns the alpha channel of the color. More...
 
void SetAlpha (UInt8 un_alpha) throw ()
 Sets the alpha channel of the color. More...
 
void Set (UInt8 un_red, UInt8 un_green, UInt8 un_blue, UInt8 un_alpha=255) throw ()
 Sets the RGBA values of the color. More...
 
void Set (const std::string &str_color)
 Sets the RGBA values of the color from a string. More...
 
 operator UInt32 ()
 Cast operator. More...
 
bool operator== (const CColor &c_color2) const throw ()
 Returns true if the given color is identical to the current. More...
 
bool operator!= (const CColor &c_color2) const throw ()
 Returns true if the given color is different from the current. More...
 

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 BROWN
 
static CColor PURPLE
 
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. More...
 
std::istream & operator>> (std::istream &is, CColor &c_color)
 Input stream operator. More...
 

Detailed Description

The basic color type.

In ARGoS, color is encoded into the RGBA schema.

Definition at line 25 of file color.h.

Constructor & Destructor Documentation

◆ CColor() [1/2]

argos::CColor::CColor ( )
inline

Class constructor.

Definition at line 53 of file color.h.

◆ CColor() [2/2]

argos::CColor::CColor ( UInt8  un_red,
UInt8  un_green,
UInt8  un_blue,
UInt8  un_alpha = 255 
)
throw (
)
inlineexplicit

Class constructor.

Definition at line 58 of file color.h.

Member Function Documentation

◆ GetAlpha()

UInt8 argos::CColor::GetAlpha ( ) const
throw (
)
inline

Returns the alpha channel of the color.

Returns
the alpha channel of the color.

Definition at line 112 of file color.h.

◆ GetBlue()

UInt8 argos::CColor::GetBlue ( ) const
throw (
)
inline

Returns the blue channel of the color.

Returns
the blue channel of the color.

Definition at line 101 of file color.h.

◆ GetGreen()

UInt8 argos::CColor::GetGreen ( ) const
throw (
)
inline

Returns the green channel of the color.

Returns
the green channel of the color.

Definition at line 90 of file color.h.

◆ GetRed()

UInt8 argos::CColor::GetRed ( ) const
throw (
)
inline

Returns the red channel of the color.

Returns
the red channel of the color.

Definition at line 79 of file color.h.

◆ operator UInt32()

argos::CColor::operator UInt32 ( )
inline

Cast operator.

Casts the color into a 32-bit structure.

Definition at line 185 of file color.h.

◆ operator!=()

bool argos::CColor::operator!= ( const CColor c_color2) const
throw (
)
inline

Returns true if the given color is different from the current.

Parameters
c_color2the color to compare the current color to.
Returns
true if the given color is different from the current.

Definition at line 203 of file color.h.

◆ operator==()

bool argos::CColor::operator== ( const CColor c_color2) const
throw (
)
inline

Returns true if the given color is identical to the current.

Parameters
c_color2the color to compare the current color to.
Returns
true if the given color is identical to the current.

Definition at line 194 of file color.h.

◆ Set() [1/2]

void argos::CColor::Set ( UInt8  un_red,
UInt8  un_green,
UInt8  un_blue,
UInt8  un_alpha = 255 
)
throw (
)
inline

Sets the RGBA values of the color.

Parameters
un_redthe red channel of the color.
un_greenthe green channel of the color.
un_bluethe blue channel of the color.
un_alphathe alpha channel of the color.

Definition at line 126 of file color.h.

◆ Set() [2/2]

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>.

Parameters
str_colorthe input string.
Exceptions
CARGoSExceptionin case of a parse error.

Definition at line 143 of file color.h.

◆ SetAlpha()

void argos::CColor::SetAlpha ( UInt8  un_alpha)
throw (
)
inline

Sets the alpha channel of the color.

Parameters
un_alphathe alpha channel of the color.

Definition at line 117 of file color.h.

◆ SetBlue()

void argos::CColor::SetBlue ( UInt8  un_blue)
throw (
)
inline

Sets the blue channel of the color.

Parameters
un_bluethe blue channel of the color.

Definition at line 106 of file color.h.

◆ SetGreen()

void argos::CColor::SetGreen ( UInt8  un_green)
throw (
)
inline

Sets the green channel of the color.

Parameters
un_greenthe green channel of the color.

Definition at line 95 of file color.h.

◆ SetRed()

void argos::CColor::SetRed ( UInt8  un_red)
throw (
)
inline

Sets the red channel of the color.

Parameters
un_redthe red channel of the color.

Definition at line 84 of file color.h.

◆ ToGrayScale()

Real argos::CColor::ToGrayScale ( ) const
throw (
)
inline

Returns the color in grayscale.

Returns
the color in grayscale. The returned value is in the range [0,1].

Definition at line 68 of file color.h.

Friends And Related Function Documentation

◆ operator<<

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>.

Parameters
osthe C++ output stream.
c_colorthe color to stream.
Returns
the new state of the C++ output stream.

Definition at line 218 of file color.h.

◆ operator>>

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>.

Parameters
isthe C++ input stream.
c_colorthe color to fill.
Returns
the new state of the C++ input stream.

Definition at line 258 of file color.h.

Member Data Documentation

◆ BLACK

CColor argos::CColor::BLACK
static

Definition at line 29 of file color.h.

◆ BLUE

CColor argos::CColor::BLUE
static

Definition at line 33 of file color.h.

◆ BROWN

CColor argos::CColor::BROWN
static

Definition at line 38 of file color.h.

◆ CYAN

CColor argos::CColor::CYAN
static

Definition at line 35 of file color.h.

◆ GRAY10

CColor argos::CColor::GRAY10
static

Definition at line 40 of file color.h.

◆ GRAY20

CColor argos::CColor::GRAY20
static

Definition at line 41 of file color.h.

◆ GRAY30

CColor argos::CColor::GRAY30
static

Definition at line 42 of file color.h.

◆ GRAY40

CColor argos::CColor::GRAY40
static

Definition at line 43 of file color.h.

◆ GRAY50

CColor argos::CColor::GRAY50
static

Definition at line 44 of file color.h.

◆ GRAY60

CColor argos::CColor::GRAY60
static

Definition at line 45 of file color.h.

◆ GRAY70

CColor argos::CColor::GRAY70
static

Definition at line 46 of file color.h.

◆ GRAY80

CColor argos::CColor::GRAY80
static

Definition at line 47 of file color.h.

◆ GRAY90

CColor argos::CColor::GRAY90
static

Definition at line 48 of file color.h.

◆ GREEN

CColor argos::CColor::GREEN
static

Definition at line 32 of file color.h.

◆ MAGENTA

CColor argos::CColor::MAGENTA
static

Definition at line 34 of file color.h.

◆ ORANGE

CColor argos::CColor::ORANGE
static

Definition at line 37 of file color.h.

◆ PURPLE

CColor argos::CColor::PURPLE
static

Definition at line 39 of file color.h.

◆ RED

CColor argos::CColor::RED
static

Definition at line 31 of file color.h.

◆ WHITE

CColor argos::CColor::WHITE
static

Definition at line 30 of file color.h.

◆ YELLOW

CColor argos::CColor::YELLOW
static

Definition at line 36 of file color.h.