17 #ifndef _GAZEBO_COLOR_HH_
18 #define _GAZEBO_COLOR_HH_
21 #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);
84 public:
virtual ~
Color();
94 public:
void Set(
float _r = 1,
float _g = 1 ,
float _b = 1,
float _a = 1);
104 public: ignition::math::Vector3d HSV() const;
110 public:
void SetFromHSV(
float _h,
float _s,
float _v);
116 public: math::Vector3 GetAsYUV() const;
120 public: ignition::math::Vector3d YUV() const;
126 public:
void SetFromYUV(
float _y,
float _u,
float _v);
136 public:
float operator[](
unsigned int _index);
140 public:
RGBA GetAsRGBA() const;
144 public:
BGRA GetAsBGRA() const;
148 public:
ARGB GetAsARGB() const;
152 public:
ABGR GetAsABGR() const;
157 public:
void SetFromRGBA(const
RGBA _v);
161 public:
void SetFromBGRA(const
BGRA _v);
165 public:
void SetFromARGB(const
ARGB _v);
169 public:
void SetFromABGR(const
ABGR _v);
174 public:
Color operator+(const
Color &_pt) const;
179 public:
Color operator+(const
float &_v) const;
184 public: const
Color &operator+=(const
Color &_pt);
189 public:
Color operator-(const
Color &_pt) const;
194 public:
Color operator-(const
float &_v) const;
199 public: const
Color &operator-=(const
Color &_pt);
204 public: const
Color operator/(const
Color &_pt) const;
209 public: const
Color operator/(const
float &_v) const;
214 public: const
Color &operator/=(const
Color &_pt);
219 public: const
Color operator*(const
Color &_pt) const;
224 public: const
Color operator*(const
float &_v) const;
229 public: const
Color &operator*=(const
Color &_pt);
234 public:
bool operator ==(const
Color &_pt) const;
239 public:
bool operator!=(const
Color &_pt) const;
242 private:
void Clamp();
248 public: friend std::ostream &operator<< (std::ostream &_out,
251 _out << _pt.
r <<
" " << _pt.g <<
" " << _pt.b <<
" " << _pt.a;
258 public:
friend std::istream &operator>> (std::istream &_in,
Color &_pt)
261 _in.setf(std::ios_base::skipws);
262 _in >> _pt.
r >> _pt.
g >> _pt.
b >> _pt.
a;
267 public:
float r, g, b, a;
float r
Definition: Color.hh:267
static const Color Red
(1, 0, 0)
Definition: Color.hh:43
static const Color White
(1, 1, 1)
Definition: Color.hh:39
The Vector3 class represents the generic vector containing 3 elements.
Definition: Vector3.hh:39
float a
Definition: Color.hh:267
unsigned int ARGB
Definition: Color.hh:63
#define GAZEBO_DEPRECATED(version)
Definition: CommonTypes.hh:47
unsigned int BGRA
Definition: Color.hh:59
#define GZ_COMMON_VISIBLE
Definition: system.hh:91
static const Color Blue
(0, 0, 1)
Definition: Color.hh:47
float g
Definition: Color.hh:267
unsigned int RGBA
Definition: Color.hh:55
unsigned int ABGR
Definition: Color.hh:67
static const Color Purple
(1, 0, 1)
Definition: Color.hh:51
static const Color Green
(0, 1, 0)
Definition: Color.hh:45
static const Color Yellow
(1, 1, 0)
Definition: Color.hh:49
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
float b
Definition: Color.hh:267
static const Color Black
(0, 0, 0)
Definition: Color.hh:41