From 31ed27f00226cc2a292d9bbbdf5c0e20ce81816c Mon Sep 17 00:00:00 2001 From: Jaehyun Cho Date: Fri, 25 Aug 2017 10:14:51 +0900 Subject: [PATCH] efl_animation: Add alpha animation --- src/Makefile_Evas.am | 3 ++ src/lib/evas/Evas_Common.h | 7 ++++ src/lib/evas/Evas_Eo.h | 1 + src/lib/evas/canvas/efl_animation_alpha.c | 41 +++++++++++++++++++++++ src/lib/evas/canvas/efl_animation_alpha.eo | 22 ++++++++++++ src/lib/evas/canvas/efl_animation_alpha_private.h | 32 ++++++++++++++++++ 6 files changed, 106 insertions(+) create mode 100644 src/lib/evas/canvas/efl_animation_alpha.c create mode 100644 src/lib/evas/canvas/efl_animation_alpha.eo create mode 100644 src/lib/evas/canvas/efl_animation_alpha_private.h diff --git a/src/Makefile_Evas.am b/src/Makefile_Evas.am index d136f38..c938821 100644 --- a/src/Makefile_Evas.am +++ b/src/Makefile_Evas.am @@ -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) diff --git a/src/lib/evas/Evas_Common.h b/src/lib/evas/Evas_Common.h index eb346ae..e45bef8 100644 --- a/src/lib/evas/Evas_Common.h +++ b/src/lib/evas/Evas_Common.h @@ -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 diff --git a/src/lib/evas/Evas_Eo.h b/src/lib/evas/Evas_Eo.h index b7b376b..2c23397 100644 --- a/src/lib/evas/Evas_Eo.h +++ b/src/lib/evas/Evas_Eo.h @@ -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 index 0000000..7bbcac1 --- /dev/null +++ b/src/lib/evas/canvas/efl_animation_alpha.c @@ -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 index 0000000..a037a9a --- /dev/null +++ b/src/lib/evas/canvas/efl_animation_alpha.eo @@ -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 index 0000000..58e429e --- /dev/null +++ b/src/lib/evas/canvas/efl_animation_alpha_private.h @@ -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; -- 2.7.4