Tizen Native API
5.5
|
The Image Util Transform APIs provides functions for transforming of images .
#include <image_util.h>
Image Util API provides support for transforming of images. The API allows :
The API allows to transform(Colorspace conversion/Resize/Rotate/Crop) including convert the colorspace(image_util_colorspace_e) of an image by calling image_util_transform_run() function.
Functions | |
int | image_util_transform_create (transformation_h *handle) |
Creates a handle of image util transform. | |
int | image_util_transform_set_hardware_acceleration (transformation_h handle, bool mode) TIZEN_DEPRECATED_API |
Sets the image util's accurate mode. | |
int | image_util_transform_set_colorspace (transformation_h handle, image_util_colorspace_e colorspace) |
Sets the information of the converting. | |
int | image_util_transform_set_resolution (transformation_h handle, unsigned int width, unsigned int height) |
Sets the information of the resizing. | |
int | image_util_transform_set_rotation (transformation_h handle, image_util_rotation_e rotation) |
Sets the information of the rotating. | |
int | image_util_transform_set_crop_area (transformation_h handle, unsigned int start_x, unsigned int start_y, unsigned int end_x, unsigned int end_y) |
Sets the information of the cropping. | |
int | image_util_transform_get_colorspace (transformation_h handle, image_util_colorspace_e *colorspace) |
Gets the colorspace of the image buffer. | |
int | image_util_transform_get_resolution (transformation_h handle, unsigned int *width, unsigned int *height) |
Gets the resolution of the image buffer. | |
int | image_util_transform_get_rotation (transformation_h handle, image_util_rotation_e *rotation) |
Gets the information of the rotating. | |
int | image_util_transform_get_crop_area (transformation_h handle, unsigned int *start_x, unsigned int *start_y, unsigned int *end_x, unsigned int *end_y) |
Gets the information of the cropping. | |
int | image_util_transform_run (transformation_h handle, media_packet_h src, image_util_transform_completed_cb callback, void *user_data) |
Transforms the image for given image util handle. | |
int | image_util_transform_run2 (transformation_h handle, image_util_image_h src, image_util_image_h *dst) |
Synchronously transforms an image with the given transformation handle. | |
int | image_util_transform_run2_async (transformation_h handle, image_util_image_h src, image_util_transform_completed2_cb callback, void *user_data) |
Synchronously transforms an image with the given transformation handle. | |
int | image_util_transform_destroy (transformation_h handle) |
Destroys a handle to image util. | |
int | image_util_create_image (unsigned int width, unsigned int height, image_util_colorspace_e colorspace, const unsigned char *data, size_t data_size, image_util_image_h *image) |
Creates an image handle. | |
int | image_util_clone_image (image_util_image_h src, image_util_image_h *dst) |
Clones an image handle. | |
int | image_util_get_image (image_util_image_h image, unsigned int *width, unsigned int *height, image_util_colorspace_e *colorspace, unsigned char **data, size_t *data_size) |
Gets the information from the image. | |
int | image_util_destroy_image (image_util_image_h image) |
Destroys an image handle. | |
Typedefs | |
typedef struct transformation_s * | transformation_h |
Image util handle. | |
typedef void(* | image_util_transform_completed_cb )(media_packet_h *dst, int error_code, void *user_data) |
Called when transform is finished just before returning the output. | |
typedef void(* | image_util_transform_completed2_cb )(image_util_image_h dst, int error_code, void *user_data) |
Called when transforming an image is completed. |
typedef void(* image_util_transform_completed2_cb)(image_util_image_h dst, int error_code, void *user_data) |
Called when transforming an image is completed.
[in] | dst | The transformed image |
[in] | error_code | The error code of transformation |
[in] | user_data | The user data passed from the callback registration function |
typedef void(* image_util_transform_completed_cb)(media_packet_h *dst, int error_code, void *user_data) |
Called when transform is finished just before returning the output.
[in,out] | dst | The result buffer of image util transform |
[in] | error_code | The error code of image util transform |
[in] | user_data | The user data passed from the callback registration function |
typedef struct transformation_s* transformation_h |
Image util handle.
int image_util_clone_image | ( | image_util_image_h | src, |
image_util_image_h * | dst | ||
) |
Clones an image handle.
[in] | src | The handle of the image |
[out] | dst | A handle of the cloned image |
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_create_image | ( | unsigned int | width, |
unsigned int | height, | ||
image_util_colorspace_e | colorspace, | ||
const unsigned char * | data, | ||
size_t | data_size, | ||
image_util_image_h * | image | ||
) |
Creates an image handle.
[in] | width | The width of image |
[in] | height | The height of image |
[in] | colorspace | The colorspace of image |
[in] | data | The data of image |
[in] | data_size | The size of data |
[out] | image | A handle of image |
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_destroy_image | ( | image_util_image_h | image | ) |
Destroys an image handle.
The function frees all resources related to the @ image. The image handle no longer can be used to perform any operations. A new image handle has to be created before the next usage.
[in] | image | The handle of the image |
0
on success, otherwise a negative error valueIMAGE_UTIL_ERROR_NONE | Successful |
IMAGE_UTIL_ERROR_INVALID_PARAMETER | Invalid parameter |
int image_util_get_image | ( | image_util_image_h | image, |
unsigned int * | width, | ||
unsigned int * | height, | ||
image_util_colorspace_e * | colorspace, | ||
unsigned char ** | data, | ||
size_t * | data_size | ||
) |
Gets the information from the image.
[in] | image | The handle of the image |
[out] | width | The width of image |
[out] | height | The height of image |
[out] | colorspace | The colorspace of image |
[out] | data | The data of image |
[out] | data_size | The size of data |
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_transform_create | ( | transformation_h * | handle | ) |
Creates a handle of image util transform.
This function creates a handle of image util transform.
[out] | handle | The handle for transforming an image |
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_transform_destroy | ( | transformation_h | handle | ) |
Destroys a handle to image util.
The function frees all resources related to the image util handle. The image util handle no longer can be used to perform any operations. A new image util handle has to be created before the next usage.
[in] | handle | The handle for transforming an image |
0
on success, otherwise a negative error valueIMAGE_UTIL_ERROR_NONE | Successful |
IMAGE_UTIL_ERROR_INVALID_PARAMETER | Invalid parameter |
int image_util_transform_get_colorspace | ( | transformation_h | handle, |
image_util_colorspace_e * | colorspace | ||
) |
Gets the colorspace of the image buffer.
[in] | handle | The handle for transforming an image |
[in,out] | colorspace | The colorspace of the 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_transform_get_crop_area | ( | transformation_h | handle, |
unsigned int * | start_x, | ||
unsigned int * | start_y, | ||
unsigned int * | end_x, | ||
unsigned int * | end_y | ||
) |
Gets the information of the cropping.
[in] | handle | The handle for transforming an image |
[in,out] | start_x | The start x position of cropped source image buffer |
[in,out] | start_y | The start y position of cropped source image buffer |
[in,out] | end_x | The end x position of cropped source image buffer |
[in,out] | end_y | The end y position of cropped source 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_transform_get_resolution | ( | transformation_h | handle, |
unsigned int * | width, | ||
unsigned int * | height | ||
) |
Gets the resolution of the image buffer.
[in] | handle | The handle for transforming an image |
[in,out] | width | The width of source image buffer |
[in,out] | height | The height of source 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_transform_get_rotation | ( | transformation_h | handle, |
image_util_rotation_e * | rotation | ||
) |
Gets the information of the rotating.
[in] | handle | The handle for transforming an image |
[in,out] | rotation | The rotation value of 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_transform_run | ( | transformation_h | handle, |
media_packet_h | src, | ||
image_util_transform_completed_cb | callback, | ||
void * | user_data | ||
) |
Transforms the image for given image util handle.
The function execute asynchronously, which contains complete callback
If you set more than two transforming, the order of running is crop or resolution, colorspace converting, rotation.
[in] | handle | The handle for transforming an image |
[in] | src | The handle of source |
[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_transform_run2 | ( | transformation_h | handle, |
image_util_image_h | src, | ||
image_util_image_h * | dst | ||
) |
Synchronously transforms an image with the given transformation handle.
This function transforms an image synchronously using the src image handle, which has image information such as size, resolution.
A transformed image is stored into the dst image handle.
[in] | handle | The handle for transforming an image |
[in] | src | The handle of the src image |
[out] | dst | The transformed 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 |
int image_util_transform_run2_async | ( | transformation_h | handle, |
image_util_image_h | src, | ||
image_util_transform_completed2_cb | callback, | ||
void * | user_data | ||
) |
Synchronously transforms an image with the given transformation handle.
This function transforms an image asynchronously using the src image handle, which has image information such as size, resolution.
callback will be called after completing transform.
[in] | handle | The handle for transforming an image |
[in] | src | The handle of the src image |
[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 |
int image_util_transform_set_colorspace | ( | transformation_h | handle, |
image_util_colorspace_e | colorspace | ||
) |
Sets the information of the converting.
[in] | handle | The handle for transforming an image |
[in] | colorspace | The colorspace of the 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_transform_set_crop_area | ( | transformation_h | handle, |
unsigned int | start_x, | ||
unsigned int | start_y, | ||
unsigned int | end_x, | ||
unsigned int | end_y | ||
) |
Sets the information of the cropping.
[in] | handle | The handle for transforming an image |
[in] | start_x | The start x position of cropped image buffer |
[in] | start_y | The start y position of cropped image buffer |
[in] | end_x | The end x position of cropped image buffer |
[in] | end_y | The end y position of cropped 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_transform_set_hardware_acceleration | ( | transformation_h | handle, |
bool | mode | ||
) |
Sets the image util's accurate mode.
This function set if you use hardware acceleration or not.
[in] | handle | The handle for transforming an image |
[in] | mode | Set true , user can use the hardware accelerationotherwise set false if user can only software image processing |
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 | The application does not have the hardware acceleration |
int image_util_transform_set_resolution | ( | transformation_h | handle, |
unsigned int | width, | ||
unsigned int | height | ||
) |
Sets the information of the resizing.
[in] | handle | The handle for transforming an image |
[in] | width | The width of image buffer |
[in] | height | The height of 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_transform_set_rotation | ( | transformation_h | handle, |
image_util_rotation_e | rotation | ||
) |
Sets the information of the rotating.
[in] | handle | The handle for transforming an image |
[in] | rotation | The rotation value of 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 |