SDL2Surface

SDL Surface wrapper. A SDL2Surface might own the SDL_Surface* handle or not.

Constructors

this
this(SDL2 sdl2, SDL_Surface* surface, Owned owned)

Create from an existing SDL_Surface* handle.

this
this(SDL2 sdl2, int width, int height, int depth, uint Rmask, uint Gmask, uint Bmask, uint Amask)

Create a new RGBA surface. Both pixels data and handle are owned.

this
this(SDL2 sdl2, void* pixels, int width, int height, int depth, int pitch, uint Rmask, uint Gmask, uint Bmask, uint Amask)

Create surface from RGBA data. Pixels data is <b>not</b> and not owned.

Destructor

~this
~this()

Releases the SDL resource.

Members

Enums

Owned
enum Owned

Whether a SDL Surface is owned by the wrapper or borrowed.

Functions

blit
void blit(SDL2Surface source, SDL_Rect srcRect, SDL_Rect dstRect)

Perform a fast surface copy of given source surface to this destination surface.

blitScaled
void blitScaled(SDL2Surface source, SDL_Rect srcRect, SDL_Rect dstRect)

Perform a scaled surface copy of given source surface to this destination surface.

clone
SDL2Surface clone()
convert
SDL2Surface convert(const(SDL_PixelFormat)* newFormat)

Converts the surface to another format.

getRGBA
RGBA getRGBA(int x, int y)

Get a surface pixel color.

handle
SDL_Surface* handle()
lock
void lock()

Lock the surface, allow to use pixels().

pitch
size_t pitch()

Get the surface pitch (number of bytes between lines).

pixelFormat
SDL_PixelFormat* pixelFormat()
pixels
ubyte* pixels()
setColorKey
void setColorKey(bool enable, uint key)

Enable the key color as the transparent key.

setColorKey
void setColorKey(bool enable, ubyte r, ubyte g, ubyte b, ubyte a)

Enable the (r, g, b, a) key color as the transparent key.

unlock
void unlock()

Unlock the surface.

Properties

height
int height [@property getter]
width
int width [@property getter]

Structs

RGBA
struct RGBA

Variables

_handleOwned
Owned _handleOwned;
Undocumented in source.
_sdl2
SDL2 _sdl2;
Undocumented in source.
_surface
SDL_Surface* _surface;
Undocumented in source.

Meta