containing ui setup steps in the profiling again.
[platform/upstream/expedite.git] / src / bin / image_map_color_nearest_solid_rotate.c
1 #undef FNAME
2 #undef NAME
3 #undef ICON
4
5 /* metadata */
6 #define FNAME image_map_color_nearest_solid_rotate_start
7 #define NAME "Image Map Color Nearest Solid 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 = efl_add(EFL_CANVAS_IMAGE_CLASS, evas);
28         o_images[i] = o;
29         efl_file_simple_load(o, build_path("image.png"), NULL);
30         efl_gfx_fill_set(o, EINA_RECT(0, 0, 120, 160));
31         efl_gfx_entity_size_set(o, EINA_SIZE2D(120, 160));
32         efl_gfx_image_smooth_scale_set(o, 0);
33         efl_gfx_entity_visible_set(o, 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++) efl_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    evas_map_smooth_set(m, 0);
53    for (i = 0; i < (OBNUM / 2); i++)
54      {
55         w = 120;
56         h = 160;
57         x = (win_w / 2) - (w / 2);
58         x += sin((double)(f + (i * 13)) / (36.7 * SLOW)) * (w / 2);
59         y = (win_h / 2) - (h / 2);
60         y += cos((double)(f + (i * 28)) / (43.8 * SLOW)) * (h / 2);
61
62         evas_map_util_points_populate_from_geometry(m, x, y, w, h, 0);
63
64         evas_map_point_color_set(m, 0, 255, 255, 255, 255);
65         evas_map_point_color_set(m, 1, 255, 0, 0, 255);
66         evas_map_point_color_set(m, 2, 0, 0, 255, 255);
67         evas_map_point_color_set(m, 3, 0, 255, 0, 255);
68
69         evas_map_util_rotate(m, f, x + (w / 2), y + (h / 2));
70
71         evas_object_map_enable_set(o_images[i], 1);
72         evas_object_map_set(o_images[i], m);
73      }
74    FPS_STD(NAME);
75 }
76
77 /* prepend special key handlers if interactive (before STD) */
78 static void _key(const 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    ui_func_set(_key, _loop, _setup);
111 }
112 # endif
113 #endif
114 #undef FNAME
115 #undef NAME
116 #undef ICON