22 #ifndef _GAZEBO_COLOR_HH_
23 #define _GAZEBO_COLOR_HH_
58 public:
typedef unsigned int RGBA;
62 public:
typedef unsigned int BGRA;
66 public:
typedef unsigned int ARGB;
70 public:
typedef unsigned int ABGR;
80 public:
Color(
float _r,
float _g,
float _b,
float _a = 1.0);
87 public:
virtual ~
Color();
97 public:
void Set(
float _r = 1,
float _g = 1 ,
float _b = 1,
float _a = 1);
107 public:
void SetFromHSV(
float _h,
float _s,
float _v);
117 public:
void SetFromYUV(
float _y,
float _u,
float _v);
127 public:
float operator[](
unsigned int _index);
131 public:
RGBA GetAsRGBA()
const;
135 public:
BGRA GetAsBGRA()
const;
139 public:
ARGB GetAsARGB()
const;
143 public:
ABGR GetAsABGR()
const;
148 public:
void SetFromRGBA(
const RGBA _v);
152 public:
void SetFromBGRA(
const BGRA _v);
156 public:
void SetFromARGB(
const ARGB _v);
160 public:
void SetFromABGR(
const ABGR _v);
165 public:
Color operator+(
const Color &_pt)
const;
170 public:
Color operator+(
const float &_v)
const;
175 public:
const Color &operator+=(
const Color &_pt);
180 public:
Color operator-(
const Color &_pt)
const;
185 public:
Color operator-(
const float &_v)
const;
190 public:
const Color &operator-=(
const Color &_pt);
195 public:
const Color operator/(
const Color &_pt)
const;
200 public:
const Color operator/(
const float &_v)
const;
205 public:
const Color &operator/=(
const Color &_pt);
210 public:
const Color operator*(
const Color &_pt)
const;
215 public:
const Color operator*(
const float &_v)
const;
220 public:
const Color &operator*=(
const Color &_pt);
225 public:
bool operator ==(
const Color &_pt)
const;
230 public:
bool operator!=(
const Color &_pt)
const;
233 private:
void Clamp();
239 public:
friend std::ostream &operator<< (std::ostream &_out,
242 _out << _pt.
r <<
" " << _pt.
g <<
" " << _pt.
b <<
" " << _pt.
a;
249 public:
friend std::istream &operator>> (std::istream &_in,
Color &_pt)
252 _in.setf(std::ios_base::skipws);
253 _in >> _pt.
r >> _pt.
g >> _pt.
b >> _pt.
a;
258 public:
float r, g, b, a;