40 if (sdlSurface !=
nullptr)
41 SDL_FreeSurface(sdlSurface);
50 class Surface :
public std::unique_ptr<SDL_Surface, SurfaceDestroy> {
67 explicit Surface(
const std::filesystem::path &path);
76 Surface(
int width,
int height,
int depth = 32, SDL_PixelFormatEnum format = SDL_PIXELFORMAT_RGBA8888);
78 explicit Surface(
Size size,
int depth = 32, SDL_PixelFormatEnum format = SDL_PIXELFORMAT_RGBA8888)
79 :
Surface(size.w, size.h, depth, format) {}
81 Surface(
int width,
int height,
int depth, uint32_t rmask, uint32_t gmask, uint32_t bmask, uint32_t amask);
90 [[nodiscard]] uint32_t &
pixel(
int x,
int y)
const;
98 [[nodiscard]]
color::RGBA color(
int x,
int y)
const;
117 createWithFormat(
int width,
int height,
int depth = 32, SDL_PixelFormatEnum format = SDL_PIXELFORMAT_RGBA8888);
153 int setBlendMode(SDL_BlendMode blendMode) noexcept;
160 int blitSurface(
Surface &source);
190 explicit operator bool() const noexcept {
Definition: GraphicsModel.cpp:20
A functor to destroy an SDL_Surface.
Definition: Surface.h:33
void operator()(SDL_Surface *sdlSurface)
Call the SDL API to free the SDL_Surface.
Definition: Surface.h:39
A wrapper class for SDL_Surface pointers.
Definition: Surface.h:50
Red Green Blue Alpha representation of a color.
Definition: Color.h:64
A helper class to wrap the SDL_LockSurface and SDL_UnlockSurface API calls.
Definition: Surface.h:167
SDL_Surface * mSurface
The surface being locked.
Definition: Surface.h:170
Abstraction of SDL_Texture.
Definition: Texture.h:46
Context
Definition: GraphicsModel.h:76
Surface(SDL_Surface *surface)
Create a Surface initialized with an SDL_Surface pointer.
Definition: Surface.h:61
A composite of a Position and a Size.
Definition: Types.h:307
int pixel(SDL_Renderer *renderer, Sint16 x, Sint16 y)
Draw pixel in currently set color.
Definition: GfxPrimitives.cpp:20
A size in integer dimensions.
Definition: Types.h:230