RGB color with Alpha.
More...
#include <SDL2pp/Color.hh>
|
| constexpr | Color () |
| | Default constructor.
|
| |
| constexpr | Color (const SDL_Color &color) |
| | Construct a color from existing SDL_Color.
|
| |
| constexpr | Color (Uint8 r, Uint8 g, Uint8 b) |
| | Construct the color from given RGB, alpha is opaque.
|
| |
| constexpr | Color (Uint8 r, Uint8 g, Uint8 b, Uint8 a) |
| | Construct the color from given RGB and alpha values.
|
| |
|
| Color (const Color &) noexcept=default |
| | Copy constructor.
|
| |
|
| Color (Color &&) noexcept=default |
| | Move constructor.
|
| |
| Color & | operator= (const Color &) noexcept=default |
| | Assignment operator.
|
| |
| Color & | operator= (Color &&) noexcept=default |
| | Move assignment operator.
|
| |
| constexpr Uint8 | GetRed () const |
| | Get the red component from the color.
|
| |
| Color & | SetRed (int nr) |
| | Set the red component from the color.
|
| |
| constexpr Uint8 | GetGreen () const |
| | Get the green component from the color.
|
| |
| Color & | SetGreen (int ng) |
| | Set the green component from the color.
|
| |
| constexpr Uint8 | GetBlue () const |
| | Get the blue component from the color.
|
| |
| Color & | SetBlue (int nb) |
| | Set the blue component from the color.
|
| |
| constexpr Uint8 | GetAlpha () const |
| | Get the alpha component from the color.
|
| |
| Color & | SetAlpha (int na) |
| | Set the alpha component from the color.
|
| |
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
◆ Color() [1/4]
| constexpr SDL2pp::Color::Color |
( |
| ) |
|
|
inlineconstexpr |
Default constructor.
Creates a Color(0, 0, 0, 0)
◆ Color() [2/4]
| constexpr SDL2pp::Color::Color |
( |
const SDL_Color & |
color | ) |
|
|
inlineconstexpr |
Construct a color from existing SDL_Color.
- Parameters
-
| [in] | color | Existing SDL_Color |
◆ Color() [3/4]
| constexpr SDL2pp::Color::Color |
( |
Uint8 |
r, |
|
|
Uint8 |
g, |
|
|
Uint8 |
b |
|
) |
| |
|
inlineconstexpr |
Construct the color from given RGB, alpha is opaque.
- Parameters
-
| [in] | r | Red component in the range 0-255 |
| [in] | g | Green component in the range 0-255 |
| [in] | b | Blue component in the range 0-255 |
◆ Color() [4/4]
| constexpr SDL2pp::Color::Color |
( |
Uint8 |
r, |
|
|
Uint8 |
g, |
|
|
Uint8 |
b, |
|
|
Uint8 |
a |
|
) |
| |
|
inlineconstexpr |
Construct the color from given RGB and alpha values.
- Parameters
-
| [in] | r | Red component in the range 0-255 |
| [in] | g | Green component in the range 0-255 |
| [in] | b | Blue component in the range 0-255 |
| [in] | a | Alpha component in the range 0-255 |
◆ GetAlpha()
| constexpr Uint8 SDL2pp::Color::GetAlpha |
( |
| ) |
const |
|
inlineconstexpr |
Get the alpha component from the color.
- Returns
- The alpha component from the color
◆ GetBlue()
| constexpr Uint8 SDL2pp::Color::GetBlue |
( |
| ) |
const |
|
inlineconstexpr |
Get the blue component from the color.
- Returns
- The blue component from the color
◆ GetGreen()
| constexpr Uint8 SDL2pp::Color::GetGreen |
( |
| ) |
const |
|
inlineconstexpr |
Get the green component from the color.
- Returns
- The green component from the color
◆ GetRed()
| constexpr Uint8 SDL2pp::Color::GetRed |
( |
| ) |
const |
|
inlineconstexpr |
Get the red component from the color.
- Returns
- The red component from the color
◆ operator=() [1/2]
Move assignment operator.
- Returns
- Reference to self
◆ operator=() [2/2]
| Color & SDL2pp::Color::operator= |
( |
const Color & |
| ) |
|
|
defaultnoexcept |
Assignment operator.
- Returns
- Reference to self
◆ SetAlpha()
| Color & SDL2pp::Color::SetAlpha |
( |
int |
na | ) |
|
|
inline |
Set the alpha component from the color.
- Parameters
-
| [in] | na | New alpha component value |
- Returns
- Reference to self
◆ SetBlue()
| Color & SDL2pp::Color::SetBlue |
( |
int |
nb | ) |
|
|
inline |
Set the blue component from the color.
- Parameters
-
| [in] | nb | New blue component value |
- Returns
- Reference to self
◆ SetGreen()
| Color & SDL2pp::Color::SetGreen |
( |
int |
ng | ) |
|
|
inline |
Set the green component from the color.
- Parameters
-
| [in] | ng | New green component value |
- Returns
- Reference to self
◆ SetRed()
| Color & SDL2pp::Color::SetRed |
( |
int |
nr | ) |
|
|
inline |
Set the red component from the color.
- Parameters
-
| [in] | nr | New red component value |
- Returns
- Reference to self
The documentation for this class was generated from the following file: