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