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