diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile_Efl.am | 1 | ||||
-rw-r--r-- | src/lib/efl/Efl.h | 2 | ||||
-rw-r--r-- | src/lib/efl/interfaces/efl_image.eo | 13 | ||||
-rw-r--r-- | src/lib/efl/interfaces/efl_image_animated.eo | 120 | ||||
-rw-r--r-- | src/lib/efl/interfaces/efl_interfaces_main.c | 1 | ||||
-rw-r--r-- | src/lib/evas/Evas_Legacy.h | 100 | ||||
-rw-r--r-- | src/lib/evas/canvas/evas_image.eo | 109 | ||||
-rw-r--r-- | src/lib/evas/canvas/evas_object_image.c | 74 | ||||
-rw-r--r-- | src/lib/evas/canvas/evas_types.eot | 1 |
9 files changed, 287 insertions, 134 deletions
diff --git a/src/Makefile_Efl.am b/src/Makefile_Efl.am index cf97f36e70..e3d5974d00 100644 --- a/src/Makefile_Efl.am +++ b/src/Makefile_Efl.am @@ -2,6 +2,7 @@ efl_eolian_legacy_files = \ lib/efl/interfaces/efl_gfx_fill.eo \ lib/efl/interfaces/efl_gfx_base.eo \ + lib/efl/interfaces/efl_image_animated.eo \ $(NULL) efl_eolian_files = \ diff --git a/src/lib/efl/Efl.h b/src/lib/efl/Efl.h index c1b42e179b..bb7580a4b3 100644 --- a/src/lib/efl/Efl.h +++ b/src/lib/efl/Efl.h @@ -58,6 +58,7 @@ typedef Efl_Gfx_Path_Command_Type Efl_Gfx_Path_Command; #include "interfaces/efl_control.eo.h" #include "interfaces/efl_file.eo.h" #include "interfaces/efl_image.eo.h" +#include "interfaces/efl_image_animated.eo.h" #include "interfaces/efl_player.eo.h" #include "interfaces/efl_text.eo.h" #include "interfaces/efl_text_properties.eo.h" @@ -98,6 +99,7 @@ static inline void efl_gfx_color16_type_set(Efl_Gfx_Color *color, #ifndef EFL_NOLEGACY_API_SUPPORT #include "interfaces/efl_gfx_types.eot.h" +#include "interfaces/efl_image_animated.eo.legacy.h" #include "interfaces/efl_gfx_fill.eo.legacy.h" #include "interfaces/efl_gfx_base.eo.legacy.h" #endif diff --git a/src/lib/efl/interfaces/efl_image.eo b/src/lib/efl/interfaces/efl_image.eo index dd9162abeb..3b0efbf411 100644 --- a/src/lib/efl/interfaces/efl_image.eo +++ b/src/lib/efl/interfaces/efl_image.eo @@ -1,19 +1,6 @@ interface Efl.Image { legacy_prefix: null; methods { - @property animated { - /* FIXME: Move to specific interface */ - get { - [[Check if an image can be animated (has multiple frames). - - This will be $true for animated Gif files for instance but $false - for still images. - ]] - } - values { - is_animated: bool; [[$true if the image is animated]] - } - } @property load_size { [[The loading size of an image. diff --git a/src/lib/efl/interfaces/efl_image_animated.eo b/src/lib/efl/interfaces/efl_image_animated.eo new file mode 100644 index 0000000000..0ffcc82a22 --- /dev/null +++ b/src/lib/efl/interfaces/efl_image_animated.eo @@ -0,0 +1,120 @@ +/* FIXME: invalid type from evas/emile! */ +/* type @extern Evas.Animated_Loop_Hint: int; */ + +enum Efl.Image_Animated.Loop_Hint { + none = 0, [[No looping order specified.]] + loop = 1, [[Standard loop: 1->2->3->1->2->3->1]] + pingpong = 2 [[Ping-pong bouncing loop: 1->2->3->2->1->2->3->1]] +} + +/* FIXME: rename to Efl.Image.Animated when eo/eolian are fixed */ + +interface Efl.Image_Animated () +{ + legacy_prefix: null; + eo_prefix: efl_image; + + methods { + @property animated { + get { + [[Check if an image can be animated (has multiple frames). + + This will be $true for animated Gif files for instance but $false + for still images. + + @since 1.1 + ]] + } + values { + is_animated: bool; [[$true if the image is animated]] + } + } + @property animated_frame { + [[Index of the current frame of an animated image. + + Ranges from 1 to @.animated_frame_count. Valid only if @.animated. + ]] + set { + [[Set the frame to current frame of an image object. + + @since 1.1 + ]] + return: bool; [[Returns $true if the frame index is valid.]] + } + get {} + values { + frame_index: int; [[The index of current frame.]] + } + } + @property animated_frame_count { + get { + [[Get the total number of frames of the image, if animated. + + Returns -1 if not animated. + + @since 1.1 + ]] + return: int; [[The number of frames in the animated image.]] + } + } + @property animated_loop_type { + /* FIXME: external type used from evas / emile */ + get { + [[Get the kind of looping the image object does. + + This returns the kind of looping the image object wants to do. + + If it returns @Efl.Image_Animated.Loop_Hint.loop, you should + display frames in a sequence like: 1->2->3->1->2->3->1... + + If it returns @Efl.Image_Animated.Loop_Hint.pingpong, it is + better to display frames in a sequence like: + 1->2->3->2->1->2->3->1... + + The default type is @Efl.Image_Animated.Loop_Hint.loop. + + @since 1.1 + ]] + return: Efl.Image_Animated.Loop_Hint; [[Loop type of the image object.]] + } + } + @property animated_loop_count { + get { + [[Get the number times the animation of the object loops. + + This returns loop count of image. The loop count is the number + of times the animation will play fully from first to last frame + until the animation should stop (at the final frame). + + If 0 is returned, then looping should happen indefinitely + (no limit to the number of times it loops). + + @since 1.1 + ]] + return: int; [[The number of loop of an animated image object.]] + } + } + @property animated_frame_duration { + get { + [[Get the duration of a sequence of frames. + + This returns total duration in seconds that the specified + sequence of frames should take. + + If $start_frame is 1 and $frame_num is 0, this returns the + duration of frame 1. If $start_frame is 1 and $frame_num is 1, + this returns the total duration of frame 1 + frame 2. + + @since 1.1 + ]] + } + keys { + start_frame: int; [[The first frame, rangers from 1 to @.animated_frame_count.]] + frame_num: int; [[Number of frames in the sequence, starts from 0.]] + } + values { + duration: double; + } + } + } +} diff --git a/src/lib/efl/interfaces/efl_interfaces_main.c b/src/lib/efl/interfaces/efl_interfaces_main.c index cd962dd86f..b0be0d21e5 100644 --- a/src/lib/efl/interfaces/efl_interfaces_main.c +++ b/src/lib/efl/interfaces/efl_interfaces_main.c @@ -7,6 +7,7 @@ #include "interfaces/efl_control.eo.c" #include "interfaces/efl_file.eo.c" #include "interfaces/efl_image.eo.c" +#include "interfaces/efl_image_animated.eo.c" #include "interfaces/efl_player.eo.c" #include "interfaces/efl_text.eo.c" #include "interfaces/efl_text_properties.eo.c" diff --git a/src/lib/evas/Evas_Legacy.h b/src/lib/evas/Evas_Legacy.h index 472b2ae25f..668684845a 100644 --- a/src/lib/evas/Evas_Legacy.h +++ b/src/lib/evas/Evas_Legacy.h @@ -2753,6 +2753,106 @@ EAPI Eina_Bool evas_object_image_save(const Eo *obj, const char *file, const cha EAPI Eina_Bool evas_object_image_animated_get(const Eo *obj); /** + * @brief Set the frame to current frame of an image object. + * + * This set image object's current frame to frame_num with 1 being the first + * 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. + * + * @param[in] frame_index The index of current frame. + * + * @since 1.1 + */ +EAPI void evas_object_image_animated_frame_set(Evas_Object *obj, int frame_index); + +/** + * @brief Get the total number of frames of the image object. + * + * This returns total number of frames the image object supports (if animated). + * + * See also @ref evas_object_image_animated_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. + * + * @return The number of frames. + * + * @since 1.1 + */ +EAPI int evas_object_image_animated_frame_count_get(const Evas_Object *obj); + +/** + * @brief Get the kind of looping the image object does. + * + * This returns the kind of looping the image object wants to do. + * + * If it returns EVAS_IMAGE_ANIMATED_HINT_LOOP, you should display frames in a + * sequence like: 1->2->3->1->2->3->1... + * + * If it returns EVAS_IMAGE_ANIMATED_HINT_PINGPONG, it is better to display + * frames in a sequence like: 1->2->3->2->1->2->3->1... + * + * The default type is EVAS_IMAGE_ANIMATED_HINT_LOOP. + * + * See also @ref evas_object_image_animated_get, + * @ref evas_object_image_animated_frame_count_get, + * @ref evas_object_image_animated_loop_count_get, + * @ref evas_object_image_animated_frame_duration_get. + * + * @return Loop type of the image object. + * + * @since 1.1 + */ +EAPI Evas_Image_Animated_Loop_Hint evas_object_image_animated_loop_type_get(const Evas_Object *obj); + +/** + * @brief Get the number times the animation of the object loops. + * + * This returns loop count of image. The loop count is the number of times the + * animation will play fully from first to last frame until the animation + * should stop (at the final frame). + * + * If 0 is returned, then looping should happen indefinitely (no limit to the + * number of times it loops). + * + * 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_frame_duration_get. + * + * @return The number of loop of an animated image object. + * + * @since 1.1 + */ +EAPI int evas_object_image_animated_loop_count_get(const Evas_Object *obj); + +/** + * @brief Get the duration of a sequence of frames. + * + * This returns total duration that the specified sequence of frames should + * take in seconds. + * + * If you set start_frame to 1 and frame_num 0, you get frame 1's duration. If + * you set start_frame to 1 and frame_num 1, you get frame 1's duration + + * frame2's duration. + * + * 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, + * + * @param[in] frame_num Number of frames in the sequence. + * + * @since 1.1 + */ +EAPI double evas_object_image_animated_frame_duration_get(const Evas_Object *obj, int start_frame, int frame_num); + +/** * * Set the load size of a given image object's source image. * diff --git a/src/lib/evas/canvas/evas_image.eo b/src/lib/evas/canvas/evas_image.eo index 2536a5f36b..323ae946d4 100644 --- a/src/lib/evas/canvas/evas_image.eo +++ b/src/lib/evas/canvas/evas_image.eo @@ -1,6 +1,6 @@ type @extern Evas_Object_Image_Pixels_Get_Cb: __undefined_type; /* FIXME: func pointers are not supported. */ -class Evas.Image (Evas.Object, Efl.File, Efl.Image, Efl.Gfx.Fill, Efl.Gfx.View, Evas.Filter) +class Evas.Image (Evas.Object, Efl.File, Efl.Image, Efl.Image_Animated, Efl.Gfx.Fill, Efl.Gfx.View, Evas.Filter) { legacy_prefix: evas_object_image; eo_prefix: evas_obj_image; @@ -482,24 +482,6 @@ class Evas.Image (Evas.Object, Efl.File, Efl.Image, Efl.Gfx.Fill, Efl.Gfx.View, data: void *; [[The raw data to replace.]] } } - @property animated_frame { - set { - [[Set the frame to current frame of an image object. - - This set image object's current frame to frame_num with 1 - being the first frame. - - See also \@ref evas_object_image_animated_get, - @.animated_frame_count.get, @.animated_loop_type.get, - @.animated_loop_count.get, @.animated_frame_duration_get. - - @since 1.1 - ]] - } - values { - frame_index: int; [[The index of current frame.]] - } - } @property region_support { get { [[Get the support state of a given image. @@ -521,22 +503,6 @@ class Evas.Image (Evas.Object, Efl.File, Efl.Image, Efl.Gfx.Fill, Efl.Gfx.View, ]] } } - @property animated_frame_count { - get { - [[Get the total number of frames of the image object. - - This returns total number of frames the image object - supports (if animated). - - See also \@ref evas_object_image_animated_get, - @.animated_frame_count.get, @.animated_loop_type.get, - @.animated_loop_count.get, @.animated_frame_duration_get. - - @since 1.1 - ]] - return: int; [[The number of frames.]] - } - } @property stride { get { [[Retrieves the row stride of the given image object. @@ -547,49 +513,6 @@ class Evas.Image (Evas.Object, Efl.File, Efl.Image, Efl.Gfx.Fill, Efl.Gfx.View, return: int @warn_unused; [[The stride of the image (in bytes).]] } } - @property animated_loop_type { - get { - [[Get the kind of looping the image object does. - - This returns the kind of looping the image object wants to do. - - If it returns EVAS_IMAGE_ANIMATED_HINT_LOOP, you should display - frames in a sequence like: 1->2->3->1->2->3->1... - - If it returns EVAS_IMAGE_ANIMATED_HINT_PINGPONG, it is better - to display frames in a sequence like: 1->2->3->2->1->2->3->1... - - The default type is EVAS_IMAGE_ANIMATED_HINT_LOOP. - - See also \@ref evas_object_image_animated_get, - @.animated_frame_count.get, @.animated_loop_type.get, - @.animated_loop_count.get, @.animated_frame_duration_get. - - @since 1.1 - ]] - return: Evas.Image_Animated_Loop_Hint; [[Loop type of the image object.]] - } - } - @property animated_loop_count { - get { - [[Get the number times the animation of the object loops. - - This returns loop count of image. The loop count is the number - of times the animation will play fully from first to last frame - until the animation should stop (at the final frame). - - If 0 is returned, then looping should happen indefinitely - (no limit to the number of times it loops). - - See also \@ref evas_object_image_animated_get, - @.animated_frame_count.get, @.animated_loop_type.get, - @.animated_loop_count.get, @.animated_frame_duration_get. - - @since 1.1 - ]] - return: int; [[The number of loop of an animated image object.]] - } - } @property scene { set { @@ -672,28 +595,6 @@ class Evas.Image (Evas.Object, Efl.File, Efl.Image, Efl.Gfx.Fill, Efl.Gfx.View, @in h: int; [[Height of the region to be updated.]] } } - animated_frame_duration_get @const { - [[Get the duration of a sequence of frames. - - This returns total duration that the specified sequence of - frames should take in seconds. - - If you set start_frame to 1 and frame_num 0, you get frame 1's - duration. If you set start_frame to 1 and frame_num 1, you get - frame 1's duration + frame2's duration. - - See also \@ref evas_object_image_animated_get, - @.animated_frame_count.get, @.animated_loop_type.get, - @.animated_loop_count.get, @.animated_frame_duration_get. - - @since 1.1 - ]] - return: double; - params { - @in start_frame: int; [[The first frame.]] - @in frame_num: int; [[Number of frames in the sequence.]] - } - } data_set { [[Sets the raw image data of the given image object. @@ -750,7 +651,13 @@ class Evas.Image (Evas.Object, Efl.File, Efl.Image, Efl.Gfx.Fill, Efl.Gfx.View, Efl.File.mmap.set; Efl.File.mmap.get; Efl.File.save; - Efl.Image.animated.get; + Efl.Image_Animated.animated.get; + Efl.Image_Animated.animated_frame.get; + Efl.Image_Animated.animated_frame.set; + Efl.Image_Animated.animated_frame_count.get; + Efl.Image_Animated.animated_loop_type.get; + Efl.Image_Animated.animated_loop_count.get; + Efl.Image_Animated.animated_frame_duration.get; Efl.Image.load_size.set; Efl.Image.load_size.get; Efl.Image.smooth_scale.set; diff --git a/src/lib/evas/canvas/evas_object_image.c b/src/lib/evas/canvas/evas_object_image.c index 9d674c2732..15f2b0c07f 100644 --- a/src/lib/evas/canvas/evas_object_image.c +++ b/src/lib/evas/canvas/evas_object_image.c @@ -2248,7 +2248,7 @@ _evas_image_region_support_get(Eo *eo_obj, Evas_Image_Data *o) /* animated feature */ EOLIAN static Eina_Bool -_evas_image_efl_image_animated_get(Eo *eo_obj, Evas_Image_Data *o) +_evas_image_efl_image_animated_animated_get(Eo *eo_obj, Evas_Image_Data *o) { Eina_Bool animated; Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS); @@ -2262,7 +2262,7 @@ _evas_image_efl_image_animated_get(Eo *eo_obj, Evas_Image_Data *o) } EOLIAN static int -_evas_image_animated_frame_count_get(Eo *eo_obj, Evas_Image_Data *o) +_evas_image_efl_image_animated_animated_frame_count_get(Eo *eo_obj, Evas_Image_Data *o) { int frame_count; frame_count = -1; @@ -2276,23 +2276,22 @@ _evas_image_animated_frame_count_get(Eo *eo_obj, Evas_Image_Data *o) return frame_count; } -EOLIAN static Evas_Image_Animated_Loop_Hint -_evas_image_animated_loop_type_get(Eo *eo_obj, Evas_Image_Data *o) +EOLIAN static Efl_Image_Animated_Loop_Hint +_evas_image_efl_image_animated_animated_loop_type_get(Eo *eo_obj, Evas_Image_Data *o) { Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS); + Efl_Image_Animated_Loop_Hint hint = EFL_IMAGE_ANIMATED_LOOP_HINT_NONE; - Evas_Image_Animated_Loop_Hint hint; - hint = EVAS_IMAGE_ANIMATED_HINT_NONE; if (!evas_object_image_animated_get(eo_obj)) return hint; if (ENFN->image_animated_loop_type_get) - hint = ENFN->image_animated_loop_type_get(ENDT, o->engine_data); + hint = (Efl_Image_Animated_Loop_Hint) ENFN->image_animated_loop_type_get(ENDT, o->engine_data); return hint; } EOLIAN static int -_evas_image_animated_loop_count_get(Eo *eo_obj, Evas_Image_Data *o) +_evas_image_efl_image_animated_animated_loop_count_get(Eo *eo_obj, Evas_Image_Data *o) { Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS); @@ -2309,14 +2308,12 @@ _evas_image_animated_loop_count_get(Eo *eo_obj, Evas_Image_Data *o) } EOLIAN static double -_evas_image_animated_frame_duration_get(const Eo *eo_obj, Evas_Image_Data *o, int start_frame, int frame_num) +_evas_image_efl_image_animated_animated_frame_duration_get(Eo *eo_obj, Evas_Image_Data *o, int start_frame, int frame_num) { Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS); + double frame_duration = -1; int frame_count = 0; - double frame_duration; - frame_duration = -1; - if (!ENFN->image_animated_frame_count_get) return frame_duration; frame_count = ENFN->image_animated_frame_count_get(ENDT, o->engine_data); @@ -2328,24 +2325,24 @@ _evas_image_animated_frame_duration_get(const Eo *eo_obj, Evas_Image_Data *o, in return frame_duration; } -EOLIAN static void -_evas_image_animated_frame_set(Eo *eo_obj, Evas_Image_Data *o, int frame_index) +EOLIAN static Eina_Bool +_evas_image_efl_image_animated_animated_frame_set(Eo *eo_obj, Evas_Image_Data *o, int frame_index) { Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS); int frame_count = 0; - if (!o->cur->u.file) return; - if (o->cur->frame == frame_index) return; + if (!o->cur->u.file) return EINA_FALSE; + if (o->cur->frame == frame_index) return EINA_TRUE; - if (!evas_object_image_animated_get(eo_obj)) return; + if (!evas_object_image_animated_get(eo_obj)) return EINA_FALSE; evas_object_async_block(obj); frame_count = evas_object_image_animated_frame_count_get(eo_obj); /* limit the size of frame to FRAME_MAX */ if ((frame_count > FRAME_MAX) || (frame_count < 0) || (frame_index > frame_count)) - return; + return EINA_FALSE; - if (!ENFN->image_animated_frame_set) return; + if (!ENFN->image_animated_frame_set) return EINA_FALSE; ENFN->image_animated_frame_set(ENDT, o->engine_data, frame_index); // if (!ENFN->image_animated_frame_set(ENDT, o->engine_data, frame_index)) return; @@ -2360,6 +2357,15 @@ _evas_image_animated_frame_set(Eo *eo_obj, Evas_Image_Data *o, int frame_index) o->changed = EINA_TRUE; evas_object_change(eo_obj, obj); + return EINA_TRUE; +} + +EOLIAN static int +_evas_image_efl_image_animated_animated_frame_get(Eo *eo_obj, Evas_Image_Data *o) +{ + if (!o->cur->u.file) return EINA_FALSE; + if (!evas_object_image_animated_get(eo_obj)) return EINA_FALSE; + return o->cur->frame; } EOLIAN void @@ -4950,6 +4956,36 @@ evas_object_image_animated_get(const Eo *obj) } EAPI void +evas_object_image_animated_frame_set(Evas_Object *obj, int frame_index) +{ + efl_image_animated_frame_set(obj, frame_index); +} + +EAPI int +evas_object_image_animated_frame_count_get(const Evas_Object *obj) +{ + return efl_image_animated_frame_count_get(obj); +} + +EAPI Evas_Image_Animated_Loop_Hint +evas_object_image_animated_loop_type_get(const Evas_Object *obj) +{ + return (Evas_Image_Animated_Loop_Hint) efl_image_animated_loop_type_get(obj); +} + +EAPI int +evas_object_image_animated_loop_count_get(const Evas_Object *obj) +{ + return efl_image_animated_loop_count_get(obj); +} + +EAPI double +evas_object_image_animated_frame_duration_get(const Evas_Object *obj, int start_frame, int frame_num) +{ + return efl_image_animated_frame_duration_get(obj, start_frame, frame_num); +} + +EAPI void evas_object_image_load_size_set(Eo *obj, int w, int h) { efl_image_load_size_set((Eo *) obj, w, h); diff --git a/src/lib/evas/canvas/evas_types.eot b/src/lib/evas/canvas/evas_types.eot index bbd376f36b..138b319769 100644 --- a/src/lib/evas/canvas/evas_types.eot +++ b/src/lib/evas/canvas/evas_types.eot @@ -1,6 +1,5 @@ type @extern Evas.Load_Error: int; /* FIXME: Need to migrate emile. */ type @extern Evas.Image_Scale_Hint: int; /* FIXME: Need to migrate emile. */ -type @extern Evas.Image_Animated_Loop_Hint: int; /* FIXME: Need to migrate emile. */ struct @extern Evas.Video_Surface; /* FIXME: The structure is full of the unsupported func pointers. */ /* FIXME: Unsupported annonymous structures inside */ |