Go to the documentation of this file.
17 #ifndef _GAZEBO_COLOR_HH_
18 #define _GAZEBO_COLOR_HH_
21 #include <ignition/math/Color.hh>
22 #include <ignition/math/Vector3.hh>
55 public:
typedef unsigned int RGBA;
59 public:
typedef unsigned int BGRA;
63 public:
typedef unsigned int ARGB;
67 public:
typedef unsigned int ABGR;
77 public:
Color(
float _r,
float _g,
float _b,
float _a = 1.0)
101 public:
void Reset();
108 public:
void Set(
float _r = 1,
float _g = 1 ,
float _b = 1,
float _a = 1);
112 public:
ignition::math::Vector3d HSV() const;
118 public:
void SetFromHSV(
float _h,
float _s,
float _v);
122 public:
ignition::math::Vector3d YUV() const;
128 public:
void SetFromYUV(
float _y,
float _u,
float _v);
138 public:
float operator[](
unsigned int _index);
142 public:
RGBA GetAsRGBA() const;
146 public:
BGRA GetAsBGRA() const;
150 public:
ARGB GetAsARGB() const;
154 public:
ABGR GetAsABGR() const;
158 public:
void SetFromRGBA(const
RGBA _v);
162 public:
void SetFromBGRA(const
BGRA _v);
166 public:
void SetFromARGB(const
ARGB _v);
170 public:
void SetFromABGR(const
ABGR _v);
175 public:
Color operator+(const
Color &_pt) const;
180 public:
Color operator+(const
float &_v) const;
185 public: const
Color &operator+=(const
Color &_pt);
190 public:
Color operator-(const
Color &_pt) const;
195 public:
Color operator-(const
float &_v) const;
200 public: const
Color &operator-=(const
Color &_pt);
205 public: const
Color operator/(const
Color &_pt) const;
210 public: const
Color operator/(const
float &_v) const;
215 public: const
Color &operator/=(const
Color &_pt);
220 public: const
Color operator*(const
Color &_pt) const;
225 public: const
Color operator*(const
float &_v) const;
230 public: const
Color &operator*=(const
Color &_pt);
235 public:
bool operator ==(const
Color &_pt) const;
240 public:
bool operator!=(const
Color &_pt) const;
243 private:
void Clamp();
249 public: friend std::ostream &operator<< (std::ostream &_out,
252 _out << _pt.
r <<
" " << _pt.g <<
" " << _pt.b <<
" " << _pt.a;
259 public:
friend std::istream &operator>> (std::istream &_in,
Color &_pt)
262 _in.setf(std::ios_base::skipws);
263 _in >> _pt.
r >> _pt.
g >> _pt.
b >> _pt.
a;
268 public:
float r, g, b, a;
void Reset()
Reset the color to default values.
void SetFromBGRA(const BGRA _v)
Set from uint32 BGRA packed value.
void SetFromYUV(float _y, float _u, float _v)
Set from yuv.
Forward declarations for the common classes.
Definition: Animation.hh:26
static const Color Yellow
(1, 1, 0)
Definition: Color.hh:49
void Set(float _r=1, float _g=1, float _b=1, float _a=1)
Set the contents of the vector.
unsigned int ABGR
Definition: Color.hh:67
ignition::math::Vector3d YUV() const
Get the color in YUV colorspace.
float r
Definition: Color.hh:268
unsigned int ARGB
Definition: Color.hh:63
ARGB GetAsARGB() const
Get as uint32 ARGB packed value.
static const Color Green
(0, 1, 0)
Definition: Color.hh:45
static const Color White
(1, 1, 1)
Definition: Color.hh:39
float b
Definition: Color.hh:268
void SetFromABGR(const ABGR _v)
Set from uint32 ABGR packed value.
ignition::math::Color Ign() const
Convert to ignition type.
ignition::math::Vector3d HSV() const
Get the color in HSV colorspace.
static const Color Red
(1, 0, 0)
Definition: Color.hh:43
unsigned int RGBA
Definition: Color.hh:55
void SetFromRGBA(const RGBA _v)
Set from uint32 RGBA packed value.
GAZEBO_VISIBLE void Set(common::Image &_img, const msgs::Image &_msg)
Convert a msgs::Image to a common::Image.
unsigned int BGRA
Definition: Color.hh:59
BGRA GetAsBGRA() const
Get as uint32 BGRA packed value.
static const Color Black
(0, 0, 0)
Definition: Color.hh:41
Defines a color.
Definition: Color.hh:36
#define GAZEBO_DEPRECATED(version)
Definition: system.hh:328
static const Color Blue
(0, 0, 1)
Definition: Color.hh:47
ABGR GetAsABGR() const
Get as uint32 ABGR packed value.
RGBA GetAsRGBA() const
Get as uint32 RGBA packed value.
static const Color Magenta
(1, 0, 1)
Definition: Color.hh:51
void SetFromARGB(const ARGB _v)
Set from uint32 ARGB packed value.
void SetFromHSV(float _h, float _s, float _v)
Set a color based on HSV values.
float a
Definition: Color.hh:268
Color() GAZEBO_DEPRECATED(9.0)
Constructor.
float g
Definition: Color.hh:268
friend std::istream & operator>>(std::istream &_in, Color &_pt)
Stream insertion operator.
Definition: Color.hh:259