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