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)
83 public:
Color(const ignition::math::
Color &_color) GAZEBO_DEPRECATED(9.0);
87 public:
Color &operator=(const ignition::math::
Color &_color)
88 GAZEBO_DEPRECATED(9.0);
91 public: ignition::math::
Color Ign() const;
95 public:
Color(const
Color &_clr) GAZEBO_DEPRECATED(9.0);
98 public: virtual ~
Color() GAZEBO_DEPRECATED(9.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);
133 public:
Color &operator =(const
Color &_pt) GAZEBO_DEPRECATED(9.0);
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;
static const Color Blue
(0, 0, 1)
Definition: Color.hh:47
float a
Definition: Color.hh:268
float b
Definition: Color.hh:268
static const Color White
(1, 1, 1)
Definition: Color.hh:39
static const Color Red
(1, 0, 0)
Definition: Color.hh:43
unsigned int RGBA
Definition: Color.hh:55
unsigned int ABGR
Definition: Color.hh:67
unsigned int ARGB
Definition: Color.hh:63
static const Color Green
(0, 1, 0)
Definition: Color.hh:45
float r
Definition: Color.hh:268
GAZEBO_VISIBLE void Set(common::Image &_img, const msgs::Image &_msg)
Convert a msgs::Image to a common::Image.
Defines a color.
Definition: Color.hh:36
#define GAZEBO_DEPRECATED(version)
Definition: system.hh:328
static const Color Yellow
(1, 1, 0)
Definition: Color.hh:49
static const Color Black
(0, 0, 0)
Definition: Color.hh:41
static const Color Magenta
(1, 0, 1)
Definition: Color.hh:51
float g
Definition: Color.hh:268
unsigned int BGRA
Definition: Color.hh:59