forked from enlightenment/efl
evas.image: add evas_object_image_animated_frame_get
this adds an api for getting the current frame of an animation Differential Revision: https://phab.enlightenment.org/D11455
This commit is contained in:
parent
d89adaccfb
commit
a89a2ef1de
|
@ -4930,6 +4930,7 @@ EAPI Eina_Bool evas_object_image_animated_get(const Eo *obj);
|
||||||
* @ref evas_object_image_animated_loop_type_get,
|
* @ref evas_object_image_animated_loop_type_get,
|
||||||
* @ref evas_object_image_animated_loop_count_get,
|
* @ref evas_object_image_animated_loop_count_get,
|
||||||
* @ref evas_object_image_animated_frame_duration_get.
|
* @ref evas_object_image_animated_frame_duration_get.
|
||||||
|
* @ref evas_object_image_animated_frame_get.
|
||||||
*
|
*
|
||||||
* @param[in] frame_index The index of current frame.
|
* @param[in] frame_index The index of current frame.
|
||||||
*
|
*
|
||||||
|
@ -4937,6 +4938,24 @@ EAPI Eina_Bool evas_object_image_animated_get(const Eo *obj);
|
||||||
*/
|
*/
|
||||||
EAPI void evas_object_image_animated_frame_set(Evas_Object *obj, int frame_index);
|
EAPI void evas_object_image_animated_frame_set(Evas_Object *obj, int frame_index);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get the frame to current frame of an image object.
|
||||||
|
*
|
||||||
|
* This returns image object's current frame.
|
||||||
|
*
|
||||||
|
* See also @ref evas_object_image_animated_get,
|
||||||
|
* @ref evas_object_image_animated_frame_count_get,
|
||||||
|
* @ref evas_object_image_animated_loop_type_get,
|
||||||
|
* @ref evas_object_image_animated_loop_count_get,
|
||||||
|
* @ref evas_object_image_animated_frame_duration_get.
|
||||||
|
* @ref evas_object_image_animated_frame_set.
|
||||||
|
*
|
||||||
|
* @param[in] frame_index The index of current frame.
|
||||||
|
*
|
||||||
|
* @since 1.24
|
||||||
|
*/
|
||||||
|
EAPI int evas_object_image_animated_frame_get(Evas_Object *obj);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get the total number of frames of the image object.
|
* @brief Get the total number of frames of the image object.
|
||||||
*
|
*
|
||||||
|
|
|
@ -40,6 +40,7 @@ _evas_image_file_load(Eo *eo_obj, Evas_Image_Data *o)
|
||||||
const Eina_File *f = efl_file_mmap_get(eo_obj);
|
const Eina_File *f = efl_file_mmap_get(eo_obj);
|
||||||
const char *key = efl_file_key_get(eo_obj);
|
const char *key = efl_file_key_get(eo_obj);
|
||||||
int load_error;
|
int load_error;
|
||||||
|
int frame_index;
|
||||||
|
|
||||||
if (!o->skip_head)
|
if (!o->skip_head)
|
||||||
EINA_SAFETY_ON_NULL_RETURN_VAL(f, EINA_FALSE);
|
EINA_SAFETY_ON_NULL_RETURN_VAL(f, EINA_FALSE);
|
||||||
|
@ -59,6 +60,13 @@ _evas_image_file_load(Eo *eo_obj, Evas_Image_Data *o)
|
||||||
o->engine_data = ENFN->image_mmap(ENC, o->cur->f, o->cur->key, &load_error, &lo);
|
o->engine_data = ENFN->image_mmap(ENC, o->cur->f, o->cur->key, &load_error, &lo);
|
||||||
else
|
else
|
||||||
o->engine_data = ENFN->image_load(ENC, efl_file_get(eo_obj), o->cur->key, &load_error, &lo);
|
o->engine_data = ENFN->image_load(ENC, efl_file_get(eo_obj), o->cur->key, &load_error, &lo);
|
||||||
|
|
||||||
|
if (_evas_image_animated_get(eo_obj))
|
||||||
|
{
|
||||||
|
frame_index = ENFN->image_animated_frame_get(ENC, o->engine_data);
|
||||||
|
_evas_image_animated_frame_set(eo_obj, frame_index);
|
||||||
|
}
|
||||||
|
|
||||||
o->load_error = _evas_load_error_to_efl_gfx_image_load_error(load_error);
|
o->load_error = _evas_load_error_to_efl_gfx_image_load_error(load_error);
|
||||||
o->buffer_data_set = EINA_FALSE;
|
o->buffer_data_set = EINA_FALSE;
|
||||||
_evas_image_done_set(eo_obj, obj, o);
|
_evas_image_done_set(eo_obj, obj, o);
|
||||||
|
|
|
@ -270,6 +270,13 @@ evas_object_image_animated_frame_set(Evas_Object *obj, int frame_index)
|
||||||
_evas_image_animated_frame_set(obj, frame_index);
|
_evas_image_animated_frame_set(obj, frame_index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EAPI int
|
||||||
|
evas_object_image_animated_frame_get(Evas_Object *obj)
|
||||||
|
{
|
||||||
|
EVAS_IMAGE_API(obj, 0);
|
||||||
|
return _evas_image_animated_frame_get(obj);
|
||||||
|
}
|
||||||
|
|
||||||
EAPI int
|
EAPI int
|
||||||
evas_object_image_animated_frame_count_get(const Evas_Object *obj)
|
evas_object_image_animated_frame_count_get(const Evas_Object *obj)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1478,6 +1478,7 @@ struct _Evas_Func
|
||||||
int (*image_animated_loop_count_get) (void *engine, void *image);
|
int (*image_animated_loop_count_get) (void *engine, void *image);
|
||||||
double (*image_animated_frame_duration_get) (void *engine, void *image, int start_frame, int frame_num);
|
double (*image_animated_frame_duration_get) (void *engine, void *image, int start_frame, int frame_num);
|
||||||
Eina_Bool (*image_animated_frame_set) (void *engine, void *image, int frame_index);
|
Eina_Bool (*image_animated_frame_set) (void *engine, void *image, int frame_index);
|
||||||
|
int (*image_animated_frame_get) (void *engine, void *image);
|
||||||
|
|
||||||
/* max size query */
|
/* max size query */
|
||||||
void (*image_max_size_get) (void *engine, int *maxw, int *maxh);
|
void (*image_max_size_get) (void *engine, int *maxw, int *maxh);
|
||||||
|
|
|
@ -2158,6 +2158,21 @@ eng_image_animated_frame_set(void *engine EINA_UNUSED, void *image, int frame_in
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
eng_image_animated_frame_get(void *engine EINA_UNUSED, void *image)
|
||||||
|
{
|
||||||
|
Evas_GL_Image *gim = image;
|
||||||
|
Image_Entry *im;
|
||||||
|
|
||||||
|
if (!gim) return EINA_FALSE;
|
||||||
|
im = (Image_Entry *)gim->im;
|
||||||
|
if (!im) return EINA_FALSE;
|
||||||
|
|
||||||
|
if (!im->animated.animated) return EINA_FALSE;
|
||||||
|
|
||||||
|
return im->animated.cur_frame;
|
||||||
|
}
|
||||||
|
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
eng_image_can_region_get(void *engine EINA_UNUSED, void *image)
|
eng_image_can_region_get(void *engine EINA_UNUSED, void *image)
|
||||||
{
|
{
|
||||||
|
@ -3308,6 +3323,7 @@ module_open(Evas_Module *em)
|
||||||
ORD(image_animated_loop_count_get);
|
ORD(image_animated_loop_count_get);
|
||||||
ORD(image_animated_frame_duration_get);
|
ORD(image_animated_frame_duration_get);
|
||||||
ORD(image_animated_frame_set);
|
ORD(image_animated_frame_set);
|
||||||
|
ORD(image_animated_frame_get);
|
||||||
|
|
||||||
ORD(image_max_size_get);
|
ORD(image_max_size_get);
|
||||||
|
|
||||||
|
|
|
@ -2915,6 +2915,18 @@ eng_image_animated_frame_set(void *data EINA_UNUSED, void *image, int frame_inde
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
eng_image_animated_frame_get(void *data EINA_UNUSED, void *image)
|
||||||
|
{
|
||||||
|
Image_Entry *im;
|
||||||
|
|
||||||
|
if (!image) return EINA_FALSE;
|
||||||
|
im = image;
|
||||||
|
if (!im->animated.animated) return EINA_FALSE;
|
||||||
|
|
||||||
|
return im->animated.cur_frame;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_draw_thread_multi_font_draw(void *data)
|
_draw_thread_multi_font_draw(void *data)
|
||||||
{
|
{
|
||||||
|
@ -4777,6 +4789,7 @@ static Evas_Func func =
|
||||||
eng_image_animated_loop_count_get,
|
eng_image_animated_loop_count_get,
|
||||||
eng_image_animated_frame_duration_get,
|
eng_image_animated_frame_duration_get,
|
||||||
eng_image_animated_frame_set,
|
eng_image_animated_frame_set,
|
||||||
|
eng_image_animated_frame_get,
|
||||||
NULL, // image_max_size_get
|
NULL, // image_max_size_get
|
||||||
eng_multi_font_draw,
|
eng_multi_font_draw,
|
||||||
eng_pixel_alpha_get,
|
eng_pixel_alpha_get,
|
||||||
|
|
Loading…
Reference in New Issue