|
SDL3pp
A slim C++ wrapper for SDL3
|
Header file for SDL_image library. More...
Namespaces | |
| namespace | SDL::prop |
| Constants for Properties keys. | |
| namespace | SDL::prop::AnimationEncoder |
| Supported properties for creating an animation encoder. | |
| namespace | SDL::prop::AnimationDecoder |
| Supported properties for creating an animation decoder. | |
| namespace | SDL::prop::Metadata |
| Animation metadata properties. | |
Classes | |
| struct | SDL::Animation |
| Animated image support. More... | |
| struct | SDL::AnimationEncoder |
| An object representing the encoder context. More... | |
| struct | SDL::AnimationDecoder |
| An object representing animation decoder. More... | |
Macros | |
| #define | SDL_IMAGE_VERSION |
| This is the version number macro for the current SDL_image version. | |
| #define | SDL_IMAGE_VERSION_ATLEAST(X, Y, Z) |
| This macro will evaluate to true if compiled with SDL_image at least X.Y.Z. | |
Typedefs | |
| using | SDL::AnimationRaw = IMG_Animation* |
| Alias to raw representation for Animation. | |
| using | SDL::AnimationRawConst = const IMG_Animation* |
| Alias to const raw representation for Animation. | |
| using | SDL::AnimationRef = ResourceRef<Animation> |
| Reference for Animation. | |
| using | SDL::AnimationConstRef = ResourceConstRef<AnimationRaw, AnimationRawConst> |
| Safely wrap Animation for non owning const parameters. | |
| using | SDL::AnimationEncoderRaw = IMG_AnimationEncoder* |
| Alias to raw representation for AnimationEncoder. | |
| using | SDL::AnimationEncoderRef = ResourceRef<AnimationEncoder> |
| Reference for AnimationEncoder. | |
| using | SDL::AnimationDecoderRaw = IMG_AnimationDecoder* |
| Alias to raw representation for AnimationDecoder. | |
| using | SDL::AnimationDecoderRef = ResourceRef<AnimationDecoder> |
| Reference for AnimationDecoder. | |
| using | SDL::AnimationDecoderStatus = IMG_AnimationDecoderStatus |
| An enum representing the status of an animation decoder. | |
Functions | |
| Surface | SDL::LoadSurface (StringParam file) |
| Load an image from a filesystem path into a software surface. | |
| Surface | SDL::LoadSurface_IO (IOStreamRef src, bool closeio=false) |
| Load an image from an SDL data source into a software surface. | |
| Surface | SDL::LoadSurfaceTyped_IO (IOStreamRef src, StringParam type, bool closeio=false) |
| Load an image from an SDL data source into a software surface. | |
| Texture | SDL::LoadTexture (RendererRef renderer, StringParam file) |
| Load an image from a filesystem path into a texture. | |
| Texture | SDL::LoadTexture_IO (RendererRef renderer, IOStreamRef src, bool closeio=false) |
| Load an image from an SDL data source into a texture. | |
| Texture | SDL::LoadTextureTyped_IO (RendererRef renderer, IOStreamRef src, StringParam type, bool closeio=false) |
| Load an image from an SDL data source into a texture. | |
| GPUTexture | SDL::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. | |
| Surface | SDL::GetClipboardImage () |
| Load an image from an SDL data source into a GPU texture. | |
| bool | SDL::isANI (IOStreamRef src) |
| Detect ANI animated cursor data on a readable/seekable IOStream. | |
| bool | SDL::isAVIF (IOStreamRef src) |
| Detect AVIF image data on a readable/seekable IOStream. | |
| bool | SDL::isCUR (IOStreamRef src) |
| Detect CUR image data on a readable/seekable IOStream. | |
| bool | SDL::isBMP (IOStreamRef src) |
| Detect BMP image data on a readable/seekable IOStream. | |
| bool | SDL::isGIF (IOStreamRef src) |
| Detect GIF image data on a readable/seekable IOStream. | |
| bool | SDL::isICO (IOStreamRef src) |
| Detect ICO image data on a readable/seekable IOStream. | |
| bool | SDL::isJPG (IOStreamRef src) |
| Detect JPG image data on a readable/seekable IOStream. | |
| bool | SDL::isJXL (IOStreamRef src) |
| Detect JXL image data on a readable/seekable IOStream. | |
| bool | SDL::isLBM (IOStreamRef src) |
| Detect LBM image data on a readable/seekable IOStream. | |
| bool | SDL::isPCX (IOStreamRef src) |
| Detect PCX image data on a readable/seekable IOStream. | |
| bool | SDL::isPNG (IOStreamRef src) |
| Detect PNG image data on a readable/seekable IOStream. | |
| bool | SDL::isPNM (IOStreamRef src) |
| Detect PNM image data on a readable/seekable IOStream. | |
| bool | SDL::isQOI (IOStreamRef src) |
| Detect QOI image data on a readable/seekable IOStream. | |
| bool | SDL::isSVG (IOStreamRef src) |
| Detect SVG image data on a readable/seekable IOStream. | |
| bool | SDL::isTIF (IOStreamRef src) |
| Detect TIFF image data on a readable/seekable IOStream. | |
| bool | SDL::isWEBP (IOStreamRef src) |
| Detect WEBP image data on a readable/seekable IOStream. | |
| bool | SDL::isXCF (IOStreamRef src) |
| Detect XCF image data on a readable/seekable IOStream. | |
| bool | SDL::isXPM (IOStreamRef src) |
| Detect XPM image data on a readable/seekable IOStream. | |
| bool | SDL::isXV (IOStreamRef src) |
| Detect XV image data on a readable/seekable IOStream. | |
| Surface | SDL::LoadAVIF_IO (IOStreamRef src) |
| Load a AVIF image directly. | |
| Surface | SDL::LoadCUR_IO (IOStreamRef src) |
| Load a CUR image directly. | |
| Surface | SDL::LoadGIF_IO (IOStreamRef src) |
| Load a GIF image directly. | |
| Surface | SDL::LoadICO_IO (IOStreamRef src) |
| Load a ICO image directly. | |
| Surface | SDL::LoadJPG_IO (IOStreamRef src) |
| Load a JPG image directly. | |
| Surface | SDL::LoadJXL_IO (IOStreamRef src) |
| Load a JXL image directly. | |
| Surface | SDL::LoadLBM_IO (IOStreamRef src) |
| Load a LBM image directly. | |
| Surface | SDL::LoadPCX_IO (IOStreamRef src) |
| Load a PCX image directly. | |
| Surface | SDL::LoadPNG_IO (IOStreamRef src) |
| Load a PNG image directly. | |
| Surface | SDL::LoadPNG_IO (IOStreamRef src, bool closeio) |
| Load a PNG image directly. | |
| Surface | SDL::LoadPNG (StringParam file) |
| Load a PNG image from a file. | |
| Surface | SDL::LoadPNM_IO (IOStreamRef src) |
| Load a PNM image directly. | |
| Surface | SDL::LoadSVG_IO (IOStreamRef src) |
| Load a SVG image directly. | |
| Surface | SDL::LoadSizedSVG_IO (IOStreamRef src, const PointRaw &size) |
| Load an SVG image, scaled to a specific size. | |
| Surface | SDL::LoadQOI_IO (IOStreamRef src) |
| Load a QOI image directly. | |
| Surface | SDL::LoadTGA_IO (IOStreamRef src) |
| Load a TGA image directly. | |
| Surface | SDL::LoadTIF_IO (IOStreamRef src) |
| Load a TIFF image directly. | |
| Surface | SDL::LoadWEBP_IO (IOStreamRef src) |
| Load a WEBP image directly. | |
| Surface | SDL::LoadXCF_IO (IOStreamRef src) |
| Load a XCF image directly. | |
| Surface | SDL::LoadXPM_IO (IOStreamRef src) |
| Load a XPM image directly. | |
| Surface | SDL::LoadXV_IO (IOStreamRef src) |
| Load a XV image directly. | |
| Surface | SDL::ReadXPMFromArray (char **xpm) |
| Load an XPM image from a memory array. | |
| Surface | SDL::ReadXPMFromArrayToRGB888 (char **xpm) |
| Load an XPM image from a memory array. | |
| void | SDL::Save (SurfaceConstRef surface, StringParam file) |
| Save an Surface into an image file. | |
| void | SDL::SaveTyped_IO (SurfaceConstRef surface, IOStreamRef dst, StringParam type, bool closeio=false) |
| Save an Surface into formatted image data, via an IOStream. | |
| void | SDL::SaveAVIF (SurfaceRef surface, StringParam file, int quality) |
| Save an Surface into a AVIF image file. | |
| void | SDL::SaveAVIF_IO (SurfaceRef surface, IOStreamRef dst, int quality, bool closeio=false) |
| Save an Surface into AVIF image data, via an IOStream. | |
| void | SDL::SaveCUR (SurfaceRef surface, StringParam file) |
| Save an Surface into a CUR image file. | |
| void | SDL::SaveCUR_IO (SurfaceRef surface, IOStreamRef dst, bool closeio=false) |
| Save an Surface into CUR image data, via an IOStream. | |
| void | SDL::SaveGIF (SurfaceRef surface, StringParam file) |
| Save an Surface into a GIF image file. | |
| void | SDL::SaveGIF_IO (SurfaceRef surface, IOStreamRef dst, bool closeio=false) |
| Save an Surface into GIF image data, via an IOStream. | |
| void | SDL::SaveICO (SurfaceRef surface, StringParam file) |
| Save an Surface into a ICO image file. | |
| void | SDL::SaveICO_IO (SurfaceRef surface, IOStreamRef dst, bool closeio=false) |
| Save an Surface into ICO image data, via an IOStream. | |
| void | SDL::SaveJPG (SurfaceRef surface, StringParam file, int quality) |
| Save an Surface into a JPEG image file. | |
| void | SDL::SaveJPG_IO (SurfaceRef surface, IOStreamRef dst, int quality, bool closeio=false) |
| Save an Surface into JPEG image data, via an IOStream. | |
| void | SDL::SavePNG (SurfaceRef surface, StringParam file) |
| Save an Surface into a PNG image file. | |
| void | SDL::SavePNG_IO (SurfaceRef surface, IOStreamRef dst, bool closeio=false) |
| Save an Surface into PNG image data, via an IOStream. | |
| void | SDL::SaveTGA (SurfaceRef surface, StringParam file) |
| Save an Surface into a TGA image file. | |
| void | SDL::SaveTGA_IO (SurfaceRef surface, IOStreamRef dst, bool closeio=false) |
| Save an Surface into TGA image data, via an IOStream. | |
| void | SDL::SaveWEBP (SurfaceRef surface, StringParam file, float quality) |
| Save an Surface into a WEBP image file. | |
| void | SDL::SaveWEBP_IO (SurfaceRef surface, IOStreamRef dst, float quality, bool closeio=false) |
| Save an Surface into WEBP image data, via an IOStream. | |
| int | SDL::GetAnimationWidth (AnimationConstRef anim) |
| Get the width in pixels. | |
| int | SDL::GetAnimationHeight (AnimationConstRef anim) |
| Get the height in pixels. | |
| Point | SDL::GetAnimationSize (AnimationConstRef anim) |
| Get the size in pixels. | |
| int | SDL::GetAnimationCount (AnimationConstRef anim) |
| Return the number of frames. | |
| Surface | SDL::GetAnimationFrame (AnimationConstRef anim, int index) |
| Return the frame image under given index. | |
| int | SDL::GetAnimationDelay (AnimationConstRef anim, int index) |
| Return the frame delay under given index. | |
| Animation | SDL::LoadAnimation (StringParam file) |
| Load an animation from a file. | |
| Animation | SDL::LoadAnimation_IO (IOStreamRef src, bool closeio=false) |
| Load an animation from an IOStream. | |
| Animation | SDL::LoadAnimationTyped_IO (IOStreamRef src, StringParam type, bool closeio=false) |
| Load an animation from an IOStream. | |
| Animation | SDL::LoadANIAnimation_IO (IOStreamRef src) |
| Load an ANI animation directly from an IOStream. | |
| Animation | SDL::LoadAPNGAnimation_IO (IOStreamRef src) |
| Load an APNG animation directly from an IOStream. | |
| Animation | SDL::LoadAVIFAnimation_IO (IOStreamRef src) |
| Load an AVIF animation directly from an IOStream. | |
| Animation | SDL::LoadGIFAnimation_IO (IOStreamRef src) |
| Load a GIF animation directly. | |
| Animation | SDL::LoadWEBPAnimation_IO (IOStreamRef src) |
| Load a WEBP animation directly. | |
| void | SDL::SaveAnimation (AnimationRef anim, StringParam file) |
| Save an animation to a file. | |
| void | SDL::SaveAnimationTyped_IO (AnimationRef anim, IOStreamRef dst, StringParam type, bool closeio=false) |
| Save an animation to an IOStream. | |
| void | SDL::SaveANIAnimation_IO (AnimationRef anim, IOStreamRef dst, bool closeio=false) |
| Save an animation in ANI format to an IOStream. | |
| void | SDL::SaveAPNGAnimation_IO (AnimationRef anim, IOStreamRef dst, bool closeio=false) |
| Save an animation in APNG format to an IOStream. | |
| void | SDL::SaveAVIFAnimation_IO (AnimationRef anim, IOStreamRef dst, int quality, bool closeio=false) |
| Save an animation in AVIF format to an IOStream. | |
| void | SDL::SaveGIFAnimation_IO (AnimationRef anim, IOStreamRef dst, bool closeio=false) |
| Save an animation in GIF format to an IOStream. | |
| void | SDL::SaveWEBPAnimation_IO (AnimationRef anim, IOStreamRef dst, int quality, bool closeio=false) |
| Save an animation in WEBP format to an IOStream. | |
| Cursor | SDL::CreateAnimatedCursor (AnimationRef anim, const PointRaw &hotspot) |
| Create an animated cursor from an animation. | |
| void | SDL::FreeAnimation (AnimationRaw anim) |
| Dispose of an Animation and free its resources. | |
| AnimationEncoder | SDL::CreateAnimationEncoder (StringParam file) |
| Create an encoder to save a series of images to a file. | |
| AnimationEncoder | SDL::CreateAnimationEncoder_IO (IOStreamRef dst, StringParam type, bool closeio=false) |
| Create an encoder to save a series of images to an IOStream. | |
| AnimationEncoder | SDL::CreateAnimationEncoderWithProperties (PropertiesRef props) |
| Create an animation encoder with the specified properties. | |
| void | SDL::AddAnimationEncoderFrame (AnimationEncoderRef encoder, SurfaceRef surface, Uint64 duration) |
| Add a frame to an animation encoder. | |
| void | SDL::CloseAnimationEncoder (AnimationEncoderRaw encoder) |
| Close an animation encoder, finishing any encoding. | |
| AnimationDecoder | SDL::CreateAnimationDecoder (StringParam file) |
| Create a decoder to read a series of images from a file. | |
| AnimationDecoder | SDL::CreateAnimationDecoder_IO (IOStreamRef src, StringParam type, bool closeio=false) |
| Create a decoder to read a series of images from an IOStream. | |
| AnimationDecoder | SDL::CreateAnimationDecoderWithProperties (PropertiesRef props) |
| Create an animation decoder with the specified properties. | |
| PropertiesRef | SDL::GetAnimationDecoderProperties (AnimationDecoderRef decoder) |
| Get the properties of an animation decoder. | |
| Surface | SDL::GetAnimationDecoderFrame (AnimationDecoderRef decoder, Uint64 *duration) |
| Get the next frame in an animation decoder. | |
| AnimationDecoderStatus | SDL::GetAnimationDecoderStatus (AnimationDecoderRef decoder) |
| Get the decoder status indicating the current state of the decoder. | |
| void | SDL::ResetAnimationDecoder (AnimationDecoderRef decoder) |
| Reset an animation decoder. | |
| void | SDL::CloseAnimationDecoder (AnimationDecoderRaw decoder) |
| Close an animation decoder, finishing any decoding. | |
| SDL::Surface::Surface (StringParam file) | |
| Load an image from a filesystem path into a software surface. | |
| SDL::Surface::Surface (IOStreamRef src, bool closeio=false) | |
| Load an image from an SDL data source into a software surface. | |
| SDL::Texture::Texture (RendererRef renderer, StringParam file) | |
| Load an image from a filesystem path into a texture. | |
| SDL::Texture::Texture (RendererRef renderer, IOStreamRef src, bool closeio=false) | |
| Load an image from an SDL data source into a texture. | |
| void | SDL::Surface::Save (StringParam filename) const |
| Save an Surface into an image file. | |
| void | SDL::Surface::SaveTyped_IO (IOStreamRef dst, StringParam type, bool closeio=false) const |
| Save an Surface into formatted image data, via an IOStream. | |
| void | SDL::Surface::SavePNG (StringParam file) const |
| Save a surface to a file in PNG format. | |
| void | SDL::Surface::SavePNG_IO (IOStreamRef dst, bool closeio=false) const |
| Save a surface to a seekable SDL data stream in PNG format. | |
| int | SDL::Animation::GetWidth () const |
| Get the width in pixels. | |
| int | SDL::Animation::GetHeight () const |
| Get the height in pixels. | |
| Point | SDL::Animation::GetSize () const |
| Get the size in pixels. | |
| int | SDL::Animation::GetCount () const |
| Return the number of frames. | |
| Surface | SDL::Animation::GetFrame (int index) const |
| Return the frame image under given index. | |
| int | SDL::Animation::GetDelay (int index) const |
| Return the frame delay under given index. | |
| SDL::Animation::Animation (StringParam file) | |
| Load an animation from a file. | |
| SDL::Animation::Animation (IOStreamRef src, bool closeio=false) | |
| Load an animation from an IOStream. | |
| void | SDL::Animation::Save (StringParam file) |
| Save an animation to a file. | |
| void | SDL::Animation::SaveTyped_IO (IOStreamRef dst, StringParam type, bool closeio=false) |
| Save an animation to an IOStream. | |
| void | SDL::Animation::SaveANI_IO (IOStreamRef dst, bool closeio=false) |
| Save an animation in ANI format to an IOStream. | |
| void | SDL::Animation::SaveAPNG_IO (IOStreamRef dst, bool closeio=false) |
| Save an animation in APNG format to an IOStream. | |
| void | SDL::Animation::SaveAVIF_IO (IOStreamRef dst, int quality, bool closeio=false) |
| Save an animation in AVIF format to an IOStream. | |
| void | SDL::Animation::SaveGIF_IO (IOStreamRef dst, bool closeio=false) |
| Save an animation in GIF format to an IOStream. | |
| void | SDL::Animation::SaveWEBP_IO (IOStreamRef dst, int quality, bool closeio=false) |
| Save an animation in WEBP format to an IOStream. | |
| Cursor | SDL::Animation::CreateCursor (const PointRaw &hotspot) |
| Create an animated cursor from an animation. | |
| void | SDL::Animation::Free () |
| Dispose of an Animation and free its resources. | |
| SDL::AnimationEncoder::AnimationEncoder (StringParam file) | |
| Create an encoder to save a series of images to a file. | |
| SDL::AnimationEncoder::AnimationEncoder (IOStreamRef dst, StringParam type, bool closeio=false) | |
| Create an encoder to save a series of images to an IOStream. | |
| SDL::AnimationEncoder::AnimationEncoder (PropertiesRef props) | |
| Create an animation encoder with the specified properties. | |
| void | SDL::AnimationEncoder::AddFrame (SurfaceRef surface, Uint64 duration) |
| Add a frame to an animation encoder. | |
| void | SDL::AnimationEncoder::Close () |
| Close an animation encoder, finishing any encoding. | |
| SDL::AnimationDecoder::AnimationDecoder (StringParam file) | |
| Create a decoder to read a series of images from a file. | |
| SDL::AnimationDecoder::AnimationDecoder (IOStreamRef src, StringParam type, bool closeio=false) | |
| Create a decoder to read a series of images from an IOStream. | |
| SDL::AnimationDecoder::AnimationDecoder (PropertiesRef props) | |
| Create an animation decoder with the specified properties. | |
| PropertiesRef | SDL::AnimationDecoder::GetProperties () |
| Get the properties of an animation decoder. | |
| Surface | SDL::AnimationDecoder::GetFrame (Uint64 *duration) |
| Get the next frame in an animation decoder. | |
| AnimationDecoderStatus | SDL::AnimationDecoder::GetStatus () |
| Get the decoder status indicating the current state of the decoder. | |
| void | SDL::AnimationDecoder::Reset () |
| Reset an animation decoder. | |
| void | SDL::AnimationDecoder::Close () |
| Close an animation decoder, finishing any decoding. | |
Variables | |
| constexpr AnimationDecoderStatus | SDL::DECODER_STATUS_INVALID |
| The decoder is invalid. | |
| constexpr AnimationDecoderStatus | SDL::DECODER_STATUS_OK |
| The decoder is ready to decode the next frame. | |
| constexpr AnimationDecoderStatus | SDL::DECODER_STATUS_FAILED |
| The decoder failed to decode a frame, call GetError() for more information. | |
| constexpr AnimationDecoderStatus | SDL::DECODER_STATUS_COMPLETE |
| No more frames available. | |
Header file for SDL_image library.
A simple library to load images of various formats as SDL surfaces
| #define SDL_IMAGE_VERSION |
This is the version number macro for the current SDL_image version.
| #define SDL_IMAGE_VERSION_ATLEAST | ( | X, | |
| Y, | |||
| Z ) |
This macro will evaluate to true if compiled with SDL_image at least X.Y.Z.
Reference for AnimationDecoder.
This does not take ownership!
| using SDL::AnimationDecoderStatus = IMG_AnimationDecoderStatus |
An enum representing the status of an animation decoder.
Reference for AnimationEncoder.
This does not take ownership!
| using SDL::AnimationRef = ResourceRef<Animation> |
Reference for Animation.
This does not take ownership!
|
inline |
Add a frame to an animation encoder.
| encoder | the receiving images. |
| surface | the surface to add as the next frame in the animation. |
| duration | the duration of the frame, usually in milliseconds but can be other units if the prop.AnimationEncoder.CREATE_TIMEBASE_DENOMINATOR_NUMBER property is set when creating the encoder. |
| Error | on failure. |
|
inline |
Add a frame to an animation encoder.
| surface | the surface to add as the next frame in the animation. |
| duration | the duration of the frame, usually in milliseconds but can be other units if the prop.AnimationEncoder.CREATE_TIMEBASE_DENOMINATOR_NUMBER property is set when creating the encoder. |
| Error | on failure. |
|
inline |
Load an animation from an IOStream.
If closeio is true, src will be closed before returning, whether this function succeeds or not. SDL_image reads everything it needs from src during this call in any case.
When done with the returned animation, the app should dispose of it with a call to Animation.Free().
| src | an IOStream that data will be read from. |
| closeio | true to close/free the IOStream before returning, false to leave it open. |
|
inline |
Load an animation from a file.
When done with the returned animation, the app should dispose of it with a call to Animation.Free().
| file | path on the filesystem containing an animated image. |
|
inline |
Create a decoder to read a series of images from an IOStream.
These animation types are currently supported:
If closeio is true, src will be closed before returning if this function fails, or when the animation decoder is closed if this function succeeds.
| src | an IOStream containing a series of images. |
| closeio | true to close the IOStream when done, false to leave it open. |
| type | a filename extension that represent this data ("WEBP", etc). |
| Error | on failure. |
|
inline |
Create an animation decoder with the specified properties.
These animation types are currently supported:
These are the supported properties:
| props | the properties of the animation decoder. |
| Error | on failure. |
|
inline |
Create a decoder to read a series of images from a file.
These animation types are currently supported:
The file type is determined from the file extension, e.g. "file.webp" will be decoded using WEBP.
| file | the file containing a series of images. |
| Error | on failure. |
|
inline |
Create an encoder to save a series of images to an IOStream.
These animation types are currently supported:
If closeio is true, dst will be closed before returning if this function fails, or when the animation encoder is closed if this function succeeds.
| dst | an IOStream that will be used to save the stream. |
| type | a filename extension that represent this data ("WEBP", etc). |
| closeio | true to close the IOStream when done, false to leave it open. |
| Error | on failure. |
|
inline |
Create an animation encoder with the specified properties.
These animation types are currently supported:
These are the supported properties:
| props | the properties of the animation encoder. |
| Error | on failure. |
|
inline |
Create an encoder to save a series of images to a file.
These animation types are currently supported:
The file type is determined from the file extension, e.g. "file.webp" will be encoded using WEBP.
| file | the file where the animation will be saved. |
| Error | on failure. |
|
inline |
Close an animation decoder, finishing any decoding.
Calling this function frees the animation decoder, and returns the final status of the decoding process.
| Error | on failure. |
|
inline |
Close an animation encoder, finishing any encoding.
Calling this function frees the animation encoder, and returns the final status of the encoding process.
| Error | on failure. |
|
inline |
Close an animation decoder, finishing any decoding.
Calling this function frees the animation decoder, and returns the final status of the decoding process.
| decoder | the decoder to close. |
| Error | on failure. |
|
inline |
Close an animation encoder, finishing any encoding.
Calling this function frees the animation encoder, and returns the final status of the encoding process.
| encoder | the encoder to close. |
| Error | on failure. |
|
inline |
Create an animated cursor from an animation.
| anim | an animation to use to create an animated cursor. |
| hotspot | the x, y position of the cursor hot spot. |
| Error | on failure. |
|
inline |
Create a decoder to read a series of images from a file.
These animation types are currently supported:
The file type is determined from the file extension, e.g. "file.webp" will be decoded using WEBP.
| file | the file containing a series of images. |
| Error | on failure. |
|
inline |
Create a decoder to read a series of images from an IOStream.
These animation types are currently supported:
If closeio is true, src will be closed before returning if this function fails, or when the animation decoder is closed if this function succeeds.
| src | an IOStream containing a series of images. |
| closeio | true to close the IOStream when done, false to leave it open. |
| type | a filename extension that represent this data ("WEBP", etc). |
| Error | on failure. |
|
inline |
Create an animation decoder with the specified properties.
These animation types are currently supported:
These are the supported properties:
| props | the properties of the animation decoder. |
| Error | on failure. |
|
inline |
Create an encoder to save a series of images to a file.
These animation types are currently supported:
The file type is determined from the file extension, e.g. "file.webp" will be encoded using WEBP.
| file | the file where the animation will be saved. |
| Error | on failure. |
|
inline |
Create an encoder to save a series of images to an IOStream.
These animation types are currently supported:
If closeio is true, dst will be closed before returning if this function fails, or when the animation encoder is closed if this function succeeds.
| dst | an IOStream that will be used to save the stream. |
| type | a filename extension that represent this data ("WEBP", etc). |
| closeio | true to close the IOStream when done, false to leave it open. |
| Error | on failure. |
|
inline |
Create an animation encoder with the specified properties.
These animation types are currently supported:
These are the supported properties:
| props | the properties of the animation encoder. |
| Error | on failure. |
Create an animated cursor from an animation.
| hotspot | the x, y position of the cursor hot spot. |
| Error | on failure. |
|
inline |
Dispose of an Animation and free its resources.
The provided anim pointer is not valid once this call returns.
|
inline |
|
inline |
Get the next frame in an animation decoder.
This function decodes the next frame in the animation decoder, returning it as an Surface.
| decoder | the animation decoder. |
| duration | the duration of the frame, usually in milliseconds but can be other units if the prop.AnimationDecoder.CREATE_TIMEBASE_DENOMINATOR_NUMBER property is set when creating the decoder. |
| Error | on failure. |
|
inline |
Get the properties of an animation decoder.
This function returns the properties of the animation decoder, which holds information about the underlying image such as description, copyright text and loop count.
| decoder | the animation decoder. |
|
inline |
Get the decoder status indicating the current state of the decoder.
| decoder | the decoder to get the status of. |
|
inline |
Return the frame delay under given index.
| anim | Animation to dispose of. |
| index | the index to get frame, within [0, GetCount() - 1] |
|
inline |
Return the frame image under given index.
| anim | Animation to dispose of. |
| index | the index to get frame, within [0, GetCount() - 1] |
|
inline |
Load an image from an SDL data source into a GPU texture.
An GPUTexture represents an image in GPU memory, usable by SDL's GPU API. Regardless of the source format of the image, this function will create a GPU texture with the format GPU_TEXTUREFORMAT_R8G8B8A8_UNORM with no mip levels. It can be bound as a sampled texture from a graphics or compute pipeline and as a a readonly storage texture in a compute pipeline.
If closeio is true, src will be closed before returning, whether this function succeeds or not. SDL_image reads everything it needs from src during this call in any case.
There is a separate function to read files from disk without having to deal with IOStream: `LoadGPUTexture(device, copy_pass, "filename.jpg", width, height) will call this function and manage those details for you, determining the file type from the filename's extension.
There is also LoadGPUTextureTyped_IO(), which is equivalent to this function except a file extension (like "BMP", "JPG", etc) can be specified, in case SDL_image cannot autodetect the file format.
When done with the returned texture, the app should dispose of it with a call to GPUDevice.ReleaseTexture().
| device | the GPUDevice to use to create the GPU texture. |
| copy_pass | the GPUCopyPass to use to upload the loaded image to the GPU texture. |
| src | an IOStream that data will be read from. |
| closeio | true to close/free the IOStream before returning, false to leave it open. |
| width | a pointer filled in with the width of the GPU texture. may be nullptr. |
| height | a pointer filled in with the width of the GPU texture. may be nullptr. |
/** Load an image from an SDL data source into a GPU texture.
An GPUTexture represents an image in GPU memory, usable by SDL's GPU API. Regardless of the source format of the image, this function will create a GPU texture with the format GPU_TEXTUREFORMAT_R8G8B8A8_UNORM with no mip levels. It can be bound as a sampled texture from a graphics or compute pipeline and as a a readonly storage texture in a compute pipeline.
If closeio is true, src will be closed before returning, whether this function succeeds or not. SDL_image reads everything it needs from src during this call in any case.
Even though this function accepts a file type, SDL_image may still try other decoders that are capable of detecting file type from the contents of the image data, but may rely on the caller-provided type string for formats that it cannot autodetect. If type is nullptr, SDL_image will rely solely on its ability to guess the format.
There is a separate function to read files from disk without having to deal with IOStream: `LoadGPUTexture(device, copy_pass, "filename.jpg", width, height) will call this function and manage those details for you, determining the file type from the filename's extension.
There is also LoadGPUTexture_IO(), which is equivalent to this function except that it will rely on SDL_image to determine what type of data it is loading, much like passing a nullptr for type.
When done with the returned texture, the app should dispose of it with a call to GPUDevice.ReleaseTexture().
| device | the GPUDevice to use to create the GPU texture. |
| copy_pass | the GPUCopyPass to use to upload the loaded image to the GPU texture. |
| src | an IOStream that data will be read from. |
| type | a filename extension that represent this data ("BMP", "GIF", "PNG", etc). |
| closeio | true to close/free the IOStream before returning, false to leave it open. |
| width | a pointer filled in with the width of the GPU texture. may be nullptr. |
| height | a pointer filled in with the width of the GPU texture. may be nullptr. |
/** Get the image currently in the clipboard.
When done with the returned surface, the app should dispose of it with a call to Surface.Destroy().
|
inline |
Return the frame delay under given index.
| index | the index to get frame, within [0, GetCount() - 1] |
|
inline |
Return the frame image under given index.
| index | the index to get frame, within [0, GetCount() - 1] |
Get the next frame in an animation decoder.
This function decodes the next frame in the animation decoder, returning it as an Surface. The returned surface should be freed with SDL_FreeSurface() when no longer needed.
| duration | the duration of the frame, usually in milliseconds but can be other units if the prop.AnimationDecoder.CREATE_TIMEBASE_DENOMINATOR_NUMBER property is set when creating the decoder. |
| Error | on failure. |
|
inline |
Get the properties of an animation decoder.
This function returns the properties of the animation decoder, which holds information about the underlying image such as description, copyright text and loop count.
|
inline |
Get the decoder status indicating the current state of the decoder.
|
inline |
Detect ANI animated cursor data on a readable/seekable IOStream.
This function attempts to determine if a file is a given filetype, reading the least amount possible from the IOStream (usually a few bytes).
There is no distinction made between "not the filetype in question" and basic i/o errors.
This function will always attempt to seek src back to where it started when this function was called, but it will not report any errors in doing so, but assuming seeking works, this means you can immediately use this with a different IMG_isTYPE function, or load the image without further seeking.
You do not need to call this function to load data; SDL_image can work to determine file type in many cases in its standard load functions.
| src | a seekable/readable IOStream to provide image data. |
|
inline |
Detect AVIF image data on a readable/seekable IOStream.
This function attempts to determine if a file is a given filetype, reading the least amount possible from the IOStream (usually a few bytes).
There is no distinction made between "not the filetype in question" and basic i/o errors.
This function will always attempt to seek src back to where it started when this function was called, but it will not report any errors in doing so, but assuming seeking works, this means you can immediately use this with a different IMG_isTYPE function, or load the image without further seeking.
You do not need to call this function to load data; SDL_image can work to determine file type in many cases in its standard load functions.
| src | a seekable/readable IOStream to provide image data. |
|
inline |
Detect BMP image data on a readable/seekable IOStream.
This function attempts to determine if a file is a given filetype, reading the least amount possible from the IOStream (usually a few bytes).
There is no distinction made between "not the filetype in question" and basic i/o errors.
This function will always attempt to seek src back to where it started when this function was called, but it will not report any errors in doing so, but assuming seeking works, this means you can immediately use this with a different IMG_isTYPE function, or load the image without further seeking.
You do not need to call this function to load data; SDL_image can work to determine file type in many cases in its standard load functions.
| src | a seekable/readable IOStream to provide image data. |
|
inline |
Detect CUR image data on a readable/seekable IOStream.
This function attempts to determine if a file is a given filetype, reading the least amount possible from the IOStream (usually a few bytes).
There is no distinction made between "not the filetype in question" and basic i/o errors.
This function will always attempt to seek src back to where it started when this function was called, but it will not report any errors in doing so, but assuming seeking works, this means you can immediately use this with a different IMG_isTYPE function, or load the image without further seeking.
You do not need to call this function to load data; SDL_image can work to determine file type in many cases in its standard load functions.
| src | a seekable/readable IOStream to provide image data. |
|
inline |
Detect GIF image data on a readable/seekable IOStream.
This function attempts to determine if a file is a given filetype, reading the least amount possible from the IOStream (usually a few bytes).
There is no distinction made between "not the filetype in question" and basic i/o errors.
This function will always attempt to seek src back to where it started when this function was called, but it will not report any errors in doing so, but assuming seeking works, this means you can immediately use this with a different IMG_isTYPE function, or load the image without further seeking.
You do not need to call this function to load data; SDL_image can work to determine file type in many cases in its standard load functions.
| src | a seekable/readable IOStream to provide image data. |
|
inline |
Detect ICO image data on a readable/seekable IOStream.
This function attempts to determine if a file is a given filetype, reading the least amount possible from the IOStream (usually a few bytes).
There is no distinction made between "not the filetype in question" and basic i/o errors.
This function will always attempt to seek src back to where it started when this function was called, but it will not report any errors in doing so, but assuming seeking works, this means you can immediately use this with a different IMG_isTYPE function, or load the image without further seeking.
You do not need to call this function to load data; SDL_image can work to determine file type in many cases in its standard load functions.
| src | a seekable/readable IOStream to provide image data. |
|
inline |
Detect JPG image data on a readable/seekable IOStream.
This function attempts to determine if a file is a given filetype, reading the least amount possible from the IOStream (usually a few bytes).
There is no distinction made between "not the filetype in question" and basic i/o errors.
This function will always attempt to seek src back to where it started when this function was called, but it will not report any errors in doing so, but assuming seeking works, this means you can immediately use this with a different IMG_isTYPE function, or load the image without further seeking.
You do not need to call this function to load data; SDL_image can work to determine file type in many cases in its standard load functions.
| src | a seekable/readable IOStream to provide image data. |
|
inline |
Detect JXL image data on a readable/seekable IOStream.
This function attempts to determine if a file is a given filetype, reading the least amount possible from the IOStream (usually a few bytes).
There is no distinction made between "not the filetype in question" and basic i/o errors.
This function will always attempt to seek src back to where it started when this function was called, but it will not report any errors in doing so, but assuming seeking works, this means you can immediately use this with a different IMG_isTYPE function, or load the image without further seeking.
You do not need to call this function to load data; SDL_image can work to determine file type in many cases in its standard load functions.
| src | a seekable/readable IOStream to provide image data. |
|
inline |
Detect LBM image data on a readable/seekable IOStream.
This function attempts to determine if a file is a given filetype, reading the least amount possible from the IOStream (usually a few bytes).
There is no distinction made between "not the filetype in question" and basic i/o errors.
This function will always attempt to seek src back to where it started when this function was called, but it will not report any errors in doing so, but assuming seeking works, this means you can immediately use this with a different IMG_isTYPE function, or load the image without further seeking.
You do not need to call this function to load data; SDL_image can work to determine file type in many cases in its standard load functions.
| src | a seekable/readable IOStream to provide image data. |
|
inline |
Detect PCX image data on a readable/seekable IOStream.
This function attempts to determine if a file is a given filetype, reading the least amount possible from the IOStream (usually a few bytes).
There is no distinction made between "not the filetype in question" and basic i/o errors.
This function will always attempt to seek src back to where it started when this function was called, but it will not report any errors in doing so, but assuming seeking works, this means you can immediately use this with a different IMG_isTYPE function, or load the image without further seeking.
You do not need to call this function to load data; SDL_image can work to determine file type in many cases in its standard load functions.
| src | a seekable/readable IOStream to provide image data. |
|
inline |
Detect PNG image data on a readable/seekable IOStream.
This function attempts to determine if a file is a given filetype, reading the least amount possible from the IOStream (usually a few bytes).
There is no distinction made between "not the filetype in question" and basic i/o errors.
This function will always attempt to seek src back to where it started when this function was called, but it will not report any errors in doing so, but assuming seeking works, this means you can immediately use this with a different IMG_isTYPE function, or load the image without further seeking.
You do not need to call this function to load data; SDL_image can work to determine file type in many cases in its standard load functions.
| src | a seekable/readable IOStream to provide image data. |
|
inline |
Detect PNM image data on a readable/seekable IOStream.
This function attempts to determine if a file is a given filetype, reading the least amount possible from the IOStream (usually a few bytes).
There is no distinction made between "not the filetype in question" and basic i/o errors.
This function will always attempt to seek src back to where it started when this function was called, but it will not report any errors in doing so, but assuming seeking works, this means you can immediately use this with a different IMG_isTYPE function, or load the image without further seeking.
You do not need to call this function to load data; SDL_image can work to determine file type in many cases in its standard load functions.
| src | a seekable/readable IOStream to provide image data. |
|
inline |
Detect QOI image data on a readable/seekable IOStream.
This function attempts to determine if a file is a given filetype, reading the least amount possible from the IOStream (usually a few bytes).
There is no distinction made between "not the filetype in question" and basic i/o errors.
This function will always attempt to seek src back to where it started when this function was called, but it will not report any errors in doing so, but assuming seeking works, this means you can immediately use this with a different IMG_isTYPE function, or load the image without further seeking.
You do not need to call this function to load data; SDL_image can work to determine file type in many cases in its standard load functions.
| src | a seekable/readable IOStream to provide image data. |
|
inline |
Detect SVG image data on a readable/seekable IOStream.
This function attempts to determine if a file is a given filetype, reading the least amount possible from the IOStream (usually a few bytes).
There is no distinction made between "not the filetype in question" and basic i/o errors.
This function will always attempt to seek src back to where it started when this function was called, but it will not report any errors in doing so, but assuming seeking works, this means you can immediately use this with a different IMG_isTYPE function, or load the image without further seeking.
You do not need to call this function to load data; SDL_image can work to determine file type in many cases in its standard load functions.
| src | a seekable/readable IOStream to provide image data. |
|
inline |
Detect TIFF image data on a readable/seekable IOStream.
This function attempts to determine if a file is a given filetype, reading the least amount possible from the IOStream (usually a few bytes).
There is no distinction made between "not the filetype in question" and basic i/o errors.
This function will always attempt to seek src back to where it started when this function was called, but it will not report any errors in doing so, but assuming seeking works, this means you can immediately use this with a different IMG_isTYPE function, or load the image without further seeking.
You do not need to call this function to load data; SDL_image can work to determine file type in many cases in its standard load functions.
| src | a seekable/readable IOStream to provide image data. |
|
inline |
Detect WEBP image data on a readable/seekable IOStream.
This function attempts to determine if a file is a given filetype, reading the least amount possible from the IOStream (usually a few bytes).
There is no distinction made between "not the filetype in question" and basic i/o errors.
This function will always attempt to seek src back to where it started when this function was called, but it will not report any errors in doing so, but assuming seeking works, this means you can immediately use this with a different IMG_isTYPE function, or load the image without further seeking.
You do not need to call this function to load data; SDL_image can work to determine file type in many cases in its standard load functions.
| src | a seekable/readable IOStream to provide image data. |
|
inline |
Detect XCF image data on a readable/seekable IOStream.
This function attempts to determine if a file is a given filetype, reading the least amount possible from the IOStream (usually a few bytes).
There is no distinction made between "not the filetype in question" and basic i/o errors.
This function will always attempt to seek src back to where it started when this function was called, but it will not report any errors in doing so, but assuming seeking works, this means you can immediately use this with a different IMG_isTYPE function, or load the image without further seeking.
You do not need to call this function to load data; SDL_image can work to determine file type in many cases in its standard load functions.
| src | a seekable/readable IOStream to provide image data. |
|
inline |
Detect XPM image data on a readable/seekable IOStream.
This function attempts to determine if a file is a given filetype, reading the least amount possible from the IOStream (usually a few bytes).
There is no distinction made between "not the filetype in question" and basic i/o errors.
This function will always attempt to seek src back to where it started when this function was called, but it will not report any errors in doing so, but assuming seeking works, this means you can immediately use this with a different IMG_isTYPE function, or load the image without further seeking.
You do not need to call this function to load data; SDL_image can work to determine file type in many cases in its standard load functions.
| src | a seekable/readable IOStream to provide image data. |
|
inline |
Detect XV image data on a readable/seekable IOStream.
This function attempts to determine if a file is a given filetype, reading the least amount possible from the IOStream (usually a few bytes).
There is no distinction made between "not the filetype in question" and basic i/o errors.
This function will always attempt to seek src back to where it started when this function was called, but it will not report any errors in doing so, but assuming seeking works, this means you can immediately use this with a different IMG_isTYPE function, or load the image without further seeking.
You do not need to call this function to load data; SDL_image can work to determine file type in many cases in its standard load functions.
| src | a seekable/readable IOStream to provide image data. |
|
inline |
Load an ANI animation directly from an IOStream.
If you know you definitely have an ANI image, you can call this function, which will skip SDL_image's file format detection routines. Generally, it's better to use the abstract interfaces; also, there is only an IOStream interface available here.
When done with the returned animation, the app should dispose of it with a call to Animation.Free().
| src | an IOStream from which data will be read. |
|
inline |
Load an animation from a file.
When done with the returned animation, the app should dispose of it with a call to Animation.Free().
| file | path on the filesystem containing an animated image. |
|
inline |
Load an animation from an IOStream.
If closeio is true, src will be closed before returning, whether this function succeeds or not. SDL_image reads everything it needs from src during this call in any case.
When done with the returned animation, the app should dispose of it with a call to Animation.Free().
| src | an IOStream that data will be read from. |
| closeio | true to close/free the IOStream before returning, false to leave it open. |
|
inline |
Load an animation from an IOStream.
Even though this function accepts a file type, SDL_image may still try other decoders that are capable of detecting file type from the contents of the image data, but may rely on the caller-provided type string for formats that it cannot autodetect. If type is nullptr, SDL_image will rely solely on its ability to guess the format.
If closeio is true, src will be closed before returning, whether this function succeeds or not. SDL_image reads everything it needs from src during this call in any case.
When done with the returned animation, the app should dispose of it with a call to Animation.Free().
| src | an IOStream that data will be read from. |
| type | a filename extension that represent this data ("GIF", etc). |
| closeio | true to close/free the IOStream before returning, false to leave it open. |
|
inline |
Load an APNG animation directly from an IOStream.
If you know you definitely have an APNG image, you can call this function, which will skip SDL_image's file format detection routines. Generally, it's better to use the abstract interfaces; also, there is only an IOStream interface available here.
When done with the returned animation, the app should dispose of it with a call to Animation.Free().
| src | an IOStream from which data will be read. |
|
inline |
Load a AVIF image directly.
If you know you definitely have a AVIF image, you can call this function, which will skip SDL_image's file format detection routines. Generally it's better to use the abstract interfaces; also, there is only an IOStream interface available here.
| src | an IOStream to load image data from. |
|
inline |
Load an AVIF animation directly from an IOStream.
If you know you definitely have an AVIF animation, you can call this function, which will skip SDL_image's file format detection routines. Generally it's better to use the abstract interfaces; also, there is only an IOStream interface available here.
When done with the returned animation, the app should dispose of it with a call to Animation.Free().
| src | an IOStream that data will be read from. |
|
inline |
Load a CUR image directly.
If you know you definitely have a CUR image, you can call this function, which will skip SDL_image's file format detection routines. Generally it's better to use the abstract interfaces; also, there is only an IOStream interface available here.
| src | an IOStream to load image data from. |
|
inline |
Load a GIF image directly.
If you know you definitely have a GIF image, you can call this function, which will skip SDL_image's file format detection routines. Generally it's better to use the abstract interfaces; also, there is only an IOStream interface available here.
| src | an IOStream to load image data from. |
|
inline |
Load a GIF animation directly.
If you know you definitely have a GIF image, you can call this function, which will skip SDL_image's file format detection routines. Generally it's better to use the abstract interfaces; also, there is only an IOStream interface available here.
| src | an IOStream that data will be read from. |
|
inline |
Load an image from a filesystem path into a GPU texture.
An GPUTexture represents an image in GPU memory, usable by SDL's GPU API. Regardless of the source format of the image, this function will create a GPU texture with the format GPU_TEXTUREFORMAT_R8G8B8A8_UNORM with no mip levels. It can be bound as a sampled texture from a graphics or compute pipeline and as a a readonly storage texture in a compute pipeline.
There is a separate function to read files from an IOStream, if you need an i/o abstraction to provide data from anywhere instead of a simple filesystem read; that function is LoadGPUTexture_IO().
When done with the returned texture, the app should dispose of it with a call to GPUDevice.ReleaseTexture().
| device | the GPUDevice to use to create the GPU texture. |
| copy_pass | the GPUCopyPass to use to upload the loaded image to the GPU texture. |
| file | a path on the filesystem to load an image from. |
| width | a pointer filled in with the width of the GPU texture. may be nullptr. |
| height | a pointer filled in with the width of the GPU texture. may be nullptr. |
|
inline |
Load a ICO image directly.
If you know you definitely have a ICO image, you can call this function, which will skip SDL_image's file format detection routines. Generally it's better to use the abstract interfaces; also, there is only an IOStream interface available here.
| src | an IOStream to load image data from. |
|
inline |
Load a JPG image directly.
If you know you definitely have a JPG image, you can call this function, which will skip SDL_image's file format detection routines. Generally it's better to use the abstract interfaces; also, there is only an IOStream interface available here.
| src | an IOStream to load image data from. |
|
inline |
Load a JXL image directly.
If you know you definitely have a JXL image, you can call this function, which will skip SDL_image's file format detection routines. Generally it's better to use the abstract interfaces; also, there is only an IOStream interface available here.
| src | an IOStream to load image data from. |
|
inline |
Load a LBM image directly.
If you know you definitely have a LBM image, you can call this function, which will skip SDL_image's file format detection routines. Generally it's better to use the abstract interfaces; also, there is only an IOStream interface available here.
| src | an IOStream to load image data from. |
|
inline |
Load a PCX image directly.
If you know you definitely have a PCX image, you can call this function, which will skip SDL_image's file format detection routines. Generally it's better to use the abstract interfaces; also, there is only an IOStream interface available here.
| src | an IOStream to load image data from. |
|
inline |
Load a PNG image from a file.
If you know you definitely have a PNG image, you can call this function, which will skip SDL_image's file format detection routines. Generally it's better to use the abstract interfaces;
| file | the PNG file to load. |
|
inline |
Load a PNG image directly.
If you know you definitely have a PNG image, you can call this function, which will skip SDL_image's file format detection routines. Generally it's better to use the abstract interfaces; also, there is only an IOStream interface available here.
| src | an IOStream to load image data from. |
|
inline |
Load a PNG image directly.
If you know you definitely have a PNG image, you can call this function, which will skip SDL_image's file format detection routines. Generally it's better to use the abstract interfaces; also, there is only an IOStream interface available here.
| src | an IOStream to load image data from. |
| closeio | if true, calls IOStream.Close() on src before returning, even in the case of an error. |
|
inline |
Load a PNM image directly.
If you know you definitely have a PNM image, you can call this function, which will skip SDL_image's file format detection routines. Generally it's better to use the abstract interfaces; also, there is only an IOStream interface available here.
| src | an IOStream to load image data from. |
|
inline |
Load a QOI image directly.
If you know you definitely have a QOI image, you can call this function, which will skip SDL_image's file format detection routines. Generally it's better to use the abstract interfaces; also, there is only an IOStream interface available here.
| src | an IOStream to load image data from. |
|
inline |
Load an SVG image, scaled to a specific size.
Since SVG files are resolution-independent, you specify the size you would like the output image to be and it will be generated at those dimensions.
Either width or height may be 0 and the image will be auto-sized to preserve aspect ratio.
When done with the returned surface, the app should dispose of it with a call to Surface.Destroy().
| src | an IOStream to load SVG data from. |
| size | desired width and height of the generated surface, in pixels. |
|
inline |
Load an image from a filesystem path into a software surface.
An Surface is a buffer of pixels in memory accessible by the CPU. Use this if you plan to hand the data to something else or manipulate it further in code.
There are no guarantees about what format the new Surface data will be; in many cases, SDL_image will attempt to supply a surface that exactly matches the provided image, but in others it might have to convert (either because the image is in a format that SDL doesn't directly support or because it's compressed data that could reasonably uncompress to various formats and SDL_image had to pick one). You can inspect an Surface for its specifics, and use Surface.Convert to then migrate to any supported format.
If the image format supports a transparent pixel, SDL will set the colorkey for the surface. You can enable RLE acceleration on the surface afterwards by calling: Surface.SetColorKey(image, SDL_RLEACCEL, image->format->colorkey);
There is a separate function to read files from an IOStream, if you need an i/o abstraction to provide data from anywhere instead of a simple filesystem read; that function is LoadSurface_IO().
If you are using SDL's 2D rendering API, there is an equivalent call to load images directly into an Texture for use by the GPU without using a software surface: call LoadTexture() instead.
| file | a path on the filesystem to load an image from. |
|
inline |
Load an image from an SDL data source into a software surface.
An Surface is a buffer of pixels in memory accessible by the CPU. Use this if you plan to hand the data to something else or manipulate it further in code.
There are no guarantees about what format the new Surface data will be; in many cases, SDL_image will attempt to supply a surface that exactly matches the provided image, but in others it might have to convert (either because the image is in a format that SDL doesn't directly support or because it's compressed data that could reasonably uncompress to various formats and SDL_image had to pick one). You can inspect an Surface for its specifics, and use Surface.Convert to then migrate to any supported format.
If the image format supports a transparent pixel, SDL will set the colorkey for the surface. You can enable RLE acceleration on the surface afterwards by calling: Surface.SetColorKey(image, SDL_RLEACCEL, image->format->colorkey);
If closeio is true, src will be closed before returning, whether this function succeeds or not. SDL_image reads everything it needs from src during this call in any case.
There is a separate function to read files from disk without having to deal with IOStream: LoadSurface("filename.jpg") will call this function and manage those details for you, determining the file type from the filename's extension.
There is also LoadSurfaceTyped_IO(), which is equivalent to this function except a file extension (like "BMP", "JPG", etc) can be specified, in case SDL_image cannot autodetect the file format.
If you are using SDL's 2D rendering API, there is an equivalent call to load images directly into an Texture for use by the GPU without using a software surface: call LoadSurface() instead.
| src | an IOStream that data will be read from. |
| closeio | true to close/free the IOStream before returning, false to leave it open. |
|
inline |
Load an image from an SDL data source into a software surface.
An Surface is a buffer of pixels in memory accessible by the CPU. Use this if you plan to hand the data to something else or manipulate it further in code.
There are no guarantees about what format the new Surface data will be; in many cases, SDL_image will attempt to supply a surface that exactly matches the provided image, but in others it might have to convert (either because the image is in a format that SDL doesn't directly support or because it's compressed data that could reasonably uncompress to various formats and SDL_image had to pick one). You can inspect an Surface for its specifics, and use Surface.Convert to then migrate to any supported format.
If the image format supports a transparent pixel, SDL will set the colorkey for the surface. You can enable RLE acceleration on the surface afterwards by calling: Surface.SetColorKey(image, SDL_RLEACCEL, image->format->colorkey);
If closeio is true, src will be closed before returning, whether this function succeeds or not. SDL_image reads everything it needs from src during this call in any case.
Even though this function accepts a file type, SDL_image may still try other decoders that are capable of detecting file type from the contents of the image data, but may rely on the caller-provided type string for formats that it cannot autodetect. If type is nullptr, SDL_image will rely solely on its ability to guess the format.
There is a separate function to read files from disk without having to deal with IOStream: LoadSurface("filename.jpg") will call this function and manage those details for you, determining the file type from the filename's extension.
There is also LoadSurface_IO(), which is equivalent to this function except that it will rely on SDL_image to determine what type of data it is loading, much like passing a nullptr for type.
If you are using SDL's 2D rendering API, there is an equivalent call to load images directly into an Texture for use by the GPU without using a software surface: call LoadTextureTyped_IO() instead.
| src | an IOStream that data will be read from. |
| type | a filename extension that represent this data ("BMP", "GIF", "PNG", etc). |
| closeio | true to close/free the IOStream before returning, false to leave it open. |
|
inline |
Load a SVG image directly.
If you know you definitely have a SVG image, you can call this function, which will skip SDL_image's file format detection routines. Generally it's better to use the abstract interfaces; also, there is only an IOStream interface available here.
| src | an IOStream to load image data from. |
|
inline |
Load an image from a filesystem path into a texture.
An Texture represents an image in GPU memory, usable by SDL's 2D Render API. This can be significantly more efficient than using a CPU-bound Surface if you don't need to manipulate the image directly after loading it.
If the loaded image has transparency or a colorkey, a texture with an alpha channel will be created. Otherwise, SDL_image will attempt to create an Texture in the most format that most reasonably represents the image data (but in many cases, this will just end up being 32-bit RGB or 32-bit RGBA).
There is a separate function to read files from an IOStream, if you need an i/o abstraction to provide data from anywhere instead of a simple filesystem read; that function is LoadTexture_IO().
If you would rather decode an image to an Surface (a buffer of pixels in CPU memory), call LoadSurface() instead.
| renderer | the Renderer to use to create the texture. |
| file | a path on the filesystem to load an image from. |
|
inline |
Load an image from an SDL data source into a texture.
An Texture represents an image in GPU memory, usable by SDL's 2D Render API. This can be significantly more efficient than using a CPU-bound Surface if you don't need to manipulate the image directly after loading it.
If the loaded image has transparency or a colorkey, a texture with an alpha channel will be created. Otherwise, SDL_image will attempt to create an Texture in the most format that most reasonably represents the image data (but in many cases, this will just end up being 32-bit RGB or 32-bit RGBA).
If closeio is true, src will be closed before returning, whether this function succeeds or not. SDL_image reads everything it needs from src during this call in any case.
There is a separate function to read files from disk without having to deal with IOStream: LoadTexture(renderer, "filename.jpg") will call this function and manage those details for you, determining the file type from the filename's extension.
There is also LoadTextureTyped_IO(), which is equivalent to this function except a file extension (like "BMP", "JPG", etc) can be specified, in case SDL_image cannot autodetect the file format.
If you would rather decode an image to an Surface (a buffer of pixels in CPU memory), call LoadSurface() instead.
| renderer | the Renderer to use to create the texture. |
| src | an IOStream that data will be read from. |
| closeio | true to close/free the IOStream before returning, false to leave it open. |
|
inline |
Load an image from an SDL data source into a texture.
An Texture represents an image in GPU memory, usable by SDL's 2D Render API. This can be significantly more efficient than using a CPU-bound Surface if you don't need to manipulate the image directly after loading it.
If the loaded image has transparency or a colorkey, a texture with an alpha channel will be created. Otherwise, SDL_image will attempt to create an Texture in the most format that most reasonably represents the image data (but in many cases, this will just end up being 32-bit RGB or 32-bit RGBA).
If closeio is true, src will be closed before returning, whether this function succeeds or not. SDL_image reads everything it needs from src during this call in any case.
Even though this function accepts a file type, SDL_image may still try other decoders that are capable of detecting file type from the contents of the image data, but may rely on the caller-provided type string for formats that it cannot autodetect. If type is nullptr, SDL_image will rely solely on its ability to guess the format.
There is a separate function to read files from disk without having to deal with IOStream: LoadTexture("filename.jpg") will call this function and manage those details for you, determining the file type from the filename's extension.
There is also LoadTexture_IO(), which is equivalent to this function except that it will rely on SDL_image to determine what type of data it is loading, much like passing a nullptr for type.
If you would rather decode an image to an Surface (a buffer of pixels in CPU memory), call LoadSurfaceTyped_IO() instead.
| renderer | the Renderer to use to create the texture. |
| src | an IOStream that data will be read from. |
| type | a filename extension that represent this data ("BMP", "GIF", "PNG", etc). |
| closeio | true to close/free the IOStream before returning, false to leave it open. |
|
inline |
Load a TGA image directly.
If you know you definitely have a TGA image, you can call this function, which will skip SDL_image's file format detection routines. Generally it's better to use the abstract interfaces; also, there is only an IOStream interface available here.
| src | an IOStream to load image data from. |
|
inline |
Load a TIFF image directly.
If you know you definitely have a TIFF image, you can call this function, which will skip SDL_image's file format detection routines. Generally it's better to use the abstract interfaces; also, there is only an IOStream interface available here.
| src | an IOStream to load image data from. |
|
inline |
Load a WEBP image directly.
If you know you definitely have a WEBP image, you can call this function, which will skip SDL_image's file format detection routines. Generally it's better to use the abstract interfaces; also, there is only an IOStream interface available here.
| src | an IOStream to load image data from. |
|
inline |
Load a WEBP animation directly.
If you know you definitely have a WEBP image, you can call this function, which will skip SDL_image's file format detection routines. Generally it's better to use the abstract interfaces; also, there is only an IOStream interface available here.
| src | an IOStream that data will be read from. |
|
inline |
Load a XCF image directly.
If you know you definitely have a XCF image, you can call this function, which will skip SDL_image's file format detection routines. Generally it's better to use the abstract interfaces; also, there is only an IOStream interface available here.
| src | an IOStream to load image data from. |
|
inline |
Load a XPM image directly.
If you know you definitely have a XPM image, you can call this function, which will skip SDL_image's file format detection routines. Generally it's better to use the abstract interfaces; also, there is only an IOStream interface available here.
| src | an IOStream to load image data from. |
|
inline |
Load a XV image directly.
If you know you definitely have a XV image, you can call this function, which will skip SDL_image's file format detection routines. Generally it's better to use the abstract interfaces; also, there is only an IOStream interface available here.
| src | an IOStream to load image data from. |
|
inline |
Load an XPM image from a memory array.
The returned surface will be an 8bpp indexed surface, if possible, otherwise it will be 32bpp. If you always want 32-bit data, use ReadXPMFromArrayToRGB888() instead.
| xpm | a null-terminated array of strings that comprise XPM data. |
|
inline |
Load an XPM image from a memory array.
The returned surface will always be a 32-bit RGB surface. If you want 8-bit indexed colors (and the XPM data allows it), use ReadXPMFromArray() instead.
| xpm | a null-terminated array of strings that comprise XPM data. |
|
inline |
Reset an animation decoder.
Calling this function resets the animation decoder, allowing it to start from the beginning again. This is useful if you want to decode the frame sequence again without creating a new decoder.
| Error | on failure. |
|
inline |
Reset an animation decoder.
Calling this function resets the animation decoder, allowing it to start from the beginning again. This is useful if you want to decode the frame sequence again without creating a new decoder.
| decoder | the decoder to reset. |
| Error | on failure. |
|
inline |
Save an animation to a file.
For formats that accept a quality, a default quality of 90 will be used.
| file | path on the filesystem containing an animated image. |
| Error | on failure. |
|
inline |
Save an Surface into an image file.
If the file already exists, it will be overwritten.
For formats that accept a quality, a default quality of 90 will be used.
| surface | the SDL surface to save. |
| file | path on the filesystem to write new file to. |
| Error | on failure. |
|
inline |
Save an Surface into an image file.
If the file already exists, it will be overwritten.
For formats that accept a quality, a default quality of 90 will be used.
| filename | path on the filesystem to write new file to. |
| Error | on failure. |
|
inline |
Save an animation in ANI format to an IOStream.
If closeio is true, dst will be closed before returning, whether this function succeeds or not.
| dst | an IOStream from which data will be written to. |
| closeio | true to close/free the IOStream before returning, false to leave it open. |
| Error | on failure. |
|
inline |
Save an animation in ANI format to an IOStream.
If closeio is true, dst will be closed before returning, whether this function succeeds or not.
| anim | the animation to save. |
| dst | an IOStream from which data will be written to. |
| closeio | true to close/free the IOStream before returning, false to leave it open. |
| Error | on failure. |
|
inline |
Save an animation to a file.
For formats that accept a quality, a default quality of 90 will be used.
| anim | the animation to save. |
| file | path on the filesystem containing an animated image. |
| Error | on failure. |
|
inline |
Save an animation to an IOStream.
If you just want to save to a filename, you can use Animation.Save() instead.
If closeio is true, dst will be closed before returning, whether this function succeeds or not.
For formats that accept a quality, a default quality of 90 will be used.
| anim | the animation to save. |
| dst | an IOStream that data will be written to. |
| closeio | true to close/free the IOStream before returning, false to leave it open. |
| type | a filename extension that represent this data ("GIF", etc). |
| Error | on failure. |
|
inline |
Save an animation in APNG format to an IOStream.
If closeio is true, dst will be closed before returning, whether this function succeeds or not.
| dst | an IOStream from which data will be written to. |
| closeio | true to close/free the IOStream before returning, false to leave it open. |
| Error | on failure. |
|
inline |
Save an animation in APNG format to an IOStream.
If closeio is true, dst will be closed before returning, whether this function succeeds or not.
| anim | the animation to save. |
| dst | an IOStream from which data will be written to. |
| closeio | true to close/free the IOStream before returning, false to leave it open. |
| Error | on failure. |
|
inline |
Save an Surface into a AVIF image file.
If the file already exists, it will be overwritten.
| surface | the SDL surface to save. |
| file | path on the filesystem to write new file to. |
| quality | the desired quality, ranging between 0 (lowest) and 100 (highest). |
| Error | on failure. |
|
inline |
Save an animation in AVIF format to an IOStream.
If closeio is true, dst will be closed before returning, whether this function succeeds or not.
| dst | an IOStream from which data will be written to. |
| quality | the desired quality, ranging between 0 (lowest) and 100 (highest). |
| closeio | true to close/free the IOStream before returning, false to leave it open. |
| Error | on failure. |
|
inline |
Save an Surface into AVIF image data, via an IOStream.
If you just want to save to a filename, you can use SaveAVIF() instead.
If closeio is true, dst will be closed before returning, whether this function succeeds or not.
| surface | the SDL surface to save. |
| dst | the IOStream to save the image data to. |
| quality | the desired quality, ranging between 0 (lowest) and 100 (highest). |
| closeio | true to close/free the IOStream before returning, false to leave it open. |
| Error | on failure. |
|
inline |
Save an animation in AVIF format to an IOStream.
If closeio is true, dst will be closed before returning, whether this function succeeds or not.
| anim | the animation to save. |
| dst | an IOStream from which data will be written to. |
| quality | the desired quality, ranging between 0 (lowest) and 100 (highest). |
| closeio | true to close/free the IOStream before returning, false to leave it open. |
| Error | on failure. |
|
inline |
Save an Surface into a CUR image file.
If the file already exists, it will be overwritten.
| surface | the SDL surface to save. |
| file | path on the filesystem to write new file to. |
| Error | on failure. |
|
inline |
Save an Surface into CUR image data, via an IOStream.
If you just want to save to a filename, you can use SaveCUR() instead.
If closeio is true, dst will be closed before returning, whether this function succeeds or not.
| surface | the SDL surface to save. |
| dst | the IOStream to save the image data to. |
| closeio | true to close/free the IOStream before returning, false to leave it open. |
| Error | on failure. |
|
inline |
Save an Surface into a GIF image file.
If the file already exists, it will be overwritten.
| surface | the SDL surface to save. |
| file | path on the filesystem to write new file to. |
| Error | on failure. |
|
inline |
Save an animation in GIF format to an IOStream.
If closeio is true, dst will be closed before returning, whether this function succeeds or not.
| dst | an IOStream from which data will be written to. |
| closeio | true to close/free the IOStream before returning, false to leave it open. |
| Error | on failure. |
|
inline |
Save an Surface into GIF image data, via an IOStream.
If you just want to save to a filename, you can use SaveGIF() instead.
If closeio is true, dst will be closed before returning, whether this function succeeds or not.
| surface | the SDL surface to save. |
| dst | the IOStream to save the image data to. |
| closeio | true to close/free the IOStream before returning, false to leave it open. |
| Error | on failure. |
|
inline |
Save an animation in GIF format to an IOStream.
If closeio is true, dst will be closed before returning, whether this function succeeds or not.
| anim | the animation to save. |
| dst | an IOStream from which data will be written to. |
| closeio | true to close/free the IOStream before returning, false to leave it open. |
| Error | on failure. |
|
inline |
Save an Surface into a ICO image file.
If the file already exists, it will be overwritten.
| surface | the SDL surface to save. |
| file | path on the filesystem to write new file to. |
| Error | on failure. |
|
inline |
Save an Surface into ICO image data, via an IOStream.
If you just want to save to a filename, you can use SaveICO() instead.
If closeio is true, dst will be closed before returning, whether this function succeeds or not.
| surface | the SDL surface to save. |
| dst | the IOStream to save the image data to. |
| closeio | true to close/free the IOStream before returning, false to leave it open. |
| Error | on failure. |
|
inline |
Save an Surface into a JPEG image file.
If the file already exists, it will be overwritten.
| surface | the SDL surface to save. |
| file | path on the filesystem to write new file to. |
| quality | [0; 33] is Lowest quality, [34; 66] is Middle quality, [67; 100] is Highest quality. |
| Error | on failure. |
|
inline |
Save an Surface into JPEG image data, via an IOStream.
If you just want to save to a filename, you can use SaveJPG() instead.
If closeio is true, dst will be closed before returning, whether this function succeeds or not.
| surface | the SDL surface to save. |
| dst | the IOStream to save the image data to. |
| quality | [0; 33] is Lowest quality, [34; 66] is Middle quality, [67; 100] is Highest quality. |
| closeio | true to close/free the IOStream before returning, false to leave it open. |
| Error | on failure. |
|
inline |
Save an Surface into a PNG image file.
If the file already exists, it will be overwritten.
| surface | the SDL surface to save. |
| file | path on the filesystem to write new file to. |
| Error | on failure. |
|
inline |
Save a surface to a file in PNG format.
If the file already exists, it will be overwritten.
| file | a file to save to. |
| Error | on failure. |
|
inline |
Save an Surface into PNG image data, via an IOStream.
If you just want to save to a filename, you can use SavePNG() instead.
If closeio is true, dst will be closed before returning, whether this function succeeds or not.
| surface | the SDL surface to save. |
| dst | the IOStream to save the image data to. |
| closeio | true to close/free the IOStream before returning, false to leave it open. |
| Error | on failure. |
|
inline |
Save a surface to a seekable SDL data stream in PNG format.
If the file already exists, it will be overwritten.
| dst | a data stream to save to. |
| closeio | if true, calls IOStream.Close() on dst before returning, even in the case of an error. |
| Error | on failure. |
|
inline |
Save an Surface into a TGA image file.
If the file already exists, it will be overwritten.
| surface | the SDL surface to save. |
| file | path on the filesystem to write new file to. |
| Error | on failure. |
|
inline |
Save an Surface into TGA image data, via an IOStream.
If you just want to save to a filename, you can use SaveTGA() instead.
If closeio is true, dst will be closed before returning, whether this function succeeds or not.
| surface | the SDL surface to save. |
| dst | the IOStream to save the image data to. |
| closeio | true to close/free the IOStream before returning, false to leave it open. |
| Error | on failure. |
|
inline |
Save an animation to an IOStream.
If you just want to save to a filename, you can use Animation.Save() instead.
If closeio is true, dst will be closed before returning, whether this function succeeds or not.
For formats that accept a quality, a default quality of 90 will be used.
| dst | an IOStream that data will be written to. |
| type | a filename extension that represent this data ("GIF", etc). |
| closeio | true to close/free the IOStream before returning, false to leave it open. |
| Error | on failure. |
|
inline |
Save an Surface into formatted image data, via an IOStream.
If you just want to save to a filename, you can use Save() instead.
If closeio is true, dst will be closed before returning, whether this function succeeds or not.
For formats that accept a quality, a default quality of 90 will be used.
| surface | the SDL surface to save. |
| dst | the IOStream to save the image data to. |
| type | a filename extension that represent this data ("BMP", "GIF", "PNG", etc). |
| closeio | true to close/free the IOStream before returning, false to leave it open. |
| Error | on failure. |
|
inline |
Save an Surface into formatted image data, via an IOStream.
If you just want to save to a filename, you can use Save() instead.
If closeio is true, dst will be closed before returning, whether this function succeeds or not.
For formats that accept a quality, a default quality of 90 will be used.
| dst | the IOStream to save the image data to. |
| closeio | true to close/free the IOStream before returning, false to leave it open. |
| type | a filename extension that represent this data ("BMP", "GIF", "PNG", etc). |
| Error | on failure. |
|
inline |
Save an Surface into a WEBP image file.
If the file already exists, it will be overwritten.
| surface | the SDL surface to save. |
| file | path on the filesystem to write the new file to. |
| quality | between 0 and 100. For lossy, 0 gives the smallest size and 100 the largest. For lossless, this parameter is the amount of effort put into the compression: 0 is the fastest but gives larger files compared to the slowest, but best, 100. |
| Error | on failure. |
|
inline |
Save an animation in WEBP format to an IOStream.
If closeio is true, dst will be closed before returning, whether this function succeeds or not.
| dst | an IOStream from which data will be written to. |
| quality | between 0 and 100. For lossy, 0 gives the smallest size and 100 the largest. For lossless, this parameter is the amount of effort put into the compression: 0 is the fastest but gives larger files compared to the slowest, but best, 100. |
| closeio | true to close/free the IOStream before returning, false to leave it open. |
| Error | on failure. |
|
inline |
Save an Surface into WEBP image data, via an IOStream.
If you just want to save to a filename, you can use SaveWEBP() instead.
If closeio is true, dst will be closed before returning, whether this function succeeds or not.
| surface | the SDL surface to save. |
| dst | the IOStream to save the image data to. |
| quality | between 0 and 100. For lossy, 0 gives the smallest size and 100 the largest. For lossless, this parameter is the amount of effort put into the compression: 0 is the fastest but gives larger files compared to the slowest, but best, 100. |
| closeio | true to close/free the IOStream before returning, false to leave it open. |
| Error | on failure. |
|
inline |
Save an animation in WEBP format to an IOStream.
If closeio is true, dst will be closed before returning, whether this function succeeds or not.
| anim | the animation to save. |
| dst | an IOStream from which data will be written to. |
| quality | between 0 and 100. For lossy, 0 gives the smallest size and 100 the largest. For lossless, this parameter is the amount of effort put into the compression: 0 is the fastest but gives larger files compared to the slowest, but best, 100. |
| closeio | true to close/free the IOStream before returning, false to leave it open. |
| Error | on failure. |
|
inline |
Load an image from an SDL data source into a software surface.
An Surface is a buffer of pixels in memory accessible by the CPU. Use this if you plan to hand the data to something else or manipulate it further in code.
There are no guarantees about what format the new Surface data will be; in many cases, SDL_image will attempt to supply a surface that exactly matches the provided image, but in others it might have to convert (either because the image is in a format that SDL doesn't directly support or because it's compressed data that could reasonably uncompress to various formats and SDL_image had to pick one). You can inspect an Surface for its specifics, and use Surface.Convert to then migrate to any supported format.
If the image format supports a transparent pixel, SDL will set the colorkey for the surface. You can enable RLE acceleration on the surface afterwards by calling: Surface.SetColorKey(image, SDL_RLEACCEL, image->format->colorkey);
If closeio is true, src will be closed before returning, whether this function succeeds or not. SDL_image reads everything it needs from src during this call in any case.
There is a separate function to read files from disk without having to deal with IOStream: LoadSurface("filename.jpg") will call this function and manage those details for you, determining the file type from the filename's extension.
There is also LoadSurfaceTyped_IO(), which is equivalent to this function except a file extension (like "BMP", "JPG", etc) can be specified, in case SDL_image cannot autodetect the file format.
If you are using SDL's 2D rendering API, there is an equivalent call to load images directly into an Texture for use by the GPU without using a software surface: call LoadTexture_IO() instead.
| src | an IOStream that data will be read from. |
| closeio | true to close/free the IOStream before returning, false to leave it open. |
|
inline |
Load an image from a filesystem path into a software surface.
An Surface is a buffer of pixels in memory accessible by the CPU. Use this if you plan to hand the data to something else or manipulate it further in code.
There are no guarantees about what format the new Surface data will be; in many cases, SDL_image will attempt to supply a surface that exactly matches the provided image, but in others it might have to convert (either because the image is in a format that SDL doesn't directly support or because it's compressed data that could reasonably uncompress to various formats and SDL_image had to pick one). You can inspect an Surface for its specifics, and use Surface.Convert to then migrate to any supported format.
If the image format supports a transparent pixel, SDL will set the colorkey for the surface. You can enable RLE acceleration on the surface afterwards by calling: Surface.SetColorKey(image, SDL_RLEACCEL, image->format->colorkey);
There is a separate function to read files from an IOStream, if you need an i/o abstraction to provide data from anywhere instead of a simple filesystem read; that function is LoadSurface_IO().
If you are using SDL's 2D rendering API, there is an equivalent call to load images directly into an Texture for use by the GPU without using a software surface: call LoadTexture() instead.
| file | a path on the filesystem to load an image from. |
|
inline |
Load an image from an SDL data source into a texture.
An Texture represents an image in GPU memory, usable by SDL's 2D Render API. This can be significantly more efficient than using a CPU-bound Surface if you don't need to manipulate the image directly after loading it.
If the loaded image has transparency or a colorkey, a texture with an alpha channel will be created. Otherwise, SDL_image will attempt to create an Texture in the most format that most reasonably represents the image data (but in many cases, this will just end up being 32-bit RGB or 32-bit RGBA).
If closeio is true, src will be closed before returning, whether this function succeeds or not. SDL_image reads everything it needs from src during this call in any case.
There is a separate function to read files from disk without having to deal with IOStream: LoadTexture(renderer, "filename.jpg") will call this function and manage those details for you, determining the file type from the filename's extension.
There is also LoadTextureTyped_IO(), which is equivalent to this function except a file extension (like "BMP", "JPG", etc) can be specified, in case SDL_image cannot autodetect the file format.
If you would rather decode an image to an Surface (a buffer of pixels in CPU memory), call LoadSurface() instead.
| renderer | the Renderer to use to create the texture. |
| src | an IOStream that data will be read from. |
| closeio | true to close/free the IOStream before returning, false to leave it open. |
|
inline |
Load an image from a filesystem path into a texture.
An Texture represents an image in GPU memory, usable by SDL's 2D Render API. This can be significantly more efficient than using a CPU-bound Surface if you don't need to manipulate the image directly after loading it.
If the loaded image has transparency or a colorkey, a texture with an alpha channel will be created. Otherwise, SDL_image will attempt to create an Texture in the most format that most reasonably represents the image data (but in many cases, this will just end up being 32-bit RGB or 32-bit RGBA).
There is a separate function to read files from an IOStream, if you need an i/o abstraction to provide data from anywhere instead of a simple filesystem read; that function is LoadTexture_IO().
If you would rather decode an image to an Surface (a buffer of pixels in CPU memory), call LoadSurface() instead.
| renderer | the Renderer to use to create the texture. |
| file | a path on the filesystem to load an image from. |
|
constexpr |
No more frames available.
|
constexpr |
The decoder failed to decode a frame, call GetError() for more information.
|
constexpr |
The decoder is invalid.
|
constexpr |
The decoder is ready to decode the next frame.