Revert "Revert "Setup before starting fps measurement""
[platform/upstream/expedite.git] / src / bin / image_mask_9.c
1 #undef FNAME
2 #undef NAME
3 #undef ICON
4
5 /* metadata */
6 #define FNAME image_mask_9
7 #define NAME "Image Mask 9"
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[1];
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 < 1; i++)
35      {
36         o = efl_add(EFL_CANVAS_IMAGE_CLASS, evas);
37         o_images[i] = o;
38         efl_file_simple_load(o, build_path("texture.png"), NULL);
39         efl_gfx_fill_set(o, EINA_RECT(0, 0, 500, 444));
40         efl_gfx_entity_size_set(o, EINA_SIZE2D(win_w * 4, win_h * 4));
41         evas_object_clip_set(o, o_mask);
42         efl_gfx_entity_visible_set(o, EINA_TRUE);
43      }
44    done = 0;
45 }
46
47 /* cleanup */
48 static void _cleanup(void)
49 {
50    int i;
51    for (i = 0; i < 1; i++) efl_del(o_images[i]);
52    efl_del(o_mask);
53 }
54
55 /* loop - do things */
56 static void _loop(double t, int f)
57 {
58    int i;
59    static Evas_Map *m = NULL;
60    Evas_Coord x, y, w, h;
61    for (i = 0; i < 1; i++)
62      {
63         w = win_w * 4;
64         h = win_h * 4;
65         x = (win_w / 2) - (w / 2);
66         x += sin((double)(f + (i * 13)) / (36.7 * SLOW)) * (500 / 2);
67         y = (win_h / 2) - (h / 2);
68         y += cos((double)(f + (i * 28)) / (43.8 * SLOW)) * (444 / 2);
69         efl_gfx_entity_position_set(o_images[i], EINA_POSITION2D(x, y));
70      }
71    if (!m) m = evas_map_new(4);
72
73    evas_map_util_points_populate_from_geometry(m, 
74                                                (win_w - 720) / 2, 
75                                                (win_h - 420) / 2, 
76                                                720, 420, 0);
77    evas_map_util_rotate(m, f, win_w / 2, win_h / 2);
78
79    evas_object_map_enable_set(o_mask, 1);
80    evas_object_map_set(o_mask, m);
81    FPS_STD(NAME);
82 }
83
84 /* prepend special key handlers if interactive (before STD) */
85 static void _key(const char *key)
86 {
87    KEY_STD;
88 }
89
90
91
92
93
94
95
96
97
98
99
100
101 /* template stuff - ignore */
102 # endif
103 #endif
104
105 #ifdef UI
106 _ui_menu_item_add(ICON, NAME, FNAME);
107 #endif
108
109 #ifdef PROTO
110 void FNAME(void);
111 #endif
112
113 #ifndef PROTO
114 # ifndef UI
115 void FNAME(void)
116 {
117    _setup();
118    ui_func_set(_key, _loop);
119 }
120 # endif
121 #endif
122 #undef FNAME
123 #undef NAME
124 #undef ICON