summaryrefslogtreecommitdiff
path: root/src/lib/evas/canvas
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/evas/canvas')
-rw-r--r--src/lib/evas/canvas/efl_canvas_animation.c51
-rw-r--r--src/lib/evas/canvas/efl_canvas_animation.eo91
-rw-r--r--src/lib/evas/canvas/efl_canvas_animation_alpha.eo15
-rw-r--r--src/lib/evas/canvas/efl_canvas_animation_group.c20
-rw-r--r--src/lib/evas/canvas/efl_canvas_animation_group.eo24
-rw-r--r--src/lib/evas/canvas/efl_canvas_animation_group_parallel.c14
-rw-r--r--src/lib/evas/canvas/efl_canvas_animation_group_parallel.eo9
-rw-r--r--src/lib/evas/canvas/efl_canvas_animation_group_sequential.c14
-rw-r--r--src/lib/evas/canvas/efl_canvas_animation_group_sequential.eo10
-rw-r--r--src/lib/evas/canvas/efl_canvas_animation_player.c444
-rw-r--r--src/lib/evas/canvas/efl_canvas_animation_player.eo62
-rw-r--r--src/lib/evas/canvas/efl_canvas_animation_player_private.h53
-rw-r--r--src/lib/evas/canvas/efl_canvas_animation_private.h4
-rw-r--r--src/lib/evas/canvas/efl_canvas_animation_rotate.c44
-rw-r--r--src/lib/evas/canvas/efl_canvas_animation_rotate.eo44
-rw-r--r--src/lib/evas/canvas/efl_canvas_animation_rotate_private.h9
-rw-r--r--src/lib/evas/canvas/efl_canvas_animation_scale.c134
-rw-r--r--src/lib/evas/canvas/efl_canvas_animation_scale.eo49
-rw-r--r--src/lib/evas/canvas/efl_canvas_animation_scale_private.h18
-rw-r--r--src/lib/evas/canvas/efl_canvas_animation_translate.c75
-rw-r--r--src/lib/evas/canvas/efl_canvas_animation_translate.eo32
-rw-r--r--src/lib/evas/canvas/efl_canvas_animation_translate_private.h10
-rw-r--r--src/lib/evas/canvas/efl_canvas_animation_types.eot9
-rw-r--r--src/lib/evas/canvas/efl_canvas_image.c22
-rw-r--r--src/lib/evas/canvas/efl_canvas_image.eo1
-rw-r--r--src/lib/evas/canvas/efl_canvas_object.eo6
-rw-r--r--src/lib/evas/canvas/efl_canvas_object_animation.c214
-rw-r--r--src/lib/evas/canvas/efl_canvas_object_animation.eo60
-rw-r--r--src/lib/evas/canvas/efl_canvas_pointer.eo35
-rw-r--r--src/lib/evas/canvas/efl_canvas_scene.eo244
-rw-r--r--src/lib/evas/canvas/efl_canvas_text.eo324
-rw-r--r--src/lib/evas/canvas/efl_canvas_text_eo.legacy.c66
-rw-r--r--src/lib/evas/canvas/efl_canvas_textblock.eo565
-rw-r--r--src/lib/evas/canvas/efl_canvas_textblock_eo.legacy.c72
-rw-r--r--src/lib/evas/canvas/efl_canvas_textblock_eo.legacy.h (renamed from src/lib/evas/canvas/efl_canvas_text_eo.legacy.h)36
-rw-r--r--src/lib/evas/canvas/efl_canvas_textblock_factory.eo (renamed from src/lib/evas/canvas/efl_canvas_text_factory.eo)2
-rw-r--r--src/lib/evas/canvas/efl_canvas_textblock_internal.h315
-rw-r--r--src/lib/evas/canvas/efl_canvas_vg_container.c20
-rw-r--r--src/lib/evas/canvas/efl_canvas_vg_gradient_linear.c4
-rw-r--r--src/lib/evas/canvas/efl_canvas_vg_gradient_radial.c4
-rw-r--r--src/lib/evas/canvas/efl_canvas_vg_node.c2
-rw-r--r--src/lib/evas/canvas/efl_canvas_vg_object.c60
-rw-r--r--src/lib/evas/canvas/efl_canvas_vg_object.eo1
-rw-r--r--src/lib/evas/canvas/efl_canvas_vg_object_eo.legacy.h2
-rw-r--r--src/lib/evas/canvas/efl_input_device.c331
-rw-r--r--src/lib/evas/canvas/efl_input_device.eo102
-rw-r--r--src/lib/evas/canvas/efl_input_event.c4
-rw-r--r--src/lib/evas/canvas/efl_input_focus.c5
-rw-r--r--src/lib/evas/canvas/efl_input_hold.c3
-rw-r--r--src/lib/evas/canvas/efl_input_key.c3
-rw-r--r--src/lib/evas/canvas/efl_input_pointer.c3
-rw-r--r--src/lib/evas/canvas/efl_input_types.eot178
-rw-r--r--src/lib/evas/canvas/efl_text_attribute_factory.c133
-rw-r--r--src/lib/evas/canvas/efl_text_attribute_factory.eo37
-rw-r--r--src/lib/evas/canvas/efl_text_cursor.c478
-rw-r--r--src/lib/evas/canvas/efl_text_cursor.eo235
-rw-r--r--src/lib/evas/canvas/evas_callbacks.c19
-rw-r--r--src/lib/evas/canvas/evas_device.c100
-rw-r--r--src/lib/evas/canvas/evas_events.c11
-rw-r--r--src/lib/evas/canvas/evas_events_legacy.c3
-rw-r--r--src/lib/evas/canvas/evas_focus.c2
-rw-r--r--src/lib/evas/canvas/evas_font_dir.c49
-rw-r--r--src/lib/evas/canvas/evas_image_private.h5
-rw-r--r--src/lib/evas/canvas/evas_key_grab.c3
-rw-r--r--src/lib/evas/canvas/evas_main.c6
-rw-r--r--src/lib/evas/canvas/evas_object_image.c31
-rw-r--r--src/lib/evas/canvas/evas_object_main.c108
-rw-r--r--src/lib/evas/canvas/evas_object_text.c82
-rw-r--r--src/lib/evas/canvas/evas_object_textblock.c3003
-rw-r--r--src/lib/evas/canvas/evas_object_textgrid.c46
-rw-r--r--src/lib/evas/canvas/evas_text_eo.c6
-rw-r--r--src/lib/evas/canvas/evas_textblock_hyphenation.x4
-rw-r--r--src/lib/evas/canvas/evas_textblock_legacy.h114
-rw-r--r--src/lib/evas/canvas/evas_textgrid_eo.c16
-rw-r--r--src/lib/evas/canvas/evas_textgrid_eo.h2
-rw-r--r--src/lib/evas/canvas/evas_textgrid_eo.legacy.h2
-rw-r--r--src/lib/evas/canvas/evas_vg_private.h7
-rw-r--r--src/lib/evas/canvas/meson.build21
78 files changed, 5562 insertions, 2880 deletions
diff --git a/src/lib/evas/canvas/efl_canvas_animation.c b/src/lib/evas/canvas/efl_canvas_animation.c
index b8c7c99..ae88dec 100644
--- a/src/lib/evas/canvas/efl_canvas_animation.c
+++ b/src/lib/evas/canvas/efl_canvas_animation.c
@@ -1,12 +1,15 @@
1#include "efl_canvas_animation_private.h" 1#include "efl_canvas_animation_private.h"
2 2#include <math.h>
3#define MY_CLASS EFL_CANVAS_ANIMATION_CLASS 3#define MY_CLASS EFL_CANVAS_ANIMATION_CLASS
4 4
5static double _default_animation_time = 0.2; //in seconds
6
5EOLIAN static void 7EOLIAN static void
6_efl_canvas_animation_duration_set(Eo *eo_obj EINA_UNUSED, 8_efl_canvas_animation_duration_set(Eo *eo_obj EINA_UNUSED,
7 Efl_Canvas_Animation_Data *pd, 9 Efl_Canvas_Animation_Data *pd,
8 double sec) 10 double sec)
9{ 11{
12 EINA_SAFETY_ON_FALSE_RETURN(sec >= 0.0);
10 pd->duration = sec; 13 pd->duration = sec;
11} 14}
12 15
@@ -38,9 +41,8 @@ _efl_canvas_animation_repeat_mode_set(Eo *eo_obj EINA_UNUSED,
38 Efl_Canvas_Animation_Data *pd, 41 Efl_Canvas_Animation_Data *pd,
39 Efl_Canvas_Animation_Repeat_Mode mode) 42 Efl_Canvas_Animation_Repeat_Mode mode)
40{ 43{
41 if ((mode == EFL_CANVAS_ANIMATION_REPEAT_MODE_RESTART) || 44 EINA_SAFETY_ON_FALSE_RETURN(mode >= 0 && mode < EFL_CANVAS_ANIMATION_REPEAT_MODE_LAST);
42 (mode == EFL_CANVAS_ANIMATION_REPEAT_MODE_REVERSE)) 45 pd->repeat_mode = mode;
43 pd->repeat_mode = mode;
44} 46}
45 47
46EOLIAN static Efl_Canvas_Animation_Repeat_Mode 48EOLIAN static Efl_Canvas_Animation_Repeat_Mode
@@ -50,20 +52,19 @@ _efl_canvas_animation_repeat_mode_get(const Eo *eo_obj EINA_UNUSED, Efl_Canvas_A
50} 52}
51 53
52EOLIAN static void 54EOLIAN static void
53_efl_canvas_animation_repeat_count_set(Eo *eo_obj EINA_UNUSED, 55_efl_canvas_animation_play_count_set(Eo *eo_obj EINA_UNUSED,
54 Efl_Canvas_Animation_Data *pd, 56 Efl_Canvas_Animation_Data *pd,
55 int count) 57 int count)
56{ 58{
57 //EFL_ANIMATION_REPEAT_INFINITE repeats animation infinitely 59 EINA_SAFETY_ON_FALSE_RETURN(count >= 0);
58 if ((count < 0) && (count != EFL_ANIMATION_REPEAT_INFINITE)) return;
59 60
60 pd->repeat_count = count; 61 pd->play_count = count;
61} 62}
62 63
63EOLIAN static int 64EOLIAN static int
64_efl_canvas_animation_repeat_count_get(const Eo *eo_obj EINA_UNUSED, Efl_Canvas_Animation_Data *pd) 65_efl_canvas_animation_play_count_get(const Eo *eo_obj EINA_UNUSED, Efl_Canvas_Animation_Data *pd)
65{ 66{
66 return pd->repeat_count; 67 return pd->play_count;
67} 68}
68 69
69EOLIAN static void 70EOLIAN static void
@@ -71,7 +72,7 @@ _efl_canvas_animation_start_delay_set(Eo *eo_obj EINA_UNUSED,
71 Efl_Canvas_Animation_Data *pd, 72 Efl_Canvas_Animation_Data *pd,
72 double sec) 73 double sec)
73{ 74{
74 if (sec < 0.0) return; 75 EINA_SAFETY_ON_FALSE_RETURN(sec >= 0.0);
75 76
76 pd->start_delay_time = sec; 77 pd->start_delay_time = sec;
77} 78}
@@ -114,13 +115,12 @@ _efl_canvas_animation_animation_apply(Eo *eo_obj,
114EOLIAN static double 115EOLIAN static double
115_efl_canvas_animation_efl_playable_length_get(const Eo *eo_obj, Efl_Canvas_Animation_Data *pd EINA_UNUSED) 116_efl_canvas_animation_efl_playable_length_get(const Eo *eo_obj, Efl_Canvas_Animation_Data *pd EINA_UNUSED)
116{ 117{
117 if (efl_animation_repeat_count_get(eo_obj) == EFL_ANIMATION_REPEAT_INFINITE) 118 if (efl_animation_play_count_get(eo_obj) == 0)
118 { 119 {
119 //TODO: what's correct? 120 return INFINITY;
120 return (double)EFL_ANIMATION_REPEAT_INFINITE;
121 } 121 }
122 122
123 return (efl_animation_duration_get(eo_obj) * (efl_animation_repeat_count_get(eo_obj) + 1)); 123 return (efl_animation_duration_get(eo_obj) * efl_animation_play_count_get(eo_obj));
124} 124}
125 125
126EOLIAN static Eina_Bool 126EOLIAN static Eina_Bool
@@ -135,4 +135,25 @@ _efl_canvas_animation_efl_playable_seekable_get(const Eo *eo_obj EINA_UNUSED, Ef
135 return EINA_TRUE; 135 return EINA_TRUE;
136} 136}
137 137
138EOLIAN static Efl_Object*
139_efl_canvas_animation_efl_object_constructor(Eo *obj, Efl_Canvas_Animation_Data *pd)
140{
141 pd->duration = _default_animation_time;
142 pd->play_count = 1;
143 return efl_constructor(efl_super(obj, MY_CLASS));
144}
145
146EOLIAN static void
147_efl_canvas_animation_default_duration_set(double animation_time)
148{
149 EINA_SAFETY_ON_FALSE_RETURN(animation_time >= 0.0);
150 _default_animation_time = animation_time;
151}
152
153EOLIAN static double
154_efl_canvas_animation_default_duration_get(void)
155{
156 return _default_animation_time;
157}
158
138#include "efl_canvas_animation.eo.c" 159#include "efl_canvas_animation.eo.c"
diff --git a/src/lib/evas/canvas/efl_canvas_animation.eo b/src/lib/evas/canvas/efl_canvas_animation.eo
index a640478..49bd1cb 100644
--- a/src/lib/evas/canvas/efl_canvas_animation.eo
+++ b/src/lib/evas/canvas/efl_canvas_animation.eo
@@ -2,78 +2,127 @@ import efl_canvas_animation_types;
2 2
3class @beta Efl.Canvas.Animation extends Efl.Object implements Efl.Playable 3class @beta Efl.Canvas.Animation extends Efl.Object implements Efl.Playable
4{ 4{
5 [[Efl animation class]] 5 [[Base class to be used by classes implementing specific canvas animations.
6
7 A canvas animation modifies the properties of a @Efl.Canvas.Object like
8 @Efl.Gfx.Entity.position, @Efl.Gfx.Entity.scale or @Efl.Gfx.Mapping.rotate, for example.
9 The value of the changed properties moves smoothly as the provided progress value
10 evolves from $[0] to $[1].
11
12 For example implementations see @Efl.Canvas.Animation_Translate or @Efl.Canvas.Animation_Scale.
13
14 Note: Unless @.final_state_keep is used, when an animation finishes any effect it introduced on the object is
15 removed. This means that if the animation does not end in the object's initial state there will be a noticeable
16 sudden jump.
17 To avoid this, animations must finish in the same state as they begin, or the object's state must be
18 matched to the animation's ending state once the animation finishes (using the @[Efl.Canvas.Object_Animation.animation,changed]
19 event).
20 ]]
6 c_prefix: efl_animation; 21 c_prefix: efl_animation;
7 methods { 22 methods {
8 @property final_state_keep { 23 @property final_state_keep {
9 [[Keep final state property]] 24 [[If $true the last mapping state the animation applies will be kept.
25 Otherwise all the @Efl.Gfx.Mapping properties will be reset when the animation ends.
26
27 Be careful, though. Object properties like @Efl.Gfx.Entity.position do not take
28 animations into account so they might not match the actual rendered values.
29 It is usually better to remove the effects of the animation as soon as it finishes
30 and set the final values on the object's properties.
31 ]]
10 set { 32 set {
11 } 33 }
12 get { 34 get {
13 } 35 }
14 values { 36 values {
15 keep: bool; [[$true to keep final state, $false otherwise.]] 37 keep: bool; [[$true to keep the final state.]]
16 } 38 }
17 } 39 }
18 @property duration { 40 @property duration {
19 [[Duration property]] 41 [[The duration of a single animation "run".
42 The @Efl.Playable.length implementation will return this duration adjusted by @.repeat_mode and
43 @.play_count.
44 ]]
20 set { 45 set {
21 } 46 }
22 get { 47 get {
23 } 48 }
24 values { 49 values {
25 sec: double; [[Duration value.]] 50 sec: double; [[Duration in seconds.]]
26 } 51 }
27 } 52 }
28 @property repeat_mode { 53 @property repeat_mode {
29 [[Repeat mode property]] 54 [[What to do when the animation finishes.
55 ]]
30 set { 56 set {
31 } 57 }
32 get { 58 get {
33 } 59 }
34 values { 60 values {
35 mode: Efl.Canvas.Animation_Repeat_Mode; [[Repeat mode.]] 61 mode: Efl.Canvas.Animation_Repeat_Mode(Efl.Canvas.Animation_Repeat_Mode.restart); [[Repeat mode.]]
36 } 62 }
37 } 63 }
38 @property repeat_count { 64 @property play_count {
39 [[Repeat count property]] 65 [[How many times to play an animation.
40 set { 66 $[1] means that the animation only plays once (it is not repeated), whereas $[2] will play it
41 } 67 again once it finishes the first time and then stop.
42 get { 68 $[0] means that the animation is repeated forever.
43 } 69 @.repeat_mode controls the direction in which subsequent playbacks will run.
70 ]]
44 values { 71 values {
45 count: int; [[Repeat count. -1 repeats animation infinitely.]] 72 count: int(1); [[Play count.]]
46 } 73 }
47 } 74 }
48 @property start_delay { 75 @property start_delay {
49 [[Start delay property]] 76 [[The time that passes since the animation is started and the first real change to the object is applied.
77 ]]
50 set { 78 set {
51 } 79 }
52 get { 80 get {
53 } 81 }
54 values { 82 values {
55 sec: double; [[Delay time, in seconds, from when the animation starts until the animation is animated.]] 83 sec: double; [[Delay time in seconds.]]
56 } 84 }
57 } 85 }
58 @property interpolator { 86 @property interpolator {
59 [[Interpolator property]] 87 [[Optional mapping function.
88
89 Animations are based on a timer that moves linearly from 0 to 1. This $interpolator
90 method is applied before the timer is passed to the animation, to achieve effects
91 like acceleration or deceleration, for example.
92 ]]
60 set { 93 set {
61 } 94 }
62 get { 95 get {
63 } 96 }
64 values { 97 values {
65 interpolator: Efl.Interpolator; [[Interpolator which indicates interpolation function.]] 98 interpolator: Efl.Interpolator; [[Mapping function. By default it is $NULL (linear mapping).]]
66 } 99 }
67 } 100 }
68 animation_apply { 101 animation_apply {
102 [[Overwrite this method to implement your own animation subclasses.
103
104 This is used for example by @Efl.Canvas.Animation_Translate or @Efl.Canvas.Animation_Scale.
105
106 Subclasses should call their parent's @.animation_apply to get the adjusted $progress value
107 and then perform the animation by modifying the $target's properties.
108 ]]
69 params { 109 params {
70 @in progress: double; 110 @in progress: double; [[Animation progress from $[0] to $[1].]]
71 @in target: Efl.Canvas.Object; 111 @in target: Efl.Canvas.Object; [[Object to animate.]]
112 }
113 return: double; [[Final applied progress, after possible adjustments. See @.interpolator.]]
114 }
115 @property default_duration @static {
116 [[Duration that will be used by default on all animations unless another value
117 is set per object using @.duration.
118 ]]
119 values {
120 animation_time : double; [[Default animation duration, in seconds.]]
72 } 121 }
73 return: double; [[Final applied progress.]]
74 } 122 }
75 } 123 }
76 implements { 124 implements {
125 Efl.Object.constructor;
77 Efl.Playable.length { get; } 126 Efl.Playable.length { get; }
78 Efl.Playable.seekable { get; } 127 Efl.Playable.seekable { get; }
79 Efl.Playable.playable { get; } 128 Efl.Playable.playable { get; }
diff --git a/src/lib/evas/canvas/efl_canvas_animation_alpha.eo b/src/lib/evas/canvas/efl_canvas_animation_alpha.eo
index 1ff9720..d76a80c 100644
--- a/src/lib/evas/canvas/efl_canvas_animation_alpha.eo
+++ b/src/lib/evas/canvas/efl_canvas_animation_alpha.eo
@@ -1,18 +1,25 @@
1class @beta Efl.Canvas.Animation_Alpha extends Efl.Canvas.Animation 1class @beta Efl.Canvas.Animation_Alpha extends Efl.Canvas.Animation
2{ 2{
3 [[Efl alpha animation class]] 3 [[Animated alpha blending effect.
4
5 The @Efl.Canvas.Object will have its alpha (transparency) value multiplied by
6 this animation.
7 This can be used to create fade-in and fade-out transitions, for example.
8 ]]
4 c_prefix: efl_animation_alpha; 9 c_prefix: efl_animation_alpha;
5 data: Efl_Canvas_Animation_Alpha_Data; 10 data: Efl_Canvas_Animation_Alpha_Data;
6 methods { 11 methods {
7 @property alpha { 12 @property alpha {
8 [[Alpha property]] 13 [[Alpha range to animate. $[0.0] means the object is transparent and $[1.0] means
14 the object is opaque.
15 ]]
9 set { 16 set {
10 } 17 }
11 get { 18 get {
12 } 19 }
13 values { 20 values {
14 from_alpha: double; [[Alpha value when animation starts]] 21 from_alpha: double; [[Initial alpha value.]]
15 to_alpha: double; [[Alpha value when animation ends]] 22 to_alpha: double; [[Ending alpha value.]]
16 } 23 }
17 } 24 }
18 } 25 }
diff --git a/src/lib/evas/canvas/efl_canvas_animation_group.c b/src/lib/evas/canvas/efl_canvas_animation_group.c
index ab88743..b6a7715 100644
--- a/src/lib/evas/canvas/efl_canvas_animation_group.c
+++ b/src/lib/evas/canvas/efl_canvas_animation_group.c
@@ -8,10 +8,7 @@ _efl_canvas_animation_group_animation_add(Eo *eo_obj,
8 if (!animation) return; 8 if (!animation) return;
9 9
10 double duration = efl_animation_duration_get(efl_super(eo_obj, MY_CLASS)); 10 double duration = efl_animation_duration_get(efl_super(eo_obj, MY_CLASS));
11 /* if group animation duration is available value, then the duration is 11 efl_animation_duration_set(animation, duration);
12 * propagated to its child. */
13 if (duration != EFL_ANIMATION_GROUP_DURATION_NONE)
14 efl_animation_duration_set(animation, duration);
15 12
16 Eina_Bool keep_final_state = efl_animation_final_state_keep_get(eo_obj); 13 Eina_Bool keep_final_state = efl_animation_final_state_keep_get(eo_obj);
17 efl_animation_final_state_keep_set(animation, keep_final_state); 14 efl_animation_final_state_keep_set(animation, keep_final_state);
@@ -41,11 +38,11 @@ _efl_canvas_animation_group_animation_del(Eo *eo_obj EINA_UNUSED,
41 } 38 }
42} 39}
43 40
44EOLIAN static Eina_List * 41EOLIAN static Eina_Iterator*
45_efl_canvas_animation_group_animations_get(const Eo *eo_obj EINA_UNUSED, 42_efl_canvas_animation_group_animations_get(const Eo *eo_obj EINA_UNUSED,
46 Efl_Canvas_Animation_Group_Data *pd) 43 Efl_Canvas_Animation_Group_Data *pd)
47{ 44{
48 return pd->animations; 45 return eina_list_iterator_new(pd->animations);
49} 46}
50 47
51EOLIAN static void 48EOLIAN static void
@@ -53,9 +50,8 @@ _efl_canvas_animation_group_efl_canvas_animation_duration_set(Eo *eo_obj,
53 Efl_Canvas_Animation_Group_Data *pd, 50 Efl_Canvas_Animation_Group_Data *pd,
54 double duration) 51 double duration)
55{ 52{
56 if (duration == EFL_ANIMATION_GROUP_DURATION_NONE) goto end; 53 efl_animation_duration_set(efl_super(eo_obj, MY_CLASS), duration);
57 54 duration = efl_animation_duration_get(eo_obj);
58 if (duration < 0.0) return;
59 55
60 Eina_List *l; 56 Eina_List *l;
61 Efl_Canvas_Animation *anim; 57 Efl_Canvas_Animation *anim;
@@ -63,9 +59,6 @@ _efl_canvas_animation_group_efl_canvas_animation_duration_set(Eo *eo_obj,
63 { 59 {
64 efl_animation_duration_set(anim, duration); 60 efl_animation_duration_set(anim, duration);
65 } 61 }
66
67end:
68 efl_animation_duration_set(efl_super(eo_obj, MY_CLASS), duration);
69} 62}
70 63
71EOLIAN static void 64EOLIAN static void
@@ -106,9 +99,6 @@ _efl_canvas_animation_group_efl_object_constructor(Eo *eo_obj,
106 99
107 pd->animations = NULL; 100 pd->animations = NULL;
108 101
109 //group animation does not affect its child duration by default.
110 efl_animation_duration_set(eo_obj, EFL_ANIMATION_GROUP_DURATION_NONE);
111
112 return eo_obj; 102 return eo_obj;
113} 103}
114 104
diff --git a/src/lib/evas/canvas/efl_canvas_animation_group.eo b/src/lib/evas/canvas/efl_canvas_animation_group.eo
index fdf42e2..7b9f19c 100644
--- a/src/lib/evas/canvas/efl_canvas_animation_group.eo
+++ b/src/lib/evas/canvas/efl_canvas_animation_group.eo
@@ -1,24 +1,32 @@
1abstract @beta Efl.Canvas.Animation_Group extends Efl.Canvas.Animation 1abstract @beta Efl.Canvas.Animation_Group extends Efl.Canvas.Animation
2{ 2{
3 [[Efl group animation abstract class]] 3 [[Base class for combined animations (groups of animations that are played together).
4
5 This class provides methods to add, remove and retrieve individual animations from the group.
6
7 See for example @Efl.Canvas.Animation_Group_Parallel and @Efl.Canvas.Animation_Group_Sequential.
8 ]]
4 c_prefix: efl_animation_group; 9 c_prefix: efl_animation_group;
5 data: Efl_Canvas_Animation_Group_Data; 10 data: Efl_Canvas_Animation_Group_Data;
6 methods { 11 methods {
7 animation_add { 12 animation_add {
8 [[Add the given animation to the animation group.]] 13 [[Adds the given animation to the animation group.]]
9 params { 14 params {
10 @in animation: Efl.Canvas.Animation; [[The animation which needs to be added to the animation group]] 15 @in animation: Efl.Canvas.Animation; [[Animation to add to the group.]]
11 } 16 }
12 } 17 }
13 animation_del { 18 animation_del {
14 [[Delete the given animation from the animation group.]] 19 [[Removes the given animation from the animation group.]]
15 params { 20 params {
16 @in animation: Efl.Canvas.Animation; [[The animation which needs to be deleted from the animation group]] 21 @in animation: Efl.Canvas.Animation; [[Animation to remove from the group.]]
17 } 22 }
18 } 23 }
19 animations_get @const { 24 @property animations {
20 [[Get the animations of the animation group.]] 25 [[All animations that are currently part of this group.]]
21 return: list<Efl.Canvas.Animation>; [[The animations of the animation group]] 26 get { }
27 values {
28 animations : iterator<Efl.Canvas.Animation> @move; [[The iterator carrying all animations of this group]]
29 }
22 } 30 }
23 } 31 }
24 implements { 32 implements {
diff --git a/src/lib/evas/canvas/efl_canvas_animation_group_parallel.c b/src/lib/evas/canvas/efl_canvas_animation_group_parallel.c
index 4ec979c..9960e41 100644
--- a/src/lib/evas/canvas/efl_canvas_animation_group_parallel.c
+++ b/src/lib/evas/canvas/efl_canvas_animation_group_parallel.c
@@ -13,15 +13,14 @@ _efl_canvas_animation_group_parallel_efl_canvas_animation_animation_apply(Eo *eo
13 int anim_repeated_count; 13 int anim_repeated_count;
14 14
15 progress = efl_animation_apply(efl_super(eo_obj, MY_CLASS), progress, target); 15 progress = efl_animation_apply(efl_super(eo_obj, MY_CLASS), progress, target);
16 Eina_List *group_anim = efl_animation_group_animations_get(eo_obj); 16 Eina_Iterator *group_anim = efl_animation_group_animations_get(eo_obj);
17 if (!group_anim) return progress; 17 if (!group_anim) return progress;
18 18
19 group_length = efl_playable_length_get(eo_obj); 19 group_length = efl_playable_length_get(eo_obj);
20 group_elapsed_time = group_length * progress; 20 group_elapsed_time = group_length * progress;
21 21
22 Eina_List *l;
23 Efl_Canvas_Animation *anim; 22 Efl_Canvas_Animation *anim;
24 EINA_LIST_FOREACH(group_anim, l, anim) 23 EINA_ITERATOR_FOREACH(group_anim, anim)
25 { 24 {
26 anim_length = efl_playable_length_get(anim); 25 anim_length = efl_playable_length_get(anim);
27 anim_duration = efl_animation_duration_get(anim); 26 anim_duration = efl_animation_duration_get(anim);
@@ -48,6 +47,7 @@ _efl_canvas_animation_group_parallel_efl_canvas_animation_animation_apply(Eo *eo
48 47
49 efl_animation_apply(anim, anim_progress, target); 48 efl_animation_apply(anim, anim_progress, target);
50 } 49 }
50 eina_iterator_free(group_anim);
51 51
52 return progress; 52 return progress;
53} 53}
@@ -58,18 +58,18 @@ _efl_canvas_animation_group_parallel_efl_canvas_animation_duration_get(const Eo
58 double child_total_duration; 58 double child_total_duration;
59 double total_duration = 0.0; 59 double total_duration = 0.0;
60 60
61 Eina_List *animations = efl_animation_group_animations_get(eo_obj); 61 Eina_Iterator *group_anim = efl_animation_group_animations_get(eo_obj);
62 if (!animations) return 0.0; 62 if (!group_anim) return 0.0;
63 63
64 Eina_List *l;
65 Efl_Canvas_Animation *anim; 64 Efl_Canvas_Animation *anim;
66 EINA_LIST_FOREACH(animations, l, anim) 65 EINA_ITERATOR_FOREACH(group_anim, anim)
67 { 66 {
68 child_total_duration = efl_playable_length_get(anim); 67 child_total_duration = efl_playable_length_get(anim);
69 child_total_duration += efl_animation_start_delay_get(anim); 68 child_total_duration += efl_animation_start_delay_get(anim);
70 if (child_total_duration > total_duration) 69 if (child_total_duration > total_duration)
71 total_duration = child_total_duration; 70 total_duration = child_total_duration;
72 } 71 }
72 eina_iterator_free(group_anim);
73 73
74 return total_duration; 74 return total_duration;
75} 75}
diff --git a/src/lib/evas/canvas/efl_canvas_animation_group_parallel.eo b/src/lib/evas/canvas/efl_canvas_animation_group_parallel.eo
index 63773dd..e0434e7 100644
--- a/src/lib/evas/canvas/efl_canvas_animation_group_parallel.eo
+++ b/src/lib/evas/canvas/efl_canvas_animation_group_parallel.eo
@@ -1,6 +1,13 @@
1class @beta Efl.Canvas.Animation_Group_Parallel extends Efl.Canvas.Animation_Group 1class @beta Efl.Canvas.Animation_Group_Parallel extends Efl.Canvas.Animation_Group
2{ 2{
3 [[Efl group parallel animation class]] 3 [[Combined animation which plays its individual animations in parallel
4 (all of them simultaneously).
5
6 For instance, this could be used to move an @Efl.Canvas.Object from one position to another
7 while rotating it along the way.
8
9 Use @Efl.Canvas.Animation_Group.animation_add to append individual animations.
10 ]]
4 c_prefix: efl_animation_group_parallel; 11 c_prefix: efl_animation_group_parallel;
5 data: null; 12 data: null;
6 methods { 13 methods {
diff --git a/src/lib/evas/canvas/efl_canvas_animation_group_sequential.c b/src/lib/evas/canvas/efl_canvas_animation_group_sequential.c
index 2a83fc4..26edb21 100644
--- a/src/lib/evas/canvas/efl_canvas_animation_group_sequential.c
+++ b/src/lib/evas/canvas/efl_canvas_animation_group_sequential.c
@@ -15,15 +15,14 @@ _efl_canvas_animation_group_sequential_efl_canvas_animation_animation_apply(Eo *
15 int anim_repeated_count; 15 int anim_repeated_count;
16 16
17 progress = efl_animation_apply(efl_super(eo_obj, MY_CLASS), progress, target); 17 progress = efl_animation_apply(efl_super(eo_obj, MY_CLASS), progress, target);
18 Eina_List *group_anim = efl_animation_group_animations_get(eo_obj); 18 Eina_Iterator *group_anim = efl_animation_group_animations_get(eo_obj);
19 if (!group_anim) return progress; 19 if (!group_anim) return progress;
20 20
21 group_length = efl_playable_length_get(eo_obj); 21 group_length = efl_playable_length_get(eo_obj);
22 group_elapsed_time = group_length * progress; 22 group_elapsed_time = group_length * progress;
23 23
24 Eina_List *l;
25 Efl_Canvas_Animation *anim; 24 Efl_Canvas_Animation *anim;
26 EINA_LIST_FOREACH(group_anim, l, anim) 25 EINA_ITERATOR_FOREACH(group_anim, anim)
27 { 26 {
28 anim_start_delay = efl_animation_start_delay_get(anim); 27 anim_start_delay = efl_animation_start_delay_get(anim);
29 anim_length = efl_playable_length_get(anim) + anim_start_delay; 28 anim_length = efl_playable_length_get(anim) + anim_start_delay;
@@ -53,6 +52,7 @@ _efl_canvas_animation_group_sequential_efl_canvas_animation_animation_apply(Eo *
53 52
54 break; 53 break;
55 } 54 }
55 eina_iterator_free(group_anim);
56 56
57 return progress; 57 return progress;
58} 58}
@@ -63,17 +63,17 @@ _efl_canvas_animation_group_sequential_efl_canvas_animation_duration_get(const E
63 double total_duration = 0.0; 63 double total_duration = 0.0;
64 double child_total_duration; 64 double child_total_duration;
65 65
66 Eina_List *animations = efl_animation_group_animations_get(eo_obj); 66 Eina_Iterator *group_anim = efl_animation_group_animations_get(eo_obj);
67 if (!animations) return 0.0; 67 if (!group_anim) return 0.0;
68 68
69 Eina_List *l;
70 Efl_Canvas_Animation *anim; 69 Efl_Canvas_Animation *anim;
71 EINA_LIST_FOREACH(animations, l, anim) 70 EINA_ITERATOR_FOREACH(group_anim, anim)
72 { 71 {
73 child_total_duration = efl_playable_length_get(anim); 72 child_total_duration = efl_playable_length_get(anim);
74 child_total_duration += efl_animation_start_delay_get(anim); 73 child_total_duration += efl_animation_start_delay_get(anim);
75 total_duration += child_total_duration; 74 total_duration += child_total_duration;
76 } 75 }
76 eina_iterator_free(group_anim);
77 77
78 return total_duration; 78 return total_duration;
79} 79}
diff --git a/src/lib/evas/canvas/efl_canvas_animation_group_sequential.eo b/src/lib/evas/canvas/efl_canvas_animation_group_sequential.eo
index 415a87f..aebd70e 100644
--- a/src/lib/evas/canvas/efl_canvas_animation_group_sequential.eo
+++ b/src/lib/evas/canvas/efl_canvas_animation_group_sequential.eo
@@ -1,6 +1,14 @@
1class @beta Efl.Canvas.Animation_Group_Sequential extends Efl.Canvas.Animation_Group 1class @beta Efl.Canvas.Animation_Group_Sequential extends Efl.Canvas.Animation_Group
2{ 2{
3 [[Efl group sequential animation class]] 3 [[Combined animation which plays its individual animations in a sequential order
4 (one after the other).
5
6 For instance, this could be used to move an @Efl.Canvas.Object from one position to another
7 and then start rotating it once it reaches its destination.
8
9 Use @Efl.Canvas.Animation_Group.animation_add to append individual animations.
10 Animations are played in the order in which they are added.
11 ]]
4 data: null; 12 data: null;
5 methods { 13 methods {
6 } 14 }
diff --git a/src/lib/evas/canvas/efl_canvas_animation_player.c b/src/lib/evas/canvas/efl_canvas_animation_player.c
deleted file mode 100644
index e8b57cb..0000000
--- a/src/lib/evas/canvas/efl_canvas_animation_player.c
+++ /dev/null
@@ -1,444 +0,0 @@
1#include "efl_canvas_animation_player_private.h"
2
3static void
4_target_del_cb(void *data, const Efl_Event *event EINA_UNUSED)
5{
6 Efl_Canvas_Animation_Player_Data *pd = data;
7 pd->target = NULL;
8}
9
10EOLIAN static void
11_efl_canvas_animation_player_target_set(Eo *eo_obj EINA_UNUSED,
12 Efl_Canvas_Animation_Player_Data *pd,
13 Efl_Canvas_Object *target)
14{
15 if (pd->target == target)
16 return;
17
18 if (pd->target)
19 efl_event_callback_del(pd->target, EFL_EVENT_DEL, _target_del_cb, pd);
20
21 efl_event_callback_add(target, EFL_EVENT_DEL, _target_del_cb, pd);
22
23 pd->target = target;
24}
25
26EOLIAN static Efl_Canvas_Object *
27_efl_canvas_animation_player_target_get(const Eo *eo_obj EINA_UNUSED, Efl_Canvas_Animation_Player_Data *pd)
28{
29 return pd->target;
30}
31
32EOLIAN static void
33_efl_canvas_animation_player_auto_del_set(Eo *eo_obj EINA_UNUSED,
34 Efl_Canvas_Animation_Player_Data *pd,
35 Eina_Bool auto_del)
36{
37 pd->auto_del = auto_del;
38}
39
40EOLIAN static Eina_Bool
41_efl_canvas_animation_player_auto_del_get(const Eo *eo_obj EINA_UNUSED,
42 Efl_Canvas_Animation_Player_Data *pd)
43{
44 return pd->auto_del;
45}
46
47EOLIAN static void
48_efl_canvas_animation_player_animation_set(Eo *eo_obj,
49 Efl_Canvas_Animation_Player_Data *pd,
50 Efl_Canvas_Animation *anim)
51{
52 if (anim == pd->animation)
53 return;
54
55 if (!efl_isa(anim, EFL_CANVAS_ANIMATION_CLASS))
56 {
57 ERR("Passed argument [%p]:[%s] is not an Efl.Animation",
58 anim, efl_class_name_get(efl_class_get(anim)));
59 return;
60 }
61
62 if (pd->animation)
63 {
64 efl_player_playing_set(eo_obj, EINA_FALSE);
65 efl_unref(pd->animation);
66 }
67 pd->animation = anim;
68 efl_ref(pd->animation);
69}
70
71EOLIAN static Efl_Canvas_Animation *
72_efl_canvas_animation_player_animation_get(const Eo *eo_obj EINA_UNUSED,
73 Efl_Canvas_Animation_Player_Data *pd)
74{
75 return pd->animation;
76}
77
78static Eina_Bool
79_animator_cb(void *data)
80{
81 Eo *eo_obj = data;
82 EFL_ANIMATION_PLAYER_DATA_GET(eo_obj, pd);
83 EFL_ANIMATION_PLAYER_ANIMATION_GET(eo_obj, anim);
84 double duration, elapsed_time, vector;
85
86 if (efl_playable_seekable_get(eo_obj))
87 {
88 pd->time.current = ecore_loop_time_get();
89
90 duration = efl_animation_duration_get(anim);
91 elapsed_time = pd->time.current - pd->time.prev;
92 vector = elapsed_time / duration;
93
94 /* When animation player starts, _animator_cb() is called immediately so
95 * both elapsed time and progress are 0.0.
96 * Since it is the beginning of the animation if progress is 0.0, the
97 * following codes for animation should be executed. */
98 if ((vector <= DBL_EPSILON) && (pd->progress != 0.0))
99 return ECORE_CALLBACK_RENEW; // There is no update.
100
101 //TODO: check negative play_speed.
102 if (!pd->is_direction_forward)
103 vector *= -1;
104 pd->progress += vector;
105
106 if (pd->progress > 1.0)
107 pd->progress = 1.0;
108 else if (pd->progress < 0.0)
109 pd->progress = 0.0;
110 }
111 else
112 {
113 pd->progress = (double)(pd->is_direction_forward);
114 }
115
116 /* The previously applied map effect should be reset before applying the
117 * current map effect. Otherwise, the incrementally added map effects
118 * increase numerical error. */
119 efl_gfx_mapping_reset(efl_animation_player_target_get(eo_obj));
120 efl_animation_apply(anim, pd->progress, efl_animation_player_target_get(eo_obj));
121
122 Efl_Canvas_Animation_Player_Event_Running event_running;
123 event_running.progress = pd->progress;
124 efl_event_callback_call(eo_obj, EFL_ANIMATION_PLAYER_EVENT_RUNNING,
125 &event_running);
126 pd->time.prev = pd->time.current;
127
128 //Not end. Keep going.
129 if (fabs((!!(pd->is_direction_forward)) - pd->progress) > DBL_EPSILON)
130 return ECORE_CALLBACK_RENEW;
131
132 //Repeat animation
133 if ((efl_animation_repeat_count_get(anim) == EFL_ANIMATION_REPEAT_INFINITE) ||
134 (pd->remaining_repeat_count > 0))
135 {
136 if (pd->remaining_repeat_count > 0)
137 pd->remaining_repeat_count--;
138
139 if (efl_animation_repeat_mode_get(anim) == EFL_CANVAS_ANIMATION_REPEAT_MODE_REVERSE)
140 {
141 pd->is_direction_forward = !pd->is_direction_forward;
142 }
143 else
144 {
145 pd->progress = 0.0;
146 }
147
148 return ECORE_CALLBACK_RENEW;
149 }
150 efl_player_playing_set(eo_obj, EINA_FALSE);
151
152 pd->animator = NULL;
153 return ECORE_CALLBACK_CANCEL;
154}
155
156static void
157_start(Eo *eo_obj, Efl_Canvas_Animation_Player_Data *pd)
158{
159 EFL_ANIMATION_PLAYER_ANIMATION_GET(eo_obj, anim);
160
161 pd->is_direction_forward = EINA_TRUE;
162
163 pd->remaining_repeat_count = efl_animation_repeat_count_get(anim);
164
165 ecore_animator_del(pd->animator);
166 pd->animator = NULL;
167 pd->time.prev = ecore_loop_time_get();
168
169 //pre started event is supported within class only (protected event)
170 efl_event_callback_call(eo_obj, EFL_ANIMATION_PLAYER_EVENT_PRE_STARTED,
171 NULL);
172 efl_event_callback_call(eo_obj, EFL_ANIMATION_PLAYER_EVENT_STARTED, NULL);
173
174 pd->animator = ecore_evas_animator_add(pd->target, _animator_cb, eo_obj);
175
176 _animator_cb(eo_obj);
177}
178
179static Eina_Bool
180_start_delay_timer_cb(void *data)
181{
182 Eo *eo_obj = data;
183 EFL_ANIMATION_PLAYER_DATA_GET(eo_obj, pd);
184
185 pd->start_delay_timer = NULL;
186
187 _start(eo_obj, pd);
188
189 return ECORE_CALLBACK_CANCEL;
190}
191
192static Eina_Bool
193_is_final_state(Efl_Canvas_Animation *anim, double progress)
194{
195 if (!anim) return EINA_FALSE;
196 if ((progress != 0.0) && (progress != 1.0)) return EINA_FALSE;
197
198 if (efl_animation_repeat_mode_get(anim) == EFL_CANVAS_ANIMATION_REPEAT_MODE_REVERSE)
199 {
200 if (efl_animation_repeat_count_get(anim) & 1)
201 {
202 if (progress == 0.0)
203 return EINA_TRUE;
204 }
205 else
206 {
207 if (progress == 1.0)
208 return EINA_TRUE;
209 }
210 }
211 else
212 {
213 if (progress == 1.0)
214 return EINA_TRUE;
215 }
216
217 return EINA_FALSE;
218}
219
220static void
221_player_stop(Eo *eo_obj, Efl_Canvas_Animation_Player_Data *pd, Efl_Canvas_Animation *anim)
222{
223 //Reset the state of the target to the initial state
224 efl_gfx_mapping_reset(efl_animation_player_target_get(eo_obj));
225
226 if (efl_animation_final_state_keep_get(anim))
227 {
228 if (_is_final_state(anim, pd->progress))
229 {
230 /* Keep the final state only if efl_player_playing_set(EINA_FALSE) is called at
231 * the end of _animator_cb. */
232 efl_animation_apply(anim, pd->progress,
233 efl_animation_player_target_get(eo_obj));
234 }
235 else
236 {
237 pd->progress = 0.0;
238 }
239 }
240 else
241 {
242 pd->progress = 0.0;
243 }
244 efl_event_callback_call(eo_obj, EFL_ANIMATION_PLAYER_EVENT_ENDED, NULL);
245 if (pd->auto_del) efl_del(eo_obj);
246}
247
248EOLIAN static Eina_Bool
249_efl_canvas_animation_player_efl_player_playing_set(Eo *eo_obj, Efl_Canvas_Animation_Player_Data *pd, Eina_Bool playing)
250{
251 double start_delay;
252 EFL_ANIMATION_PLAYER_ANIMATION_GET(eo_obj, anim);
253
254 if (!efl_playable_get(eo_obj)) return EINA_FALSE;
255 if ((!playing) && (!pd->is_play)) return EINA_TRUE;
256 if ((playing) && (pd->is_play)) return EINA_TRUE;
257 pd->is_play = !!playing;
258 if (!playing)
259 {
260 if (!pd->is_play) return EINA_TRUE;
261 pd->is_paused = EINA_FALSE;
262 _player_stop(eo_obj, pd, anim);
263 return EINA_TRUE;
264 }
265 //TODO: check this case is correct
266 if (pd->start_delay_timer) return EINA_TRUE;
267
268 pd->progress = 0.0;
269 start_delay = efl_animation_start_delay_get(anim);
270 if (start_delay > 0.0)
271 {
272 pd->start_delay_timer = ecore_timer_add(start_delay,
273 _start_delay_timer_cb, eo_obj);
274 }
275 else
276 _start(eo_obj, pd);
277 return EINA_TRUE;
278}
279
280EOLIAN static Eina_Bool
281_efl_canvas_animation_player_efl_player_playing_get(const Eo *eo_obj EINA_UNUSED, Efl_Canvas_Animation_Player_Data *pd)
282{
283 return pd->is_play;
284}
285
286EOLIAN static Eina_Bool
287_efl_canvas_animation_player_efl_player_paused_set(Eo *eo_obj,
288 Efl_Canvas_Animation_Player_Data *pd,
289 Eina_Bool paused)
290{
291 paused = !!paused;
292 /* can't pause if not playing */
293 if (!pd->is_play) return EINA_FALSE;
294 if (pd->is_paused == paused) return EINA_TRUE;
295 pd->is_paused = paused;
296 if (!paused)
297 {
298 //TODO: check this case is correct.
299 if (pd->start_delay_timer) return EINA_FALSE;
300
301 pd->time.prev = ecore_loop_time_get();
302 pd->animator = ecore_evas_animator_add(pd->target, _animator_cb, eo_obj);
303
304 _animator_cb(eo_obj);
305 }
306 else
307 {
308 ecore_timer_del(pd->start_delay_timer);
309 pd->start_delay_timer = NULL;
310 ecore_animator_del(pd->animator);
311 pd->animator = NULL;
312 }
313 return EINA_TRUE;
314}
315
316EOLIAN static Eina_Bool
317_efl_canvas_animation_player_efl_player_paused_get(const Eo *eo_obj EINA_UNUSED,
318 Efl_Canvas_Animation_Player_Data *pd)
319{
320 return pd->is_paused;
321}
322
323EOLIAN static Eina_Bool
324_efl_canvas_animation_player_efl_playable_playable_get(const Eo *eo_obj,
325 Efl_Canvas_Animation_Player_Data *pd EINA_UNUSED)
326{
327 Efl_Canvas_Animation *anim = efl_animation_player_animation_get(eo_obj);
328
329 return efl_playable_get(anim);
330}
331
332EOLIAN static double
333_efl_canvas_animation_player_efl_player_playback_position_get(const Eo *eo_obj,
334 Efl_Canvas_Animation_Player_Data *pd EINA_UNUSED)
335{
336 //TODO: this is not correct
337 Efl_Canvas_Animation *anim = efl_animation_player_animation_get(eo_obj);
338 double length = efl_animation_duration_get(anim);
339
340 return length * efl_player_playback_progress_get(eo_obj);
341}
342
343EOLIAN static void
344_efl_canvas_animation_player_efl_player_playback_position_set(Eo *eo_obj,
345 Efl_Canvas_Animation_Player_Data *pd EINA_UNUSED,
346 double sec)
347{
348 //TODO: this is not correct
349 if (!efl_playable_seekable_get(eo_obj))
350 return;
351
352 EFL_ANIMATION_PLAYER_ANIMATION_GET(eo_obj, anim);
353 double length = efl_animation_duration_get(anim);
354 pd->progress = sec / length;
355
356 /* The previously applied map effect should be reset before applying the
357 * current map effect. Otherwise, the incrementally added map effects
358 * increase numerical error. */
359 efl_gfx_mapping_reset(efl_animation_player_target_get(eo_obj));
360 efl_animation_apply(anim, pd->progress, efl_animation_player_target_get(eo_obj));
361}
362
363EOLIAN static double
364_efl_canvas_animation_player_efl_player_playback_progress_get(const Eo *eo_obj EINA_UNUSED,
365 Efl_Canvas_Animation_Player_Data *pd)
366{
367 return pd->progress;
368}
369
370EOLIAN static void
371_efl_canvas_animation_player_efl_player_playback_speed_set(Eo *eo_obj EINA_UNUSED,
372 Efl_Canvas_Animation_Player_Data *pd,
373 double play_speed)
374{
375 //TODO: check reverse play case.
376 if (play_speed < 0)
377 return;
378 pd->play_speed = play_speed;
379}
380
381EOLIAN static double
382_efl_canvas_animation_player_efl_player_playback_speed_get(const Eo *eo_obj EINA_UNUSED,
383 Efl_Canvas_Animation_Player_Data *pd)
384{
385 return pd->play_speed;
386}
387
388EOLIAN static double
389_efl_canvas_animation_player_efl_playable_length_get(const Eo *eo_obj,
390 Efl_Canvas_Animation_Player_Data *pd EINA_UNUSED)
391{
392 EFL_ANIMATION_PLAYER_ANIMATION_GET(eo_obj, anim);
393 return efl_playable_length_get(anim);
394}
395
396EOLIAN static Eina_Bool
397_efl_canvas_animation_player_efl_playable_seekable_get(const Eo *eo_obj EINA_UNUSED,
398 Efl_Canvas_Animation_Player_Data *pd EINA_UNUSED)
399{
400 EFL_ANIMATION_PLAYER_ANIMATION_GET(eo_obj, anim);
401 return efl_playable_seekable_get(anim);
402}
403
404EOLIAN static Efl_Object *
405_efl_canvas_animation_player_efl_object_constructor(Eo *eo_obj,
406 Efl_Canvas_Animation_Player_Data *pd)
407{
408 eo_obj = efl_constructor(efl_super(eo_obj, MY_CLASS));
409
410 pd->time.begin = 0.0;
411 pd->time.current = 0.0;
412
413 pd->animation = NULL;
414
415 pd->progress = 0.0;
416
417 //pd->auto_del = EINA_TRUE;
418
419 return eo_obj;
420}
421
422EOLIAN static void
423_efl_canvas_animation_player_efl_object_destructor(Eo *eo_obj,
424 Efl_Canvas_Animation_Player_Data *pd)
425{
426 if (pd->animator)
427 {
428 ecore_animator_del(pd->animator);
429 pd->animator = NULL;
430
431 //Reset the state of the target to the initial state
432 efl_player_playing_set(eo_obj, EINA_FALSE);
433
434 efl_event_callback_call(eo_obj, EFL_ANIMATION_PLAYER_EVENT_ENDED, NULL);
435 }
436 efl_unref(pd->animation);
437
438 efl_destructor(efl_super(eo_obj, MY_CLASS));
439}
440
441EWAPI const Efl_Event_Description _EFL_ANIMATION_PLAYER_EVENT_PRE_STARTED =
442 EFL_EVENT_DESCRIPTION("pre_started");
443
444#include "efl_canvas_animation_player.eo.c"
diff --git a/src/lib/evas/canvas/efl_canvas_animation_player.eo b/src/lib/evas/canvas/efl_canvas_animation_player.eo
deleted file mode 100644
index 9a391cb..0000000
--- a/src/lib/evas/canvas/efl_canvas_animation_player.eo
+++ /dev/null
@@ -1,62 +0,0 @@
1class @beta Efl.Canvas.Animation_Player extends Efl.Object implements Efl.Player, Efl.Playable
2{
3 [[Player object for playing canvas animations.
4
5 This player object can be used to play animations on a @.target canvas object.
6 The type of animation depends on the @.animation object.
7 ]]
8 c_prefix: efl_animation_player;
9 methods {
10 @property animation {
11 [[The animation to play.
12
13 This animation object will be used to change the visual state of the @.target object.
14 ]]
15 values {
16 animation: Efl.Canvas.Animation; [[An already-configured animation object.]]
17 }
18 }
19 @property auto_del {
20 [[Auto delete property]]
21 set {
22 }
23 get {
24 }
25 values {
26 auto_del: bool; [[$true to delete animation object automatically when animation is finished or animation is
27 cancelled, $false otherwise.]]
28 }
29 }
30 @property target {
31 [[The canvas object to apply the effects of the @.animation object on.
32
33 The @.animation object can change several properties of the $target.
34 You should ensure that nothing else is trying to change them too.
35 ]]
36 values {
37 target: Efl.Canvas.Object; [[Canvas object to animate.]]
38 }
39 }
40 }
41 implements {
42 Efl.Object.constructor;
43 Efl.Object.destructor;
44 Efl.Player.playing { get; set; }
45 Efl.Player.paused { get; set; }
46 Efl.Playable.playable { get; }
47 Efl.Player.playback_position { get; set; }
48 Efl.Player.playback_progress { get;}
49 Efl.Player.playback_speed { get; set; }
50 //Efl.Player.volume { get; set; }
51 //Efl.Player.mute { get; set; }
52 Efl.Playable.length { get; }
53 Efl.Playable.seekable { get; }
54 }
55 events {
56 /* FIXME: This event is similar to Efl.Canvas.Object.anim_started but with different type, might be confusing. */
57 started: void; [[Animation is started.]]
58 running: Efl.Canvas.Object_Animation_Event; [[Animation is running.]]
59 /* FIXME: This event is similar to Efl.Canvas.Object.anim_ended but with different type, might be confusing. */
60 ended: void; [[Animation is ended.]]
61 }
62}
diff --git a/src/lib/evas/canvas/efl_canvas_animation_player_private.h b/src/lib/evas/canvas/efl_canvas_animation_player_private.h
deleted file mode 100644
index aff74db..0000000
--- a/src/lib/evas/canvas/efl_canvas_animation_player_private.h
+++ /dev/null
@@ -1,53 +0,0 @@
1#define EFL_ANIMATION_PLAYER_PROTECTED
2
3#include "evas_common_private.h"
4#include <Ecore.h>
5
6#define MY_CLASS EFL_CANVAS_ANIMATION_PLAYER_CLASS
7#define MY_CLASS_NAME efl_class_name_get(MY_CLASS)
8
9#if 0
10typedef struct _Target_State
11{
12 Evas_Coord x, y, w, h;
13 int r, g, b, a;
14
15 Evas_Map *map;
16 Eina_Bool enable_map : 1;
17} Target_State;
18#endif
19
20typedef struct _Efl_Canvas_Animation_Player_Data
21{
22 Ecore_Animator *animator;
23 Ecore_Timer *start_delay_timer;
24
25 struct {
26 double prev;
27 double begin;
28 double current;
29 double pause_begin;
30 } time;
31
32 Efl_Canvas_Animation *animation;
33 Efl_Canvas_Object *target;
34
35 double progress;
36 double play_speed;
37
38 int remaining_repeat_count;
39
40 Efl_Interpolator *interpolator;
41
42 Eina_Bool auto_del : 1;
43 Eina_Bool is_play : 1;
44 Eina_Bool is_paused : 1;
45 Eina_Bool keep_final_state : 1;
46 Eina_Bool is_direction_forward : 1;
47} Efl_Canvas_Animation_Player_Data;
48
49#define EFL_ANIMATION_PLAYER_DATA_GET(o, pd) \
50 Efl_Canvas_Animation_Player_Data *pd = efl_data_scope_get(o, EFL_CANVAS_ANIMATION_PLAYER_CLASS)
51
52#define EFL_ANIMATION_PLAYER_ANIMATION_GET(o, anim) \
53 Efl_Canvas_Animation *anim = efl_animation_player_animation_get(o)
diff --git a/src/lib/evas/canvas/efl_canvas_animation_private.h b/src/lib/evas/canvas/efl_canvas_animation_private.h
index c8f0609..9995d23 100644
--- a/src/lib/evas/canvas/efl_canvas_animation_private.h
+++ b/src/lib/evas/canvas/efl_canvas_animation_private.h
@@ -10,7 +10,7 @@ typedef struct _Efl_Canvas_Animation_Data
10 double start_delay_time; 10 double start_delay_time;
11 11
12 Efl_Canvas_Animation_Repeat_Mode repeat_mode; 12 Efl_Canvas_Animation_Repeat_Mode repeat_mode;
13 int repeat_count; 13 int play_count;
14 14
15 Efl_Interpolator *interpolator; 15 Efl_Interpolator *interpolator;
16 16
@@ -25,4 +25,4 @@ typedef struct _Efl_Canvas_Animation_Data
25 25
26#define FINAL_STATE_IS_REVERSE(anim) \ 26#define FINAL_STATE_IS_REVERSE(anim) \
27 ((efl_animation_repeat_mode_get(anim) == EFL_CANVAS_ANIMATION_REPEAT_MODE_REVERSE) && \ 27 ((efl_animation_repeat_mode_get(anim) == EFL_CANVAS_ANIMATION_REPEAT_MODE_REVERSE) && \
28 (efl_animation_repeat_count_get(anim) & 1)) 28 (efl_animation_play_count_get(anim) & 1))
diff --git a/src/lib/evas/canvas/efl_canvas_animation_rotate.c b/src/lib/evas/canvas/efl_canvas_animation_rotate.c
index fe713de..ba07733 100644
--- a/src/lib/evas/canvas/efl_canvas_animation_rotate.c
+++ b/src/lib/evas/canvas/efl_canvas_animation_rotate.c
@@ -8,16 +8,14 @@ _efl_canvas_animation_rotate_rotate_set(Eo *eo_obj EINA_UNUSED,
8 double from_degree, 8 double from_degree,
9 double to_degree, 9 double to_degree,
10 Efl_Canvas_Object *pivot, 10 Efl_Canvas_Object *pivot,
11 double cx, 11 Eina_Vector2 center_point)
12 double cy)
13{ 12{
14 pd->from.degree = from_degree; 13 pd->from.degree = from_degree;
15 pd->to.degree = to_degree; 14 pd->to.degree = to_degree;
16 15
17 //TODO: check whether ref for pivot should be added. 16 //TODO: check whether ref for pivot should be added.
18 pd->rel_pivot.obj = pivot; 17 pd->rel_pivot.obj = pivot;
19 pd->rel_pivot.cx = cx; 18 pd->rel_pivot.pos = center_point;
20 pd->rel_pivot.cy = cy;
21 pd->use_rel_pivot = EINA_TRUE; 19 pd->use_rel_pivot = EINA_TRUE;
22} 20}
23 21
@@ -27,8 +25,7 @@ _efl_canvas_animation_rotate_rotate_get(const Eo *eo_obj EINA_UNUSED,
27 double *from_degree, 25 double *from_degree,
28 double *to_degree, 26 double *to_degree,
29 Efl_Canvas_Object **pivot, 27 Efl_Canvas_Object **pivot,
30 double *cx, 28 Eina_Vector2 *center_point)
31 double *cy)
32{ 29{
33 if (!pd->use_rel_pivot) 30 if (!pd->use_rel_pivot)
34 { 31 {
@@ -45,11 +42,8 @@ _efl_canvas_animation_rotate_rotate_get(const Eo *eo_obj EINA_UNUSED,
45 if (pivot) 42 if (pivot)
46 *pivot = pd->rel_pivot.obj; 43 *pivot = pd->rel_pivot.obj;
47 44
48 if (cx) 45 if (center_point)
49 *cx = pd->rel_pivot.cx; 46 *center_point = pd->rel_pivot.pos;
50
51 if (cy)
52 *cy = pd->rel_pivot.cy;
53} 47}
54 48
55EOLIAN static void 49EOLIAN static void
@@ -57,14 +51,12 @@ _efl_canvas_animation_rotate_rotate_absolute_set(Eo *eo_obj EINA_UNUSED,
57 Efl_Canvas_Animation_Rotate_Data *pd, 51 Efl_Canvas_Animation_Rotate_Data *pd,
58 double from_degree, 52 double from_degree,
59 double to_degree, 53 double to_degree,
60 Evas_Coord cx, 54 Eina_Position2D abs)
61 Evas_Coord cy)
62{ 55{
63 pd->from.degree = from_degree; 56 pd->from.degree = from_degree;
64 pd->to.degree = to_degree; 57 pd->to.degree = to_degree;
65 58
66 pd->abs_pivot.cx = cx; 59 pd->abs_pivot = abs;
67 pd->abs_pivot.cy = cy;
68 pd->use_rel_pivot = EINA_FALSE; 60 pd->use_rel_pivot = EINA_FALSE;
69} 61}
70 62
@@ -73,8 +65,7 @@ _efl_canvas_animation_rotate_rotate_absolute_get(const Eo *eo_obj EINA_UNUSED,
73 Efl_Canvas_Animation_Rotate_Data *pd, 65 Efl_Canvas_Animation_Rotate_Data *pd,
74 double *from_degree, 66 double *from_degree,
75 double *to_degree, 67 double *to_degree,
76 Evas_Coord *cx, 68 Eina_Position2D *abs)
77 Evas_Coord *cy)
78{ 69{
79 if (pd->use_rel_pivot) 70 if (pd->use_rel_pivot)
80 { 71 {
@@ -88,11 +79,8 @@ _efl_canvas_animation_rotate_rotate_absolute_get(const Eo *eo_obj EINA_UNUSED,
88 if (to_degree) 79 if (to_degree)
89 *to_degree = pd->to.degree; 80 *to_degree = pd->to.degree;
90 81
91 if (cx) 82 if (abs)
92 *cx = pd->abs_pivot.cx; 83 *abs = pd->abs_pivot;
93
94 if (cy)
95 *cy = pd->abs_pivot.cy;
96} 84}
97 85
98EOLIAN static double 86EOLIAN static double
@@ -113,13 +101,13 @@ _efl_canvas_animation_rotate_efl_canvas_animation_animation_apply(Eo *eo_obj,
113 efl_gfx_mapping_rotate(target, 101 efl_gfx_mapping_rotate(target,
114 new_degree, 102 new_degree,
115 (pd->rel_pivot.obj) ? pd->rel_pivot.obj : target, 103 (pd->rel_pivot.obj) ? pd->rel_pivot.obj : target,
116 pd->rel_pivot.cx, pd->rel_pivot.cy); 104 pd->rel_pivot.pos.x, pd->rel_pivot.pos.y);
117 } 105 }
118 else 106 else
119 { 107 {
120 efl_gfx_mapping_rotate_absolute(target, 108 efl_gfx_mapping_rotate_absolute(target,
121 new_degree, 109 new_degree,
122 pd->abs_pivot.cx, pd->abs_pivot.cy); 110 pd->abs_pivot.x, pd->abs_pivot.y);
123 } 111 }
124 112
125 return progress; 113 return progress;
@@ -135,11 +123,11 @@ _efl_canvas_animation_rotate_efl_object_constructor(Eo *eo_obj,
135 pd->to.degree = 0.0; 123 pd->to.degree = 0.0;
136 124
137 pd->rel_pivot.obj = NULL; 125 pd->rel_pivot.obj = NULL;
138 pd->rel_pivot.cx = 0.5; 126 pd->rel_pivot.pos.x = 0.5;
139 pd->rel_pivot.cy = 0.5; 127 pd->rel_pivot.pos.y = 0.5;
140 128
141 pd->abs_pivot.cx = 0; 129 pd->abs_pivot.x = 0;
142 pd->abs_pivot.cy = 0; 130 pd->abs_pivot.y = 0;
143 131
144 pd->use_rel_pivot = EINA_TRUE; 132 pd->use_rel_pivot = EINA_TRUE;
145 133
diff --git a/src/lib/evas/canvas/efl_canvas_animation_rotate.eo b/src/lib/evas/canvas/efl_canvas_animation_rotate.eo
index 169ddd3..c7463f8 100644
--- a/src/lib/evas/canvas/efl_canvas_animation_rotate.eo
+++ b/src/lib/evas/canvas/efl_canvas_animation_rotate.eo
@@ -1,37 +1,51 @@
1class @beta Efl.Canvas.Animation_Rotate extends Efl.Canvas.Animation 1class @beta Efl.Canvas.Animation_Rotate extends Efl.Canvas.Animation
2{ 2{
3 [[Efl rotate animation class]] 3 [[Animated rotation effect.
4
5 The @Efl.Canvas.Object will rotate around a pivot point from one degree to another.
6 Coordinates for the pivot point can be relative to another object or absolute
7 (relative to the containing canvas).
8
9 Note: Changing an object's position using @Efl.Gfx.Entity.position while this
10 animation is running might lead to unexpected results.
11 ]]
4 c_prefix: efl_animation_rotate; 12 c_prefix: efl_animation_rotate;
5 data: Efl_Canvas_Animation_Rotate_Data; 13 data: Efl_Canvas_Animation_Rotate_Data;
6 methods { 14 methods {
7 @property rotate { 15 @property rotate {
8 [[Rotate property]] 16 [[Degree range to animate and pivot object.
17 The object will rotate from $from_degree to $to_degree around the pivot point.
18 All of the object's vertices (i.e. the corners, if it's a rectangular object)
19 will be rotated by these degrees, relative to the pivot point inside the pivot object.
20 The pivot point is another object $pivot plus an additional offset $center_point.
21 ]]
9 set { 22 set {
10 } 23 }
11 get { 24 get {
12 } 25 }
13 values { 26 values {
14 from_degree: double; [[Rotation degree when animation starts]] 27 from_degree: double; [[Initial rotation (from 0 to 360). 0 means no rotation.]]
15 to_degree: double; [[Rotation degree when animation ends]] 28 to_degree: double; [[Ending rotation (from 0 to 360). 0 means no rotation.]]
16 pivot: Efl.Canvas.Object; [[Pivot object for the center point. 29 pivot: Efl.Canvas.Object; [[Object to use as pivot. $NULL means the animated object itself.]]
17 If the pivot object is $NULL, then the object is rotated on itself.]] 30 center_point: Eina.Vector2; [[Position in pixels of the pivot point inside the pivot object.
18 cx: double; [[X relative coordinate of the center point. 31 $[(0,0)] means the upper-left corner.]]
19 The left end is 0.0 and the right end is 1.0 (the center is 0.5).]]
20 cy: double; [[Y relative coordinate of the center point.
21 The top end is 0.0 and the bottom end is 1.0 (the center is 0.5).]]
22 } 32 }
23 } 33 }
24 @property rotate_absolute { 34 @property rotate_absolute {
25 [[Rotate absolute property]] 35 [[Degree range to animate and absolute pivot point.
36 The object will rotate from $from_degree to $to_degree around the pivot point.
37 All of the object's vertices (i.e. the corners, if it's a rectangular object)
38 will be rotated by these degrees, relative to an absolute pivot point.
39 The pivot point is relative to the canvas.
40 ]]
26 set { 41 set {
27 } 42 }
28 get { 43 get {
29 } 44 }
30 values { 45 values {
31 from_degree: double; [[Rotation degree when animation starts]] 46 from_degree: double; [[Initial rotation (from 0 to 360). 0 means no rotation.]]
32 to_degree: double; [[Rotation degree when animation ends]] 47 to_degree: double; [[Ending rotation (from 0 to 360). 0 means no rotation.]]
33 cx: int; [[X absolute coordinate of the center point.]] 48 pivot_point : Eina.Position2D; [[Position of the pivot point relative to the canvas.]]
34 cy: int; [[Y absolute coordinate of the center point.]]
35 } 49 }
36 } 50 }
37 } 51 }
diff --git a/src/lib/evas/canvas/efl_canvas_animation_rotate_private.h b/src/lib/evas/canvas/efl_canvas_animation_rotate_private.h
index e50db39..64c5887 100644
--- a/src/lib/evas/canvas/efl_canvas_animation_rotate_private.h
+++ b/src/lib/evas/canvas/efl_canvas_animation_rotate_private.h
@@ -12,15 +12,10 @@ typedef struct _Efl_Canvas_Animation_Rotate_Property
12 double degree; 12 double degree;
13} Efl_Canvas_Animation_Rotate_Property; 13} Efl_Canvas_Animation_Rotate_Property;
14 14
15typedef struct _Efl_Canvas_Animation_Rotate_Absolute_Pivot
16{
17 Evas_Coord cx, cy;
18} Efl_Canvas_Animation_Rotate_Absolute_Pivot;
19
20typedef struct _Efl_Canvas_Animation_Rotate_Relative_Pivot 15typedef struct _Efl_Canvas_Animation_Rotate_Relative_Pivot
21{ 16{
22 Efl_Canvas_Object *obj; 17 Efl_Canvas_Object *obj;
23 double cx, cy; 18 Eina_Vector2 pos;
24} Efl_Canvas_Animation_Rotate_Relative_Pivot; 19} Efl_Canvas_Animation_Rotate_Relative_Pivot;
25 20
26typedef struct _Efl_Canvas_Animation_Rotate_Data 21typedef struct _Efl_Canvas_Animation_Rotate_Data
@@ -28,7 +23,7 @@ typedef struct _Efl_Canvas_Animation_Rotate_Data
28 Efl_Canvas_Animation_Rotate_Property from; 23 Efl_Canvas_Animation_Rotate_Property from;
29 Efl_Canvas_Animation_Rotate_Property to; 24 Efl_Canvas_Animation_Rotate_Property to;
30 25
31 Efl_Canvas_Animation_Rotate_Absolute_Pivot abs_pivot; 26 Eina_Position2D abs_pivot;
32 Efl_Canvas_Animation_Rotate_Relative_Pivot rel_pivot; 27 Efl_Canvas_Animation_Rotate_Relative_Pivot rel_pivot;
33 28
34 Eina_Bool use_rel_pivot; 29 Eina_Bool use_rel_pivot;
diff --git a/src/lib/evas/canvas/efl_canvas_animation_scale.c b/src/lib/evas/canvas/efl_canvas_animation_scale.c
index 1cccbc6..e8a1323 100644
--- a/src/lib/evas/canvas/efl_canvas_animation_scale.c
+++ b/src/lib/evas/canvas/efl_canvas_animation_scale.c
@@ -5,37 +5,26 @@
5EOLIAN static void 5EOLIAN static void
6_efl_canvas_animation_scale_scale_set(Eo *eo_obj EINA_UNUSED, 6_efl_canvas_animation_scale_scale_set(Eo *eo_obj EINA_UNUSED,
7 Efl_Canvas_Animation_Scale_Data *pd, 7 Efl_Canvas_Animation_Scale_Data *pd,
8 double from_scale_x, 8 Eina_Vector2 from_scale,
9 double from_scale_y, 9 Eina_Vector2 to_scale,
10 double to_scale_x,
11 double to_scale_y,
12 Efl_Canvas_Object *pivot, 10 Efl_Canvas_Object *pivot,
13 double cx, 11 Eina_Vector2 rel_pivot_pos)
14 double cy)
15{ 12{
16 pd->from.scale_x = from_scale_x; 13 pd->from = from_scale;
17 pd->from.scale_y = from_scale_y;
18 14
19 pd->to.scale_x = to_scale_x; 15 pd->to = to_scale;
20 pd->to.scale_y = to_scale_y;
21 16
22 pd->rel_pivot.obj = pivot; 17 pd->rel_pivot.obj = pivot;
23 pd->rel_pivot.cx = cx; 18 pd->rel_pivot.pos = rel_pivot_pos;
24 pd->rel_pivot.cy = cy;
25 19
26 pd->use_rel_pivot = EINA_TRUE; 20 pd->use_rel_pivot = EINA_TRUE;
27} 21}
28 22
29EOLIAN static void 23EOLIAN static void
30_efl_canvas_animation_scale_scale_get(const Eo *eo_obj EINA_UNUSED, 24_efl_canvas_animation_scale_scale_get(const Eo *obj EINA_UNUSED,
31 Efl_Canvas_Animation_Scale_Data *pd, 25 Efl_Canvas_Animation_Scale_Data *pd,
32 double *from_scale_x, 26 Eina_Vector2 *from_scale, Eina_Vector2 *to_scale,
33 double *from_scale_y, 27 Efl_Canvas_Object **pivot, Eina_Vector2 *pivot_pos)
34 double *to_scale_x,
35 double *to_scale_y,
36 Efl_Canvas_Object **pivot,
37 double *cx,
38 double *cy)
39{ 28{
40 if (!pd->use_rel_pivot) 29 if (!pd->use_rel_pivot)
41 { 30 {
@@ -43,59 +32,39 @@ _efl_canvas_animation_scale_scale_get(const Eo *eo_obj EINA_UNUSED,
43 return; 32 return;
44 } 33 }
45 34
46 if (from_scale_x) 35 if (from_scale)
47 *from_scale_x = pd->from.scale_x; 36 *from_scale = pd->from;
48
49 if (from_scale_y)
50 *from_scale_y = pd->from.scale_y;
51
52 if (to_scale_x)
53 *to_scale_x = pd->to.scale_x;
54 37
55 if (to_scale_y) 38 if (to_scale)
56 *to_scale_y = pd->to.scale_y; 39 *to_scale = pd->to;
57 40
58 if (pivot) 41 if (pivot)
59 *pivot = pd->rel_pivot.obj; 42 *pivot = pd->rel_pivot.obj;
60 43
61 if (cx) 44 if (pivot_pos)
62 *cx = pd->rel_pivot.cx; 45 *pivot_pos = pd->rel_pivot.pos;
63
64 if (cy)
65 *cy = pd->rel_pivot.cy;
66} 46}
67 47
68EOLIAN static void 48EOLIAN static void
69_efl_canvas_animation_scale_scale_absolute_set(Eo *eo_obj EINA_UNUSED, 49_efl_canvas_animation_scale_scale_absolute_set(Eo *obj EINA_UNUSED,
70 Efl_Canvas_Animation_Scale_Data *pd, 50 Efl_Canvas_Animation_Scale_Data *pd,
71 double from_scale_x, 51 Eina_Vector2 from_scale, Eina_Vector2 to_scale,
72 double from_scale_y, 52 Eina_Position2D pos)
73 double to_scale_x,
74 double to_scale_y,
75 Evas_Coord cx,
76 Evas_Coord cy)
77{ 53{
78 pd->from.scale_x = from_scale_x; 54 pd->from = from_scale;
79 pd->from.scale_y = from_scale_y;
80 55
81 pd->to.scale_x = to_scale_x; 56 pd->to = to_scale;
82 pd->to.scale_y = to_scale_y;
83 57
84 pd->abs_pivot.cx = cx; 58 pd->pos = pos;
85 pd->abs_pivot.cy = cy;
86 59
87 pd->use_rel_pivot = EINA_FALSE; 60 pd->use_rel_pivot = EINA_FALSE;
88} 61}
89 62
90EOLIAN static void 63EOLIAN static void
91_efl_canvas_animation_scale_scale_absolute_get(const Eo *eo_obj EINA_UNUSED, 64_efl_canvas_animation_scale_scale_absolute_get(const Eo *obj EINA_UNUSED,
92 Efl_Canvas_Animation_Scale_Data *pd, 65 Efl_Canvas_Animation_Scale_Data *pd,
93 double *from_scale_x, 66 Eina_Vector2 *from_scale, Eina_Vector2 *to_scale,
94 double *from_scale_y, 67 Eina_Position2D *pos)
95 double *to_scale_x,
96 double *to_scale_y,
97 Evas_Coord *cx,
98 Evas_Coord *cy)
99{ 68{
100 if (pd->use_rel_pivot) 69 if (pd->use_rel_pivot)
101 { 70 {
@@ -103,23 +72,14 @@ _efl_canvas_animation_scale_scale_absolute_get(const Eo *eo_obj EINA_UNUSED,
103 return; 72 return;
104 } 73 }
105 74
106 if (from_scale_x) 75 if (from_scale)
107 *from_scale_x = pd->from.scale_x; 76 *from_scale = pd->from;
108
109 if (from_scale_y)
110 *from_scale_y = pd->from.scale_y;
111 77
112 if (to_scale_x) 78 if (to_scale)
113 *to_scale_x = pd->to.scale_x; 79 *to_scale = pd->to;
114 80
115 if (to_scale_y) 81 if (pos)
116 *to_scale_y = pd->to.scale_y; 82 *pos = pd->pos;
117
118 if (cx)
119 *cx = pd->abs_pivot.cx;
120
121 if (cy)
122 *cy = pd->abs_pivot.cy;
123} 83}
124 84
125EOLIAN static double 85EOLIAN static double
@@ -128,26 +88,26 @@ _efl_canvas_animation_scale_efl_canvas_animation_animation_apply(Eo *eo_obj,
128 double progress, 88 double progress,
129 Efl_Canvas_Object *target) 89 Efl_Canvas_Object *target)
130{ 90{
131 Efl_Canvas_Animation_Scale_Property new_scale; 91 Eina_Vector2 new_scale;
132 92
133 progress = efl_animation_apply(efl_super(eo_obj, MY_CLASS), progress, target); 93 progress = efl_animation_apply(efl_super(eo_obj, MY_CLASS), progress, target);
134 if (!target) return progress; 94 if (!target) return progress;
135 95
136 new_scale.scale_x = GET_STATUS(pd->from.scale_x, pd->to.scale_x, progress); 96 new_scale.x = GET_STATUS(pd->from.x, pd->to.x, progress);
137 new_scale.scale_y = GET_STATUS(pd->from.scale_y, pd->to.scale_y, progress); 97 new_scale.y = GET_STATUS(pd->from.y, pd->to.y, progress);
138 98
139 if (pd->use_rel_pivot) 99 if (pd->use_rel_pivot)
140 { 100 {
141 efl_gfx_mapping_zoom(target, 101 efl_gfx_mapping_zoom(target,
142 new_scale.scale_x, new_scale.scale_y, 102 new_scale.x, new_scale.y,
143 (pd->rel_pivot.obj) ? pd->rel_pivot.obj : target, 103 (pd->rel_pivot.obj) ? pd->rel_pivot.obj : target,
144 pd->rel_pivot.cx, pd->rel_pivot.cy); 104 pd->rel_pivot.pos.x , pd->rel_pivot.pos.y);
145 } 105 }
146 else 106 else
147 { 107 {
148 efl_gfx_mapping_zoom_absolute(target, 108 efl_gfx_mapping_zoom_absolute(target,
149 new_scale.scale_x, new_scale.scale_y, 109 new_scale.x, new_scale.y,
150 pd->abs_pivot.cx, pd->abs_pivot.cy); 110 pd->pos.x, pd->pos.y);
151 } 111 }
152 112
153 return progress; 113 return progress;
@@ -159,17 +119,11 @@ _efl_canvas_animation_scale_efl_object_constructor(Eo *eo_obj,
159{ 119{
160 eo_obj = efl_constructor(efl_super(eo_obj, MY_CLASS)); 120 eo_obj = efl_constructor(efl_super(eo_obj, MY_CLASS));
161 121
162 pd->from.scale_x = 1.0; 122 pd->from = EINA_VECTOR2(1.0, 1.0);
163 pd->from.scale_y = 1.0; 123 pd->to = EINA_VECTOR2(1.0, 1.0);
164 pd->to.scale_x = 1.0; 124 pd->rel_pivot.pos = EINA_VECTOR2(0.5, 0.5);
165 pd->to.scale_y = 1.0;
166
167 pd->rel_pivot.obj = NULL; 125 pd->rel_pivot.obj = NULL;
168 pd->rel_pivot.cx = 0.5; 126 pd->pos = EINA_POSITION2D(0, 0);
169 pd->rel_pivot.cy = 0.5;
170
171 pd->abs_pivot.cx = 0;
172 pd->abs_pivot.cy = 0;
173 127
174 pd->use_rel_pivot = EINA_TRUE; 128 pd->use_rel_pivot = EINA_TRUE;
175 129
diff --git a/src/lib/evas/canvas/efl_canvas_animation_scale.eo b/src/lib/evas/canvas/efl_canvas_animation_scale.eo
index 4d7df5e..23f9dea 100644
--- a/src/lib/evas/canvas/efl_canvas_animation_scale.eo
+++ b/src/lib/evas/canvas/efl_canvas_animation_scale.eo
@@ -1,41 +1,52 @@
1class @beta Efl.Canvas.Animation_Scale extends Efl.Canvas.Animation 1class @beta Efl.Canvas.Animation_Scale extends Efl.Canvas.Animation
2{ 2{
3 [[Efl scale animation class]] 3 [[Animated scaling effect.
4
5 The @Efl.Canvas.Object will have its size and position changed due to a scaling
6 operation around a specified pivot point.
7 Coordinates for the pivot point can be relative to the object or absolute
8 (relative to the containing canvas).
9
10 Note: Changing an object's geometry using @Efl.Gfx.Entity.position or @Efl.Gfx.Entity.size
11 while this animation is running might lead to unexpected results.
12 ]]
4 c_prefix: efl_animation_scale; 13 c_prefix: efl_animation_scale;
5 data: Efl_Canvas_Animation_Scale_Data; 14 data: Efl_Canvas_Animation_Scale_Data;
6 methods { 15 methods {
7 @property scale { 16 @property scale {
8 [[Scale property]] 17 [[Scale range and pivot object.
18 The object's scale will change from $from_scale to $to_scale.
19 All of the object's vertices (i.e. the corners, if it's a rectangular object)
20 will be multiplied by this scale, relative to the pivot point inside the pivot object.
21 The pivot point is another object $pivot plus an additional offset $center_point.
22 ]]
9 set { 23 set {
10 } 24 }
11 get { 25 get {
12 } 26 }
13 values { 27 values {
14 from_scale_x: double; [[Scale factor along x axis when animation starts]] 28 from_scale: Eina.Vector2; [[Initial scale value.]]
15 from_scale_y: double; [[Scale factor along y axis when animation starts]] 29 to_scale: Eina.Vector2; [[Ending scale value.]]
16 to_scale_x: double; [[Scale factor along x axis when animation ends]] 30 pivot: Efl.Canvas.Object; [[Object to use as pivot. $NULL means the animated object itself.]]
17 to_scale_y: double; [[Scale factor along y axis when animation ends]] 31 center_point: Eina.Vector2; [[Position in pixels of the pivot point inside the pivot object.
18 pivot: Efl.Canvas.Object; [[Pivot object for the center point. If the pivot object is $NULL, then the object 32 $[(0,0)] means the upper-left corner.]]
19 is scaled on itself.]]
20 cx: double; [[X relative coordinate of the center point. The left end is 0.0 and the right end is 1.0
21 (the center is 0.5).]]
22 cy: double; [[Y relative coordinate of the center point. The top end is 0.0 and the bottom end is 1.0
23 (the center is 0.5).]]
24 } 33 }
25 } 34 }
26 @property scale_absolute { 35 @property scale_absolute {
27 [[Scale absolute property]] 36 [[Scale range and pivot position, relative to the canvas.
37 The object's scale will change from $from_scale to $to_scale.
38 All of the object's vertices (i.e. the corners, if it's a rectangular object)
39 will be multiplied by this scale, relative to the pivot point.
40 The pivot point is relative to the canvas.
41 ]]
28 set { 42 set {
29 } 43 }
30 get { 44 get {
31 } 45 }
32 values { 46 values {
33 from_scale_x: double; [[Scale factor along x axis when animation starts]] 47 from_scale: Eina.Vector2; [[Initial scale value.]]
34 from_scale_y: double; [[Scale factor along y axis when animation starts]] 48 to_scale: Eina.Vector2; [[Ending scale value.]]
35 to_scale_x: double; [[Scale factor along x axis when animation ends]] 49 pivot_point: Eina.Position2D; [[Position of the pivot point relative to the canvas.]]
36 to_scale_y: double; [[Scale factor along y axis when animation ends]]
37 cx: int; [[X absolute coordinate of the center point.]]
38 cy: int; [[Y absolute coordinate of the center point.]]
39 } 50 }
40 } 51 }
41 } 52 }
diff --git a/src/lib/evas/canvas/efl_canvas_animation_scale_private.h b/src/lib/evas/canvas/efl_canvas_animation_scale_private.h
index 020d9fd..57dc40d 100644
--- a/src/lib/evas/canvas/efl_canvas_animation_scale_private.h
+++ b/src/lib/evas/canvas/efl_canvas_animation_scale_private.h
@@ -7,28 +7,18 @@
7#define EFL_ANIMATION_SCALE_DATA_GET(o, pd) \ 7#define EFL_ANIMATION_SCALE_DATA_GET(o, pd) \
8 Efl_Canvas_Animation_Scale_Data *pd = efl_data_scope_get(o, EFL_CANVAS_ANIMATION_SCALE_CLASS) 8 Efl_Canvas_Animation_Scale_Data *pd = efl_data_scope_get(o, EFL_CANVAS_ANIMATION_SCALE_CLASS)
9 9
10typedef struct _Efl_Canvas_Animation_Scale_Property
11{
12 double scale_x, scale_y;
13} Efl_Canvas_Animation_Scale_Property;
14
15typedef struct _Efl_Canvas_Animation_Scale_Absolute_Pivot
16{
17 Evas_Coord cx, cy;
18} Efl_Canvas_Animation_Scale_Absolute_Pivot;
19
20typedef struct _Efl_Canvas_Animation_Scale_Relative_Pivot 10typedef struct _Efl_Canvas_Animation_Scale_Relative_Pivot
21{ 11{
22 Efl_Canvas_Object *obj; 12 Efl_Canvas_Object *obj;
23 double cx, cy; 13 Eina_Vector2 pos;
24} Efl_Canvas_Animation_Scale_Relative_Pivot; 14} Efl_Canvas_Animation_Scale_Relative_Pivot;
25 15
26typedef struct _Efl_Canvas_Animation_Scale_Data 16typedef struct _Efl_Canvas_Animation_Scale_Data
27{ 17{
28 Efl_Canvas_Animation_Scale_Property from; 18 Eina_Vector2 from;
29 Efl_Canvas_Animation_Scale_Property to; 19 Eina_Vector2 to;
30 20
31 Efl_Canvas_Animation_Scale_Absolute_Pivot abs_pivot; 21 Eina_Position2D pos;
32 Efl_Canvas_Animation_Scale_Relative_Pivot rel_pivot; 22 Efl_Canvas_Animation_Scale_Relative_Pivot rel_pivot;
33 23
34 Eina_Bool use_rel_pivot; 24 Eina_Bool use_rel_pivot;
diff --git a/src/lib/evas/canvas/efl_canvas_animation_translate.c b/src/lib/evas/canvas/efl_canvas_animation_translate.c
index 39a052c..1a98daa 100644
--- a/src/lib/evas/canvas/efl_canvas_animation_translate.c
+++ b/src/lib/evas/canvas/efl_canvas_animation_translate.c
@@ -11,16 +11,12 @@ typedef struct __Translate_Property_Double
11EOLIAN static void 11EOLIAN static void
12_efl_canvas_animation_translate_translate_set(Eo *eo_obj EINA_UNUSED, 12_efl_canvas_animation_translate_translate_set(Eo *eo_obj EINA_UNUSED,
13 Efl_Canvas_Animation_Translate_Data *pd, 13 Efl_Canvas_Animation_Translate_Data *pd,
14 Evas_Coord from_x, 14 Eina_Position2D from,
15 Evas_Coord from_y, 15 Eina_Position2D to)
16 Evas_Coord to_x,
17 Evas_Coord to_y)
18{ 16{
19 pd->from.move_x = from_x; 17 pd->from = from;
20 pd->from.move_y = from_y;
21 18
22 pd->to.move_x = to_x; 19 pd->to = to;
23 pd->to.move_y = to_y;
24 20
25 pd->use_rel_move = EINA_TRUE; 21 pd->use_rel_move = EINA_TRUE;
26} 22}
@@ -28,10 +24,8 @@ _efl_canvas_animation_translate_translate_set(Eo *eo_obj EINA_UNUSED,
28EOLIAN static void 24EOLIAN static void
29_efl_canvas_animation_translate_translate_get(const Eo *eo_obj EINA_UNUSED, 25_efl_canvas_animation_translate_translate_get(const Eo *eo_obj EINA_UNUSED,
30 Efl_Canvas_Animation_Translate_Data *pd, 26 Efl_Canvas_Animation_Translate_Data *pd,
31 Evas_Coord *from_x, 27 Eina_Position2D *from,
32 Evas_Coord *from_y, 28 Eina_Position2D *to)
33 Evas_Coord *to_x,
34 Evas_Coord *to_y)
35{ 29{
36 if (!pd->use_rel_move) 30 if (!pd->use_rel_move)
37 { 31 {
@@ -39,30 +33,22 @@ _efl_canvas_animation_translate_translate_get(const Eo *eo_obj EINA_UNUSED,
39 return; 33 return;
40 } 34 }
41 35
42 if (from_x) 36 if (from)
43 *from_x = pd->from.move_x; 37 *from = pd->from;
44 if (from_y)
45 *from_y = pd->from.move_y;
46 38
47 if (to_x) 39 if (to)
48 *to_x = pd->to.move_x; 40 *to = pd->to;
49 if (to_y)
50 *to_y = pd->to.move_y;
51} 41}
52 42
53EOLIAN static void 43EOLIAN static void
54_efl_canvas_animation_translate_translate_absolute_set(Eo *eo_obj EINA_UNUSED, 44_efl_canvas_animation_translate_translate_absolute_set(Eo *eo_obj EINA_UNUSED,
55 Efl_Canvas_Animation_Translate_Data *pd, 45 Efl_Canvas_Animation_Translate_Data *pd,
56 Evas_Coord from_x, 46 Eina_Position2D from,
57 Evas_Coord from_y, 47 Eina_Position2D to)
58 Evas_Coord to_x,
59 Evas_Coord to_y)
60{ 48{
61 pd->from.x = from_x; 49 pd->from = from;
62 pd->from.y = from_y;
63 50
64 pd->to.x = to_x; 51 pd->to = to;
65 pd->to.y = to_y;
66 52
67 pd->use_rel_move = EINA_FALSE; 53 pd->use_rel_move = EINA_FALSE;
68} 54}
@@ -70,10 +56,8 @@ _efl_canvas_animation_translate_translate_absolute_set(Eo *eo_obj EINA_UNUSED,
70EOLIAN static void 56EOLIAN static void
71_efl_canvas_animation_translate_translate_absolute_get(const Eo *eo_obj EINA_UNUSED, 57_efl_canvas_animation_translate_translate_absolute_get(const Eo *eo_obj EINA_UNUSED,
72 Efl_Canvas_Animation_Translate_Data *pd, 58 Efl_Canvas_Animation_Translate_Data *pd,
73 Evas_Coord *from_x, 59 Eina_Position2D *from,
74 Evas_Coord *from_y, 60 Eina_Position2D *to)
75 Evas_Coord *to_x,
76 Evas_Coord *to_y)
77{ 61{
78 if (pd->use_rel_move) 62 if (pd->use_rel_move)
79 { 63 {
@@ -81,15 +65,11 @@ _efl_canvas_animation_translate_translate_absolute_get(const Eo *eo_obj EINA_UNU
81 return; 65 return;
82 } 66 }
83 67
84 if (from_x) 68 if (from)
85 *from_x = pd->from.x; 69 *from = pd->from;
86 if (from_y)
87 *from_y = pd->from.y;
88 70
89 if (to_x) 71 if (to)
90 *to_x = pd->to.x; 72 *to = pd->to;
91 if (to_y)
92 *to_y = pd->to.y;
93} 73}
94 74
95EOLIAN static double 75EOLIAN static double
@@ -106,8 +86,8 @@ _efl_canvas_animation_translate_efl_canvas_animation_animation_apply(Eo *eo_obj,
106 86
107 if (pd->use_rel_move) 87 if (pd->use_rel_move)
108 { 88 {
109 new.x = GET_STATUS(pd->from.move_x, pd->to.move_x, progress); 89 new.x = GET_STATUS(pd->from.x, pd->to.x, progress);
110 new.y = GET_STATUS(pd->from.move_y, pd->to.move_y, progress); 90 new.y = GET_STATUS(pd->from.y, pd->to.y, progress);
111 } 91 }
112 else 92 else
113 { 93 {
@@ -127,15 +107,8 @@ _efl_canvas_animation_translate_efl_object_constructor(Eo *eo_obj,
127{ 107{
128 eo_obj = efl_constructor(efl_super(eo_obj, MY_CLASS)); 108 eo_obj = efl_constructor(efl_super(eo_obj, MY_CLASS));
129 109
130 pd->from.move_x = 0; 110 pd->from = EINA_POSITION2D(0,0);
131 pd->from.move_y = 0; 111 pd->to = EINA_POSITION2D(0,0);
132 pd->from.x = 0;
133 pd->from.y = 0;
134
135 pd->to.move_x = 0;
136 pd->to.move_y = 0;
137 pd->to.x = 0;
138 pd->to.y = 0;
139 112
140 pd->use_rel_move = EINA_TRUE; 113 pd->use_rel_move = EINA_TRUE;
141 114
diff --git a/src/lib/evas/canvas/efl_canvas_animation_translate.eo b/src/lib/evas/canvas/efl_canvas_animation_translate.eo
index 3d74cbd..ed06dd5 100644
--- a/src/lib/evas/canvas/efl_canvas_animation_translate.eo
+++ b/src/lib/evas/canvas/efl_canvas_animation_translate.eo
@@ -1,33 +1,43 @@
1class @beta Efl.Canvas.Animation_Translate extends Efl.Canvas.Animation 1class @beta Efl.Canvas.Animation_Translate extends Efl.Canvas.Animation
2{ 2{
3 [[Efl translate animation class]] 3 [[Animated translation effect.
4
5 The @Efl.Canvas.Object will move from one point to another.
6 Coordinates for the origin and destination points can be relative to the object
7 or absolute (relative to the containing canvas).
8
9 Note: Changing an object's position using @Efl.Gfx.Entity.position while this
10 animation is running might lead to unexpected results.
11 ]]
4 c_prefix: efl_animation_translate; 12 c_prefix: efl_animation_translate;
5 data: Efl_Canvas_Animation_Translate_Data; 13 data: Efl_Canvas_Animation_Translate_Data;
6 methods { 14 methods {
7 @property translate { 15 @property translate {
8 [[Translate property]] 16 [[Translation vector, relative to the starting position of the object.
17 So, for example, if $from is $[(0,0)], the object will move from its
18 current position to $to.
19 ]]
9 set { 20 set {
10 } 21 }
11 get { 22 get {
12 } 23 }
13 values { 24 values {
14 from_x: int; [[Distance moved along x axis when animation starts]] 25 from : Eina.Position2D; [[Relative initial position.]]
15 from_y: int; [[Distance moved along y axis when animation starts]] 26 to : Eina.Position2D; [[Relative ending position.]]
16 to_x: int; [[Distance moved along x axis when animation ends]]
17 to_y: int; [[Distance moved along y axis when animation ends]]
18 } 27 }
19 } 28 }
20 @property translate_absolute { 29 @property translate_absolute {
21 [[Translate absolute property]] 30 [[Translation vector, relative to the canvas.
31 So, for example, if $from is $[(0,0)], the object will always start from the
32 origin of the canvas, regardless of the current object position.
33 ]]
22 set { 34 set {
23 } 35 }
24 get { 36 get {
25 } 37 }
26 values { 38 values {
27 from_x: int; [[X coordinate when animation starts]] 39 from : Eina.Position2D; [[Absolute initial position.]]
28 from_y: int; [[Y coordinate when animation starts]] 40 to : Eina.Position2D; [[Absolute ending position.]]
29 to_x: int; [[X coordinate when animation ends]]
30 to_y: int; [[Y coordinate when animation ends]]
31 } 41 }
32 } 42 }
33 } 43 }
diff --git a/src/lib/evas/canvas/efl_canvas_animation_translate_private.h b/src/lib/evas/canvas/efl_canvas_animation_translate_private.h
index 17c4b6d..47665a5 100644
--- a/src/lib/evas/canvas/efl_canvas_animation_translate_private.h
+++ b/src/lib/evas/canvas/efl_canvas_animation_translate_private.h
@@ -7,16 +7,10 @@
7#define EFL_ANIMATION_TRANSLATE_DATA_GET(o, pd) \ 7#define EFL_ANIMATION_TRANSLATE_DATA_GET(o, pd) \
8 Efl_Canvas_Animation_Translate_Data *pd = efl_data_scope_get(o, EFL_CANVAS_ANIMATION_TRANSLATE_CLASS) 8 Efl_Canvas_Animation_Translate_Data *pd = efl_data_scope_get(o, EFL_CANVAS_ANIMATION_TRANSLATE_CLASS)
9 9
10typedef struct _Efl_Canvas_Animation_Translate_Property
11{
12 Evas_Coord move_x, move_y;
13 Evas_Coord x, y;
14} Efl_Canvas_Animation_Translate_Property;
15
16typedef struct _Efl_Canvas_Animation_Translate_Data 10typedef struct _Efl_Canvas_Animation_Translate_Data
17{ 11{
18 Efl_Canvas_Animation_Translate_Property from; 12 Eina_Position2D from;
19 Efl_Canvas_Animation_Translate_Property to; 13 Eina_Position2D to;
20 14
21 Eina_Bool use_rel_move; 15 Eina_Bool use_rel_move;
22} Efl_Canvas_Animation_Translate_Data; 16} Efl_Canvas_Animation_Translate_Data;
diff --git a/src/lib/evas/canvas/efl_canvas_animation_types.eot b/src/lib/evas/canvas/efl_canvas_animation_types.eot
index 23e89ae..bb44fe4 100644
--- a/src/lib/evas/canvas/efl_canvas_animation_types.eot
+++ b/src/lib/evas/canvas/efl_canvas_animation_types.eot
@@ -5,8 +5,11 @@ struct @beta Efl.Canvas.Animation_Player_Event_Running; [[Information of event r
5 5
6enum @beta Efl.Canvas.Animation_Repeat_Mode 6enum @beta Efl.Canvas.Animation_Repeat_Mode
7{ 7{
8 [[Animation repeat mode]] 8 [[Animation repeat mode.]]
9 9
10 restart = 0, [[Restart animation when the animation ends.]] 10 restart = 0, [[Restart animation when the animation ends: The animation will play again from the beginning to the
11 reverse [[Reverse animation when the animation ends.]] 11 end.]]
12 reverse = 1, [[Reverse animation when the animation ends: The animation will continue playing from the end to the
13 beginning.]]
14 last
12} 15}
diff --git a/src/lib/evas/canvas/efl_canvas_image.c b/src/lib/evas/canvas/efl_canvas_image.c
index 9b19be0..1bdd532 100644
--- a/src/lib/evas/canvas/efl_canvas_image.c
+++ b/src/lib/evas/canvas/efl_canvas_image.c
@@ -517,6 +517,28 @@ _efl_canvas_image_efl_gfx_frame_controller_frame_duration_get(const Eo *eo_obj,
517 return _evas_image_animated_frame_duration_get(eo_obj, start_frame, frame_num); 517 return _evas_image_animated_frame_duration_get(eo_obj, start_frame, frame_num);
518} 518}
519 519
520Eina_Bool _efl_canvas_image_efl_gfx_frame_controller_sector_set(Eo *obj EINA_UNUSED,
521 void *_pd EINA_UNUSED,
522 const char *name EINA_UNUSED,
523 int startframe EINA_UNUSED,
524 int endframe EINA_UNUSED)
525{
526 // TODO: We need to implement the feature to section playback of image animation.
527 ERR("efl_gfx_frame_controller_sector_set not implemented for efl_canvas_image yet.");
528 return EINA_FALSE;
529}
530
531Eina_Bool _efl_canvas_image_efl_gfx_frame_controller_sector_get(const Eo *obj EINA_UNUSED,
532 void *_pd EINA_UNUSED,
533 const char *name EINA_UNUSED,
534 int *startframe EINA_UNUSED,
535 int *endframe EINA_UNUSED)
536{
537 // TODO: We need to implement the feature to section playback of image animation.
538 ERR("efl_gfx_frame_controller_sector_get not implemented for efl_canvas_image yet.");
539 return EINA_FALSE;
540}
541
520Eina_Bool 542Eina_Bool
521_evas_image_animated_frame_set(Eo *eo_obj, int frame_index) 543_evas_image_animated_frame_set(Eo *eo_obj, int frame_index)
522{ 544{
diff --git a/src/lib/evas/canvas/efl_canvas_image.eo b/src/lib/evas/canvas/efl_canvas_image.eo
index 428a1f9..72e1894 100644
--- a/src/lib/evas/canvas/efl_canvas_image.eo
+++ b/src/lib/evas/canvas/efl_canvas_image.eo
@@ -24,6 +24,7 @@ class @beta Efl.Canvas.Image extends Efl.Canvas.Image_Internal implements
24 Efl.Gfx.Frame_Controller.loop_type { get; } 24 Efl.Gfx.Frame_Controller.loop_type { get; }
25 Efl.Gfx.Frame_Controller.loop_count { get; } 25 Efl.Gfx.Frame_Controller.loop_count { get; }
26 Efl.Gfx.Frame_Controller.frame_duration { get; } 26 Efl.Gfx.Frame_Controller.frame_duration { get; }
27 Efl.Gfx.Frame_Controller.sector { set; get; }
27 Efl.Gfx.Image_Load_Controller.load_async_start; 28 Efl.Gfx.Image_Load_Controller.load_async_start;
28 Efl.Gfx.Image_Load_Controller.load_async_cancel; 29 Efl.Gfx.Image_Load_Controller.load_async_cancel;
29 Efl.Gfx.Image_Load_Controller.load_dpi { get; set; } 30 Efl.Gfx.Image_Load_Controller.load_dpi { get; set; }
diff --git a/src/lib/evas/canvas/efl_canvas_object.eo b/src/lib/evas/canvas/efl_canvas_object.eo
index 48b67e7..dbee3db 100644
--- a/src/lib/evas/canvas/efl_canvas_object.eo
+++ b/src/lib/evas/canvas/efl_canvas_object.eo
@@ -11,7 +11,7 @@ struct Efl.Event_Animator_Tick {
11 11
12abstract Efl.Canvas.Object extends Efl.Loop_Consumer implements Efl.Gfx.Entity, Efl.Gfx.Color, Efl.Gfx.Stack, 12abstract Efl.Canvas.Object extends Efl.Loop_Consumer implements Efl.Gfx.Entity, Efl.Gfx.Color, Efl.Gfx.Stack,
13 Efl.Input.Interface, Efl.Gfx.Hint, 13 Efl.Input.Interface, Efl.Gfx.Hint,
14 Efl.Gfx.Mapping, Efl.Canvas.Pointer, Efl.Gesture.Events 14 Efl.Gfx.Mapping, Efl.Canvas.Pointer, Efl.Gesture.Events, Efl.Canvas.Object_Animation
15{ 15{
16 [[Efl canvas object abstract class 16 [[Efl canvas object abstract class
17 17
@@ -352,7 +352,9 @@ abstract Efl.Canvas.Object extends Efl.Loop_Consumer implements Efl.Gfx.Entity,
352 See also @.clipper. 352 See also @.clipper.
353 ]] 353 ]]
354 get { 354 get {
355 return: iterator<Efl.Canvas.Object> @no_unused; [[An iterator over the 355 }
356 values {
357 objects: iterator<Efl.Canvas.Object> @move; [[An iterator over the
356 list of objects clipped by $obj.]] 358 list of objects clipped by $obj.]]
357 } 359 }
358 } 360 }
diff --git a/src/lib/evas/canvas/efl_canvas_object_animation.c b/src/lib/evas/canvas/efl_canvas_object_animation.c
new file mode 100644
index 0000000..3069d06
--- /dev/null
+++ b/src/lib/evas/canvas/efl_canvas_object_animation.c
@@ -0,0 +1,214 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include "evas_common_private.h"
6#include "evas_private.h"
7#include "efl_canvas_object_animation.eo.h"
8#include <Ecore.h>
9
10#define MY_CLASS EFL_CANVAS_OBJECT_ANIMATION_MIXIN
11
12
13typedef struct
14{
15 Efl_Canvas_Animation *animation;
16 double speed;
17 double progress;
18 double run_start_time;
19 double start_pos;
20 int remaining_repeats;
21 Efl_Loop_Timer *timer;
22 Eina_Bool pause_state : 1;
23} Efl_Canvas_Object_Animation_Indirect_Data;
24
25typedef struct
26{
27 Efl_Canvas_Object_Animation_Indirect_Data *in;
28} Efl_Canvas_Object_Animation_Data;
29
30static void _end(Efl_Canvas_Object_Animation *obj, Efl_Canvas_Object_Animation_Data *pd);
31
32
33static void
34_animator_cb(void *data, const Efl_Event *ev EINA_UNUSED)
35{
36 Eo *obj = data;
37 Efl_Canvas_Object_Animation_Data *pd = efl_data_scope_get(obj, MY_CLASS);
38 double duration, elapsed_time, vector, current;
39
40 EINA_SAFETY_ON_NULL_RETURN(pd->in);
41 current = ecore_loop_time_get();
42 EINA_SAFETY_ON_FALSE_RETURN(pd->in->run_start_time <= current);
43
44 duration = efl_animation_duration_get(pd->in->animation) / pd->in->speed;
45 elapsed_time = current - pd->in->run_start_time;
46 if (EINA_DBL_EQ(duration, 0))
47 {
48 if (pd->in->speed < 0.0)
49 vector = -1.0;
50 else
51 vector = 1.0;
52 }
53 else
54 vector = elapsed_time / duration;
55
56 /* When animation player starts, _animator_cb() is called immediately so
57 * both elapsed time and progress are 0.0.
58 * Since it is the beginning of the animation if progress is 0.0, the
59 * following codes for animation should be executed. */
60 if (pd->in->speed < 0.0)
61 vector += 1.0;
62 pd->in->progress = CLAMP(0.0, vector, 1.0);
63
64 /* The previously applied map effect should be reset before applying the
65 * current map effect. Otherwise, the incrementally added map effects
66 * increase numerical error. */
67 efl_gfx_mapping_reset(obj);
68 efl_animation_apply(pd->in->animation, pd->in->progress, obj);
69
70 double progress = pd->in->progress;
71 efl_event_callback_call(obj, EFL_CANVAS_OBJECT_ANIMATION_EVENT_ANIMATION_PROGRESS_UPDATED, &progress);
72
73 //Check if animation stopped in animation_progress,updated callback.
74 if (!pd->in) return;
75
76 //Not end. Keep going.
77 if ((pd->in->speed < 0 && EINA_DBL_EQ(pd->in->progress, 0)) ||
78 (pd->in->speed > 0 && EINA_DBL_EQ(pd->in->progress, 1.0)))
79 {
80 //Repeat animation
81 if ((efl_animation_play_count_get(pd->in->animation) == 0) ||
82 (pd->in->remaining_repeats > 0))
83 {
84 pd->in->remaining_repeats--;
85
86 if (efl_animation_repeat_mode_get(pd->in->animation) == EFL_CANVAS_ANIMATION_REPEAT_MODE_REVERSE)
87 pd->in->speed *= -1;
88
89 pd->in->run_start_time = current;
90 }
91 else
92 {
93 efl_canvas_object_animation_stop(obj);
94 }
95 }
96}
97
98static void
99_end(Efl_Canvas_Object_Animation *obj, Efl_Canvas_Object_Animation_Data *pd)
100{
101 EINA_SAFETY_ON_NULL_RETURN(pd->in);
102 efl_event_callback_del(obj, EFL_CANVAS_OBJECT_EVENT_ANIMATOR_TICK, _animator_cb, obj);
103}
104
105static void
106_start(Efl_Canvas_Object_Animation *obj, Efl_Canvas_Object_Animation_Data *pd, double delay)
107{
108 EINA_SAFETY_ON_NULL_RETURN(pd->in);
109 pd->in->run_start_time = ecore_loop_time_get() - efl_animation_duration_get(pd->in->animation)*delay;
110 efl_event_callback_add(obj, EFL_CANVAS_OBJECT_EVENT_ANIMATOR_TICK, _animator_cb, obj);
111 _animator_cb(obj, NULL);
112}
113
114static Eina_Value
115_start_fcb(Eo *o, void *data EINA_UNUSED, const Eina_Value v)
116{
117 Efl_Canvas_Object_Animation_Data *pd = efl_data_scope_safe_get(o, MY_CLASS);
118 EINA_SAFETY_ON_NULL_RETURN_VAL(pd, EINA_VALUE_EMPTY);
119 if (!pd->in) return v; //animation was stopped before anything started
120 _start(o, pd, pd->in->start_pos);
121 return v;
122}
123
124EOLIAN static Efl_Canvas_Animation*
125_efl_canvas_object_animation_animation_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Object_Animation_Data *pd)
126{
127 if (!pd->in) return NULL;
128 return pd->in->animation;
129}
130
131EOLIAN static double
132_efl_canvas_object_animation_animation_progress_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Object_Animation_Data *pd)
133{
134 if (pd->in && pd->in->animation)
135 return (pd->in->speed < 0) ? fabs(1.0 - pd->in->progress) : pd->in->progress;
136 else
137 return -1.0;
138}
139
140EOLIAN static void
141_efl_canvas_object_animation_animation_pause_set(Eo *obj, Efl_Canvas_Object_Animation_Data *pd, Eina_Bool pause)
142{
143 EINA_SAFETY_ON_NULL_RETURN(pd->in);
144
145 if (pd->in->pause_state == pause) return;
146
147 if (pause)
148 _end(obj, pd);
149 else
150 _start(obj, pd,(pd->in->speed < 0) ? 1.0 - pd->in->progress : pd->in->progress);
151 pd->in->pause_state = pause;
152}
153
154EOLIAN static Eina_Bool
155_efl_canvas_object_animation_animation_pause_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Object_Animation_Data *pd)
156{
157 if (!pd->in) return EINA_FALSE;
158
159 return pd->in->pause_state;
160}
161
162EOLIAN static void
163_efl_canvas_object_animation_animation_start(Eo *obj, Efl_Canvas_Object_Animation_Data *pd, Efl_Canvas_Animation *animation, double speed, double start_pos)
164{
165 Efl_Canvas_Object_Animation_Indirect_Data *in;
166 if (pd->in && pd->in->animation)
167 efl_canvas_object_animation_stop(obj);
168 EINA_SAFETY_ON_FALSE_RETURN(!pd->in);
169 in = pd->in = calloc(1, sizeof(Efl_Canvas_Object_Animation_Indirect_Data));
170
171 EINA_SAFETY_ON_NULL_RETURN(animation);
172 EINA_SAFETY_ON_FALSE_RETURN(start_pos >= 0.0 && start_pos <= 1.0);
173 EINA_SAFETY_ON_FALSE_RETURN(!EINA_DBL_EQ(speed, 0.0));
174 EINA_SAFETY_ON_FALSE_RETURN(efl_playable_seekable_get(animation));
175
176 in->pause_state = EINA_FALSE;
177 in->animation = efl_ref(animation);
178 in->remaining_repeats = efl_animation_play_count_get(animation) - 1; // -1 because one run is already going on
179 in->speed = speed;
180 in->start_pos = start_pos;
181 efl_event_callback_call(obj, EFL_CANVAS_OBJECT_ANIMATION_EVENT_ANIMATION_CHANGED, in->animation);
182 //You should not rely on in beeing available after calling the above event.
183 in = NULL;
184
185 if (efl_animation_start_delay_get(animation) > 0.0)
186 {
187 Eina_Future *f = efl_loop_timeout(efl_loop_get(obj), efl_animation_start_delay_get(animation));
188
189 efl_future_then(obj, f, .success = _start_fcb);
190 }
191 else
192 _start(obj, pd, start_pos);
193}
194
195EOLIAN static void
196_efl_canvas_object_animation_animation_stop(Eo *obj, Efl_Canvas_Object_Animation_Data *pd)
197{
198 if (!pd->in) return;
199
200 if (!efl_animation_final_state_keep_get(pd->in->animation))
201 efl_gfx_mapping_reset(obj);
202 _end(obj, pd);
203 efl_unref(pd->in->animation);
204 pd->in->animation = NULL;
205
206 efl_event_callback_call(obj, EFL_CANVAS_OBJECT_ANIMATION_EVENT_ANIMATION_CHANGED, pd->in->animation);
207
208 //this could be NULL if some weird callstack calls stop again while the above event is executed
209 if (pd->in)
210 free(pd->in);
211 pd->in = NULL;
212}
213
214#include "efl_canvas_object_animation.eo.c"
diff --git a/src/lib/evas/canvas/efl_canvas_object_animation.eo b/src/lib/evas/canvas/efl_canvas_object_animation.eo
new file mode 100644
index 0000000..49146a6
--- /dev/null
+++ b/src/lib/evas/canvas/efl_canvas_object_animation.eo
@@ -0,0 +1,60 @@
1mixin @beta Efl.Canvas.Object_Animation requires Efl.Object
2{
3 methods {
4 @property animation {
5 [[The animation that is currently played on the canvas object.
6
7 $null in case that there is no animation running.]]
8 get {
9
10 }
11 values {
12 animation : Efl.Canvas.Animation; [[The animation which is currently applied on this object.]]
13 }
14 }
15 @property animation_progress {
16 [[The current progress of the animation, between 0.0 and 1.0.
17
18 Even if the animation is going backwards (speed < 0.0). the progress will still go from 0.0 to 1.0.
19
20 If there is no animation going on, this will return -1.0.
21 ]]
22 get {
23
24 }
25 values {
26 progress : double; [[The progress the animation applying is currently in.]]
27 }
28 }
29 @property animation_pause {
30 [[Pause the animation
31
32 The animation will not be unset. When $pause is unset, the animation will be resumed at the same progress it has right now.
33 ]]
34 values {
35 pause : bool;
36 }
37 }
38 animation_start {
39 [[Start a new animation.
40
41 If there is a animation going on, this is stopped. The previous @.animation object will be replaced. The lifetime is adjusted accordingly.
42 ]]
43 params {
44 animation : Efl.Canvas.Animation @move; [[The animation to start. When not needed anymore, the reference that was passed is given up.]]
45 speed : double; [[The speed of the playback. `1.0` is normal playback. Negative values mean backward playback.]]
46 starting_progress : double; [[The progress to start, must be between 0.0 and 1.0.]]
47 }
48 }
49 animation_stop {
50 [[Stop the animation.
51
52 After this call, @.animation will return $null. The reference that was taken during @.animation_start will be given up on.
53 ]]
54 }
55 }
56 events {
57 animation,changed: Efl.Canvas.Animation; [[The animation object got changed.]]
58 animation_progress,updated : double; [[The animation progress got changed.]]
59 }
60}
diff --git a/src/lib/evas/canvas/efl_canvas_pointer.eo b/src/lib/evas/canvas/efl_canvas_pointer.eo
new file mode 100644
index 0000000..f0c363a
--- /dev/null
+++ b/src/lib/evas/canvas/efl_canvas_pointer.eo
@@ -0,0 +1,35 @@
1import efl_input_device;
2
3interface Efl.Canvas.Pointer
4{
5 [[Efl Canvas Pointer interface
6
7 @since 1.22
8 ]]
9 methods {
10 /* FIXME Efl.Input.Device is not stable yet*/
11 @property pointer_inside @beta {
12 [[Whether the mouse pointer is logically inside the canvas.
13
14 This value is $false or $true, depending on whether a pointer,in or pointer,out
15 event has been previously received.
16
17 A return value of $true indicates the mouse is logically
18 inside the canvas, and $false implies it is logically
19 outside the canvas.
20
21 A canvas begins with the mouse being assumed outside ($false).
22 ]]
23 get {
24 }
25 keys {
26 seat: Efl.Input.Device @optional; [[The seat to consider, if $null
27 then the default seat will be used.]]
28 }
29 values {
30 inside: bool; [[$true if the mouse pointer is inside the canvas,
31 $false otherwise]]
32 }
33 }
34 }
35}
diff --git a/src/lib/evas/canvas/efl_canvas_scene.eo b/src/lib/evas/canvas/efl_canvas_scene.eo
new file mode 100644
index 0000000..b31f0ba
--- /dev/null
+++ b/src/lib/evas/canvas/efl_canvas_scene.eo
@@ -0,0 +1,244 @@
1import efl_input_device;
2import efl_gfx_types;
3
4interface Efl.Canvas.Scene
5{
6 [[Interface containing basic canvas-related methods and events.
7
8 @since 1.22
9 ]]
10 methods {
11 @property image_max_size {
12 [[The maximum image size the canvas can possibly handle.
13
14 This function returns the largest image or surface size that
15 the canvas can handle in pixels, and if there is one, returns $true.
16 It returns $false if no extra constraint on maximum image
17 size exists.
18
19 The default limit is 65535x65535.
20
21 ]]
22 get {
23 return: bool; [[$true on success, $false otherwise]]
24 }
25 values {
26 max: Eina.Size2D; [[The maximum image size (in pixels).]]
27 }
28 }
29 group_objects_calculate {
30 [[Call user-provided $calculate group functions and unset the
31 flag signalling that the object needs to get recalculated to
32 all group objects in the canvas.
33 ]]
34 }
35 @property group_objects_calculating {
36 [[Get if the canvas is currently calculating group objects.]]
37 get {
38 }
39 values {
40 calculating: bool; [[$true if currently calculating group objects.]]
41 }
42 }
43 objects_at_xy_get {
44 [[Retrieve a list of objects at a given position in a canvas.
45
46 This function will traverse all the layers of the given canvas,
47 from top to bottom, querying for objects with areas covering the
48 given position. The user can exclude from the query objects which are
49 hidden and/or which are set to pass events.
50
51 Warning: This function will only evaluate top-level objects; child
52 or "sub" objects will be skipped.
53 ]]
54 return: iterator<Efl.Gfx.Entity> @move @no_unused; [[
55 The list of objects that are over the given position in $e.
56 ]]
57 params {
58 @in pos: Eina.Position2D; [[The pixel position.]]
59 @in include_pass_events_objects: bool; [[
60 Boolean flag to include or not objects which pass events
61 in this calculation.
62 ]]
63 @in include_hidden_objects: bool; [[
64 Boolean flag to include or not hidden objects in this
65 calculation.
66 ]]
67 }
68 }
69 object_top_at_xy_get @const {
70 [[Retrieve the object stacked at the top of a given position
71 in a canvas.
72
73 This function will traverse all the layers of the given canvas,
74 from top to bottom, querying for objects with areas covering the
75 given position. The user can exclude from the query objects which are
76 hidden and/or which are set to pass events.
77
78 Warning: This function will only evaluate top-level objects; child
79 or "sub" objects will be skipped.
80 ]]
81 return: Efl.Gfx.Entity @no_unused; [[The canvas object that is over all other objects at the given position.]]
82 params {
83 @in pos: Eina.Position2D; [[The pixel position.]]
84 @in include_pass_events_objects: bool; [[
85 Boolean flag to include or not objects which pass events
86 in this calculation.
87 ]]
88 @in include_hidden_objects: bool; [[
89 Boolean flag to include or not hidden objects in this
90 calculation.
91 ]]
92 }
93 }
94 objects_in_rectangle_get {
95 [[Retrieve a list of objects overlapping a given rectangular region in a canvas.
96
97 This function will traverse all the layers of the given canvas,
98 from top to bottom, querying for objects with areas overlapping
99 with the given rectangular region. The user can exclude
100 from the query objects which are hidden and/or which are set to
101 pass events.
102
103 Warning: This function will only evaluate top-level objects; child
104 or "sub" objects will be skipped.
105 ]]
106 return: iterator<Efl.Gfx.Entity> @move @no_unused; [[Iterator to objects]]
107 params {
108 @in rect: Eina.Rect; [[The rectangular region.]]
109 @in include_pass_events_objects: bool; [[
110 Boolean flag to include or not objects which pass events
111 in this calculation.
112 ]]
113 @in include_hidden_objects: bool; [[
114 Boolean flag to include or not hidden objects in this
115 calculation.
116 ]]
117 }
118 }
119 object_top_in_rectangle_get @const {
120 [[Retrieve the canvas object stacked at the top of a given
121 rectangular region in a canvas
122
123 This function will traverse all the layers of the given canvas,
124 from top to bottom, querying for objects with areas overlapping
125 with the given rectangular region. The user can exclude
126 from the query objects which are hidden and/or which are set to
127 pass events.
128
129 Warning: This function will only evaluate top-level objects; child
130 or "sub" objects will be skipped.
131 ]]
132 return: Efl.Gfx.Entity @no_unused; [[
133 The object that is over all other objects at the given
134 rectangular region.
135 ]]
136 params {
137 @in rect: Eina.Rect; [[The rectangular region.]]
138 @in include_pass_events_objects: bool; [[
139 Boolean flag to include or not objects which pass events
140 in this calculation.
141 ]]
142 @in include_hidden_objects: bool; [[
143 Boolean flag to include or not hidden objects in this
144 calculation.
145 ]]
146 }
147 }
148 /* FIXME Efl.Input.Device is not stable yet*/
149 seats @beta {
150 [[Iterate over the available input device seats for the canvas.
151
152 A "seat" is the term used for a group of input devices, typically including
153 a pointer and a keyboard. A seat object is the parent of the individual input
154 devices.
155 ]]
156 return: iterator<Efl.Input.Device> @move;
157 [[An iterator over the attached seats.]]
158 }
159 /* FIXME Efl.Input.Device is not stable yet*/
160 @property device @beta{
161 [[An input device attached to this canvas, found by name.
162
163 Note: This function is meant to find seats and not individual
164 input devices.
165
166 See also @.seat to find a seat by id instead of by name.
167 ]]
168 get {
169 [[Get a device by name.]]
170 }
171 keys {
172 name: string; [[The name of the seat to find.]]
173 }
174 values {
175 seat: Efl.Input.Device; [[The device or seat, $null if not found.]]
176 }
177 }
178 /* FIXME Efl.Input.Device is not stable yet*/
179 @property seat @beta {
180 [[Get a seat attached to this canvas using the seat's id property.
181
182 Seats are associated with an arbitrary integer id. The id is not a
183 persistent value and should never be hardcoded, as it may change between
184 runs of an application depending on the environment.
185
186 See also @.device to find a seat by name instead of by id.
187 ]]
188 get {
189 [[Get a seat by id.]]
190 }
191 keys {
192 id: int; [[The id of the seat to find.]]
193 }
194 values {
195 seat: Efl.Input.Device; [[The seat or $null if not found.]]
196 }
197 }
198 /* FIXME Efl.Input.Device is not stable yet*/
199 @property seat_default @beta {
200 [[Get the default seat attached to this canvas.
201
202 A canvas may have exactly one default seat.
203
204 See also @.device to find a seat by name.
205 See also @.seat to find a seat by id.
206 ]]
207 get {
208 [[Get the default seat.]]
209 }
210 values {
211 seat: Efl.Input.Device; [[The default seat or $null if one does not exist.]]
212 }
213 }
214 /* FIXME Efl.Input.Device is not stable yet*/
215 @property pointer_position @beta {
216 [[The current known pointer coordinates.
217
218 This function returns the current position of the main input
219 pointer (mouse, pen, etc...).
220 ]]
221 get {
222 return: bool; [[$true if a pointer exists for the given seat, otherwise $false.]]
223 }
224 keys {
225 seat: Efl.Input.Device; [[The seat, or $null to use the default.]]
226 }
227 values {
228 pos: Eina.Position2D; [[The pointer position in pixels.]]
229 }
230 }
231 }
232 events {
233 scene,focus,in: void; [[Called when scene got focus]]
234 scene,focus,out: void; [[Called when scene lost focus]]
235 object,focus,in: Efl.Input.Focus; [[Called when object got focus]]
236 object,focus,out: Efl.Input.Focus; [[Called when object lost focus]]
237 render,pre: void; [[Called when pre render happens]]
238 /* tag nullable once supported by eolian */
239 render,post @beta: Efl.Gfx.Event.Render_Post; [[Called when post render happens]]
240 device,changed @beta : Efl.Input.Device; [[Called when input device changed]]
241 device,added @beta: Efl.Input.Device; [[Called when input device was added]]
242 device,removed @beta : Efl.Input.Device; [[Called when input device was removed]]
243 }
244}
diff --git a/src/lib/evas/canvas/efl_canvas_text.eo b/src/lib/evas/canvas/efl_canvas_text.eo
deleted file mode 100644
index 511dec2..0000000
--- a/src/lib/evas/canvas/efl_canvas_text.eo
+++ /dev/null
@@ -1,324 +0,0 @@
1import efl_text_types;
2
3class @beta Efl.Canvas.Text extends Efl.Canvas.Object implements Efl.Text,
4 Efl.Canvas.Filter.Internal, Efl.Text_Font,
5 Efl.Text_Style, Efl.Text_Format, Efl.Text_Cursor,
6 Efl.Text_Annotate, Efl.Text_Markup, Efl.Text_Markup_Interactive, Efl.Ui.I18n
7{
8 [[Efl canvas text class]]
9 methods {
10 @property is_empty {
11 [[Whether the object is empty (no text) or not
12 ]]
13 get {
14 }
15 values {
16 is_empty: bool; [[$true if empty, $false otherwise]]
17 }
18 }
19 visible_range_get {
20 [[Returns the currently visible range.
21
22 The given $start and $end cursor act like out-variables here,
23 as they are set to the positions of the start and the end of the
24 visible range in the text, respectively.
25 ]]
26 return: bool; [[$true on success, $false otherwise]]
27 params {
28 @in start: ptr(Efl.Text_Cursor_Cursor); [[Range start position]]
29 @in end: ptr(Efl.Text_Cursor_Cursor); [[Range end position]]
30 }
31 }
32 @property style_insets {
33 [[Gets the left, right, top and bottom insets of the text.
34
35 The inset is any applied padding on the text.
36 ]]
37 get {}
38 values {
39 l: int; [[Left padding]]
40 r: int; [[Right padding]]
41 t: int; [[Top padding]]
42 b: int; [[Bottom padding]]
43 }
44 }
45 @property bidi_delimiters {
46 [[BiDi delimiters are used for in-paragraph separation of bidi
47 segments. This is useful, for example, in the recipient fields of
48 e-mail clients where bidi oddities can occur when mixing RTL
49 and LTR.
50 ]]
51 set {}
52 get {}
53 values {
54 delim: string; [[A null terminated string of delimiters, e.g ",|" or $null if empty]]
55 }
56 }
57 @property legacy_newline {
58 [[When $true, newline character will behave as a paragraph separator.
59 ]]
60 set {}
61 get {}
62 values {
63 mode: bool; [[$true for legacy mode, $false otherwise]]
64 }
65 }
66 @property style {
67 [[The text style of the object.
68
69 $key is how you reference the style (for deletion or fetching). $NULL
70 as key indicates the style has the highest priority (default style).
71 The style priority is the order of creation, styles created first
72 are applied first with the exception of $NULL which is implicitly
73 first.
74
75 Set $style to $NULL to delete it.
76 ]]
77 set {
78 }
79 get {
80 }
81 keys {
82 key: string; [[The name to the style. $NULL is the default style]]
83 }
84 values {
85 style: string; [[The style]]
86 }
87 }
88 @property size_formatted {
89 [[The formatted width and height.
90
91 This calculates the actual size after restricting the
92 textblock to the current size of the object.
93
94 The main difference between this and @.size_native.get
95 is that the "native" function does not wrapping into account
96 it just calculates the real width of the object if it was
97 placed on an infinite canvas, while this function gives the
98 size after wrapping according to the size restrictions of the
99 object.
100
101 For example for a textblock containing the text:
102 "You shall not pass!" with no margins or padding and assuming
103 a monospace font and a size of 7x10 char widths (for simplicity)
104 has a native size of 19x1 and a formatted size of 5x4.
105 ]]
106 get {}
107 values {
108 w: int; [[The width of the object.]]
109 h: int; [[The height of the object.]]
110 }
111 }
112 @property size_native {
113 [[The native width and height.
114
115 This calculates the actual size without taking account the
116 current size of the object.
117
118 The main difference between this and @.size_formatted.get
119 is that the "native" function does not take wrapping into
120 account it just calculates the real width of the object if
121 it was placed on an infinite canvas, while the "formatted"
122 function gives the size after wrapping text according to
123 the size restrictions of the object.
124
125 For example for a textblock containing the text:
126 "You shall not pass!" with no margins or padding and assuming
127 a monospace font and a size of 7x10 char widths (for simplicity)
128 has a native size of 19x1 and a formatted size of 5x4.
129 ]]
130 get {}
131 values {
132 w: int; [[The width returned.]]
133 h: int; [[The height returned.]]
134 }
135 }
136 range_text_get @const {
137 [[Returns the text in the range between $cur1 and $cur2.
138 ]]
139 return: mstring @move; [[The text in the given range]]
140 params {
141 @in cur1: ptr(const(Efl.Text_Cursor_Cursor)); [[Start of range]]
142 @in cur2: ptr(const(Efl.Text_Cursor_Cursor)); [[End of range]]
143 }
144 }
145 range_geometry_get {
146 [[Get the geometry of a range in the text.
147
148 The geometry is represented as rectangles for each of the line
149 segments in the given range [$cur1, $cur2].
150 ]]
151 params {
152 @in cur1: ptr(const(Efl.Text_Cursor_Cursor)); [[Start of range]]
153 @in cur2: ptr(const(Efl.Text_Cursor_Cursor)); [[End of range]]
154 }
155 return: iterator<ptr(Eina.Rect)> @move; [[
156 Iterator on all geoemtries of the given range
157 ]]
158 }
159 range_simple_geometry_get {
160 [[Get the "simple" geometry of a range.
161
162 The geometry is the geometry in which rectangles in middle lines of
163 range are merged into one big rectangle. This is an optimized
164 version of @.range_geometry_get.
165 ]]
166 params {
167 @in cur1: ptr(const(Efl.Text_Cursor_Cursor)); [[Start of range]]
168 @in cur2: ptr(const(Efl.Text_Cursor_Cursor)); [[End of range]]
169 }
170 return: iterator<ptr(Eina.Rect)> @move; [[
171 Iterator on all simple geometries of the given range
172 ]]
173 }
174 range_delete {
175 [[Deletes the range between given cursors.
176
177 This removes all the text in given range [$start,$end].
178 ]]
179 params {
180 @in cur1: ptr(Efl.Text_Cursor_Cursor); [[Range start position]]
181 @in cur2: ptr(Efl.Text_Cursor_Cursor); [[Range end position]]
182 }
183 }
184 // Obstacles
185 obstacle_add {
186 [[Add obstacle evas object $eo_obs to be observed during layout
187 of text.
188
189 The textblock does the layout of the text according to the
190 position of the obstacle.
191 ]]
192 params {
193 @in eo_obs: Efl.Canvas.Object; [[Obstacle object]]
194 }
195 return: bool; [[$true on success, $false otherwise.]]
196 }
197 obstacle_del {
198 [[Removes $eo_obs from observation during text layout.
199 ]]
200 params {
201 @in eo_obs: Efl.Canvas.Object; [[Obstacle object]]
202 }
203 return: bool; [[$true on success, $false otherwise.]]
204 }
205 obstacles_update {
206 [[Triggers for relayout due to obstacles' state change.
207
208 The obstacles alone don't affect the layout, until this is
209 called. Use this after doing changes (moving, positioning etc.)
210 in the obstacles that you would like to be considered in the
211 layout.
212
213 For example: if you have just repositioned the obstacles to
214 differrent coordinates relative to the textblock, you need to
215 call this so it will consider this new state and will relayout
216 the text.
217 ]]
218 }
219 async_layout {
220 [[Requests to layout the text off the mainloop.
221
222 Once layout is complete, the result is returned as @Eina.Rect,
223 with w, h fields set.
224 ]]
225 return: future<Eina.Rect> @move; [[Future for layout result]]
226 }
227 }
228 implements {
229 Efl.Object.constructor;
230 Efl.Object.destructor;
231 Efl.Canvas.Object.paragraph_direction { get; set; }
232 Efl.Text.text { get; set; }
233 Efl.Gfx.Filter.filter_program { get; set; }
234 Efl.Gfx.Filter.filter_data { get; set; }
235 Efl.Gfx.Filter.filter_source { get; set; }
236 Efl.Canvas.Filter.Internal.filter_dirty;
237 Efl.Canvas.Filter.Internal.filter_input_render;
238 Efl.Canvas.Filter.Internal.filter_state_prepare;
239 Efl.Text_Font.font { get; set; }
240 Efl.Text_Font.font_source { get; set; }
241 Efl.Text_Font.font_fallbacks { get; set; }
242 Efl.Text_Font.font_lang { get; set; }
243 Efl.Text_Font.font_weight { get; set; }
244 Efl.Text_Font.font_slant { get; set; }
245 Efl.Text_Font.font_width { get; set; }
246 Efl.Text_Font.font_bitmap_scalable { get; set; }
247 Efl.Text_Style.normal_color { get; set; }
248 Efl.Text_Style.backing_type { get; set; }
249 Efl.Text_Style.backing_color { get; set; }
250 Efl.Text_Style.underline_type { get; set; }
251 Efl.Text_Style.underline_color { get; set; }
252 Efl.Text_Style.underline_height { get; set; }
253 Efl.Text_Style.underline_dashed_color { get; set; }
254 Efl.Text_Style.underline_dashed_width { get; set; }
255 Efl.Text_Style.underline_dashed_gap { get; set; }
256 Efl.Text_Style.underline2_color { get; set; }
257 Efl.Text_Style.strikethrough_type { get; set; }
258 Efl.Text_Style.strikethrough_color { get; set; }
259 Efl.Text_Style.effect_type { get; set; }
260 Efl.Text_Style.outline_color { get; set; }
261 Efl.Text_Style.shadow_direction { get; set; }
262 Efl.Text_Style.shadow_color { get; set; }
263 Efl.Text_Style.glow_color { get; set; }
264 Efl.Text_Style.glow2_color { get; set; }
265 Efl.Text_Style.gfx_filter { get; set; }
266 Efl.Text_Format.ellipsis { get; set; }
267 Efl.Text_Format.wrap { get; set; }
268 Efl.Text_Format.multiline { get; set; }
269 Efl.Text_Format.halign { get; set; }
270 Efl.Text_Format.halign_auto_type { get; set; }
271 Efl.Text_Format.valign { get; set; }
272 Efl.Text_Format.linegap { get; set; }
273 Efl.Text_Format.linerelgap { get; set; }
274 Efl.Text_Format.tabstops { get; set; }
275 Efl.Text_Format.password { get; set; }
276 Efl.Text_Format.replacement_char { get; set; }
277 Efl.Text_Cursor.text_cursor { get; }
278 Efl.Text_Cursor.cursor_position { set; get; }
279 Efl.Text_Cursor.cursor_content { get; }
280 Efl.Text_Cursor.cursor_geometry { get; }
281 Efl.Text_Cursor.cursor_new;
282 Efl.Text_Cursor.cursor_free;
283 Efl.Text_Cursor.cursor_equal;
284 Efl.Text_Cursor.cursor_compare;
285 Efl.Text_Cursor.cursor_copy;
286 Efl.Text_Cursor.cursor_char_next;
287 Efl.Text_Cursor.cursor_char_prev;
288 Efl.Text_Cursor.cursor_cluster_next;
289 Efl.Text_Cursor.cursor_cluster_prev;
290 Efl.Text_Cursor.cursor_paragraph_char_first;
291 Efl.Text_Cursor.cursor_paragraph_char_last;
292 Efl.Text_Cursor.cursor_word_start;
293 Efl.Text_Cursor.cursor_word_end;
294 Efl.Text_Cursor.cursor_line_char_first;
295 Efl.Text_Cursor.cursor_line_char_last;
296 Efl.Text_Cursor.cursor_paragraph_first;
297 Efl.Text_Cursor.cursor_paragraph_last;
298 Efl.Text_Cursor.cursor_paragraph_next;
299 Efl.Text_Cursor.cursor_paragraph_prev;
300 Efl.Text_Cursor.cursor_line_jump_by;
301 Efl.Text_Cursor.cursor_coord_set;
302 Efl.Text_Cursor.cursor_cluster_coord_set;
303 Efl.Text_Cursor.cursor_text_insert;
304 Efl.Text_Cursor.cursor_char_delete;
305 Efl.Text_Annotate.annotation { set; get; }
306 Efl.Text_Annotate.range_annotations_get;
307 Efl.Text_Annotate.annotation_insert;
308 Efl.Text_Annotate.annotation_del;
309 Efl.Text_Annotate.annotation_is_item;
310 Efl.Text_Annotate.item_geometry_get;
311 Efl.Text_Annotate.annotation_positions_get;
312 Efl.Text_Annotate.cursor_item_annotation { get; }
313 Efl.Text_Annotate.cursor_item_insert;
314 Efl.Text_Markup.markup { set; get; }
315 Efl.Text_Markup_Interactive.cursor_markup_insert;
316 Efl.Text_Markup_Interactive.markup_range { get;}
317 Efl.Gfx.Entity.scale { set; }
318 }
319 events {
320 cursor,changed: void; [[Called when cursor changed]]
321 changed: void; [[Called when canvas text changed ]]
322 style_insets,changed: void; [[Called when the property @.style_insets changed.]]
323 }
324}
diff --git a/src/lib/evas/canvas/efl_canvas_text_eo.legacy.c b/src/lib/evas/canvas/efl_canvas_text_eo.legacy.c
deleted file mode 100644
index 326707b..0000000
--- a/src/lib/evas/canvas/efl_canvas_text_eo.legacy.c
+++ /dev/null
@@ -1,66 +0,0 @@
1
2EAPI Eina_Bool
3evas_object_textblock_visible_range_get(Efl_Canvas_Text *obj, Efl_Text_Cursor_Cursor *start, Efl_Text_Cursor_Cursor *end)
4{
5 return efl_canvas_text_visible_range_get(obj, start, end);
6}
7
8EAPI void
9evas_object_textblock_style_insets_get(const Efl_Canvas_Text *obj, int *l, int *r, int *t, int *b)
10{
11 efl_canvas_text_style_insets_get(obj, l, r, t, b);
12}
13
14EAPI void
15evas_object_textblock_bidi_delimiters_set(Efl_Canvas_Text *obj, const char *delim)
16{
17 efl_canvas_text_bidi_delimiters_set(obj, delim);
18}
19
20EAPI const char *
21evas_object_textblock_bidi_delimiters_get(const Efl_Canvas_Text *obj)
22{
23 return efl_canvas_text_bidi_delimiters_get(obj);
24}
25
26EAPI void
27evas_object_textblock_legacy_newline_set(Efl_Canvas_Text *obj, Eina_Bool mode)
28{
29 efl_canvas_text_legacy_newline_set(obj, mode);
30}
31
32EAPI Eina_Bool
33evas_object_textblock_legacy_newline_get(const Efl_Canvas_Text *obj)
34{
35 return efl_canvas_text_legacy_newline_get(obj);
36}
37
38EAPI void
39evas_object_textblock_size_formatted_get(const Efl_Canvas_Text *obj, int *w, int *h)
40{
41 efl_canvas_text_size_formatted_get(obj, w, h);
42}
43
44EAPI void
45evas_object_textblock_size_native_get(const Efl_Canvas_Text *obj, int *w, int *h)
46{
47 efl_canvas_text_size_native_get(obj, w, h);
48}
49
50EAPI Eina_Bool
51evas_object_textblock_obstacle_add(Efl_Canvas_Text *obj, Efl_Canvas_Object *eo_obs)
52{
53 return efl_canvas_text_obstacle_add(obj, eo_obs);
54}
55
56EAPI Eina_Bool
57evas_object_textblock_obstacle_del(Efl_Canvas_Text *obj, Efl_Canvas_Object *eo_obs)
58{
59 return efl_canvas_text_obstacle_del(obj, eo_obs);
60}
61
62EAPI void
63evas_object_textblock_obstacles_update(Efl_Canvas_Text *obj)
64{
65 efl_canvas_text_obstacles_update(obj);
66}
diff --git a/src/lib/evas/canvas/efl_canvas_textblock.eo b/src/lib/evas/canvas/efl_canvas_textblock.eo
new file mode 100644
index 0000000..5d38ecf
--- /dev/null
+++ b/src/lib/evas/canvas/efl_canvas_textblock.eo
@@ -0,0 +1,565 @@
1import efl_text_types;
2
3class @beta Efl.Canvas.Textblock extends Efl.Canvas.Object implements Efl.Text,
4 Efl.Canvas.Filter.Internal, Efl.Text_Font,
5 Efl.Text_Style, Efl.Text_Format,
6 Efl.Text_Markup, Efl.Ui.I18n
7{
8 [[This is the Canvas-level text class. This class only takes care of rendering text,
9 if you need user interaction consider the classes in $Efl.Ui.]]
10 methods {
11 @property is_empty {
12 [[Whether the object is empty (no text) or not.
13 ]]
14 get {
15 }
16 values {
17 is_empty: bool; [[$true if empty.]]
18 }
19 }
20 cursor_add {
21 [[Adds an existing cursor to the text object.
22 If the cursor already belonged to another text object it will be reassigned to the new one.
23 It is typically more convenient to obtain a cursor directly from the text object using @.cursor_create.
24 ]]
25 params {
26 cursor: Efl.Text.Cursor; [[The text cursor to use.]]
27 }
28 }
29 cursor_create {
30 [[Creates a new cursor and adds it to the text object.
31 This cursor can be used to manipulate and iterate the content of the text object.
32 ]]
33 return: Efl.Text.Cursor @move; [[The created text cursor.]]
34 }
35 visible_range_get {
36 [[Returns the currently visible range.
37
38 The given $start and $end cursors are output variables:
39 they are set to the positions of the start and the end of the
40 visible range in the text, respectively.
41 ]]
42 return: bool; [[$true on success.]]
43 params {
44 @in start: Efl.Text.Cursor; [[Range start position.]]
45 @in end: Efl.Text.Cursor; [[Range end position.]]
46 }
47 }
48 @property style_insets {
49 [[Gets the left, right, top and bottom insets of the text.
50
51 The inset is any applied padding on the text.
52 ]]
53 get {}
54 values {
55 l: int; [[Left padding.]]
56 r: int; [[Right padding.]]
57 t: int; [[Top padding.]]
58 b: int; [[Bottom padding.]]
59 }
60 }
61 @property bidi_delimiters {
62 [[BiDi delimiters are used for in-paragraph separation of bidirectional
63 segments. This is useful, for example, in the recipient fields of
64 e-mail clients where bidi oddities can occur when mixing RTL (right-to-left)
65 and LTR (left-to-right) text.
66 ]]
67 set {}
68 get {}
69 values {
70 delim: string; [[A null terminated string of delimiters, e.g ",|" or $null if empty.]]
71 }
72 }
73 @property newline_as_paragraph_separator {
74 [[When $true, the newline character will behave as a paragraph separator.
75 ]]
76 set {}
77 get {}
78 values {
79 mode: bool; [[$true for legacy mode, $false otherwise.]]
80 }
81 }
82 style_apply {
83 [[Applies a style to the text object. Applied style attributes override old ones, leaving other attributes
84 unaffected.
85 This is similar to setting individual style attributes using properties like @Efl.Text_Font.font_slant or
86 @Efl.Text_Format.wrap.
87
88 The style can be set as "attribute"="Value".
89 Multible attribute can be set at once separated by space.
90
91 The following styling attributes are accepted:
92
93 - Font
94 - Font fallback
95 - Font size
96 - Font source
97 - Font weight
98 - Font style
99 - Font width
100 - Language
101 - Color
102 - Underline Color
103 - Second Underline Color
104 - Underline Dash Color
105 - Outline Color
106 - Shadow Color
107 - First Glow Color
108 - Second Glow Color
109 - Backing Color
110 - Strikethrough Color
111 - Horizontal Align
112 - Vertical Align
113 - Wrap
114 - Left margin
115 - Right margin
116 - Underline
117 - Strikethrough
118 - Backing
119 - Style
120 - Tabstops
121 - Line size
122 - Relative line size
123 - Line gap
124 - Relative line gap
125 - Item
126 - Line fill
127 - Ellipsis
128 - Password
129 - Underline dash width
130 - Underline dash gap
131 - Underline height
132
133 Font
134 This sets the name of the font to be used.
135 font=<font name>
136
137 Font fallback
138 A comma delimited list of fonts to try if finding the primary font fails.
139 font_fallbacks=<font names>
140
141 Font size
142 This sets the the size of font in points to be used.
143 font_size=<size>
144
145 Font source
146 Specify source from which to search for the font.
147 font_source=<source>
148
149 Font weight
150 Sets the weight of the font. The value must be one of:
151 "normal"
152 "thin"
153 "ultralight"
154 "extralight"
155 "light"
156 "book"
157 "medium"
158 "semibold"
159 "bold"
160 "ultrabold"
161 "extrabold"
162 "black"
163 "extrablack"
164 font_weight=<weight>
165
166 Font style
167 Sets the style of the font. The value must be one of:
168 "normal"
169 "oblique"
170 "italic"
171 font_style=<style>
172
173 Font width
174 Sets the width of the font. The value must be one of:
175 "normal"
176 "ultracondensed"
177 "extracondensed"
178 "condensed"
179 "semicondensed"
180 "semiexpanded"
181 "expanded"
182 "extraexpanded"
183 "ultraexpanded"
184 font_width=<width>
185
186 Language
187 Overrides the language defined in font. For example, lang=he.
188 The value can either be a language text or one of presets:
189 "auto" - Respects system locale settings as language
190 "none" - Disable language support
191 lang=<language>
192
193 Color Commands <color>:
194 The following formats are accepted:
195 "#RRGGBB"
196 "#RRGGBBAA"
197 "#RGB"
198 "#RGBA"
199 "rgb(r,g,b)"
200 "rgba(r,g,b,a)"
201 "color_name" like "red" (X11 color names)
202
203 Color
204 Sets the color of the text.
205 color=<color>
206
207 Underline Color
208 Sets the color of the underline.
209 underline_color=<color>
210
211 Second Underline Color
212 Sets the color of the second line of underline(when using underline mode "double").
213 underline2_color=<color>
214
215 Underline Dash Color
216 Sets the color of dashed underline.
217 underline_dash_color=<color>
218
219 Outline Color
220 Sets the color of the outline of the text.
221 outline_color=<color>
222
223 Shadow Color
224 Sets the color of the shadow of the text.
225 shadow_color=<color>
226
227 First Glow Color
228 Sets the first color of the glow of text.
229 glow_color=<color>
230
231 Second Glow Color
232 Sets the second color of the glow of text.
233 glow2_color=<color>
234
235 Backing Color
236 Sets a background color for text.
237 backing_color=<color>
238
239 Strikethrough Color
240 Sets the color of text that is striked through.
241 strikethrough_color=<color>
242
243 Horizontal Align
244 Sets the horizontal alignment of the text. The value can either be a number, a percentage or one of several presets:
245 "auto" - Respects LTR/RTL settings
246 "locale" - Respects locale(language) direction settings
247 "center" - Centers the text in the line
248 "middle" - Alias for "center"
249 "left" - Puts the text at the left of the line
250 "right" - Puts the text at the right of the line
251 "start" - Respects LTR/RTL settings. It is same with "auto"
252 "end" - Puts the text at the opposite side of LTR/RTL settings
253 <number> - A number between 0.0 and 1.0 where 0.0 represents "left" and 1.0 represents "right"
254 <number>% - A percentage between 0% and 100% where 0% represents "left" and 100% represents "right"
255 align=<value or preset>
256
257 Vertical Align
258 Sets the vertical alignment of the text.
259 The value can either be a number or one of the following presets:
260 "top" - Puts text at the top of the line
261 "center" - Centers the text in the line
262 "middle" - Alias for "center"
263 "bottom" - Puts the text at the bottom of the line
264 "baseline" - Baseline
265 "base" - Alias for "baseline"
266 <number> - A number between 0.0 and 1.0 where 0.0 represents "top" and 1.0 represents "bottom"
267 <number>% - A percentage between 0% and 100% where 0% represents "top" and 100% represents "bottom"
268 valign=<value or preset>
269 See explanation of baseline at: https://en.wikipedia.org/wiki/Baseline_%28typography%29
270
271 Wrap
272 Sets the wrap policy of the text. The value must be one of the following:
273 "word" - Only wraps lines at word boundaries
274 "char" - Wraps at any character
275 "mixed" - Wrap at words if possible, if not at any character
276 "hyphenation" - Hyphenate if possible, if not wrap at words if possible, if not at any character
277 "" - Don't wrap
278 wrap=<value or preset>
279
280 Left margin
281 Sets the left margin of the text (in pixel). The value can be a number, an increment, decrement or "reset":
282 +<number> - Increments existing left margin by <number>
283 -<number> - Decrements existing left margin by <number>
284 <number> - Sets left margin to <number>
285 "reset" - Sets left margin to 0
286 left_margin=<value or reset>
287
288 Right margin
289 Sets the right margin of the text (in pixel). The value can be a number, an increment, decrement or "reset":
290 +<number> - Increments existing right margin by <number>
291 -<number> - Decrements existing right margin by <number>
292 <number> - Sets left margin to <number>
293 "reset" - Sets left margin to 0
294 right_margin=<value or reset>
295
296 Underline
297 Sets if and how a text will be underlined. The value must be one of the following:
298 "off" - No underlining
299 "single" - A single line under the text
300 "on" - Alias for "single"
301 "double" - Two lines under the text
302 "dashed" - A dashed line under the text
303 underline=off/single/on/double/dashed
304
305 Strikethrough
306 Sets if the text will be striked through. The value must be one of the following:
307 "off" - No strikethrough
308 "on" - Strikethrough
309 strikethrough=on/off
310