22#ifndef SDL2PP_SURFACE_HH
23#define SDL2PP_SURFACE_HH
25#include <SDL_stdinc.h>
26#include <SDL_blendmode.h>
28#include <SDL2pp/Config.hh>
29#include <SDL2pp/Optional.hh>
30#include <SDL2pp/Rect.hh>
31#include <SDL2pp/Point.hh>
32#include <SDL2pp/Export.hh>
33#include <SDL2pp/Color.hh>
36struct SDL_PixelFormat;
55 SDL_Surface* surface_;
146 void* GetPixels()
const;
155 int GetPitch()
const;
163 const SDL_PixelFormat& GetFormat()
const;
173 explicit Surface(SDL_Surface* surface);
192 Surface(Uint32 flags,
int width,
int height,
int depth, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask);
212 Surface(
void* pixels,
int width,
int height,
int depth,
int pitch, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask);
214#ifdef SDL2PP_WITH_IMAGE
233 explicit Surface(
const std::string& filename);
284 SDL_Surface* Get()
const;
297 Surface Convert(
const SDL_PixelFormat& format);
310 Surface Convert(Uint32 pixel_format);
324 void Blit(
const Optional<Rect>& srcrect,
Surface& dst,
const Rect& dstrect);
338 void BlitScaled(
const Optional<Rect>& srcrect,
Surface& dst,
const Optional<Rect>& dstrect);
360 Rect GetClipRect()
const;
372 Uint32 GetColorKey()
const;
384 Uint8 GetAlphaMod()
const;
396 SDL_BlendMode GetBlendMode()
const;
409 Color GetColorAndAlphaMod()
const;
423 void GetColorMod(Uint8& r, Uint8& g, Uint8& b)
const;
437 Surface& SetClipRect(
const Optional<Rect>& rect = NullOpt);
452 Surface& SetColorKey(
bool flag, Uint32 key);
466 Surface& SetAlphaMod(Uint8 alpha = 255);
480 Surface& SetBlendMode(SDL_BlendMode blendMode);
496 Surface& SetColorMod(Uint8 r = 255, Uint8 g = 255, Uint8 b = 255);
538 Surface& FillRect(
const Optional<Rect>& rect, Uint32 color);
552 Surface& FillRects(
const Rect* rects,
int count, Uint32 color);
560 int GetWidth()
const;
568 int GetHeight()
const;
576 Point GetSize()
const;
587 Uint32 GetFormat()
const;
RGB color with Alpha.
Definition: Color.hh:48
2D point
Definition: Point.hh:51
I/O abstraction.
Definition: RWops.hh:156
2D rectangle
Definition: Rect.hh:50
SDL2pp::Surface lock.
Definition: Surface.hh:70
LockHandle(const LockHandle &other)=delete
Deleted copy constructor.
LockHandle & operator=(const LockHandle &other)=delete
Deleted assignment operator.
Image stored in system memory with direct access to pixel data.
Definition: Surface.hh:53
Surface & operator=(const Surface &)=delete
Deleted assignment operator.
Surface(const Surface &)=delete
Deleted copy constructor.