Adding initial structure for unittest
[platform/core/multimedia/libmm-utility.git] / magick / include / mm_util_magick.h
1 /*
2  * libmm-utility
3  *
4  * Copyright (c) 2018 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: YoungHun Kim <yh8004.kim@samsung.com>
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  *
20  */
21
22 #ifndef __MM_UTILITY_MAGICK_H__
23 #define __MM_UTILITY_MAGICK_H__
24
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28
29 #include "mm_util_type.h"
30
31 typedef void *mm_util_image_h;
32
33 /**
34  * Image rotation types
35  */
36 typedef enum {
37         MM_UTIL_ROTATE_0 = 0,               /**< Rotation 0 degree - no effect */
38         MM_UTIL_ROTATE_90 = 90,              /**< Rotation 90 degree */
39         MM_UTIL_ROTATE_180 = 180,             /**< Rotation 180 degree */
40         MM_UTIL_ROTATE_270 = 270,             /**< Rotation 270 degree */
41         MM_UTIL_ROTATE_FLIP_HORZ,       /**< Flip horizontal */
42         MM_UTIL_ROTATE_FLIP_VERT,       /**< Flip vertial */
43         MM_UTIL_ROTATE_NUM              /**< Number of rotation types */
44 } mm_util_magick_rotate_type;
45
46 typedef enum {
47         IMG_CODEC_GIF = 0,
48         IMG_CODEC_PNG,
49         IMG_CODEC_WBMP,
50         IMG_CODEC_JPEG,
51         IMG_CODEC_BMP,
52         IMG_CODEC_UNKNOWN_TYPE,
53 } mm_util_img_codec_type;
54
55 int mm_util_create_handle(mm_util_image_h *handle, const unsigned char *buffer, unsigned int width, unsigned int height, size_t size, mm_util_color_format_e format);
56
57 /*You must release buffer using free().*/
58 int mm_util_get_image(mm_util_image_h handle, unsigned char **buffer, unsigned int *width, unsigned int *height, size_t *size, mm_util_color_format_e *format);
59 int mm_util_destroy_handle(mm_util_image_h handle);
60
61 int mm_util_rotate_B_B(mm_util_image_h src_handle, mm_util_magick_rotate_type angle, mm_util_image_h *dst_handle);
62 int mm_util_rotate_B_P(mm_util_image_h src_handle, mm_util_magick_rotate_type angle, const char *dst_path);
63 int mm_util_rotate_P_B(const char *src_path, mm_util_magick_rotate_type angle, mm_util_color_format_e req_format, mm_util_image_h *dst_handle);
64 int mm_util_rotate_P_P(const char *src_path, mm_util_magick_rotate_type angle, const char *dst_path);
65
66 int mm_util_resize_B_B(mm_util_image_h src_handle, unsigned int req_width, unsigned int req_height, mm_util_image_h *dst_handle);
67 int mm_util_resize_B_P(mm_util_image_h src_handle, unsigned int req_width, unsigned int req_height, const char *dst_path);
68 int mm_util_resize_P_B(const char *src_path, unsigned int req_width, unsigned int req_height, mm_util_color_format_e req_format, mm_util_image_h *dst_handle);
69 int mm_util_resize_P_P(const char *src_path, unsigned int req_width, unsigned int req_height, const char *dst_path);
70
71 int mm_util_convert_B_B(mm_util_image_h src_handle, mm_util_color_format_e req_format, mm_util_image_h *dst_handle);
72
73 int mm_util_extract_image_info(const char *path, mm_util_img_codec_type *type, unsigned int *width, unsigned int *height);
74
75 #ifdef __cplusplus
76 }
77 #endif
78
79 #endif  /*__MM_UTILITY_MAGICK_H__*/