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);
98 public: ignition::math::Vector3d HSV()
const;
104 public:
void SetFromHSV(
float _h,
float _s,
float _v);
114 public: ignition::math::Vector3d YUV()
const;
120 public:
void SetFromYUV(
float _y,
float _u,
float _v);
130 public:
float operator[](
unsigned int _index);
134 public: RGBA GetAsRGBA()
const;
138 public: BGRA GetAsBGRA()
const;
142 public: ARGB GetAsARGB()
const;
146 public: ABGR GetAsABGR()
const;
151 public:
void SetFromRGBA(
const RGBA _v);
155 public:
void SetFromBGRA(
const BGRA _v);
159 public:
void SetFromARGB(
const ARGB _v);
163 public:
void SetFromABGR(
const ABGR _v);
168 public:
Color operator+(
const Color &_pt)
const;
173 public:
Color operator+(
const float &_v)
const;
178 public:
const Color &operator+=(
const Color &_pt);
183 public:
Color operator-(
const Color &_pt)
const;
188 public:
Color operator-(
const float &_v)
const;
193 public:
const Color &operator-=(
const Color &_pt);
198 public:
const Color operator/(
const Color &_pt)
const;
203 public:
const Color operator/(
const float &_v)
const;
208 public:
const Color &operator/=(
const Color &_pt);
213 public:
const Color operator*(
const Color &_pt)
const;
218 public:
const Color operator*(
const float &_v)
const;
223 public:
const Color &operator*=(
const Color &_pt);
228 public:
bool operator ==(
const Color &_pt)
const;
233 public:
bool operator!=(
const Color &_pt)
const;
236 private:
void Clamp();
242 public:
friend std::ostream &operator<< (std::ostream &_out,
245 _out << _pt.
r <<
" " << _pt.
g <<
" " << _pt.
b <<
" " << _pt.
a;
252 public:
friend std::istream &operator>> (std::istream &_in,
Color &_pt)
255 _in.setf(std::ios_base::skipws);
256 _in >> _pt.
r >> _pt.
g >> _pt.
b >> _pt.
a;
261 public:
float r, g, b, a;
static const Color Blue
(0, 0, 1)
Definition: Color.hh:47
float a
Definition: Color.hh:261
float b
Definition: Color.hh:261
static const Color White
(1, 1, 1)
Definition: Color.hh:39
Forward declarations for the common classes.
Definition: Animation.hh:33
The Vector3 class represents the generic vector containing 3 elements.
Definition: Vector3.hh:39
static const Color Purple
(1, 0, 1)
Definition: Color.hh:51
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:261
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
static const Color Yellow
(1, 1, 0)
Definition: Color.hh:49
static const Color Black
(0, 0, 0)
Definition: Color.hh:41
float g
Definition: Color.hh:261
unsigned int BGRA
Definition: Color.hh:59