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>
47#if SDL_IMAGE_VERSION_ATLEAST(3, 4, 0)
84#define SDL_IMAGE_MAJOR_VERSION
86#define SDL_IMAGE_MINOR_VERSION
88#define SDL_IMAGE_MICRO_VERSION
95#define SDL_IMAGE_VERSION \
97 SDL_IMAGE_MAJOR_VERSION, SDL_IMAGE_MINOR_VERSION, SDL_IMAGE_MICRO_VERSION)
100#define SDL_IMAGE_VERSION_ATLEAST(X, Y, Z) \
101 ((SDL_IMAGE_MAJOR_VERSION >= X) && \
102 (SDL_IMAGE_MAJOR_VERSION > X || SDL_IMAGE_MINOR_VERSION >= Y) && \
103 (SDL_IMAGE_MAJOR_VERSION > X || SDL_IMAGE_MINOR_VERSION > Y || \
104 SDL_IMAGE_MICRO_VERSION >= Z))
117inline int Version() {
return IMG_Version(); }
163 :
Surface(IMG_Load_IO(src, closeio))
214 return Surface{IMG_Load_IO(src, closeio)};
272 bool closeio =
false)
274 return Surface(IMG_LoadTyped_IO(src, closeio, type));
307 return Texture(IMG_LoadTexture(renderer, file));
311 :
Texture(IMG_LoadTexture(renderer, file))
316 :
Texture(IMG_LoadTexture_IO(renderer, src, closeio))
361 bool closeio =
false)
363 return Texture(IMG_LoadTexture_IO(renderer, src, closeio));
416 bool closeio =
false)
418 return Texture(IMG_LoadTextureTyped_IO(renderer, src, closeio, type));
421#if SDL_IMAGE_VERSION_ATLEAST(3, 4, 0)
457 int* width =
nullptr,
458 int* height =
nullptr)
460 return IMG_LoadGPUTexture(device, copy_pass, file, width, height);
506 GPUCopyPass copy_pass,
508 bool closeio =
false,
509 int* width =
nullptr,
510 int* height =
nullptr)
512 return IMG_LoadGPUTexture_IO(device, copy_pass, src, closeio, width, height);
569 bool closeio =
false,
570 int* width =
nullptr,
571 int* height =
nullptr)
573 return IMG_LoadGPUTextureTyped_IO(
574 device, copy_pass, src, closeio, type, width, height);
1442 return Surface(IMG_LoadAVIF_IO(src));
1479 return Surface{IMG_LoadCUR_IO(src)};
1516 return Surface{IMG_LoadGIF_IO(src)};
1553 return Surface{IMG_LoadICO_IO(src)};
1590 return Surface{IMG_LoadJPG_IO(src)};
1627 return Surface{IMG_LoadJXL_IO(src)};
1664 return Surface{IMG_LoadLBM_IO(src)};
1701 return Surface{IMG_LoadPCX_IO(src)};
1738 return Surface{IMG_LoadPNG_IO(src)};
1853 return Surface{IMG_LoadPNM_IO(src)};
1891 return Surface{IMG_LoadSVG_IO(src)};
1916 return Surface{IMG_LoadSizedSVG_IO(src, size.x, size.y)};
1953 return Surface{IMG_LoadQOI_IO(src)};
1990 return Surface{IMG_LoadTGA_IO(src)};
2027 return Surface{IMG_LoadTIF_IO(src)};
2064 return Surface{IMG_LoadWEBP_IO(src)};
2101 return Surface{IMG_LoadXCF_IO(src)};
2138 return Surface{IMG_LoadXPM_IO(src)};
2175 return Surface{IMG_LoadXV_IO(src)};
2194 return Surface{IMG_ReadXPMFromArray(xpm)};
2212 return Surface{IMG_ReadXPMFromArrayToRGB888(xpm)};
2215#if SDL_IMAGE_VERSION_ATLEAST(3, 4, 0)
2285 bool closeio =
false)
2287 CheckError(IMG_SaveTyped_IO(surface, dst, closeio, type));
2316 CheckError(IMG_SaveAVIF(surface, file, quality));
2342 bool closeio =
false)
2344 CheckError(IMG_SaveAVIF_IO(surface, dst, closeio, quality));
2347#if SDL_IMAGE_VERSION_ATLEAST(3, 4, 0)
2387 bool closeio =
false)
2389 CheckError(IMG_SaveCUR_IO(surface, dst, closeio));
2430 bool closeio =
false)
2432 CheckError(IMG_SaveGIF_IO(surface, dst, closeio));
2473 bool closeio =
false)
2475 CheckError(IMG_SaveICO_IO(surface, dst, closeio));
2497 CheckError(IMG_SaveJPG(surface, file, quality));
2523 bool closeio =
false)
2525 CheckError(IMG_SaveJPG_IO(surface, dst, closeio, quality));
2571 bool closeio =
false)
2573 CheckError(IMG_SavePNG_IO(surface, dst, closeio));
2581#if SDL_IMAGE_VERSION_ATLEAST(3, 4, 0)
2621 bool closeio =
false)
2623 CheckError(IMG_SaveTGA_IO(surface, dst, closeio));
2645 CheckError(IMG_SaveWEBP(surface, file, quality));
2673 bool closeio =
false)
2675 CheckError(IMG_SaveWEBP_IO(surface, dst, closeio, quality));
2826#if SDL_IMAGE_VERSION_ATLEAST(3, 4, 0)
3025 return {anim->w, anim->h};
3059 return anim->delays[index];
3099 :
Animation(IMG_LoadAnimation_IO(src, closeio))
3171 bool closeio =
false)
3173 return Animation(IMG_LoadAnimationTyped_IO(src, closeio, type));
3176#if SDL_IMAGE_VERSION_ATLEAST(3, 4, 0)
3206 return Animation(IMG_LoadANIAnimation_IO(src));
3237 return Animation(IMG_LoadAPNGAnimation_IO(src));
3268 return Animation(IMG_LoadAVIFAnimation_IO(src));
3298 return Animation(IMG_LoadGIFAnimation_IO(src));
3326 return Animation{IMG_LoadWEBPAnimation_IO(src)};
3329#if SDL_IMAGE_VERSION_ATLEAST(3, 4, 0)
3388 bool closeio =
false)
3390 CheckError(IMG_SaveAnimationTyped_IO(anim, dst, closeio, type));
3423 bool closeio =
false)
3425 CheckError(IMG_SaveANIAnimation_IO(anim, dst, closeio));
3456 bool closeio =
false)
3458 CheckError(IMG_SaveAPNGAnimation_IO(anim, dst, closeio));
3492 bool closeio =
false)
3494 CheckError(IMG_SaveAVIFAnimation_IO(anim, dst, closeio, quality));
3525 bool closeio =
false)
3527 CheckError(IMG_SaveGIFAnimation_IO(anim, dst, closeio));
3563 bool closeio =
false)
3565 CheckError(IMG_SaveWEBPAnimation_IO(anim, dst, closeio, quality));
3590 CheckError(IMG_CreateAnimatedCursor(anim, hotspot.x, hotspot.y))};
3622#if SDL_IMAGE_VERSION_ATLEAST(3, 4, 0)
3853 CheckError(IMG_CreateAnimationEncoder_IO(dst, closeio, type)))
3859 CheckError(IMG_CreateAnimationEncoderWithProperties(props)))
3892 bool closeio =
false)
3956constexpr auto CREATE_FILENAME_STRING =
3957 IMG_PROP_ANIMATION_ENCODER_CREATE_FILENAME_STRING;
3959constexpr auto CREATE_IOSTREAM_POINTER =
3960 IMG_PROP_ANIMATION_ENCODER_CREATE_IOSTREAM_POINTER;
3962constexpr auto CREATE_IOSTREAM_AUTOCLOSE_BOOLEAN =
3963 IMG_PROP_ANIMATION_ENCODER_CREATE_IOSTREAM_AUTOCLOSE_BOOLEAN;
3965constexpr auto CREATE_TYPE_STRING =
3966 IMG_PROP_ANIMATION_ENCODER_CREATE_TYPE_STRING;
3968constexpr auto CREATE_QUALITY_NUMBER =
3969 IMG_PROP_ANIMATION_ENCODER_CREATE_QUALITY_NUMBER;
3971constexpr auto CREATE_TIMEBASE_NUMERATOR_NUMBER =
3972 IMG_PROP_ANIMATION_ENCODER_CREATE_TIMEBASE_NUMERATOR_NUMBER;
3974constexpr auto CREATE_TIMEBASE_DENOMINATOR_NUMBER =
3975 IMG_PROP_ANIMATION_ENCODER_CREATE_TIMEBASE_DENOMINATOR_NUMBER;
3977constexpr auto CREATE_AVIF_MAX_THREADS_NUMBER =
3978 IMG_PROP_ANIMATION_ENCODER_CREATE_AVIF_MAX_THREADS_NUMBER;
3980constexpr auto CREATE_AVIF_KEYFRAME_INTERVAL_NUMBER =
3981 IMG_PROP_ANIMATION_ENCODER_CREATE_AVIF_KEYFRAME_INTERVAL_NUMBER;
3983constexpr auto CREATE_GIF_USE_LUT_BOOLEAN =
3984 IMG_PROP_ANIMATION_ENCODER_CREATE_GIF_USE_LUT_BOOLEAN;
4010 CheckError(IMG_AddAnimationEncoderFrame(encoder, surface, duration));
4035 CheckError(IMG_CloseAnimationEncoder(encoder));
4048 IMG_DECODER_STATUS_INVALID;
4051 IMG_DECODER_STATUS_OK;
4055 IMG_DECODER_STATUS_FAILED;
4058 IMG_DECODER_STATUS_COMPLETE;
4338 CheckError(IMG_CreateAnimationDecoder_IO(src, closeio, type)))
4344 CheckError(IMG_CreateAnimationDecoderWithProperties(props)))
4378 bool closeio =
false)
4434constexpr auto CREATE_FILENAME_STRING =
4435 IMG_PROP_ANIMATION_DECODER_CREATE_FILENAME_STRING;
4437constexpr auto CREATE_IOSTREAM_POINTER =
4438 IMG_PROP_ANIMATION_DECODER_CREATE_IOSTREAM_POINTER;
4440constexpr auto CREATE_IOSTREAM_AUTOCLOSE_BOOLEAN =
4441 IMG_PROP_ANIMATION_DECODER_CREATE_IOSTREAM_AUTOCLOSE_BOOLEAN;
4443constexpr auto CREATE_TYPE_STRING =
4444 IMG_PROP_ANIMATION_DECODER_CREATE_TYPE_STRING;
4446constexpr auto CREATE_TIMEBASE_NUMERATOR_NUMBER =
4447 IMG_PROP_ANIMATION_DECODER_CREATE_TIMEBASE_NUMERATOR_NUMBER;
4449constexpr auto CREATE_TIMEBASE_DENOMINATOR_NUMBER =
4450 IMG_PROP_ANIMATION_DECODER_CREATE_TIMEBASE_DENOMINATOR_NUMBER;
4452constexpr auto CREATE_AVIF_MAX_THREADS_NUMBER =
4453 IMG_PROP_ANIMATION_DECODER_CREATE_AVIF_MAX_THREADS_NUMBER;
4455constexpr auto CREATE_AVIF_ALLOW_INCREMENTAL_BOOLEAN =
4456 IMG_PROP_ANIMATION_DECODER_CREATE_AVIF_ALLOW_INCREMENTAL_BOOLEAN;
4458constexpr auto CREATE_AVIF_ALLOW_PROGRESSIVE_BOOLEAN =
4459 IMG_PROP_ANIMATION_DECODER_CREATE_AVIF_ALLOW_PROGRESSIVE_BOOLEAN;
4461constexpr auto CREATE_GIF_TRANSPARENT_COLOR_INDEX_NUMBER =
4462 IMG_PROP_ANIMATION_DECODER_CREATE_GIF_TRANSPARENT_COLOR_INDEX_NUMBER;
4464constexpr auto CREATE_GIF_NUM_COLORS_NUMBER =
4465 IMG_PROP_ANIMATION_DECODER_CREATE_GIF_NUM_COLORS_NUMBER;
4488 return IMG_GetAnimationDecoderProperties(decoder);
4504constexpr auto IGNORE_PROPS_BOOLEAN = IMG_PROP_METADATA_IGNORE_PROPS_BOOLEAN;
4506constexpr auto DESCRIPTION_STRING = IMG_PROP_METADATA_DESCRIPTION_STRING;
4508constexpr auto COPYRIGHT_STRING = IMG_PROP_METADATA_COPYRIGHT_STRING;
4510constexpr auto TITLE_STRING = IMG_PROP_METADATA_TITLE_STRING;
4512constexpr auto AUTHOR_STRING = IMG_PROP_METADATA_AUTHOR_STRING;
4514constexpr auto CREATION_TIME_STRING = IMG_PROP_METADATA_CREATION_TIME_STRING;
4516constexpr auto FRAME_COUNT_NUMBER = IMG_PROP_METADATA_FRAME_COUNT_NUMBER;
4518constexpr auto LOOP_COUNT_NUMBER = IMG_PROP_METADATA_LOOP_COUNT_NUMBER;
4548 SDL_Surface* frame =
nullptr;
4549 CheckError(IMG_GetAnimationDecoderFrame(decoder, &frame, duration));
4572 return IMG_GetAnimationDecoderStatus(decoder);
4600 CheckError(IMG_ResetAnimationDecoder(decoder));
4622 CheckError(IMG_CloseAnimationDecoder(decoder));
4638 : Surface(
LoadBMP(std::move(file)))
An opaque handle representing a copy pass.
Definition SDL3pp_gpu.h:1743
An opaque handle representing a texture.
Definition SDL3pp_gpu.h:674
constexpr RawPointer get() const noexcept
Definition SDL3pp_resource.h:53
constexpr RawPointer release() noexcept
Definition SDL3pp_resource.h:56
constexpr ResourceBase(RawPointer resource)
Constructs from resource pointer.
Definition SDL3pp_resource.h:29
Const reference wrapper for a given resource,.
Definition SDL3pp_resource.h:111
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
ResourceRef< GPUDevice > GPUDeviceRef
Reference for GPUDevice.
Definition SDL3pp_gpu.h:386
void Close()
Close and free an allocated IOStream structure.
Definition SDL3pp_iostream.h:1944
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
ResourceRef< IOStream > IOStreamRef
Reference for IOStream.
Definition SDL3pp_iostream.h:34
ResourceRef< Properties > PropertiesRef
Reference for Properties.
Definition SDL3pp_properties.h:54
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:1551
Surface LoadJXL_IO(IOStreamRef src)
Load a JXL image directly.
Definition SDL3pp_image.h:1625
Surface ReadXPMFromArrayToRGB888(char **xpm)
Load an XPM image from a memory array.
Definition SDL3pp_image.h:2210
AnimationEncoder CreateAnimationEncoderWithProperties(PropertiesRef props)
Create an animation encoder with the specified properties.
Definition SDL3pp_image.h:3943
void Save(StringParam filename) const
Save an Surface into an image file.
Definition SDL3pp_image.h:2246
int GetWidth() const
Get the width in pixels.
Definition SDL3pp_image.h:3012
Animation LoadWEBPAnimation_IO(IOStreamRef src)
Load a WEBP animation directly.
Definition SDL3pp_image.h:3324
bool isPNG(IOStreamRef src)
Detect PNG image data on a readable/seekable IOStream.
Definition SDL3pp_image.h:1062
Surface LoadPNG_IO(IOStreamRef src)
Load a PNG image directly.
Definition SDL3pp_image.h:1736
AnimationDecoder CreateAnimationDecoderWithProperties(PropertiesRef props)
Create an animation decoder with the specified properties.
Definition SDL3pp_image.h:4421
Surface ReadXPMFromArray(char **xpm)
Load an XPM image from a memory array.
Definition SDL3pp_image.h:2192
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:3235
void SaveAnimation(AnimationRef anim, StringParam file)
Save an animation to a file.
Definition SDL3pp_image.h:3349
ResourceRef< AnimationDecoder > AnimationDecoderRef
Reference for AnimationDecoder.
Definition SDL3pp_image.h:73
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:3618
void AddFrame(SurfaceRef surface, Uint64 duration)
Add a frame to an animation encoder.
Definition SDL3pp_image.h:4013
void SaveCUR(SurfaceRef surface, StringParam file)
Save an Surface into a CUR image file.
Definition SDL3pp_image.h:2362
Surface LoadWEBP_IO(IOStreamRef src)
Load a WEBP image directly.
Definition SDL3pp_image.h:2062
bool isTIF(IOStreamRef src)
Detect TIFF image data on a readable/seekable IOStream.
Definition SDL3pp_image.h:1234
int GetHeight() const
Get the height in pixels.
Definition SDL3pp_image.h:3017
AnimationEncoder CreateAnimationEncoder(StringParam file)
Create an encoder to save a series of images to a file.
Definition SDL3pp_image.h:3839
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:3489
Surface LoadPNG(StringParam file)
Load a PNG image from a file.
Definition SDL3pp_image.h:1814
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:359
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:2282
ResourceConstRef< AnimationRaw, AnimationRawConst > AnimationConstRef
Safely wrap Animation for non owning const parameters.
Definition SDL3pp_image.h:45
void SaveWEBP(SurfaceRef surface, StringParam file, float quality)
Save an Surface into a WEBP image file.
Definition SDL3pp_image.h:2643
bool isWEBP(IOStreamRef src)
Detect WEBP image data on a readable/seekable IOStream.
Definition SDL3pp_image.h:1277
Surface LoadGIF_IO(IOStreamRef src)
Load a GIF image directly.
Definition SDL3pp_image.h:1514
Surface LoadXPM_IO(IOStreamRef src)
Load a XPM image directly.
Definition SDL3pp_image.h:2136
Cursor CreateCursor(const PointRaw &hotspot)
Create an animated cursor from an animation.
Definition SDL3pp_image.h:3593
Surface LoadTIF_IO(IOStreamRef src)
Load a TIFF image directly.
Definition SDL3pp_image.h:2025
bool isXPM(IOStreamRef src)
Detect XPM image data on a readable/seekable IOStream.
Definition SDL3pp_image.h:1363
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:2670
bool isPCX(IOStreamRef src)
Detect PCX image data on a readable/seekable IOStream.
Definition SDL3pp_image.h:1019
Surface GetAnimationFrame(AnimationConstRef anim, int index)
Return the frame image under given index.
Definition SDL3pp_image.h:3041
bool isJXL(IOStreamRef src)
Detect JXL image data on a readable/seekable IOStream.
Definition SDL3pp_image.h:933
int GetDelay(int index) const
Return the frame delay under given index.
Definition SDL3pp_image.h:3062
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:976
bool isICO(IOStreamRef src)
Detect ICO image data on a readable/seekable IOStream.
Definition SDL3pp_image.h:847
void AddAnimationEncoderFrame(AnimationEncoderRef encoder, SurfaceRef surface, Uint64 duration)
Add a frame to an animation encoder.
Definition SDL3pp_image.h:4006
void SaveANI_IO(IOStreamRef dst, bool closeio=false)
Save an animation in ANI format to an IOStream.
Definition SDL3pp_image.h:3428
Surface GetAnimationDecoderFrame(AnimationDecoderRef decoder, Uint64 *duration)
Get the next frame in an animation decoder.
Definition SDL3pp_image.h:4545
bool isPNM(IOStreamRef src)
Detect PNM image data on a readable/seekable IOStream.
Definition SDL3pp_image.h:1105
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:2339
IMG_AnimationDecoderStatus AnimationDecoderStatus
An enum representing the status of an animation decoder.
Definition SDL3pp_image.h:4045
int GetAnimationDelay(AnimationConstRef anim, int index)
Return the frame delay under given index.
Definition SDL3pp_image.h:3057
Surface LoadTGA_IO(IOStreamRef src)
Load a TGA image directly.
Definition SDL3pp_image.h:1988
void Close()
Close an animation encoder, finishing any encoding.
Definition SDL3pp_image.h:4038
void SaveAVIF(SurfaceRef surface, StringParam file, int quality)
Save an Surface into a AVIF image file.
Definition SDL3pp_image.h:2314
Surface GetFrame(Uint64 *duration)
Get the next frame in an animation decoder.
Definition SDL3pp_image.h:4553
Animation LoadAnimation(StringParam file)
Load an animation from a file.
Definition SDL3pp_image.h:3088
void Save(SurfaceConstRef surface, StringParam file)
Save an Surface into an image file.
Definition SDL3pp_image.h:2241
Surface LoadXCF_IO(IOStreamRef src)
Load a XCF image directly.
Definition SDL3pp_image.h:2099
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:2520
void SaveTGA_IO(SurfaceRef surface, IOStreamRef dst, bool closeio=false)
Save an Surface into TGA image data, via an IOStream.
Definition SDL3pp_image.h:2619
int GetAnimationCount(AnimationConstRef anim)
Return the number of frames.
Definition SDL3pp_image.h:3031
Surface GetClipboardImage()
Load an image from an SDL data source into a GPU texture.
Definition SDL3pp_image.h:587
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:2290
void SaveJPG(SurfaceRef surface, StringParam file, int quality)
Save an Surface into a JPEG image file.
Definition SDL3pp_image.h:2495
bool isJPG(IOStreamRef src)
Detect JPG image data on a readable/seekable IOStream.
Definition SDL3pp_image.h:890
Cursor CreateAnimatedCursor(AnimationRef anim, const PointRaw &hotspot)
Create an animated cursor from an animation.
Definition SDL3pp_image.h:3587
void SaveICO_IO(SurfaceRef surface, IOStreamRef dst, bool closeio=false)
Save an Surface into ICO image data, via an IOStream.
Definition SDL3pp_image.h:2471
void CloseAnimationDecoder(AnimationDecoderRaw decoder)
Close an animation decoder, finishing any decoding.
Definition SDL3pp_image.h:4620
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:3890
IMG_Animation * AnimationRaw
Alias to raw representation for Animation.
Definition SDL3pp_image.h:32
Surface LoadLBM_IO(IOStreamRef src)
Load a LBM image directly.
Definition SDL3pp_image.h:1662
IMG_AnimationDecoder * AnimationDecoderRaw
Alias to raw representation for AnimationDecoder.
Definition SDL3pp_image.h:66
Surface LoadCUR_IO(IOStreamRef src)
Load a CUR image directly.
Definition SDL3pp_image.h:1477
bool isXCF(IOStreamRef src)
Detect XCF image data on a readable/seekable IOStream.
Definition SDL3pp_image.h:1320
void ResetAnimationDecoder(AnimationDecoderRef decoder)
Reset an animation decoder.
Definition SDL3pp_image.h:4598
void SavePNG_IO(SurfaceRef surface, IOStreamRef dst, bool closeio=false)
Save an Surface into PNG image data, via an IOStream.
Definition SDL3pp_image.h:2569
void Free()
Dispose of an Animation and free its resources.
Definition SDL3pp_image.h:3620
ResourceRef< AnimationEncoder > AnimationEncoderRef
Reference for AnimationEncoder.
Definition SDL3pp_image.h:60
void SaveGIF(SurfaceRef surface, StringParam file)
Save an Surface into a GIF image file.
Definition SDL3pp_image.h:2405
void SaveGIF_IO(IOStreamRef dst, bool closeio=false)
Save an animation in GIF format to an IOStream.
Definition SDL3pp_image.h:3530
void SaveICO(SurfaceRef surface, StringParam file)
Save an Surface into a ICO image file.
Definition SDL3pp_image.h:2448
bool isANI(IOStreamRef src)
Detect ANI animated cursor data on a readable/seekable IOStream.
Definition SDL3pp_image.h:630
void SaveTGA(SurfaceRef surface, StringParam file)
Save an Surface into a TGA image file.
Definition SDL3pp_image.h:2596
bool isSVG(IOStreamRef src)
Detect SVG image data on a readable/seekable IOStream.
Definition SDL3pp_image.h:1191
PropertiesRef GetAnimationDecoderProperties(AnimationDecoderRef decoder)
Get the properties of an animation decoder.
Definition SDL3pp_image.h:4486
Surface LoadXV_IO(IOStreamRef src)
Load a XV image directly.
Definition SDL3pp_image.h:2173
void SaveWEBP_IO(IOStreamRef dst, int quality, bool closeio=false)
Save an animation in WEBP format to an IOStream.
Definition SDL3pp_image.h:3568
Surface GetFrame(int index) const
Return the frame image under given index.
Definition SDL3pp_image.h:3046
void Close()
Close an animation decoder, finishing any decoding.
Definition SDL3pp_image.h:4625
Surface LoadSVG_IO(IOStreamRef src)
Load a SVG image directly.
Definition SDL3pp_image.h:1889
void SavePNG(SurfaceRef surface, StringParam file)
Save an Surface into a PNG image file.
Definition SDL3pp_image.h:2541
bool isBMP(IOStreamRef src)
Detect BMP image data on a readable/seekable IOStream.
Definition SDL3pp_image.h:761
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:3560
Surface LoadPCX_IO(IOStreamRef src)
Load a PCX image directly.
Definition SDL3pp_image.h:1699
const IMG_Animation * AnimationRawConst
Alias to const raw representation for Animation.
Definition SDL3pp_image.h:35
ResourceRef< Animation > AnimationRef
Reference for Animation.
Definition SDL3pp_image.h:42
void SaveCUR_IO(SurfaceRef surface, IOStreamRef dst, bool closeio=false)
Save an Surface into CUR image data, via an IOStream.
Definition SDL3pp_image.h:2385
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:270
Surface LoadPNM_IO(IOStreamRef src)
Load a PNM image directly.
Definition SDL3pp_image.h:1851
void SavePNG(StringParam file) const
Save a surface to a file in PNG format.
Definition SDL3pp_image.h:2546
AnimationDecoderStatus GetAnimationDecoderStatus(AnimationDecoderRef decoder)
Get the decoder status indicating the current state of the decoder.
Definition SDL3pp_image.h:4569
void SaveANIAnimation_IO(AnimationRef anim, IOStreamRef dst, bool closeio=false)
Save an animation in ANI format to an IOStream.
Definition SDL3pp_image.h:3421
void SaveAnimationTyped_IO(AnimationRef anim, IOStreamRef dst, StringParam type, bool closeio=false)
Save an animation to an IOStream.
Definition SDL3pp_image.h:3385
Surface LoadAVIF_IO(IOStreamRef src)
Load a AVIF image directly.
Definition SDL3pp_image.h:1440
constexpr AnimationDecoderStatus DECODER_STATUS_OK
The decoder is ready to decode the next frame.
Definition SDL3pp_image.h:4050
bool isXV(IOStreamRef src)
Detect XV image data on a readable/seekable IOStream.
Definition SDL3pp_image.h:1406
Texture LoadTexture(RendererRef renderer, StringParam file)
Load an image from a filesystem path into a texture.
Definition SDL3pp_image.h:305
void SaveGIF_IO(SurfaceRef surface, IOStreamRef dst, bool closeio=false)
Save an Surface into GIF image data, via an IOStream.
Definition SDL3pp_image.h:2428
Surface LoadSurface_IO(IOStreamRef src, bool closeio=false)
Load an image from an SDL data source into a software surface.
Definition SDL3pp_image.h:212
int GetAnimationWidth(AnimationConstRef anim)
Get the width in pixels.
Definition SDL3pp_image.h:3010
constexpr AnimationDecoderStatus DECODER_STATUS_COMPLETE
No more frames available.
Definition SDL3pp_image.h:4057
bool isQOI(IOStreamRef src)
Detect QOI image data on a readable/seekable IOStream.
Definition SDL3pp_image.h:1148
constexpr AnimationDecoderStatus DECODER_STATUS_FAILED
The decoder failed to decode a frame, call GetError() for more information.
Definition SDL3pp_image.h:4054
Animation LoadANIAnimation_IO(IOStreamRef src)
Load an ANI animation directly from an IOStream.
Definition SDL3pp_image.h:3204
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:4376
int GetCount() const
Return the number of frames.
Definition SDL3pp_image.h:3033
Animation LoadAVIFAnimation_IO(IOStreamRef src)
Load an AVIF animation directly from an IOStream.
Definition SDL3pp_image.h:3266
void Reset()
Reset an animation decoder.
Definition SDL3pp_image.h:4603
AnimationDecoderStatus GetStatus()
Get the decoder status indicating the current state of the decoder.
Definition SDL3pp_image.h:4575
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:2576
void SaveTyped_IO(IOStreamRef dst, StringParam type, bool closeio=false)
Save an animation to an IOStream.
Definition SDL3pp_image.h:3393
Animation LoadAnimationTyped_IO(IOStreamRef src, StringParam type, bool closeio=false)
Load an animation from an IOStream.
Definition SDL3pp_image.h:3169
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:413
bool isAVIF(IOStreamRef src)
Detect AVIF image data on a readable/seekable IOStream.
Definition SDL3pp_image.h:675
Surface LoadQOI_IO(IOStreamRef src)
Load a QOI image directly.
Definition SDL3pp_image.h:1951
Surface LoadSizedSVG_IO(IOStreamRef src, const PointRaw &size)
Load an SVG image, scaled to a specific size.
Definition SDL3pp_image.h:1914
Surface LoadJPG_IO(IOStreamRef src)
Load a JPG image directly.
Definition SDL3pp_image.h:1588
bool isGIF(IOStreamRef src)
Detect GIF image data on a readable/seekable IOStream.
Definition SDL3pp_image.h:804
void SaveGIFAnimation_IO(AnimationRef anim, IOStreamRef dst, bool closeio=false)
Save an animation in GIF format to an IOStream.
Definition SDL3pp_image.h:3523
constexpr AnimationDecoderStatus DECODER_STATUS_INVALID
The decoder is invalid.
Definition SDL3pp_image.h:4047
void SaveAPNGAnimation_IO(AnimationRef anim, IOStreamRef dst, bool closeio=false)
Save an animation in APNG format to an IOStream.
Definition SDL3pp_image.h:3454
void SaveAVIF_IO(IOStreamRef dst, int quality, bool closeio=false)
Save an animation in AVIF format to an IOStream.
Definition SDL3pp_image.h:3497
bool isCUR(IOStreamRef src)
Detect CUR image data on a readable/seekable IOStream.
Definition SDL3pp_image.h:718
PropertiesRef GetProperties()
Get the properties of an animation decoder.
Definition SDL3pp_image.h:4491
Surface LoadSurface(StringParam file)
Load an image from a filesystem path into a software surface.
Definition SDL3pp_image.h:155
AnimationDecoder CreateAnimationDecoder(StringParam file)
Create a decoder to read a series of images from a file.
Definition SDL3pp_image.h:4324
Animation LoadGIFAnimation_IO(IOStreamRef src)
Load a GIF animation directly.
Definition SDL3pp_image.h:3296
void SaveAPNG_IO(IOStreamRef dst, bool closeio=false)
Save an animation in APNG format to an IOStream.
Definition SDL3pp_image.h:3461
void CloseAnimationEncoder(AnimationEncoderRaw encoder)
Close an animation encoder, finishing any encoding.
Definition SDL3pp_image.h:4033
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:454
IMG_AnimationEncoder * AnimationEncoderRaw
Alias to raw representation for AnimationEncoder.
Definition SDL3pp_image.h:53
void Save(StringParam file)
Save an animation to a file.
Definition SDL3pp_image.h:3354
Point GetSize() const
Get the size in pixels.
Definition SDL3pp_image.h:3028
::Uint64 Uint64
An unsigned 64-bit integer type.
Definition SDL3pp_stdinc.h:320
Surface LoadBMP_IO(IOStreamRef src, bool closeio=false)
Load a BMP image from a seekable SDL data stream.
Definition SDL3pp_surface.h:2695
Surface LoadBMP(StringParam file)
Load a BMP image from a file.
Definition SDL3pp_surface.h:2718
ResourceConstRef< SurfaceRaw, SurfaceRawConst > SurfaceConstRef
Safely wrap Surface for non owning const parameters.
Definition SDL3pp_surface.h:57
ResourceRef< Surface > SurfaceRef
Reference for Surface.
Definition SDL3pp_surface.h:54
ResourceRef< Renderer > RendererRef
Reference for Renderer.
Definition SDL3pp_video.h:75
Supported properties for creating an animation decoder.
Definition SDL3pp_image.h:4432
Supported properties for creating an animation encoder.
Definition SDL3pp_image.h:3954
Main include header for the SDL3pp library.
An object representing animation decoder.
Definition SDL3pp_image.h:4066
constexpr AnimationDecoder & operator=(AnimationDecoder &&other) noexcept
Assignment operator.
Definition SDL3pp_image.h:4198
constexpr AnimationDecoder(const AnimationDecoder &other)=delete
Copy constructor.
constexpr ResourceBase(RawPointer resource)
Constructs from resource pointer.
Definition SDL3pp_resource.h:29
AnimationDecoder & operator=(const AnimationDecoder &other)=delete
Assignment operator.
constexpr AnimationDecoder(AnimationDecoderRaw resource) noexcept
Constructs from raw AnimationDecoder.
Definition SDL3pp_image.h:4076
~AnimationDecoder()
Destructor.
Definition SDL3pp_image.h:4195
constexpr AnimationDecoder(AnimationDecoder &&other) noexcept
Move constructor.
Definition SDL3pp_image.h:4085
An object representing the encoder context.
Definition SDL3pp_image.h:3630
constexpr AnimationEncoder(const AnimationEncoder &other)=delete
Copy constructor.
constexpr AnimationEncoder & operator=(AnimationEncoder &&other) noexcept
Assignment operator.
Definition SDL3pp_image.h:3769
constexpr ResourceBase(RawPointer resource)
Constructs from resource pointer.
Definition SDL3pp_resource.h:29
~AnimationEncoder()
Destructor.
Definition SDL3pp_image.h:3766
constexpr AnimationEncoder(AnimationEncoder &&other) noexcept
Move constructor.
Definition SDL3pp_image.h:3649
AnimationEncoder & operator=(const AnimationEncoder &other)=delete
Assignment operator.
constexpr AnimationEncoder(AnimationEncoderRaw resource) noexcept
Constructs from raw AnimationEncoder.
Definition SDL3pp_image.h:3640
Animated image support.
Definition SDL3pp_image.h:2686
constexpr Animation(Animation &&other) noexcept
Move constructor.
Definition SDL3pp_image.h:2705
~Animation()
Destructor.
Definition SDL3pp_image.h:2770
constexpr ResourceBase(RawPointer resource)
Constructs from resource pointer.
Definition SDL3pp_resource.h:29
Animation & operator=(const Animation &other)=delete
Assignment operator.
constexpr Animation & operator=(Animation &&other) noexcept
Assignment operator.
Definition SDL3pp_image.h:2773
constexpr Animation(const Animation &other)=delete
Copy constructor.
constexpr Animation(AnimationRaw resource) noexcept
Constructs from raw Animation.
Definition SDL3pp_image.h:2696
The structure used to identify an SDL cursor.
Definition SDL3pp_mouse.h:159
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:156
A collection of pixels used in software blitting.
Definition SDL3pp_surface.h:172
constexpr Surface(SurfaceRaw resource) noexcept
Constructs from raw Surface.
Definition SDL3pp_surface.h:182
static Surface Borrow(SurfaceRaw resource)
Safely borrows the from SurfaceRaw.
Definition SDL3pp_surface.h:340
An efficient driver-specific representation of pixel data.
Definition SDL3pp_render.h:2249
constexpr Texture(TextureRaw resource) noexcept
Constructs from raw Texture.
Definition SDL3pp_render.h:2259