summaryrefslogtreecommitdiff
path: root/src/lib/emile/Emile.h
diff options
context:
space:
mode:
authorCedric BAIL <cedric@osg.samsung.com>2015-03-17 08:50:15 +0100
committerCedric BAIL <cedric@osg.samsung.com>2015-03-17 09:58:18 +0100
commitd40dad8f73bb367b7735212f22b4594725069fa0 (patch)
treed7e38bfaa797985b86795cbbe49716ff5c8d4c51 /src/lib/emile/Emile.h
parent65248db8d8868e9e6b95f0544b78767a03542376 (diff)
emile: initial addition of emile image support.
Diffstat (limited to 'src/lib/emile/Emile.h')
-rw-r--r--src/lib/emile/Emile.h158
1 files changed, 158 insertions, 0 deletions
diff --git a/src/lib/emile/Emile.h b/src/lib/emile/Emile.h
index 47a9186d3b..ff3ce7e1cf 100644
--- a/src/lib/emile/Emile.h
+++ b/src/lib/emile/Emile.h
@@ -174,6 +174,164 @@ EAPI Eina_Bool emile_binbuf_expand(const Eina_Binbuf *in,
174 Eina_Binbuf *out, 174 Eina_Binbuf *out,
175 Emile_Compressor_Type t); 175 Emile_Compressor_Type t);
176 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 struct {
283 int x, y, w, h;
284 } region;
285 struct {
286 int src_x, src_y, src_w, src_h;
287 int dst_w, dst_h;
288 int smooth;
289 Emile_Image_Scale_Hint scale_hint;
290 } scale_load;
291 double dpi;
292 unsigned int w, h;
293 unsigned int degree;
294 int scale_down_by;
295
296 Eina_Bool orientation;
297};
298
299// FIXME: Add enum for error code
300// FIXME: should set region at load time, not head time
301
302EAPI Emile_Image *emile_image_tgv_memory_open(Eina_Binbuf *source,
303 Emile_Image_Load_Opts *opts,
304 Emile_Image_Animated *animated,
305 Emile_Image_Load_Error *error);
306EAPI Emile_Image *emile_image_tgv_file_open(Eina_File *source,
307 Emile_Image_Load_Opts *opts,
308 Emile_Image_Animated *animated,
309 Emile_Image_Load_Error *error);
310
311EAPI Emile_Image *emile_image_jpeg_memory_open(Eina_Binbuf *source,
312 Emile_Image_Load_Opts *opts,
313 Emile_Image_Animated *animated,
314 Emile_Image_Load_Error *error);
315EAPI Emile_Image *emile_image_jpeg_file_open(Eina_File *source,
316 Emile_Image_Load_Opts *opts,
317 Emile_Image_Animated *animated,
318 Emile_Image_Load_Error *error);
319
320EAPI Eina_Bool emile_image_head(Emile_Image *image,
321 Emile_Image_Property *prop,
322 unsigned int property_size,
323 Emile_Image_Load_Error *error);
324EAPI Eina_Bool emile_image_data(Emile_Image *image,
325 Emile_Image_Property *prop,
326 unsigned int property_size,
327 void *pixels,
328 Emile_Image_Load_Error *error);
329
330EAPI void emile_image_close(Emile_Image *source);
331
332EAPI const char *emile_load_error_str(Emile_Image *source,
333 Emile_Image_Load_Error error);
334
177#ifdef __cplusplus 335#ifdef __cplusplus
178} 336}
179#endif /* ifdef __cplusplus */ 337#endif /* ifdef __cplusplus */