containing ui setup steps in the profiling again.
[platform/upstream/expedite.git] / src / bin / image_mask_12.c
1 #undef FNAME
2 #undef NAME
3 #undef ICON
4
5 /* metadata */
6 #define FNAME image_mask_12
7 #define NAME "Image Mask 12"
8 #define ICON "blend.png"
9
10 #ifndef PROTO
11 # ifndef UI
12 #  include "main.h"
13
14 /* standard var */
15 static int done = 0;
16 /* private data */
17 static Evas_Object *o_images[OBNUM];
18 static Evas_Object *o_mask;
19
20 /* setup */
21 static void _setup(void)
22 {
23    int i;
24    Evas_Object *o;
25
26    o = efl_add(EFL_CANVAS_IMAGE_CLASS, evas);
27    o_mask = o;
28    efl_file_simple_load(o, build_path("e-logo-mask.png"), NULL);
29    efl_gfx_fill_set(o, EINA_RECT(0, 0, 720, 420));
30    efl_gfx_entity_size_set(o, EINA_SIZE2D(720, 420));
31    efl_gfx_entity_position_set(o, EINA_POSITION2D((win_w - 720) / 2, (win_h - 420) / 2));
32    efl_gfx_entity_visible_set(o, EINA_TRUE);
33
34    for (i = 0; i < OBNUM; i++)
35      {
36         o = efl_add(EFL_CANVAS_IMAGE_CLASS, evas);
37         o_images[i] = o;
38         efl_file_simple_load(o, build_path("logo.png"), NULL);
39         efl_gfx_fill_set(o, EINA_RECT(0, 0, 120, 160));
40         efl_gfx_entity_size_set(o, EINA_SIZE2D(120, 160));
41         efl_gfx_image_smooth_scale_set(o, 1);
42         evas_object_clip_set(o, o_mask);
43         efl_gfx_entity_visible_set(o, EINA_TRUE);
44      }
45    done = 0;
46 }
47
48 /* cleanup */
49 static void _cleanup(void)
50 {
51    int i;
52    for (i = 0; i < OBNUM; i++) efl_del(o_images[i]);
53    efl_del(o_mask);
54 }
55
56 /* loop - do things */
57 static void _loop(double t, int f)
58 {
59    int i;
60    Evas_Coord x, y, w, h, w0, h0;
61    for (i = 0; i < OBNUM; i++)
62      {
63         w0 = 80;
64         h0 = 80;
65         w = 5 + ((1.0 + cos((double)(f + (i * 10)) / (7.4 * SLOW) )) * w0 * 2);
66         h = 5 + ((1.0 + sin((double)(f + (i * 19)) / (12.6 * SLOW) )) * h0 * 2);
67         x = (win_w / 2) - (w / 2);
68         x += sin((double)(f + (i * 13)) / (36.7 * SLOW)) * (w0 / 2);
69         y = (win_h / 2) - (h / 2);
70         y += cos((double)(f + (i * 28)) / (43.8 * SLOW)) * (h0 / 2);
71
72         efl_gfx_entity_position_set(o_images[i], EINA_POSITION2D(x, y));
73         efl_gfx_entity_size_set(o_images[i], EINA_SIZE2D(w, h));
74         efl_gfx_fill_set(o_images[i], EINA_RECT(0, 0, w, h));
75      }
76    FPS_STD(NAME);
77 }
78
79 /* prepend special key handlers if interactive (before STD) */
80 static void _key(const char *key)
81 {
82    KEY_STD;
83 }
84
85
86
87
88
89
90
91
92
93
94
95
96 /* template stuff - ignore */
97 # endif
98 #endif
99
100 #ifdef UI
101 _ui_menu_item_add(ICON, NAME, FNAME);
102 #endif
103
104 #ifdef PROTO
105 void FNAME(void);
106 #endif
107
108 #ifndef PROTO
109 # ifndef UI
110 void FNAME(void)
111 {
112    ui_func_set(_key, _loop, _setup);
113 }
114 # endif
115 #endif
116 #undef FNAME
117 #undef NAME
118 #undef ICON