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;
float r
Definition: Color.hh:258
static const Color Red
(1, 0, 0)
Definition: Color.hh:46
static const Color White
(1, 1, 1)
Definition: Color.hh:42
The Vector3 class represents the generic vector containing 3 elements.
Definition: Vector3.hh:43
float a
Definition: Color.hh:258
unsigned int ARGB
Definition: Color.hh:66
unsigned int BGRA
Definition: Color.hh:62
static const Color Blue
(0, 0, 1)
Definition: Color.hh:50
float g
Definition: Color.hh:258
unsigned int RGBA
Definition: Color.hh:58
unsigned int ABGR
Definition: Color.hh:70
static const Color Purple
(1, 0, 1)
Definition: Color.hh:54
static const Color Green
(0, 1, 0)
Definition: Color.hh:48
static const Color Yellow
(1, 1, 0)
Definition: Color.hh:52
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:39
float b
Definition: Color.hh:258
static const Color Black
(0, 0, 0)
Definition: Color.hh:44
#define GAZEBO_VISIBLE
Use to represent "symbol visible" if supported.
Definition: system.hh:48