Arctic Engine
Designed to give you control and not take anything away.
arctic::Rgba Struct Reference

Represents a color in RGBA format. More...

#include <rgba.h>

Public Member Functions

 Rgba ()
 Default constructor.
 
 Rgba (Ui32 rgba_in)
 Constructor from 32-bit RGBA value. More...
 
 Rgba (Ui8 r_in, Ui8 g_in, Ui8 b_in)
 Constructor for RGB color (alpha set to 255). More...
 
 Rgba (Ui8 r_in, Ui8 g_in, Ui8 b_in, Ui8 a_in)
 Constructor for RGBA color. More...
 
const bool operator!= (const Rgba &v) const
 Inequality comparison operator. More...
 
Rgbaoperator= (const Rgba &v)
 Assignment operator. More...
 
const bool operator== (const Rgba &v) const
 Equality comparison operator. More...
 
Ui8 & operator[] (Si32 i)
 Array subscript operator. More...
 
const Ui8 & operator[] (Si32 i) const
 Const array subscript operator. More...
 

Public Attributes

union {
   struct {
      Ui8   a
 Alpha component.
 
      Ui8   b
 Blue component.
 
      Ui8   g
 Green component.
 
      Ui8   r
 Red component.
 
   } 
 
   Ui8   element [4]
 Array access to color components.
 
   Ui32   rgba
 Combined RGBA value.
 
}; 
 

Detailed Description

Represents a color in RGBA format.

Constructor & Destructor Documentation

◆ Rgba() [1/3]

arctic::Rgba::Rgba ( Ui8  r_in,
Ui8  g_in,
Ui8  b_in 
)
inlineexplicit

Constructor for RGB color (alpha set to 255).

Parameters
r_inRed component
g_inGreen component
b_inBlue component

◆ Rgba() [2/3]

arctic::Rgba::Rgba ( Ui8  r_in,
Ui8  g_in,
Ui8  b_in,
Ui8  a_in 
)
inlineexplicit

Constructor for RGBA color.

Parameters
r_inRed component
g_inGreen component
b_inBlue component
a_inAlpha component (255 is opaque, 0 is transparent)

◆ Rgba() [3/3]

arctic::Rgba::Rgba ( Ui32  rgba_in)
inlineexplicit

Constructor from 32-bit RGBA value.

Parameters
rgba_in32-bit value containing 0xAABBGGRR (e.g., 0xff00ff00 is opaque green)

Member Function Documentation

◆ operator!=()

const bool arctic::Rgba::operator!= ( const Rgba v) const
inline

Inequality comparison operator.

Parameters
vRgba color to compare
Returns
True if colors are not equal, false otherwise

◆ operator=()

Rgba & arctic::Rgba::operator= ( const Rgba v)
inline

Assignment operator.

Parameters
vRgba color to assign
Returns
Reference to this object

◆ operator==()

const bool arctic::Rgba::operator== ( const Rgba v) const
inline

Equality comparison operator.

Parameters
vRgba color to compare
Returns
True if colors are equal, false otherwise

◆ operator[]() [1/2]

Ui8 & arctic::Rgba::operator[] ( Si32  i)
inline

Array subscript operator.

Parameters
iIndex of the color component (0-3)
Returns
Reference to the color component

◆ operator[]() [2/2]

const Ui8 & arctic::Rgba::operator[] ( Si32  i) const
inline

Const array subscript operator.

Parameters
iIndex of the color component (0-3)
Returns
Const reference to the color component

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