|
cpp-sdl2
C++ header-only SDL2 wrapper
|
C++ wrapping around the SDL_Color structure. More...
#include <color.hpp>
Inheritance diagram for sdl::Color:Public Member Functions | |
| constexpr | Color () |
| Construct an sdl::Color object. Color will be black by default. More... | |
| constexpr | Color (Uint8 r, Uint8 g, Uint8 b, Uint8 a=255) |
| Construct an sdl Color::object with the given 8 bit color values. More... | |
| constexpr | Color (Color const &)=default |
| Default copy ctor. More... | |
| constexpr | Color (Color &&)=default |
| Default move ctor. More... | |
| Color (Uint32 raw, SDL_PixelFormat const &format) | |
| Converting constructor that will initialize the color with a given 32 bit value, according to the provided PixelFormat. More... | |
| Color (Uint32 raw, Uint32 format) | |
| Converting constructor that will initialize the color with a given 32 bit value, according to the provided PixelFormat. More... | |
| Color & | operator= (Color const &)=default |
| Default copy assing operator. More... | |
| Color & | operator= (Color &&)=default |
| Default move assing operator. More... | |
| Uint32 | as_uint (SDL_PixelFormat const &format) const |
| Return the color of the current object as a 32bit number (4 bytes) More... | |
| Uint32 | as_uint (Uint32 format) const |
| Return the color of the current object as a 32bit number (4 bytes) More... | |
| bool | operator== (Color const &c) const |
| Return true if both colors are identical. More... | |
Static Public Member Functions | |
| static constexpr Color | White () |
| static constexpr Color | Black () |
| static constexpr Color | Red () |
| static constexpr Color | Green () |
| static constexpr Color | Blue () |
| static constexpr Color | Transparent () |
Friends | |
| std::ostream & | operator<< (std::ostream &stream, Color const &c) |
| Output stream overload that will print the value of the current color as a 4D vector of 8bit numbers. More... | |
|
inline |
Construct an sdl::Color object. Color will be black by default.
Definition at line 14 of file color.hpp.
Referenced by Color().
|
inline |
Construct an sdl Color::object with the given 8 bit color values.
Alpha channel to fully opaque by default
| r | 8 bit quantity of red |
| g | 8 bit quantity of green |
| b | 8 bit quantity of blue |
| a | 8 bit opacity level. Default to 255 (0xff) |
Definition at line 21 of file color.hpp.
References sdl::simd::a, and Color().
|
default |
Default copy ctor.
|
default |
Default move ctor.
|
inline |
Converting constructor that will initialize the color with a given 32 bit value, according to the provided PixelFormat.
Definition at line 33 of file color.hpp.
References sdl::simd::a.
|
inline |
Converting constructor that will initialize the color with a given 32 bit value, according to the provided PixelFormat.
Definition at line 39 of file color.hpp.
References sdl::simd::a, and operator=().
|
inline |
Return the color of the current object as a 32bit number (4 bytes)
| format | pixel format to use |
Definition at line 55 of file color.hpp.
References sdl::simd::a.
Referenced by as_uint(), sdl::Pixel::set_color(), and sdl::Surface::set_colorkey().
|
inline |
Default copy assing operator.
Referenced by Color().
|
inline |
Return true if both colors are identical.
Definition at line 78 of file color.hpp.
References sdl::simd::a.
|
inlinestatic |
|
friend |