26 #ifndef __TERRALIB_COLOR_INTERNAL_RGBACOLOR_H
27 #define __TERRALIB_COLOR_INTERNAL_RGBACOLOR_H
30 #include "../common/HexUtils.h"
181 void getRgba(
int* r,
int* g,
int* b,
int* a=0)
const;
201 void setColor(
const std::string& hexColor);
220 void setColor(
int r,
int g,
int b,
int a=255);
254 : m_rgba((a << 24) + (r << 16) + (g << 8) + b)
256 assert(r >= 0 && r <= 255);
257 assert(g >= 0 && g <= 255);
258 assert(b >= 0 && b <= 255);
259 assert(a >= 0 && a <= 255);
297 return (((
m_rgba) & 0xFF0000) >> 16);
302 return (((
m_rgba) & 0x00FF00) >> 8);
307 return ((
m_rgba) & 0x0000FF);
312 return (((
m_rgba) & 0xFF000000) >> 24);
318 *a = (
m_rgba & 0xFF000000) >> 24;
319 *r = (
m_rgba & 0xFF0000) >> 16;
320 *g = (
m_rgba & 0xFF00) >> 8;
331 assert(hexColor.size() == 7);
332 assert(hexColor[0] ==
'#');
336 int r = int((highR << 4) + lowR);
340 int g = int((highG << 4) + lowG);
344 int b = int((highB << 4) + lowB);
353 std::string result(buffer);
359 m_rgba = (a << 24) + (r << 16) + (g << 8) + b;
370 #endif // __TERRALIB_COLOR_INTERNAL_RGBACOLOR_H
void setColor(const std::string &hexColor)
It sets the color using a two hexadecimal RGB-encoded color.
int getRed() const
It returns the red component color value (a value from 0 to 255).
int getBlue() const
It returns the blue component color value (a value from 0 to 255).
int getGreen() const
It returns the green component color value (a value from 0 to 255).
Configuration flags for the Color module of TerraLib.
unsigned char GetDecimalFromHexNotCS(unsigned char hexValue)
It returns the decimal value in a char from a given hex value (for example: 'A' => 10...
RGBAColor()
Default constructor of a new color.
te::color::RGBAColor & operator=(const RGBAColor &color)
Assigns a copy of a color to this color, and returns a reference to it.
#define TE_OPAQUE
For an RGBA color this is the value of the alpha-channel for totally opaque.
int getAlpha() const
It returns the alpha component color value (a value from 0 to 255).
bool operator!=(const RGBAColor &color) const
It compares the colors are different.
std::string getColor() const
It gets the color encoded using two hexadecimal digits per primary-color component, in the order Red, Green, Blue, prefixed with a hash (#) sign.
A helper class for 32-bit RGBA (Red-Green-Blue-Alpha channel) color.
int getRgba() const
It returns the color value (0xAARRGGBB).
bool operator==(const RGBAColor &color) const
It compares the colors are iqual.
int m_rgba
It returns the internal representation as a 32-bits RGBA color.