Revert "Revert "Setup before starting fps measurement""
[platform/upstream/expedite.git] / src / bin / image_mask_clipped.c
1 #undef FNAME
2 #undef NAME
3 #undef ICON
4
5 /* metadata */
6 #define FNAME image_mask_clipped
7 #define NAME "Image Mask Clipped"
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 static Evas_Object *o_clip;
20
21 /* setup */
22 static void _setup(void)
23 {
24    int i;
25    Evas_Object *o;
26
27    o = efl_add(EFL_CANVAS_RECTANGLE_CLASS, evas);
28    o_clip = o;
29    efl_gfx_entity_size_set(o, EINA_SIZE2D(180, 105));
30    efl_gfx_entity_position_set(o, EINA_POSITION2D((win_w - 180) / 2, (win_h - 105) / 2));
31    efl_gfx_entity_visible_set(o, EINA_TRUE);
32
33    o = efl_add(EFL_CANVAS_IMAGE_CLASS, evas);
34    o_mask = o;
35    efl_file_simple_load(o, build_path("e-logo-mask.png"), NULL);
36    efl_gfx_fill_set(o, EINA_RECT(0, 0, 720, 420));
37    efl_gfx_entity_size_set(o, EINA_SIZE2D(720, 420));
38    evas_object_clip_set(o, o_clip);
39    efl_canvas_object_has_fixed_size_set(o, 1);
40    efl_gfx_entity_position_set(o, EINA_POSITION2D((win_w - 720) / 2, (win_h - 420) / 2));
41    efl_gfx_entity_visible_set(o, EINA_TRUE);
42
43    for (i = 0; i < OBNUM; i++)
44      {
45         o = efl_add(EFL_CANVAS_IMAGE_CLASS, evas);
46         o_images[i] = o;
47         efl_file_simple_load(o, build_path("logo.png"), NULL);
48         efl_gfx_fill_set(o, EINA_RECT(0, 0, 360, 480));
49         efl_gfx_entity_size_set(o, EINA_SIZE2D(360, 480));
50         efl_gfx_image_smooth_scale_set(o, 0);
51         evas_object_clip_set(o, o_mask);
52         efl_gfx_entity_visible_set(o, EINA_TRUE);
53      }
54    done = 0;
55 }
56
57 /* cleanup */
58 static void _cleanup(void)
59 {
60    int i;
61    for (i = 0; i < OBNUM; i++) efl_del(o_images[i]);
62    efl_del(o_mask);
63    efl_del(o_clip);
64 }
65
66 /* loop - do things */
67 static void _loop(double t, int f)
68 {
69    int i;
70    Evas_Coord x, y, w, h, w0, h0;
71
72    for (i = 0; i < OBNUM; i++)
73      {
74         w0 = 80;
75         h0 = 80;
76         w = 5 + ((1.0 + cos((double)(f + (i * 10)) / (7.4 * SLOW) )) * w0 * 2);
77         h = 5 + ((1.0 + sin((double)(f + (i * 19)) / (12.6 * SLOW) )) * h0 * 2);
78         x = (win_w / 2) - (w / 2);
79         x += sin((double)(f + (i * 13)) / (36.7 * SLOW)) * (w0 / 2);
80         y = (win_h / 2) - (h / 2);
81         y += cos((double)(f + (i * 28)) / (43.8 * SLOW)) * (h0 / 2);
82
83         efl_gfx_entity_position_set(o_images[i], EINA_POSITION2D(x, y));
84         efl_gfx_entity_size_set(o_images[i], EINA_SIZE2D(w, h));
85         efl_gfx_fill_set(o_images[i], EINA_RECT(0, 0, w, h));
86      }
87    w = (sin((double)f) * 720 + 840) / 2.2;
88    h = (sin((double)f) * 720 + 840) / 2.2;
89    efl_gfx_entity_size_set(o_mask, EINA_SIZE2D(w, h));
90    efl_gfx_entity_position_set(o_mask, EINA_POSITION2D((win_w - w) / 2, (win_h - h) / 2));
91    FPS_STD(NAME);
92 }
93
94 /* prepend special key handlers if interactive (before STD) */
95 static void _key(const char *key)
96 {
97    KEY_STD;
98 }
99
100
101
102
103
104
105
106
107
108
109
110
111 /* template stuff - ignore */
112 # endif
113 #endif
114
115 #ifdef UI
116 _ui_menu_item_add(ICON, NAME, FNAME);
117 #endif
118
119 #ifdef PROTO
120 void FNAME(void);
121 #endif
122
123 #ifndef PROTO
124 # ifndef UI
125 void FNAME(void)
126 {
127    _setup();
128    ui_func_set(_key, _loop);
129 }
130 # endif
131 #endif
132 #undef FNAME
133 #undef NAME
134 #undef ICON