Get a function to convert one image format to another
#include <img.h> img_convert_f *img_convert_getfunc( img_format_t src, img_format_t dst )
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 convert a run of pixels from format src to format dst. The source and destination formats must be “direct” — palette-based formats are not supported. A conversion function takes the form:
void convert_f( const uint8_t *src, uint8_t *dst, unsigned n )
A conversion function is called to convert n pixels from the src buffer, writing the results in the dst buffer. The conversions can be done in place (that is, src can be the same as dst).
Use this function instead of img_convert_data() if you need to repeatedly convert data from one format to another. Calling img_convert_data() each time will add overhead because it has to get the conversion function each time its called. Using this function, you can just call the correct conversion function yourself directly.
Image library
Safety: | |
---|---|
Interrupt handler | No |
Signal handler | No |
Thread | No |
img_convert_data(), IMG_FMT_BPL(), img_lib_attach()