containing ui setup steps in the profiling again.
[platform/upstream/expedite.git] / src / bin / rect_blend_pow2.c
1 #undef FNAME
2 #undef NAME
3 #undef ICON
4
5 /* metadata */
6 #define FNAME rect_blend_pow2_start
7 #define NAME "Rect Blend Power 2"
8 #define ICON "rect.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
19 /* setup */
20 static void _setup(void)
21 {
22    int i;
23    Evas_Object *o;
24    srnd();
25    for (i = 0; i < OBNUM; i++)
26      {
27         int r, g, b, a;
28
29         o = efl_add(EFL_CANVAS_RECTANGLE_CLASS, evas);
30         o_images[i] = o;
31         a = 256 - (1 << ((rnd() % 8) + 1));
32         if (a < 128) a = 128;
33         r = ((rnd()&0xff) * a) / 255;
34         g = ((rnd()&0xff) * a) / 255;
35         b = ((rnd()&0xff) * a) / 255;
36         efl_gfx_color_set(o, r, g, b, a);
37         efl_gfx_entity_visible_set(o, EINA_TRUE);
38      }
39    done = 0;
40 }
41
42 /* cleanup */
43 static void _cleanup(void)
44 {
45    int i;
46    for (i = 0; i < OBNUM; i++) efl_del(o_images[i]);
47 }
48
49 /* loop - do things */
50 static void _loop(double t, int f)
51 {
52    int i;
53    Evas_Coord x, y, w, h, w0, h0;
54    for (i = 0; i < OBNUM; i++)
55      {
56         w0 = 80;
57         h0 = 80;
58         w = 5 + ((1.0 + cos((double)(f + (i * 10)) / (7.4 * SLOW) )) * w0 * 2);
59         h = 5 + ((1.0 + sin((double)(f + (i * 19)) / (12.6 * SLOW) )) * h0 * 2);
60         x = (win_w / 2) - (w / 2);
61         x += sin((double)(f + (i * 13)) / (36.7 * SLOW)) * (w0 / 2);
62         y = (win_h / 2) - (h / 2);
63         y += cos((double)(f + (i * 28)) / (43.8 * SLOW)) * (h0 / 2);
64         efl_gfx_entity_position_set(o_images[i], EINA_POSITION2D(x, y));
65         efl_gfx_entity_size_set(o_images[i], EINA_SIZE2D(w, h));
66      }
67    FPS_STD(NAME);
68 }
69
70 /* prepend special key handlers if interactive (before STD) */
71 static void _key(const char *key)
72 {
73    KEY_STD;
74 }
75
76
77
78
79
80
81
82
83
84
85
86
87 /* template stuff - ignore */
88 # endif
89 #endif
90
91 #ifdef UI
92 _ui_menu_item_add(ICON, NAME, FNAME);
93 #endif
94
95 #ifdef PROTO
96 void FNAME(void);
97 #endif
98
99 #ifndef PROTO
100 # ifndef UI
101 void FNAME(void)
102 {
103    ui_func_set(_key, _loop, _setup);
104 }
105 # endif
106 #endif
107 #undef FNAME
108 #undef NAME
109 #undef ICON