Tizen Native API
4.0
|
The Image Util Encode/Decode APIs provides functions for encoding and decoding of images .
Required Header
#include <image_util.h>
Overview
Image Util API provides support for encoding and decoding of images. The API allows :
- Encoding of a JPEG/PNG/GIF/BMP image.
- Decoding of a JPEG/PNG/GIF/BMP image. Encoding supports gif images including the animated, but decoding gif does not support the animated.
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 Operations
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_jpeg_colorspace (image_util_supported_jpeg_colorspace_cb callback, void *user_data) TIZEN_DEPRECATED_API |
Retrieves all supported JPEG encoding/decoding colorspace by invoking a callback function once for each one. | |
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. | |
Typedefs | |
typedef bool(* | image_util_supported_jpeg_colorspace_cb )(image_util_colorspace_e colorspace, void *user_data) |
Called once for each supported JPEG encode/decode colorspace. | |
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_encode_completed_cb )(int error_code, void *user_data, unsigned long long size) |
Called when Image-util encoding is finished just before returning the output. | |
typedef void * | image_util_decode_h |
Image-util decoding handle. | |
typedef void * | image_util_encode_h |
Image-util encoding handle. |
Typedef Documentation
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.
- Since :
- 3.0
- Remarks:
- The output will be stored in the pointer set using image_util_decode_set_output_buffer() after this callback.
The callback is called in a separate thread(not in the main loop).
- Parameters:
-
[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
- Precondition:
- image_util_decode_run() will invoke this function.
typedef void* image_util_decode_h |
Image-util decoding handle.
- Since :
- 3.0
typedef void(* image_util_encode_completed_cb)(int error_code, void *user_data, unsigned long long size) |
Called when Image-util encoding is finished just before returning the output.
- Since :
- 3.0
- Remarks:
- The output will be stored in the pointer set using image_util_encode_set_output_buffer() or image_util_encode_set_output_path() after this callback.
The callback is called in a separate thread(not in the main loop).
- Parameters:
-
[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
- Precondition:
- image_util_encode_run() will invoke this function.
typedef void* image_util_encode_h |
Image-util encoding handle.
- Since :
- 3.0
typedef bool(* image_util_supported_colorspace_cb)(image_util_colorspace_e colorspace, void *user_data) |
Called once for each supported image encode/decode colorspace.
- Since :
- 3.0
- Parameters:
-
[in] colorspace The colorspace [in] user_data The user data passed from the foreach function
- Returns:
true
to continue with the next iteration of the loop,
otherwisefalse
to break out of the loop
- Precondition:
- image_util_foreach_supported_colorspace() invokes this callback.
- See also:
- image_util_foreach_supported_colorspace()
- image_util_encode_create()
- image_util_decode_create()
typedef bool(* image_util_supported_jpeg_colorspace_cb)(image_util_colorspace_e colorspace, void *user_data) |
Called once for each supported JPEG encode/decode colorspace.
- Deprecated:
- Deprecated since 3.0. Use image_util_supported_colorspace_cb() instead.
- Since :
- 2.3
- Parameters:
-
[in] colorspace The colorspace [in] user_data The user data passed from the foreach function
- Returns:
true
to continue with the next iteration of the loop,
otherwisefalse
to break out of the loop
- Precondition:
- image_util_foreach_supported_jpeg_colorspace() invokes this callback.
- See also:
- image_util_foreach_supported_jpeg_colorspace()
- image_util_encode_jpeg()
- image_util_encode_jpeg_to_memory()
- image_util_decode_jpeg()
- image_util_decode_jpeg_from_memory()
Enumeration Type Documentation
Enumeration for PNG compression values.
- Since :
- 3.0
- Enumerator:
enum image_util_scale_e |
enum image_util_type_e |
Function Documentation
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.
- Since :
- 3.0
- Parameters:
-
[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
- Returns:
- 0 on success, otherwise a negative error value
- Return values:
-
IMAGE_UTIL_ERROR_NONE Successful IMAGE_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
- Postcondition:
- This function invokes image_util_supported_colorspace_cb() repeatedly to retrieve each supported image encoding/decoding colorspace.
- See also:
- image_util_supported_colorspace_cb()
- image_util_encode_create()
- image_util_decode_create()
int image_util_foreach_supported_jpeg_colorspace | ( | image_util_supported_jpeg_colorspace_cb | callback, |
void * | user_data | ||
) |
Retrieves all supported JPEG encoding/decoding colorspace by invoking a callback function once for each one.
- Deprecated:
- Deprecated since 3.0. Use image_util_foreach_supported_colorspace() instead.
- Since :
- 2.3
- Parameters:
-
[in] callback The callback function to invoke [in] user_data The user data to be passed to the callback function
- Returns:
- 0 on success, otherwise a negative error value
- Return values:
-
IMAGE_UTIL_ERROR_NONE Successful IMAGE_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
- Postcondition:
- This function invokes image_util_supported_jpeg_colorspace_cb() repeatedly to retrieve each supported JPEG encoding/decoding colorspace.
- See also:
- image_util_supported_jpeg_colorspace_cb()
- image_util_encode_jpeg()
- image_util_encode_jpeg_to_memory()
- image_util_decode_jpeg()
- image_util_decode_jpeg_from_memory()