Get a function to convert a palette format to a direct format
#include <img.h> img_expand_f *img_expand_getfunc( img_format_t src, img_format_t lut )
img
This function returns a pointer to a data conversion function (or NULL if the requested conversion is not supported) which you can call to “expand” (that is, convert) a run of pixels from a palette-based format src to a “direct” format in a lookup table lut. A conversion function takes the form:
void img_expand_f( const uint8 *src, uint8 *dst, unsigned n, const uint8 *lut);
Here is a sample procedure for converting from PAL8 to ARGB1555:
img_convert_data(IMG_FMT_PKHE_ARGB8888, palette, IMG_FMT_PKLE_ARGB1555, palette, npalette);
img_expand_getfunc(IMG_FMT_PAL8, IMG_FMT_PKLE_ARGB1555);
expand_f(sptr, dptr, npixels, palette);
Image library
Safety: | |
---|---|
Interrupt handler | No |
Signal handler | No |
Thread | No |
img_convert_data(), img_dtransform_create(), IMG_FMT_BPL(), img_lib_attach()