forked from enlightenment/efl
From: Jiyoun Park <jy0703.park@samsung.com>
Subject: RE: [E-devel] [Patch] Animation gif feature patch Animated gif suport in evas and api's to handle animated images and frame flipping. from jy. SVN revision: 62331
This commit is contained in:
parent
c2d2867a2b
commit
dae46003e7
|
@ -744,6 +744,13 @@ typedef enum _Evas_Image_Scale_Hint
|
|||
EVAS_IMAGE_SCALE_HINT_STATIC = 2 /**< Image is not being re-scaled over time, thus turning scaling cache @b on for its data */
|
||||
} Evas_Image_Scale_Hint; /**< How an image's data is to be treated by Evas, with regard to scaling cache */
|
||||
|
||||
typedef enum _Evas_Image_Animated_Loop_Hint
|
||||
{
|
||||
EVAS_IMAGE_ANIMATED_HINT_NONE = 0,
|
||||
EVAS_IMAGE_ANIMATED_HINT_LOOP = 1, /**< Image's animation mode is loop like 1->2->3->1->2->3 */
|
||||
EVAS_IMAGE_ANIMATED_HINT_PINGPONG = 2 /**< Image's animation mode is pingpong like 1->2->3->2->1-> ... */
|
||||
} Evas_Image_Animated_Loop_Hint;
|
||||
|
||||
typedef enum _Evas_Engine_Render_Mode
|
||||
{
|
||||
EVAS_RENDER_MODE_BLOCKING = 0,
|
||||
|
@ -7088,6 +7095,121 @@ EAPI Eina_Bool evas_object_image_extension_can_load_get(const char *file);
|
|||
*/
|
||||
EAPI Eina_Bool evas_object_image_extension_can_load_fast_get(const char *file);
|
||||
|
||||
/**
|
||||
* Get the animation of an image object.
|
||||
*
|
||||
* @param obj Image object
|
||||
* @return whether obj support animation
|
||||
*
|
||||
* This returns the possibility of animation of image object's image
|
||||
* currently Evas only support animation of gif file type.
|
||||
*
|
||||
* Example:
|
||||
* @code
|
||||
* extern Evas_Object *object;
|
||||
*
|
||||
*
|
||||
* if (evas_object_image_animated_get(obj))
|
||||
* {
|
||||
* int frame_count;
|
||||
* int loop_count;
|
||||
* Evas_Image_Animated_Loop_Hint loop_type;
|
||||
* double duration;
|
||||
*
|
||||
* frame_count = evas_object_image_animated_frame_count_get(obj);
|
||||
* printf("This image has %d frames\n",frame_count);
|
||||
*
|
||||
* duration = evas_object_image_animated_frame_duration_get(obj,1,0);
|
||||
* printf("Frame 1's duration is %f. You had better set object's frame to 2 after this duration using timer\n");
|
||||
*
|
||||
* loop_count = evas_object_image_animated_loop_count_get(obj);
|
||||
* printf("loop count is %d. You had better run loop %d times\n",loop_count,loop_count);
|
||||
*
|
||||
* loop_type = evas_object_image_animated_loop_type_get(obj);
|
||||
* if (loop_type == EVAS_IMAGE_ANIMATED_HINT_LOOP)
|
||||
* printf("You had better set frame like 1->2->3->1->2->3...\n");
|
||||
* else if (loop_type == EVAS_IMAGE_ANIMATED_HINT_PINGPONG)
|
||||
* printf("You had better set frame like 1->2->3->2->1->2...\n");
|
||||
* else
|
||||
* printf("Unknown loop type\n");
|
||||
*
|
||||
* evas_object_image_animated_frame_set(obj,1);
|
||||
* printf("You set image object's frame to 1. You can see frame 1\n");
|
||||
* }
|
||||
*
|
||||
* @endcode
|
||||
*/
|
||||
EAPI Eina_Bool evas_object_image_animated_get(const Evas_Object *obj);
|
||||
|
||||
/**
|
||||
* Get the total frame number of image object's file.
|
||||
*
|
||||
* @param obj Image object
|
||||
* @return the number of frame
|
||||
*
|
||||
* This returns total frame number of image object's file.
|
||||
* See @ref evas_object_image_animated_get for more details.
|
||||
*/
|
||||
EAPI int evas_object_image_animated_frame_num_get(const Evas_Object *obj);
|
||||
|
||||
/**
|
||||
* Get the loop type of an animated image object.
|
||||
*
|
||||
* @param obj Image object
|
||||
* @return loop type of animated image object
|
||||
*
|
||||
* This returns loop type.
|
||||
* If Evas_Image_Animated_Loop_Hint is EVAS_IMAGE_ANIMATED_HINT_LOOP, It is better to set sequence like 1->2->3->1->2->3
|
||||
* If Evas_Image_Animated_Loop_Hint is EVAS_IMAGE_ANIMATED_HINT_PINGPONG, It is better to set sequence like 1->2->3->2->1->2
|
||||
* Default type is EVAS_IMAGE_ANIMATED_HINT_LOOP.
|
||||
*
|
||||
* See @ref evas_object_image_animated_get for more details.
|
||||
*/
|
||||
EAPI Evas_Image_Animated_Loop_Hint evas_object_image_animated_loop_type_get(const Evas_Object *obj);
|
||||
|
||||
/**
|
||||
* Get the number of loop of an animated image object.
|
||||
*
|
||||
* @param obj Image object
|
||||
* @return the number of loop of an animated image object
|
||||
*
|
||||
* This returns loop count of image.
|
||||
* Default value is 0. It means infinite loop.
|
||||
* If loop count is 1, you can set each frame only one time.
|
||||
*
|
||||
* See @ref evas_object_image_animated_get for more details.
|
||||
*/
|
||||
EAPI int evas_object_image_animated_loop_count_get(const Evas_Object *obj);
|
||||
|
||||
/**
|
||||
* Get the duration of frames of an image object.
|
||||
*
|
||||
* @param obj Image object
|
||||
* @param start_frame start frame
|
||||
* @param fram_num number of frames which want to duration
|
||||
*
|
||||
* This returns total duration of frames.
|
||||
* For example.
|
||||
* If you set start_frame to 1 and frame_num 0, you can frame 1's duration
|
||||
* If you set start_frame to 1 and frame_num 1, you can frame1 duration + frame2 duration
|
||||
*
|
||||
* See @ref evas_object_image_animated_get for more details.
|
||||
*
|
||||
*/
|
||||
EAPI double evas_object_image_animated_frame_duration_get(const Evas_Object *obj, int start_frame, int fram_num);
|
||||
|
||||
/**
|
||||
* Set the frame to current frame of an image object must render
|
||||
*
|
||||
* @param obj The given image object.
|
||||
* @param frame_num The index of current frame
|
||||
*
|
||||
* This set image object's current frame to frame_num.
|
||||
* If you set frame_num to 5, evas will render frame 5 of image when rendering time
|
||||
*
|
||||
* See @ref evas_object_image_animated_get for more details.
|
||||
*/
|
||||
EAPI void evas_object_image_animated_frame_set(Evas_Object *obj, int frame_num);
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
|
|
@ -1166,7 +1166,7 @@ evas_cache_image_load_data(Image_Entry *im)
|
|||
#endif
|
||||
int error = EVAS_LOAD_ERROR_NONE;
|
||||
|
||||
if (im->flags.loaded) return error;
|
||||
if ((im->flags.loaded) && (!im->flags.animated)) return error;
|
||||
#ifdef BUILD_ASYNC_PRELOAD
|
||||
if (im->preload)
|
||||
{
|
||||
|
@ -1190,7 +1190,7 @@ evas_cache_image_load_data(Image_Entry *im)
|
|||
LKU(wakeup);
|
||||
}
|
||||
|
||||
if (im->flags.loaded) return error;
|
||||
if ((im->flags.loaded) && (!im->flags.animated)) return error;
|
||||
LKL(im->lock);
|
||||
#endif
|
||||
im->flags.in_progress = EINA_TRUE;
|
||||
|
|
|
@ -37,6 +37,7 @@ struct _Evas_Object_Image
|
|||
Evas_Map *defmap;
|
||||
const char *file;
|
||||
const char *key;
|
||||
int frame;
|
||||
int cspace;
|
||||
|
||||
unsigned char smooth_scale : 1;
|
||||
|
@ -1858,6 +1859,7 @@ evas_object_image_alpha_mask_set(Evas_Object *obj, Eina_Bool ismask)
|
|||
|
||||
}
|
||||
|
||||
#define FRAME_MAX 1024
|
||||
EAPI Evas_Image_Content_Hint
|
||||
evas_object_image_content_hint_get(const Evas_Object *obj)
|
||||
{
|
||||
|
@ -1873,6 +1875,152 @@ evas_object_image_content_hint_get(const Evas_Object *obj)
|
|||
return o->content_hint;
|
||||
}
|
||||
|
||||
/* animated feature */
|
||||
EAPI Eina_Bool
|
||||
evas_object_image_animated_get(const Evas_Object *obj)
|
||||
{
|
||||
Evas_Object_Image *o;
|
||||
|
||||
MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
|
||||
return EINA_FALSE;
|
||||
MAGIC_CHECK_END();
|
||||
o = (Evas_Object_Image *)(obj->object_data);
|
||||
MAGIC_CHECK(o, Evas_Object_Image, MAGIC_OBJ_IMAGE);
|
||||
return EINA_FALSE;
|
||||
MAGIC_CHECK_END();
|
||||
|
||||
if (obj->layer->evas->engine.func->image_animated_get)
|
||||
return obj->layer->evas->engine.func->image_animated_get(obj->layer->evas->engine.data.output, o->engine_data);
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
EAPI int
|
||||
evas_object_image_animated_frame_count_get(const Evas_Object *obj)
|
||||
{
|
||||
Evas_Object_Image *o;
|
||||
|
||||
MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
|
||||
return -1;
|
||||
MAGIC_CHECK_END();
|
||||
o = (Evas_Object_Image *)(obj->object_data);
|
||||
MAGIC_CHECK(o, Evas_Object_Image, MAGIC_OBJ_IMAGE);
|
||||
return -1;
|
||||
MAGIC_CHECK_END();
|
||||
|
||||
if (!evas_object_image_animated_get(obj)) return -1;
|
||||
if (obj->layer->evas->engine.func->image_animated_frame_count_get)
|
||||
return obj->layer->evas->engine.func->image_animated_frame_count_get(obj->layer->evas->engine.data.output, o->engine_data);
|
||||
return -1;
|
||||
}
|
||||
|
||||
EAPI Evas_Image_Animated_Loop_Hint
|
||||
evas_object_image_animated_loop_type_get(const Evas_Object *obj)
|
||||
{
|
||||
Evas_Object_Image *o;
|
||||
|
||||
MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
|
||||
return EVAS_IMAGE_ANIMATED_HINT_NONE;
|
||||
MAGIC_CHECK_END();
|
||||
o = (Evas_Object_Image *)(obj->object_data);
|
||||
MAGIC_CHECK(o, Evas_Object_Image, MAGIC_OBJ_IMAGE);
|
||||
return EVAS_IMAGE_ANIMATED_HINT_NONE;
|
||||
MAGIC_CHECK_END();
|
||||
|
||||
if (!evas_object_image_animated_get(obj)) return EVAS_IMAGE_ANIMATED_HINT_NONE;
|
||||
|
||||
if (obj->layer->evas->engine.func->image_animated_loop_type_get)
|
||||
return obj->layer->evas->engine.func->image_animated_loop_type_get(obj->layer->evas->engine.data.output, o->engine_data);
|
||||
return EVAS_IMAGE_ANIMATED_HINT_NONE;
|
||||
}
|
||||
|
||||
EAPI int
|
||||
evas_object_image_animated_loop_count_get(const Evas_Object *obj)
|
||||
{
|
||||
Evas_Object_Image *o;
|
||||
|
||||
MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
|
||||
return -1;
|
||||
MAGIC_CHECK_END();
|
||||
o = (Evas_Object_Image *)(obj->object_data);
|
||||
MAGIC_CHECK(o, Evas_Object_Image, MAGIC_OBJ_IMAGE);
|
||||
return -1;
|
||||
MAGIC_CHECK_END();
|
||||
|
||||
if (!evas_object_image_animated_get(obj)) return -1;
|
||||
|
||||
if (obj->layer->evas->engine.func->image_animated_loop_count_get)
|
||||
return obj->layer->evas->engine.func->image_animated_loop_count_get(obj->layer->evas->engine.data.output, o->engine_data);
|
||||
return -1;
|
||||
}
|
||||
|
||||
EAPI double
|
||||
evas_object_image_animated_frame_duration_get(const Evas_Object *obj, int start_frame, int frame_num)
|
||||
{
|
||||
Evas_Object_Image *o;
|
||||
int frame_count = 0;
|
||||
|
||||
if (start_frame < 1) return -1;
|
||||
if (frame_num < 0) return -1;
|
||||
|
||||
MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
|
||||
return -1;
|
||||
MAGIC_CHECK_END();
|
||||
o = (Evas_Object_Image *)(obj->object_data);
|
||||
MAGIC_CHECK(o, Evas_Object_Image, MAGIC_OBJ_IMAGE);
|
||||
return -1;
|
||||
MAGIC_CHECK_END();
|
||||
|
||||
if (!evas_object_image_animated_get(obj)) return -1;
|
||||
|
||||
if (!obj->layer->evas->engine.func->image_animated_frame_count_get) return -1;
|
||||
|
||||
frame_count = obj->layer->evas->engine.func->image_animated_frame_count_get(obj->layer->evas->engine.data.output, o->engine_data);
|
||||
|
||||
if ((start_frame + frame_num) > frame_count) return -1;
|
||||
if (obj->layer->evas->engine.func->image_animated_frame_duration_get)
|
||||
return obj->layer->evas->engine.func->image_animated_frame_duration_get(obj->layer->evas->engine.data.output, o->engine_data, start_frame, frame_num);
|
||||
return -1;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
evas_object_image_animated_frame_set(Evas_Object *obj, int frame_index)
|
||||
{
|
||||
Evas_Object_Image *o;
|
||||
int frame_count = 0;
|
||||
Eina_Bool animated = EINA_FALSE;
|
||||
char frame_index_char[4];
|
||||
|
||||
MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
|
||||
return;
|
||||
MAGIC_CHECK_END();
|
||||
o = (Evas_Object_Image *)(obj->object_data);
|
||||
MAGIC_CHECK(o, Evas_Object_Image, MAGIC_OBJ_IMAGE);
|
||||
return;
|
||||
MAGIC_CHECK_END();
|
||||
|
||||
if (!o->cur.file) return;
|
||||
if (o->cur.frame == frame_index) return;
|
||||
|
||||
if (!evas_object_image_animated_get(obj)) return;
|
||||
|
||||
frame_count = evas_object_image_animated_frame_count_get(obj);
|
||||
|
||||
/* limit the size of frame to FRAME_MAX */
|
||||
if ((frame_count > FRAME_MAX) || (frame_count < 0) || (frame_index > frame_count))
|
||||
return;
|
||||
|
||||
if (!obj->layer->evas->engine.func->image_animated_frame_set) return;
|
||||
if (!obj->layer->evas->engine.func->image_animated_frame_set(obj->layer->evas->engine.data.output, o->engine_data, frame_index))
|
||||
return;
|
||||
|
||||
o->prev.frame = o->cur.frame;
|
||||
o->cur.frame = frame_index;
|
||||
|
||||
o->changed = 1;
|
||||
evas_object_change(obj);
|
||||
|
||||
}
|
||||
|
||||
EAPI void
|
||||
evas_image_cache_flush(Evas *e)
|
||||
{
|
||||
|
@ -3000,6 +3148,12 @@ evas_object_image_render_pre(Evas_Object *obj)
|
|||
evas_object_render_pre_prev_cur_add(&e->clip_changes, obj);
|
||||
if (!o->pixel_updates) goto done;
|
||||
}
|
||||
if (o->cur.frame != o->prev.frame)
|
||||
{
|
||||
evas_object_render_pre_prev_cur_add(&e->clip_changes, obj);
|
||||
if (!o->pixel_updates) goto done;
|
||||
}
|
||||
|
||||
}
|
||||
/* if it changed geometry - and obviously not visibility or color */
|
||||
/* calculate differences since we have a constant color fill */
|
||||
|
|
|
@ -54,6 +54,7 @@ EAPI void
|
|||
|
||||
EAPI int evas_common_load_rgba_image_module_from_file (Image_Entry *im);
|
||||
EAPI int evas_common_load_rgba_image_data_from_file (Image_Entry *im);
|
||||
EAPI double evas_common_load_rgba_image_frame_duration_from_file(Image_Entry *im, int start_frame, int frame_num);
|
||||
|
||||
void _evas_common_rgba_image_post_surface(Image_Entry *ie);
|
||||
|
||||
|
|
|
@ -309,7 +309,7 @@ evas_common_load_rgba_image_data_from_file(Image_Entry *ie)
|
|||
Evas_Image_Load_Func *evas_image_load_func = NULL;
|
||||
int ret = EVAS_LOAD_ERROR_NONE;
|
||||
|
||||
if (ie->flags.loaded) return EVAS_LOAD_ERROR_GENERIC;
|
||||
if ((ie->flags.loaded) && (!ie->flags.animated)) return EVAS_LOAD_ERROR_GENERIC;
|
||||
|
||||
#ifdef EVAS_CSERVE
|
||||
if (ie->data1)
|
||||
|
@ -346,6 +346,20 @@ evas_common_load_rgba_image_data_from_file(Image_Entry *ie)
|
|||
return EVAS_LOAD_ERROR_NONE;
|
||||
}
|
||||
|
||||
EAPI double
|
||||
evas_common_load_rgba_image_frame_duration_from_file(Image_Entry *ie, const int start, const int frame_num)
|
||||
{
|
||||
Evas_Image_Load_Func *evas_image_load_func = NULL;
|
||||
|
||||
if (!ie->info.module) return -1;
|
||||
|
||||
evas_image_load_func = ie->info.loader;
|
||||
evas_module_use((Evas_Module*) ie->info.module);
|
||||
if (evas_image_load_func->frame_duration)
|
||||
return evas_image_load_func->frame_duration(ie, ie->file, start, frame_num);
|
||||
return -1;
|
||||
}
|
||||
|
||||
EAPI Eina_Bool
|
||||
evas_common_extension_can_load_get(const char *file)
|
||||
{
|
||||
|
|
|
@ -188,6 +188,20 @@ _evas_common_rgba_image_delete(Image_Entry *ie)
|
|||
}
|
||||
}
|
||||
*/
|
||||
if (ie->frames)
|
||||
{
|
||||
Eina_List *l;
|
||||
Image_Entry_Frame *frame;
|
||||
EINA_LIST_FOREACH(ie->frames, l, frame)
|
||||
{
|
||||
if (frame)
|
||||
{
|
||||
if (frame->data) free(frame->data);
|
||||
if (frame->info) free(frame->info);
|
||||
free (frame);
|
||||
}
|
||||
}
|
||||
}
|
||||
free(im);
|
||||
}
|
||||
|
||||
|
@ -351,6 +365,7 @@ _evas_common_rgba_image_surface_delete(Image_Entry *ie)
|
|||
else if (ie->data1)
|
||||
evas_cserve_image_free(ie);
|
||||
#endif
|
||||
|
||||
im->image.data = NULL;
|
||||
ie->allocated.w = 0;
|
||||
ie->allocated.h = 0;
|
||||
|
|
|
@ -728,7 +728,7 @@ evas_common_rgba_image_scalecache_do(Image_Entry *ie, RGBA_Image *dst,
|
|||
didpop = 1;
|
||||
}
|
||||
}
|
||||
if (sci->im)
|
||||
if (sci->im && !ie->flags.animated)
|
||||
{
|
||||
if (!didpop)
|
||||
{
|
||||
|
|
|
@ -357,6 +357,7 @@ typedef unsigned char DATA8;
|
|||
|
||||
typedef struct _Image_Entry Image_Entry;
|
||||
typedef struct _Image_Entry_Flags Image_Entry_Flags;
|
||||
typedef struct _Image_Entry_Frame Image_Entry_Frame;
|
||||
typedef struct _Image_Timestamp Image_Timestamp;
|
||||
typedef struct _Engine_Image_Entry Engine_Image_Entry;
|
||||
typedef struct _Evas_Cache_Target Evas_Cache_Target;
|
||||
|
@ -511,6 +512,15 @@ struct _Image_Entry_Flags
|
|||
Eina_Bool delete_me : 1;
|
||||
Eina_Bool pending : 1;
|
||||
#endif
|
||||
Eina_Bool animated : 1;
|
||||
};
|
||||
|
||||
struct _Image_Entry_Frame
|
||||
{
|
||||
int index;
|
||||
DATA32 *data; /* frame decoding data */
|
||||
void *info; /* special image type info */
|
||||
Eina_Bool loaded : 1;
|
||||
};
|
||||
|
||||
struct _Evas_Cache_Target
|
||||
|
@ -593,6 +603,13 @@ struct _Image_Entry
|
|||
int connect_num;
|
||||
int channel;
|
||||
int load_error;
|
||||
|
||||
/* for animation feature */
|
||||
int frame_count;
|
||||
Evas_Image_Animated_Loop_Hint loop_hint;
|
||||
int loop_count;
|
||||
int cur_frame;
|
||||
Eina_List *frames;
|
||||
};
|
||||
|
||||
struct _Engine_Image_Entry
|
||||
|
|
|
@ -818,6 +818,14 @@ struct _Evas_Func
|
|||
void *(*gl_api_get) (void *data);
|
||||
int (*image_load_error_get) (void *data, void *image);
|
||||
int (*font_run_end_get) (void *data, Evas_Font_Set *font, Evas_Font_Instance **script_fi, Evas_Font_Instance **cur_fi, Evas_Script_Type script, const Eina_Unicode *text, int run_len);
|
||||
|
||||
/* animated feature */
|
||||
Eina_Bool (*image_animated_get) (void *data, void *image);
|
||||
int (*image_animated_frame_count_get) (void *data, void *image);
|
||||
Evas_Image_Animated_Loop_Hint (*image_animated_loop_type_get) (void *data, void *image);
|
||||
int (*image_animated_loop_count_get) (void *data, void *image);
|
||||
double (*image_animated_frame_duration_get) (void *data, void *image, int start_frame, int frame_num);
|
||||
Eina_Bool (*image_animated_frame_set) (void *data, void *image, int frame_index);
|
||||
};
|
||||
|
||||
struct _Evas_Image_Load_Func
|
||||
|
@ -825,6 +833,7 @@ struct _Evas_Image_Load_Func
|
|||
Eina_Bool threadable;
|
||||
Eina_Bool (*file_head) (Image_Entry *ie, const char *file, const char *key, int *error);
|
||||
Eina_Bool (*file_data) (Image_Entry *ie, const char *file, const char *key, int *error);
|
||||
double (*frame_duration) (Image_Entry *ie, const char *file, const int start, const int frame_num);
|
||||
};
|
||||
|
||||
struct _Evas_Image_Save_Func
|
||||
|
|
|
@ -2902,6 +2902,74 @@ eng_image_load_error_get(void *data __UNUSED__, void *image)
|
|||
return im->im->cache_entry.load_error;
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
eng_image_animated_get(void *data __UNUSED__, void *image)
|
||||
{
|
||||
Image_Entry *im;
|
||||
|
||||
if (!image) return EINA_FALSE;
|
||||
im = image;
|
||||
return im->flags.animated;
|
||||
}
|
||||
|
||||
static int
|
||||
eng_image_animated_frame_count_get(void *data __UNUSED__, void *image)
|
||||
{
|
||||
Image_Entry *im;
|
||||
|
||||
if (!image) return -1;
|
||||
im = image;
|
||||
if (!im->flags.animated) return -1;
|
||||
return im->frame_count;
|
||||
}
|
||||
|
||||
static Evas_Image_Animated_Loop_Hint
|
||||
eng_image_animated_loop_type_get(void *data __UNUSED__, void *image)
|
||||
{
|
||||
Image_Entry *im;
|
||||
|
||||
if (!image) return EVAS_IMAGE_ANIMATED_HINT_NONE;
|
||||
im = image;
|
||||
if (!im->flags.animated) return EVAS_IMAGE_ANIMATED_HINT_NONE;
|
||||
return im->loop_hint;
|
||||
}
|
||||
|
||||
static int
|
||||
eng_image_animated_loop_count_get(void *data __UNUSED__, void *image)
|
||||
{
|
||||
Image_Entry *im;
|
||||
|
||||
if (!image) return -1;
|
||||
im = image;
|
||||
if (!im->flags.animated) return -1;
|
||||
return im->loop_count;
|
||||
}
|
||||
|
||||
static double
|
||||
eng_image_animated_frame_duration_get(void *data __UNUSED__, void *image, int start_frame, int frame_num)
|
||||
{
|
||||
Image_Entry *im;
|
||||
|
||||
if (!image) return -1;
|
||||
im = image;
|
||||
if (!im->flags.animated) return -1;
|
||||
return evas_common_load_rgba_image_frame_duration_from_file(im, start_frame, frame_num);
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
eng_image_animated_frame_set(void *data __UNUSED__, void *image, int frame_index)
|
||||
{
|
||||
Image_Entry *im;
|
||||
|
||||
if (!image) return EINA_FALSE;
|
||||
im = image;
|
||||
if (!im->flags.animated) return EINA_FALSE;
|
||||
if (im->cur_frame == frame_index) return EINA_FALSE;
|
||||
|
||||
im->cur_frame = frame_index;
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
static int
|
||||
module_open(Evas_Module *em)
|
||||
{
|
||||
|
@ -3010,6 +3078,14 @@ module_open(Evas_Module *em)
|
|||
|
||||
ORD(image_load_error_get);
|
||||
|
||||
/* now advertise out own api */
|
||||
ORD(image_animated_get);
|
||||
ORD(image_animated_frame_count_get);
|
||||
ORD(image_animated_loop_type_get);
|
||||
ORD(image_animated_loop_count_get);
|
||||
ORD(image_animated_frame_duration_get);
|
||||
ORD(image_animated_frame_set);
|
||||
|
||||
/* now advertise out own api */
|
||||
em->functions = (void *)(&func);
|
||||
return 1;
|
||||
|
|
|
@ -653,6 +653,73 @@ eng_image_scale_hint_get(void *data __UNUSED__, void *image)
|
|||
return im->scale_hint;
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
eng_image_animated_get(void *data __UNUSED__, void *image)
|
||||
{
|
||||
Image_Entry *im;
|
||||
|
||||
if (!image) return EINA_FALSE;
|
||||
im = image;
|
||||
return im->flags.animated;
|
||||
}
|
||||
|
||||
static int
|
||||
eng_image_animated_frame_count_get(void *data __UNUSED__, void *image)
|
||||
{
|
||||
Image_Entry *im;
|
||||
|
||||
if (!image) return -1;
|
||||
im = image;
|
||||
if (!im->flags.animated) return -1;
|
||||
return im->frame_count;
|
||||
}
|
||||
|
||||
static Evas_Image_Animated_Loop_Hint
|
||||
eng_image_animated_loop_type_get(void *data __UNUSED__, void *image)
|
||||
{
|
||||
Image_Entry *im;
|
||||
|
||||
if (!image) return EVAS_IMAGE_ANIMATED_HINT_NONE;
|
||||
im = image;
|
||||
if (!im->flags.animated) return EVAS_IMAGE_ANIMATED_HINT_NONE;
|
||||
return im->loop_hint;
|
||||
}
|
||||
|
||||
static int
|
||||
eng_image_animated_loop_count_get(void *data __UNUSED__, void *image)
|
||||
{
|
||||
Image_Entry *im;
|
||||
|
||||
if (!image) return -1;
|
||||
im = image;
|
||||
if (!im->flags.animated) return -1;
|
||||
return im->loop_count;
|
||||
}
|
||||
|
||||
static double
|
||||
eng_image_animated_frame_duration_get(void *data __UNUSED__, void *image, int start_frame, int frame_num)
|
||||
{
|
||||
Image_Entry *im;
|
||||
|
||||
if (!image) return -1;
|
||||
im = image;
|
||||
if (!im->flags.animated) return -1;
|
||||
return evas_common_load_rgba_image_frame_duration_from_file(im, start_frame, frame_num);
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
eng_image_animated_frame_set(void *data __UNUSED__, void *image, int frame_index)
|
||||
{
|
||||
Image_Entry *im;
|
||||
|
||||
if (!image) return EINA_FALSE;
|
||||
im = image;
|
||||
if (!im->flags.animated) return EINA_FALSE;
|
||||
if (im->cur_frame == frame_index) return EINA_FALSE;
|
||||
im->cur_frame = frame_index;
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
eng_image_cache_flush(void *data __UNUSED__)
|
||||
{
|
||||
|
@ -1099,7 +1166,13 @@ static Evas_Func func =
|
|||
NULL, // FIXME: need software mesa for gl rendering <- gl_native_surface_get
|
||||
NULL, // FIXME: need software mesa for gl rendering <- gl_api_get
|
||||
eng_image_load_error_get,
|
||||
eng_font_run_font_end_get
|
||||
eng_font_run_font_end_get,
|
||||
eng_image_animated_get,
|
||||
eng_image_animated_frame_count_get,
|
||||
eng_image_animated_loop_type_get,
|
||||
eng_image_animated_loop_count_get,
|
||||
eng_image_animated_frame_duration_get,
|
||||
eng_image_animated_frame_set
|
||||
/* FUTURE software generic calls go here */
|
||||
};
|
||||
|
||||
|
|
|
@ -18,7 +18,8 @@ static Evas_Image_Load_Func evas_image_load_bmp_func =
|
|||
{
|
||||
EINA_TRUE,
|
||||
evas_image_load_file_head_bmp,
|
||||
evas_image_load_file_data_bmp
|
||||
evas_image_load_file_data_bmp,
|
||||
NULL
|
||||
};
|
||||
|
||||
static int
|
||||
|
|
|
@ -15,7 +15,8 @@ static Evas_Image_Load_Func evas_image_load_edb_func =
|
|||
{
|
||||
EINA_TRUE,
|
||||
evas_image_load_file_head_edb,
|
||||
evas_image_load_file_data_edb
|
||||
evas_image_load_file_data_edb,
|
||||
NULL
|
||||
};
|
||||
|
||||
static Eina_Bool
|
||||
|
|
|
@ -15,7 +15,8 @@ Evas_Image_Load_Func evas_image_load_eet_func =
|
|||
{
|
||||
EINA_TRUE,
|
||||
evas_image_load_file_head_eet,
|
||||
evas_image_load_file_data_eet
|
||||
evas_image_load_file_data_eet,
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -23,7 +23,8 @@ Evas_Image_Load_Func evas_image_load_generic_func =
|
|||
{
|
||||
EINA_TRUE,
|
||||
evas_image_load_file_head_generic,
|
||||
evas_image_load_file_data_generic
|
||||
evas_image_load_file_data_generic,
|
||||
NULL
|
||||
};
|
||||
|
||||
static Eina_Bool
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -18,7 +18,8 @@ static Evas_Image_Load_Func evas_image_load_ico_func =
|
|||
{
|
||||
EINA_TRUE,
|
||||
evas_image_load_file_head_ico,
|
||||
evas_image_load_file_data_ico
|
||||
evas_image_load_file_data_ico,
|
||||
NULL
|
||||
};
|
||||
|
||||
static int
|
||||
|
|
|
@ -45,7 +45,8 @@ static Evas_Image_Load_Func evas_image_load_jpeg_func =
|
|||
{
|
||||
EINA_TRUE,
|
||||
evas_image_load_file_head_jpeg,
|
||||
evas_image_load_file_data_jpeg
|
||||
evas_image_load_file_data_jpeg,
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -18,7 +18,8 @@ static Eina_Bool evas_image_load_file_data_pmaps(Image_Entry *ie, const char *fi
|
|||
Evas_Image_Load_Func evas_image_load_pmaps_func = {
|
||||
EINA_TRUE,
|
||||
evas_image_load_file_head_pmaps,
|
||||
evas_image_load_file_data_pmaps
|
||||
evas_image_load_file_data_pmaps,
|
||||
NULL
|
||||
};
|
||||
|
||||
/* The buffer to load pmaps images */
|
||||
|
|
|
@ -34,7 +34,8 @@ static Evas_Image_Load_Func evas_image_load_png_func =
|
|||
{
|
||||
EINA_TRUE,
|
||||
evas_image_load_file_head_png,
|
||||
evas_image_load_file_data_png
|
||||
evas_image_load_file_data_png,
|
||||
NULL
|
||||
};
|
||||
|
||||
static Eina_Bool
|
||||
|
|
|
@ -940,7 +940,8 @@ get_compressed_channels_length(PSD_Header *head,
|
|||
static const Evas_Image_Load_Func evas_image_load_psd_func = {
|
||||
EINA_TRUE,
|
||||
evas_image_load_file_head_psd,
|
||||
evas_image_load_file_data_psd
|
||||
evas_image_load_file_data_psd,
|
||||
NULL
|
||||
};
|
||||
|
||||
static int
|
||||
|
|
|
@ -12,7 +12,8 @@ Evas_Image_Load_Func evas_image_load_svg_func =
|
|||
{
|
||||
EINA_FALSE,
|
||||
evas_image_load_file_head_svg,
|
||||
evas_image_load_file_data_svg
|
||||
evas_image_load_file_data_svg,
|
||||
NULL
|
||||
};
|
||||
|
||||
static int rsvg_initialized = 0;
|
||||
|
|
|
@ -61,7 +61,8 @@ static Evas_Image_Load_Func evas_image_load_tga_func =
|
|||
{
|
||||
EINA_TRUE,
|
||||
evas_image_load_file_head_tga,
|
||||
evas_image_load_file_data_tga
|
||||
evas_image_load_file_data_tga,
|
||||
NULL
|
||||
};
|
||||
|
||||
static Eina_Bool
|
||||
|
|
|
@ -33,7 +33,8 @@ static Evas_Image_Load_Func evas_image_load_tiff_func =
|
|||
{
|
||||
EINA_TRUE,
|
||||
evas_image_load_file_head_tiff,
|
||||
evas_image_load_file_data_tiff
|
||||
evas_image_load_file_data_tiff,
|
||||
NULL
|
||||
};
|
||||
|
||||
typedef struct TIFFRGBAImage_Extra TIFFRGBAImage_Extra;
|
||||
|
|
|
@ -18,7 +18,8 @@ static Evas_Image_Load_Func evas_image_load_wbmp_func =
|
|||
{
|
||||
EINA_TRUE,
|
||||
evas_image_load_file_head_wbmp,
|
||||
evas_image_load_file_data_wbmp
|
||||
evas_image_load_file_data_wbmp,
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -23,7 +23,8 @@ static Evas_Image_Load_Func evas_image_load_xpm_func =
|
|||
{
|
||||
EINA_FALSE,
|
||||
evas_image_load_file_head_xpm,
|
||||
evas_image_load_file_data_xpm
|
||||
evas_image_load_file_data_xpm,
|
||||
NULL
|
||||
};
|
||||
|
||||
// TODO: REWRITE THIS WITH THREAD SAFE VERSION NOT USING THIS HANDLE!!!!
|
||||
|
|
Loading…
Reference in New Issue