upldate 1.7.10
[platform/upstream/expedite.git] / src / bin / image_map_color_rotate.c
1 #undef FNAME
2 #undef NAME
3 #undef ICON
4
5 /* metadata */
6 #define FNAME image_map_color_rotate_start
7 #define NAME "Image Map Color Rotate"
8 #define ICON "map.png"
9
10 #ifndef PROTO
11 # ifndef UI
12 #  include "main.h"
13
14 /* standard var */
15 static int done = 0;
16
17 /* private data */
18 static Evas_Object *o_images[OBNUM];
19
20 /* setup */
21 static void _setup(void)
22 {
23    int i;
24    Evas_Object *o;
25    for (i = 0; i < (OBNUM / 2); i++)
26      {
27         o = eo_add(EVAS_IMAGE_CLASS, evas);
28         o_images[i] = o;
29         eo_do(o,
30               efl_file_set(build_path("logo.png"), NULL),
31               efl_gfx_fill_set(0, 0, 120, 160),
32               efl_gfx_size_set(120, 160),
33               efl_gfx_visible_set(EINA_TRUE));
34      }
35    done = 0;
36 }
37
38 /* cleanup */
39 static void _cleanup(void)
40 {
41    int i;
42    for (i = 0; i < (OBNUM / 2); i++) eo_del(o_images[i]);
43 }
44
45 /* loop - do things */
46 static void _loop(double t, int f)
47 {
48    int i;
49    static Evas_Map *m = NULL;
50    Evas_Coord x, y, w, h;
51    if (!m) m = evas_map_new(4);
52    for (i = 0; i < (OBNUM / 2); i++)
53      {
54         w = 120;
55         h = 160;
56         x = (win_w / 2) - (w / 2);
57         x += sin((double)(f + (i * 13)) / (36.7 * SLOW)) * (w / 2);
58         y = (win_h / 2) - (h / 2);
59         y += cos((double)(f + (i * 28)) / (43.8 * SLOW)) * (h / 2);
60
61         evas_map_util_points_populate_from_geometry(m, x, y, w, h, 0);
62
63         evas_map_point_color_set(m, 0, 255, 255, 255, 255);
64         evas_map_point_color_set(m, 1, 255, 0, 0, 255);
65         evas_map_point_color_set(m, 2, 0, 0, 255, 255);
66         evas_map_point_color_set(m, 3, 0, 255, 0, 255);
67
68         evas_map_util_rotate(m, f, x + (w / 2), y + (h / 2));
69
70         eo_do(o_images[i],
71               evas_obj_map_enable_set(1),
72               evas_obj_map_set(m));
73      }
74    FPS_STD(NAME);
75 }
76
77 /* prepend special key handlers if interactive (before STD) */
78 static void _key(char *key)
79 {
80    KEY_STD;
81 }
82
83
84
85
86
87
88
89
90
91
92
93
94 /* template stuff - ignore */
95 # endif
96 #endif
97
98 #ifdef UI
99 _ui_menu_item_add(ICON, NAME, FNAME);
100 #endif
101
102 #ifdef PROTO
103 void FNAME(void);
104 #endif
105
106 #ifndef PROTO
107 # ifndef UI
108 void FNAME(void)
109 {
110    _setup();
111    ui_func_set(_key, _loop);
112 }
113 # endif
114 #endif
115 #undef FNAME
116 #undef NAME
117 #undef ICON