Convert data from one image format to another
Synopsis:
#include <img/img.h>
int img_convert_data( img_format_t sformat,
const uint8_t* src,
img_format_t dformat,
uint8_t* dst,
size_t n );
Arguments:
- sformat
- The format of the data you are converting from; see
img_format_t.
- src
- A pointer to a buffer containing the source data.
- dformat
- The format you would like to convert the data to.
- dst
- A pointer to a buffer to store the converted data. This may point to a different buffer, or it can point to the same buffer as src, as long as you've ensured that the source buffer is large enough to store the converted data (the IMG_FMT_BPL() macro can help you with this).
- n
- The number of samples to convert.
Library:
libimg
Use the -l img option to
qcc
to link against this library.
Description:
This function converts data from one image format to another. The conversion may be done from one buffer to another, or in place.
Note:
The neither the destination nor the source formats can be a palette-based format (for example
IMG_FMT_PAL8 or
IMG_FMT_PAL4). Both must be
direct formats. See
img_expand_getfunc() to convert a palette-based image to a direct format.
If you're repeatedly converting data, it's better to call img_convert_getfunc() to get the conversion function, and then call the conversion function as required.
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 |