Maps SDK for C++ 1.0.0
Loading...
Searching...
No Matches
gem::Rgba Struct Reference

RGBA color representation struct. More...

Collaboration diagram for gem::Rgba:

Classes

struct  BitField32
 RGBA bit field. More...

Public Member Functions

 Rgba (unsigned int aValue=0)
 Constructor assigning rgba color as a single int, or 0 (black) if none specified.
 Rgba (unsigned int red, unsigned int green, unsigned int blue, unsigned int alpha)
 Constructor assigning rgba color as 4 separate ints in the range 0-255 each.
 Rgba (const Rgba &clr, unsigned int alpha)
 Constructor assigning rgba color and an alpha value.
bool operator== (const Rgba &c) const
 Equal operator.
bool operator!= (const Rgba &c) const
 Not equal operator.
unsigned int argbValue () const
 Converts this RGBA value to ARGB.
unsigned int bgraValue () const
 Converts this RGBA value to BGRA.
RgbaswapRedBlue ()
 Swaps red and blue colors.
double getLuma () const
 Compute color luma in ITU-R BT.709 specs.
bool isLight () const
 check if color is light

Static Public Member Functions

static Rgba noColor ()
 Static member function returning default rgba no-color 0,0,0,0 so, considering the max is 255, this would be completely black with alpha 0 (transparent).
static Rgba black ()
 Static member function returning rgba color of (0, 0, 0, 255).
static Rgba white ()
 Static member function returning rgba color of (255, 255, 255, 255).

Public Attributes

union { 
   BitField32   color 
 Bitfield to access each individual r,g,b,a value as a byte.
   unsigned int   value 
 4 byte int to store rgba value, 1 byte for each of r,g,b,a.
}; 

Detailed Description

RGBA color representation struct.

Constructor & Destructor Documentation

◆ Rgba() [1/3]

gem::Rgba::Rgba ( unsigned int aValue = 0)
inline

Constructor assigning rgba color as a single int, or 0 (black) if none specified.

Parameters
aValueRGBA color as a single int.

◆ Rgba() [2/3]

gem::Rgba::Rgba ( unsigned int red,
unsigned int green,
unsigned int blue,
unsigned int alpha )
inline

Constructor assigning rgba color as 4 separate ints in the range 0-255 each.

Parameters
redRed color value in range 0-255.
greenGreen color value in range 0-255.
blueBlue color value in range 0-255.
alphaAlpha color value in range 0-255.

◆ Rgba() [3/3]

gem::Rgba::Rgba ( const Rgba & clr,
unsigned int alpha )
inline

Constructor assigning rgba color and an alpha value.

Parameters
clrRGBA color.
alphaAlpha color value in range 0-255.

Member Function Documentation

◆ argbValue()

unsigned int gem::Rgba::argbValue ( ) const
inline

Converts this RGBA value to ARGB.

Returns
ARGB value.

◆ bgraValue()

unsigned int gem::Rgba::bgraValue ( ) const
inline

Converts this RGBA value to BGRA.

Returns
BGRA value.

◆ black()

Rgba gem::Rgba::black ( )
inlinestatic

Static member function returning rgba color of (0, 0, 0, 255).

Returns
Rgba object with all values set to 0, except alpha set to 255.

◆ getLuma()

double gem::Rgba::getLuma ( ) const
inline

Compute color luma in ITU-R BT.709 specs.

Returns
Luma value

◆ isLight()

bool gem::Rgba::isLight ( ) const
inline

check if color is light

Returns
True if color is light, false otherwise

◆ noColor()

Rgba gem::Rgba::noColor ( )
inlinestatic

Static member function returning default rgba no-color 0,0,0,0 so, considering the max is 255, this would be completely black with alpha 0 (transparent).

Returns
Rgba object with all values set to 0.

◆ operator!=()

bool gem::Rgba::operator!= ( const Rgba & c) const
inline

Not equal operator.

Parameters
cRGBA color to compare to.
Returns
True if the colors are not equal, false otherwise.

◆ operator==()

bool gem::Rgba::operator== ( const Rgba & c) const
inline

Equal operator.

Parameters
cRGBA color to compare to.
Returns
True if the colors are equal, false otherwise.

◆ swapRedBlue()

Rgba & gem::Rgba::swapRedBlue ( )
inline

Swaps red and blue colors.

Returns
Return this object

◆ white()

Rgba gem::Rgba::white ( )
inlinestatic

Static member function returning rgba color of (255, 255, 255, 255).

Returns
Rgba object with all values set to 255.