GL Studio C++ Runtime API
GlsColor Class Reference

#include <gls_color.h>

Public Member Functions

 GlsColor ()
 
 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 ()
 
const unsigned char * RGBA () const
 
unsigned long RGBA_ULong () const
 
unsigned char R () const
 
unsigned char G () const
 
unsigned char B () const
 
unsigned char A () 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() [1/5]

GlsColor ( )
inline

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

◆ GlsColor() [2/5]

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() [3/5]

GlsColor ( const unsigned char  newColor[])
inline

4ubv constructor. Intializes using rgba value

Parameters
newColor4 character RGBA array, range 0-255

◆ GlsColor() [4/5]

GlsColor ( unsigned long  rgbaVal)
inline

4ul constructor.

Parameters
rgbaValUnsigned long containing color in the form RRGGBBAA (8 bits per component

◆ GlsColor() [5/5]

GlsColor ( const GlsColor color)
inline

Copy constructor.

Parameters
colorThe color to copy from.

Member Function Documentation

◆ A() [1/2]

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

◆ A() [2/2]

void A ( const unsigned char  val)
inline

Set the Alpha component of this color

Parameters
valThe new value for the component

◆ B() [1/2]

unsigned char B ( ) const
inline
Returns
The Blue component of this color

◆ B() [2/2]

void B ( const unsigned char  val)
inline

Set the Blue component of this color

Parameters
valThe new value for the component

◆ G() [1/2]

unsigned char G ( ) const
inline
Returns
The Green component of this color

◆ G() [2/2]

void G ( const unsigned char  val)
inline

Set the Green component of this color

Parameters
valThe new value for the component

◆ GetRGBA4d()

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

◆ GetRGBA4f()

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

◆ operator!=()

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

◆ operator=()

GlsColor & operator= ( const GlsColor color)
inline

Assignment operator

Parameters
colorThe color to copy.
Returns
The resulting color (this).

◆ operator==()

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

◆ R() [1/2]

unsigned char R ( ) const
inline
Returns
The Red component of this color

◆ R() [2/2]

void R ( const unsigned char  val)
inline

Set the Red component of this color

Parameters
valThe new value for the component

◆ RGBA() [1/5]

unsigned char * RGBA ( )
inline

Gets RGBA value

Returns
A pointer to array of 4 unsigned chars containing rgba (0-255 range).

◆ RGBA() [2/5]

const unsigned char * RGBA ( ) const
inline

Gets RGBA value

Returns
A const pointer to array of 4 unsigned chars containing rgba (0-255 range).

◆ RGBA() [3/5]

void RGBA ( const unsigned char  newColor[])
inline

Sets RGBA value

Parameters
newColor4 character RGBA array, range 0-255

◆ RGBA() [4/5]

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

◆ RGBA() [5/5]

void RGBA ( unsigned long  rgbaVal)
inline

Sets RGBA value

Parameters
rgbaValUnsigned long containing color in the form RRGGBBAA (8 bits per component

◆ RGBA_ULong()

unsigned long RGBA_ULong ( ) const
inline
Returns
RGBA value packed into a 32 bit unsigned int in host byte order

◆ SetRGBA4d()

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

◆ SetRGBA4f()

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: