summaryrefslogtreecommitdiff
path: root/src/lib/emile/Emile.h
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/Emile.h
parent4095519d653172aa7b7fa916def28b315721233e (diff)
emile: split headers.
Diffstat (limited to 'src/lib/emile/Emile.h')
-rw-r--r--src/lib/emile/Emile.h227
1 files changed, 3 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}