cpp-sdl2
C++ header-only SDL2 wrapper
|
Represent a 4 channel pixel. More...
#include <pixel.hpp>
Public Member Functions | |
Pixel (void *target, SDL_PixelFormat const &fmt) | |
Construct a pixel structure. More... | |
Pixel & | operator= (Color const &c) |
Set color to this pixel via operator =. More... | |
void | set_color (Color const &c) |
Set color to this pixel. More... | |
Color | color () const |
Get color. More... | |
Uint8 | r () const |
Get red channel as byte. More... | |
Uint8 | g () const |
Get green channel as byte. More... | |
Uint8 | b () const |
Get blue channel as byte. More... | |
Uint8 | a () const |
Get alpha channel as byte. More... | |
void | set_r (Uint8 r) |
Set red channel from given byte. More... | |
void | set_g (Uint8 g) |
Set green channel from given byte. More... | |
void | set_b (Uint8 b) |
Set blue channel from given byte. More... | |
void | set_a (Uint8 a) |
Set alpha channel from given byte. More... | |
Private Member Functions | |
void | set_raw (Uint32 raw) |
Set this pixel from a 32byte value. More... | |
Uint32 | get_raw () const |
Get pixel as 32 bit value. More... | |
Private Attributes | |
void * | target_ |
pointer to target structure More... | |
const SDL_PixelFormat & | fmt_ |
Used pixel format on this format. More... | |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inlineprivate |
Set color to this pixel via operator =.
Definition at line 17 of file pixel.hpp.
References set_color().
|
inline |
|
inline |
Set alpha channel from given byte.
Definition at line 59 of file pixel.hpp.
References a(), color(), and set_color().
|
inline |
Set blue channel from given byte.
Definition at line 52 of file pixel.hpp.
References b(), color(), and set_color().
|
inline |
Set color to this pixel.
Definition at line 23 of file pixel.hpp.
References sdl::Color::as_uint(), fmt_, and set_raw().
Referenced by operator=(), set_a(), set_b(), set_g(), and set_r().
|
inline |
Set green channel from given byte.
Definition at line 45 of file pixel.hpp.
References color(), g(), and set_color().
|
inline |
Set red channel from given byte.
Definition at line 38 of file pixel.hpp.
References color(), r(), and set_color().
|
inlineprivate |
Set this pixel from a 32byte value.
Definition at line 68 of file pixel.hpp.
Referenced by set_color().
|
private |
|
private |