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>
50#if SDL_IMAGE_VERSION_ATLEAST(3, 4, 0)
93#define SDL_IMAGE_MAJOR_VERSION
95#define SDL_IMAGE_MINOR_VERSION
97#define SDL_IMAGE_MICRO_VERSION
104#define SDL_IMAGE_VERSION \
106 SDL_IMAGE_MAJOR_VERSION, SDL_IMAGE_MINOR_VERSION, SDL_IMAGE_MICRO_VERSION)
109#define SDL_IMAGE_VERSION_ATLEAST(X, Y, Z) \
110 ((SDL_IMAGE_MAJOR_VERSION >= X) && \
111 (SDL_IMAGE_MAJOR_VERSION > X || SDL_IMAGE_MINOR_VERSION >= Y) && \
112 (SDL_IMAGE_MAJOR_VERSION > X || SDL_IMAGE_MINOR_VERSION > Y || \
113 SDL_IMAGE_MICRO_VERSION >= Z))
126inline int Version() {
return IMG_Version(); }
172 :
Surface(IMG_Load_IO(src, closeio))
223 return Surface{IMG_Load_IO(src, closeio)};
281 bool closeio =
false)
283 return Surface(IMG_LoadTyped_IO(src, closeio, type));
316 return Texture(IMG_LoadTexture(renderer, file));
320 :
Texture(IMG_LoadTexture(renderer, file))
325 :
Texture(IMG_LoadTexture_IO(renderer, src, closeio))
370 bool closeio =
false)
372 return Texture(IMG_LoadTexture_IO(renderer, src, closeio));
425 bool closeio =
false)
427 return Texture(IMG_LoadTextureTyped_IO(renderer, src, closeio, type));
430#if SDL_IMAGE_VERSION_ATLEAST(3, 4, 0)
466 int* width =
nullptr,
467 int* height =
nullptr)
469 return IMG_LoadGPUTexture(device, copy_pass, file, width, height);
515 GPUCopyPass copy_pass,
517 bool closeio =
false,
518 int* width =
nullptr,
519 int* height =
nullptr)
521 return IMG_LoadGPUTexture_IO(device, copy_pass, src, closeio, width, height);
578 bool closeio =
false,
579 int* width =
nullptr,
580 int* height =
nullptr)
582 return IMG_LoadGPUTextureTyped_IO(
583 device, copy_pass, src, closeio, type, width, height);
1448 return Surface(IMG_LoadAVIF_IO(src));
1485 return Surface{IMG_LoadCUR_IO(src)};
1522 return Surface{IMG_LoadGIF_IO(src)};
1559 return Surface{IMG_LoadICO_IO(src)};
1596 return Surface{IMG_LoadJPG_IO(src)};
1633 return Surface{IMG_LoadJXL_IO(src)};
1670 return Surface{IMG_LoadLBM_IO(src)};
1707 return Surface{IMG_LoadPCX_IO(src)};
1744 return Surface{IMG_LoadPNG_IO(src)};
1859 return Surface{IMG_LoadPNM_IO(src)};
1897 return Surface{IMG_LoadSVG_IO(src)};
1919 return Surface{IMG_LoadSizedSVG_IO(src, size.x, size.y)};
1956 return Surface{IMG_LoadQOI_IO(src)};
1993 return Surface{IMG_LoadTGA_IO(src)};
2030 return Surface{IMG_LoadTIF_IO(src)};
2067 return Surface{IMG_LoadWEBP_IO(src)};
2104 return Surface{IMG_LoadXCF_IO(src)};
2141 return Surface{IMG_LoadXPM_IO(src)};
2178 return Surface{IMG_LoadXV_IO(src)};
2197 return Surface{IMG_ReadXPMFromArray(xpm)};
2215 return Surface{IMG_ReadXPMFromArrayToRGB888(xpm)};
2218#if SDL_IMAGE_VERSION_ATLEAST(3, 4, 0)
2288 bool closeio =
false)
2290 CheckError(IMG_SaveTyped_IO(surface, dst, closeio, type));
2319 CheckError(IMG_SaveAVIF(surface, file, quality));
2345 bool closeio =
false)
2347 CheckError(IMG_SaveAVIF_IO(surface, dst, closeio, quality));
2350#if SDL_IMAGE_VERSION_ATLEAST(3, 4, 0)
2390 bool closeio =
false)
2392 CheckError(IMG_SaveCUR_IO(surface, dst, closeio));
2433 bool closeio =
false)
2435 CheckError(IMG_SaveGIF_IO(surface, dst, closeio));
2476 bool closeio =
false)
2478 CheckError(IMG_SaveICO_IO(surface, dst, closeio));
2500 CheckError(IMG_SaveJPG(surface, file, quality));
2526 bool closeio =
false)
2528 CheckError(IMG_SaveJPG_IO(surface, dst, closeio, quality));
2574 bool closeio =
false)
2576 CheckError(IMG_SavePNG_IO(surface, dst, closeio));
2584#if SDL_IMAGE_VERSION_ATLEAST(3, 4, 0)
2624 bool closeio =
false)
2626 CheckError(IMG_SaveTGA_IO(surface, dst, closeio));
2648 CheckError(IMG_SaveWEBP(surface, file, quality));
2676 bool closeio =
false)
2678 CheckError(IMG_SaveWEBP_IO(surface, dst, closeio, quality));
2739#if SDL_IMAGE_VERSION_ATLEAST(3, 4, 0)
2929 using AnimationBase::AnimationBase;
3025 return {anim->w, anim->h};
3065 return anim->delays[index];
3102 :
Animation(IMG_LoadAnimation_IO(src, closeio))
3168 bool closeio =
false)
3170 return Animation(IMG_LoadAnimationTyped_IO(src, closeio, type));
3173#if SDL_IMAGE_VERSION_ATLEAST(3, 4, 0)
3200 return Animation(IMG_LoadANIAnimation_IO(src));
3228 return Animation(IMG_LoadAPNGAnimation_IO(src));
3256 return Animation(IMG_LoadAVIFAnimation_IO(src));
3286 return Animation(IMG_LoadGIFAnimation_IO(src));
3314 return Animation{IMG_LoadWEBPAnimation_IO(src)};
3317#if SDL_IMAGE_VERSION_ATLEAST(3, 4, 0)
3376 bool closeio =
false)
3378 CheckError(IMG_SaveAnimationTyped_IO(anim, dst, closeio, type));
3411 bool closeio =
false)
3413 CheckError(IMG_SaveANIAnimation_IO(anim, dst, closeio));
3444 bool closeio =
false)
3446 CheckError(IMG_SaveAPNGAnimation_IO(anim, dst, closeio));
3480 bool closeio =
false)
3482 CheckError(IMG_SaveAVIFAnimation_IO(anim, dst, closeio, quality));
3515 bool closeio =
false)
3517 CheckError(IMG_SaveGIFAnimation_IO(anim, dst, closeio));
3553 bool closeio =
false)
3555 CheckError(IMG_SaveWEBPAnimation_IO(anim, dst, closeio, quality));
3582 CheckError(IMG_CreateAnimatedCursor(anim, hotspot.x, hotspot.y)));
3614#if SDL_IMAGE_VERSION_ATLEAST(3, 4, 0)
3668 using AnimationEncoderBase::AnimationEncoderBase;
3845 CheckError(IMG_CreateAnimationEncoder_IO(dst, closeio, type)))
3851 CheckError(IMG_CreateAnimationEncoderWithProperties(props)))
3884 bool closeio =
false)
3949 IMG_PROP_ANIMATION_ENCODER_CREATE_FILENAME_STRING;
3952 IMG_PROP_ANIMATION_ENCODER_CREATE_IOSTREAM_POINTER;
3955 IMG_PROP_ANIMATION_ENCODER_CREATE_IOSTREAM_AUTOCLOSE_BOOLEAN;
3960 IMG_PROP_ANIMATION_ENCODER_CREATE_TYPE_STRING;
3963 IMG_PROP_ANIMATION_ENCODER_CREATE_QUALITY_NUMBER;
3966 IMG_PROP_ANIMATION_ENCODER_CREATE_TIMEBASE_NUMERATOR_NUMBER;
3971 IMG_PROP_ANIMATION_ENCODER_CREATE_TIMEBASE_DENOMINATOR_NUMBER;
3976 IMG_PROP_ANIMATION_ENCODER_CREATE_AVIF_MAX_THREADS_NUMBER;
3981 IMG_PROP_ANIMATION_ENCODER_CREATE_AVIF_KEYFRAME_INTERVAL_NUMBER;
3987 IMG_PROP_ANIMATION_ENCODER_CREATE_GIF_USE_LUT_BOOLEAN;
4014 CheckError(IMG_AddAnimationEncoderFrame(encoder, surface, duration));
4039 CheckError(IMG_CloseAnimationEncoder(encoder));
4052 IMG_DECODER_STATUS_INVALID;
4055 IMG_DECODER_STATUS_OK;
4059 IMG_DECODER_STATUS_FAILED;
4062 IMG_DECODER_STATUS_COMPLETE;
4175 using AnimationDecoderBase::AnimationDecoderBase;
4346 CheckError(IMG_CreateAnimationDecoder_IO(src, closeio, type)))
4352 CheckError(IMG_CreateAnimationDecoderWithProperties(props)))
4386 bool closeio =
false)
4443 IMG_PROP_ANIMATION_DECODER_CREATE_FILENAME_STRING;
4446 IMG_PROP_ANIMATION_DECODER_CREATE_IOSTREAM_POINTER;
4449 IMG_PROP_ANIMATION_DECODER_CREATE_IOSTREAM_AUTOCLOSE_BOOLEAN;
4454 IMG_PROP_ANIMATION_DECODER_CREATE_TYPE_STRING;
4457 IMG_PROP_ANIMATION_DECODER_CREATE_TIMEBASE_NUMERATOR_NUMBER;
4462 IMG_PROP_ANIMATION_DECODER_CREATE_TIMEBASE_DENOMINATOR_NUMBER;
4467 IMG_PROP_ANIMATION_DECODER_CREATE_AVIF_MAX_THREADS_NUMBER;
4472 IMG_PROP_ANIMATION_DECODER_CREATE_AVIF_ALLOW_INCREMENTAL_BOOLEAN;
4478 IMG_PROP_ANIMATION_DECODER_CREATE_AVIF_ALLOW_PROGRESSIVE_BOOLEAN;
4484 IMG_PROP_ANIMATION_DECODER_CREATE_GIF_TRANSPARENT_COLOR_INDEX_NUMBER;
4492 IMG_PROP_ANIMATION_DECODER_CREATE_GIF_NUM_COLORS_NUMBER;
4519 return IMG_GetAnimationDecoderProperties(decoder);
4536 IMG_PROP_METADATA_IGNORE_PROPS_BOOLEAN;
4539 IMG_PROP_METADATA_DESCRIPTION_STRING;
4542 IMG_PROP_METADATA_COPYRIGHT_STRING;
4545 IMG_PROP_METADATA_TITLE_STRING;
4548 IMG_PROP_METADATA_AUTHOR_STRING;
4551 IMG_PROP_METADATA_CREATION_TIME_STRING;
4554 IMG_PROP_METADATA_FRAME_COUNT_NUMBER;
4557 IMG_PROP_METADATA_LOOP_COUNT_NUMBER;
4587 SDL_Surface* frame =
nullptr;
4588 CheckError(IMG_GetAnimationDecoderFrame(decoder, &frame, duration));
4611 return IMG_GetAnimationDecoderStatus(decoder);
4639 CheckError(IMG_ResetAnimationDecoder(decoder));
4661 CheckError(IMG_CloseAnimationDecoder(decoder));
4677 : Surface(
LoadBMP(std::move(file)))
An opaque handle representing a copy pass.
Definition SDL3pp_gpu.h:1744
An opaque handle representing a texture.
Definition SDL3pp_gpu.h:675
constexpr RawPointer release() noexcept
Definition SDL3pp_resource.h:57
friend constexpr void swap(ResourceBaseT &lhs, ResourceBaseT &rhs) noexcept
Definition SDL3pp_resource.h:65
constexpr RawPointer get() const noexcept
Definition SDL3pp_resource.h:54
constexpr ResourceBaseT()=default
Default constructor, creates null/invalid resource.
Const reference wrapper for a given resource,.
Definition SDL3pp_resource.h:115
Helpers to use C++ strings parameters.
Definition SDL3pp_strings.h:43
constexpr void CheckError(bool result)
Check and throw if returned value from SDL is an error.
Definition SDL3pp_error.h:199
ResourceRefT< GPUDeviceBase > GPUDeviceRef
Reference for GPUDevice.
Definition SDL3pp_gpu.h:387
ResourceRefT< IOStreamBase > IOStreamRef
Reference for IOStream.
Definition SDL3pp_iostream.h:37
IOStream IOFromFile(StringParam file, StringParam mode)
Use this function to create a new IOStream structure for reading from and/or writing to a named file.
Definition SDL3pp_iostream.h:1683
void Close()
Close and free an allocated IOStream structure.
Definition SDL3pp_iostream.h:1946
ResourceRefT< PropertiesBase > PropertiesRef
Reference for Properties.
Definition SDL3pp_properties.h:53
SDL_Point PointRaw
Alias to raw representation for Point.
Definition SDL3pp_rect.h:22
Surface LoadICO_IO(IOStreamRef src)
Load a ICO image directly.
Definition SDL3pp_image.h:1557
void SaveAPNG_IO(IOStreamRef dst, bool closeio=false)
Save an animation in APNG format to an IOStream.
Definition SDL3pp_image.h:3449
Surface LoadJXL_IO(IOStreamRef src)
Load a JXL image directly.
Definition SDL3pp_image.h:1631
Surface ReadXPMFromArrayToRGB888(char **xpm)
Load an XPM image from a memory array.
Definition SDL3pp_image.h:2213
AnimationEncoder CreateAnimationEncoderWithProperties(PropertiesRef props)
Create an animation encoder with the specified properties.
Definition SDL3pp_image.h:3935
Animation LoadWEBPAnimation_IO(IOStreamRef src)
Load a WEBP animation directly.
Definition SDL3pp_image.h:3312
bool isPNG(IOStreamRef src)
Detect PNG image data on a readable/seekable IOStream.
Definition SDL3pp_image.h:1068
Surface LoadPNG_IO(IOStreamRef src)
Load a PNG image directly.
Definition SDL3pp_image.h:1742
AnimationDecoder CreateAnimationDecoderWithProperties(PropertiesRef props)
Create an animation decoder with the specified properties.
Definition SDL3pp_image.h:4429
Surface ReadXPMFromArray(char **xpm)
Load an XPM image from a memory array.
Definition SDL3pp_image.h:2195
int GetAnimationHeight(AnimationConstRef anim)
Get the height in pixels.
Definition SDL3pp_image.h:3015
Animation LoadAPNGAnimation_IO(IOStreamRef src)
Load an APNG animation directly from an IOStream.
Definition SDL3pp_image.h:3226
void SaveAnimation(AnimationRef anim, StringParam file)
Save an animation to a file.
Definition SDL3pp_image.h:3337
Animation LoadAnimation_IO(IOStreamRef src, bool closeio=false)
Load an animation from an IOStream.
Definition SDL3pp_image.h:3130
void FreeAnimation(AnimationRaw anim)
Dispose of an Animation and free its resources.
Definition SDL3pp_image.h:3610
void SaveCUR(SurfaceRef surface, StringParam file)
Save an Surface into a CUR image file.
Definition SDL3pp_image.h:2365
Surface LoadWEBP_IO(IOStreamRef src)
Load a WEBP image directly.
Definition SDL3pp_image.h:2065
bool isTIF(IOStreamRef src)
Detect TIFF image data on a readable/seekable IOStream.
Definition SDL3pp_image.h:1240
AnimationEncoder CreateAnimationEncoder(StringParam file)
Create an encoder to save a series of images to a file.
Definition SDL3pp_image.h:3831
void SaveAVIFAnimation_IO(AnimationRef anim, IOStreamRef dst, int quality, bool closeio=false)
Save an animation in AVIF format to an IOStream.
Definition SDL3pp_image.h:3477
Surface LoadPNG(StringParam file)
Load a PNG image from a file.
Definition SDL3pp_image.h:1820
Cursor CreateCursor(const PointRaw &hotspot)
Create an animated cursor from an animation.
Definition SDL3pp_image.h:3585
Texture LoadTexture_IO(RendererRef renderer, IOStreamRef src, bool closeio=false)
Load an image from an SDL data source into a texture.
Definition SDL3pp_image.h:368
void SaveTyped_IO(SurfaceConstRef surface, IOStreamRef dst, StringParam type, bool closeio=false)
Save an Surface into formatted image data, via an IOStream.
Definition SDL3pp_image.h:2285
void Reset()
Reset an animation decoder.
Definition SDL3pp_image.h:4642
ResourceConstRef< AnimationRaw, AnimationRawConst > AnimationConstRef
Safely wrap Animation for non owning const parameters.
Definition SDL3pp_image.h:48
void SaveWEBP(SurfaceRef surface, StringParam file, float quality)
Save an Surface into a WEBP image file.
Definition SDL3pp_image.h:2646
bool isWEBP(IOStreamRef src)
Detect WEBP image data on a readable/seekable IOStream.
Definition SDL3pp_image.h:1283
Surface LoadGIF_IO(IOStreamRef src)
Load a GIF image directly.
Definition SDL3pp_image.h:1520
int GetHeight() const
Get the height in pixels.
Definition SDL3pp_image.h:3017
Surface LoadXPM_IO(IOStreamRef src)
Load a XPM image directly.
Definition SDL3pp_image.h:2139
Surface LoadTIF_IO(IOStreamRef src)
Load a TIFF image directly.
Definition SDL3pp_image.h:2028
bool isXPM(IOStreamRef src)
Detect XPM image data on a readable/seekable IOStream.
Definition SDL3pp_image.h:1369
void SaveWEBP_IO(SurfaceRef surface, IOStreamRef dst, float quality, bool closeio=false)
Save an Surface into WEBP image data, via an IOStream.
Definition SDL3pp_image.h:2673
bool isPCX(IOStreamRef src)
Detect PCX image data on a readable/seekable IOStream.
Definition SDL3pp_image.h:1025
Surface GetAnimationFrame(AnimationConstRef anim, int index)
Return the frame image under given index.
Definition SDL3pp_image.h:3047
bool isJXL(IOStreamRef src)
Detect JXL image data on a readable/seekable IOStream.
Definition SDL3pp_image.h:939
Point GetAnimationSize(AnimationConstRef anim)
Get the size in pixels.
Definition SDL3pp_image.h:3023
bool isLBM(IOStreamRef src)
Detect LBM image data on a readable/seekable IOStream.
Definition SDL3pp_image.h:982
void SavePNG(StringParam file) const
Save a surface to a file in PNG format.
Definition SDL3pp_image.h:2549
bool isICO(IOStreamRef src)
Detect ICO image data on a readable/seekable IOStream.
Definition SDL3pp_image.h:853
void AddAnimationEncoderFrame(AnimationEncoderRef encoder, SurfaceRef surface, Uint64 duration)
Add a frame to an animation encoder.
Definition SDL3pp_image.h:4010
Surface GetAnimationDecoderFrame(AnimationDecoderRef decoder, Uint64 *duration)
Get the next frame in an animation decoder.
Definition SDL3pp_image.h:4584
bool isPNM(IOStreamRef src)
Detect PNM image data on a readable/seekable IOStream.
Definition SDL3pp_image.h:1111
void SaveAVIF_IO(SurfaceRef surface, IOStreamRef dst, int quality, bool closeio=false)
Save an Surface into AVIF image data, via an IOStream.
Definition SDL3pp_image.h:2342
IMG_AnimationDecoderStatus AnimationDecoderStatus
An enum representing the status of an animation decoder.
Definition SDL3pp_image.h:4049
int GetAnimationDelay(AnimationConstRef anim, int index)
Return the frame delay under given index.
Definition SDL3pp_image.h:3063
Surface LoadTGA_IO(IOStreamRef src)
Load a TGA image directly.
Definition SDL3pp_image.h:1991
void SaveAVIF(SurfaceRef surface, StringParam file, int quality)
Save an Surface into a AVIF image file.
Definition SDL3pp_image.h:2317
int GetDelay(int index) const
Return the frame delay under given index.
Definition SDL3pp_image.h:3068
ResourceRefT< AnimationDecoderBase > AnimationDecoderRef
Reference for AnimationDecoder.
Definition SDL3pp_image.h:82
Animation LoadAnimation(StringParam file)
Load an animation from a file.
Definition SDL3pp_image.h:3091
void Save(SurfaceConstRef surface, StringParam file)
Save an Surface into an image file.
Definition SDL3pp_image.h:2244
Surface LoadXCF_IO(IOStreamRef src)
Load a XCF image directly.
Definition SDL3pp_image.h:2102
void SaveJPG_IO(SurfaceRef surface, IOStreamRef dst, int quality, bool closeio=false)
Save an Surface into JPEG image data, via an IOStream.
Definition SDL3pp_image.h:2523
void SaveTGA_IO(SurfaceRef surface, IOStreamRef dst, bool closeio=false)
Save an Surface into TGA image data, via an IOStream.
Definition SDL3pp_image.h:2622
int GetAnimationCount(AnimationConstRef anim)
Return the number of frames.
Definition SDL3pp_image.h:3034
Surface GetClipboardImage()
Load an image from an SDL data source into a GPU texture.
Definition SDL3pp_image.h:593
void SaveJPG(SurfaceRef surface, StringParam file, int quality)
Save an Surface into a JPEG image file.
Definition SDL3pp_image.h:2498
bool isJPG(IOStreamRef src)
Detect JPG image data on a readable/seekable IOStream.
Definition SDL3pp_image.h:896
Cursor CreateAnimatedCursor(AnimationRef anim, const PointRaw &hotspot)
Create an animated cursor from an animation.
Definition SDL3pp_image.h:3579
void SaveICO_IO(SurfaceRef surface, IOStreamRef dst, bool closeio=false)
Save an Surface into ICO image data, via an IOStream.
Definition SDL3pp_image.h:2474
void CloseAnimationDecoder(AnimationDecoderRaw decoder)
Close an animation decoder, finishing any decoding.
Definition SDL3pp_image.h:4659
void Save(StringParam filename) const
Save an Surface into an image file.
Definition SDL3pp_image.h:2249
AnimationEncoder CreateAnimationEncoder_IO(IOStreamRef dst, StringParam type, bool closeio=false)
Create an encoder to save a series of images to an IOStream.
Definition SDL3pp_image.h:3882
IMG_Animation * AnimationRaw
Alias to raw representation for Animation.
Definition SDL3pp_image.h:35
Surface LoadLBM_IO(IOStreamRef src)
Load a LBM image directly.
Definition SDL3pp_image.h:1668
IMG_AnimationDecoder * AnimationDecoderRaw
Alias to raw representation for AnimationDecoder.
Definition SDL3pp_image.h:75
Surface LoadCUR_IO(IOStreamRef src)
Load a CUR image directly.
Definition SDL3pp_image.h:1483
bool isXCF(IOStreamRef src)
Detect XCF image data on a readable/seekable IOStream.
Definition SDL3pp_image.h:1326
void Close()
Close an animation decoder, finishing any decoding.
Definition SDL3pp_image.h:4664
void ResetAnimationDecoder(AnimationDecoderRef decoder)
Reset an animation decoder.
Definition SDL3pp_image.h:4637
void SavePNG_IO(SurfaceRef surface, IOStreamRef dst, bool closeio=false)
Save an Surface into PNG image data, via an IOStream.
Definition SDL3pp_image.h:2572
void SaveGIF(SurfaceRef surface, StringParam file)
Save an Surface into a GIF image file.
Definition SDL3pp_image.h:2408
AnimationDecoderStatus GetStatus()
Get the decoder status indicating the current state of the decoder.
Definition SDL3pp_image.h:4614
void SaveICO(SurfaceRef surface, StringParam file)
Save an Surface into a ICO image file.
Definition SDL3pp_image.h:2451
bool isANI(IOStreamRef src)
Detect ANI animated cursor data on a readable/seekable IOStream.
Definition SDL3pp_image.h:636
void SaveTGA(SurfaceRef surface, StringParam file)
Save an Surface into a TGA image file.
Definition SDL3pp_image.h:2599
ResourceRefT< AnimationEncoderBase > AnimationEncoderRef
Reference for AnimationEncoder.
Definition SDL3pp_image.h:66
bool isSVG(IOStreamRef src)
Detect SVG image data on a readable/seekable IOStream.
Definition SDL3pp_image.h:1197
PropertiesRef GetAnimationDecoderProperties(AnimationDecoderRef decoder)
Get the properties of an animation decoder.
Definition SDL3pp_image.h:4517
Surface LoadXV_IO(IOStreamRef src)
Load a XV image directly.
Definition SDL3pp_image.h:2176
Surface GetFrame(Uint64 *duration)
Get the next frame in an animation decoder.
Definition SDL3pp_image.h:4592
void SaveAVIF_IO(IOStreamRef dst, int quality, bool closeio=false)
Save an animation in AVIF format to an IOStream.
Definition SDL3pp_image.h:3485
void AddFrame(SurfaceRef surface, Uint64 duration)
Add a frame to an animation encoder.
Definition SDL3pp_image.h:4017
Surface LoadSVG_IO(IOStreamRef src)
Load a SVG image directly.
Definition SDL3pp_image.h:1895
void SaveGIF_IO(IOStreamRef dst, bool closeio=false)
Save an animation in GIF format to an IOStream.
Definition SDL3pp_image.h:3520
int GetWidth() const
Get the width in pixels.
Definition SDL3pp_image.h:3009
void SavePNG(SurfaceRef surface, StringParam file)
Save an Surface into a PNG image file.
Definition SDL3pp_image.h:2544
void Free()
Dispose of an Animation and free its resources.
Definition SDL3pp_image.h:3612
bool isBMP(IOStreamRef src)
Detect BMP image data on a readable/seekable IOStream.
Definition SDL3pp_image.h:767
void SaveWEBPAnimation_IO(AnimationRef anim, IOStreamRef dst, int quality, bool closeio=false)
Save an animation in WEBP format to an IOStream.
Definition SDL3pp_image.h:3550
Surface LoadPCX_IO(IOStreamRef src)
Load a PCX image directly.
Definition SDL3pp_image.h:1705
const IMG_Animation * AnimationRawConst
Alias to const raw representation for Animation.
Definition SDL3pp_image.h:38
void SaveCUR_IO(SurfaceRef surface, IOStreamRef dst, bool closeio=false)
Save an Surface into CUR image data, via an IOStream.
Definition SDL3pp_image.h:2388
Surface LoadSurfaceTyped_IO(IOStreamRef src, StringParam type, bool closeio=false)
Load an image from an SDL data source into a software surface.
Definition SDL3pp_image.h:279
Surface LoadPNM_IO(IOStreamRef src)
Load a PNM image directly.
Definition SDL3pp_image.h:1857
void Close()
Close an animation encoder, finishing any encoding.
Definition SDL3pp_image.h:4042
AnimationDecoderStatus GetAnimationDecoderStatus(AnimationDecoderRef decoder)
Get the decoder status indicating the current state of the decoder.
Definition SDL3pp_image.h:4608
void SaveANIAnimation_IO(AnimationRef anim, IOStreamRef dst, bool closeio=false)
Save an animation in ANI format to an IOStream.
Definition SDL3pp_image.h:3409
void SaveAnimationTyped_IO(AnimationRef anim, IOStreamRef dst, StringParam type, bool closeio=false)
Save an animation to an IOStream.
Definition SDL3pp_image.h:3373
ResourceRefT< AnimationBase > AnimationRef
Reference for Animation.
Definition SDL3pp_image.h:45
Surface LoadAVIF_IO(IOStreamRef src)
Load a AVIF image directly.
Definition SDL3pp_image.h:1446
constexpr AnimationDecoderStatus DECODER_STATUS_OK
The decoder is ready to decode the next frame.
Definition SDL3pp_image.h:4054
bool isXV(IOStreamRef src)
Detect XV image data on a readable/seekable IOStream.
Definition SDL3pp_image.h:1412
Texture LoadTexture(RendererRef renderer, StringParam file)
Load an image from a filesystem path into a texture.
Definition SDL3pp_image.h:314
void SaveGIF_IO(SurfaceRef surface, IOStreamRef dst, bool closeio=false)
Save an Surface into GIF image data, via an IOStream.
Definition SDL3pp_image.h:2431
Surface LoadSurface_IO(IOStreamRef src, bool closeio=false)
Load an image from an SDL data source into a software surface.
Definition SDL3pp_image.h:221
int GetAnimationWidth(AnimationConstRef anim)
Get the width in pixels.
Definition SDL3pp_image.h:3007
constexpr AnimationDecoderStatus DECODER_STATUS_COMPLETE
No more frames available.
Definition SDL3pp_image.h:4061
bool isQOI(IOStreamRef src)
Detect QOI image data on a readable/seekable IOStream.
Definition SDL3pp_image.h:1154
constexpr AnimationDecoderStatus DECODER_STATUS_FAILED
The decoder failed to decode a frame, call GetError() for more information.
Definition SDL3pp_image.h:4058
Animation LoadANIAnimation_IO(IOStreamRef src)
Load an ANI animation directly from an IOStream.
Definition SDL3pp_image.h:3198
AnimationDecoder CreateAnimationDecoder_IO(IOStreamRef src, StringParam type, bool closeio=false)
Create a decoder to read a series of images from an IOStream.
Definition SDL3pp_image.h:4384
Animation LoadAVIFAnimation_IO(IOStreamRef src)
Load an AVIF animation directly from an IOStream.
Definition SDL3pp_image.h:3254
void SaveTyped_IO(IOStreamRef dst, StringParam type, bool closeio=false) const
Save an Surface into formatted image data, via an IOStream.
Definition SDL3pp_image.h:2293
void SaveWEBP_IO(IOStreamRef dst, int quality, bool closeio=false)
Save an animation in WEBP format to an IOStream.
Definition SDL3pp_image.h:3558
void SaveANI_IO(IOStreamRef dst, bool closeio=false)
Save an animation in ANI format to an IOStream.
Definition SDL3pp_image.h:3416
Animation LoadAnimationTyped_IO(IOStreamRef src, StringParam type, bool closeio=false)
Load an animation from an IOStream.
Definition SDL3pp_image.h:3166
Texture LoadTextureTyped_IO(RendererRef renderer, IOStreamRef src, StringParam type, bool closeio=false)
Load an image from an SDL data source into a texture.
Definition SDL3pp_image.h:422
bool isAVIF(IOStreamRef src)
Detect AVIF image data on a readable/seekable IOStream.
Definition SDL3pp_image.h:681
void SavePNG_IO(IOStreamRef dst, bool closeio=false) const
Save a surface to a seekable SDL data stream in PNG format.
Definition SDL3pp_image.h:2579
Surface LoadQOI_IO(IOStreamRef src)
Load a QOI image directly.
Definition SDL3pp_image.h:1954
PropertiesRef GetProperties()
Get the properties of an animation decoder.
Definition SDL3pp_image.h:4522
Surface LoadSizedSVG_IO(IOStreamRef src, const PointRaw &size)
Load an SVG image, scaled to a specific size.
Definition SDL3pp_image.h:1917
Surface LoadJPG_IO(IOStreamRef src)
Load a JPG image directly.
Definition SDL3pp_image.h:1594
bool isGIF(IOStreamRef src)
Detect GIF image data on a readable/seekable IOStream.
Definition SDL3pp_image.h:810
void SaveGIFAnimation_IO(AnimationRef anim, IOStreamRef dst, bool closeio=false)
Save an animation in GIF format to an IOStream.
Definition SDL3pp_image.h:3513
constexpr AnimationDecoderStatus DECODER_STATUS_INVALID
The decoder is invalid.
Definition SDL3pp_image.h:4051
void SaveAPNGAnimation_IO(AnimationRef anim, IOStreamRef dst, bool closeio=false)
Save an animation in APNG format to an IOStream.
Definition SDL3pp_image.h:3442
bool isCUR(IOStreamRef src)
Detect CUR image data on a readable/seekable IOStream.
Definition SDL3pp_image.h:724
Surface GetFrame(int index) const
Return the frame image under given index.
Definition SDL3pp_image.h:3052
int GetCount() const
Return the number of frames.
Definition SDL3pp_image.h:3036
void SaveTyped_IO(IOStreamRef dst, StringParam type, bool closeio=false)
Save an animation to an IOStream.
Definition SDL3pp_image.h:3381
Surface LoadSurface(StringParam file)
Load an image from a filesystem path into a software surface.
Definition SDL3pp_image.h:164
Point GetSize() const
Get the size in pixels.
Definition SDL3pp_image.h:3028
AnimationDecoder CreateAnimationDecoder(StringParam file)
Create a decoder to read a series of images from a file.
Definition SDL3pp_image.h:4332
Animation LoadGIFAnimation_IO(IOStreamRef src)
Load a GIF animation directly.
Definition SDL3pp_image.h:3284
void CloseAnimationEncoder(AnimationEncoderRaw encoder)
Close an animation encoder, finishing any encoding.
Definition SDL3pp_image.h:4037
GPUTexture LoadGPUTexture(GPUDeviceRef 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:463
IMG_AnimationEncoder * AnimationEncoderRaw
Alias to raw representation for AnimationEncoder.
Definition SDL3pp_image.h:59
void Save(StringParam file)
Save an animation to a file.
Definition SDL3pp_image.h:3342
::Uint64 Uint64
An unsigned 64-bit integer type.
Definition SDL3pp_stdinc.h:326
Surface LoadBMP_IO(IOStreamRef src, bool closeio=false)
Load a BMP image from a seekable SDL data stream.
Definition SDL3pp_surface.h:2714
Surface LoadBMP(StringParam file)
Load a BMP image from a file.
Definition SDL3pp_surface.h:2737
ResourceRefT< SurfaceBase > SurfaceRef
Reference for Surface.
Definition SDL3pp_surface.h:57
ResourceConstRef< SurfaceRaw, SurfaceRawConst > SurfaceConstRef
Safely wrap Surface for non owning const parameters.
Definition SDL3pp_surface.h:60
ResourceRefT< RendererBase > RendererRef
Reference for Renderer.
Definition SDL3pp_video.h:86
Supported properties for creating an animation decoder.
Definition SDL3pp_image.h:4440
constexpr auto AVIF_ALLOW_INCREMENTAL_BOOLEAN
Enable avif allow incremental.
Definition SDL3pp_image.h:4471
constexpr auto GIF_TRANSPARENT_COLOR_INDEX_NUMBER
Number for gif transparent color index.
Definition SDL3pp_image.h:4483
constexpr auto TYPE_STRING
String for type.
Definition SDL3pp_image.h:4453
constexpr auto TIMEBASE_NUMERATOR_NUMBER
Number for timebase numerator.
Definition SDL3pp_image.h:4456
constexpr auto IOSTREAM_POINTER
Pointer to iostream.
Definition SDL3pp_image.h:4445
constexpr auto AVIF_MAX_THREADS_NUMBER
Number for avif max threads.
Definition SDL3pp_image.h:4466
constexpr auto AVIF_ALLOW_PROGRESSIVE_BOOLEAN
Enable avif allow progressive.
Definition SDL3pp_image.h:4477
constexpr auto IOSTREAM_AUTOCLOSE_BOOLEAN
Enable iostream autoclose.
Definition SDL3pp_image.h:4448
constexpr auto GIF_NUM_COLORS_NUMBER
Number for gif num colors.
Definition SDL3pp_image.h:4491
constexpr auto FILENAME_STRING
String for filename.
Definition SDL3pp_image.h:4442
constexpr auto TIMEBASE_DENOMINATOR_NUMBER
Number for timebase denominator.
Definition SDL3pp_image.h:4461
Supported properties for creating an animation encoder.
Definition SDL3pp_image.h:3946
constexpr auto AVIF_MAX_THREADS_NUMBER
Number for avif max threads.
Definition SDL3pp_image.h:3975
constexpr auto AVIF_KEYFRAME_INTERVAL_NUMBER
Number for avif keyframe interval.
Definition SDL3pp_image.h:3980
constexpr auto QUALITY_NUMBER
Number for quality.
Definition SDL3pp_image.h:3962
constexpr auto FILENAME_STRING
String for filename.
Definition SDL3pp_image.h:3948
constexpr auto IOSTREAM_AUTOCLOSE_BOOLEAN
Enable iostream autoclose.
Definition SDL3pp_image.h:3954
constexpr auto IOSTREAM_POINTER
Pointer to iostream.
Definition SDL3pp_image.h:3951
constexpr auto TYPE_STRING
String for type.
Definition SDL3pp_image.h:3959
constexpr auto GIF_USE_LUT_BOOLEAN
Enable gif use lut.
Definition SDL3pp_image.h:3986
constexpr auto TIMEBASE_DENOMINATOR_NUMBER
Number for timebase denominator.
Definition SDL3pp_image.h:3970
constexpr auto TIMEBASE_NUMERATOR_NUMBER
Number for timebase numerator.
Definition SDL3pp_image.h:3965
Main include header for the SDL3pp library.
Base class to Animation.
Definition SDL3pp_image.h:2689
constexpr ResourceBaseT()=default
Default constructor, creates null/invalid resource.
Base class to AnimationDecoder.
Definition SDL3pp_image.h:4070
constexpr ResourceBaseT()=default
Default constructor, creates null/invalid resource.
An object representing animation decoder.
Definition SDL3pp_image.h:4174
constexpr AnimationDecoder & operator=(AnimationDecoder &&other) noexcept
Assignment operator.
Definition SDL3pp_image.h:4299
constexpr AnimationDecoder(AnimationDecoderRaw resource) noexcept
Constructs from raw AnimationDecoder.
Definition SDL3pp_image.h:4184
~AnimationDecoder()
Destructor.
Definition SDL3pp_image.h:4296
constexpr AnimationDecoder(AnimationDecoder &&other) noexcept
Move constructor.
Definition SDL3pp_image.h:4190
Base class to AnimationEncoder.
Definition SDL3pp_image.h:3622
constexpr ResourceBaseT()=default
Default constructor, creates null/invalid resource.
An object representing the encoder context.
Definition SDL3pp_image.h:3667
constexpr AnimationEncoder & operator=(AnimationEncoder &&other) noexcept
Assignment operator.
Definition SDL3pp_image.h:3799
~AnimationEncoder()
Destructor.
Definition SDL3pp_image.h:3796
constexpr AnimationEncoder(AnimationEncoder &&other) noexcept
Move constructor.
Definition SDL3pp_image.h:3683
constexpr AnimationEncoder(AnimationEncoderRaw resource) noexcept
Constructs from raw AnimationEncoder.
Definition SDL3pp_image.h:3677
Animated image support.
Definition SDL3pp_image.h:2928
constexpr Animation(Animation &&other) noexcept
Move constructor.
Definition SDL3pp_image.h:2944
~Animation()
Destructor.
Definition SDL3pp_image.h:2996
constexpr Animation & operator=(Animation &&other) noexcept
Assignment operator.
Definition SDL3pp_image.h:2999
constexpr Animation(AnimationRaw resource) noexcept
Constructs from raw Animation.
Definition SDL3pp_image.h:2938
The structure used to identify an SDL cursor.
Definition SDL3pp_mouse.h:207
The structure that defines a point (using integers).
Definition SDL3pp_rect.h:97
A non-owning reference wrapper for a given resource.
Definition SDL3pp_resource.h:93
A collection of pixels used in software blitting.
Definition SDL3pp_surface.h:1677
static Surface borrow(SurfaceRaw resource)
Safely borrows the from SurfaceRaw.
Definition SDL3pp_surface.h:1844
constexpr Surface(SurfaceRaw resource) noexcept
Constructs from raw Surface.
Definition SDL3pp_surface.h:1687
An efficient driver-specific representation of pixel data.
Definition SDL3pp_render.h:2993
constexpr Texture(TextureRaw resource) noexcept
Constructs from raw Texture.
Definition SDL3pp_render.h:3003