Aspen
2D C++ Class-Based Object Oriented Game Engine
Aspen::Graphics::Color Class Reference

Color class that is used to store RGBA8 color information. More...

#include <Graphics.hpp>

Public Member Functions

 Color (unsigned color=0xFFFFFFFF)
 Constructor. More...
 
 Color (unsigned char r, unsigned char g, unsigned char b, unsigned char a=0xFF)
 Constructor. More...
 
Uint8 Red () const
 Gets red of the color. More...
 
Uint8 Green () const
 Gets green of the color. More...
 
Uint8 Blue () const
 Gets blue of the color. More...
 
Uint8 Alpha () const
 Gets alpha of the color. More...
 
void Red (Uint8 r)
 Sets red of the color. More...
 
void Green (Uint8 g)
 Sets green of the color. More...
 
void Blue (Uint8 b)
 Sets blue of the color. More...
 
void Alpha (Uint8 a)
 Sets alpha of the color. More...
 
 operator SDL_Color () const
 Implicitly converts this class to SDL's color class.
 
bool operator== (const Color &rhs) const
 Equality operator. More...
 

Protected Attributes

unsigned _c
 RGBA8 color.
 

Detailed Description

Color class that is used to store RGBA8 color information.

Constructor & Destructor Documentation

◆ Color() [1/2]

Aspen::Graphics::Color::Color ( unsigned  color = 0xFFFFFFFF)

Constructor.

Parameters
colorRGBA8 color to use as data Defaults to fully white

◆ Color() [2/2]

Aspen::Graphics::Color::Color ( unsigned char  r,
unsigned char  g,
unsigned char  b,
unsigned char  a = 0xFF 
)

Constructor.

Parameters
rRed component
gGreen component
bBlue component
aAlpha component Defaults to fully opaque

Member Function Documentation

◆ Alpha() [1/2]

Uint8 Aspen::Graphics::Color::Alpha ( ) const

Gets alpha of the color.

Returns
Alpha component of the color

◆ Alpha() [2/2]

void Aspen::Graphics::Color::Alpha ( Uint8  a)

Sets alpha of the color.

Parameters
aAlpha component of the color

◆ Blue() [1/2]

Uint8 Aspen::Graphics::Color::Blue ( ) const

Gets blue of the color.

Returns
Blue component of the color

◆ Blue() [2/2]

void Aspen::Graphics::Color::Blue ( Uint8  b)

Sets blue of the color.

Parameters
bBlue component of the color

◆ Green() [1/2]

Uint8 Aspen::Graphics::Color::Green ( ) const

Gets green of the color.

Returns
Green component of the color

◆ Green() [2/2]

void Aspen::Graphics::Color::Green ( Uint8  g)

Sets green of the color.

Parameters
gGreen component of the color

◆ operator==()

bool Aspen::Graphics::Color::operator== ( const Color rhs) const

Equality operator.

Parameters
rhsColor to the right of the operator
Returns
True if both colors are equivalent False otherwise

◆ Red() [1/2]

Uint8 Aspen::Graphics::Color::Red ( ) const

Gets red of the color.

Returns
Red component of the color

◆ Red() [2/2]

void Aspen::Graphics::Color::Red ( Uint8  r)

Sets red of the color.

Parameters
rRed component of the color

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