diff options
author | Jaehyun Cho <jae_hyun.cho@samsung.com> | 2017-08-25 10:14:51 +0900 |
---|---|---|
committer | Jaehyun Cho <jae_hyun.cho@samsung.com> | 2017-10-12 21:03:49 +0900 |
commit | 31ed27f00226cc2a292d9bbbdf5c0e20ce81816c (patch) | |
tree | 73d14a88b7cf6e984d8cc089fe0aba5e0bcf51ad /src/lib | |
parent | b4d4e2a2cc4f673fc08554b659846b72f8833285 (diff) |
efl_animation: Add alpha animation
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/evas/Evas_Common.h | 7 | ||||
-rw-r--r-- | src/lib/evas/Evas_Eo.h | 1 | ||||
-rw-r--r-- | src/lib/evas/canvas/efl_animation_alpha.c | 41 | ||||
-rw-r--r-- | src/lib/evas/canvas/efl_animation_alpha.eo | 22 | ||||
-rw-r--r-- | src/lib/evas/canvas/efl_animation_alpha_private.h | 32 |
5 files changed, 103 insertions, 0 deletions
diff --git a/src/lib/evas/Evas_Common.h b/src/lib/evas/Evas_Common.h index eb346ae734..e45bef86ed 100644 --- a/src/lib/evas/Evas_Common.h +++ b/src/lib/evas/Evas_Common.h | |||
@@ -3337,6 +3337,13 @@ typedef Eo Efl_Animation; | |||
3337 | 3337 | ||
3338 | #endif | 3338 | #endif |
3339 | 3339 | ||
3340 | #ifndef _EFL_ANIMATION_ALPHA_EO_CLASS_TYPE | ||
3341 | #define _EFL_ANIMATION_ALPHA_EO_CLASS_TYPE | ||
3342 | |||
3343 | typedef Eo Efl_Animation_Alpha; | ||
3344 | |||
3345 | #endif | ||
3346 | |||
3340 | #ifndef _EFL_ANIMATION_OBJECT_EO_CLASS_TYPE | 3347 | #ifndef _EFL_ANIMATION_OBJECT_EO_CLASS_TYPE |
3341 | #define _EFL_ANIMATION_OBJECT_EO_CLASS_TYPE | 3348 | #define _EFL_ANIMATION_OBJECT_EO_CLASS_TYPE |
3342 | 3349 | ||
diff --git a/src/lib/evas/Evas_Eo.h b/src/lib/evas/Evas_Eo.h index b7b376b8a8..2c233974c4 100644 --- a/src/lib/evas/Evas_Eo.h +++ b/src/lib/evas/Evas_Eo.h | |||
@@ -56,6 +56,7 @@ | |||
56 | #include "canvas/efl_canvas_object.eo.h" | 56 | #include "canvas/efl_canvas_object.eo.h" |
57 | 57 | ||
58 | #include "canvas/efl_animation.eo.h" | 58 | #include "canvas/efl_animation.eo.h" |
59 | #include "canvas/efl_animation_alpha.eo.h" | ||
59 | #include "canvas/efl_animation_object.eo.h" | 60 | #include "canvas/efl_animation_object.eo.h" |
60 | 61 | ||
61 | #endif /* EFL_EO_API_SUPPORT */ | 62 | #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 0000000000..7bbcac16e7 --- /dev/null +++ b/src/lib/evas/canvas/efl_animation_alpha.c | |||
@@ -0,0 +1,41 @@ | |||
1 | #include "efl_animation_alpha_private.h" | ||
2 | |||
3 | EOLIAN static void | ||
4 | _efl_animation_alpha_alpha_set(Eo *eo_obj, | ||
5 | Efl_Animation_Alpha_Data *pd, | ||
6 | double from_alpha, | ||
7 | double to_alpha) | ||
8 | { | ||
9 | EFL_ANIMATION_ALPHA_CHECK_OR_RETURN(eo_obj); | ||
10 | |||
11 | pd->from.alpha = from_alpha; | ||
12 | pd->to.alpha = to_alpha; | ||
13 | } | ||
14 | |||
15 | EOLIAN static void | ||
16 | _efl_animation_alpha_alpha_get(Eo *eo_obj EINA_UNUSED, | ||
17 | Efl_Animation_Alpha_Data *pd, | ||
18 | double *from_alpha, | ||
19 | double *to_alpha) | ||
20 | { | ||
21 | EFL_ANIMATION_ALPHA_CHECK_OR_RETURN(eo_obj); | ||
22 | |||
23 | if (from_alpha) | ||
24 | *from_alpha = pd->from.alpha; | ||
25 | if (to_alpha) | ||
26 | *to_alpha = pd->to.alpha; | ||
27 | } | ||
28 | |||
29 | EOLIAN static Efl_Object * | ||
30 | _efl_animation_alpha_efl_object_constructor(Eo *eo_obj, | ||
31 | Efl_Animation_Alpha_Data *pd) | ||
32 | { | ||
33 | eo_obj = efl_constructor(efl_super(eo_obj, MY_CLASS)); | ||
34 | |||
35 | pd->from.alpha = 1.0; | ||
36 | pd->to.alpha = 1.0; | ||
37 | |||
38 | return eo_obj; | ||
39 | } | ||
40 | |||
41 | #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 0000000000..a037a9a92b --- /dev/null +++ b/src/lib/evas/canvas/efl_animation_alpha.eo | |||
@@ -0,0 +1,22 @@ | |||
1 | import efl_animation_types; | ||
2 | |||
3 | class Efl.Animation.Alpha (Efl.Animation) | ||
4 | { | ||
5 | [[Efl alpha animation class]] | ||
6 | data: Efl_Animation_Alpha_Data; | ||
7 | methods { | ||
8 | @property alpha { | ||
9 | set { | ||
10 | } | ||
11 | get { | ||
12 | } | ||
13 | values { | ||
14 | from_alpha: double; [[Alpha value when animation starts]] | ||
15 | to_alpha: double; [[Alpha value when animation ends]] | ||
16 | } | ||
17 | } | ||
18 | } | ||
19 | implements { | ||
20 | Efl.Object.constructor; | ||
21 | } | ||
22 | } | ||
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 0000000000..58e429eb07 --- /dev/null +++ b/src/lib/evas/canvas/efl_animation_alpha_private.h | |||
@@ -0,0 +1,32 @@ | |||
1 | #define EFL_ANIMATION_PROTECTED | ||
2 | |||
3 | #include "evas_common_private.h" | ||
4 | |||
5 | #define MY_CLASS EFL_ANIMATION_ALPHA_CLASS | ||
6 | #define MY_CLASS_NAME efl_class_name_get(MY_CLASS) | ||
7 | |||
8 | #define EFL_ANIMATION_ALPHA_CHECK_OR_RETURN(anim, ...) \ | ||
9 | do { \ | ||
10 | if (!anim) { \ | ||
11 | CRI("Efl_Animation " # anim " is NULL!"); \ | ||
12 | return __VA_ARGS__; \ | ||
13 | } \ | ||
14 | if (efl_animation_is_deleted(anim)) { \ | ||
15 | ERR("Efl_Animation " # anim " has already been deleted!"); \ | ||
16 | return __VA_ARGS__; \ | ||
17 | } \ | ||
18 | } while (0) | ||
19 | |||
20 | #define EFL_ANIMATION_ALPHA_DATA_GET(o, pd) \ | ||
21 | Efl_Animation_Alpha_Data *pd = efl_data_scope_get(o, EFL_ANIMATION_ALPHA_CLASS) | ||
22 | |||
23 | typedef struct _Efl_Animation_Alpha_Property | ||
24 | { | ||
25 | double alpha; | ||
26 | } Efl_Animation_Alpha_Property; | ||
27 | |||
28 | typedef struct _Efl_Animation_Alpha_Data | ||
29 | { | ||
30 | Efl_Animation_Alpha_Property from; | ||
31 | Efl_Animation_Alpha_Property to; | ||
32 | } Efl_Animation_Alpha_Data; | ||