#include <mm_util_imgp.h>
#include <mm_util_jpeg.h>
-#include <mm_util_png.h>
#include <mm_util_gif.h>
#include <mm_util_magick.h>
#include <mm_util_image.h>
err = mm_util_decode_from_jpeg_memory(_handle->src_buffer, _handle->src_size, colorspace, downscale, image_info);
}
break;
- case IMAGE_UTIL_PNG:
- {
- if (_handle->path)
- err = mm_util_decode_from_png_file(_handle->path, image_info);
- else
- err = mm_util_decode_from_png_memory(_handle->src_buffer, _handle->src_size, image_info);
- }
- break;
case IMAGE_UTIL_GIF:
{
if (_handle->path)
err = mm_util_decode_from_gif_memory(_handle->src_buffer, _handle->src_size, image_info);
}
break;
+ case IMAGE_UTIL_PNG:
+ /* fall through */
case IMAGE_UTIL_BMP:
{
if (_handle->path)
}
break;
- case IMAGE_UTIL_PNG:
- ret = mm_util_decode_from_png_file(file_path, image);
- break;
-
case IMAGE_UTIL_GIF:
ret = mm_util_decode_from_gif_file(file_path, image);
break;
+ case IMAGE_UTIL_PNG:
+ /* fall through */
case IMAGE_UTIL_BMP:
ret = mm_util_decode_image_from_file(file_path, _handle->colorspace, image);
break;
ret = mm_util_decode_from_jpeg_memory((void *)buffer, buffer_size, colorspace, downscale, image);
}
break;
- case IMAGE_UTIL_PNG:
- ret = mm_util_decode_from_png_memory((void *)buffer, buffer_size, image);
- break;
+
case IMAGE_UTIL_GIF:
ret = mm_util_decode_from_gif_memory((void *)buffer, buffer_size, image);
break;
+
+ case IMAGE_UTIL_PNG:
+ /* fall through */
case IMAGE_UTIL_BMP:
ret = mm_util_decode_image_from_buffer((void *)buffer, buffer_size, _handle->colorspace, image);
break;
+
default:
image_util_error("Not supported format [%d]", image_type);
return IMAGE_UTIL_ERROR_INVALID_PARAMETER;
#include <mm_util_imgp.h>
#include <mm_util_jpeg.h>
-#include <mm_util_png.h>
#include <mm_util_gif.h>
#include <mm_util_magick.h>
#include <mm_util_image.h>
size_t dst_size;
gchar *path;
int quality;
- image_util_png_compression_e compression;
gif_encode_s gif_encode_info;
encode_cb_s *_encode_cb;
mm_util_enc_opt_h enc_opt;
_handle->dst_buffer = NULL;
_handle->path = NULL;
_handle->quality = 75;
- _handle->compression = IMAGE_UTIL_PNG_COMPRESSION_6;
err = mm_util_enc_opt_create(&_handle->enc_opt);
if (err != MM_UTIL_ERROR_NONE) {
encode_s *_handle = (encode_s *) handle;
image_util_retvm_if(!_handle, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle");
- IMAGE_UTIL_SUPPORT_TYPE_CHECK(_handle->image_type, IMAGE_UTIL_PNG);
- image_util_retvm_if((compression < IMAGE_UTIL_PNG_COMPRESSION_0 || compression > IMAGE_UTIL_PNG_COMPRESSION_9), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid compression value");
-
- _handle->compression = compression;
-
- return IMAGE_UTIL_ERROR_NONE;
+ return _image_error_capi(mm_util_enc_opt_set_png_compression(_handle->enc_opt, compression));
}
int image_util_encode_set_gif_frame_delay_time(image_util_encode_h handle, unsigned long long delay_time)
err = mm_util_encode_to_jpeg_memory(_src, _handle->quality, _handle->dst_buffer, &_handle->dst_size);
}
break;
- case IMAGE_UTIL_PNG:
- {
- if (_handle->path)
- err = mm_util_encode_to_png_file(_src, _handle->compression, _handle->path);
- else
- err = mm_util_encode_to_png_memory(_src, _handle->compression, _handle->dst_buffer, &_handle->dst_size);
- }
- break;
case IMAGE_UTIL_GIF:
{
image_util_debug("[Count] source_count:%u, buffer:%u, resolution:%u, delay:%u", _handle->gif_encode_info.source_count, _handle->gif_encode_info.current_buffer_count, _handle->gif_encode_info.current_resolution_count, _handle->gif_encode_info.current_delay_count);
err = mm_util_encode_to_gif_memory((mm_util_image_h *)_handle->gif_encode_info.sources, _handle->gif_encode_info.source_count, _handle->dst_buffer, &_handle->dst_size);
}
break;
+ case IMAGE_UTIL_PNG:
+ /* fall through */
case IMAGE_UTIL_BMP:
{
if (_handle->path)
ret = mm_util_jpeg_encode_to_file(image, _handle->quality, file_path);
break;
- case IMAGE_UTIL_PNG:
- ret = mm_util_encode_to_png_file(image, _handle->compression, file_path);
- break;
-
case IMAGE_UTIL_GIF:
ret = mm_util_encode_to_gif_file(&image, 1, file_path);
break;
+ case IMAGE_UTIL_PNG:
+ /* fall through */
case IMAGE_UTIL_BMP:
ret = mm_util_encode_image_to_file(image, _handle->enc_opt, file_path);
break;
ret = mm_util_encode_to_jpeg_memory(image, _handle->quality, (void **)buffer, buffer_size);
break;
- case IMAGE_UTIL_PNG:
- ret = mm_util_encode_to_png_memory(image, _handle->compression, (void **)buffer, buffer_size);
- break;
-
case IMAGE_UTIL_GIF:
ret = mm_util_encode_to_gif_memory(&image, 1, (void **)buffer, buffer_size);
break;
+ case IMAGE_UTIL_PNG:
+ /* fall through */
case IMAGE_UTIL_BMP:
ret = mm_util_encode_image_to_buffer(image, _handle->enc_opt, (void **)buffer, buffer_size);
break;