SDL3pp
A slim C++ wrapper for SDL3
Loading...
Searching...
No Matches
SDL3pp_image.h
1#ifndef SDL3PP_IMAGE_H_
2#define SDL3PP_IMAGE_H_
3
4#include "SDL3pp_error.h"
5#include "SDL3pp_render.h"
6#include "SDL3pp_surface.h"
7#include "SDL3pp_version.h"
8#include "SDL3pp_video.h"
9
10#if defined(SDL3PP_ENABLE_IMAGE) || defined(SDL3PP_DOC)
11
12#include <SDL3_image/SDL_image.h>
13
14namespace SDL {
15
26// Forward decl
27struct Animation;
28
30using AnimationRaw = IMG_Animation*;
31
32// Forward decl
33struct AnimationRef;
34
37{
39
42 : value(value)
43 {
44 }
45
47 constexpr AnimationParam(std::nullptr_t = nullptr)
48 : value(nullptr)
49 {
50 }
51
53 constexpr explicit operator bool() const { return !!value; }
54
56 constexpr auto operator<=>(const AnimationParam& other) const = default;
57
59 constexpr operator AnimationRaw() const { return value; }
60
62 constexpr auto operator->() { return value; }
63};
64
67{
69
72 : value(value)
73 {
74 }
75
79 {
80 }
81
83 constexpr AnimationConstParam(std::nullptr_t = nullptr)
84 : value(nullptr)
85 {
86 }
87
89 constexpr explicit operator bool() const { return !!value; }
90
92 constexpr auto operator<=>(const AnimationConstParam& other) const = default;
93
95 constexpr operator const AnimationRaw() const { return value; }
96
98 constexpr auto operator->() { return value; }
99};
100
101#ifdef SDL3PP_DOC
102
108#define SDL_IMAGE_MAJOR_VERSION
109
110#define SDL_IMAGE_MINOR_VERSION
111
112#define SDL_IMAGE_MICRO_VERSION
113
115
119#define SDL_IMAGE_VERSION \
120 SDL_VERSIONNUM( \
121 SDL_IMAGE_MAJOR_VERSION, SDL_IMAGE_MINOR_VERSION, SDL_IMAGE_MICRO_VERSION)
122
124#define SDL_IMAGE_VERSION_ATLEAST(X, Y, Z) \
125 ((SDL_IMAGE_MAJOR_VERSION >= X) && \
126 (SDL_IMAGE_MAJOR_VERSION > X || SDL_IMAGE_MINOR_VERSION >= Y) && \
127 (SDL_IMAGE_MAJOR_VERSION > X || SDL_IMAGE_MINOR_VERSION > Y || \
128 SDL_IMAGE_MICRO_VERSION >= Z))
129
130#endif // SDL3PP_DOC
131
132namespace IMG {
133
141inline int Version() { return IMG_Version(); }
142
143} // namespace IMG
144
200 StringParam type,
201 bool closeio = false)
202{
203 return Surface(IMG_LoadTyped_IO(src, closeio, type));
204}
205
241inline Surface LoadSurface(StringParam file) { return Surface(IMG_Load(file)); }
242
289inline Surface LoadSurface(IOStreamParam src, bool closeio = false)
290{
291 return Surface(IMG_Load_IO(src, closeio));
292}
293
295 : m_resource(IMG_Load(file))
296{
297}
298
299inline Surface::Surface(IOStreamParam src, bool closeio)
300 : m_resource(IMG_Load_IO(src, closeio))
301{
302}
303
333{
334 return Texture(IMG_LoadTexture(renderer, file));
335}
336
378 IOStreamParam src,
379 bool closeio = false)
380{
381 return Texture(IMG_LoadTexture_IO(renderer, src, closeio));
382}
383
385 : m_resource(IMG_LoadTexture(renderer, file))
386{
387}
388
389inline Texture::Texture(RendererParam renderer, IOStreamParam src, bool closeio)
390 : m_resource(IMG_LoadTexture_IO(renderer, src, closeio))
391{
392}
393
442 IOStreamParam src,
443 StringParam type,
444 bool closeio = false)
445{
446 return Texture(IMG_LoadTextureTyped_IO(renderer, src, closeio, type));
447}
448
490inline bool isAVIF(IOStreamParam src) { return IMG_isAVIF(src); }
491
532inline bool isICO(IOStreamParam src) { return IMG_isICO(src); }
533
574inline bool isCUR(IOStreamParam src) { return IMG_isCUR(src); }
575
616inline bool isBMP(IOStreamParam src) { return IMG_isBMP(src); }
617
658inline bool isGIF(IOStreamParam src) { return IMG_isGIF(src); }
659
700inline bool isJPG(IOStreamParam src) { return IMG_isJPG(src); }
701
742inline bool isJXL(IOStreamParam src) { return IMG_isJXL(src); }
743
784inline bool isLBM(IOStreamParam src) { return IMG_isLBM(src); }
785
826inline bool isPCX(IOStreamParam src) { return IMG_isPCX(src); }
827
868inline bool isPNG(IOStreamParam src) { return IMG_isPNG(src); }
869
910inline bool isPNM(IOStreamParam src) { return IMG_isPNM(src); }
911
952inline bool isSVG(IOStreamParam src) { return IMG_isSVG(src); }
953
994inline bool isQOI(IOStreamParam src) { return IMG_isQOI(src); }
995
1036inline bool isTIF(IOStreamParam src) { return IMG_isTIF(src); }
1037
1078inline bool isXCF(IOStreamParam src) { return IMG_isXCF(src); }
1079
1120inline bool isXPM(IOStreamParam src) { return IMG_isXPM(src); }
1121
1162inline bool isXV(IOStreamParam src) { return IMG_isXV(src); }
1163
1204inline bool isWEBP(IOStreamParam src) { return IMG_isWEBP(src); }
1205
1239{
1240 return Surface(IMG_LoadAVIF_IO(src));
1241}
1242
1276{
1277 return Surface{IMG_LoadICO_IO(src)};
1278}
1279
1313{
1314 return Surface{IMG_LoadCUR_IO(src)};
1315}
1316
1350{
1351 return Surface{IMG_LoadBMP_IO(src)};
1352}
1353
1387{
1388 return Surface{IMG_LoadGIF_IO(src)};
1389}
1390
1424{
1425 return Surface{IMG_LoadJPG_IO(src)};
1426}
1427
1461{
1462 return Surface{IMG_LoadJXL_IO(src)};
1463}
1464
1498{
1499 return Surface{IMG_LoadLBM_IO(src)};
1500}
1501
1535{
1536 return Surface{IMG_LoadPCX_IO(src)};
1537}
1538
1572{
1573 return Surface{IMG_LoadPNG_IO(src)};
1574}
1575
1609{
1610 return Surface{IMG_LoadPNM_IO(src)};
1611}
1612
1646{
1647 return Surface{IMG_LoadSVG_IO(src)};
1648}
1649
1683{
1684 return Surface{IMG_LoadQOI_IO(src)};
1685}
1686
1720{
1721 return Surface{IMG_LoadTGA_IO(src)};
1722}
1723
1757{
1758 return Surface{IMG_LoadTIF_IO(src)};
1759}
1760
1794{
1795 return Surface{IMG_LoadXCF_IO(src)};
1796}
1797
1831{
1832 return Surface{IMG_LoadXPM_IO(src)};
1833}
1834
1867inline Surface LoadXV(IOStreamParam src) { return Surface{IMG_LoadXV_IO(src)}; }
1868
1902{
1903 return Surface{IMG_LoadWEBP_IO(src)};
1904}
1905
1922{
1923 return Surface(IMG_LoadSizedSVG_IO(src, size.x, size.y));
1924}
1925
1940inline Surface ReadXPMFromArray(char** xpm)
1941{
1942 return Surface{IMG_ReadXPMFromArray(xpm)};
1943}
1944
1959{
1960 return Surface{IMG_ReadXPMFromArrayToRGB888(xpm)};
1961}
1962
1976inline void SaveAVIF(SurfaceParam surface, StringParam file, int quality)
1977{
1978 CheckError(IMG_SaveAVIF(surface, file, quality));
1979}
1980
1999inline void SaveAVIF(SurfaceParam surface,
2000 IOStreamParam dst,
2001 int quality,
2002 bool closeio = false)
2003{
2004 CheckError(IMG_SaveAVIF_IO(surface, dst, closeio, quality));
2005}
2006
2020inline void SavePNG(SurfaceParam surface, StringParam file)
2021{
2022 CheckError(IMG_SavePNG(surface, file));
2023}
2024
2041inline void SavePNG(SurfaceParam surface,
2042 IOStreamParam dst,
2043 bool closeio = false)
2044{
2045 CheckError(IMG_SavePNG_IO(surface, dst, closeio));
2046}
2047
2061inline void SaveJPG(SurfaceParam surface, StringParam file, int quality)
2062{
2063 CheckError(IMG_SaveJPG(surface, file, quality));
2064}
2065
2084inline void SaveJPG(SurfaceParam surface,
2085 IOStreamParam dst,
2086 int quality,
2087 bool closeio = false)
2088{
2089 CheckError(IMG_SaveJPG_IO(surface, dst, closeio, quality));
2090}
2091
2100{
2101 AnimationRaw m_resource = nullptr;
2102
2103public:
2105 constexpr Animation(std::nullptr_t = nullptr) noexcept
2106 : m_resource(0)
2107 {
2108 }
2109
2117 constexpr explicit Animation(const AnimationRaw resource) noexcept
2118 : m_resource(resource)
2119 {
2120 }
2121
2122protected:
2124 constexpr Animation(const Animation& other) noexcept = default;
2125
2126public:
2128 constexpr Animation(Animation&& other) noexcept
2129 : Animation(other.release())
2130 {
2131 }
2132
2133 constexpr Animation(const AnimationRef& other) = delete;
2134
2135 constexpr Animation(AnimationRef&& other) = delete;
2136
2151 : m_resource(IMG_LoadAnimation(file))
2152 {
2153 }
2154
2174 Animation(IOStreamParam src, bool closeio = false)
2175 : m_resource(IMG_LoadAnimation_IO(src, closeio))
2176 {
2177 }
2178
2180 constexpr const AnimationRaw operator->() const noexcept
2181 {
2182 return m_resource;
2183 }
2184
2186 constexpr AnimationRaw operator->() noexcept { return m_resource; }
2187
2189 ~Animation() { IMG_FreeAnimation(m_resource); }
2190
2192 constexpr Animation& operator=(Animation&& other) noexcept
2193 {
2194 std::swap(m_resource, other.m_resource);
2195 return *this;
2196 }
2197
2198protected:
2200 constexpr Animation& operator=(const Animation& other) noexcept = default;
2201
2202public:
2204 constexpr AnimationRaw get() const noexcept { return m_resource; }
2205
2207 constexpr AnimationRaw release() noexcept
2208 {
2209 auto r = m_resource;
2210 m_resource = nullptr;
2211 return r;
2212 }
2213
2215 constexpr auto operator<=>(const Animation& other) const noexcept = default;
2216
2218 constexpr explicit operator bool() const noexcept { return !!m_resource; }
2219
2221 constexpr operator AnimationParam() const noexcept { return {m_resource}; }
2222
2233 void Free();
2234
2236 int GetWidth() const;
2237
2239 int GetHeight() const;
2240
2242 Point GetSize() const;
2243
2245 int GetCount() const;
2246
2252 Surface GetFrame(int index) const;
2253
2259 int GetDelay(int index) const;
2260};
2261
2264{
2266
2274 AnimationRef(AnimationParam resource) noexcept
2275 : Animation(resource.value)
2276 {
2277 }
2278
2286 AnimationRef(AnimationRaw resource) noexcept
2287 : Animation(resource)
2288 {
2289 }
2290
2292 constexpr AnimationRef(const AnimationRef& other) noexcept = default;
2293
2296};
2297
2299inline int GetAnimationWidth(AnimationConstParam anim) { return anim->w; }
2300
2301inline int Animation::GetWidth() const
2302{
2303 return SDL::GetAnimationWidth(m_resource);
2304}
2305
2307inline int GetAnimationHeight(AnimationConstParam anim) { return anim->h; }
2308
2309inline int Animation::GetHeight() const
2310{
2311 return SDL::GetAnimationHeight(m_resource);
2312}
2313
2316{
2317 return {anim->w, anim->h};
2318}
2319
2321{
2322 return SDL::GetAnimationSize(m_resource);
2323}
2324
2326inline int GetAnimationCount(AnimationConstParam anim) { return anim->count; }
2327
2328inline int Animation::GetCount() const
2329{
2330 return SDL::GetAnimationCount(m_resource);
2331}
2332
2340{
2341 return Surface::Borrow(anim->frames[index]);
2342}
2343
2344inline Surface Animation::GetFrame(int index) const
2345{
2346 return SDL::GetAnimationFrame(m_resource, index);
2347}
2348
2355inline int GetAnimationDelay(AnimationConstParam anim, int index)
2356{
2357 return anim->delays[index];
2358}
2359
2360inline int Animation::GetDelay(int index) const
2361{
2362 return SDL::GetAnimationDelay(m_resource, index);
2363}
2364
2379{
2380 return Animation(std::move(file));
2381}
2382
2402inline Animation LoadAnimation(IOStreamParam src, bool closeio = false)
2403{
2404 return Animation(src, closeio);
2405}
2406
2435 StringParam type,
2436 bool closeio = false)
2437{
2438 return Animation(IMG_LoadAnimationTyped_IO(src, closeio, type));
2439}
2440
2453inline void FreeAnimation(AnimationRaw anim) { IMG_FreeAnimation(anim); }
2454
2456
2475{
2476 return Animation(IMG_LoadGIFAnimation_IO(src));
2477}
2478
2497{
2498 return Animation{IMG_LoadWEBPAnimation_IO(src)};
2499}
2500
2502
2503} // namespace SDL
2504
2505#else // defined(SDL3PP_ENABLE_IMAGE) || defined(SDL3PP_DOC)
2506
2507namespace SDL {
2508
2509inline Surface::Surface(StringParam file)
2510 : Surface(LoadBMP(std::move(file)))
2511{
2512}
2513
2514inline Surface::Surface(IOStreamParam src, bool closeio)
2515 : Surface(LoadBMP(std::move(src), closeio))
2516{
2517}
2518
2519inline Texture::Texture(RendererParam renderer, StringParam file)
2520 : Texture(std::move(renderer), Surface(std::move(file)))
2521{
2522}
2523
2524inline Texture::Texture(RendererParam renderer, IOStreamParam src, bool closeio)
2525 : Texture(std::move(renderer), Surface(std::move(src), closeio))
2526{
2527}
2528
2529} // namespace SDL
2530
2531#endif // defined(SDL3PP_ENABLE_IMAGE) || defined(SDL3PP_DOC)
2532
2533#endif /* SDL3PP_IMAGE_H_ */
Animated image support.
Definition: SDL3pp_image.h:2100
constexpr Animation(Animation &&other) noexcept
Move constructor.
Definition: SDL3pp_image.h:2128
constexpr AnimationRaw release() noexcept
Retrieves underlying AnimationRaw and clear this.
Definition: SDL3pp_image.h:2207
constexpr auto operator<=>(const Animation &other) const noexcept=default
Comparison.
~Animation()
Destructor.
Definition: SDL3pp_image.h:2189
constexpr Animation(const Animation &other) noexcept=default
Copy constructor.
constexpr Animation & operator=(const Animation &other) noexcept=default
Assignment operator.
Animation(IOStreamParam src, bool closeio=false)
Load an animation from an IOStream.
Definition: SDL3pp_image.h:2174
constexpr AnimationRaw get() const noexcept
Retrieves underlying AnimationRaw.
Definition: SDL3pp_image.h:2204
constexpr AnimationRaw operator->() noexcept
member access to underlying AnimationRaw.
Definition: SDL3pp_image.h:2186
constexpr Animation(const AnimationRaw resource) noexcept
Constructs from AnimationParam.
Definition: SDL3pp_image.h:2117
constexpr const AnimationRaw operator->() const noexcept
member access to underlying AnimationRaw.
Definition: SDL3pp_image.h:2180
constexpr Animation & operator=(Animation &&other) noexcept
Assignment operator.
Definition: SDL3pp_image.h:2192
constexpr Animation(std::nullptr_t=nullptr) noexcept
Default ctor.
Definition: SDL3pp_image.h:2105
Animation(StringParam file)
Load an animation from a file.
Definition: SDL3pp_image.h:2150
Helpers to use C++ strings parameters.
Definition: SDL3pp_strings.h:43
A collection of pixels used in software blitting.
Definition: SDL3pp_surface.h:227
constexpr Surface(std::nullptr_t=nullptr) noexcept
Default ctor.
Definition: SDL3pp_surface.h:232
static constexpr Surface Borrow(SurfaceParam resource)
Safely borrows the from SurfaceParam.
Definition: SDL3pp_surface.h:411
An efficient driver-specific representation of pixel data.
Definition: SDL3pp_render.h:2466
constexpr Texture(std::nullptr_t=nullptr) noexcept
Default ctor.
Definition: SDL3pp_render.h:2471
constexpr void CheckError(bool result)
Check and throw if returned value from SDL is an error.
Definition: SDL3pp_error.h:197
SDL_Point PointRaw
Alias to raw representation for Point.
Definition: SDL3pp_rect.h:22
Surface ReadXPMFromArrayToRGB888(char **xpm)
Load an XPM image from a memory array.
Definition: SDL3pp_image.h:1958
bool isTIF(IOStreamParam src)
Detect TIFF image data on a readable/seekable IOStream.
Definition: SDL3pp_image.h:1036
int GetWidth() const
Get the width in pixels.
Definition: SDL3pp_image.h:2301
Surface ReadXPMFromArray(char **xpm)
Load an XPM image from a memory array.
Definition: SDL3pp_image.h:1940
Surface LoadCUR(IOStreamParam src)
Load a CUR image directly.
Definition: SDL3pp_image.h:1312
void FreeAnimation(AnimationRaw anim)
Dispose of an Animation and free its resources.
Definition: SDL3pp_image.h:2453
Surface LoadSVG(IOStreamParam src)
Load a SVG image directly.
Definition: SDL3pp_image.h:1645
int GetHeight() const
Get the height in pixels.
Definition: SDL3pp_image.h:2309
bool isXCF(IOStreamParam src)
Detect XCF image data on a readable/seekable IOStream.
Definition: SDL3pp_image.h:1078
Surface LoadPCX(IOStreamParam src)
Load a PCX image directly.
Definition: SDL3pp_image.h:1534
Surface LoadLBM(IOStreamParam src)
Load a LBM image directly.
Definition: SDL3pp_image.h:1497
bool isQOI(IOStreamParam src)
Detect QOI image data on a readable/seekable IOStream.
Definition: SDL3pp_image.h:994
bool isJPG(IOStreamParam src)
Detect JPG image data on a readable/seekable IOStream.
Definition: SDL3pp_image.h:700
Surface LoadXV(IOStreamParam src)
Load a XV image directly.
Definition: SDL3pp_image.h:1867
bool isXPM(IOStreamParam src)
Detect XPM image data on a readable/seekable IOStream.
Definition: SDL3pp_image.h:1120
bool isGIF(IOStreamParam src)
Detect GIF image data on a readable/seekable IOStream.
Definition: SDL3pp_image.h:658
int GetDelay(int index) const
Return the frame delay under given index.
Definition: SDL3pp_image.h:2360
Surface LoadBMP(IOStreamParam src)
Load a BMP image directly.
Definition: SDL3pp_image.h:1349
Animation LoadWEBPAnimation(IOStreamParam src)
Load a WEBP animation directly.
Definition: SDL3pp_image.h:2496
void SaveJPG(SurfaceParam surface, StringParam file, int quality)
Save an Surface into a JPEG image file.
Definition: SDL3pp_image.h:2061
Surface LoadWEBP(IOStreamParam src)
Load a WEBP image directly.
Definition: SDL3pp_image.h:1901
Surface LoadSurfaceTyped(IOStreamParam src, StringParam type, bool closeio=false)
Load an image from an SDL data source into a software surface.
Definition: SDL3pp_image.h:199
Surface LoadTIF(IOStreamParam src)
Load a TIFF image directly.
Definition: SDL3pp_image.h:1756
Surface LoadJPG(IOStreamParam src)
Load a JPG image directly.
Definition: SDL3pp_image.h:1423
Surface LoadPNM(IOStreamParam src)
Load a PNM image directly.
Definition: SDL3pp_image.h:1608
bool isPCX(IOStreamParam src)
Detect PCX image data on a readable/seekable IOStream.
Definition: SDL3pp_image.h:826
Animation LoadAnimation(StringParam file)
Load an animation from a file.
Definition: SDL3pp_image.h:2378
bool isICO(IOStreamParam src)
Detect ICO image data on a readable/seekable IOStream.
Definition: SDL3pp_image.h:532
Animation LoadAnimationTyped(IOStreamParam src, StringParam type, bool closeio=false)
Load an animation from an SDL datasource.
Definition: SDL3pp_image.h:2434
int GetAnimationDelay(AnimationConstParam anim, int index)
Return the frame delay under given index.
Definition: SDL3pp_image.h:2355
Surface LoadTGA(IOStreamParam src)
Load a TGA image directly.
Definition: SDL3pp_image.h:1719
void Free()
Dispose of an Animation and free its resources.
Definition: SDL3pp_image.h:2455
Texture LoadTextureTyped(RendererParam renderer, IOStreamParam src, StringParam type, bool closeio=false)
Load an image from an SDL data source into a GPU texture.
Definition: SDL3pp_image.h:441
bool isJXL(IOStreamParam src)
Detect JXL image data on a readable/seekable IOStream.
Definition: SDL3pp_image.h:742
bool isWEBP(IOStreamParam src)
Detect WEBP image data on a readable/seekable IOStream.
Definition: SDL3pp_image.h:1204
bool isPNM(IOStreamParam src)
Detect PNM image data on a readable/seekable IOStream.
Definition: SDL3pp_image.h:910
bool isSVG(IOStreamParam src)
Detect SVG image data on a readable/seekable IOStream.
Definition: SDL3pp_image.h:952
Point GetAnimationSize(AnimationConstParam anim)
Get the size in pixels.
Definition: SDL3pp_image.h:2315
Surface LoadGIF(IOStreamParam src)
Load a GIF image directly.
Definition: SDL3pp_image.h:1386
Surface LoadJXL(IOStreamParam src)
Load a JXL image directly.
Definition: SDL3pp_image.h:1460
bool isAVIF(IOStreamParam src)
Detect AVIF image data on a readable/seekable IOStream.
Definition: SDL3pp_image.h:490
void SaveAVIF(SurfaceParam surface, StringParam file, int quality)
Save an Surface into a AVIF image file.
Definition: SDL3pp_image.h:1976
bool isLBM(IOStreamParam src)
Detect LBM image data on a readable/seekable IOStream.
Definition: SDL3pp_image.h:784
Surface GetFrame(int index) const
Return the frame image under given index.
Definition: SDL3pp_image.h:2344
Surface LoadICO(IOStreamParam src)
Load a ICO image directly.
Definition: SDL3pp_image.h:1275
bool isPNG(IOStreamParam src)
Detect PNG image data on a readable/seekable IOStream.
Definition: SDL3pp_image.h:868
Surface LoadAVIF(IOStreamParam src)
Load a AVIF image directly.
Definition: SDL3pp_image.h:1238
Surface LoadXPM(IOStreamParam src)
Load a XPM image directly.
Definition: SDL3pp_image.h:1830
Surface LoadPNG(IOStreamParam src)
Load a PNG image directly.
Definition: SDL3pp_image.h:1571
Surface LoadSizedSVG(IOStreamParam src, const PointRaw &size)
Load an SVG image, scaled to a specific size.
Definition: SDL3pp_image.h:1921
Animation LoadGIFAnimation(IOStreamParam src)
Load a GIF animation directly.
Definition: SDL3pp_image.h:2474
int GetCount() const
Return the number of frames.
Definition: SDL3pp_image.h:2328
bool isXV(IOStreamParam src)
Detect XV image data on a readable/seekable IOStream.
Definition: SDL3pp_image.h:1162
Surface GetAnimationFrame(AnimationConstParam anim, int index)
Return the frame image under given index.
Definition: SDL3pp_image.h:2339
Surface LoadQOI(IOStreamParam src)
Load a QOI image directly.
Definition: SDL3pp_image.h:1682
Texture LoadTexture(RendererParam renderer, StringParam file)
Load an image from a filesystem path into a GPU texture.
Definition: SDL3pp_image.h:332
int GetAnimationCount(AnimationConstParam anim)
Return the number of frames.
Definition: SDL3pp_image.h:2326
int GetAnimationWidth(AnimationConstParam anim)
Get the width in pixels.
Definition: SDL3pp_image.h:2299
Surface LoadXCF(IOStreamParam src)
Load a XCF image directly.
Definition: SDL3pp_image.h:1793
IMG_Animation * AnimationRaw
Alias to raw representation for Animation.
Definition: SDL3pp_image.h:30
int GetAnimationHeight(AnimationConstParam anim)
Get the height in pixels.
Definition: SDL3pp_image.h:2307
Surface LoadSurface(StringParam file)
Load an image from a filesystem path into a software surface.
Definition: SDL3pp_image.h:241
void SavePNG(SurfaceParam surface, StringParam file)
Save an Surface into a PNG image file.
Definition: SDL3pp_image.h:2020
bool isBMP(IOStreamParam src)
Detect BMP image data on a readable/seekable IOStream.
Definition: SDL3pp_image.h:616
bool isCUR(IOStreamParam src)
Detect CUR image data on a readable/seekable IOStream.
Definition: SDL3pp_image.h:574
Point GetSize() const
Get the size in pixels.
Definition: SDL3pp_image.h:2320
Main include header for the SDL3pp library.
Safely wrap Animation for non owning const parameters.
Definition: SDL3pp_image.h:67
constexpr auto operator->()
member access to underlying AnimationRaw.
Definition: SDL3pp_image.h:98
const AnimationRaw value
parameter's const AnimationRaw
Definition: SDL3pp_image.h:68
constexpr auto operator<=>(const AnimationConstParam &other) const =default
Comparison.
constexpr AnimationConstParam(const AnimationRaw value)
Constructs from const AnimationRaw.
Definition: SDL3pp_image.h:71
constexpr AnimationConstParam(AnimationParam value)
Constructs from AnimationParam.
Definition: SDL3pp_image.h:77
constexpr AnimationConstParam(std::nullptr_t=nullptr)
Constructs null/invalid.
Definition: SDL3pp_image.h:83
Safely wrap Animation for non owning parameters.
Definition: SDL3pp_image.h:37
AnimationRaw value
parameter's AnimationRaw
Definition: SDL3pp_image.h:38
constexpr AnimationParam(AnimationRaw value)
Constructs from AnimationRaw.
Definition: SDL3pp_image.h:41
constexpr auto operator<=>(const AnimationParam &other) const =default
Comparison.
constexpr auto operator->()
member access to underlying AnimationRaw.
Definition: SDL3pp_image.h:62
constexpr AnimationParam(std::nullptr_t=nullptr)
Constructs null/invalid.
Definition: SDL3pp_image.h:47
Semi-safe reference for Animation.
Definition: SDL3pp_image.h:2264
AnimationRef(AnimationParam resource) noexcept
Constructs from AnimationParam.
Definition: SDL3pp_image.h:2274
~AnimationRef()
Destructor.
Definition: SDL3pp_image.h:2295
AnimationRef(AnimationRaw resource) noexcept
Constructs from AnimationParam.
Definition: SDL3pp_image.h:2286
constexpr AnimationRef(const AnimationRef &other) noexcept=default
Copy constructor.
Safely wrap IOStream for non owning parameters.
Definition: SDL3pp_iostream.h:34
The structure that defines a point (using integers).
Definition: SDL3pp_rect.h:83
Safely wrap Renderer for non owning parameters.
Definition: SDL3pp_render.h:54
Safely wrap Surface for non owning parameters.
Definition: SDL3pp_surface.h:53