Rose
|
A wrapper class for SDL_Surface pointers. More...
#include <Surface.h>
Public Member Functions | |
Surface ()=default | |
Create an empty Surface. | |
Surface (SDL_Surface *surface) | |
Create a Surface initialized with an SDL_Surface pointer. More... | |
Surface (const std::filesystem::path &path) | |
Create a surface from a file. More... | |
Surface (int width, int height, int depth=32, SDL_PixelFormatEnum format=SDL_PIXELFORMAT_RGBA8888) | |
Constructor. More... | |
Surface (Size size, int depth=32, SDL_PixelFormatEnum format=SDL_PIXELFORMAT_RGBA8888) | |
Surface (int width, int height, int depth, uint32_t rmask, uint32_t gmask, uint32_t bmask, uint32_t amask) | |
uint32_t & | pixel (int x, int y) const |
Provide access to a pixel of the Surface. More... | |
color::RGBA | color (int x, int y) const |
Get a pixel color of the Surface. More... | |
void | setColor (int x, int y, color::RGBA color) |
Set a pixel color of the Surface. More... | |
bool | createWithFormat (int width, int height, int depth=32, SDL_PixelFormatEnum format=SDL_PIXELFORMAT_RGBA8888) |
Create a surface using SDL_CreateRGBSurfaceWithFormat() More... | |
int | fillRectangle (const Rectangle &rect, const color::RGBA &color) |
Fill a rectangle using SDL_FillRect() More... | |
int | fillRectangle (const color::RGBA &color) |
Fill the Surface using SDL_FillRect() More... | |
bool | textureFromSurface (Context &context, Texture &texture) |
Create an SDL_Texture from the Surface and set it in the Texture object. More... | |
Texture | toTexture (Context &context) |
Create an SDL_Texture from the surface. More... | |
int | setBlendMode (SDL_BlendMode blendMode) noexcept |
Set the Surfacle SDL_BlendMode. More... | |
int | blitSurface (Surface &source) |
Blit the contents of the source Surface to this surface. More... | |
A wrapper class for SDL_Surface pointers.
Provide a std::unique_ptr storage type for SDL_Surface pointers.
|
inlineexplicit |
Create a Surface initialized with an SDL_Surface pointer.
surface | The SDL_Surface pointer. |
|
explicit |
Create a surface from a file.
path | The path to the file to load. |
rose::gm::Surface::Surface | ( | int | width, |
int | height, | ||
int | depth = 32 , |
||
SDL_PixelFormatEnum | format = SDL_PIXELFORMAT_RGBA8888 |
||
) |
Constructor.
Create a surface using SDL_CreateRGBSurfaceWithFormat()
width | The width of the surface. |
height | The height of the surface. |
depth | The pixel depth, defaults to 32. |
format | The format, defaults to SDL_PIXELFORMAT_RGBA8888 |
int rose::gm::Surface::blitSurface | ( | Surface & | source | ) |
color::RGBA rose::gm::Surface::color | ( | int | x, |
int | y | ||
) | const |
Get a pixel color of the Surface.
x | The x co-ordinate. |
y | The y co-ordinate. |
bool rose::gm::Surface::createWithFormat | ( | int | width, |
int | height, | ||
int | depth = 32 , |
||
SDL_PixelFormatEnum | format = SDL_PIXELFORMAT_RGBA8888 |
||
) |
Create a surface using SDL_CreateRGBSurfaceWithFormat()
width | The width of the surface. |
height | The height of the surface. |
depth | The pixel depth, defaults to 32. |
format | The format, defaults to SDL_PIXELFORMAT_RGBA8888 |
int rose::gm::Surface::fillRectangle | ( | const Rectangle & | rect, |
const color::RGBA & | color | ||
) |
Fill a rectangle using SDL_FillRect()
rect | The Rectangle to fill. |
color | The fill Color. |
int rose::gm::Surface::fillRectangle | ( | const color::RGBA & | color | ) |
Fill the Surface using SDL_FillRect()
color | The fill Color. |
uint32_t & rose::gm::Surface::pixel | ( | int | x, |
int | y | ||
) | const |
Provide access to a pixel of the Surface.
The co-ordinates are not checked for out of range values.
x | The X co-ordinate. |
y | The Y co-ordinate. |
|
noexcept |
Set the Surfacle SDL_BlendMode.
blendMode | The blend mode, a value from SDL_BlendMode enum. |
void rose::gm::Surface::setColor | ( | int | x, |
int | y, | ||
color::RGBA | color | ||
) |
Set a pixel color of the Surface.
x | The x co-ordinate. |
y | The y co-ordinate. |
color | the color as an RGBA. |
Create an SDL_Texture from the surface.
context | The Renderer used. |