summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaehyun Cho <jae_hyun.cho@samsung.com>2017-08-25 11:34:28 +0900
committerJaehyun Cho <jae_hyun.cho@samsung.com>2017-10-12 21:03:49 +0900
commitc3865609c9a89a705976a79a8a8e189a00027d18 (patch)
treee65388f98e261e772edfdd8784d82021364cc11c
parent29917e4e91c61cff88753bddbeb571e58faea9a6 (diff)
efl_animation: Add scale animation
-rw-r--r--src/Makefile_Evas.am3
-rw-r--r--src/bin/elementary/test_event_animation.c396
-rw-r--r--src/lib/evas/Evas_Common.h7
-rw-r--r--src/lib/evas/Evas_Eo.h1
-rw-r--r--src/lib/evas/canvas/efl_animation_scale.c224
-rw-r--r--src/lib/evas/canvas/efl_animation_scale.eo41
-rw-r--r--src/lib/evas/canvas/efl_animation_scale_private.h48
7 files changed, 720 insertions, 0 deletions
diff --git a/src/Makefile_Evas.am b/src/Makefile_Evas.am
index 3fcb08b5fa..3fb44c2ce0 100644
--- a/src/Makefile_Evas.am
+++ b/src/Makefile_Evas.am
@@ -47,6 +47,7 @@ evas_eolian_pub_files = \
47 lib/evas/canvas/efl_animation.eo \ 47 lib/evas/canvas/efl_animation.eo \
48 lib/evas/canvas/efl_animation_alpha.eo \ 48 lib/evas/canvas/efl_animation_alpha.eo \
49 lib/evas/canvas/efl_animation_rotate.eo \ 49 lib/evas/canvas/efl_animation_rotate.eo \
50 lib/evas/canvas/efl_animation_scale.eo \
50 lib/evas/canvas/efl_animation_object.eo \ 51 lib/evas/canvas/efl_animation_object.eo \
51 lib/evas/canvas/efl_animation_object_alpha.eo \ 52 lib/evas/canvas/efl_animation_object_alpha.eo \
52 lib/evas/canvas/efl_animation_object_rotate.eo \ 53 lib/evas/canvas/efl_animation_object_rotate.eo \
@@ -131,6 +132,7 @@ lib/evas/common3d/primitives/primitive_common.h \
131lib/evas/canvas/efl_animation_private.h \ 132lib/evas/canvas/efl_animation_private.h \
132lib/evas/canvas/efl_animation_alpha_private.h \ 133lib/evas/canvas/efl_animation_alpha_private.h \
133lib/evas/canvas/efl_animation_rotate_private.h \ 134lib/evas/canvas/efl_animation_rotate_private.h \
135lib/evas/canvas/efl_animation_scale_private.h \
134lib/evas/canvas/efl_animation_object_private.h \ 136lib/evas/canvas/efl_animation_object_private.h \
135lib/evas/canvas/efl_animation_object_alpha_private.h \ 137lib/evas/canvas/efl_animation_object_alpha_private.h \
136lib/evas/canvas/efl_animation_object_rotate_private.h 138lib/evas/canvas/efl_animation_object_rotate_private.h
@@ -222,6 +224,7 @@ lib/evas/canvas/efl_input_focus.c \
222lib/evas/canvas/efl_animation.c \ 224lib/evas/canvas/efl_animation.c \
223lib/evas/canvas/efl_animation_alpha.c \ 225lib/evas/canvas/efl_animation_alpha.c \
224lib/evas/canvas/efl_animation_rotate.c \ 226lib/evas/canvas/efl_animation_rotate.c \
227lib/evas/canvas/efl_animation_scale.c \
225lib/evas/canvas/efl_animation_object.c \ 228lib/evas/canvas/efl_animation_object.c \
226lib/evas/canvas/efl_animation_object_alpha.c \ 229lib/evas/canvas/efl_animation_object_alpha.c \
227lib/evas/canvas/efl_animation_object_rotate.c \ 230lib/evas/canvas/efl_animation_object_rotate.c \
diff --git a/src/bin/elementary/test_event_animation.c b/src/bin/elementary/test_event_animation.c
new file mode 100644
index 0000000000..81696148ba
--- /dev/null
+++ b/src/bin/elementary/test_event_animation.c
@@ -0,0 +1,396 @@
1#ifdef HAVE_CONFIG_H
2# include "elementary_config.h"
3#endif
4#include <Elementary.h>
5
6#define BUTTON_TEXT_SET(BT, TEXT) \
7 elm_object_text_set((BT), (TEXT)); \
8 elm_object_tooltip_text_set((BT), (TEXT)); \
9 elm_object_tooltip_window_mode_set((BT), EINA_TRUE)
10
11static char img1[PATH_MAX];
12static char img2[PATH_MAX];
13static char img3[PATH_MAX];
14static char img4[PATH_MAX];
15static char img5[PATH_MAX];
16static char img6[PATH_MAX];
17static char img7[PATH_MAX];
18
19Evas_Object *
20_content_new(Evas_Object *parent, const char *img)
21{
22 Evas_Object *photo = elm_photo_add(parent);
23 elm_photo_file_set(photo, img);
24 elm_photo_fill_inside_set(photo, EINA_TRUE);
25 elm_object_style_set(photo, "shadow");
26 return photo;
27}
28
29void
30_navi_pop(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
31{
32 elm_naviframe_item_pop(data);
33}
34
35void
36_navi_it_del(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
37{
38 elm_object_item_del(data);
39}
40
41void
42_title_clicked(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
43{
44 printf("Title Clicked!\n");
45}
46
47void
48_item_activated(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
49{
50 Elm_Object_Item *it = event_info;
51 printf("Item(%p) is activated! The Title is \"%s\"\n", it, elm_object_item_text_get(it));
52}
53
54void
55_title_visible(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
56{
57 elm_naviframe_item_title_enabled_set(data,
58 !elm_naviframe_item_title_enabled_get(data),
59 EINA_TRUE);
60}
61
62void
63_promote(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
64{
65 elm_naviframe_item_promote(data);
66}
67
68void
69_page8(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
70{
71 Evas_Object *bt, *bt2, *content, *nf = data;
72 Elm_Object_Item *it;
73
74 snprintf(img6, sizeof(img6), "%s/images/sky_02.jpg", elm_app_data_dir_get());
75 bt = elm_button_add(nf);
76 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
77 BUTTON_TEXT_SET(bt, "Page 7");
78
79 bt2 = elm_button_add(nf);
80 evas_object_size_hint_align_set(bt2, EVAS_HINT_FILL, EVAS_HINT_FILL);
81 BUTTON_TEXT_SET(bt2, "Page 1");
82 evas_object_smart_callback_add(bt2, "clicked", _promote,
83 evas_object_data_get(nf, "page1"));
84 content = _content_new(nf, img6);
85 it = elm_naviframe_item_push(nf, "Page 8", bt, bt2, content, NULL);
86 elm_object_item_part_text_set(it, "subtitle", "Overlap style!");
87
88 evas_object_smart_callback_add(bt, "clicked", _navi_pop, nf);
89}
90
91static void
92_page7_btn_down_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj,
93 void *event_info EINA_UNUSED)
94{
95 evas_object_color_set(obj, 100, 0, 0, 100);
96 _page8(data, NULL, NULL);
97}
98
99static void
100_page7_btn_up_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj,
101 void *event_info EINA_UNUSED)
102{
103 evas_object_color_set(obj, 255, 255, 255, 255);
104 printf("Page7 Button Mouse Up!\n");
105}
106
107Evas_Object *
108_page7_content_new(Evas_Object *nf)
109{
110 Evas_Object *bt;
111
112 bt = elm_button_add(nf);
113 elm_object_text_set(bt, "Page 8");
114 evas_object_event_callback_add(bt, EVAS_CALLBACK_MOUSE_DOWN,
115 _page7_btn_down_cb, nf);
116 evas_object_event_callback_add(bt, EVAS_CALLBACK_MOUSE_UP,
117 _page7_btn_up_cb, NULL);
118
119 return bt;
120}
121
122void
123_page7(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
124{
125 Evas_Object *bt, *bt2, *content, *nf = data;
126 Elm_Object_Item *it;
127
128 bt = elm_button_add(nf);
129 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
130 BUTTON_TEXT_SET(bt, "Page 6");
131
132 bt2 = elm_button_add(nf);
133 evas_object_size_hint_align_set(bt2, EVAS_HINT_FILL, EVAS_HINT_FILL);
134 BUTTON_TEXT_SET(bt2, "Page 8");
135 evas_object_smart_callback_add(bt2, "clicked", _page8, nf);
136 content = _page7_content_new(nf);
137 it = elm_naviframe_item_push(nf, "Page 7", bt, bt2, content, "overlap");
138 elm_object_item_part_text_set(it, "subtitle", "Overlap style!");
139
140 evas_object_smart_callback_add(bt, "clicked", _navi_pop, nf);
141}
142
143void
144_page6(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
145{
146 Evas_Object *bt, *bt2, *content, *nf = data;
147 Elm_Object_Item *it;
148
149 snprintf(img7, sizeof(img7), "%s/images/sky_03.jpg", elm_app_data_dir_get());
150 bt = elm_button_add(nf);
151 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
152 BUTTON_TEXT_SET(bt, "Page 5");
153
154 bt2 = elm_button_add(nf);
155 evas_object_size_hint_align_set(bt2, EVAS_HINT_FILL, EVAS_HINT_FILL);
156 BUTTON_TEXT_SET(bt2, "Page 7");
157 evas_object_smart_callback_add(bt2, "clicked", _page7, nf);
158
159 content = _content_new(nf, img7);
160 it = elm_naviframe_item_push(nf, "Page 6", bt, bt2, content, "overlap");
161 elm_object_item_part_text_set(it, "subtitle", "Overlap style!");
162
163 evas_object_smart_callback_add(bt, "clicked", _navi_pop, nf);
164}
165
166void
167_page5(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
168{
169 Evas_Object *bt, *bt2, *content, *nf = data;
170 Elm_Object_Item *it;
171
172 snprintf(img5, sizeof(img5), "%s/images/sky_01.jpg", elm_app_data_dir_get());
173 bt = elm_button_add(nf);
174 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
175 BUTTON_TEXT_SET(bt, "Page 4");
176
177 bt2 = elm_button_add(nf);
178 evas_object_size_hint_align_set(bt2, EVAS_HINT_FILL, EVAS_HINT_FILL);
179 BUTTON_TEXT_SET(bt2, "Page 6");
180 evas_object_smart_callback_add(bt2, "clicked", _page6, nf);
181
182 content = _content_new(nf, img5);
183 it = elm_naviframe_item_insert_after(nf,
184 elm_naviframe_top_item_get(nf),
185 "Page 5",
186 bt,
187 bt2,
188 content,
189 NULL);
190 elm_object_item_part_text_set(it, "subtitle", "This page is inserted after top item without transition");
191 evas_object_smart_callback_add(bt, "clicked", _navi_it_del, it);
192}
193
194void
195_page4(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
196{
197 Evas_Object *bt, *ic, *content, *nf = data;
198 char buf[PATH_MAX];
199 Elm_Object_Item *it;
200
201 snprintf(img4, sizeof(img4), "%s/images/rock_02.jpg", elm_app_data_dir_get());
202 ic = elm_icon_add(nf);
203 elm_icon_standard_set(ic, "go-right");
204
205 bt = elm_button_add(nf);
206 evas_object_smart_callback_add(bt, "clicked", _page5, nf);
207 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
208 elm_layout_content_set(bt, "icon", ic);
209
210 content = _content_new(nf, img4);
211
212 it = elm_naviframe_item_push(nf,
213 "Page 4",
214 NULL,
215 bt,
216 content,
217 NULL);
218 elm_object_item_part_text_set(it, "subtitle", "Title area visibility test");
219
220 ic = elm_icon_add(nf);
221 snprintf(buf, sizeof(buf), "%s/images/logo_small.png",
222 elm_app_data_dir_get());
223 elm_image_file_set(ic, buf, NULL);
224 evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
225 elm_object_item_part_content_set(it, "icon", ic);
226 elm_naviframe_item_title_enabled_set(it, EINA_FALSE, EINA_FALSE);
227 evas_object_smart_callback_add(content, "clicked", _title_visible, it);
228}
229
230void
231_page3(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
232{
233 Evas_Object *bt2, *content, *nf = data;
234
235 snprintf(img3, sizeof(img3), "%s/images/rock_01.jpg", elm_app_data_dir_get());
236 bt2 = elm_button_add(nf);
237 evas_object_size_hint_align_set(bt2, EVAS_HINT_FILL, EVAS_HINT_FILL);
238 BUTTON_TEXT_SET(bt2, "Next");
239 evas_object_smart_callback_add(bt2, "clicked", _page4, nf);
240
241 content = _content_new(nf, img3);
242
243 elm_naviframe_item_push(nf,
244 "Page 3",
245 NULL,
246 bt2,
247 content,
248 NULL);
249}
250
251void
252_page2(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
253{
254 Evas_Object *bt, *content, *ic, *nf = data;
255 Elm_Object_Item *it;
256
257 snprintf(img2, sizeof(img2), "%s/images/plant_01.jpg", elm_app_data_dir_get());
258 bt = elm_button_add(nf);
259 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
260 evas_object_smart_callback_add(bt, "clicked", _page3, nf);
261
262 ic = elm_icon_add(nf);
263 elm_icon_standard_set(ic, "arrow_right");
264 evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
265 elm_layout_content_set(bt, "icon", ic);
266
267 content = _content_new(nf, img2);
268
269 it = elm_naviframe_item_push(nf, "Page 2 - Long Title Here",
270 NULL, bt, content, NULL);
271 elm_object_item_part_text_set(it, "subtitle", "Here is sub-title part!");
272}
273
274void
275test_naviframe(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
276{
277 Evas_Object *win, *nf, *btn, *content;
278 Elm_Object_Item *it;
279
280 snprintf(img1, sizeof(img1), "%s/images/logo.png", elm_app_data_dir_get());
281 win = elm_win_util_standard_add("naviframe", "Naviframe");
282 elm_win_focus_highlight_enabled_set(win, EINA_TRUE);
283 elm_win_autodel_set(win, EINA_TRUE);
284
285 nf = elm_naviframe_add(win);
286 evas_object_size_hint_weight_set(nf, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
287 elm_win_resize_object_add(win, nf);
288 evas_object_show(nf);
289 evas_object_smart_callback_add(nf, "title,clicked", _title_clicked, 0);
290 evas_object_smart_callback_add(nf, "item,activated", _item_activated, NULL);
291
292 btn = elm_button_add(nf);
293 evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, EVAS_HINT_FILL);
294 evas_object_smart_callback_add(btn, "clicked", _page2, nf);
295 BUTTON_TEXT_SET(btn, "Next");
296 evas_object_show(btn);
297
298 content = _content_new(nf, img1);
299 it = elm_naviframe_item_push(nf, "Page 1", NULL, btn, content, NULL);
300 evas_object_data_set(nf, "page1", it);
301
302 evas_object_resize(win, 400, 400);
303 evas_object_show(win);
304}
305
306void
307test_naviframe2(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
308{
309 Evas_Object *win, *nf, *sc, *btn, *ico, *content;
310 Elm_Object_Item *it;
311
312 snprintf(img1, sizeof(img1), "%s/images/logo.png", elm_app_data_dir_get());
313 win = elm_win_util_standard_add("naviframe", "Naviframe");
314 elm_win_focus_highlight_enabled_set(win, EINA_TRUE);
315 elm_win_autodel_set(win, EINA_TRUE);
316
317 nf = elm_naviframe_add(win);
318 evas_object_size_hint_weight_set(nf, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
319 elm_win_resize_object_add(win, nf);
320 evas_object_show(nf);
321
322 sc = elm_segment_control_add(nf);
323 elm_segment_control_item_add(sc, NULL, "Show All");
324 elm_segment_control_item_add(sc, NULL, "Just Filtered");
325
326 btn = elm_button_add(nf);
327 ico = elm_icon_add(btn);
328 elm_icon_standard_set(ico, "refresh");
329 elm_layout_content_set(btn, "icon", ico);
330
331 content = _content_new(nf, img1);
332 it = elm_naviframe_item_push(nf, NULL, NULL, btn, content, NULL);
333 evas_object_data_set(nf, "page1", it);
334
335 elm_object_item_part_content_set(it, "icon", sc);
336
337 evas_object_resize(win, 400, 400);
338 evas_object_show(win);
339}
340
341static void
342_bt_pop_all(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
343{
344 Elm_Object_Item *it = evas_object_data_get(obj, "root");
345
346 while (elm_naviframe_top_item_get(data) != it)
347 elm_naviframe_item_pop(data);
348}
349
350void
351test_naviframe3(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
352{
353 Evas_Object *win, *tb, *bxh, *nf, *btn, *content;
354 Elm_Object_Item *it;
355
356 snprintf(img1, sizeof(img1), "%s/images/logo.png", elm_app_data_dir_get());
357 win = elm_win_util_standard_add("naviframe", "Naviframe");
358 elm_win_focus_highlight_enabled_set(win, EINA_TRUE);
359 elm_win_autodel_set(win, EINA_TRUE);
360
361 bxh = elm_box_add(win);
362 evas_object_size_hint_weight_set(bxh, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
363 elm_box_horizontal_set(bxh, EINA_TRUE);
364 elm_win_resize_object_add(win, bxh);
365 evas_object_show(bxh);
366
367 tb = elm_toolbar_add(win);
368 evas_object_size_hint_weight_set(tb, 0.0, EVAS_HINT_EXPAND);
369 evas_object_size_hint_align_set(tb, EVAS_HINT_FILL, EVAS_HINT_FILL);
370 elm_toolbar_horizontal_set(tb, EINA_FALSE);
371 elm_toolbar_select_mode_set(tb, ELM_OBJECT_SELECT_MODE_ALWAYS);
372 elm_box_pack_end(bxh, tb);
373 evas_object_show(tb);
374
375 nf = elm_naviframe_add(win);
376 evas_object_size_hint_weight_set(nf, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
377 evas_object_size_hint_align_set(nf, EVAS_HINT_FILL, EVAS_HINT_FILL);
378 elm_box_pack_end(bxh, nf);
379 evas_object_show(nf);
380
381 btn = elm_button_add(nf);
382 evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, EVAS_HINT_FILL);
383 evas_object_smart_callback_add(btn, "clicked", _page2, nf);
384 BUTTON_TEXT_SET(btn, "Next");
385 evas_object_show(btn);
386
387 content = _content_new(nf, img1);
388 it = elm_naviframe_item_push(nf, "Page 1", NULL, btn, content, NULL);
389 evas_object_data_set(nf, "page1", it);
390
391 evas_object_data_set(tb, "root", it);
392 elm_toolbar_item_append(tb, NULL, "Pop all", _bt_pop_all, nf);
393
394 evas_object_resize(win, 400, 400);
395 evas_object_show(win);
396}
diff --git a/src/lib/evas/Evas_Common.h b/src/lib/evas/Evas_Common.h
index fd5c5910b5..d12e028145 100644
--- a/src/lib/evas/Evas_Common.h
+++ b/src/lib/evas/Evas_Common.h
@@ -3351,6 +3351,13 @@ typedef Eo Efl_Animation_Rotate;
3351 3351
3352#endif 3352#endif
3353 3353
3354#ifndef _EFL_ANIMATION_SCALE_EO_CLASS_TYPE
3355#define _EFL_ANIMATION_SCALE_EO_CLASS_TYPE
3356
3357typedef Eo Efl_Animation_Scale;
3358
3359#endif
3360
3354#ifndef _EFL_ANIMATION_OBJECT_EO_CLASS_TYPE 3361#ifndef _EFL_ANIMATION_OBJECT_EO_CLASS_TYPE
3355#define _EFL_ANIMATION_OBJECT_EO_CLASS_TYPE 3362#define _EFL_ANIMATION_OBJECT_EO_CLASS_TYPE
3356 3363
diff --git a/src/lib/evas/Evas_Eo.h b/src/lib/evas/Evas_Eo.h
index d0d0cacc6d..4a7e5e5399 100644
--- a/src/lib/evas/Evas_Eo.h
+++ b/src/lib/evas/Evas_Eo.h
@@ -58,6 +58,7 @@
58#include "canvas/efl_animation.eo.h" 58#include "canvas/efl_animation.eo.h"
59#include "canvas/efl_animation_alpha.eo.h" 59#include "canvas/efl_animation_alpha.eo.h"
60#include "canvas/efl_animation_rotate.eo.h" 60#include "canvas/efl_animation_rotate.eo.h"
61#include "canvas/efl_animation_scale.eo.h"
61#include "canvas/efl_animation_object.eo.h" 62#include "canvas/efl_animation_object.eo.h"
62#include "canvas/efl_animation_object_alpha.eo.h" 63#include "canvas/efl_animation_object_alpha.eo.h"
63#include "canvas/efl_animation_object_rotate.eo.h" 64#include "canvas/efl_animation_object_rotate.eo.h"
diff --git a/src/lib/evas/canvas/efl_animation_scale.c b/src/lib/evas/canvas/efl_animation_scale.c
new file mode 100644
index 0000000000..2b2d41198a
--- /dev/null
+++ b/src/lib/evas/canvas/efl_animation_scale.c
@@ -0,0 +1,224 @@
1#include "efl_animation_scale_private.h"
2
3EOLIAN static void
4_efl_animation_scale_scale_set(Eo *eo_obj,
5 Efl_Animation_Scale_Data *pd,
6 double from_scale_x,
7 double from_scale_y,
8 double to_scale_x,
9 double to_scale_y,
10 Efl_Canvas_Object *pivot,
11 double cx,
12 double cy)
13{
14 EFL_ANIMATION_SCALE_CHECK_OR_RETURN(eo_obj);
15
16 pd->from.scale_x = from_scale_x;
17 pd->from.scale_y = from_scale_y;
18
19 pd->to.scale_x = to_scale_x;
20 pd->to.scale_y = to_scale_y;
21
22 pd->rel_pivot.obj = pivot;
23 pd->rel_pivot.cx = cx;
24 pd->rel_pivot.cy = cy;
25
26 //Update absolute pivot based on relative pivot
27 Evas_Coord x = 0;
28 Evas_Coord y = 0;
29 Evas_Coord w = 0;
30 Evas_Coord h = 0;
31
32 if (pivot)
33 evas_object_geometry_get(pivot, &x, &y, &w, &h);
34 else
35 {
36 Efl_Canvas_Object *target = efl_animation_target_get(eo_obj);
37 if (target)
38 evas_object_geometry_get(target, &x, &y, &w, &h);
39 }
40
41 pd->abs_pivot.cx = x + (w * cx);
42 pd->abs_pivot.cy = y + (h * cy);
43
44 pd->use_rel_pivot = EINA_TRUE;
45}
46
47EOLIAN static void
48_efl_animation_scale_scale_get(Eo *eo_obj,
49 Efl_Animation_Scale_Data *pd,
50 double *from_scale_x,
51 double *from_scale_y,
52 double *to_scale_x,
53 double *to_scale_y,
54 Efl_Canvas_Object **pivot,
55 double *cx,
56 double *cy)
57{
58 EFL_ANIMATION_SCALE_CHECK_OR_RETURN(eo_obj);
59
60 //Update relative pivot based on absolute pivot
61 if (!pd->use_rel_pivot)
62 {
63 Evas_Coord x = 0;
64 Evas_Coord y = 0;
65 Evas_Coord w = 0;
66 Evas_Coord h = 0;
67
68 Efl_Canvas_Object *target = efl_animation_target_get(eo_obj);
69 if (target)
70 evas_object_geometry_get(target, &x, &y, &w, &h);
71
72 if (w != 0)
73 pd->rel_pivot.cx = (double)(pd->abs_pivot.cx - x) / w;
74 else
75 pd->rel_pivot.cx = 0.0;
76
77 if (h != 0)
78 pd->rel_pivot.cy = (double)(pd->abs_pivot.cy - y) / h;
79 else
80 pd->rel_pivot.cy = 0.0;
81 }
82
83 if (from_scale_x)
84 *from_scale_x = pd->from.scale_x;
85
86 if (from_scale_y)
87 *from_scale_y = pd->from.scale_y;
88
89 if (to_scale_x)
90 *to_scale_x = pd->to.scale_x;
91
92 if (to_scale_y)
93 *to_scale_y = pd->to.scale_y;
94
95 if (pivot)
96 *pivot = pd->rel_pivot.obj;
97
98 if (cx)
99 *cx = pd->rel_pivot.cx;
100
101 if (cy)
102 *cy = pd->rel_pivot.cy;
103}
104
105EOLIAN static void
106_efl_animation_scale_scale_absolute_set(Eo *eo_obj,
107 Efl_Animation_Scale_Data *pd,
108 double from_scale_x,
109 double from_scale_y,
110 double to_scale_x,
111 double to_scale_y,
112 Evas_Coord cx,
113 Evas_Coord cy)
114{
115 EFL_ANIMATION_SCALE_CHECK_OR_RETURN(eo_obj);
116
117 pd->from.scale_x = from_scale_x;
118 pd->from.scale_y = from_scale_y;
119
120 pd->to.scale_x = to_scale_x;
121 pd->to.scale_y = to_scale_y;
122
123 pd->abs_pivot.cx = cx;
124 pd->abs_pivot.cy = cy;
125
126 //Update relative pivot based on absolute pivot
127 Evas_Coord x = 0;
128 Evas_Coord y = 0;
129 Evas_Coord w = 0;
130 Evas_Coord h = 0;
131
132 Efl_Canvas_Object *target = efl_animation_target_get(eo_obj);
133 if (target)
134 evas_object_geometry_get(target, &x, &y, &w, &h);
135
136 pd->rel_pivot.obj = NULL;
137
138 if (w != 0)
139 pd->rel_pivot.cx = (double)(cx - x) / w;
140 else
141 pd->rel_pivot.cx = 0.0;
142
143 if (h != 0)
144 pd->rel_pivot.cy = (double)(cy - y) / h;
145 else
146 pd->rel_pivot.cy = 0.0;
147
148 pd->use_rel_pivot = EINA_FALSE;
149}
150
151EOLIAN static void
152_efl_animation_scale_scale_absolute_get(Eo *eo_obj,
153 Efl_Animation_Scale_Data *pd,
154 double *from_scale_x,
155 double *from_scale_y,
156 double *to_scale_x,
157 double *to_scale_y,
158 Evas_Coord *cx,
159 Evas_Coord *cy)
160{
161 EFL_ANIMATION_SCALE_CHECK_OR_RETURN(eo_obj);
162
163 //Update absolute pivot based on relative pivot
164 if (pd->use_rel_pivot)
165 {
166 Evas_Coord x = 0;
167 Evas_Coord y = 0;
168 Evas_Coord w = 0;
169 Evas_Coord h = 0;
170
171 if (pd->rel_pivot.obj)
172 evas_object_geometry_get(pd->rel_pivot.obj, &x, &y, &w, &h);
173 else
174 {
175 Efl_Canvas_Object *target = efl_animation_target_get(eo_obj);
176 if (target)
177 evas_object_geometry_get(target, &x, &y, &w, &h);
178 }
179
180 pd->abs_pivot.cx = x + (w * pd->rel_pivot.cx);
181 pd->abs_pivot.cy = y + (h * pd->rel_pivot.cy);
182 }
183
184 if (from_scale_x)
185 *from_scale_x = pd->from.scale_x;
186
187 if (from_scale_y)
188 *from_scale_y = pd->from.scale_y;
189
190 if (to_scale_x)
191 *to_scale_x = pd->to.scale_x;
192
193 if (to_scale_y)
194 *to_scale_y = pd->to.scale_y;
195
196 if (cx)
197 *cx = pd->abs_pivot.cx;
198
199 if (cy)
200 *cy = pd->abs_pivot.cy;
201}
202
203EOLIAN static Efl_Object *
204_efl_animation_scale_efl_object_constructor(Eo *eo_obj,
205 Efl_Animation_Scale_Data *pd)
206{
207 eo_obj = efl_constructor(efl_super(eo_obj, MY_CLASS));
208
209 pd->from.scale_x = 1.0;
210 pd->from.scale_y = 1.0;
211
212 pd->rel_pivot.obj = NULL;
213 pd->rel_pivot.cx = 0.5;
214 pd->rel_pivot.cy = 0.5;
215
216 pd->abs_pivot.cx = 0;
217 pd->abs_pivot.cy = 0;
218
219 pd->use_rel_pivot = EINA_TRUE;
220
221 return eo_obj;
222}
223
224#include "efl_animation_scale.eo.c"
diff --git a/src/lib/evas/canvas/efl_animation_scale.eo b/src/lib/evas/canvas/efl_animation_scale.eo
new file mode 100644
index 0000000000..28eb0e25e9
--- /dev/null
+++ b/src/lib/evas/canvas/efl_animation_scale.eo
@@ -0,0 +1,41 @@
1import efl_animation_types;
2
3class Efl.Animation.Scale (Efl.Animation)
4{
5 [[Efl scale animation class]]
6 data: Efl_Animation_Scale_Data;
7 methods {
8 @property scale {
9 set {
10 }
11 get {
12 }
13 values {
14 from_scale_x: double; [[Scale factor along x axis when animation starts]]
15 from_scale_y: double; [[Scale factor along y axis when animation starts]]
16 to_scale_x: double; [[Scale factor along x axis when animation ends]]
17 to_scale_y: double; [[Scale factor along y axis when animation ends]]
18 pivot: Efl.Canvas.Object; [[Pivot object for the center point. If the pivot object is NULL, then the object is scaled on itself.]]
19 cx: double; [[X relative coordinate of the center point. 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. The top end is 0.0 and the bottom end is 1.0 (the center is 0.5).]]
21 }
22 }
23 @property scale_absolute {
24 set {
25 }
26 get {
27 }
28 values {
29 from_scale_x: double; [[Scale factor along x axis when animation starts]]
30 from_scale_y: double; [[Scale factor along y axis when animation starts]]
31 to_scale_x: double; [[Scale factor along x axis when animation ends]]
32 to_scale_y: double; [[Scale factor along y axis when animation ends]]
33 cx: int; [[X absolute coordinate of the center point.]]
34 cy: int; [[Y absolute coordinate of the center point.]]
35 }
36 }
37 }
38 implements {
39 Efl.Object.constructor;
40 }
41}
diff --git a/src/lib/evas/canvas/efl_animation_scale_private.h b/src/lib/evas/canvas/efl_animation_scale_private.h
new file mode 100644
index 0000000000..298097a64c
--- /dev/null
+++ b/src/lib/evas/canvas/efl_animation_scale_private.h
@@ -0,0 +1,48 @@
1#define EFL_ANIMATION_PROTECTED
2
3#include "evas_common_private.h"
4
5#define MY_CLASS EFL_ANIMATION_SCALE_CLASS
6#define MY_CLASS_NAME efl_class_name_get(MY_CLASS)
7
8#define EFL_ANIMATION_SCALE_CHECK_OR_RETURN(anim, ...) \
9 do { \
10 if (!anim) { \
11 CRI("Efl_Animation " # anim " is NULL!"); \
12 return __VA_ARGS__; \
13 } \
14 if (efl_animation_is_deleted(anim)) { \
15 ERR("Efl_Animation " # anim " has already been deleted!"); \
16 return __VA_ARGS__; \
17 } \
18 } while (0)
19
20#define EFL_ANIMATION_SCALE_DATA_GET(o, pd) \
21 Efl_Animation_Scale_Data *pd = efl_data_scope_get(o, EFL_ANIMATION_SCALE_CLASS)
22
23typedef struct _Efl_Animation_Scale_Property
24{
25 double scale_x, scale_y;
26} Efl_Animation_Scale_Property;
27
28typedef struct _Efl_Animation_Scale_Absolute_Pivot
29{
30 Evas_Coord cx, cy;
31} Efl_Animation_Scale_Absolute_Pivot;
32
33typedef struct _Efl_Animation_Scale_Relative_Pivot
34{
35 Efl_Canvas_Object *obj;
36 double cx, cy;
37} Efl_Animation_Scale_Relative_Pivot;
38
39typedef struct _Efl_Animation_Scale_Data
40{
41 Efl_Animation_Scale_Property from;
42 Efl_Animation_Scale_Property to;
43
44 Efl_Animation_Scale_Absolute_Pivot abs_pivot;
45 Efl_Animation_Scale_Relative_Pivot rel_pivot;
46
47 Eina_Bool use_rel_pivot;
48} Efl_Animation_Scale_Data;