libSDL2pp  0.16.0
C++11 bindings/wrapper for SDL2
Public Member Functions | List of all members
SDL2pp::Color Class Reference

RGB color with Alpha. More...

#include <SDL2pp/Color.hh>

Inheritance diagram for SDL2pp::Color:

Public Member Functions

constexpr Color ()
 Default constructor. More...
 
constexpr Color (const SDL_Color &color)
 Construct a color from existing SDL_Color. More...
 
constexpr Color (Uint8 r, Uint8 g, Uint8 b)
 Construct the color from given RGB, alpha is opaque. More...
 
constexpr Color (Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 Construct the color from given RGB and alpha values. More...
 
 Color (const Color &) noexcept=default
 Copy constructor.
 
 Color (Color &&) noexcept=default
 Move constructor.
 
Coloroperator= (const Color &) noexcept=default
 Assignment operator. More...
 
Coloroperator= (Color &&) noexcept=default
 Move assignment operator. More...
 
constexpr Uint8 GetRed () const
 Get the red component from the color. More...
 
ColorSetRed (int nr)
 Set the red component from the color. More...
 
constexpr Uint8 GetGreen () const
 Get the green component from the color. More...
 
ColorSetGreen (int ng)
 Set the green component from the color. More...
 
constexpr Uint8 GetBlue () const
 Get the blue component from the color. More...
 
ColorSetBlue (int nb)
 Set the blue component from the color. More...
 
constexpr Uint8 GetAlpha () const
 Get the alpha component from the color. More...
 
ColorSetAlpha (int na)
 Set the alpha component from the color. More...
 

Detailed Description

RGB color with Alpha.

This class is public-derived from SDL_Color structure, may generally used as it if passed via pointer or reference. It also supports direct access to r, g, b and a members.

See also
http://wiki.libsdl.org/SDL_Color

Constructor & Destructor Documentation

◆ Color() [1/4]

constexpr SDL2pp::Color::Color ( )
inline

Default constructor.

Creates a Color(0, 0, 0, 0)

◆ Color() [2/4]

constexpr SDL2pp::Color::Color ( const SDL_Color &  color)
inline

Construct a color from existing SDL_Color.

Parameters
[in]colorExisting SDL_Color

◆ Color() [3/4]

constexpr SDL2pp::Color::Color ( Uint8  r,
Uint8  g,
Uint8  b 
)
inline

Construct the color from given RGB, alpha is opaque.

Parameters
[in]rRed component in the range 0-255
[in]gGreen component in the range 0-255
[in]bBlue component in the range 0-255

◆ Color() [4/4]

constexpr SDL2pp::Color::Color ( Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)
inline

Construct the color from given RGB and alpha values.

Parameters
[in]rRed component in the range 0-255
[in]gGreen component in the range 0-255
[in]bBlue component in the range 0-255
[in]aAlpha component in the range 0-255

Member Function Documentation

◆ GetAlpha()

constexpr Uint8 SDL2pp::Color::GetAlpha ( ) const
inline

Get the alpha component from the color.

Returns
The alpha component from the color

◆ GetBlue()

constexpr Uint8 SDL2pp::Color::GetBlue ( ) const
inline

Get the blue component from the color.

Returns
The blue component from the color

◆ GetGreen()

constexpr Uint8 SDL2pp::Color::GetGreen ( ) const
inline

Get the green component from the color.

Returns
The green component from the color

◆ GetRed()

constexpr Uint8 SDL2pp::Color::GetRed ( ) const
inline

Get the red component from the color.

Returns
The red component from the color

◆ operator=() [1/2]

Color& SDL2pp::Color::operator= ( const Color )
defaultnoexcept

Assignment operator.

Returns
Reference to self

◆ operator=() [2/2]

Color& SDL2pp::Color::operator= ( Color &&  )
defaultnoexcept

Move assignment operator.

Returns
Reference to self

◆ SetAlpha()

Color& SDL2pp::Color::SetAlpha ( int  na)
inline

Set the alpha component from the color.

Parameters
[in]naNew alpha component value
Returns
Reference to self

◆ SetBlue()

Color& SDL2pp::Color::SetBlue ( int  nb)
inline

Set the blue component from the color.

Parameters
[in]nbNew blue component value
Returns
Reference to self

◆ SetGreen()

Color& SDL2pp::Color::SetGreen ( int  ng)
inline

Set the green component from the color.

Parameters
[in]ngNew green component value
Returns
Reference to self

◆ SetRed()

Color& SDL2pp::Color::SetRed ( int  nr)
inline

Set the red component from the color.

Parameters
[in]nrNew red component value
Returns
Reference to self

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