SDL Surface wrapper.
A SDL2Surface might own the SDL_Surface* handle or not.
Whether a SDL Surface is owned by the wrapper or borrowed.
this(SDL2 sdl2, SDL_Surface* surface, Owned owned);
Create from an existing SDL_Surface* handle.
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.
- See Also
- http://wiki.libsdl.org/SDL_CreateRGBSurface
- Throws
- SDL2Exception on error.
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 not and not owned.
- See Also
- clone, SDL_CreateRGBSurfaceFrom
- Throws
- SDL2Exception on error.
SDL2Surface convert(const(SDL_PixelFormat)* newFormat);
Converts the surface to another format.
- See Also
- http://wiki.libsdl.org/SDL_ConvertSurface
- Returns
- A new surface.
- Returns
- A copy of the surface, useful for taking ownership of not-owned pixel data.
- See Also
- $WEB(wiki.libsdl.org/SDL_CreateRGBSurfaceFrom,SDL_CreateRGBSurfaceFrom)
const @property int width();
- Returns
- Width of the surface in pixels.
- Returns
- Height of the surface in pixels.
- Returns
- Pointer to surface data.
You must lock the surface before accessng it.
Get the surface pitch (number of bytes between lines).
Lock the surface, allow to use pixels().
- Throws
- SDL2Exception on error.
- Returns
- SDL_PixelFormat which describe the surface.
Get a surface pixel color.
- Known Bugs
- must be locked when using this method. Slow!
void blit(SDL2Surface source, SDL_Rect srcRect, SDL_Rect dstRect);
Perform a fast surface copy of given source surface to this destination surface.
- See Also
- http://wiki.libsdl.org/SDL_BlitSurface
- Throws
- SDL2Exception on error.
void blitScaled(SDL2Surface source, SDL_Rect srcRect, SDL_Rect dstRect);
Perform a scaled surface copy of given source surface to this destination surface.
- See Also
- http://wiki.libsdl.org/SDL_BlitScaled
- Throws
- SDL2Exception on error.