img_convert_getfunc()

Get a function to convert one image format to another

Synopsis:

#include <img.h>

img_convert_f *img_convert_getfunc( img_format_t src,
                                    img_format_t dst )

Arguments:

src
The img_format_t image format to convert from
dst
The img_format_t image format to convert to.

Library:

img

Description:

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.

Returns:

IMG_ERR_OK
Success.
IMG_ERR_NOSUPPORT
One of the formats specified is invalid.

Classification:

Image library

Safety:
Interrupt handler No
Signal handler No
Thread No

See also:

img_convert_data(), IMG_FMT_BPL(), img_lib_attach()