summaryrefslogtreecommitdiff
path: root/src/lib/emile
diff options
context:
space:
mode:
authorCedric BAIL <cedric@osg.samsung.com>2015-03-17 08:50:30 +0100
committerCedric BAIL <cedric@osg.samsung.com>2015-03-17 09:58:19 +0100
commit2cd4e1764d69ac3455cf3267102f48597c739240 (patch)
treea9b5d1f451ba0604bf49d632308c3d2d49509c04 /src/lib/emile
parent4095519d653172aa7b7fa916def28b315721233e (diff)
emile: split headers.
Diffstat (limited to 'src/lib/emile')
-rw-r--r--src/lib/emile/Emile.h227
-rw-r--r--src/lib/emile/emile_cipher.h48
-rw-r--r--src/lib/emile/emile_compression.h28
-rw-r--r--src/lib/emile/emile_image.h159
4 files changed, 238 insertions, 224 deletions
diff --git a/src/lib/emile/Emile.h b/src/lib/emile/Emile.h
index b092f42ea8..617a45802f 100644
--- a/src/lib/emile/Emile.h
+++ b/src/lib/emile/Emile.h
@@ -106,230 +106,9 @@ EAPI int emile_shutdown(void);
106 * @} 106 * @}
107 */ 107 */
108 108
109typedef struct _Emile_SSL Emile_SSL; 109#include "emile_cipher.h"
110 110#include "emile_compression.h"
111typedef enum 111#include "emile_image.h"
112{
113 EMILE_SSLv23,
114 EMILE_SSLv3,
115 EMILE_TLSv1
116} Emile_Cipher_Type;
117
118typedef enum
119{
120 EMILE_WANT_NOTHING = 0,
121 EMILE_WANT_READ = 1,
122 EMILE_WANT_WRITE = 3
123} Emile_Want_Type;
124
125EAPI Eina_Bool emile_cipher_init(void);
126EAPI const char *emile_cipher_module_get(void);
127
128EAPI Eina_Binbuf *emile_binbuf_cipher(const Eina_Binbuf *in,
129 const char *key, unsigned int length);
130
131EAPI Eina_Binbuf *emile_binbuf_decipher(const Eina_Binbuf *in,
132 const char *key, unsigned int length);
133
134EAPI Emile_SSL *emile_cipher_server_listen(Emile_Cipher_Type t);
135EAPI Emile_SSL *emile_cipher_client_connect(Emile_SSL *server, int fd);
136EAPI Emile_SSL *emile_cipher_server_connect(Emile_Cipher_Type t);
137EAPI Eina_Bool emile_cipher_free(Emile_SSL *emile);
138
139EAPI Eina_Bool emile_cipher_cafile_add(Emile_SSL *emile, const char *file);
140EAPI Eina_Bool emile_cipher_cert_add(Emile_SSL *emile, const char *file);
141EAPI Eina_Bool emile_cipher_privkey_add(Emile_SSL *emile, const char *file);
142EAPI Eina_Bool emile_cipher_crl_add(Emile_SSL *emile, const char *file);
143EAPI int emile_cipher_read(Emile_SSL *emile, Eina_Binbuf *buffer);
144EAPI int emile_cipher_write(Emile_SSL *emile, const Eina_Binbuf *buffer);
145EAPI const char *emile_cipher_error_get(const Emile_SSL *emile);
146EAPI Eina_Bool emile_cipher_verify_name_set(Emile_SSL *emile, const char *name);
147EAPI const char *emile_cipher_verify_name_get(const Emile_SSL *emile);
148EAPI void emile_cipher_verify_set(Emile_SSL *emile, Eina_Bool verify);
149EAPI void emile_cipher_verify_basic_set(Emile_SSL *emile, Eina_Bool verify_basic);
150EAPI Eina_Bool emile_cipher_verify_get(const Emile_SSL *emile);
151EAPI Eina_Bool emile_cipher_verify_basic_get(const Emile_SSL *emile);
152
153typedef enum
154{
155 EMILE_ZLIB,
156 EMILE_LZ4,
157 EMILE_LZ4HC
158} Emile_Compressor_Type;
159
160typedef enum
161{
162 EMILE_DEFAULT = -1,
163 EMILE_NO_COMPRESSION = 0,
164 EMILE_FAST_COMPRESSION = 1,
165 EMILE_BEST_COMPRESSION = 9
166} Emile_Compressor_Level;
167
168EAPI Eina_Binbuf *emile_binbuf_compress(const Eina_Binbuf *in,
169 Emile_Compressor_Type t, int level);
170EAPI Eina_Binbuf *emile_binbuf_uncompress(const Eina_Binbuf *in,
171 Emile_Compressor_Type t,
172 unsigned int dest_length);
173EAPI Eina_Bool emile_binbuf_expand(const Eina_Binbuf *in,
174 Eina_Binbuf *out,
175 Emile_Compressor_Type t);
176
177/* All the value from below enum should be the same as in Evas_Loader.h */
178typedef enum _Emile_Colorspace
179{
180 EMILE_COLORSPACE_ARGB8888,/**< ARGB 32 bits per pixel, high-byte is Alpha, accessed 1 32bit word at a time */
181 EMILE_COLORSPACE_YCBCR422P601_PL, /**< YCbCr 4:2:2 Planar, ITU.BT-601 specifications. The data pointed to is just an array of row pointer, pointing to the Y rows, then the Cb, then Cr rows */
182 EMILE_COLORSPACE_YCBCR422P709_PL, /**< YCbCr 4:2:2 Planar, ITU.BT-709 specifications. The data pointed to is just an array of row pointer, pointing to the Y rows, then the Cb, then Cr rows */
183 EMILE_COLORSPACE_RGB565_A5P, /**< 16bit rgb565 + Alpha plane at end - 5 bits of the 8 being used per alpha byte */
184 EMILE_COLORSPACE_GRY8 = 4,
185 EMILE_COLORSPACE_YCBCR422601_PL, /**< YCbCr 4:2:2, ITU.BT-601 specifications. The data pointed to is just an array of row pointer, pointing to line of Y,Cb,Y,Cr bytes */
186 EMILE_COLORSPACE_YCBCR420NV12601_PL, /**< YCbCr 4:2:0, ITU.BT-601 specification. The data pointed to is just an array of row pointer, pointing to the Y rows, then the Cb,Cr rows. */
187 EMILE_COLORSPACE_YCBCR420TM12601_PL, /**< YCbCr 4:2:0, ITU.BT-601 specification. The data pointed to is just an array of tiled row pointer, pointing to the Y rows, then the Cb,Cr rows. */
188 EMILE_COLORSPACE_AGRY88 = 8, /**< AY 8bits Alpha and 8bits Grey, accessed 1 16bits at a time */
189 EMILE_COLORSPACE_ETC1 = 9, /**< OpenGL ETC1 encoding of RGB texture (4 bit per pixel) @since 1.10 */
190 EMILE_COLORSPACE_RGB8_ETC2 = 10, /**< OpenGL GL_COMPRESSED_RGB8_ETC2 texture compression format (4 bit per pixel) @since 1.10 */
191 EMILE_COLORSPACE_RGBA8_ETC2_EAC = 11, /**< OpenGL GL_COMPRESSED_RGBA8_ETC2_EAC texture compression format, supports alpha (8 bit per pixel) @since 1.10 */
192 EMILE_COLORSPACE_ETC1_ALPHA = 12, /**< ETC1 with alpha support using two planes: ETC1 RGB and ETC1 grey for alpha @since 1.11 */
193 EMILE_COLORSPACE_RGB_S3TC_DXT1 = 13, /**< OpenGL COMPRESSED_RGB_S3TC_DXT1_EXT format with RGB only. @since 1.11 */
194 EMILE_COLORSPACE_RGBA_S3TC_DXT1 = 14, /**< OpenGL COMPRESSED_RGBA_S3TC_DXT1_EXT format with RGBA punchthrough. @since 1.11 */
195 EMILE_COLORSPACE_RGBA_S3TC_DXT2 = 15, /**< DirectDraw DXT2 format with premultiplied RGBA. Not supported by OpenGL itself. @since 1.11 */
196 EMILE_COLORSPACE_RGBA_S3TC_DXT3 = 16, /**< OpenGL COMPRESSED_RGBA_S3TC_DXT3_EXT format with RGBA. @since 1.11 */
197 EMILE_COLORSPACE_RGBA_S3TC_DXT4 = 17, /**< DirectDraw DXT4 format with premultiplied RGBA. Not supported by OpenGL itself. @since 1.11 */
198 EMILE_COLORSPACE_RGBA_S3TC_DXT5 = 18 /**< OpenGL COMPRESSED_RGBA_S3TC_DXT5_EXT format with RGBA. @since 1.11 */
199} Emile_Colorspace;
200
201typedef enum _Emile_Image_Encoding
202{
203 EMILE_IMAGE_LOSSLESS = 0,
204 EMILE_IMAGE_JPEG = 1,
205 EMILE_IMAGE_ETC1 = 2,
206 EMILE_IMAGE_ETC2_RGB = 3,
207 EMILE_IMAGE_ETC2_RGBA = 4,
208 EMILE_IMAGE_ETC1_ALPHA = 5
209} Emile_Image_Encoding;
210
211typedef enum _Emile_Image_Scale_Hint
212{
213 EMILE_IMAGE_SCALE_HINT_NONE = 0, /**< No scale hint at all */
214 EMILE_IMAGE_SCALE_HINT_DYNAMIC = 1, /**< Image is being re-scaled over time, thus turning scaling cache @b off for its data */
215 EMILE_IMAGE_SCALE_HINT_STATIC = 2 /**< Image is not being re-scaled over time, thus turning scaling cache @b on for its data */
216} Emile_Image_Scale_Hint;
217
218typedef enum _Emile_Image_Animated_Loop_Hint
219{
220 EMILE_IMAGE_ANIMATED_HINT_NONE = 0,
221 EMILE_IMAGE_ANIMATED_HINT_LOOP = 1,
222 EMILE_IMAGE_ANIMATED_HINT_PINGPONG = 2
223} Emile_Image_Animated_Loop_Hint;
224
225typedef enum _Emile_Image_Load_Error
226{
227 EMILE_IMAGE_LOAD_ERROR_NONE = 0, /**< No error on load */
228 EMILE_IMAGE_LOAD_ERROR_GENERIC = 1, /**< A non-specific error occurred */
229 EMILE_IMAGE_LOAD_ERROR_DOES_NOT_EXIST = 2, /**< File (or file path) does not exist */
230 EMILE_IMAGE_LOAD_ERROR_PERMISSION_DENIED = 3, /**< Permission denied to an existing file (or path) */
231 EMILE_IMAGE_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED = 4, /**< Allocation of resources failure prevented load */
232 EMILE_IMAGE_LOAD_ERROR_CORRUPT_FILE = 5, /**< File corrupt (but was detected as a known format) */
233 EMILE_IMAGE_LOAD_ERROR_UNKNOWN_FORMAT = 6 /**< File is not a known format */
234} Emile_Image_Load_Error; /**< Emile image load error codes one can get - see emile_load_error_str() too. */
235
236typedef struct _Emile_Image Emile_Image;
237typedef struct _Emile_Image_Property Emile_Image_Property;
238typedef struct _Emile_Image_Load_Opts Emile_Image_Load_Opts;
239typedef struct _Emile_Image_Animated Emile_Image_Animated;
240
241struct _Emile_Image_Property
242{
243 struct {
244 unsigned char l, r, t, b;
245 } borders;
246
247 const Emile_Colorspace *cspaces;
248 Emile_Colorspace cspace;
249
250 Emile_Image_Encoding encoding;
251
252 unsigned int w;
253 unsigned int h;
254 unsigned int row_stride;
255
256 unsigned char scale;
257
258 Eina_Bool rotated;
259 Eina_Bool alpha;
260 Eina_Bool premul;
261 Eina_Bool alpha_sparse;
262
263 Eina_Bool flipped;
264 Eina_Bool comp;
265};
266
267struct _Emile_Image_Animated
268{
269 Eina_List *frames;
270
271 Emile_Image_Animated_Loop_Hint loop_hint;
272
273 int frame_count;
274 int loop_count;
275 int cur_frame;
276
277 Eina_Bool animated;
278};
279
280struct _Emile_Image_Load_Opts
281{
282 Eina_Rectangle region;
283 struct {
284 int src_x, src_y, src_w, src_h;
285 int dst_w, dst_h;
286 int smooth;
287 Emile_Image_Scale_Hint scale_hint;
288 } scale_load;
289 double dpi;
290 unsigned int w, h;
291 unsigned int degree;
292 int scale_down_by;
293
294 Eina_Bool orientation;
295};
296
297// FIXME: Add enum for error code
298// FIXME: should set region at load time, not head time
299// FIXME: add a sizeof for all load opts and animated structure ?
300
301EAPI Emile_Image *emile_image_tgv_memory_open(Eina_Binbuf *source,
302 Emile_Image_Load_Opts *opts,
303 Emile_Image_Animated *animated,
304 Emile_Image_Load_Error *error);
305EAPI Emile_Image *emile_image_tgv_file_open(Eina_File *source,
306 Emile_Image_Load_Opts *opts,
307 Emile_Image_Animated *animated,
308 Emile_Image_Load_Error *error);
309
310EAPI Emile_Image *emile_image_jpeg_memory_open(Eina_Binbuf *source,
311 Emile_Image_Load_Opts *opts,
312 Emile_Image_Animated *animated,
313 Emile_Image_Load_Error *error);
314EAPI Emile_Image *emile_image_jpeg_file_open(Eina_File *source,
315 Emile_Image_Load_Opts *opts,
316 Emile_Image_Animated *animated,
317 Emile_Image_Load_Error *error);
318
319EAPI Eina_Bool emile_image_head(Emile_Image *image,
320 Emile_Image_Property *prop,
321 unsigned int property_size,
322 Emile_Image_Load_Error *error);
323EAPI Eina_Bool emile_image_data(Emile_Image *image,
324 Emile_Image_Property *prop,
325 unsigned int property_size,
326 void *pixels,
327 Emile_Image_Load_Error *error);
328
329EAPI void emile_image_close(Emile_Image *source);
330
331EAPI const char *emile_load_error_str(Emile_Image *source,
332 Emile_Image_Load_Error error);
333 112
334#ifdef __cplusplus 113#ifdef __cplusplus
335} 114}
diff --git a/src/lib/emile/emile_cipher.h b/src/lib/emile/emile_cipher.h
new file mode 100644
index 0000000000..80097545ed
--- /dev/null
+++ b/src/lib/emile/emile_cipher.h
@@ -0,0 +1,48 @@
1#ifndef EMILE_CIPHER_H_
2#define EMILE_CIPHER_H_
3
4typedef struct _Emile_SSL Emile_SSL;
5
6typedef enum
7{
8 EMILE_SSLv23,
9 EMILE_SSLv3,
10 EMILE_TLSv1
11} Emile_Cipher_Type;
12
13typedef enum
14{
15 EMILE_WANT_NOTHING = 0,
16 EMILE_WANT_READ = 1,
17 EMILE_WANT_WRITE = 3
18} Emile_Want_Type;
19
20EAPI Eina_Bool emile_cipher_init(void);
21EAPI const char *emile_cipher_module_get(void);
22
23EAPI Eina_Binbuf *emile_binbuf_cipher(const Eina_Binbuf *in,
24 const char *key, unsigned int length);
25
26EAPI Eina_Binbuf *emile_binbuf_decipher(const Eina_Binbuf *in,
27 const char *key, unsigned int length);
28
29EAPI Emile_SSL *emile_cipher_server_listen(Emile_Cipher_Type t);
30EAPI Emile_SSL *emile_cipher_client_connect(Emile_SSL *server, int fd);
31EAPI Emile_SSL *emile_cipher_server_connect(Emile_Cipher_Type t);
32EAPI Eina_Bool emile_cipher_free(Emile_SSL *emile);
33
34EAPI Eina_Bool emile_cipher_cafile_add(Emile_SSL *emile, const char *file);
35EAPI Eina_Bool emile_cipher_cert_add(Emile_SSL *emile, const char *file);
36EAPI Eina_Bool emile_cipher_privkey_add(Emile_SSL *emile, const char *file);
37EAPI Eina_Bool emile_cipher_crl_add(Emile_SSL *emile, const char *file);
38EAPI int emile_cipher_read(Emile_SSL *emile, Eina_Binbuf *buffer);
39EAPI int emile_cipher_write(Emile_SSL *emile, const Eina_Binbuf *buffer);
40EAPI const char *emile_cipher_error_get(const Emile_SSL *emile);
41EAPI Eina_Bool emile_cipher_verify_name_set(Emile_SSL *emile, const char *name);
42EAPI const char *emile_cipher_verify_name_get(const Emile_SSL *emile);
43EAPI void emile_cipher_verify_set(Emile_SSL *emile, Eina_Bool verify);
44EAPI void emile_cipher_verify_basic_set(Emile_SSL *emile, Eina_Bool verify_basic);
45EAPI Eina_Bool emile_cipher_verify_get(const Emile_SSL *emile);
46EAPI Eina_Bool emile_cipher_verify_basic_get(const Emile_SSL *emile);
47
48#endif
diff --git a/src/lib/emile/emile_compression.h b/src/lib/emile/emile_compression.h
new file mode 100644
index 0000000000..89688f18a8
--- /dev/null
+++ b/src/lib/emile/emile_compression.h
@@ -0,0 +1,28 @@
1#ifndef EMILE_COMPRESSION_H_
2#define EMILE_COMPRESSION_H_
3
4typedef enum
5{
6 EMILE_ZLIB,
7 EMILE_LZ4,
8 EMILE_LZ4HC
9} Emile_Compressor_Type;
10
11typedef enum
12{
13 EMILE_DEFAULT = -1,
14 EMILE_NO_COMPRESSION = 0,
15 EMILE_FAST_COMPRESSION = 1,
16 EMILE_BEST_COMPRESSION = 9
17} Emile_Compressor_Level;
18
19EAPI Eina_Binbuf *emile_binbuf_compress(const Eina_Binbuf *in,
20 Emile_Compressor_Type t, int level);
21EAPI Eina_Binbuf *emile_binbuf_uncompress(const Eina_Binbuf *in,
22 Emile_Compressor_Type t,
23 unsigned int dest_length);
24EAPI Eina_Bool emile_binbuf_expand(const Eina_Binbuf *in,
25 Eina_Binbuf *out,
26 Emile_Compressor_Type t);
27
28#endif
diff --git a/src/lib/emile/emile_image.h b/src/lib/emile/emile_image.h
new file mode 100644
index 0000000000..ef62d316d1
--- /dev/null
+++ b/src/lib/emile/emile_image.h
@@ -0,0 +1,159 @@
1#ifndef EMILE_IMAGE_H
2#define EMILE_IMAGE_H
3
4/* All the value from below enum should be the same as in Evas_Loader.h */
5typedef enum _Emile_Colorspace
6{
7 EMILE_COLORSPACE_ARGB8888,/**< ARGB 32 bits per pixel, high-byte is Alpha, accessed 1 32bit word at a time */
8 EMILE_COLORSPACE_YCBCR422P601_PL, /**< YCbCr 4:2:2 Planar, ITU.BT-601 specifications. The data pointed to is just an array of row pointer, pointing to the Y rows, then the Cb, then Cr rows */
9 EMILE_COLORSPACE_YCBCR422P709_PL, /**< YCbCr 4:2:2 Planar, ITU.BT-709 specifications. The data pointed to is just an array of row pointer, pointing to the Y rows, then the Cb, then Cr rows */
10 EMILE_COLORSPACE_RGB565_A5P, /**< 16bit rgb565 + Alpha plane at end - 5 bits of the 8 being used per alpha byte */
11 EMILE_COLORSPACE_GRY8 = 4,
12 EMILE_COLORSPACE_YCBCR422601_PL, /**< YCbCr 4:2:2, ITU.BT-601 specifications. The data pointed to is just an array of row pointer, pointing to line of Y,Cb,Y,Cr bytes */
13 EMILE_COLORSPACE_YCBCR420NV12601_PL, /**< YCbCr 4:2:0, ITU.BT-601 specification. The data pointed to is just an array of row pointer, pointing to the Y rows, then the Cb,Cr rows. */
14 EMILE_COLORSPACE_YCBCR420TM12601_PL, /**< YCbCr 4:2:0, ITU.BT-601 specification. The data pointed to is just an array of tiled row pointer, pointing to the Y rows, then the Cb,Cr rows. */
15 EMILE_COLORSPACE_AGRY88 = 8, /**< AY 8bits Alpha and 8bits Grey, accessed 1 16bits at a time */
16 EMILE_COLORSPACE_ETC1 = 9, /**< OpenGL ETC1 encoding of RGB texture (4 bit per pixel) @since 1.10 */
17 EMILE_COLORSPACE_RGB8_ETC2 = 10, /**< OpenGL GL_COMPRESSED_RGB8_ETC2 texture compression format (4 bit per pixel) @since 1.10 */
18 EMILE_COLORSPACE_RGBA8_ETC2_EAC = 11, /**< OpenGL GL_COMPRESSED_RGBA8_ETC2_EAC texture compression format, supports alpha (8 bit per pixel) @since 1.10 */
19 EMILE_COLORSPACE_ETC1_ALPHA = 12, /**< ETC1 with alpha support using two planes: ETC1 RGB and ETC1 grey for alpha @since 1.11 */
20 EMILE_COLORSPACE_RGB_S3TC_DXT1 = 13, /**< OpenGL COMPRESSED_RGB_S3TC_DXT1_EXT format with RGB only. @since 1.11 */
21 EMILE_COLORSPACE_RGBA_S3TC_DXT1 = 14, /**< OpenGL COMPRESSED_RGBA_S3TC_DXT1_EXT format with RGBA punchthrough. @since 1.11 */
22 EMILE_COLORSPACE_RGBA_S3TC_DXT2 = 15, /**< DirectDraw DXT2 format with premultiplied RGBA. Not supported by OpenGL itself. @since 1.11 */
23 EMILE_COLORSPACE_RGBA_S3TC_DXT3 = 16, /**< OpenGL COMPRESSED_RGBA_S3TC_DXT3_EXT format with RGBA. @since 1.11 */
24 EMILE_COLORSPACE_RGBA_S3TC_DXT4 = 17, /**< DirectDraw DXT4 format with premultiplied RGBA. Not supported by OpenGL itself. @since 1.11 */
25 EMILE_COLORSPACE_RGBA_S3TC_DXT5 = 18 /**< OpenGL COMPRESSED_RGBA_S3TC_DXT5_EXT format with RGBA. @since 1.11 */
26} Emile_Colorspace;
27
28typedef enum _Emile_Image_Encoding
29{
30 EMILE_IMAGE_LOSSLESS = 0,
31 EMILE_IMAGE_JPEG = 1,
32 EMILE_IMAGE_ETC1 = 2,
33 EMILE_IMAGE_ETC2_RGB = 3,
34 EMILE_IMAGE_ETC2_RGBA = 4,
35 EMILE_IMAGE_ETC1_ALPHA = 5
36} Emile_Image_Encoding;
37
38typedef enum _Emile_Image_Scale_Hint
39{
40 EMILE_IMAGE_SCALE_HINT_NONE = 0, /**< No scale hint at all */
41 EMILE_IMAGE_SCALE_HINT_DYNAMIC = 1, /**< Image is being re-scaled over time, thus turning scaling cache @b off for its data */
42 EMILE_IMAGE_SCALE_HINT_STATIC = 2 /**< Image is not being re-scaled over time, thus turning scaling cache @b on for its data */
43} Emile_Image_Scale_Hint;
44
45typedef enum _Emile_Image_Animated_Loop_Hint
46{
47 EMILE_IMAGE_ANIMATED_HINT_NONE = 0,
48 EMILE_IMAGE_ANIMATED_HINT_LOOP = 1,
49 EMILE_IMAGE_ANIMATED_HINT_PINGPONG = 2
50} Emile_Image_Animated_Loop_Hint;
51
52typedef enum _Emile_Image_Load_Error
53{
54 EMILE_IMAGE_LOAD_ERROR_NONE = 0, /**< No error on load */
55 EMILE_IMAGE_LOAD_ERROR_GENERIC = 1, /**< A non-specific error occurred */
56 EMILE_IMAGE_LOAD_ERROR_DOES_NOT_EXIST = 2, /**< File (or file path) does not exist */
57 EMILE_IMAGE_LOAD_ERROR_PERMISSION_DENIED = 3, /**< Permission denied to an existing file (or path) */
58 EMILE_IMAGE_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED = 4, /**< Allocation of resources failure prevented load */
59 EMILE_IMAGE_LOAD_ERROR_CORRUPT_FILE = 5, /**< File corrupt (but was detected as a known format) */
60 EMILE_IMAGE_LOAD_ERROR_UNKNOWN_FORMAT = 6 /**< File is not a known format */
61} Emile_Image_Load_Error; /**< Emile image load error codes one can get - see emile_load_error_str() too. */
62
63typedef struct _Emile_Image Emile_Image;
64typedef struct _Emile_Image_Property Emile_Image_Property;
65typedef struct _Emile_Image_Load_Opts Emile_Image_Load_Opts;
66typedef struct _Emile_Image_Animated Emile_Image_Animated;
67
68struct _Emile_Image_Property
69{
70 struct {
71 unsigned char l, r, t, b;
72 } borders;
73
74 const Emile_Colorspace *cspaces;
75 Emile_Colorspace cspace;
76
77 Emile_Image_Encoding encoding;
78
79 unsigned int w;
80 unsigned int h;
81 unsigned int row_stride;
82
83 unsigned char scale;
84
85 Eina_Bool rotated;
86 Eina_Bool alpha;
87 Eina_Bool premul;
88 Eina_Bool alpha_sparse;
89
90 Eina_Bool flipped;
91 Eina_Bool comp;
92};
93
94struct _Emile_Image_Animated
95{
96 Eina_List *frames;
97
98 Emile_Image_Animated_Loop_Hint loop_hint;
99
100 int frame_count;
101 int loop_count;
102 int cur_frame;
103
104 Eina_Bool animated;
105};
106
107struct _Emile_Image_Load_Opts
108{
109 Eina_Rectangle region;
110 struct {
111 int src_x, src_y, src_w, src_h;
112 int dst_w, dst_h;
113 int smooth;
114 Emile_Image_Scale_Hint scale_hint;
115 } scale_load;
116 double dpi;
117 unsigned int w, h;
118 unsigned int degree;
119 int scale_down_by;
120
121 Eina_Bool orientation;
122};
123
124// FIXME: should we set region at load time, instead of head time
125
126EAPI Emile_Image *emile_image_tgv_memory_open(Eina_Binbuf *source,
127 Emile_Image_Load_Opts *opts,
128 Emile_Image_Animated *animated,
129 Emile_Image_Load_Error *error);
130EAPI Emile_Image *emile_image_tgv_file_open(Eina_File *source,
131 Emile_Image_Load_Opts *opts,
132 Emile_Image_Animated *animated,
133 Emile_Image_Load_Error *error);
134
135EAPI Emile_Image *emile_image_jpeg_memory_open(Eina_Binbuf *source,
136 Emile_Image_Load_Opts *opts,
137 Emile_Image_Animated *animated,
138 Emile_Image_Load_Error *error);
139EAPI Emile_Image *emile_image_jpeg_file_open(Eina_File *source,
140 Emile_Image_Load_Opts *opts,
141 Emile_Image_Animated *animated,
142 Emile_Image_Load_Error *error);
143
144EAPI Eina_Bool emile_image_head(Emile_Image *image,
145 Emile_Image_Property *prop,
146 unsigned int property_size,
147 Emile_Image_Load_Error *error);
148EAPI Eina_Bool emile_image_data(Emile_Image *image,
149 Emile_Image_Property *prop,
150 unsigned int property_size,
151 void *pixels,
152 Emile_Image_Load_Error *error);
153
154EAPI void emile_image_close(Emile_Image *source);
155
156EAPI const char *emile_load_error_str(Emile_Image *source,
157 Emile_Image_Load_Error error);
158
159#endif