4#include "SDL3pp_error.h"
6#include "SDL3pp_mouse.h"
7#include "SDL3pp_render.h"
8#include "SDL3pp_surface.h"
9#include "SDL3pp_version.h"
10#include "SDL3pp_video.h"
12#if defined(SDL3PP_ENABLE_IMAGE) || defined(SDL3PP_DOC)
14#include <SDL3_image/SDL_image.h>
55 constexpr explicit operator bool()
const {
return !!
value; }
91 constexpr explicit operator bool()
const {
return !!
value; }
103#if SDL_IMAGE_VERSION_ATLEAST(3, 4, 0)
106struct AnimationEncoder;
132 constexpr explicit operator bool()
const {
return !!
value; }
143struct AnimationDecoder;
169 constexpr explicit operator bool()
const {
return !!
value; }
187#define SDL_IMAGE_MAJOR_VERSION
189#define SDL_IMAGE_MINOR_VERSION
191#define SDL_IMAGE_MICRO_VERSION
198#define SDL_IMAGE_VERSION \
200 SDL_IMAGE_MAJOR_VERSION, SDL_IMAGE_MINOR_VERSION, SDL_IMAGE_MICRO_VERSION)
203#define SDL_IMAGE_VERSION_ATLEAST(X, Y, Z) \
204 ((SDL_IMAGE_MAJOR_VERSION >= X) && \
205 (SDL_IMAGE_MAJOR_VERSION > X || SDL_IMAGE_MINOR_VERSION >= Y) && \
206 (SDL_IMAGE_MAJOR_VERSION > X || SDL_IMAGE_MINOR_VERSION > Y || \
207 SDL_IMAGE_MICRO_VERSION >= Z))
220inline int Version() {
return IMG_Version(); }
307 return Surface{IMG_Load_IO(src, closeio)};
311 : m_resource(IMG_Load(file))
316 : m_resource(IMG_Load_IO(src, closeio))
375 bool closeio =
false)
377 return Surface(IMG_LoadTyped_IO(src, closeio, type));
410 return Texture(IMG_LoadTexture(renderer, file));
454 bool closeio =
false)
456 return Texture(IMG_LoadTexture_IO(renderer, src, closeio));
460 : m_resource(IMG_LoadTexture(renderer, file))
465 : m_resource(IMG_LoadTexture_IO(renderer, src, closeio))
519 bool closeio =
false)
521 return Texture(IMG_LoadTextureTyped_IO(renderer, src, closeio, type));
524#if SDL_IMAGE_VERSION_ATLEAST(3, 4, 0)
560 int* width =
nullptr,
561 int* height =
nullptr)
563 return IMG_LoadGPUTexture(device, copy_pass, file, width, height);
611 bool closeio =
false,
612 int* width =
nullptr,
613 int* height =
nullptr)
615 return IMG_LoadGPUTexture_IO(device, copy_pass, src, closeio, width, height);
672 bool closeio =
false,
673 int* width =
nullptr,
674 int* height =
nullptr)
676 return IMG_LoadGPUTextureTyped_IO(
677 device, copy_pass, src, closeio, type, width, height);
1545 return Surface(IMG_LoadAVIF_IO(src));
1582 return Surface{IMG_LoadBMP_IO(src)};
1619 return Surface{IMG_LoadCUR_IO(src)};
1656 return Surface{IMG_LoadGIF_IO(src)};
1693 return Surface{IMG_LoadICO_IO(src)};
1730 return Surface{IMG_LoadJPG_IO(src)};
1767 return Surface{IMG_LoadJXL_IO(src)};
1804 return Surface{IMG_LoadLBM_IO(src)};
1841 return Surface{IMG_LoadPCX_IO(src)};
1878 return Surface{IMG_LoadPNG_IO(src)};
1915 return Surface{IMG_LoadPNM_IO(src)};
1953 return Surface{IMG_LoadSVG_IO(src)};
1978 return Surface{IMG_LoadSizedSVG_IO(src, size.x, size.y)};
2015 return Surface{IMG_LoadQOI_IO(src)};
2052 return Surface{IMG_LoadTGA_IO(src)};
2089 return Surface{IMG_LoadTIF_IO(src)};
2126 return Surface{IMG_LoadWEBP_IO(src)};
2163 return Surface{IMG_LoadXCF_IO(src)};
2200 return Surface{IMG_LoadXPM_IO(src)};
2253 return Surface{IMG_ReadXPMFromArray(xpm)};
2271 return Surface{IMG_ReadXPMFromArrayToRGB888(xpm)};
2274#if SDL_IMAGE_VERSION_ATLEAST(3, 4, 0)
2339 bool closeio =
false)
2341 CheckError(IMG_SaveTyped_IO(surface, dst, closeio, type));
2363 CheckError(IMG_SaveAVIF(surface, file, quality));
2389 bool closeio =
false)
2391 CheckError(IMG_SaveAVIF_IO(surface, dst, closeio, quality));
2394#if SDL_IMAGE_VERSION_ATLEAST(3, 4, 0)
2434 bool closeio =
false)
2436 CheckError(IMG_SaveBMP_IO(surface, dst, closeio));
2477 bool closeio =
false)
2479 CheckError(IMG_SaveCUR_IO(surface, dst, closeio));
2520 bool closeio =
false)
2522 CheckError(IMG_SaveGIF_IO(surface, dst, closeio));
2563 bool closeio =
false)
2565 CheckError(IMG_SaveICO_IO(surface, dst, closeio));
2587 CheckError(IMG_SaveJPG(surface, file, quality));
2613 bool closeio =
false)
2615 CheckError(IMG_SaveJPG_IO(surface, dst, closeio, quality));
2656 bool closeio =
false)
2658 CheckError(IMG_SavePNG_IO(surface, dst, closeio));
2661#if SDL_IMAGE_VERSION_ATLEAST(3, 4, 0)
2701 bool closeio =
false)
2703 CheckError(IMG_SaveTGA_IO(surface, dst, closeio));
2725 CheckError(IMG_SaveWEBP(surface, file, quality));
2753 bool closeio =
false)
2755 CheckError(IMG_SaveWEBP_IO(surface, dst, closeio, quality));
2784 : m_resource(resource)
2825 : m_resource(IMG_LoadAnimation(file))
2857 : m_resource(IMG_LoadAnimation_IO(src, closeio))
2876 std::swap(m_resource, other.m_resource);
2891 auto r = m_resource;
2892 m_resource =
nullptr;
2900 constexpr explicit operator bool() const noexcept {
return !!m_resource; }
2949#if SDL_IMAGE_VERSION_ATLEAST(3, 4, 0)
3187 return {anim->w, anim->h};
3227 return anim->delays[index];
3329 bool closeio =
false)
3331 return Animation(IMG_LoadAnimationTyped_IO(src, closeio, type));
3334#if SDL_IMAGE_VERSION_ATLEAST(3, 4, 0)
3364 return Animation(IMG_LoadANIAnimation_IO(src));
3395 return Animation(IMG_LoadAPNGAnimation_IO(src));
3426 return Animation(IMG_LoadAVIFAnimation_IO(src));
3456 return Animation(IMG_LoadGIFAnimation_IO(src));
3484 return Animation{IMG_LoadWEBPAnimation_IO(src)};
3487#if SDL_IMAGE_VERSION_ATLEAST(3, 4, 0)
3546 bool closeio =
false)
3548 CheckError(IMG_SaveAnimationTyped_IO(anim, dst, closeio, type));
3581 bool closeio =
false)
3583 CheckError(IMG_SaveANIAnimation_IO(anim, dst, closeio));
3614 bool closeio =
false)
3616 CheckError(IMG_SaveAPNGAnimation_IO(anim, dst, closeio));
3650 bool closeio =
false)
3652 CheckError(IMG_SaveAVIFAnimation_IO(anim, dst, quality, closeio));
3683 bool closeio =
false)
3685 CheckError(IMG_SaveGIFAnimation_IO(anim, dst, closeio));
3721 bool closeio =
false)
3723 CheckError(IMG_SaveWEBPAnimation_IO(anim, dst, quality, closeio));
3748 CheckError(IMG_CreateAnimatedCursor(anim, hotspot.x, hotspot.y))};
3779#if SDL_IMAGE_VERSION_ATLEAST(3, 4, 0)
3806 : m_resource(resource)
3851 : m_resource(IMG_CreateAnimationEncoder(file))
3885 : m_resource(IMG_CreateAnimationEncoder_IO(dst, closeio, type))
3937 : m_resource(IMG_CreateAnimationEncoderWithProperties(props))
3947 std::swap(m_resource, other.m_resource);
3963 auto r = m_resource;
3964 m_resource =
nullptr;
3973 constexpr explicit operator bool() const noexcept {
return !!m_resource; }
3978 return {m_resource};
4113 bool closeio =
false)
4170namespace prop::AnimationEncoder {
4172constexpr auto CREATE_FILENAME_STRING =
4173 IMG_PROP_ANIMATION_ENCODER_CREATE_FILENAME_STRING;
4175constexpr auto CREATE_IOSTREAM_POINTER =
4176 IMG_PROP_ANIMATION_ENCODER_CREATE_IOSTREAM_POINTER;
4178constexpr auto CREATE_IOSTREAM_AUTOCLOSE_BOOLEAN =
4179 IMG_PROP_ANIMATION_ENCODER_CREATE_IOSTREAM_AUTOCLOSE_BOOLEAN;
4181constexpr auto CREATE_TYPE_STRING =
4182 IMG_PROP_ANIMATION_ENCODER_CREATE_TYPE_STRING;
4184constexpr auto CREATE_QUALITY_NUMBER =
4185 IMG_PROP_ANIMATION_ENCODER_CREATE_QUALITY_NUMBER;
4187constexpr auto CREATE_TIMEBASE_NUMERATOR_NUMBER =
4188 IMG_PROP_ANIMATION_ENCODER_CREATE_TIMEBASE_NUMERATOR_NUMBER;
4190constexpr auto CREATE_TIMEBASE_DENOMINATOR_NUMBER =
4191 IMG_PROP_ANIMATION_ENCODER_CREATE_TIMEBASE_DENOMINATOR_NUMBER;
4193constexpr auto CREATE_AVIF_MAX_THREADS_NUMBER =
4194 IMG_PROP_ANIMATION_ENCODER_CREATE_AVIF_MAX_THREADS_NUMBER;
4196constexpr auto CREATE_AVIF_KEYFRAME_INTERVAL_NUMBER =
4197 IMG_PROP_ANIMATION_ENCODER_CREATE_AVIF_KEYFRAME_INTERVAL_NUMBER;
4199constexpr auto CREATE_GIF_USE_LUT_BOOLEAN =
4200 IMG_PROP_ANIMATION_ENCODER_CREATE_GIF_USE_LUT_BOOLEAN;
4226 CheckError(IMG_AddAnimationEncoderFrame(encoder, surface, duration));
4251 CheckError(IMG_CloseAnimationEncoder(encoder));
4264 IMG_DECODER_STATUS_INVALID;
4267 IMG_DECODER_STATUS_OK;
4271 IMG_DECODER_STATUS_FAILED;
4274 IMG_DECODER_STATUS_COMPLETE;
4301 : m_resource(resource)
4347 : m_resource(IMG_CreateAnimationDecoder(file))
4382 : m_resource(IMG_CreateAnimationDecoder_IO(src, closeio, type))
4425 : m_resource(IMG_CreateAnimationDecoderWithProperties(props))
4435 std::swap(m_resource, other.m_resource);
4451 auto r = m_resource;
4452 m_resource =
nullptr;
4461 constexpr explicit operator bool() const noexcept {
return !!m_resource; }
4466 return {m_resource};
4658 bool closeio =
false)
4707namespace prop::AnimationDecoder {
4709constexpr auto CREATE_FILENAME_STRING =
4710 IMG_PROP_ANIMATION_DECODER_CREATE_FILENAME_STRING;
4712constexpr auto CREATE_IOSTREAM_POINTER =
4713 IMG_PROP_ANIMATION_DECODER_CREATE_IOSTREAM_POINTER;
4715constexpr auto CREATE_IOSTREAM_AUTOCLOSE_BOOLEAN =
4716 IMG_PROP_ANIMATION_DECODER_CREATE_IOSTREAM_AUTOCLOSE_BOOLEAN;
4718constexpr auto CREATE_TYPE_STRING =
4719 IMG_PROP_ANIMATION_DECODER_CREATE_TYPE_STRING;
4721constexpr auto CREATE_TIMEBASE_NUMERATOR_NUMBER =
4722 IMG_PROP_ANIMATION_DECODER_CREATE_TIMEBASE_NUMERATOR_NUMBER;
4724constexpr auto CREATE_TIMEBASE_DENOMINATOR_NUMBER =
4725 IMG_PROP_ANIMATION_DECODER_CREATE_TIMEBASE_DENOMINATOR_NUMBER;
4727constexpr auto CREATE_AVIF_MAX_THREADS_NUMBER =
4728 IMG_PROP_ANIMATION_DECODER_CREATE_AVIF_MAX_THREADS_NUMBER;
4730constexpr auto CREATE_AVIF_ALLOW_INCREMENTAL_BOOLEAN =
4731 IMG_PROP_ANIMATION_DECODER_CREATE_AVIF_ALLOW_INCREMENTAL_BOOLEAN;
4733constexpr auto CREATE_AVIF_ALLOW_PROGRESSIVE_BOOLEAN =
4734 IMG_PROP_ANIMATION_DECODER_CREATE_AVIF_ALLOW_PROGRESSIVE_BOOLEAN;
4736constexpr auto CREATE_GIF_TRANSPARENT_COLOR_INDEX_NUMBER =
4737 IMG_PROP_ANIMATION_DECODER_CREATE_GIF_TRANSPARENT_COLOR_INDEX_NUMBER;
4739constexpr auto CREATE_GIF_NUM_COLORS_NUMBER =
4740 IMG_PROP_ANIMATION_DECODER_CREATE_GIF_NUM_COLORS_NUMBER;
4764 return IMG_GetAnimationDecoderProperties(decoder);
4772namespace prop::Metadata {
4774constexpr auto IGNORE_PROPS_BOOLEAN = IMG_PROP_METADATA_IGNORE_PROPS_BOOLEAN;
4776constexpr auto DESCRIPTION_STRING = IMG_PROP_METADATA_DESCRIPTION_STRING;
4778constexpr auto COPYRIGHT_STRING = IMG_PROP_METADATA_COPYRIGHT_STRING;
4780constexpr auto TITLE_STRING = IMG_PROP_METADATA_TITLE_STRING;
4782constexpr auto AUTHOR_STRING = IMG_PROP_METADATA_AUTHOR_STRING;
4784constexpr auto CREATION_TIME_STRING = IMG_PROP_METADATA_CREATION_TIME_STRING;
4786constexpr auto FRAME_COUNT_NUMBER = IMG_PROP_METADATA_FRAME_COUNT_NUMBER;
4788constexpr auto LOOP_COUNT_NUMBER = IMG_PROP_METADATA_LOOP_COUNT_NUMBER;
4818 SDL_Surface* frame =
nullptr;
4819 CheckError(IMG_GetAnimationDecoderFrame(decoder, &frame, duration));
4842 return IMG_GetAnimationDecoderStatus(decoder);
4870 CheckError(IMG_ResetAnimationDecoder(decoder));
4895 CheckError(IMG_CloseAnimationDecoder(decoder));
4911 : Surface(
LoadBMP(std::move(file)))
4916 : Surface(
LoadBMP(std::move(src), closeio))
4921 : Texture(std::move(renderer), Surface(std::move(file)))
4925inline Texture::Texture(RendererParam renderer, IOStreamParam src,
bool closeio)
4926 : Texture(std::move(renderer), Surface(std::move(src), closeio))
An object representing animation decoder.
Definition: SDL3pp_image.h:4282
constexpr AnimationDecoder & operator=(AnimationDecoder &&other) noexcept
Assignment operator.
Definition: SDL3pp_image.h:4433
constexpr auto operator<=>(const AnimationDecoder &other) const noexcept=default
Comparison.
constexpr AnimationDecoder(const AnimationDecoder &other) noexcept=default
Copy constructor.
constexpr AnimationDecoderRaw get() const noexcept
Retrieves underlying AnimationDecoderRaw.
Definition: SDL3pp_image.h:4446
constexpr AnimationDecoder(std::nullptr_t=nullptr) noexcept
Default ctor.
Definition: SDL3pp_image.h:4287
constexpr AnimationDecoderRaw release() noexcept
Retrieves underlying AnimationDecoderRaw and clear this.
Definition: SDL3pp_image.h:4449
constexpr AnimationDecoder & operator=(const AnimationDecoder &other) noexcept=default
Assignment operator.
AnimationDecoder(StringParam file)
Create a decoder to read a series of images from a file.
Definition: SDL3pp_image.h:4346
~AnimationDecoder()
Destructor.
Definition: SDL3pp_image.h:4430
AnimationDecoder(IOStreamParam src, StringParam type, bool closeio=false)
Create a decoder to read a series of images from an IOStream.
Definition: SDL3pp_image.h:4381
AnimationDecoder(PropertiesParam props)
Create an animation decoder with the specified properties.
Definition: SDL3pp_image.h:4424
constexpr AnimationDecoder(const AnimationDecoderRaw resource) noexcept
Constructs from AnimationDecoderParam.
Definition: SDL3pp_image.h:4299
constexpr AnimationDecoder(AnimationDecoder &&other) noexcept
Move constructor.
Definition: SDL3pp_image.h:4311
An object representing the encoder context.
Definition: SDL3pp_image.h:3787
constexpr AnimationEncoder & operator=(AnimationEncoder &&other) noexcept
Assignment operator.
Definition: SDL3pp_image.h:3945
constexpr AnimationEncoderRaw release() noexcept
Retrieves underlying AnimationEncoderRaw and clear this.
Definition: SDL3pp_image.h:3961
constexpr AnimationEncoder(const AnimationEncoderRaw resource) noexcept
Constructs from AnimationEncoderParam.
Definition: SDL3pp_image.h:3804
constexpr AnimationEncoder(std::nullptr_t=nullptr) noexcept
Default ctor.
Definition: SDL3pp_image.h:3792
AnimationEncoder(IOStreamParam dst, StringParam type, bool closeio=false)
Create an encoder to save a series of images to an IOStream.
Definition: SDL3pp_image.h:3884
~AnimationEncoder()
Destructor.
Definition: SDL3pp_image.h:3942
AnimationEncoder(PropertiesParam props)
Create an animation encoder with the specified properties.
Definition: SDL3pp_image.h:3936
constexpr auto operator<=>(const AnimationEncoder &other) const noexcept=default
Comparison.
constexpr AnimationEncoder(AnimationEncoder &&other) noexcept
Move constructor.
Definition: SDL3pp_image.h:3816
constexpr AnimationEncoder & operator=(const AnimationEncoder &other) noexcept=default
Assignment operator.
constexpr AnimationEncoderRaw get() const noexcept
Retrieves underlying AnimationEncoderRaw.
Definition: SDL3pp_image.h:3958
constexpr AnimationEncoder(const AnimationEncoder &other) noexcept=default
Copy constructor.
AnimationEncoder(StringParam file)
Create an encoder to save a series of images to a file.
Definition: SDL3pp_image.h:3850
Animated image support.
Definition: SDL3pp_image.h:2766
constexpr Animation(Animation &&other) noexcept
Move constructor.
Definition: SDL3pp_image.h:2794
constexpr AnimationRaw release() noexcept
Retrieves underlying AnimationRaw and clear this.
Definition: SDL3pp_image.h:2889
constexpr auto operator<=>(const Animation &other) const noexcept=default
Comparison.
~Animation()
Destructor.
Definition: SDL3pp_image.h:2871
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:2856
constexpr AnimationRaw get() const noexcept
Retrieves underlying AnimationRaw.
Definition: SDL3pp_image.h:2886
constexpr AnimationRaw operator->() noexcept
member access to underlying AnimationRaw.
Definition: SDL3pp_image.h:2868
constexpr Animation(const AnimationRaw resource) noexcept
Constructs from AnimationParam.
Definition: SDL3pp_image.h:2783
constexpr const AnimationRaw operator->() const noexcept
member access to underlying AnimationRaw.
Definition: SDL3pp_image.h:2862
constexpr Animation & operator=(Animation &&other) noexcept
Assignment operator.
Definition: SDL3pp_image.h:2874
constexpr Animation(std::nullptr_t=nullptr) noexcept
Default ctor.
Definition: SDL3pp_image.h:2771
Animation(StringParam file)
Load an animation from a file.
Definition: SDL3pp_image.h:2824
The structure used to identify an SDL cursor.
Definition: SDL3pp_mouse.h:182
An opaque handle representing a copy pass.
Definition: SDL3pp_gpu.h:1790
An opaque handle representing a texture.
Definition: SDL3pp_gpu.h:705
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:409
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
void SaveAPNGAnimation(AnimationParam anim, IOStreamParam dst, bool closeio=false)
Save an animation in APNG format to an IOStream.
Definition: SDL3pp_image.h:3612
Surface ReadXPMFromArrayToRGB888(char **xpm)
Load an XPM image from a memory array.
Definition: SDL3pp_image.h:2269
bool isTIF(IOStreamParam src)
Detect TIFF image data on a readable/seekable IOStream.
Definition: SDL3pp_image.h:1337
IMG_AnimationDecoderStatus AnimationDecoderStatus
An enum representing the status of an animation decoder.
Definition: SDL3pp_image.h:4261
int GetWidth() const
Get the width in pixels.
Definition: SDL3pp_image.h:3171
Surface ReadXPMFromArray(char **xpm)
Load an XPM image from a memory array.
Definition: SDL3pp_image.h:2251
void AddAnimationEncoderFrame(AnimationEncoderParam encoder, SurfaceParam surface, Uint64 duration)
Add a frame to an animation encoder.
Definition: SDL3pp_image.h:4222
IMG_AnimationDecoder * AnimationDecoderRaw
Alias to raw representation for AnimationDecoder.
Definition: SDL3pp_image.h:146
Surface LoadCUR(IOStreamParam src)
Load a CUR image directly.
Definition: SDL3pp_image.h:1617
void FreeAnimation(AnimationRaw anim)
Dispose of an Animation and free its resources.
Definition: SDL3pp_image.h:3775
Surface LoadSVG(IOStreamParam src)
Load a SVG image directly.
Definition: SDL3pp_image.h:1951
GPUTexture LoadGPUTextureTyped(GPUDeviceParam device, GPUCopyPass copy_pass, IOStreamParam src, StringParam type, bool closeio=false, int *width=nullptr, int *height=nullptr)
Load an image from an SDL data source into a GPU texture.
Definition: SDL3pp_image.h:668
void SaveAPNG(IOStreamParam dst, bool closeio=false)
Save an animation in APNG format to an IOStream.
Definition: SDL3pp_image.h:3619
int GetHeight() const
Get the height in pixels.
Definition: SDL3pp_image.h:3179
AnimationEncoder CreateAnimationEncoder(StringParam file)
Create an encoder to save a series of images to a file.
Definition: SDL3pp_image.h:4079
void SaveAVIF(IOStreamParam dst, int quality, bool closeio=false)
Save an animation in AVIF format to an IOStream.
Definition: SDL3pp_image.h:3655
bool isXCF(IOStreamParam src)
Detect XCF image data on a readable/seekable IOStream.
Definition: SDL3pp_image.h:1423
Surface LoadPCX(IOStreamParam src)
Load a PCX image directly.
Definition: SDL3pp_image.h:1839
Surface LoadLBM(IOStreamParam src)
Load a LBM image directly.
Definition: SDL3pp_image.h:1802
Animation LoadAVIFAnimation(IOStreamParam src)
Load an AVIF animation directly from an IOStream.
Definition: SDL3pp_image.h:3424
AnimationEncoder CreateAnimationEncoderWithProperties(PropertiesParam props)
Create an animation encoder with the specified properties.
Definition: SDL3pp_image.h:4164
IMG_AnimationEncoder * AnimationEncoderRaw
Alias to raw representation for AnimationEncoder.
Definition: SDL3pp_image.h:109
void Save(SurfaceParam surface, StringParam file)
Save an Surface into an image file.
Definition: SDL3pp_image.h:2300
bool isQOI(IOStreamParam src)
Detect QOI image data on a readable/seekable IOStream.
Definition: SDL3pp_image.h:1251
bool isJPG(IOStreamParam src)
Detect JPG image data on a readable/seekable IOStream.
Definition: SDL3pp_image.h:993
void SaveWEBP(IOStreamParam dst, int quality, bool closeio=false)
Save an animation in WEBP format to an IOStream.
Definition: SDL3pp_image.h:3726
Cursor CreateCursor(const PointRaw &hotspot)
Create an animated cursor from an animation.
Definition: SDL3pp_image.h:3751
Surface LoadXV(IOStreamParam src)
Load a XV image directly.
Definition: SDL3pp_image.h:2235
bool isXPM(IOStreamParam src)
Detect XPM image data on a readable/seekable IOStream.
Definition: SDL3pp_image.h:1466
AnimationDecoder CreateAnimationDecoderWithProperties(PropertiesParam props)
Create an animation decoder with the specified properties.
Definition: SDL3pp_image.h:4701
void SaveBMP(SurfaceParam surface, StringParam file)
Save an Surface into a BMP image file.
Definition: SDL3pp_image.h:2409
void SaveAnimationTyped(AnimationParam anim, IOStreamParam dst, StringParam type, bool closeio=false)
Save an animation to an IOStream.
Definition: SDL3pp_image.h:3543
bool isGIF(IOStreamParam src)
Detect GIF image data on a readable/seekable IOStream.
Definition: SDL3pp_image.h:907
int GetDelay(int index) const
Return the frame delay under given index.
Definition: SDL3pp_image.h:3230
void SaveWEBPAnimation(AnimationParam anim, IOStreamParam dst, int quality, bool closeio=false)
Save an animation in WEBP format to an IOStream.
Definition: SDL3pp_image.h:3718
Surface LoadBMP(IOStreamParam src)
Load a BMP image directly.
Definition: SDL3pp_image.h:1580
Animation LoadWEBPAnimation(IOStreamParam src)
Load a WEBP animation directly.
Definition: SDL3pp_image.h:3482
void SaveAnimation(AnimationParam anim, StringParam file)
Save an animation to a file.
Definition: SDL3pp_image.h:3507
void Close()
Close an animation encoder, finishing any encoding.
Definition: SDL3pp_image.h:4254
void SaveJPG(SurfaceParam surface, StringParam file, int quality)
Save an Surface into a JPEG image file.
Definition: SDL3pp_image.h:2585
Surface LoadWEBP(IOStreamParam src)
Load a WEBP image directly.
Definition: SDL3pp_image.h:2124
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:373
Surface LoadTIF(IOStreamParam src)
Load a TIFF image directly.
Definition: SDL3pp_image.h:2087
Surface GetFrame(Uint64 *duration)
Get the next frame in an animation decoder.
Definition: SDL3pp_image.h:4823
Surface LoadJPG(IOStreamParam src)
Load a JPG image directly.
Definition: SDL3pp_image.h:1728
Surface LoadPNM(IOStreamParam src)
Load a PNM image directly.
Definition: SDL3pp_image.h:1913
bool isPCX(IOStreamParam src)
Detect PCX image data on a readable/seekable IOStream.
Definition: SDL3pp_image.h:1122
Animation LoadAnimation(StringParam file)
Load an animation from a file.
Definition: SDL3pp_image.h:3256
void SaveGIF(SurfaceParam surface, StringParam file)
Save an Surface into a GIF image file.
Definition: SDL3pp_image.h:2495
void SaveICO(SurfaceParam surface, StringParam file)
Save an Surface into a ICO image file.
Definition: SDL3pp_image.h:2538
bool isICO(IOStreamParam src)
Detect ICO image data on a readable/seekable IOStream.
Definition: SDL3pp_image.h:950
Surface GetClipboardImage()
Get the image currently in the clipboard.
Definition: SDL3pp_image.h:690
AnimationDecoderStatus GetAnimationDecoderStatus(AnimationDecoderParam decoder)
Get the decoder status indicating the current state of the decoder.
Definition: SDL3pp_image.h:4839
Animation LoadAnimationTyped(IOStreamParam src, StringParam type, bool closeio=false)
Load an animation from an IOStream.
Definition: SDL3pp_image.h:3327
void CloseAnimationDecoder(AnimationDecoderRaw decoder)
Close an animation decoder, finishing any decoding.
Definition: SDL3pp_image.h:4893
Cursor CreateAnimatedCursor(AnimationParam anim, const PointRaw &hotspot)
Create an animated cursor from an animation.
Definition: SDL3pp_image.h:3745
int GetAnimationDelay(AnimationConstParam anim, int index)
Return the frame delay under given index.
Definition: SDL3pp_image.h:3225
void SaveGIF(IOStreamParam dst, bool closeio=false)
Save an animation in GIF format to an IOStream.
Definition: SDL3pp_image.h:3688
Surface LoadTGA(IOStreamParam src)
Load a TGA image directly.
Definition: SDL3pp_image.h:2050
void Free()
Dispose of an Animation and free its resources.
Definition: SDL3pp_image.h:3777
Texture LoadTextureTyped(RendererParam renderer, IOStreamParam src, StringParam type, bool closeio=false)
Load an image from an SDL data source into a texture.
Definition: SDL3pp_image.h:516
void SaveANI(IOStreamParam dst, bool closeio=false)
Save an animation in ANI format to an IOStream.
Definition: SDL3pp_image.h:3586
Animation LoadAPNGAnimation(IOStreamParam src)
Load an APNG animation directly from an IOStream.
Definition: SDL3pp_image.h:3393
bool isJXL(IOStreamParam src)
Detect JXL image data on a readable/seekable IOStream.
Definition: SDL3pp_image.h:1036
bool isWEBP(IOStreamParam src)
Detect WEBP image data on a readable/seekable IOStream.
Definition: SDL3pp_image.h:1380
bool isPNM(IOStreamParam src)
Detect PNM image data on a readable/seekable IOStream.
Definition: SDL3pp_image.h:1208
bool isSVG(IOStreamParam src)
Detect SVG image data on a readable/seekable IOStream.
Definition: SDL3pp_image.h:1294
Point GetAnimationSize(AnimationConstParam anim)
Get the size in pixels.
Definition: SDL3pp_image.h:3185
Surface LoadGIF(IOStreamParam src)
Load a GIF image directly.
Definition: SDL3pp_image.h:1654
Surface LoadJXL(IOStreamParam src)
Load a JXL image directly.
Definition: SDL3pp_image.h:1765
PropertiesRef GetAnimationDecoderProperties(AnimationDecoderParam decoder)
Get the properties of an animation decoder.
Definition: SDL3pp_image.h:4761
bool isAVIF(IOStreamParam src)
Detect AVIF image data on a readable/seekable IOStream.
Definition: SDL3pp_image.h:778
void SaveAVIF(SurfaceParam surface, StringParam file, int quality)
Save an Surface into a AVIF image file.
Definition: SDL3pp_image.h:2361
bool isLBM(IOStreamParam src)
Detect LBM image data on a readable/seekable IOStream.
Definition: SDL3pp_image.h:1079
void SaveGIFAnimation(AnimationParam anim, IOStreamParam dst, bool closeio=false)
Save an animation in GIF format to an IOStream.
Definition: SDL3pp_image.h:3681
void SaveTyped(IOStreamParam dst, StringParam type, bool closeio=false)
Save an animation to an IOStream.
Definition: SDL3pp_image.h:3551
Surface GetFrame(int index) const
Return the frame image under given index.
Definition: SDL3pp_image.h:3214
void Close()
Close an animation decoder, finishing any decoding.
Definition: SDL3pp_image.h:4898
Surface LoadICO(IOStreamParam src)
Load a ICO image directly.
Definition: SDL3pp_image.h:1691
void SaveCUR(SurfaceParam surface, StringParam file)
Save an Surface into a CUR image file.
Definition: SDL3pp_image.h:2452
bool isPNG(IOStreamParam src)
Detect PNG image data on a readable/seekable IOStream.
Definition: SDL3pp_image.h:1165
Surface LoadAVIF(IOStreamParam src)
Load a AVIF image directly.
Definition: SDL3pp_image.h:1543
Surface LoadXPM(IOStreamParam src)
Load a XPM image directly.
Definition: SDL3pp_image.h:2198
Surface LoadPNG(IOStreamParam src)
Load a PNG image directly.
Definition: SDL3pp_image.h:1876
void AddFrame(SurfaceParam surface, Uint64 duration)
Add a frame to an animation encoder.
Definition: SDL3pp_image.h:4229
constexpr AnimationDecoderStatus DECODER_STATUS_OK
The decoder is ready to decode the next frame.
Definition: SDL3pp_image.h:4266
void SaveWEBP(SurfaceParam surface, StringParam file, float quality)
Save an Surface into a WEBP image file.
Definition: SDL3pp_image.h:2723
constexpr AnimationDecoderStatus DECODER_STATUS_COMPLETE
No more frames available.
Definition: SDL3pp_image.h:4273
Surface LoadSizedSVG(IOStreamParam src, const PointRaw &size)
Load an SVG image, scaled to a specific size.
Definition: SDL3pp_image.h:1976
constexpr AnimationDecoderStatus DECODER_STATUS_FAILED
The decoder failed to decode a frame, call GetError() for more information.
Definition: SDL3pp_image.h:4270
Animation LoadGIFAnimation(IOStreamParam src)
Load a GIF animation directly.
Definition: SDL3pp_image.h:3454
void SaveTGA(SurfaceParam surface, StringParam file)
Save an Surface into a TGA image file.
Definition: SDL3pp_image.h:2676
int GetCount() const
Return the number of frames.
Definition: SDL3pp_image.h:3198
bool isXV(IOStreamParam src)
Detect XV image data on a readable/seekable IOStream.
Definition: SDL3pp_image.h:1509
void SaveTyped(SurfaceParam surface, IOStreamParam dst, StringParam type, bool closeio=false)
Save an Surface into formatted image data, via an IOStream.
Definition: SDL3pp_image.h:2336
void Reset()
Reset an animation decoder.
Definition: SDL3pp_image.h:4873
AnimationDecoderStatus GetStatus()
Get the decoder status indicating the current state of the decoder.
Definition: SDL3pp_image.h:4845
Surface GetAnimationFrame(AnimationConstParam anim, int index)
Return the frame image under given index.
Definition: SDL3pp_image.h:3209
bool isANI(IOStreamParam src)
Detect ANI animated cursor data on a readable/seekable IOStream.
Definition: SDL3pp_image.h:733
Surface LoadQOI(IOStreamParam src)
Load a QOI image directly.
Definition: SDL3pp_image.h:2013
void SaveAVIFAnimation(AnimationParam anim, IOStreamParam dst, int quality, bool closeio=false)
Save an animation in AVIF format to an IOStream.
Definition: SDL3pp_image.h:3647
Texture LoadTexture(RendererParam renderer, StringParam file)
Load an image from a filesystem path into a texture.
Definition: SDL3pp_image.h:408
int GetAnimationCount(AnimationConstParam anim)
Return the number of frames.
Definition: SDL3pp_image.h:3196
int GetAnimationWidth(AnimationConstParam anim)
Get the width in pixels.
Definition: SDL3pp_image.h:3169
Surface GetAnimationDecoderFrame(AnimationDecoderParam decoder, Uint64 *duration)
Get the next frame in an animation decoder.
Definition: SDL3pp_image.h:4815
GPUTexture LoadGPUTexture(GPUDeviceParam device, GPUCopyPass copy_pass, StringParam file, int *width=nullptr, int *height=nullptr)
Load an image from a filesystem path into a GPU texture.
Definition: SDL3pp_image.h:557
Surface LoadXCF(IOStreamParam src)
Load a XCF image directly.
Definition: SDL3pp_image.h:2161
constexpr AnimationDecoderStatus DECODER_STATUS_INVALID
The decoder is invalid.
Definition: SDL3pp_image.h:4263
IMG_Animation * AnimationRaw
Alias to raw representation for Animation.
Definition: SDL3pp_image.h:32
void ResetAnimationDecoder(AnimationDecoderParam decoder)
Reset an animation decoder.
Definition: SDL3pp_image.h:4868
int GetAnimationHeight(AnimationConstParam anim)
Get the height in pixels.
Definition: SDL3pp_image.h:3177
PropertiesRef GetProperties()
Get the properties of an animation decoder.
Definition: SDL3pp_image.h:4767
Surface LoadSurface(StringParam file)
Load an image from a filesystem path into a software surface.
Definition: SDL3pp_image.h:258
void SaveANIAnimation(AnimationParam anim, IOStreamParam dst, bool closeio=false)
Save an animation in ANI format to an IOStream.
Definition: SDL3pp_image.h:3579
Animation LoadANIAnimation(IOStreamParam src)
Load an ANI animation directly from an IOStream.
Definition: SDL3pp_image.h:3362
AnimationDecoder CreateAnimationDecoder(StringParam file)
Create a decoder to read a series of images from a file.
Definition: SDL3pp_image.h:4623
void SavePNG(SurfaceParam surface, StringParam file)
Save an Surface into a PNG image file.
Definition: SDL3pp_image.h:2631
bool isBMP(IOStreamParam src)
Detect BMP image data on a readable/seekable IOStream.
Definition: SDL3pp_image.h:864
void CloseAnimationEncoder(AnimationEncoderRaw encoder)
Close an animation encoder, finishing any encoding.
Definition: SDL3pp_image.h:4249
bool isCUR(IOStreamParam src)
Detect CUR image data on a readable/seekable IOStream.
Definition: SDL3pp_image.h:821
void Save(StringParam file)
Save an animation to a file.
Definition: SDL3pp_image.h:3512
Point GetSize() const
Get the size in pixels.
Definition: SDL3pp_image.h:3190
::Uint64 Uint64
An unsigned 64-bit integer type.
Definition: SDL3pp_stdinc.h:371
Main include header for the SDL3pp library.
Safely wrap Animation for non owning const parameters.
Definition: SDL3pp_image.h:69
constexpr auto operator->()
member access to underlying AnimationRaw.
Definition: SDL3pp_image.h:100
const AnimationRaw value
parameter's const AnimationRaw
Definition: SDL3pp_image.h:70
constexpr auto operator<=>(const AnimationConstParam &other) const =default
Comparison.
constexpr AnimationConstParam(const AnimationRaw value)
Constructs from const AnimationRaw.
Definition: SDL3pp_image.h:73
constexpr AnimationConstParam(AnimationParam value)
Constructs from AnimationParam.
Definition: SDL3pp_image.h:79
constexpr AnimationConstParam(std::nullptr_t=nullptr)
Constructs null/invalid.
Definition: SDL3pp_image.h:85
Safely wrap AnimationDecoder for non owning parameters.
Definition: SDL3pp_image.h:153
constexpr AnimationDecoderParam(AnimationDecoderRaw value)
Constructs from AnimationDecoderRaw.
Definition: SDL3pp_image.h:157
constexpr AnimationDecoderParam(std::nullptr_t=nullptr)
Constructs null/invalid.
Definition: SDL3pp_image.h:163
AnimationDecoderRaw value
parameter's AnimationDecoderRaw
Definition: SDL3pp_image.h:154
constexpr auto operator<=>(const AnimationDecoderParam &other) const =default
Comparison.
Semi-safe reference for AnimationDecoder.
Definition: SDL3pp_image.h:4562
~AnimationDecoderRef()
Destructor.
Definition: SDL3pp_image.h:4594
AnimationDecoderRef(AnimationDecoderRaw resource) noexcept
Constructs from AnimationDecoderParam.
Definition: SDL3pp_image.h:4584
constexpr AnimationDecoderRef(const AnimationDecoderRef &other) noexcept=default
Copy constructor.
AnimationDecoderRef(AnimationDecoderParam resource) noexcept
Constructs from AnimationDecoderParam.
Definition: SDL3pp_image.h:4572
Safely wrap AnimationEncoder for non owning parameters.
Definition: SDL3pp_image.h:116
AnimationEncoderRaw value
parameter's AnimationEncoderRaw
Definition: SDL3pp_image.h:117
constexpr AnimationEncoderParam(AnimationEncoderRaw value)
Constructs from AnimationEncoderRaw.
Definition: SDL3pp_image.h:120
constexpr AnimationEncoderParam(std::nullptr_t=nullptr)
Constructs null/invalid.
Definition: SDL3pp_image.h:126
constexpr auto operator<=>(const AnimationEncoderParam &other) const =default
Comparison.
Semi-safe reference for AnimationEncoder.
Definition: SDL3pp_image.h:4019
AnimationEncoderRef(AnimationEncoderRaw resource) noexcept
Constructs from AnimationEncoderParam.
Definition: SDL3pp_image.h:4041
AnimationEncoderRef(AnimationEncoderParam resource) noexcept
Constructs from AnimationEncoderParam.
Definition: SDL3pp_image.h:4029
~AnimationEncoderRef()
Destructor.
Definition: SDL3pp_image.h:4051
constexpr AnimationEncoderRef(const AnimationEncoderRef &other) noexcept=default
Copy constructor.
Safely wrap Animation for non owning parameters.
Definition: SDL3pp_image.h:39
AnimationRaw value
parameter's AnimationRaw
Definition: SDL3pp_image.h:40
constexpr AnimationParam(AnimationRaw value)
Constructs from AnimationRaw.
Definition: SDL3pp_image.h:43
constexpr auto operator<=>(const AnimationParam &other) const =default
Comparison.
constexpr auto operator->()
member access to underlying AnimationRaw.
Definition: SDL3pp_image.h:64
constexpr AnimationParam(std::nullptr_t=nullptr)
Constructs null/invalid.
Definition: SDL3pp_image.h:49
Semi-safe reference for Animation.
Definition: SDL3pp_image.h:3134
AnimationRef(AnimationParam resource) noexcept
Constructs from AnimationParam.
Definition: SDL3pp_image.h:3144
~AnimationRef()
Destructor.
Definition: SDL3pp_image.h:3165
AnimationRef(AnimationRaw resource) noexcept
Constructs from AnimationParam.
Definition: SDL3pp_image.h:3156
constexpr AnimationRef(const AnimationRef &other) noexcept=default
Copy constructor.
Safely wrap GPUDevice for non owning parameters.
Definition: SDL3pp_gpu.h:387
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 Properties for non owning parameters.
Definition: SDL3pp_properties.h:53
Semi-safe reference for Properties.
Definition: SDL3pp_properties.h:716
Safely wrap Renderer for non owning parameters.
Definition: SDL3pp_render.h:54
Safely wrap Surface for non owning parameters.
Definition: SDL3pp_surface.h:53