Tizen Native API
5.5
|
The Image Util Encode/Decode APIs provides functions for encoding and decoding of images .
#include <image_util.h>
Image Util API provides support for encoding and decoding of images. The API allows :
The decoding of a jpeg/png/gif/bmp image located at a given path, to a buffer can be done by calling image_util_decode_run() function and decoding of a jpeg image on memory can be done by calling image_util_decode_set_output_buffer(). Similarly, for encoding image_util_encode_run() and image_util_encode_set_output_buffer() functions can be called to encode an image buffer to a jpeg/png/gif/bmp image and a buffer respectively.
FOREACH | CALLBACK | DESCRIPTION |
---|---|---|
image_util_foreach_supported_colorspace() | image_util_supported_colorspace_cb() | Supported JPEG/PNG/GIF/BMP encoding/decoding colorspace |
Functions | |
int | image_util_foreach_supported_colorspace (image_util_type_e image_type, image_util_supported_colorspace_cb callback, void *user_data) |
Retrieves all supported image encoding/decoding colorspace by invoking a callback function once for each one. | |
int | image_util_decode_create (image_util_decode_h *handle) |
Creates a handle of image util decoding. | |
int | image_util_decode_set_input_path (image_util_decode_h handle, const char *path) |
Sets the input file path from which to decode. | |
int | image_util_decode_set_input_buffer (image_util_decode_h handle, const unsigned char *src_buffer, unsigned long long src_size) |
Sets the input buffer from which to decode. | |
int | image_util_decode_set_output_buffer (image_util_decode_h handle, unsigned char **dst_buffer) TIZEN_DEPRECATED_API |
Sets the output buffer to which the decoded buffer will be written to. | |
int | image_util_decode_set_colorspace (image_util_decode_h handle, image_util_colorspace_e colorspace) |
Sets the decoded image colorspace format. | |
int | image_util_decode_set_jpeg_downscale (image_util_decode_h handle, image_util_scale_e down_scale) |
Sets the downscale value at which JPEG image should be decoded. | |
int | image_util_decode_run (image_util_decode_h handle, unsigned long *width, unsigned long *height, unsigned long long *size) TIZEN_DEPRECATED_API |
Starts decoding of the image and fills the output buffer set using image_util_decode_set_output_buffer(). | |
int | image_util_decode_run_async (image_util_decode_h handle, image_util_decode_completed_cb callback, void *user_data) TIZEN_DEPRECATED_API |
Starts decoding of the image and fills the output buffer set using image_util_decode_set_output_buffer(). | |
int | image_util_decode_run2 (image_util_decode_h handle, image_util_image_h *image) |
Decodes the image with the given decode handle. | |
int | image_util_decode_run_async2 (image_util_decode_h handle, image_util_decode_completed2_cb callback, void *user_data) |
Starts decoding of the image with the given decode handle. | |
int | image_util_decode_destroy (image_util_decode_h handle) |
Destroys the image decoding handle. | |
int | image_util_encode_create (image_util_type_e image_type, image_util_encode_h *handle) |
Creates a handle of image util encoding. | |
int | image_util_encode_set_resolution (image_util_encode_h handle, unsigned long width, unsigned long height) TIZEN_DEPRECATED_API |
Sets the resolution of the encoded image. | |
int | image_util_encode_set_colorspace (image_util_encode_h handle, image_util_colorspace_e colorspace) TIZEN_DEPRECATED_API |
Sets the colorspace format for image encoding. | |
int | image_util_encode_set_quality (image_util_encode_h handle, int quality) |
Sets the quality for image encoding. | |
int | image_util_encode_set_png_compression (image_util_encode_h handle, image_util_png_compression_e compression) |
Sets the compression value of PNG image encoding(0~9). | |
int | image_util_encode_set_gif_frame_delay_time (image_util_encode_h handle, unsigned long long delay_time) TIZEN_DEPRECATED_API |
Sets the time delay between each frame in the encoded animated GIF image. | |
int | image_util_encode_set_input_buffer (image_util_encode_h handle, const unsigned char *src_buffer) TIZEN_DEPRECATED_API |
Sets the input buffer from which to encode. | |
int | image_util_encode_set_output_path (image_util_encode_h handle, const char *path) TIZEN_DEPRECATED_API |
Sets the output path to which to encoded buffer will be written to. | |
int | image_util_encode_set_output_buffer (image_util_encode_h handle, unsigned char **dst_buffer) TIZEN_DEPRECATED_API |
Sets the output buffer to which to encoded buffer will be written to. | |
int | image_util_encode_run (image_util_encode_h handle, unsigned long long *size) TIZEN_DEPRECATED_API |
Starts encoding of the image and fills the output buffer, set using image_util_encode_set_output_buffer() or image_util_encode_set_output_path(). | |
int | image_util_encode_run_async (image_util_encode_h handle, image_util_encode_completed_cb callback, void *user_data) TIZEN_DEPRECATED_API |
Starts encoding of the image and fills the output buffer, set using image_util_encode_set_output_buffer() or image_util_encode_set_output_path(). | |
int | image_util_encode_run_to_file (image_util_encode_h handle, image_util_image_h image, const char *file_path) |
Encodes the image and save it to a file in the given encoding handle. | |
int | image_util_encode_run_to_buffer (image_util_encode_h handle, image_util_image_h image, unsigned char **buffer, size_t *buffer_size) |
Encodes the image to save it to a buffer in the given encoding handle. | |
int | image_util_encode_run_async_to_file (image_util_encode_h handle, image_util_image_h image, const char *file_path, image_util_encode_to_file_completed_cb completed_cb, void *user_data) |
Encodes the image and save it to a file in the given encoding handle asynchronously. | |
int | image_util_encode_run_async_to_buffer (image_util_encode_h handle, image_util_image_h image, image_util_encode_to_buffer_completed_cb completed_cb, void *user_data) |
Encodes the image and save it to a buffer in the given encoding handle asynchronously. | |
int | image_util_encode_destroy (image_util_encode_h handle) |
Destroys the image encoding handle. | |
int | image_util_agif_encode_create (image_util_agif_encode_h *handle) |
Creates a handle for encoding an animated GIF. | |
int | image_util_agif_encode_add_frame (image_util_agif_encode_h handle, image_util_image_h image, unsigned int time_delay) |
Encodes an image and adds the encoded image to the frames of the animated GIF. | |
int | image_util_agif_encode_save_to_file (image_util_agif_encode_h handle, const char *file_path) |
Saves the animated GIF image to the file. | |
int | image_util_agif_encode_save_to_buffer (image_util_agif_encode_h handle, unsigned char **buffer, size_t *buffer_size) |
Saves the animated GIF image to the buffer. | |
int | image_util_agif_encode_destroy (image_util_agif_encode_h handle) |
Destroys the handle for encoding an animated GIF. | |
Typedefs | |
typedef bool(* | image_util_supported_colorspace_cb )(image_util_colorspace_e colorspace, void *user_data) |
Called once for each supported image encode/decode colorspace. | |
typedef void(* | image_util_decode_completed_cb )(int error_code, void *user_data, unsigned long width, unsigned long height, unsigned long long size) |
Called when Image-util decoding is finished just before returning the output. | |
typedef void(* | image_util_decode_completed2_cb )(int error_code, image_util_image_h image, void *user_data) |
Called when image_util_decode_run_async2() finishes decoding an image. | |
typedef void(* | image_util_encode_completed_cb )(int error_code, void *user_data, unsigned long long size) TIZEN_DEPRECATED_API |
Called when Image-util encoding is finished just before returning the output. | |
typedef void(* | image_util_encode_to_file_completed_cb )(image_util_error_e error_code, void *user_data) |
Called when image encoding is finished just after storing the output to the file. | |
typedef void(* | image_util_encode_to_buffer_completed_cb )(image_util_error_e error_code, unsigned char *buffer, size_t buffer_size, void *user_data) |
Called when image encoding is finished just after storing the output to the buffer. | |
typedef void * | image_util_decode_h |
Image-util decoding handle. | |
typedef void * | image_util_encode_h |
Image-util encoding handle. | |
typedef void * | image_util_agif_encode_h |
Image-util animation encoding handle. |
typedef void* image_util_agif_encode_h |
Image-util animation encoding handle.
typedef void(* image_util_decode_completed2_cb)(int error_code, image_util_image_h image, void *user_data) |
Called when image_util_decode_run_async2() finishes decoding an image.
[in] | error_code | The error code of image util decoding IMAGE_UTIL_ERROR_NONE Successful IMAGE_UTIL_ERROR_INVALID_PARAMETER Invalid parameter IMAGE_UTIL_ERROR_INVALID_OPERATION Invalid operation IMAGE_UTIL_ERROR_OUT_OF_MEMORY Out of memory IMAGE_UTIL_ERROR_NOT_SUPPORTED_FORMAT Format not supported |
[in] | image | The decoded image (or NULL if decoding failed) |
[in] | user_data | The user data passed from the callback registration function |
typedef void(* image_util_decode_completed_cb)(int error_code, void *user_data, unsigned long width, unsigned long height, unsigned long long size) |
Called when Image-util decoding is finished just before returning the output.
[in] | error_code | The error code of image util decoding IMAGE_UTIL_ERROR_NONE Successful IMAGE_UTIL_ERROR_INVALID_PARAMETER Invalid parameter IMAGE_UTIL_ERROR_INVALID_OPERATION Invalid operation |
[in] | user_data | The user data passed from the callback registration function |
[in] | width | Width of the decoded image |
[in] | height | Height of the decoded image |
[in] | size | Size of the decoded image |
typedef void* image_util_decode_h |
Image-util decoding handle.
typedef void(* image_util_encode_completed_cb)(int error_code, void *user_data, unsigned long long size) TIZEN_DEPRECATED_API |
Called when Image-util encoding is finished just before returning the output.
[in] | error_code | The error code of image util encoding IMAGE_UTIL_ERROR_NONE Successful IMAGE_UTIL_ERROR_INVALID_PARAMETER Invalid parameter IMAGE_UTIL_ERROR_INVALID_OPERATION Invalid operation |
[in] | user_data | The user data passed from the callback registration function |
[in] | size | Size of the encoded image |
typedef void* image_util_encode_h |
Image-util encoding handle.
typedef void(* image_util_encode_to_buffer_completed_cb)(image_util_error_e error_code, unsigned char *buffer, size_t buffer_size, void *user_data) |
Called when image encoding is finished just after storing the output to the buffer.
[in] | error_code | The error code of image util encoding IMAGE_UTIL_ERROR_NONE Successful IMAGE_UTIL_ERROR_INVALID_PARAMETER Invalid parameter IMAGE_UTIL_ERROR_INVALID_OPERATION Invalid operation IMAGE_UTIL_ERROR_OUT_OF_MEMORY Out of memory IMAGE_UTIL_ERROR_NOT_SUPPORTED_FORMAT Not supported format |
[in] | buffer | The buffer for the encoded image |
[in] | buffer_size | The size of the buffer for the encoded image |
[in] | user_data | The user data passed from the callback registration function |
typedef void(* image_util_encode_to_file_completed_cb)(image_util_error_e error_code, void *user_data) |
Called when image encoding is finished just after storing the output to the file.
[in] | error_code | The error code of image util encoding IMAGE_UTIL_ERROR_NONE Successful IMAGE_UTIL_ERROR_INVALID_PARAMETER Invalid parameter IMAGE_UTIL_ERROR_INVALID_OPERATION Invalid operation IMAGE_UTIL_ERROR_OUT_OF_MEMORY Out of memory IMAGE_UTIL_ERROR_NOT_SUPPORTED_FORMAT Not supported format |
[in] | user_data | The user data passed from the callback registration function |
typedef bool(* image_util_supported_colorspace_cb)(image_util_colorspace_e colorspace, void *user_data) |
Called once for each supported image encode/decode colorspace.
[in] | colorspace | The colorspace |
[in] | user_data | The user data passed from the foreach function |
true
to continue with the next iteration of the loop, false
to break out of the loopEnumeration for PNG compression values.
enum image_util_scale_e |
enum image_util_type_e |
int image_util_agif_encode_add_frame | ( | image_util_agif_encode_h | handle, |
image_util_image_h | image, | ||
unsigned int | time_delay | ||
) |
Encodes an image and adds the encoded image to the frames of the animated GIF.
[in] | handle | The handle of encoding an animated GIF |
[in] | image | The handle of the image for each frame |
[in] | time_delay | The time delay between image and the next image (in 0.01sec increments) |
0
on success, otherwise a negative error valueIMAGE_UTIL_ERROR_NONE | Successful |
IMAGE_UTIL_ERROR_NOT_SUPPORTED_FORMAT | Not supported format |
IMAGE_UTIL_ERROR_INVALID_PARAMETER | Invalid parameter |
IMAGE_UTIL_ERROR_INVALID_OPERATION | Invalid operation |
IMAGE_UTIL_ERROR_OUT_OF_MEMORY | Out of memory |
int image_util_agif_encode_create | ( | image_util_agif_encode_h * | handle | ) |
Creates a handle for encoding an animated GIF.
[out] | handle | The handle of encoding an animated GIF |
0
on success, otherwise a negative error valueIMAGE_UTIL_ERROR_NONE | Successful |
IMAGE_UTIL_ERROR_INVALID_PARAMETER | Invalid parameter |
IMAGE_UTIL_ERROR_OUT_OF_MEMORY | Out of memory |
int image_util_agif_encode_destroy | ( | image_util_agif_encode_h | handle | ) |
Destroys the handle for encoding an animated GIF.
[in] | handle | The handle of encoding an animated GIF |
0
on success, otherwise a negative error valueIMAGE_UTIL_ERROR_NONE | Successful |
IMAGE_UTIL_ERROR_INVALID_PARAMETER | Invalid parameter |
int image_util_agif_encode_save_to_buffer | ( | image_util_agif_encode_h | handle, |
unsigned char ** | buffer, | ||
size_t * | buffer_size | ||
) |
Saves the animated GIF image to the buffer.
After the data has been written to a buffer, the file cannot be modified. In other words,
it is not possible to add frames to the buffer.
However, the encoder can be still used after the data is written.
For example, although you write the data to one buffer(B0),
you can do the following operations:
1. Add frames 1-10 to the encoder.
2. Save the data in the encoder to another buffer(B1).
3. Add more frames (11-20) to the same encoder.
4. Save the data in the encoder to the other buffer (B2)
It is not possible to save the changed data to B1 file used in step 4.
[in] | handle | The handle of encoding an animated GIF |
[out] | buffer | The buffer in which the animated GIF is saved |
[out] | buffer_size | The size of the buffer |
0
on success, otherwise a negative error valueIMAGE_UTIL_ERROR_NONE | Successful |
IMAGE_UTIL_ERROR_INVALID_PARAMETER | Invalid parameter |
IMAGE_UTIL_ERROR_OUT_OF_MEMORY | Out of memory |
int image_util_agif_encode_save_to_file | ( | image_util_agif_encode_h | handle, |
const char * | file_path | ||
) |
Saves the animated GIF image to the file.
After the data has been written to a file, the file cannot be modified. In other words,
it is not possible to add frames to the file.
However, the encoder can be still used after the data is written.
For example, although you write the data to one file(B0),
you can do the following operations:
1. Add frames 1-10 to the encoder.
2. Save the data in the encoder to another file(B1).
3. Add more frames (11-20) to the same encoder.
4. Save the data in the encoder to the other file (B2)
It is not possible to save the changed data to B1 file used in step 4.
[in] | handle | The handle of encoding an animated GIF |
[in] | file_path | The file path for saving the animated GIF |
0
on success, otherwise a negative error valueIMAGE_UTIL_ERROR_NONE | Successful |
IMAGE_UTIL_ERROR_PERMISSION_DENIED | Permission denied |
IMAGE_UTIL_ERROR_INVALID_PARAMETER | Invalid parameter |
IMAGE_UTIL_ERROR_OUT_OF_MEMORY | Out of memory |
IMAGE_UTIL_ERROR_NO_SUCH_FILE | No such file |
int image_util_decode_create | ( | image_util_decode_h * | handle | ) |
Creates a handle of image util decoding.
This function creates a handle of image util decoding.
[out] | handle | The handle of image util decoding |
0
on success, otherwise a negative error valueIMAGE_UTIL_ERROR_NONE | Successful |
IMAGE_UTIL_ERROR_INVALID_PARAMETER | Invalid parameter |
IMAGE_UTIL_ERROR_OUT_OF_MEMORY | Out of memory |
int image_util_decode_destroy | ( | image_util_decode_h | handle | ) |
Destroys the image decoding handle.
[in] | handle | The handle of image util decoding |
0
on success, otherwise a negative error valueIMAGE_UTIL_ERROR_NONE | Successful |
IMAGE_UTIL_ERROR_INVALID_PARAMETER | Invalid parameter |
IMAGE_UTIL_ERROR_INVALID_OPERATION | Invalid operation |
int image_util_decode_run | ( | image_util_decode_h | handle, |
unsigned long * | width, | ||
unsigned long * | height, | ||
unsigned long long * | size | ||
) |
Starts decoding of the image and fills the output buffer set using image_util_decode_set_output_buffer().
[in] | handle | The handle of image util decoding |
[out] | width | Width of the decoded image |
[out] | height | Height of the decoded image |
[out] | size | Size of the decoded image |
0
on success, otherwise a negative error valueIMAGE_UTIL_ERROR_NONE | Successful |
IMAGE_UTIL_ERROR_INVALID_PARAMETER | Invalid parameter |
IMAGE_UTIL_ERROR_INVALID_OPERATION | Invalid operation |
int image_util_decode_run2 | ( | image_util_decode_h | handle, |
image_util_image_h * | image | ||
) |
Decodes the image with the given decode handle.
This function decodes the image synchronously.
NULL
.[in] | handle | The handle of image util decoding |
[out] | image | The decoded image |
0
on success, otherwise a negative error valueIMAGE_UTIL_ERROR_NONE | Successful |
IMAGE_UTIL_ERROR_INVALID_PARAMETER | Invalid parameter |
IMAGE_UTIL_ERROR_INVALID_OPERATION | Invalid operation |
IMAGE_UTIL_ERROR_OUT_OF_MEMORY | Out of memory |
IMAGE_UTIL_ERROR_NOT_SUPPORTED_FORMAT | Not supported format |
int image_util_decode_run_async | ( | image_util_decode_h | handle, |
image_util_decode_completed_cb | callback, | ||
void * | user_data | ||
) |
Starts decoding of the image and fills the output buffer set using image_util_decode_set_output_buffer().
[in] | handle | The handle of image util decoding |
[in] | callback | The callback function to be invoked |
[in] | user_data | The user data to be passed to the callback function |
0
on success, otherwise a negative error valueIMAGE_UTIL_ERROR_NONE | Successful |
IMAGE_UTIL_ERROR_INVALID_PARAMETER | Invalid parameter |
IMAGE_UTIL_ERROR_INVALID_OPERATION | Invalid operation |
int image_util_decode_run_async2 | ( | image_util_decode_h | handle, |
image_util_decode_completed2_cb | callback, | ||
void * | user_data | ||
) |
Starts decoding of the image with the given decode handle.
This function decodes the image asynchronously.
NULL
image and a non-zero error_code.[in] | handle | The handle of image util decoding |
[in] | callback | The callback function to be invoked |
[in] | user_data | The user data to be passed to the callback function |
0
on success, otherwise a negative error valueIMAGE_UTIL_ERROR_NONE | Successful |
IMAGE_UTIL_ERROR_INVALID_PARAMETER | Invalid parameter |
IMAGE_UTIL_ERROR_INVALID_OPERATION | Invalid operation |
IMAGE_UTIL_ERROR_OUT_OF_MEMORY | Out of memory |
IMAGE_UTIL_ERROR_NOT_SUPPORTED_FORMAT | Not supported format |
int image_util_decode_set_colorspace | ( | image_util_decode_h | handle, |
image_util_colorspace_e | colorspace | ||
) |
Sets the decoded image colorspace format.
[in] | handle | The handle of image util decoding |
[in] | colorspace | The decoded image colorspace |
0
on success, otherwise a negative error valueIMAGE_UTIL_ERROR_NONE | Successful |
IMAGE_UTIL_ERROR_INVALID_PARAMETER | Invalid parameter |
IMAGE_UTIL_ERROR_NOT_SUPPORTED_FORMAT | Not supported format |
int image_util_decode_set_input_buffer | ( | image_util_decode_h | handle, |
const unsigned char * | src_buffer, | ||
unsigned long long | src_size | ||
) |
Sets the input buffer from which to decode.
[in] | handle | The handle of image util decoding |
[in] | src_buffer | The input image buffer |
[in] | src_size | The input image buffer size |
0
on success, otherwise a negative error valueIMAGE_UTIL_ERROR_NONE | Successful |
IMAGE_UTIL_ERROR_INVALID_PARAMETER | Invalid parameter |
IMAGE_UTIL_ERROR_INVALID_OPERATION | Invalid operation |
IMAGE_UTIL_ERROR_OUT_OF_MEMORY | Out of memory |
IMAGE_UTIL_ERROR_NOT_SUPPORTED_FORMAT | Not supported format |
int image_util_decode_set_input_path | ( | image_util_decode_h | handle, |
const char * | path | ||
) |
Sets the input file path from which to decode.
[in] | handle | The handle of image util decoding |
[in] | path | The path to input image |
0
on success, otherwise a negative error valueIMAGE_UTIL_ERROR_NONE | Successful |
IMAGE_UTIL_ERROR_NO_SUCH_FILE | No such file |
IMAGE_UTIL_ERROR_INVALID_PARAMETER | Invalid parameter |
IMAGE_UTIL_ERROR_INVALID_OPERATION | Invalid operation |
IMAGE_UTIL_ERROR_PERMISSION_DENIED | The application does not have the privilege to call this function |
IMAGE_UTIL_ERROR_OUT_OF_MEMORY | Out of memory |
IMAGE_UTIL_ERROR_NOT_SUPPORTED_FORMAT | Not supported format |
int image_util_decode_set_jpeg_downscale | ( | image_util_decode_h | handle, |
image_util_scale_e | down_scale | ||
) |
Sets the downscale value at which JPEG image should be decoded.
[in] | handle | The handle of image util decoding |
[in] | down_scale | The downscale at which image is to be decoded |
0
on success, otherwise a negative error valueIMAGE_UTIL_ERROR_NONE | Successful |
IMAGE_UTIL_ERROR_INVALID_PARAMETER | Invalid parameter |
IMAGE_UTIL_ERROR_NOT_SUPPORTED_FORMAT | Not supported format |
int image_util_decode_set_output_buffer | ( | image_util_decode_h | handle, |
unsigned char ** | dst_buffer | ||
) |
Sets the output buffer to which the decoded buffer will be written to.
image_util_decode_run()
or image_util_decode_run_async()
.[in] | handle | The handle of image util decoding |
[in] | dst_buffer | The decoded output buffer |
0
on success, otherwise a negative error valueIMAGE_UTIL_ERROR_NONE | Successful |
IMAGE_UTIL_ERROR_INVALID_PARAMETER | Invalid parameter |
IMAGE_UTIL_ERROR_INVALID_OPERATION | Invalid operation |
int image_util_encode_create | ( | image_util_type_e | image_type, |
image_util_encode_h * | handle | ||
) |
Creates a handle of image util encoding.
This function creates a handle of image util encoding.
[in] | image_type | The type of output image for which to create encode handle. |
[out] | handle | The handle of image util encoding |
0
on success, otherwise a negative error valueIMAGE_UTIL_ERROR_NONE | Successful |
IMAGE_UTIL_ERROR_INVALID_PARAMETER | Invalid parameter |
IMAGE_UTIL_ERROR_OUT_OF_MEMORY | Out of memory |
int image_util_encode_destroy | ( | image_util_encode_h | handle | ) |
Destroys the image encoding handle.
[in] | handle | The handle of image util encoding |
0
on success, otherwise a negative error valueIMAGE_UTIL_ERROR_NONE | Successful |
IMAGE_UTIL_ERROR_INVALID_PARAMETER | Invalid parameter |
IMAGE_UTIL_ERROR_INVALID_OPERATION | Invalid operation |
int image_util_encode_run | ( | image_util_encode_h | handle, |
unsigned long long * | size | ||
) |
Starts encoding of the image and fills the output buffer, set using image_util_encode_set_output_buffer() or image_util_encode_set_output_path().
[in] | handle | The handle of image util encoding |
[out] | size | Size of the encoded image |
0
on success, otherwise a negative error valueIMAGE_UTIL_ERROR_NONE | Successful |
IMAGE_UTIL_ERROR_INVALID_PARAMETER | Invalid parameter |
IMAGE_UTIL_ERROR_INVALID_OPERATION | Invalid operation |
int image_util_encode_run_async | ( | image_util_encode_h | handle, |
image_util_encode_completed_cb | callback, | ||
void * | user_data | ||
) |
Starts encoding of the image and fills the output buffer, set using image_util_encode_set_output_buffer() or image_util_encode_set_output_path().
[in] | handle | The handle of image util encoding |
[in] | callback | The callback function to be invoked |
[in] | user_data | The user data to be passed to the callback function |
0
on success, otherwise a negative error valueIMAGE_UTIL_ERROR_NONE | Successful |
IMAGE_UTIL_ERROR_INVALID_PARAMETER | Invalid parameter |
IMAGE_UTIL_ERROR_INVALID_OPERATION | Invalid operation |
int image_util_encode_run_async_to_buffer | ( | image_util_encode_h | handle, |
image_util_image_h | image, | ||
image_util_encode_to_buffer_completed_cb | completed_cb, | ||
void * | user_data | ||
) |
Encodes the image and save it to a buffer in the given encoding handle asynchronously.
The output will be stored in a buffer provided by the completed_cb callback.
[in] | handle | The handle of image util encoding |
[in] | image | The image handle for encoding |
[in] | completed_cb | The callback function to be invoked |
[in] | user_data | The user data to be passed to the callback function |
0
on success, otherwise a negative error valueIMAGE_UTIL_ERROR_NONE | Successful |
IMAGE_UTIL_ERROR_INVALID_PARAMETER | Invalid parameter |
IMAGE_UTIL_ERROR_INVALID_OPERATION | Invalid operation |
IMAGE_UTIL_ERROR_OUT_OF_MEMORY | Out of memory |
int image_util_encode_run_async_to_file | ( | image_util_encode_h | handle, |
image_util_image_h | image, | ||
const char * | file_path, | ||
image_util_encode_to_file_completed_cb | completed_cb, | ||
void * | user_data | ||
) |
Encodes the image and save it to a file in the given encoding handle asynchronously.
The output will be stored in file_path. And the function executes asynchronously.
[in] | handle | The handle of image util encoding |
[in] | image | The image handle for encoding |
[in] | file_path | The file path for encoding image |
[in] | completed_cb | The callback function to be invoked |
[in] | user_data | The user data to be passed to the callback function |
0
on success, otherwise a negative error valueIMAGE_UTIL_ERROR_NONE | Successful |
IMAGE_UTIL_ERROR_PERMISSION_DENIED | Permission denied |
IMAGE_UTIL_ERROR_INVALID_PARAMETER | Invalid parameter |
IMAGE_UTIL_ERROR_INVALID_OPERATION | Invalid operation |
IMAGE_UTIL_ERROR_OUT_OF_MEMORY | Out of memory |
int image_util_encode_run_to_buffer | ( | image_util_encode_h | handle, |
image_util_image_h | image, | ||
unsigned char ** | buffer, | ||
size_t * | buffer_size | ||
) |
Encodes the image to save it to a buffer in the given encoding handle.
The function executes synchronously.
[in] | handle | The handle of image util encoding |
[in] | image | The image handle for encoding |
[out] | buffer | The buffer that encoded image is stored |
[out] | buffer_size | The size of the buffer |
0
on success, otherwise a negative error valueIMAGE_UTIL_ERROR_NONE | Successful |
IMAGE_UTIL_ERROR_NOT_SUPPORTED_FORMAT | Not supported format |
IMAGE_UTIL_ERROR_INVALID_PARAMETER | Invalid parameter |
IMAGE_UTIL_ERROR_INVALID_OPERATION | Invalid operation |
IMAGE_UTIL_ERROR_OUT_OF_MEMORY | Out of memory |
int image_util_encode_run_to_file | ( | image_util_encode_h | handle, |
image_util_image_h | image, | ||
const char * | file_path | ||
) |
Encodes the image and save it to a file in the given encoding handle.
The function executes synchronously.
[in] | handle | The handle of image util encoding |
[in] | image | The image handle for encoding |
[in] | file_path | The file path for encoding image |
0
on success, otherwise a negative error valueIMAGE_UTIL_ERROR_NONE | Successful |
IMAGE_UTIL_ERROR_NOT_SUPPORTED_FORMAT | Not supported format |
IMAGE_UTIL_ERROR_PERMISSION_DENIED | Permission denied |
IMAGE_UTIL_ERROR_INVALID_PARAMETER | Invalid parameter |
IMAGE_UTIL_ERROR_INVALID_OPERATION | Invalid operation |
IMAGE_UTIL_ERROR_OUT_OF_MEMORY | Out of memory |
int image_util_encode_set_colorspace | ( | image_util_encode_h | handle, |
image_util_colorspace_e | colorspace | ||
) |
Sets the colorspace format for image encoding.
[in] | handle | The handle of image util encoding |
[in] | colorspace | The colorspace of the input image to encode |
0
on success, otherwise a negative error valueIMAGE_UTIL_ERROR_NONE | Successful |
IMAGE_UTIL_ERROR_NOT_SUPPORTED_FORMAT | Not supported format |
IMAGE_UTIL_ERROR_INVALID_PARAMETER | Invalid parameter |
int image_util_encode_set_gif_frame_delay_time | ( | image_util_encode_h | handle, |
unsigned long long | delay_time | ||
) |
Sets the time delay between each frame in the encoded animated GIF image.
[in] | handle | The handle of image util encoding |
[in] | delay_time | Time delay between each frame in the encoded image, in 0.01sec units. |
0
on success, otherwise a negative error valueIMAGE_UTIL_ERROR_NONE | Successful |
IMAGE_UTIL_ERROR_NOT_SUPPORTED_FORMAT | Not supported format |
IMAGE_UTIL_ERROR_INVALID_PARAMETER | Invalid parameter |
int image_util_encode_set_input_buffer | ( | image_util_encode_h | handle, |
const unsigned char * | src_buffer | ||
) |
Sets the input buffer from which to encode.
[in] | handle | The handle of image util decoding |
[in] | src_buffer | The input image buffer |
0
on success, otherwise a negative error valueIMAGE_UTIL_ERROR_NONE | Successful |
IMAGE_UTIL_ERROR_INVALID_PARAMETER | Invalid parameter |
IMAGE_UTIL_ERROR_INVALID_OPERATION | Invalid operation |
int image_util_encode_set_output_buffer | ( | image_util_encode_h | handle, |
unsigned char ** | dst_buffer | ||
) |
Sets the output buffer to which to encoded buffer will be written to.
image_util_encode_run()
or image_util_encode_run_async()
.[in] | handle | The handle of image util encoding |
[in] | dst_buffer | The output image buffer |
0
on success, otherwise a negative error valueIMAGE_UTIL_ERROR_NONE | Successful |
IMAGE_UTIL_ERROR_INVALID_PARAMETER | Invalid parameter |
IMAGE_UTIL_ERROR_INVALID_OPERATION | Invalid operation |
IMAGE_UTIL_ERROR_NOT_SUPPORTED_FORMAT | Not supported format |
int image_util_encode_set_output_path | ( | image_util_encode_h | handle, |
const char * | path | ||
) |
Sets the output path to which to encoded buffer will be written to.
[in] | handle | The handle of image util encoding |
[in] | path | The output file path |
0
on success, otherwise a negative error valueIMAGE_UTIL_ERROR_NONE | Successful |
IMAGE_UTIL_ERROR_PERMISSION_DENIED | The application does not have the privilege to call this function |
IMAGE_UTIL_ERROR_INVALID_PARAMETER | Invalid parameter |
IMAGE_UTIL_ERROR_INVALID_OPERATION | Invalid operation |
IMAGE_UTIL_ERROR_NO_SUCH_FILE | No such file |
int image_util_encode_set_png_compression | ( | image_util_encode_h | handle, |
image_util_png_compression_e | compression | ||
) |
Sets the compression value of PNG image encoding(0~9).
[in] | handle | The handle of image util encoding |
[in] | compression | The compression value valid from 0~9 |
0
on success, otherwise a negative error valueIMAGE_UTIL_ERROR_NONE | Successful |
IMAGE_UTIL_ERROR_NOT_SUPPORTED_FORMAT | Not supported format |
IMAGE_UTIL_ERROR_INVALID_PARAMETER | Invalid parameter |
IMAGE_UTIL_ERROR_INVALID_OPERATION | Invalid operation |
int image_util_encode_set_quality | ( | image_util_encode_h | handle, |
int | quality | ||
) |
Sets the quality for image encoding.
[in] | handle | The handle of image util encoding |
[in] | quality | Encoding quality from 1~100 |
0
on success, otherwise a negative error valueIMAGE_UTIL_ERROR_NONE | Successful |
IMAGE_UTIL_ERROR_NOT_SUPPORTED_FORMAT | Not supported format |
IMAGE_UTIL_ERROR_INVALID_PARAMETER | Invalid parameter |
int image_util_encode_set_resolution | ( | image_util_encode_h | handle, |
unsigned long | width, | ||
unsigned long | height | ||
) |
Sets the resolution of the encoded image.
[in] | handle | The handle of image util encoding |
[in] | width | Width of the original image |
[in] | height | Height of the original image |
0
on success, otherwise a negative error valueIMAGE_UTIL_ERROR_NONE | Successful |
IMAGE_UTIL_ERROR_INVALID_PARAMETER | Invalid parameter |
IMAGE_UTIL_ERROR_INVALID_OPERATION | Invalid operation |
int image_util_foreach_supported_colorspace | ( | image_util_type_e | image_type, |
image_util_supported_colorspace_cb | callback, | ||
void * | user_data | ||
) |
Retrieves all supported image encoding/decoding colorspace by invoking a callback function once for each one.
[in] | image_type | The type of supported image for which to create encode/decode handle |
[in] | callback | The callback function to invoke |
[in] | user_data | The user data to be passed to the callback function |
IMAGE_UTIL_ERROR_NONE | Successful |
IMAGE_UTIL_ERROR_INVALID_PARAMETER | Invalid parameter |