Tizen Native API
9.0
|
The Image Util Transform APIs provides functions for transforming of images .
Required Header
#include <image_util.h>
Overview
Image Util API provides support for transforming of images. The API allows :
- Image transformation(Colorspace conversion/Resize/Rotate/Crop) .
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_colorspace (transformation_h handle, image_util_colorspace_e colorspace) |
Sets the information of the colorspace to transform. | |
int | image_util_transform_set_resolution (transformation_h handle, unsigned int width, unsigned int height) |
Sets the information of the resolution to transform. | |
int | image_util_transform_set_rotation (transformation_h handle, image_util_rotation_e rotation) |
Sets the information of the rotation to transform. | |
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 crop area to transform. | |
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 an image using given handle. | |
int | image_util_transform_run2 (transformation_h handle, image_util_image_h src, image_util_image_h *dst) |
Synchronously transforms an image using given handle. | |
int | image_util_transform_run2_async (transformation_h handle, image_util_image_h src, image_util_transform_completed2_cb callback, void *user_data) |
Asynchronously 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_create_image_from_media_packet (media_packet_h media_packet, image_util_image_h *image) |
Creates an image handle from media packet. | |
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 |
The handle of image util transform. | |
typedef void(* | image_util_transform_completed_cb )(media_packet_h *dst, int error_code, void *user_data) |
Called when transforming an media packet 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. |
Typedef Documentation
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.
- Since :
- 5.5
- Remarks:
- The dst can be used only in the callback. To use outside, make a copy using image_util_clone_image().
The callback is called in a separate thread(not in the main loop).
- Parameters:
-
[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
- Precondition:
- image_util_transform_run2_async()
- See also:
- image_util_clone_image()
typedef void(* image_util_transform_completed_cb)(media_packet_h *dst, int error_code, void *user_data) |
Called when transforming an media packet is completed.
- Since :
- 2.3
- Remarks:
- The dst should be released using media_packet_destroy().
The callback is called in a separate thread(not in the main loop).
- Parameters:
-
[in] dst The transformed media packet handle [in] error_code The error code of image util transform [in] user_data The user data passed from the callback registration function
- Precondition:
- image_util_transform_run()
typedef struct transformation_s* transformation_h |
The handle of image util transform.
- Since :
- 2.3
Enumeration Type Documentation
Function Documentation
int image_util_clone_image | ( | image_util_image_h | src, |
image_util_image_h * | dst | ||
) |
Clones an image handle.
- Since :
- 5.5
- Remarks:
- The dst should be released using image_util_destroy_image().
- Parameters:
-
[in] src The handle of the image to clone [out] dst The handle of new image
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
IMAGE_UTIL_ERROR_NONE Successful IMAGE_UTIL_ERROR_INVALID_PARAMETER Invalid parameter IMAGE_UTIL_ERROR_OUT_OF_MEMORY Out of memory
- See also:
- image_util_destroy_image()
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.
- Since :
- 5.5
- Remarks:
- The image should be released using image_util_destroy_image().
- Parameters:
-
[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 The handle of image
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
IMAGE_UTIL_ERROR_NONE Successful IMAGE_UTIL_ERROR_INVALID_PARAMETER Invalid parameter IMAGE_UTIL_ERROR_OUT_OF_MEMORY Out of memory
- See also:
- image_util_destroy_image()
int image_util_create_image_from_media_packet | ( | media_packet_h | media_packet, |
image_util_image_h * | image | ||
) |
Creates an image handle from media packet.
- Since :
- 7.0
- Remarks:
- The image should be released using image_util_destroy_image().
- Parameters:
-
[in] media_packet The media_packet [out] image A handle of image
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
IMAGE_UTIL_ERROR_NONE Successful IMAGE_UTIL_ERROR_INVALID_PARAMETER Invalid parameter IMAGE_UTIL_ERROR_OUT_OF_MEMORY Out of memory
- See also:
- image_util_destroy_image()
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.
- Since :
- 5.5
- Parameters:
-
[in] image The handle of the image to destroy
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
IMAGE_UTIL_ERROR_NONE Successful IMAGE_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
- See also:
- image_util_create_image()
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.
The function get the information from the image. If you don't want to get specific information, you can pass unwanted parameters to NULL.
- Since :
- 5.5
- Remarks:
- The data should be released using free() if that's not NULL.
- Parameters:
-
[in] image The handle of the image to get the information [out] width The width of the image [out] height The height of the image [out] colorspace The colorspace of the image [out] data The data of image [out] data_size The size of data
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
IMAGE_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.
- Since :
- 2.3
- Remarks:
- The handle should be released using image_util_transform_destroy().
- Parameters:
-
[out] handle The handle of image util tranform
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
IMAGE_UTIL_ERROR_NONE Successful IMAGE_UTIL_ERROR_INVALID_PARAMETER Invalid parameter IMAGE_UTIL_ERROR_OUT_OF_MEMORY Out of memory
- See also:
- image_util_transform_destroy()
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.
- Since :
- 2.3
- Parameters:
-
[in] handle The handle of image util tranform
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
IMAGE_UTIL_ERROR_NONE Successful IMAGE_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
- See also:
- image_util_transform_create()
int image_util_transform_get_colorspace | ( | transformation_h | handle, |
image_util_colorspace_e * | colorspace | ||
) |
Gets the colorspace of the image buffer.
- Since :
- 2.3
- Parameters:
-
[in] handle The handle of image util tranform [in,out] colorspace The colorspace to transform
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
IMAGE_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
- Precondition:
- image_util_transform_create()
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.
- Since :
- 2.3
- Parameters:
-
[in] handle The handle of image util tranform [in,out] start_x The start x position to transform [in,out] start_y The start y position to transform [in,out] end_x The end x position to transform [in,out] end_y The end y position to transform
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
IMAGE_UTIL_ERROR_NONE Successful IMAGE_UTIL_ERROR_INVALID_PARAMETER Invalid parameter IMAGE_UTIL_ERROR_INVALID_OPERATION Invalid operation
- See also:
- image_util_transform_set_crop_area()
int image_util_transform_get_resolution | ( | transformation_h | handle, |
unsigned int * | width, | ||
unsigned int * | height | ||
) |
Gets the resolution of the image buffer.
- Since :
- 2.3
- Parameters:
-
[in] handle The handle of image util tranform [in,out] width The width to transform [in,out] height The height to transform
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
IMAGE_UTIL_ERROR_NONE Successful IMAGE_UTIL_ERROR_INVALID_PARAMETER Invalid parameter IMAGE_UTIL_ERROR_INVALID_OPERATION Invalid operation
- Precondition:
- image_util_transform_create()
int image_util_transform_get_rotation | ( | transformation_h | handle, |
image_util_rotation_e * | rotation | ||
) |
Gets the information of the rotating.
- Since :
- 2.3
- Parameters:
-
[in] handle The handle of image util tranform [in,out] rotation The rotation to transform
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
IMAGE_UTIL_ERROR_NONE Successful IMAGE_UTIL_ERROR_INVALID_PARAMETER Invalid parameter IMAGE_UTIL_ERROR_INVALID_OPERATION Invalid operation
- Precondition:
- image_util_transform_create().
image_util_transform_set_rotation().
- See also:
- image_util_transform_set_rotation()
int image_util_transform_run | ( | transformation_h | handle, |
media_packet_h | src, | ||
image_util_transform_completed_cb | callback, | ||
void * | user_data | ||
) |
Transforms an image using given handle.
This function transforms src media packet synchronously using the handle. If you set more than two transforming, the order of running is crop or resolution, colorspace converting, and rotation.
- Since :
- 2.3
- Parameters:
-
[in] handle The handle of image util tranform [in] src The handle of a source media packet [in] callback The callback function to be invoked [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 IMAGE_UTIL_ERROR_INVALID_OPERATION Invalid operation
- See also:
- image_util_transform_completed_cb()
int image_util_transform_run2 | ( | transformation_h | handle, |
image_util_image_h | src, | ||
image_util_image_h * | dst | ||
) |
Synchronously transforms an image using given handle.
This function transforms src image synchronously using the handle.
A transformed image is stored into the dst image handle.
- Since :
- 5.5
- Remarks:
- If transforming is failed, the dst will be null. The dst should be released using image_util_destroy_image().
- Parameters:
-
[in] handle The handle of image util tranform [in] src The handle of a source image [out] dst The transformed image
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
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
- Precondition:
- Create a transformation handle by calling image_util_transform_create().
-
Set the information to transform by calling image_util_transform_set_colorspace(), image_util_transform_set_resolution(),
image_util_transform_set_rotation(), image_util_transform_set_crop_area().
int image_util_transform_run2_async | ( | transformation_h | handle, |
image_util_image_h | src, | ||
image_util_transform_completed2_cb | callback, | ||
void * | user_data | ||
) |
Asynchronously transforms an image with the given transformation handle.
This function transforms src image asynchronously using the handle. callback will be invoked after transforming is completed.
- Since :
- 5.5
- Remarks:
- If transforming is failed, the dst of callback parameter will be null.
- Parameters:
-
[in] handle The handle of image util tranform [in] src The handle of a source image [in] callback The callback function to be invoked [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 IMAGE_UTIL_ERROR_INVALID_OPERATION Invalid operation IMAGE_UTIL_ERROR_OUT_OF_MEMORY Out of memory
- Precondition:
- Create a transformation handle by calling image_util_transform_create().
-
Set the transformation information by calling image_util_transform_set_colorspace(), image_util_transform_set_resolution(),
image_util_transform_set_rotation(), image_util_transform_set_crop_area().
- See also:
- image_util_transform_completed2_cb()
int image_util_transform_set_colorspace | ( | transformation_h | handle, |
image_util_colorspace_e | colorspace | ||
) |
Sets the information of the colorspace to transform.
- Since :
- 2.3
- Parameters:
-
[in] handle The handle for image util transform [in] colorspace The colorspace to transform
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
IMAGE_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
- Precondition:
- image_util_transform_create()
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 crop area to transform.
- Since :
- 2.3
- Remarks:
- image_util_transform_set_resolution() and image_util_transform_set_crop_area() can't do that at the same time.
- Parameters:
-
[in] handle The handle of image util tranform [in] start_x The start x position to transform [in] start_y The start y position to transform [in] end_x The end x position to transform [in] end_y The end y position to transform
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
IMAGE_UTIL_ERROR_NONE Successful IMAGE_UTIL_ERROR_INVALID_PARAMETER Invalid parameter IMAGE_UTIL_ERROR_INVALID_OPERATION Invalid operation
- Precondition:
- image_util_transform_create()
- See also:
- image_util_transform_get_crop_area()
int image_util_transform_set_resolution | ( | transformation_h | handle, |
unsigned int | width, | ||
unsigned int | height | ||
) |
Sets the information of the resolution to transform.
- Since :
- 2.3
- Remarks:
- image_util_transform_set_resolution() and image_util_transform_set_crop_area() can't do that at the same time.
- Parameters:
-
[in] handle The handle for image util transform [in] width The width to transform [in] height The height to transform
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
IMAGE_UTIL_ERROR_NONE Successful IMAGE_UTIL_ERROR_INVALID_PARAMETER Invalid parameter IMAGE_UTIL_ERROR_INVALID_OPERATION Invalid operation
- Precondition:
- image_util_transform_create()
int image_util_transform_set_rotation | ( | transformation_h | handle, |
image_util_rotation_e | rotation | ||
) |
Sets the information of the rotation to transform.
- Since :
- 2.3
- Parameters:
-
[in] handle The handle of image util tranform [in] rotation The rotation to transform
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
IMAGE_UTIL_ERROR_NONE Successful IMAGE_UTIL_ERROR_INVALID_PARAMETER Invalid parameter IMAGE_UTIL_ERROR_INVALID_OPERATION Invalid operation
- Precondition:
- image_util_transform_create()
- See also:
- image_util_transform_get_rotation()