Defines a color. More...
#include <common/common.hh>
Public Types | |
typedef unsigned int | ABGR |
typedef unsigned int | ARGB |
typedef unsigned int | BGRA |
typedef unsigned int | RGBA |
Public Member Functions | |
Color () | |
Constructor. | |
Color (float _r, float _g, float _b, float _a=1.0) | |
Constructor. | |
Color (const Color &_clr) | |
Copy Constructor. | |
virtual | ~Color () |
Destructor. | |
ABGR | GetAsABGR () const |
Get as uint32 ABGR packed value. | |
ARGB | GetAsARGB () const |
Get as uint32 ARGB packed value. | |
BGRA | GetAsBGRA () const |
Get as uint32 BGRA packed value. | |
math::Vector3 | GetAsHSV () const |
Get the color in HSV colorspace. | |
RGBA | GetAsRGBA () const |
Get as uint32 RGBA packed value. | |
math::Vector3 | GetAsYUV () const |
Get the color in YUV colorspace. | |
bool | operator!= (const Color &_pt) const |
Inequality operator. | |
const Color | operator* (const Color &_pt) const |
Multiplication operator. | |
const Color | operator* (const float &_v) const |
Multiply all color components by _v. | |
const Color & | operator*= (const Color &_pt) |
Multiplication equal operator. | |
Color | operator+ (const Color &_pt) const |
Addition operator (this + _pt) | |
Color | operator+ (const float &_v) const |
Add _v to all color components. | |
const Color & | operator+= (const Color &_pt) |
Addition equal operator. | |
Color | operator- (const Color &_pt) const |
Subtraction operator. | |
Color | operator- (const float &_v) const |
Subtract _v from all color components. | |
const Color & | operator-= (const Color &_pt) |
Subtraction equal operator. | |
const Color | operator/ (const Color &_pt) const |
Division operator. | |
const Color | operator/ (const float &_v) const |
Divide all color component by _v. | |
const Color & | operator/= (const Color &_pt) |
Division equal operator. | |
Color & | operator= (const Color &_pt) |
Equal operator. | |
bool | operator== (const Color &_pt) const |
Equality operator. | |
float | operator[] (unsigned int _index) |
Array index operator. | |
void | Reset () |
Reset the color to default values. | |
void | Set (float _r=1, float _g=1, float _b=1, float _a=1) |
Set the contents of the vector. | |
void | SetFromABGR (const ABGR _v) |
Set from uint32 ABGR packed value. | |
void | SetFromARGB (const ARGB _v) |
Set from uint32 ARGB packed value. | |
void | SetFromBGRA (const BGRA _v) |
Set from uint32 BGRA packed value. | |
void | SetFromHSV (float _h, float _s, float _v) |
Set a color based on HSV values. | |
void | SetFromRGBA (const RGBA _v) |
Set from uint32 RGBA packed value. | |
void | SetFromYUV (float _y, float _u, float _v) |
Set from yuv. | |
Public Attributes | |
float | a |
float | b |
float | g |
float | r |
Static Public Attributes | |
static const Color | Black |
(0, 0, 0) | |
static const Color | Blue |
(0, 0, 1) | |
static const Color | Green |
(0, 1, 0) | |
static const Color | Purple |
(1, 0, 1) | |
static const Color | Red |
(1, 0, 0) | |
static const Color | White |
(1, 1, 1) | |
static const Color | Yellow |
(1, 1, 0) | |
Friends | |
std::ostream & | operator<< (std::ostream &_out, const Color &_pt) |
Stream insertion operator. | |
std::istream & | operator>> (std::istream &_in, Color &_pt) |
Stream insertion operator. | |
Defines a color.
typedef unsigned int gazebo::common::Color::ABGR |
typedef unsigned int gazebo::common::Color::ARGB |
typedef unsigned int gazebo::common::Color::BGRA |
typedef unsigned int gazebo::common::Color::RGBA |
gazebo::common::Color::Color | ( | ) |
Constructor.
gazebo::common::Color::Color | ( | float | _r, |
float | _g, | ||
float | _b, | ||
float | _a = 1.0 |
||
) |
Constructor.
[in] | _r | Red value (range 0 to 1) |
[in] | _g | Green value (range 0 to 1 |
[in] | _b | Blue value (range 0 to 1 |
[in] | _a | Alpha value (0=transparent, 1=opaque) |
gazebo::common::Color::Color | ( | const Color & | _clr | ) |
Copy Constructor.
[in] | _clr | Color to copy |
|
virtual |
Destructor.
ABGR gazebo::common::Color::GetAsABGR | ( | ) | const |
Get as uint32 ABGR packed value.
ARGB gazebo::common::Color::GetAsARGB | ( | ) | const |
Get as uint32 ARGB packed value.
BGRA gazebo::common::Color::GetAsBGRA | ( | ) | const |
Get as uint32 BGRA packed value.
math::Vector3 gazebo::common::Color::GetAsHSV | ( | ) | const |
Get the color in HSV colorspace.
RGBA gazebo::common::Color::GetAsRGBA | ( | ) | const |
Get as uint32 RGBA packed value.
math::Vector3 gazebo::common::Color::GetAsYUV | ( | ) | const |
Get the color in YUV colorspace.
bool gazebo::common::Color::operator!= | ( | const Color & | _pt | ) | const |
Inequality operator.
[in] | _pt | The color to check for inequality |
Multiplication operator.
[in] | _pt | The color to muliply by |
const Color gazebo::common::Color::operator* | ( | const float & | _v | ) | const |
Multiply all color components by _v.
[in] | _v | The value to multiply by |
Multiplication equal operator.
[in] | _pt | The color to muliply by |
Color gazebo::common::Color::operator+ | ( | const float & | _v | ) | const |
Add _v to all color components.
[in] | _v | Value to add to each color component |
Subtraction operator.
[in] | _pt | The color to substract |
Color gazebo::common::Color::operator- | ( | const float & | _v | ) | const |
Subtract _v from all color components.
[in] | _v | Value to subtract |
const Color gazebo::common::Color::operator/ | ( | const float & | _v | ) | const |
Divide all color component by _v.
[in] | _v | The value to divide by |
bool gazebo::common::Color::operator== | ( | const Color & | _pt | ) | const |
Equality operator.
[in] | _pt | The color to check for equality |
float gazebo::common::Color::operator[] | ( | unsigned int | _index | ) |
Array index operator.
[in] | _index | Color component index(0=red, 1=green, 2=blue) |
void gazebo::common::Color::Reset | ( | ) |
Reset the color to default values.
void gazebo::common::Color::Set | ( | float | _r = 1 , |
float | _g = 1 , |
||
float | _b = 1 , |
||
float | _a = 1 |
||
) |
Set the contents of the vector.
[in] | _r | Red value (range 0 to 1) |
[in] | _g | Green value (range 0 to 1) |
[in] | _b | Blue value (range 0 to 1) |
[in] | _a | Alpha value (0=transparent, 1=opaque) |
void gazebo::common::Color::SetFromABGR | ( | const ABGR | _v | ) |
Set from uint32 ABGR packed value.
[in] | _v | the new color |
void gazebo::common::Color::SetFromARGB | ( | const ARGB | _v | ) |
Set from uint32 ARGB packed value.
[in] | _v | the new color |
void gazebo::common::Color::SetFromBGRA | ( | const BGRA | _v | ) |
Set from uint32 BGRA packed value.
[in] | _v | the new color |
void gazebo::common::Color::SetFromHSV | ( | float | _h, |
float | _s, | ||
float | _v | ||
) |
Set a color based on HSV values.
[in] | _h | Hue(0..360) |
[in] | _s | Saturation(0..1) |
[in] | _v | Value(0..1) |
void gazebo::common::Color::SetFromRGBA | ( | const RGBA | _v | ) |
Set from uint32 RGBA packed value.
[in] | _v | the new color |
void gazebo::common::Color::SetFromYUV | ( | float | _y, |
float | _u, | ||
float | _v | ||
) |
Set from yuv.
[in] | _y | value |
[in] | _u | value |
[in] | _v | value |
|
friend |
Stream insertion operator.
[in] | _out | the output stream |
[in] | _pt | the color |
|
friend |
Stream insertion operator.
[in] | _in | the input stream |
[in] | _pt |
float gazebo::common::Color::a |
float gazebo::common::Color::b |
|
static |
(0, 0, 0)
|
static |
(0, 0, 1)
float gazebo::common::Color::g |
|
static |
(0, 1, 0)
|
static |
(1, 0, 1)
float gazebo::common::Color::r |
|
static |
(1, 0, 0)
|
static |
(1, 1, 1)
|
static |
(1, 1, 0)