55 unsigned char rgba[ 4 ];
61 rgba[ 0 ] = rgba[ 1 ] = rgba[ 2 ] = rgba[ 3 ] = 0;
70 GlsColor(
unsigned char r,
unsigned char g,
unsigned char b,
unsigned char a = 255 )
83 rgba[ 0 ] = newColor[ 0 ];
84 rgba[ 1 ] = newColor[ 1 ];
85 rgba[ 2 ] = newColor[ 2 ];
86 rgba[ 3 ] = newColor[ 3 ];
94 rgba[ 0 ] = (
unsigned char)( ( rgbaVal & 0xFF000000 ) >> 24 );
95 rgba[ 1 ] = (
unsigned char)( ( rgbaVal & 0x00FF0000 ) >> 16 );
96 rgba[ 2 ] = (
unsigned char)( ( rgbaVal & 0x0000FF00 ) >> 8 );
97 rgba[ 3 ] = (
unsigned char)( ( rgbaVal & 0x000000FF ) );
103 memcpy( rgba, color.rgba,
sizeof(
unsigned char ) * 4 );
112 void SetRGBA4f(
float r,
float g,
float b,
float a = 1 )
114 rgba[ 0 ] = (
unsigned char)( r * 255.0f );
115 rgba[ 1 ] = (
unsigned char)( g * 255.0f );
116 rgba[ 2 ] = (
unsigned char)( b * 255.0f );
117 rgba[ 3 ] = (
unsigned char)( a * 255.0f );
126 void GetRGBA4f(
float& r,
float& g,
float& b,
float& a )
const
128 r = (float)rgba[ 0 ] / 255.0f;
129 g = (float)rgba[ 1 ] / 255.0f;
130 b = (float)rgba[ 2 ] / 255.0f;
131 a = (float)rgba[ 3 ] / 255.0f;
140 void SetRGBA4d(
double r,
double g,
double b,
double a = 1 )
142 rgba[ 0 ] = (
unsigned char)( r * 255.0 );
143 rgba[ 1 ] = (
unsigned char)( g * 255.0 );
144 rgba[ 2 ] = (
unsigned char)( b * 255.0 );
145 rgba[ 3 ] = (
unsigned char)( a * 255.0 );
154 void GetRGBA4d(
double& r,
double& g,
double& b,
double& a )
const
156 r = (double)rgba[ 0 ] / 255.0;
157 g = (double)rgba[ 1 ] / 255.0;
158 b = (double)rgba[ 2 ] / 255.0;
159 a = (double)rgba[ 3 ] / 255.0;
168 void RGBA(
unsigned char r,
unsigned char g,
unsigned char b,
unsigned char a = 255 )
179 void RGBA(
const unsigned char newColor[] )
181 memcpy( rgba, newColor,
sizeof(
unsigned char ) * 4 );
187 void RGBA(
unsigned long rgbaVal )
189 rgba[ 0 ] = (
unsigned char)( ( rgbaVal & 0xFF000000 ) >> 24 );
190 rgba[ 1 ] = (
unsigned char)( ( rgbaVal & 0x00FF0000 ) >> 16 );
191 rgba[ 2 ] = (
unsigned char)( ( rgbaVal & 0x0000FF00 ) >> 8 );
192 rgba[ 3 ] = (
unsigned char)( ( rgbaVal & 0x000000FF ) );
198 unsigned char*
RGBA(
void ) {
return rgba; }
199 const unsigned char*
RGBA(
void )
const {
return rgba; }
204 return ( rgba[ 0 ] << 24 ) | ( rgba[ 1 ] << 16 ) | ( rgba[ 2 ] << 8 ) | rgba[ 3 ];
208 unsigned char R(
void )
const {
return rgba[ 0 ]; }
211 unsigned char G(
void )
const {
return rgba[ 1 ]; }
214 unsigned char B(
void )
const {
return rgba[ 2 ]; }
217 unsigned char A(
void )
const {
return rgba[ 3 ]; }
222 void R(
const unsigned char val ) { rgba[ 0 ] = val; }
227 void G(
const unsigned char val ) { rgba[ 1 ] = val; }
232 void B(
const unsigned char val ) { rgba[ 2 ] = val; }
237 void A(
const unsigned char val ) { rgba[ 3 ] = val; }
245 return 0 == memcmp( rgba, arg.rgba,
sizeof(
unsigned char ) * 4 );
254 return 0 != memcmp( rgba, arg.rgba,
sizeof(
unsigned char ) * 4 );
262 memcpy( rgba, color.rgba,
sizeof(
unsigned char ) * 4 );
268 DISTI_EXPORT std::ostream& operator<<( std::ostream& outstr,
const GlsColor& color );
269 DISTI_EXPORT std::istream& operator>>( std::istream& instr, GlsColor& color );
The DistiUnhideGlobalsDummyClass class.
GlsColor glsColor
Alias for backwards compatibility.
Definition: gls_color.h:272
void RGBA(const unsigned char newColor[])
Definition: gls_color.h:179
bool operator==(const GlsColor &arg) const
Definition: gls_color.h:243
unsigned char R(void) const
Definition: gls_color.h:208
void RGBA(unsigned long rgbaVal)
Definition: gls_color.h:187
void SetRGBA4d(double r, double g, double b, double a=1)
Definition: gls_color.h:140
unsigned char B(void) const
Definition: gls_color.h:214
void GetRGBA4f(float &r, float &g, float &b, float &a) const
Definition: gls_color.h:126
void R(const unsigned char val)
Definition: gls_color.h:222
A file for all GL Studio files to include.
GlsColor(const GlsColor &color)
Definition: gls_color.h:101
GlsColor(const unsigned char newColor[])
Definition: gls_color.h:81
GlsColor(unsigned char r, unsigned char g, unsigned char b, unsigned char a=255)
Definition: gls_color.h:70
GlsColor(unsigned long rgbaVal)
Definition: gls_color.h:92
void B(const unsigned char val)
Definition: gls_color.h:232
void GetRGBA4d(double &r, double &g, double &b, double &a) const
Definition: gls_color.h:154
unsigned char G(void) const
Definition: gls_color.h:211
Definition: gls_color.h:53
void SetRGBA4f(float r, float g, float b, float a=1)
Definition: gls_color.h:112
unsigned long RGBA_ULong(void) const
Definition: gls_color.h:202
GlsColor(void)
Definition: gls_color.h:59
unsigned char * RGBA(void)
Definition: gls_color.h:198
GlsColor & operator=(const GlsColor &color)
Definition: gls_color.h:258
unsigned char A(void) const
Definition: gls_color.h:217
void A(const unsigned char val)
Definition: gls_color.h:237
bool operator!=(const GlsColor &arg) const
Definition: gls_color.h:252
Definition: bmpimage.h:46
void RGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a=255)
Definition: gls_color.h:168
void G(const unsigned char val)
Definition: gls_color.h:227