summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <m.blumenkran@samsung.com>2013-10-07 13:41:22 +0100
committerMike Blumenkrantz <m.blumenkran@samsung.com>2013-10-07 13:41:22 +0100
commit59eae6ee3bd7861a0702dfa3198621c079896b53 (patch)
tree76807af0543805a259e6416b490fbc0eb83ab3ea
parent837d7045cf217a3b3476eba85b150b3a59e74292 (diff)
LCEU2013 compositing demo wip
-rw-r--r--linuxcon-eu-2013/comp_demo/Pattern_Radial.edjbin0 -> 706972 bytes
-rw-r--r--linuxcon-eu-2013/comp_demo/compositing.c201
-rw-r--r--linuxcon-eu-2013/comp_demo/firefox.pngbin0 -> 132058 bytes
-rw-r--r--linuxcon-eu-2013/comp_demo/home.pngbin0 -> 9062 bytes
-rw-r--r--linuxcon-eu-2013/comp_demo/menu.pngbin0 -> 15642 bytes
-rw-r--r--linuxcon-eu-2013/comp_demo/secrets.pngbin0 -> 10186 bytes
-rw-r--r--linuxcon-eu-2013/comp_demo/shelf.pngbin0 -> 32728 bytes
-rw-r--r--linuxcon-eu-2013/comp_demo/shelf2.pngbin0 -> 33130 bytes
-rw-r--r--linuxcon-eu-2013/comp_demo/shelf3.pngbin0 -> 33628 bytes
-rw-r--r--linuxcon-eu-2013/comp_demo/terminology.pngbin0 -> 10109 bytes
-rw-r--r--linuxcon-eu-2013/comp_demo/terminology1.pngbin0 -> 21584 bytes
-rw-r--r--linuxcon-eu-2013/comp_demo/terminology2.pngbin0 -> 11795 bytes
12 files changed, 201 insertions, 0 deletions
diff --git a/linuxcon-eu-2013/comp_demo/Pattern_Radial.edj b/linuxcon-eu-2013/comp_demo/Pattern_Radial.edj
new file mode 100644
index 0000000..d4a4387
--- /dev/null
+++ b/linuxcon-eu-2013/comp_demo/Pattern_Radial.edj
Binary files differ
diff --git a/linuxcon-eu-2013/comp_demo/compositing.c b/linuxcon-eu-2013/comp_demo/compositing.c
new file mode 100644
index 0000000..f640e19
--- /dev/null
+++ b/linuxcon-eu-2013/comp_demo/compositing.c
@@ -0,0 +1,201 @@
1#include <Elementary.h>
2#include <Efx.h>
3
4static unsigned int state = 0;
5
6static Evas_Object *win = NULL;
7
8static Evas_Object *imgs[4] = {NULL};
9
10static Evas_Object *shelf = NULL;
11
12static Evas_Object *terminology[2] = {NULL};
13static Evas_Object *firefox = NULL;
14static Evas_Object *menu = NULL;
15
16static Evas_Object *
17image_add(const char *file, int *w, int *h)
18{
19 Evas_Object *o;
20
21 o = elm_image_add(win);
22 elm_image_file_set(o, file, NULL);
23 elm_image_object_size_get(o, w, h);
24 evas_object_resize(o, *w, *h);
25 return o;
26}
27
28static Eina_Bool
29key_down(void *data EINA_UNUSED, int t EINA_UNUSED, Ecore_Event_Key *ev)
30{
31 if (!strcmp(ev->keyname, "Escape"))
32 ecore_main_loop_quit();
33 return ECORE_CALLBACK_RENEW;
34}
35
36static void
37menu_del(void *data EINA_UNUSED, Efx_Map_Data *e EINA_UNUSED, Evas_Object *obj)
38{
39 evas_object_del(obj);
40}
41
42static void
43zoom_end(void *data EINA_UNUSED, Efx_Map_Data *e EINA_UNUSED, Evas_Object *obj)
44{
45 efx_zoom_reset(obj);
46}
47
48static void
49fade_end(void *data EINA_UNUSED, Efx_Map_Data *e EINA_UNUSED, Evas_Object *obj)
50{
51 evas_object_hide(terminology[0]);
52}
53
54static void
55shelf_end(void *data EINA_UNUSED, Efx_Map_Data *e EINA_UNUSED, Evas_Object *obj)
56{
57 /* remove map */
58 efx_rotate_reset(obj);
59}
60
61static Eina_Bool
62mouse_down(void *data EINA_UNUSED, int t EINA_UNUSED, Ecore_Event_Mouse_Button *ev)
63{
64 Evas_Object *o;
65 int w, h, sw, sh;
66
67 switch (state)
68 {
69 case 0:
70 menu = o = image_add("menu.png", &w, &h);
71 evas_object_move(o, ev->x, ev->y);
72 efx_zoom(o, EFX_EFFECT_SPEED_DECELERATE, 0.8, 1.0, NULL, 0.2, zoom_end, NULL);
73 evas_object_show(o);
74 break;
75 case 1:
76 efx_fade(menu, EFX_EFFECT_SPEED_DECELERATE, EFX_COLOR(0, 0, 0), 0, 0.2, NULL, NULL);
77 efx_zoom(menu, EFX_EFFECT_SPEED_DECELERATE, 1.0, 0.8, NULL, 0.2, menu_del, NULL);
78 menu = NULL;
79 break;
80 case 5:
81 efx_queue_run(imgs[1]);
82 efx_queue_run(imgs[2]);
83 break;
84 case 6:
85 evas_object_geometry_get(win, NULL, NULL, &sw, &sh);
86 shelf = o = image_add("shelf.png", &w, &h);
87 evas_object_move(o, -w, sh - h);
88 evas_object_show(o);
89
90 efx_move(o, EFX_EFFECT_SPEED_DECELERATE, EFX_POINT(sw - (w / 2) - (h / 2), sh - h), 1.0, NULL, NULL);
91 efx_rotate(o, EFX_EFFECT_SPEED_DECELERATE, 810, NULL, 1.0, NULL, NULL);
92 break;
93 case 7:
94 evas_object_geometry_get(win, NULL, NULL, &sw, &sh);
95 elm_image_object_size_get(shelf, &w, &h);
96 efx_move(shelf, EFX_EFFECT_SPEED_DECELERATE, EFX_POINT((sw / 2) - (w / 2), sh - h), 0.5, NULL, NULL);
97 efx_rotate(shelf, EFX_EFFECT_SPEED_DECELERATE, -90, NULL, 0.5, shelf_end, NULL);
98 break;
99 case 10:
100 efx_fade(terminology[1], EFX_EFFECT_SPEED_LINEAR, EFX_COLOR(0, 0, 0), 0, 2.0, NULL, NULL);
101 break;
102 case 11:
103 efx_fade(terminology[1], EFX_EFFECT_SPEED_LINEAR, EFX_COLOR(180, 180, 180), 180, 3.5, NULL, NULL);
104 break;
105 case 12:
106 efx_fade_reset(terminology[1]);
107 break;
108 default: break;
109 }
110 return ECORE_CALLBACK_RENEW;
111}
112
113static Eina_Bool
114mouse_up(void *data EINA_UNUSED, int t EINA_UNUSED, Ecore_Event_Mouse_Button *ev EINA_UNUSED)
115{
116 Evas_Object *o;
117 int x, y, w, h, ow, sh;
118
119 switch (state)
120 {
121 case 2:
122 case 3:
123 case 4:
124 evas_object_show(imgs[state - 2]);
125 break;
126 case 8:
127 evas_object_geometry_get(imgs[0], NULL, NULL, &ow, NULL);
128
129 terminology[0] = o = image_add("terminology1.png", &w, &h);
130 evas_object_move(o, ow + 2, 0);
131 efx_zoom(o, EFX_EFFECT_SPEED_DECELERATE, 0.5, 1.0, NULL, 0.2, zoom_end, NULL);
132 evas_object_show(o);
133
134 elm_image_file_set(shelf, "shelf2.png", NULL);
135 break;
136 case 9:
137 evas_object_geometry_get(terminology[0], &x, &y, &ow, NULL);
138
139 terminology[1] = o = image_add("terminology2.png", &w, &h);
140 evas_object_move(o, x, y);
141 evas_object_stack_above(terminology[1], terminology[0]);
142 efx_fade(terminology[1], EFX_EFFECT_SPEED_DECELERATE, EFX_COLOR(0, 0, 0), 0, 0, NULL, NULL);
143 efx_fade(terminology[1], EFX_EFFECT_SPEED_LINEAR, EFX_COLOR(255, 255, 255), 255, 0.2, fade_end, NULL);
144 evas_object_show(o);
145
146 evas_object_geometry_get(win, NULL, NULL, &ow, NULL);
147
148 firefox = o = image_add("firefox.png", &w, &h);
149 evas_object_move(o, ow - w, 0);
150 efx_zoom(o, EFX_EFFECT_SPEED_DECELERATE, 0.5, 1.0, NULL, 0.2, zoom_end, NULL);
151 evas_object_show(o);
152
153 elm_image_file_set(shelf, "shelf3.png", NULL);
154 break;
155 default: break;
156 }
157 state++;
158 return ECORE_CALLBACK_RENEW;
159}
160
161int
162main(int argc, char *argv[])
163{
164 Evas_Object *o;
165 int ow, oh, w, h;
166
167 elm_init(argc, (char**)argv);
168 efx_init();
169
170 ecore_event_handler_add(ECORE_EVENT_KEY_DOWN, (Ecore_Event_Handler_Cb)key_down, NULL);
171 ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_UP, (Ecore_Event_Handler_Cb)mouse_up, NULL);
172 ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, (Ecore_Event_Handler_Cb)mouse_down, NULL);
173
174 win = elm_win_util_standard_add("desktop", "demo");
175 o = elm_bg_add(win);
176 elm_bg_file_set(o, "Pattern_Radial.edj", "e/desktop/background");
177 elm_win_resize_object_add(win, o);
178 elm_win_fullscreen_set(win, 1);
179 evas_object_show(o);
180 evas_object_show(win);
181
182 imgs[0] = o = image_add("home.png", &ow, &oh);
183
184 imgs[1] = o = image_add("terminology.png", &w, &h);
185 evas_object_move(o, ow, 0);
186
187 efx_queue_append(o, EFX_EFFECT_SPEED_DECELERATE,
188 EFX_QUEUED_EFFECT(EFX_EFFECT_MOVE(0, oh)), 0.3, NULL, NULL);
189
190 ow += w;
191 oh += h;
192
193 imgs[2] = o = image_add("secrets.png", &w, &h);
194 evas_object_move(o, ow, 0);
195
196 efx_queue_append(o, EFX_EFFECT_SPEED_DECELERATE,
197 EFX_QUEUED_EFFECT(EFX_EFFECT_MOVE(0, oh)), 0.3, NULL, NULL);
198
199 ecore_main_loop_begin();
200 return 0;
201}
diff --git a/linuxcon-eu-2013/comp_demo/firefox.png b/linuxcon-eu-2013/comp_demo/firefox.png
new file mode 100644
index 0000000..93d4745
--- /dev/null
+++ b/linuxcon-eu-2013/comp_demo/firefox.png
Binary files differ
diff --git a/linuxcon-eu-2013/comp_demo/home.png b/linuxcon-eu-2013/comp_demo/home.png
new file mode 100644
index 0000000..c902f4a
--- /dev/null
+++ b/linuxcon-eu-2013/comp_demo/home.png
Binary files differ
diff --git a/linuxcon-eu-2013/comp_demo/menu.png b/linuxcon-eu-2013/comp_demo/menu.png
new file mode 100644
index 0000000..30fc85a
--- /dev/null
+++ b/linuxcon-eu-2013/comp_demo/menu.png
Binary files differ
diff --git a/linuxcon-eu-2013/comp_demo/secrets.png b/linuxcon-eu-2013/comp_demo/secrets.png
new file mode 100644
index 0000000..9895270
--- /dev/null
+++ b/linuxcon-eu-2013/comp_demo/secrets.png
Binary files differ
diff --git a/linuxcon-eu-2013/comp_demo/shelf.png b/linuxcon-eu-2013/comp_demo/shelf.png
new file mode 100644
index 0000000..3ba052c
--- /dev/null
+++ b/linuxcon-eu-2013/comp_demo/shelf.png
Binary files differ
diff --git a/linuxcon-eu-2013/comp_demo/shelf2.png b/linuxcon-eu-2013/comp_demo/shelf2.png
new file mode 100644
index 0000000..2b1a380
--- /dev/null
+++ b/linuxcon-eu-2013/comp_demo/shelf2.png
Binary files differ
diff --git a/linuxcon-eu-2013/comp_demo/shelf3.png b/linuxcon-eu-2013/comp_demo/shelf3.png
new file mode 100644
index 0000000..4e105b5
--- /dev/null
+++ b/linuxcon-eu-2013/comp_demo/shelf3.png
Binary files differ
diff --git a/linuxcon-eu-2013/comp_demo/terminology.png b/linuxcon-eu-2013/comp_demo/terminology.png
new file mode 100644
index 0000000..7816372
--- /dev/null
+++ b/linuxcon-eu-2013/comp_demo/terminology.png
Binary files differ
diff --git a/linuxcon-eu-2013/comp_demo/terminology1.png b/linuxcon-eu-2013/comp_demo/terminology1.png
new file mode 100644
index 0000000..327222d
--- /dev/null
+++ b/linuxcon-eu-2013/comp_demo/terminology1.png
Binary files differ
diff --git a/linuxcon-eu-2013/comp_demo/terminology2.png b/linuxcon-eu-2013/comp_demo/terminology2.png
new file mode 100644
index 0000000..0224eb3
--- /dev/null
+++ b/linuxcon-eu-2013/comp_demo/terminology2.png
Binary files differ