summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaehyun Cho <jae_hyun.cho@samsung.com>2017-07-03 16:07:32 +0900
committerJaehyun Cho <jae_hyun.cho@samsung.com>2017-08-18 12:06:01 +0900
commit44fdcc01608a0bb32c608a71f75696c5ef496d25 (patch)
treeeb98b081b99d76b238628cf6a16351ae3e53ea3b
parenta21f25b0eb07cf42373bc4303e19cb9cb6cf9dc2 (diff)
downloadefl-44fdcc01608a0bb32c608a71f75696c5ef496d25.tar.gz
efl_animation: Add efl_animation
Efl.Animation is an abstract class which contains basic properties of animation for Efl.Canvas.Object.
-rw-r--r--src/Makefile_Evas.am5
-rw-r--r--src/lib/evas/Evas_Common.h7
-rw-r--r--src/lib/evas/Evas_Eo.h4
-rw-r--r--src/lib/evas/Evas_Internal.h1
-rw-r--r--src/lib/evas/canvas/efl_animation.c155
-rw-r--r--src/lib/evas/canvas/efl_animation.eo41
-rw-r--r--src/lib/evas/canvas/efl_animation_types.eot2
-rw-r--r--src/lib/evas/include/evas_private.h2
8 files changed, 216 insertions, 1 deletions
diff --git a/src/Makefile_Evas.am b/src/Makefile_Evas.am
index 37e1167829..da393b87fd 100644
--- a/src/Makefile_Evas.am
+++ b/src/Makefile_Evas.am
@@ -50,6 +50,7 @@ evas_eolian_pub_files = \
lib/evas/canvas/efl_input_hold.eo \
lib/evas/canvas/efl_input_focus.eo \
lib/evas/canvas/efl_gfx_map.eo \
+ lib/evas/canvas/efl_animation.eo \
$(NULL)
evas_eolian_legacy_files = \
@@ -66,7 +67,8 @@ evas_eolian_priv_files = \
lib/evas/include/evas_ector_buffer.eo
evas_eolian_type_files = \
- lib/evas/canvas/evas_canvas3d_types.eot
+ lib/evas/canvas/evas_canvas3d_types.eot \
+ lib/evas/canvas/efl_animation_types.eot
evas_eolian_priv_c = $(evas_eolian_priv_files:%.eo=%.eo.c)
evas_eolian_priv_h = $(evas_eolian_priv_files:%.eo=%.eo.h) \
@@ -213,6 +215,7 @@ lib/evas/canvas/efl_input_key.c \
lib/evas/canvas/efl_input_pointer.c \
lib/evas/canvas/efl_input_hold.c \
lib/evas/canvas/efl_input_focus.c \
+lib/evas/canvas/efl_animation.c \
$(NULL)
EXTRA_DIST2 += \
diff --git a/src/lib/evas/Evas_Common.h b/src/lib/evas/Evas_Common.h
index 9fa88a9463..273fe3a879 100644
--- a/src/lib/evas/Evas_Common.h
+++ b/src/lib/evas/Evas_Common.h
@@ -3321,6 +3321,13 @@ EAPI const Eina_List *evas_font_path_global_list(void) EINA_WARN_UNUSED_R
*/
EAPI void evas_font_reinit(void);
+#ifndef _EFL_ANIMATION_EO_CLASS_TYPE
+#define _EFL_ANIMATION_EO_CLASS_TYPE
+
+typedef Eo Efl_Animation;
+
+#endif
+
/**
* @}
*/
diff --git a/src/lib/evas/Evas_Eo.h b/src/lib/evas/Evas_Eo.h
index 7dd6b087db..c179e8d69d 100644
--- a/src/lib/evas/Evas_Eo.h
+++ b/src/lib/evas/Evas_Eo.h
@@ -62,7 +62,11 @@
* @}
*/
+#include "canvas/efl_animation_types.eot.h"
+
#include "canvas/efl_canvas_object.eo.h"
+
+#include "canvas/efl_animation.eo.h"
#endif /* EFL_EO_API_SUPPORT */
#if defined(EFL_BETA_API_SUPPORT) && defined(EFL_EO_API_SUPPORT)
diff --git a/src/lib/evas/Evas_Internal.h b/src/lib/evas/Evas_Internal.h
index 28702ef65c..09b7d5dc55 100644
--- a/src/lib/evas/Evas_Internal.h
+++ b/src/lib/evas/Evas_Internal.h
@@ -73,6 +73,7 @@ EWAPI extern const Efl_Event_Description _EVAS_CANVAS_EVENT_VIEWPORT_RESIZE;
#define EFL_CANVAS_GROUP_ADD_OPS(kls) EFL_OBJECT_OP_FUNC(efl_canvas_group_add, _##kls##_efl_canvas_group_group_add)
#define EFL_CANVAS_GROUP_ADD_DEL_OPS(kls) EFL_CANVAS_GROUP_ADD_OPS(kls), EFL_CANVAS_GROUP_DEL_OPS(kls)
+EOAPI Eina_Bool efl_animation_is_deleted(Eo *obj);
#ifdef __cplusplus
}
diff --git a/src/lib/evas/canvas/efl_animation.c b/src/lib/evas/canvas/efl_animation.c
new file mode 100644
index 0000000000..a19b9d2387
--- /dev/null
+++ b/src/lib/evas/canvas/efl_animation.c
@@ -0,0 +1,155 @@
+#include "evas_common_private.h"
+#include "evas_private.h"
+#include <Ecore.h>
+
+#define MY_CLASS EFL_ANIMATION_CLASS
+#define MY_CLASS_NAME efl_class_name_get(MY_CLASS)
+
+#define EFL_ANIMATION_CHECK_OR_RETURN(anim, ...) \
+ do { \
+ if (!anim) { \
+ CRI("Efl_Animation " # anim " is NULL!"); \
+ return __VA_ARGS__; \
+ } \
+ if (efl_animation_is_deleted(anim)) { \
+ ERR("Efl_Animation " # anim " has already been deleted!"); \
+ return __VA_ARGS__; \
+ } \
+ } while (0)
+
+#define EFL_ANIMATION_DATA_GET(o, pd) \
+ Evas_Object_Animation_Data *pd = efl_data_scope_get(o, EFL_ANIMATION_CLASS)
+
+struct _Evas_Object_Animation_Data
+{
+ /*
+ * FIXME: The following properties should be added.
+ * Current Interpolation Function
+ * Eina_Bool auto_delete;
+ * int repeat_time;
+ * int current_loop; //Default value is 1
+ * Eina_Bool is_reverse;
+ */
+ Efl_Canvas_Object *target;
+
+ double duration;
+
+ Eina_Bool deleted : 1;
+ Eina_Bool state_keep : 1;
+};
+
+static void
+_target_del_cb(void *data, const Efl_Event *event EINA_UNUSED)
+{
+ Eo *eo_obj = data;
+
+ EFL_ANIMATION_CHECK_OR_RETURN(eo_obj);
+ EFL_ANIMATION_DATA_GET(eo_obj, pd);
+
+ pd->target = NULL;
+}
+
+EOLIAN static void
+_efl_animation_target_set(Eo *eo_obj,
+ Evas_Object_Animation_Data *pd,
+ Efl_Canvas_Object *target)
+{
+ EFL_ANIMATION_CHECK_OR_RETURN(eo_obj);
+
+ efl_event_callback_add(target, EFL_EVENT_DEL, _target_del_cb, eo_obj);
+
+ pd->target = target;
+}
+
+EOLIAN static Efl_Canvas_Object *
+_efl_animation_target_get(Eo *eo_obj, Evas_Object_Animation_Data *pd)
+{
+ EFL_ANIMATION_CHECK_OR_RETURN(eo_obj, NULL);
+
+ return pd->target;
+}
+
+
+EOLIAN static void
+_efl_animation_duration_set(Eo *eo_obj,
+ Evas_Object_Animation_Data *pd,
+ double duration)
+{
+ EFL_ANIMATION_CHECK_OR_RETURN(eo_obj);
+
+ if (duration <= 0.0) return;
+
+ pd->duration = duration;
+}
+
+EOLIAN static double
+_efl_animation_duration_get(Eo *eo_obj, Evas_Object_Animation_Data *pd)
+{
+ EFL_ANIMATION_CHECK_OR_RETURN(eo_obj, 0.0);
+
+ return pd->duration;
+}
+
+EOLIAN static Eina_Bool
+_efl_animation_is_deleted(Eo *eo_obj, Evas_Object_Animation_Data *pd)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(eo_obj, EINA_TRUE);
+
+ return pd->deleted;
+}
+
+EOLIAN static void
+_efl_animation_final_state_keep_set(Eo *eo_obj,
+ Evas_Object_Animation_Data *pd,
+ Eina_Bool state_keep)
+{
+ EFL_ANIMATION_CHECK_OR_RETURN(eo_obj);
+
+ if (pd->state_keep == state_keep) return;
+
+ pd->state_keep = !!state_keep;
+}
+
+EOLIAN static Eina_Bool
+_efl_animation_final_state_keep_get(Eo *eo_obj, Evas_Object_Animation_Data *pd)
+{
+ EFL_ANIMATION_CHECK_OR_RETURN(eo_obj, EINA_FALSE);
+
+ return pd->state_keep;
+}
+
+EOLIAN static Efl_Object *
+_efl_animation_efl_object_constructor(Eo *eo_obj,
+ Evas_Object_Animation_Data *pd)
+{
+ eo_obj = efl_constructor(efl_super(eo_obj, MY_CLASS));
+
+ pd->target = NULL;
+
+ pd->duration = 0.0;
+
+ pd->deleted = EINA_FALSE;
+ pd->state_keep = EINA_FALSE;
+
+ return eo_obj;
+}
+
+EOLIAN static void
+_efl_animation_efl_object_destructor(Eo *eo_obj, Evas_Object_Animation_Data *pd)
+{
+ pd->deleted = EINA_TRUE;
+
+ if (pd->target)
+ efl_event_callback_del(pd->target, EFL_EVENT_DEL, _target_del_cb, eo_obj);
+
+ efl_destructor(efl_super(eo_obj, MY_CLASS));
+}
+
+/* Internal EO APIs */
+
+EOAPI EFL_FUNC_BODY(efl_animation_is_deleted, Eina_Bool, 0);
+
+#define EFL_ANIMATION_EXTRA_OPS \
+ EFL_OBJECT_OP_FUNC(efl_animation_is_deleted, _efl_animation_is_deleted)
+
+#include "efl_animation.eo.c"
diff --git a/src/lib/evas/canvas/efl_animation.eo b/src/lib/evas/canvas/efl_animation.eo
new file mode 100644
index 0000000000..549279d968
--- /dev/null
+++ b/src/lib/evas/canvas/efl_animation.eo
@@ -0,0 +1,41 @@
+import efl_animation_types;
+
+abstract Efl.Animation (Efl.Object)
+{
+ [[Efl animation abstract class]]
+ legacy_prefix: evas_object_animation;
+ data: Evas_Object_Animation_Data;
+ methods {
+ @property target {
+ set {
+ }
+ get {
+ }
+ values {
+ target: Efl.Canvas.Object; [[Target object which is applied animation]]
+ }
+ }
+ @property final_state_keep {
+ set {
+ }
+ get {
+ }
+ values {
+ state_keep: bool; [[$true to keep final state, $false otherwise]]
+ }
+ }
+ @property duration {
+ set {
+ }
+ get {
+ }
+ values {
+ duration: double; [[Duration value]]
+ }
+ }
+ }
+ implements {
+ Efl.Object.constructor;
+ Efl.Object.destructor;
+ }
+}
diff --git a/src/lib/evas/canvas/efl_animation_types.eot b/src/lib/evas/canvas/efl_animation_types.eot
new file mode 100644
index 0000000000..f9047e3061
--- /dev/null
+++ b/src/lib/evas/canvas/efl_animation_types.eot
@@ -0,0 +1,2 @@
+// ----------------------------------------------------------------------------
+// All the below types are for Efl Animation
diff --git a/src/lib/evas/include/evas_private.h b/src/lib/evas/include/evas_private.h
index 7cb9b85106..3c44ab4e26 100644
--- a/src/lib/evas/include/evas_private.h
+++ b/src/lib/evas/include/evas_private.h
@@ -108,6 +108,8 @@ typedef struct _Evas_Pointer_Data Evas_Pointer_Data;
typedef struct _Evas_Filter_Command Evas_Filter_Command;
typedef enum _Evas_Filter_Support Evas_Filter_Support;
+typedef struct _Evas_Object_Animation_Data Evas_Object_Animation_Data;
+
// 3D stuff
#define EVAS_CANVAS3D_VERTEX_ATTRIB_COUNT 5