30 #ifndef _CEGUIColour_h_ 31 #define _CEGUIColour_h_ 33 #include "CEGUI/Base.h" 44 class CEGUIEXPORT Colour :
45 public AllocatedObject<Colour>
52 Colour(
const Colour& val);
53 Colour(
float red,
float green,
float blue,
float alpha = 1.0f);
59 argb_t getARGB(
void)
const 63 d_argb = calculateARGB();
70 float getAlpha(
void)
const {
return d_alpha;}
71 float getRed(
void)
const {
return d_red;}
72 float getGreen(
void)
const {
return d_green;}
73 float getBlue(
void)
const {
return d_blue;}
75 float getHue(
void)
const;
76 float getSaturation(
void)
const;
77 float getLumination(
void)
const;
83 void setARGB(argb_t argb);
84 inline void setAlpha(
float alpha)
90 inline void setRed(
float red)
96 inline void setGreen(
float green)
102 inline void setBlue(
float blue)
108 inline void set(
float red,
float green,
float blue,
float alpha = 1.0f)
117 inline void setRGB(
float red,
float green,
float blue)
125 inline void setRGB(
const Colour& val)
128 d_green = val.d_green;
132 d_argbValid = val.d_argbValid;
134 d_argb = (d_argb & 0xFF000000) | (val.d_argb & 0x00FFFFFF);
138 void setHSL(
float hue,
float saturation,
float luminance,
float alpha = 1.0f);
140 void invertColour(
void);
141 void invertColourWithAlpha(
void);
146 inline Colour& operator=(argb_t val)
152 inline Colour& operator=(
const Colour& val)
154 d_alpha = val.d_alpha;
156 d_green = val.d_green;
159 d_argbValid = val.d_argbValid;
164 inline Colour& operator&=(argb_t val)
166 setARGB(getARGB() & val);
170 inline Colour& operator&=(
const Colour& val)
172 setARGB(getARGB() & val.getARGB());
176 inline Colour& operator|=(argb_t val)
178 setARGB(getARGB() | val);
182 inline Colour& operator|=(
const Colour& val)
184 setARGB(getARGB() | val.getARGB());
188 inline Colour& operator<<=(
int val)
190 setARGB(getARGB() << val);
194 inline Colour& operator>>=(
int val)
196 setARGB(getARGB() >> val);
200 inline Colour
operator+(
const Colour& val)
const 204 d_green + val.d_green,
206 d_alpha + val.d_alpha
210 inline Colour operator-(
const Colour& val)
const 214 d_green - val.d_green,
216 d_alpha - val.d_alpha
220 inline Colour operator*(
const float val)
const 230 inline Colour& operator*=(
const Colour& val)
233 d_blue *= val.d_blue;
234 d_green *= val.d_green;
235 d_alpha *= val.d_alpha;
245 inline bool operator==(
const Colour& rhs)
const 247 return d_red == rhs.d_red &&
248 d_green == rhs.d_green &&
249 d_blue == rhs.d_blue &&
250 d_alpha == rhs.d_alpha;
253 inline bool operator!=(
const Colour& rhs)
const 255 return !(*
this == rhs);
261 operator argb_t()
const {
return getARGB();}
271 argb_t calculateARGB(
void)
const;
276 float d_alpha, d_red, d_green, d_blue;
277 mutable argb_t d_argb;
278 mutable bool d_argbValid;
284 #endif // end of guard _CEGUIColour_h_ bool CEGUIEXPORT operator==(const String &str1, const String &str2)
Return true if String str1 is equal to String str2.
Definition: cegui/src/String.cpp:150
Main namespace for Crazy Eddie's GUI Library.
Definition: cegui/include/CEGUI/Affector.h:42
uint32 argb_t
32 bit ARGB representation of a colour.
Definition: cegui/include/CEGUI/Colour.h:38
String CEGUIEXPORT operator+(const String &str1, const String &str2)
Return String object that is the concatenation of the given inputs.
Definition: cegui/src/String.cpp:371
bool CEGUIEXPORT operator!=(const String &str1, const String &str2)
Return true if String str1 is not equal to String str2.
Definition: cegui/src/String.cpp:176