Tizen Native API
3.0
|
The Image Util Transform APIs provides functions for transfroming 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 to image util transform. | |
int | image_util_transform_set_hardware_acceleration (transformation_h handle, bool mode) |
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) |
Transform the image for given image util handle. | |
int | image_util_transform_destroy (transformation_h handle) |
Destroys a handle to image util. | |
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 Documentation
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.
- Since :
- 2.3
- Remarks:
- You must release the dst result using media_packet_destroy().
The callback is called in a separate thread(not in the main loop).
- Parameters:
-
[in] error_code The error code of image util transfrom [in,out] dst The result buffer of image util transform [in] user_data The user data passed from the callback registration function
- Precondition:
- image_util_transform_run() will invoke this function.
typedef struct transformation_s* transformation_h |
Image util handle.
- Since :
- 2.3
Enumeration Type Documentation
Function Documentation
int image_util_transform_create | ( | transformation_h * | handle | ) |
Creates a handle to image util transform.
- Since :
- 2.3
This function creates a handle to image util transform.
- Remarks:
- You must release the image util handle using image_util_transform_destroy().
- Parameters:
-
[out] handle A handle to image util 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_OUT_OF_MEMORY Out of memory IMAGE_UTIL_ERROR_PERMISSION_DENIED The application does not have the privilege to call this funtion
- See also:
- image_util_transform_destroy()
int image_util_transform_destroy | ( | transformation_h | handle | ) |
Destroys a handle to image util.
- Since :
- 2.3
The function frees all resources related to the image util handle. The image util handle no longer can be used to perform any operation. A new image util handle has to be created before the next usage.
- Parameters:
-
[in] handle The handle to image util 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_PERMISSION_DENIED The application does not have the privilege to call this funtion
- 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 to image util transform [in,out] colorspace The colorspace of the image buffer
- 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
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 to image util transform [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
- 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_PERMISSION_DENIED The application does not have the privilege to call this funtion
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 to image util transform [in,out] width The width of source image buffer [in,out] height The height of source image buffer
- 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_PERMISSION_DENIED The application does not have the privilege to call this funtion
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 to image util transform [in,out] rotation The rotation value of image buffer
- 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_PERMISSION_DENIED The application does not have the privilege to call this funtion
- Precondition:
- image_util_transform_create().
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 | ||
) |
Transform the image for given image util handle.
- Since :
- 2.3
- Remarks:
- If H/W acceleration is not set, transformation is done via S/W acceleration.
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, rotaion.
- Parameters:
-
[in] handle The handle of transform [in] src The handle to image util transform [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_PERMISSION_DENIED The application does not have the privilege to call this funtion
int image_util_transform_set_colorspace | ( | transformation_h | handle, |
image_util_colorspace_e | colorspace | ||
) |
Sets the information of the converting.
- Since :
- 2.3
- Parameters:
-
[in] handle The handle to image util transform [in] colorspace The colorspace of the image buffer
- 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_PERMISSION_DENIED The application does not have the privilege to call this funtion 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 cropping.
- 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 to image util transform [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
- 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_PERMISSION_DENIED The application does not have the privilege to call this funtion
- Precondition:
- image_util_transform_create().
int image_util_transform_set_hardware_acceleration | ( | transformation_h | handle, |
bool | mode | ||
) |
Sets the image util's accurate mode.
- Since :
- 2.3
This function set if you use hardware accerlation or not.
- Remarks:
- The value returned will be IMAGE_UTIL_ERROR_NOT_SUPPORTED, if H/W acceleration doesn't support on the device.
- Parameters:
-
[in] handle The handle to image util [in] mode Set true
, user can use the hardware acceleration
otherwise setfalse
if user can only software image processing
- 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_PERMISSION_DENIED The application does not have the privilege to call this funtion IMAGE_UTIL_ERROR_NOT_SUPPORTED The application does not have the hardware acceleration
- Precondition:
- image_util_transform_create().
int image_util_transform_set_resolution | ( | transformation_h | handle, |
unsigned int | width, | ||
unsigned int | height | ||
) |
Sets the information of the resizing.
- 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 to image util transform [in] width The width of image buffer [in] height The height of image buffer
- 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_PERMISSION_DENIED The application does not have the privilege to call this funtion
- Precondition:
- image_util_transform_create().
int image_util_transform_set_rotation | ( | transformation_h | handle, |
image_util_rotation_e | rotation | ||
) |
Sets the information of the rotating.
- Since :
- 2.3
- Parameters:
-
[in] handle The handle to image util transform [in] rotation The rotation value of image buffer
- 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_PERMISSION_DENIED The application does not have the privilege to call this funtion
- Precondition:
- image_util_transform_create().