cpp-sdl2
C++ header-only SDL2 wrapper
|
Represent an SDL_Surface. More...
#include <surface.hpp>
Classes | |
class | Lock |
Represent a lock to safely access surface content. More... | |
Public Member Functions | |
Surface (SDL_Surface *surface) | |
Explicit converting ctor from C SDL_Surface to sdl::Surface. More... | |
Surface (Surface &&other) noexcept | |
Surface & | operator= (Surface &&other) noexcept |
Surface (Uint32 flags, int w, int h, int depth, Uint32 rmask, Uint32 gmask, Uint32 bmask, Uint32 amask) | |
Create surface for given parameters. More... | |
Surface (void *pixels, int w, int h, int depth, int pitch, Uint32 rmask, Uint32 gmask, Uint32 bmask, Uint32 amask) | |
Create surface from array of pixels. More... | |
Surface (Uint32 flags, int w, int h, int depth, Uint32 format) | |
Create surface with specified format. More... | |
Surface (void *pixels, int w, int h, int depth, int pitch, int format) | |
Create surface from array of pixels. More... | |
Surface (std::string const &filename) | |
Construct surface from image file, require SDL_Image. More... | |
Surface (std::string const &filename) | |
Stubbed constructor for missing SDL_Image usage. More... | |
~Surface () | |
RAII dtor to automatically free the surface. More... | |
SDL_Surface * | ptr () const |
Get C SDL_Surface object. More... | |
Surface | with_format (SDL_PixelFormat const &format) const |
Convert surface to given format. More... | |
Surface | with_format (Uint32 format) const |
convert surface from given format More... | |
Surface & | convert_to (SDL_PixelFormat const &format) |
Convert this surface to specified format. More... | |
Surface & | convert_to (Uint32 format) |
Convert this surface to specified format. More... | |
bool | has_colorkey () const |
void | blit_on (Rect const &src, Surface &surf, Rect const &dst) const |
Blit surface on another. More... | |
void | blit_on (Surface &surf, Rect const &dst) const |
Blit surface on another. More... | |
int | width () const |
Get width of surface. More... | |
int | height () const |
Get height of surface. More... | |
Vec2i | size () const |
Get size of surface. More... | |
SDL_PixelFormat const & | pixelformat () const |
Get surface's pixel format. More... | |
Uint32 | format () const |
Get surface format. More... | |
Uint32 | flags () const |
Get surface flags. More... | |
Rect | cliprect () const |
Get surface clip rectangle. More... | |
void | disable_colorkey () const |
disable colorkey More... | |
void | set_colorkey (Uint32 key) const |
Set colorkey. More... | |
void | set_colorkey (Color const &color) const |
Set colorkey. More... | |
Color | colorkey () const |
Get color key. More... | |
void | set_blendmode (SDL_BlendMode const &bm) const |
Set surface blend mode. More... | |
SDL_BlendMode | blendmode () const |
void | set_colormod (Color const &color) const |
Set colormod. More... | |
void | set_colormod (Uint8 r, Uint8 g, Uint8 b) const |
Set colormod. More... | |
Color | colormod () const |
Get colormod. More... | |
void | set_alphamod (Uint8 alpha) const |
Set alphamod. More... | |
Uint8 | alphamod () const |
Get alphamod. More... | |
void | set_coloralphamod (Uint8 r, Uint8 g, Uint8 b, Uint8 a) const |
Set color and alpha mod. More... | |
void | set_coloralphamod (Color const &c) const |
Set color and alpha mod. More... | |
Color | coloralphamod () const |
Get color and alpha mod. More... | |
Lock | lock () |
Lock surface for raw access to pixel. More... | |
Private Attributes | |
SDL_Surface * | surface_ = nullptr |
Set surface pointer. More... | |
Represent an SDL_Surface.
Definition at line 21 of file surface.hpp.
|
inlineexplicit |
Explicit converting ctor from C SDL_Surface to sdl::Surface.
Definition at line 59 of file surface.hpp.
|
inlinenoexcept |
Definition at line 61 of file surface.hpp.
|
inline |
Create surface for given parameters.
Definition at line 75 of file surface.hpp.
References sdl::Surface::Lock::surface_.
|
inline |
Create surface from array of pixels.
Definition at line 90 of file surface.hpp.
References sdl::Surface::Lock::surface_.
|
inline |
Create surface with specified format.
Definition at line 106 of file surface.hpp.
References sdl::Surface::Lock::surface_.
|
inline |
Create surface from array of pixels.
Definition at line 113 of file surface.hpp.
References sdl::Surface::Lock::Surface, and sdl::Surface::Lock::surface_.
|
inline |
Construct surface from image file, require SDL_Image.
Definition at line 121 of file surface.hpp.
|
inline |
Stubbed constructor for missing SDL_Image usage.
Definition at line 128 of file surface.hpp.
|
inline |
RAII dtor to automatically free the surface.
Definition at line 141 of file surface.hpp.
References sdl::Surface::Lock::surface_.
|
inline |
Get alphamod.
Definition at line 281 of file surface.hpp.
References sdl::Surface::Lock::surface_.
Referenced by coloralphamod().
|
inline |
Definition at line 251 of file surface.hpp.
References sdl::Surface::Lock::surface_.
Blit surface on another.
Definition at line 174 of file surface.hpp.
References sdl::Surface::Lock::surface_, and surface_.
Blit surface on another.
Definition at line 185 of file surface.hpp.
References sdl::Surface::Lock::surface_, and surface_.
|
inline |
Get surface clip rectangle.
Definition at line 211 of file surface.hpp.
References sdl::Surface::Lock::surface_.
|
inline |
Get color and alpha mod.
Definition at line 302 of file surface.hpp.
References alphamod(), and colormod().
|
inline |
Get color key.
Definition at line 239 of file surface.hpp.
References pixelformat(), and sdl::Surface::Lock::surface_.
|
inline |
Get colormod.
Definition at line 267 of file surface.hpp.
References sdl::Surface::Lock::surface_.
Referenced by coloralphamod().
|
inline |
Convert this surface to specified format.
Definition at line 165 of file surface.hpp.
References with_format().
|
inline |
Convert this surface to specified format.
Definition at line 167 of file surface.hpp.
References with_format().
|
inline |
disable colorkey
Definition at line 219 of file surface.hpp.
References sdl::Surface::Lock::surface_.
|
inline |
Get surface flags.
Definition at line 208 of file surface.hpp.
References sdl::Surface::Lock::surface_.
|
inline |
Get surface format.
Definition at line 205 of file surface.hpp.
References sdl::Surface::Lock::surface_.
|
inline |
Definition at line 170 of file surface.hpp.
References sdl::Surface::Lock::surface_.
|
inline |
Get height of surface.
Definition at line 197 of file surface.hpp.
References sdl::Surface::Lock::surface_.
Referenced by size().
|
inline |
Lock surface for raw access to pixel.
Return a lock object that permit to access the pixels. When lock goes out of scope, resources goes unlocked automatically
Definition at line 312 of file surface.hpp.
References sdl::Surface::Lock::surface_.
Definition at line 63 of file surface.hpp.
References sdl::Surface::Lock::surface_.
|
inline |
Get surface's pixel format.
Definition at line 202 of file surface.hpp.
References sdl::Surface::Lock::surface_.
Referenced by colorkey(), and set_colorkey().
|
inline |
Get C SDL_Surface object.
Definition at line 144 of file surface.hpp.
References sdl::Surface::Lock::surface_.
Referenced by sdl::Window::set_icon(), and sdl::Texture::Texture().
|
inline |
Set alphamod.
Definition at line 276 of file surface.hpp.
References sdl::Surface::Lock::surface_.
Referenced by set_coloralphamod().
|
inline |
Set surface blend mode.
Definition at line 247 of file surface.hpp.
References sdl::Surface::Lock::surface_.
|
inline |
Set color and alpha mod.
Definition at line 290 of file surface.hpp.
References set_alphamod(), and set_colormod().
|
inline |
Set color and alpha mod.
Definition at line 296 of file surface.hpp.
References set_alphamod(), and set_colormod().
|
inline |
|
inline |
Set colorkey.
Definition at line 230 of file surface.hpp.
References sdl::Color::as_uint(), pixelformat(), and sdl::Surface::Lock::surface_.
|
inline |
Set colormod.
Definition at line 259 of file surface.hpp.
References set_colormod().
Referenced by set_coloralphamod(), and set_colormod().
|
inline |
|
inline |
|
inline |
Get width of surface.
Definition at line 195 of file surface.hpp.
References sdl::Surface::Lock::surface_.
Referenced by size().
|
inline |
Convert surface to given format.
format | What pixel format to use |
Definition at line 148 of file surface.hpp.
References sdl::Surface::Lock::surface_.
Referenced by convert_to().
|
inline |
convert surface from given format
format | what format to use |
Definition at line 157 of file surface.hpp.
References sdl::Surface::Lock::surface_.
|
private |