efl_animation: Add alpha animation
authorJaehyun Cho <jae_hyun.cho@samsung.com>
Fri, 25 Aug 2017 01:14:51 +0000 (10:14 +0900)
committerJaehyun Cho <jae_hyun.cho@samsung.com>
Thu, 12 Oct 2017 12:03:49 +0000 (21:03 +0900)
src/Makefile_Evas.am
src/lib/evas/Evas_Common.h
src/lib/evas/Evas_Eo.h
src/lib/evas/canvas/efl_animation_alpha.c [new file with mode: 0644]
src/lib/evas/canvas/efl_animation_alpha.eo [new file with mode: 0644]
src/lib/evas/canvas/efl_animation_alpha_private.h [new file with mode: 0644]

index d136f38..c938821 100644 (file)
@@ -45,6 +45,7 @@ evas_eolian_pub_files = \
        lib/evas/canvas/efl_input_focus.eo \
        lib/evas/canvas/efl_gfx_map.eo \
        lib/evas/canvas/efl_animation.eo \
+       lib/evas/canvas/efl_animation_alpha.eo \
        lib/evas/canvas/efl_animation_object.eo \
        $(NULL)
 
@@ -125,6 +126,7 @@ lib/evas/canvas/evas_polygon_private.h \
 lib/evas/canvas/efl_canvas_surface.h \
 lib/evas/common3d/primitives/primitive_common.h \
 lib/evas/canvas/efl_animation_private.h \
+lib/evas/canvas/efl_animation_alpha_private.h \
 lib/evas/canvas/efl_animation_object_private.h
 
 # Linebreak
@@ -212,6 +214,7 @@ 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 \
+lib/evas/canvas/efl_animation_alpha.c \
 lib/evas/canvas/efl_animation_object.c \
 $(NULL)
 
index eb346ae..e45bef8 100644 (file)
@@ -3337,6 +3337,13 @@ typedef Eo Efl_Animation;
 
 #endif
 
+#ifndef _EFL_ANIMATION_ALPHA_EO_CLASS_TYPE
+#define _EFL_ANIMATION_ALPHA_EO_CLASS_TYPE
+
+typedef Eo Efl_Animation_Alpha;
+
+#endif
+
 #ifndef _EFL_ANIMATION_OBJECT_EO_CLASS_TYPE
 #define _EFL_ANIMATION_OBJECT_EO_CLASS_TYPE
 
index b7b376b..2c23397 100644 (file)
@@ -56,6 +56,7 @@
 #include "canvas/efl_canvas_object.eo.h"
 
 #include "canvas/efl_animation.eo.h"
+#include "canvas/efl_animation_alpha.eo.h"
 #include "canvas/efl_animation_object.eo.h"
 
 #endif /* EFL_EO_API_SUPPORT */
diff --git a/src/lib/evas/canvas/efl_animation_alpha.c b/src/lib/evas/canvas/efl_animation_alpha.c
new file mode 100644 (file)
index 0000000..7bbcac1
--- /dev/null
@@ -0,0 +1,41 @@
+#include "efl_animation_alpha_private.h"
+
+EOLIAN static void
+_efl_animation_alpha_alpha_set(Eo *eo_obj,
+                               Efl_Animation_Alpha_Data *pd,
+                               double from_alpha,
+                               double to_alpha)
+{
+   EFL_ANIMATION_ALPHA_CHECK_OR_RETURN(eo_obj);
+
+   pd->from.alpha = from_alpha;
+   pd->to.alpha = to_alpha;
+}
+
+EOLIAN static void
+_efl_animation_alpha_alpha_get(Eo *eo_obj EINA_UNUSED,
+                               Efl_Animation_Alpha_Data *pd,
+                               double *from_alpha,
+                               double *to_alpha)
+{
+   EFL_ANIMATION_ALPHA_CHECK_OR_RETURN(eo_obj);
+
+   if (from_alpha)
+     *from_alpha = pd->from.alpha;
+   if (to_alpha)
+     *to_alpha = pd->to.alpha;
+}
+
+EOLIAN static Efl_Object *
+_efl_animation_alpha_efl_object_constructor(Eo *eo_obj,
+                                            Efl_Animation_Alpha_Data *pd)
+{
+   eo_obj = efl_constructor(efl_super(eo_obj, MY_CLASS));
+
+   pd->from.alpha = 1.0;
+   pd->to.alpha = 1.0;
+
+   return eo_obj;
+}
+
+#include "efl_animation_alpha.eo.c"
diff --git a/src/lib/evas/canvas/efl_animation_alpha.eo b/src/lib/evas/canvas/efl_animation_alpha.eo
new file mode 100644 (file)
index 0000000..a037a9a
--- /dev/null
@@ -0,0 +1,22 @@
+import efl_animation_types;
+
+class Efl.Animation.Alpha (Efl.Animation)
+{
+   [[Efl alpha animation class]]
+   data: Efl_Animation_Alpha_Data;
+   methods {
+      @property alpha {
+         set {
+         }
+         get {
+         }
+         values {
+            from_alpha: double; [[Alpha value when animation starts]]
+            to_alpha: double; [[Alpha value when animation ends]]
+         }
+      }
+   }
+   implements {
+      Efl.Object.constructor;
+   }
+}
diff --git a/src/lib/evas/canvas/efl_animation_alpha_private.h b/src/lib/evas/canvas/efl_animation_alpha_private.h
new file mode 100644 (file)
index 0000000..58e429e
--- /dev/null
@@ -0,0 +1,32 @@
+#define EFL_ANIMATION_PROTECTED
+
+#include "evas_common_private.h"
+
+#define MY_CLASS EFL_ANIMATION_ALPHA_CLASS
+#define MY_CLASS_NAME efl_class_name_get(MY_CLASS)
+
+#define EFL_ANIMATION_ALPHA_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_ALPHA_DATA_GET(o, pd) \
+   Efl_Animation_Alpha_Data *pd = efl_data_scope_get(o, EFL_ANIMATION_ALPHA_CLASS)
+
+typedef struct _Efl_Animation_Alpha_Property
+{
+   double alpha;
+} Efl_Animation_Alpha_Property;
+
+typedef struct _Efl_Animation_Alpha_Data
+{
+   Efl_Animation_Alpha_Property from;
+   Efl_Animation_Alpha_Property to;
+} Efl_Animation_Alpha_Data;