Module dagon.resource.sdlimage

Image decoder that uses SDL2_Image.

Description

The dagon.resource.sdlimage module defines functionality for loading images via SDL2_Image, and converting SDL surfaces to GPU-ready texture buffers. The loader supports a wide range of formats (BMP, GIF, JPEG, PNG, QOI, TGA, TIFF, WEBP, AVIF, JXL, SVG, and more), and can handle pixel format conversion. It also creates a TextureImage object for compatibility with dlib.image`.

Functions

NameDescription
isSDLImageSupportedFormat(formatExtension) Checks if the given file extension is supported by SDL2_Image.
loadImageViaSDLImage(istrm, extension, asset) Loads an image from an input stream using SDL2_Image and fills a TextureAsset. Handles resizing (for SVG) and pixel format conversion, if needed. Creates asset.image if the image format is compatible with dlib.image. This function is preferred by DefaultTextureLoader if SDL2_Image is available.

Enums

NameDescription
ConversionHint Hints for pixel format conversion when loading images.

Global variables

NameTypeDescription
dlibImageSupportedFormats immutable(int[]) List of OpenGL internal formats supported by dlib.image.
sdlImageFormats immutable(char[][]) List of file extensions supported by SDL2_Image.