* @retval #IMAGE_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
*
* @see image_util_transform_run()
-* @see image_util_decode_jpeg()
-* @see image_util_decode_jpeg_from_memory()
-* @see image_util_encode_jpeg()
-* @see image_util_encode_jpeg_to_memory()
*/
int image_util_calculate_buffer_size(int width, int height, image_util_colorspace_e colorspace , unsigned int *size);
*/
/**
-* @deprecated Deprecated since 3.0. Use image_util_supported_colorspace_cb() instead.
-* @brief Called once for each supported JPEG encode/decode colorspace.
-* @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
-*
-* @param[in] colorspace The colorspace
-* @param[in] user_data The user data passed from the foreach function
-*
-* @return @c true to continue with the next iteration of the loop, \n
-* otherwise @c false to break out of the loop
-*
-* @pre image_util_foreach_supported_jpeg_colorspace() invokes this callback.
-*
-* @see image_util_foreach_supported_jpeg_colorspace()
-* @see image_util_encode_jpeg()
-* @see image_util_encode_jpeg_to_memory()
-* @see image_util_decode_jpeg()
-* @see image_util_decode_jpeg_from_memory()
-*/
-typedef bool(*image_util_supported_jpeg_colorspace_cb)(image_util_colorspace_e colorspace, void *user_data);
-
-/**
-* @deprecated Deprecated since 3.0. Use image_util_foreach_supported_colorspace() instead.
-* @brief Retrieves all supported JPEG encoding/decoding colorspace by invoking a callback function once for each one.
-* @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
-*
-* @param[in] callback The callback function to invoke
-* @param[in] user_data The user data to be passed to the callback function
-* @return 0 on success,
-* otherwise a negative error value
-*
-* @retval #IMAGE_UTIL_ERROR_NONE Successful
-* @retval #IMAGE_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
-* @post This function invokes image_util_supported_jpeg_colorspace_cb() repeatedly to retrieve each supported JPEG encoding/decoding colorspace.
-*
-* @see image_util_supported_jpeg_colorspace_cb()
-* @see image_util_encode_jpeg()
-* @see image_util_encode_jpeg_to_memory()
-* @see image_util_decode_jpeg()
-* @see image_util_decode_jpeg_from_memory()
-*/
-int image_util_foreach_supported_jpeg_colorspace(image_util_supported_jpeg_colorspace_cb callback, void *user_data) TIZEN_DEPRECATED_API;
-
-/**
* @brief Called once for each supported image encode/decode colorspace.
* @since_tizen 3.0
*
int image_util_decode_destroy(image_util_decode_h handle);
/**
-* @deprecated Deprecated since 3.0. Use image_util_decode_create() instead.
-* @brief Decodes the JPEG image to the buffer.
-* @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
-*
-* @remarks The @a image_buffer should be released using free().\n
-* http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n
-* http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage.\n
-* If you decode the JPEG image which has odd numbered width or height to YUV colorspace, \n
-* the width or height of decoded data will be rounded down to even numbered width or height.
-*
-* @param[in] path The image file path
-* @param[in] colorspace The decoded image colorspace
-* @param[out] image_buffer The image buffer for the decoded image
-* @param[out] width The image width
-* @param[out] height The image height
-* @param[out] size The image buffer size
-*
-* @return @c 0 on success,
-* otherwise a negative error value
-*
-* @retval #IMAGE_UTIL_ERROR_NONE Successful
-* @retval #IMAGE_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
-* @retval #IMAGE_UTIL_ERROR_OUT_OF_MEMORY out of memory
-* @retval #IMAGE_UTIL_ERROR_NOT_SUPPORTED_FORMAT Format not supported
-* @retval #IMAGE_UTIL_ERROR_INVALID_OPERATION Invalid operation
-* @retval #IMAGE_UTIL_ERROR_PERMISSION_DENIED The application does not have the privilege to call this funtion
-*
-* @see image_util_supported_jpeg_colorspace_cb()
-* @see image_util_decode_jpeg_from_memory()
-* @see image_util_foreach_supported_jpeg_colorspace()
-*/
-int image_util_decode_jpeg(const char *path, image_util_colorspace_e colorspace, unsigned char **image_buffer, int *width, int *height, unsigned int *size) TIZEN_DEPRECATED_API;
-
-/**
-* @deprecated Deprecated since 3.0. Use image_util_decode_create() instead.
-* @brief Decodes the JPEG image(in memory) to the buffer.
-* @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
-*
-* @remarks The @a image_buffer should be released using free().\n
-* If you decode the JPEG image which has odd numbered width or height to YUV colorspace, \n
-* the width or height of decoded data will be rounded down to even numbered width or height.
-*
-* @param[in] jpeg_buffer The JPEG image buffer
-* @param[in] jpeg_size The JPEG image buffer size
-* @param[in] colorspace The decoded image colorspace
-* @param[out] image_buffer The image buffer for the decoded image
-* @param[out] width The image width
-* @param[out] height The image height
-* @param[out] size The image buffer size
-*
-* @return 0 on success,
-* otherwise a negative error value
-*
-* @retval #IMAGE_UTIL_ERROR_NONE Successful
-* @retval #IMAGE_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
-* @retval #IMAGE_UTIL_ERROR_OUT_OF_MEMORY out of memory
-* @retval #IMAGE_UTIL_ERROR_NOT_SUPPORTED_FORMAT Format not supported
-* @retval #IMAGE_UTIL_ERROR_INVALID_OPERATION Invalid operation
-* @retval #IMAGE_UTIL_ERROR_PERMISSION_DENIED The application does not have the privilege to call this funtion
-*
-* @see image_util_supported_jpeg_colorspace_cb()
-* @see image_util_decode_jpeg()
-* @see image_util_foreach_supported_jpeg_colorspace()
-*/
-int image_util_decode_jpeg_from_memory(const unsigned char *jpeg_buffer, int jpeg_size, image_util_colorspace_e colorspace, unsigned char **image_buffer, int *width, int *height, unsigned int *size) TIZEN_DEPRECATED_API;
-
-/**
-* @deprecated Deprecated since 3.0. Use image_util_decode_create() instead.
-* @brief Decodes the JPEG image to the buffer with downscale decoding option.
-* @since_tizen @if WEARABLE @else 2.4 @endif
-*
-* @remarks The @a image_buffer should be released using free().\n
-* http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n
-* http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage.\n
-* If you decode the JPEG image which has odd numbered width or height to YUV colorspace, \n
-* the width or height of decoded data will be rounded down to even numbered width or height.
-*
-* @param[in] path The image file path
-* @param[in] colorspace The decoded image colorspace
-* @param[in] downscale The downscale value
-* @param[out] image_buffer The image buffer for the decoded image
-* @param[out] width The image width
-* @param[out] height The image height
-* @param[out] size The image buffer size
-*
-* @return @c 0 on success,
-* otherwise a negative error value
-*
-* @retval #IMAGE_UTIL_ERROR_NONE Successful
-* @retval #IMAGE_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
-* @retval #IMAGE_UTIL_ERROR_OUT_OF_MEMORY out of memory
-* @retval #IMAGE_UTIL_ERROR_NOT_SUPPORTED_FORMAT Format not supported
-* @retval #IMAGE_UTIL_ERROR_INVALID_OPERATION Invalid operation
-* @retval #IMAGE_UTIL_ERROR_PERMISSION_DENIED The application does not have the privilege to call this funtion
-*
-* @see image_util_supported_jpeg_colorspace_cb()
-* @see image_util_decode_jpeg_from_memory()
-* @see image_util_foreach_supported_jpeg_colorspace()
-*/
-int image_util_decode_jpeg_with_downscale(const char *path, image_util_colorspace_e colorspace, image_util_scale_e downscale, unsigned char **image_buffer, int *width, int *height, unsigned int *size) TIZEN_DEPRECATED_API;
-
-/**
-* @deprecated Deprecated since 3.0. Use image_util_decode_create() instead.
-* @brief Decodes the JPEG image(in memory) to the buffer with downscale decoding option.
-* @since_tizen @if WEARABLE @else 2.4 @endif
-*
-* @remarks The @a image_buffer should be released using free().\n
-* If you decode the JPEG image which has odd numbered width or height to YUV colorspace, \n
-* the width or height of decoded data will be rounded down to even numbered width or height.
-*
-* @param[in] jpeg_buffer The JPEG image buffer
-* @param[in] jpeg_size The JPEG image buffer size
-* @param[in] colorspace The decoded image colorspace
-* @param[in] downscale The downscale value
-* @param[out] image_buffer The image buffer for the decoded image
-* @param[out] width The image width
-* @param[out] height The image height
-* @param[out] size The image buffer size
-*
-* @return @c 0 on success,
-* otherwise a negative error value
-*
-* @retval #IMAGE_UTIL_ERROR_NONE Successful
-* @retval #IMAGE_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
-* @retval #IMAGE_UTIL_ERROR_OUT_OF_MEMORY out of memory
-* @retval #IMAGE_UTIL_ERROR_NOT_SUPPORTED_FORMAT Format not supported
-* @retval #IMAGE_UTIL_ERROR_INVALID_OPERATION Invalid operation
-* @retval #IMAGE_UTIL_ERROR_PERMISSION_DENIED The application does not have the privilege to call this funtion
-*
-* @see image_util_supported_jpeg_colorspace_cb()
-* @see image_util_decode_jpeg()
-* @see image_util_foreach_supported_jpeg_colorspace()
-*/
-int image_util_decode_jpeg_from_memory_with_downscale(const unsigned char *jpeg_buffer, int jpeg_size, image_util_colorspace_e colorspace, image_util_scale_e downscale, unsigned char **image_buffer, int *width, int *height, unsigned int *size) TIZEN_DEPRECATED_API;
-
-/**
* @}
*/
int image_util_encode_destroy(image_util_encode_h handle);
/**
-* @deprecated Deprecated since 3.0. Use image_util_encode_create() instead.
-* @brief Encodes the image to the JPEG image.
-* @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
-*
-* @remarks http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n
-* http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage.
-*
-* @param[in] buffer The original image buffer
-* @param[in] width The original image width
-* @param[in] height The original image height
-* @param[in] colorspace The original image colorspace
-* @param[in] quality The quality for JPEG image encoding(1 ~ 100)
-* @param[in] path The file path to be created
-*
-* @return 0 on success,
-* otherwise a negative error value
-*
-* @retval #IMAGE_UTIL_ERROR_NONE Successful
-* @retval #IMAGE_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
-* @retval #IMAGE_UTIL_ERROR_NO_SUCH_FILE No such file
-* @retval #IMAGE_UTIL_ERROR_NOT_SUPPORTED_FORMAT Format not supported
-* @retval #IMAGE_UTIL_ERROR_INVALID_OPERATION Invalid operation
-* @retval #IMAGE_UTIL_ERROR_PERMISSION_DENIED The application does not have the privilege to call this funtion
-*
-* @see image_util_supported_jpeg_colorspace_cb()
-* @see image_util_foreach_supported_jpeg_colorspace()
-* @see image_util_encode_jpeg_to_memory()
-*/
-int image_util_encode_jpeg(const unsigned char *buffer, int width, int height, image_util_colorspace_e colorspace, int quality, const char *path) TIZEN_DEPRECATED_API;
-
-/**
-* @deprecated Deprecated since 3.0. Use image_util_encode_create() instead.
-* @brief Encodes the image to the JPEG image
-* @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
-*
-* @remarks The @a jpeg_buffer should be released using free().
-*
-* @param[in] image_buffer The original image buffer
-* @param[in] width The image width
-* @param[in] height The image height
-* @param[in] colorspace The original image colorspace
-* @param[in] quality The quality for JPEG image encoding(1 ~ 100)
-* @param[out] jpeg_buffer The created JPEG image buffer \n
-* The buffer is created by frameworks
-* @param[out] jpeg_size The created jpeg image buffer size
-*
-* @return 0 on success,
-* otherwise a negative error value
-*
-* @retval #IMAGE_UTIL_ERROR_NONE Successful
-* @retval #IMAGE_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
-* @retval #IMAGE_UTIL_ERROR_OUT_OF_MEMORY out of memory
-* @retval #IMAGE_UTIL_ERROR_NOT_SUPPORTED_FORMAT Format not supported
-* @retval #IMAGE_UTIL_ERROR_INVALID_OPERATION Invalid operation
-* @retval #IMAGE_UTIL_ERROR_PERMISSION_DENIED The application does not have the privilege to call this funtion
-*
-* @see image_util_supported_jpeg_colorspace_cb()
-* @see image_util_foreach_supported_jpeg_colorspace()
-* @see image_util_encode_jpeg()
-*/
-int image_util_encode_jpeg_to_memory(const unsigned char *image_buffer, int width, int height, image_util_colorspace_e colorspace, int quality, unsigned char **jpeg_buffer, unsigned int *jpeg_size) TIZEN_DEPRECATED_API;
-
-/**
* @}
*/
return IMAGE_UTIL_ERROR_NONE;
}
-int image_util_foreach_supported_jpeg_colorspace(image_util_supported_jpeg_colorspace_cb callback, void *user_data)
-{
- int idx = 0;
-
- DEPRECATION_LOGW("image_util_foreach_supported_jpeg_colorspace()", "image_util_foreach_supported_colorspace()");
-
- image_util_retvm_if((callback == NULL), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "callback is null");
-
- /* RGB has higher precedence than YUV */
- for (idx = (int)(NUM_OF_COLORSPACE - 1); idx >= 0; idx--) {
- if (is_supported_colorspace(idx, IMAGE_UTIL_JPEG))
- if (false == callback(idx, user_data))
- return IMAGE_UTIL_ERROR_NONE;
-
- }
-
- return IMAGE_UTIL_ERROR_NONE;
-}
-
int image_util_transform_create(transformation_h * handle)
{
int err = MM_UTIL_ERROR_NONE;
return IMAGE_UTIL_ERROR_NONE;
}
-
-int image_util_decode_jpeg(const char *path, image_util_colorspace_e colorspace, unsigned char **image_buffer, int *width, int *height, unsigned int *size)
-{
- DEPRECATION_LOGW("image_util_decode_jpeg()", "image_util_decode_create()");
-
- return image_util_decode_jpeg_with_downscale(path, colorspace, IMAGE_UTIL_DOWNSCALE_1_1, image_buffer, width, height, size);
-}
-
-int image_util_decode_jpeg_from_memory(const unsigned char *jpeg_buffer, int jpeg_size, image_util_colorspace_e colorspace, unsigned char **image_buffer, int *width, int *height, unsigned int *size)
-{
- DEPRECATION_LOGW("image_util_decode_jpeg_from_memory()", "image_util_decode_create()");
-
- return image_util_decode_jpeg_from_memory_with_downscale(jpeg_buffer, jpeg_size, colorspace, IMAGE_UTIL_DOWNSCALE_1_1, image_buffer, width, height, size);
-}
-
-int image_util_decode_jpeg_with_downscale(const char *path, image_util_colorspace_e colorspace, image_util_scale_e downscale, unsigned char **image_buffer, int *width, int *height, unsigned int *size)
-{
- int err = MM_UTIL_ERROR_NONE;
-
- DEPRECATION_LOGW("image_util_decode_jpeg_with_downscale()", "image_util_decode_create()");
-
- image_util_retvm_if((path == NULL), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "path is null");
- image_util_retvm_if((image_buffer == NULL), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "image_buffer is null");
- image_util_retvm_if((size == NULL), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "size is null");
- image_util_retvm_if((strlen(path) == 0), IMAGE_UTIL_ERROR_NO_SUCH_FILE, "Invalid path");
- image_util_retvm_if((is_valid_colorspace(colorspace) == FALSE), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid colorspace");
- image_util_retvm_if((is_supported_colorspace(colorspace, IMAGE_UTIL_JPEG) == FALSE), IMAGE_UTIL_ERROR_NOT_SUPPORTED_FORMAT, "not supported format");
- image_util_retvm_if((downscale < 0 || downscale >= _NUM_OF_SCALE), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "downsacle is invalid");
-
- mm_util_jpeg_yuv_data decoded;
- memset(&decoded, 0, sizeof(mm_util_jpeg_yuv_data));
-
- err = mm_util_decode_from_jpeg_file_with_downscale(path, TYPECAST_COLOR_BY_TYPE(colorspace, IMAGE_UTIL_JPEG), _convert_decode_scale_tbl[downscale], &decoded);
- if (err == MM_UTIL_ERROR_NONE) {
- *image_buffer = decoded.data;
- if (width)
- *width = decoded.width;
- if (height)
- *height = decoded.height;
- if (size)
- *size = decoded.size;
- }
- return _image_error_capi(ERR_TYPE_DECODE, err);
-}
-
-int image_util_decode_jpeg_from_memory_with_downscale(const unsigned char *jpeg_buffer, int jpeg_size, image_util_colorspace_e colorspace, image_util_scale_e downscale, unsigned char **image_buffer, int *width, int *height, unsigned int *size)
-{
- int err = MM_UTIL_ERROR_NONE;
-
- DEPRECATION_LOGW("image_util_decode_jpeg_from_memory_with_downscale()", "image_util_decode_create()");
-
- image_util_retvm_if((jpeg_buffer == NULL), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "jpeg_buffer is null");
- image_util_retvm_if((image_buffer == NULL), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "image_buffer is null");
- image_util_retvm_if((size == NULL), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "size is null");
- image_util_retvm_if((is_valid_colorspace(colorspace) == FALSE), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid colorspace");
- image_util_retvm_if((is_supported_colorspace(colorspace, IMAGE_UTIL_JPEG) == FALSE), IMAGE_UTIL_ERROR_NOT_SUPPORTED_FORMAT, "not supported format");
- image_util_retvm_if((downscale < 0 || downscale >= _NUM_OF_SCALE), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "downsacle is invalid");
-
- mm_util_jpeg_yuv_data decoded;
- memset(&decoded, 0, sizeof(mm_util_jpeg_yuv_data));
-
- err = mm_util_decode_from_jpeg_memory_with_downscale((void *)jpeg_buffer, (size_t)jpeg_size, TYPECAST_COLOR_BY_TYPE(colorspace, IMAGE_UTIL_JPEG), _convert_decode_scale_tbl[downscale], &decoded);
-
- if (err == MM_UTIL_ERROR_NONE) {
- *image_buffer = decoded.data;
- if (width)
- *width = decoded.width;
- if (height)
- *height = decoded.height;
- if (size)
- *size = decoded.size;
- }
-
- return _image_error_capi(ERR_TYPE_DECODE, err);
-}
return err;
}
-
-int image_util_encode_jpeg(const unsigned char *buffer, int width, int height, image_util_colorspace_e colorspace, int quality, const char *path)
-{
- int err = MM_UTIL_ERROR_NONE;
-
- DEPRECATION_LOGW("image_util_encode_jpeg()", "image_util_encode_create()");
-
- image_util_retvm_if((path == NULL), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "path is null");
- image_util_retvm_if((buffer == NULL), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "buffer is null");
- image_util_retvm_if((strlen(path) == 0), IMAGE_UTIL_ERROR_NO_SUCH_FILE, "Invalid path");
- image_util_retvm_if((is_valid_colorspace(colorspace) == FALSE), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid colorspace");
- image_util_retvm_if((is_supported_colorspace(colorspace, IMAGE_UTIL_JPEG) == FALSE), IMAGE_UTIL_ERROR_NOT_SUPPORTED_FORMAT, "not supported format");
-
- mm_util_jpeg_yuv_data decoded = {0, };
- decoded.width = width;
- decoded.height = height;
- decoded.format = TYPECAST_COLOR_BY_TYPE(colorspace, IMAGE_UTIL_JPEG);
- decoded.data = (void *)buffer;
-
- err = mm_util_jpeg_encode_to_file(&decoded, quality, path);
- return _image_error_capi(ERR_TYPE_ENCODE, err);
-}
-
-int image_util_encode_jpeg_to_memory(const unsigned char *image_buffer, int width, int height, image_util_colorspace_e colorspace, int quality, unsigned char **jpeg_buffer, unsigned int *jpeg_size)
-{
- int err = MM_UTIL_ERROR_NONE;
-
- DEPRECATION_LOGW("image_util_encode_jpeg_to_memory()", "image_util_encode_create()");
-
- image_util_retvm_if((jpeg_buffer == NULL), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "jpeg_buffer is null");
- image_util_retvm_if((image_buffer == NULL), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "image_buffer is null");
- image_util_retvm_if((jpeg_size == NULL), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "jpeg_size is null");
- image_util_retvm_if((is_valid_colorspace(colorspace) == FALSE), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid colorspace");
- image_util_retvm_if((is_supported_colorspace(colorspace, IMAGE_UTIL_JPEG) == FALSE), IMAGE_UTIL_ERROR_NOT_SUPPORTED_FORMAT, "not supported format");
-
- mm_util_jpeg_yuv_data decoded = {0, };
- decoded.width = width;
- decoded.height = height;
- decoded.format = TYPECAST_COLOR_BY_TYPE(colorspace, IMAGE_UTIL_JPEG);
- decoded.data = (void *)image_buffer;
-
- err = mm_util_jpeg_encode_to_memory(&decoded, quality, (void **)jpeg_buffer, (size_t *)jpeg_size);
- return _image_error_capi(ERR_TYPE_ENCODE, err);
-}
-