Defines a color using a red (R), green (G), blue (B), and alpha (A) component. More...
#include <ignition/math/Color.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 (const Color &_clr) | |
| Copy Constructor. | |
| Color (const float _r, const float _g, const float _b, const float _a=1.0) | |
| Constructor. | |
| virtual | ~Color () |
| Destructor. | |
| float & | A () |
| Get a mutable reference to the alpha value. | |
| float | A () const |
| Get the alpha value. | |
| void | A (const float _a) |
| Set the alpha value. | |
| ABGR | AsABGR () const |
| Get as uint32 ABGR packed value. | |
| ARGB | AsARGB () const |
| Get as uint32 ARGB packed value. | |
| BGRA | AsBGRA () const |
| Get as uint32 BGRA packed value. | |
| RGBA | AsRGBA () const |
| Get as uint32 RGBA packed value. | |
| float & | B () |
| Get a mutable reference to the blue value. | |
| float | B () const |
| Get the blue value. | |
| void | B (const float _b) |
| Set the blue value. | |
| float & | G () |
| Get a mutable reference to the green value. | |
| float | G () const |
| Get the green value. | |
| void | G (const float _g) |
| Set the green value. | |
| Vector3f | HSV () const |
| Get the color in HSV 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[] (const unsigned int _index) |
| Array index operator. | |
| float & | R () |
| Get a mutable reference to the red value. | |
| float | R () const |
| Get the red value. | |
| void | R (const float _r) |
| Set the red value. | |
| void | Reset () |
| Reset the color to default values to red=0, green=0, blue=0, alpha=1. | |
| void | Set (const float _r=1, const float _g=1, const float _b=1, const 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 (const float _h, const float _s, const float _v) |
| Set a color based on HSV values. | |
| void | SetFromRGBA (const RGBA _v) |
| Set from uint32 RGBA packed value. | |
| void | SetFromYUV (const float _y, const float _u, const float _v) |
| Set from yuv. | |
| Vector3f | YUV () const |
| Get the color in YUV colorspace. | |
Static Public Attributes | |
| static const Color | Black |
| (0, 0, 0) | |
| static const Color | Blue |
| (0, 0, 1) | |
| static const Color | Cyan |
| (0, 1, 1) | |
| static const Color | Green |
| (0, 1, 0) | |
| static const Color | Magenta |
| (1, 0, 1) | |
| static const Color | Red |
| (1, 0, 0) | |
| static const Color | White |
| (1, 1, 1) | |
| static const Color | Yellow |
| (1, 1, 0) | |
Defines a color using a red (R), green (G), blue (B), and alpha (A) component.
Each color component is in the range [0..1].
| typedef unsigned int ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Color::ABGR |
| typedef unsigned int ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Color::ARGB |
| typedef unsigned int ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Color::BGRA |
| typedef unsigned int ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Color::RGBA |
| ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Color::Color | ( | ) |
Constructor.
Referenced by Color(), operator!=(), operator*(), operator*(), operator*=(), operator+(), operator+(), operator+=(), operator-(), operator-(), operator-=(), operator/(), operator/(), operator/=(), operator<<, operator=(), operator==(), and operator>>.
| ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Color::Color | ( | const float | _r, |
| const float | _g, | ||
| const float | _b, | ||
| const 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) |
| ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Color::Color | ( | const Color & | _clr | ) |
|
virtual |
Destructor.
| float & ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Color::A | ( | ) |
Get a mutable reference to the alpha value.
| float ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Color::A | ( | ) | const |
Get the alpha value.
| void ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Color::A | ( | const float | _a | ) |
Set the alpha value.
| _r | New alpha value |
| ABGR ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Color::AsABGR | ( | ) | const |
Get as uint32 ABGR packed value.
| ARGB ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Color::AsARGB | ( | ) | const |
Get as uint32 ARGB packed value.
| BGRA ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Color::AsBGRA | ( | ) | const |
Get as uint32 BGRA packed value.
| RGBA ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Color::AsRGBA | ( | ) | const |
Get as uint32 RGBA packed value.
| float & ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Color::B | ( | ) |
Get a mutable reference to the blue value.
| float ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Color::B | ( | ) | const |
Get the blue value.
| void ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Color::B | ( | const float | _b | ) |
Set the blue value.
| _r | New blue value |
| float & ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Color::G | ( | ) |
Get a mutable reference to the green value.
| float ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Color::G | ( | ) | const |
Get the green value.
| void ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Color::G | ( | const float | _g | ) |
Set the green value.
| _r | New green value |
| Vector3f ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Color::HSV | ( | ) | const |
Get the color in HSV colorspace.
| bool ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Color::operator!= | ( | const Color & | _pt | ) | const |
Inequality operator.
| [in] | _pt | The color to check for inequality |
References Color().
| const Color ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Color::operator* | ( | const Color & | _pt | ) | const |
Multiplication operator.
| [in] | _pt | The color to muliply by |
References Color().
| const Color ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Color::operator* | ( | const float & | _v | ) | const |
Multiply all color components by _v.
| [in] | _v | The value to multiply by |
References Color().
| const Color & ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Color::operator*= | ( | const Color & | _pt | ) |
Multiplication equal operator.
| [in] | _pt | The color to muliply by |
References Color().
| Color ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Color::operator+ | ( | const float & | _v | ) | const |
Add _v to all color components.
| [in] | _v | Value to add to each color component |
References Color().
Subtraction operator.
| [in] | _pt | The color to substract |
References Color().
| Color ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Color::operator- | ( | const float & | _v | ) | const |
Subtract _v from all color components.
| [in] | _v | Value to subtract |
References Color().
| const Color ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Color::operator/ | ( | const float & | _v | ) | const |
Divide all color component by _v.
| [in] | _v | The value to divide by |
References Color().
| bool ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Color::operator== | ( | const Color & | _pt | ) | const |
Equality operator.
| [in] | _pt | The color to check for equality |
References Color().
| float ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Color::operator[] | ( | const unsigned int | _index | ) |
Array index operator.
| [in] | _index | Color component index(0=red, 1=green, 2=blue) |
| float & ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Color::R | ( | ) |
Get a mutable reference to the red value.
| float ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Color::R | ( | ) | const |
Get the red value.
| void ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Color::R | ( | const float | _r | ) |
Set the red value.
| _r | New red value |
| void ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Color::Reset | ( | ) |
Reset the color to default values to red=0, green=0, blue=0, alpha=1.
| void ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Color::Set | ( | const float | _r = 1, |
| const float | _g = 1, | ||
| const float | _b = 1, | ||
| const 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 ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Color::SetFromABGR | ( | const ABGR | _v | ) |
Set from uint32 ABGR packed value.
| [in] | _v | the new color |
| void ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Color::SetFromARGB | ( | const ARGB | _v | ) |
Set from uint32 ARGB packed value.
| [in] | _v | the new color |
| void ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Color::SetFromBGRA | ( | const BGRA | _v | ) |
Set from uint32 BGRA packed value.
| [in] | _v | the new color |
| void ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Color::SetFromHSV | ( | const float | _h, |
| const float | _s, | ||
| const 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 ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Color::SetFromRGBA | ( | const RGBA | _v | ) |
Set from uint32 RGBA packed value.
| [in] | _v | the new color |
| void ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Color::SetFromYUV | ( | const float | _y, |
| const float | _u, | ||
| const float | _v ) |
Set from yuv.
| [in] | _y | value |
| [in] | _u | value |
| [in] | _v | value |
| Vector3f ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Color::YUV | ( | ) | const |
Get the color in YUV colorspace.
|
static |
(0, 0, 0)
|
static |
(0, 0, 1)
|
static |
(0, 1, 1)
|
static |
(0, 1, 0)
|
static |
(1, 0, 1)
|
static |
(1, 0, 0)
|
static |
(1, 1, 1)
|
static |
(1, 1, 0)