ImMedia repository contains the following decoders:
support format | |
---|---|
GIFLIB | gif |
libjpeg-turbo | jpeg |
libpng | png |
libwebp | webp |
qoi | qoi |
stb | bmp, jpg, pic, png, pnm, psd, tga |
To install an image decoder for immedia, you need to set up this struct:
struct ImageDecoder
{
void* (*CreateContextFromFile)(void* f, size_t file_size);
void* (*CreateContextFromData)(const uint8_t* data, size_t data_size);
void (*DeleteContext)(void* context);
void (*GetInfo)(void* context, int* width, int* height, PixelFormat* format, int* frame_count);
bool (*BeginReadFrame)(void* context, uint8_t** pixels, int* delay);
void (*EndReadFrame)(void* context);
};
For the functionality of each method, refer to comments.
Then, install decoder by ImMedia::InstallImageDecoder
ImMedia::InstallImageDecoder("format", your_decoder);