GL Studio C++ Runtime API
GlsColor Class Reference

#include <gls_color.h>

Public Member Functions

 GlsColor (void)
 
 GlsColor (unsigned char r, unsigned char g, unsigned char b, unsigned char a=255)
 
 GlsColor (const unsigned char newColor[])
 
 GlsColor (unsigned long rgbaVal)
 
 GlsColor (const GlsColor &color)
 
void SetRGBA4f (float r, float g, float b, float a=1)
 
void GetRGBA4f (float &r, float &g, float &b, float &a) const
 
void SetRGBA4d (double r, double g, double b, double a=1)
 
void GetRGBA4d (double &r, double &g, double &b, double &a) const
 
void RGBA (unsigned char r, unsigned char g, unsigned char b, unsigned char a=255)
 
void RGBA (const unsigned char newColor[])
 
void RGBA (unsigned long rgbaVal)
 
unsigned char * RGBA (void)
 
unsigned long RGBA_ULong (void) const
 
unsigned char R (void) const
 
unsigned char G (void) const
 
unsigned char B (void) const
 
unsigned char A (void) const
 
void R (const unsigned char val)
 
void G (const unsigned char val)
 
void B (const unsigned char val)
 
void A (const unsigned char val)
 
bool operator== (const GlsColor &arg) const
 
bool operator!= (const GlsColor &arg) const
 
GlsColoroperator= (const GlsColor &color)
 

Detailed Description

The Color class: Implements a 4 component RGBA color.

Constructor & Destructor Documentation

GlsColor ( void  )
inline

Red, Green, Blue, Alpha 0-255 range default constructor. Intializes rgba data to zero

GlsColor ( unsigned char  r,
unsigned char  g,
unsigned char  b,
unsigned char  a = 255 
)
inline

4ub constructor. Intializes using rgba values

Parameters
rRed value, range 0-255
gGreen value, range 0-255
bBlue value, range 0-255
aAlpha value, range 0-255
GlsColor ( const unsigned char  newColor[])
inline

4ubv constructor. Intializes using rgba value

Parameters
newColor4 character RGBA array, range 0-255
GlsColor ( unsigned long  rgbaVal)
inline

4ul constructor.

Parameters
rgbaValUnsigned long containing color in the form RRGGBBAA (8 bits per component
GlsColor ( const GlsColor color)
inline

copy constructor.

Member Function Documentation

unsigned char A ( void  ) const
inline
Returns
The Alpha component of this color
void A ( const unsigned char  val)
inline

Set the Alpha component of this color

Parameters
valThe new value for the component
unsigned char B ( void  ) const
inline
Returns
The Blue component of this color
void B ( const unsigned char  val)
inline

Set the Blue component of this color

Parameters
valThe new value for the component
unsigned char G ( void  ) const
inline
Returns
The Green component of this color
void G ( const unsigned char  val)
inline

Set the Green component of this color

Parameters
valThe new value for the component
void GetRGBA4d ( double &  r,
double &  g,
double &  b,
double &  a 
) const
inline

Gets RGBA value using doubles

Parameters
rRed value, range 0-1.0
gGreen value, range 0-1.0
bBlue value, range 0-1.0
aAlpha value, range 0-1.0
void GetRGBA4f ( float &  r,
float &  g,
float &  b,
float &  a 
) const
inline

Gets RGBA value using floats

Parameters
rRed value, range 0-1.0
gGreen value, range 0-1.0
bBlue value, range 0-1.0
aAlpha value, range 0-1.0
bool operator!= ( const GlsColor arg) const
inline

Determines if the color is NOT identical to the supplied color

Parameters
argcolor to compare to
Returns
TRUE if NOT equal, else FALSE
GlsColor& operator= ( const GlsColor color)
inline

Copy another color into this one

bool operator== ( const GlsColor arg) const
inline

Determines if the color is identical to the supplied color

Parameters
argcolor to compare to
Returns
TRUE if equal, else FALSE
unsigned char R ( void  ) const
inline
Returns
The Red component of this color
void R ( const unsigned char  val)
inline

Set the Red component of this color

Parameters
valThe new value for the component
void RGBA ( unsigned char  r,
unsigned char  g,
unsigned char  b,
unsigned char  a = 255 
)
inline

Sets RGBA value

Parameters
rRed value, range 0-255
gGreen value, range 0-255
bBlue value, range 0-255
aAlpha value, range 0-255
void RGBA ( const unsigned char  newColor[])
inline

Sets RGBA value

Parameters
newColor4 character RGBA array, range 0-255
void RGBA ( unsigned long  rgbaVal)
inline

Sets RGBA value

Parameters
rgbaValUnsigned long containing color in the form RRGGBBAA (8 bits per component
unsigned char* RGBA ( void  )
inline

Gets RGBA value

Returns
Pointer to array of 4 unsigned chars containing rgba (0-255 range)
unsigned long RGBA_ULong ( void  ) const
inline
Returns
RGBA value packed into a 32 bit unsigned int in host byte order
void SetRGBA4d ( double  r,
double  g,
double  b,
double  a = 1 
)
inline

Sets RGBA value using doubles

Parameters
rRed value, range 0-1.0
gGreen value, range 0-1.0
bBlue value, range 0-1.0
aAlpha value, range 0-1.0
void SetRGBA4f ( float  r,
float  g,
float  b,
float  a = 1 
)
inline

Sets RGBA value using floats

Parameters
rRed value, range 0-1.0
gGreen value, range 0-1.0
bBlue value, range 0-1.0
aAlpha value, range 0-1.0

The documentation for this class was generated from the following file: