summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCedric BAIL <cedric@osg.samsung.com>2015-05-18 15:44:41 +0200
committerCedric BAIL <cedric@osg.samsung.com>2015-08-06 11:14:40 +0200
commit8e8a0795150dbc65e084d9f4cd28a099144b0e83 (patch)
tree0c5e27986aa37e32d501fa7665d1736d37c8f303
parent3ce8b3f1451700f9a2da60c2e717c644220e2449 (diff)
snapshot: add a test with blur.
-rw-r--r--src/bin/Makefile.am3
-rw-r--r--src/bin/snapshot_widgets_file_icons.c211
-rw-r--r--src/bin/tests.h1
3 files changed, 214 insertions, 1 deletions
diff --git a/src/bin/Makefile.am b/src/bin/Makefile.am
index d37babc..754b8ab 100644
--- a/src/bin/Makefile.am
+++ b/src/bin/Makefile.am
@@ -128,7 +128,8 @@ image_mask_13.c \
128vg_basic_rect.c \ 128vg_basic_rect.c \
129vg_basic_circle.c \ 129vg_basic_circle.c \
130vg_basic_gradient.c \ 130vg_basic_gradient.c \
131vg_scaled.c 131vg_scaled.c \
132snapshot_widgets_file_icons.c
132# \ 133# \
133# image_mask_14.c \ 134# image_mask_14.c \
134# image_mask_15.c 135# image_mask_15.c
diff --git a/src/bin/snapshot_widgets_file_icons.c b/src/bin/snapshot_widgets_file_icons.c
new file mode 100644
index 0000000..c78b9d4
--- /dev/null
+++ b/src/bin/snapshot_widgets_file_icons.c
@@ -0,0 +1,211 @@
1#define EFL_GFX_FILTER_BETA
2
3#undef FNAME
4#undef NAME
5#undef ICON
6
7/* metadata */
8#define FNAME snapshot_widgets_file_icons_start
9#define NAME "Snapshot Widgets File Icons"
10#define ICON "widgets.png"
11
12#ifndef PROTO
13# ifndef UI
14# include "main.h"
15
16/* standard var */
17static int done = 0;
18/* private data */
19#define NUM 512
20#define ICON_SIZE 64
21static Evas_Object *o_images[NUM];
22static Evas_Object *o_texts[NUM];
23static Evas_Object *o_snap;
24
25static const char *icons[] =
26{
27 "bug.png",
28 "bulb.png",
29 "camera.png",
30 "colorbox.png",
31
32 "e.png",
33 "error.png",
34 "flower.png",
35 "house.png",
36
37 "mushroom.png",
38 "pulse.png",
39 "typewriter.png",
40 "warning.png",
41
42 "watch.png"
43};
44
45/* setup */
46static void _setup(void)
47{
48 Evas_Object *o;
49 Evas_Coord x, y;
50 int i;
51
52 x = y = 0;
53 for (i = 0; i < NUM; i++)
54 {
55 Evas_Coord tw, th, cent;
56
57 o = eo_add(EVAS_IMAGE_CLASS, evas);
58 o_images[i] = o;
59 eo_do(o,
60 efl_file_set(build_path(icons[i % 13]), NULL),
61 efl_gfx_fill_set(0, 0, ICON_SIZE, ICON_SIZE),
62 efl_gfx_size_set(ICON_SIZE, ICON_SIZE),
63 efl_gfx_position_set(x + 8, y),
64 efl_gfx_visible_set(EINA_TRUE));
65
66 o = eo_add(EVAS_TEXT_CLASS, evas);
67 o_texts[i] = o;
68 eo_do(o,
69 efl_text_properties_font_set("Vera-Bold", 10),
70 efl_text_set(icons[i % 13]),
71 evas_obj_text_style_set(EVAS_TEXT_STYLE_FAR_SOFT_SHADOW),
72 efl_gfx_color_set(255, 255, 255, 255),
73 evas_obj_text_shadow_color_set(0, 0, 0, 24),
74 efl_gfx_visible_set(EINA_TRUE),
75 efl_gfx_size_get(&tw, &th));
76 cent = ICON_SIZE + 16 - tw / 2;
77 eo_do(o, efl_gfx_position_set(x + cent, y + ICON_SIZE + 4));
78 x += ICON_SIZE + 16;
79 if (x > win_w)
80 {
81 x = 0;
82 y += ICON_SIZE + 16;
83 }
84 }
85
86 const char *filter =
87 "a = buffer { 'rgba' }"
88 "blend {}"
89 "blur { 5, dst = a }"
90 "blend { src = a, color = '#ff08' }"
91 ;
92
93 o = eo_add(EVAS_IMAGE_CLASS, evas);
94 o_snap = o;
95 eo_do(o,
96 efl_gfx_visible_set(EINA_TRUE),
97 efl_gfx_position_set(50, 50),
98 efl_gfx_size_set(200, 200),
99 efl_gfx_fill_set(0, 0, 200, 200),
100 evas_obj_image_snapshot_set(EINA_TRUE),
101 efl_gfx_filter_program_set(filter, "test"));
102
103 done = 0;
104}
105
106/* cleanup */
107static void _cleanup(void)
108{
109 int i;
110 for (i = 0; i < NUM; i++)
111 {
112 eo_del(o_images[i]);
113 eo_del(o_texts[i]);
114 }
115 eo_del(o_snap);
116}
117
118/* loop - do things */
119static int dx = 2;
120static int dy = 2;
121
122static void _loop(double t, int f)
123{
124 int i;
125 Evas_Coord x, y, tw, th, cent;
126 x = 0;
127 y = 0 - f;
128 for (i = 0; i < NUM; i++)
129 {
130 eo_do(o_images[i], efl_gfx_position_set(x + 8, y));
131 eo_do(o_texts[i], efl_gfx_size_get(&tw, &th));
132 cent = (ICON_SIZE + 16 - tw) / 2;
133 eo_do(o_texts[i], efl_gfx_position_set(x + cent, y + ICON_SIZE + 4));
134 x += ICON_SIZE + 16;
135 if (x > win_w)
136 {
137 x = 0;
138 y += ICON_SIZE + 16;
139 }
140 }
141
142 if (1)
143 {
144 evas_object_geometry_get(o_snap, &x, &y, NULL, NULL);
145 if (dx > 0)
146 {
147 if (x + dx >= win_w) dx = -dx;
148 }
149 else
150 {
151 if (x + dx <= 0) dx = -dx;
152 }
153 x = x + dx;
154
155 if (dy > 0)
156 {
157 if (y + dy >= win_h) dy = -dy;
158 }
159 else
160 {
161 if (y + dy <= 0) dy = -dy;
162 }
163 x = x + dx;
164
165 evas_object_move(o_snap, x, y);
166 }
167
168 FPS_STD(NAME);
169}
170
171/* prepend special key handlers if interactive (before STD) */
172static void _key(char *key)
173{
174 KEY_STD;
175}
176
177
178
179
180
181
182
183
184
185
186
187
188/* template stuff - ignore */
189# endif
190#endif
191
192#ifdef UI
193_ui_menu_item_add(ICON, NAME, FNAME);
194#endif
195
196#ifdef PROTO
197void FNAME(void);
198#endif
199
200#ifndef PROTO
201# ifndef UI
202void FNAME(void)
203{
204 ui_func_set(_key, _loop);
205 _setup();
206}
207# endif
208#endif
209#undef FNAME
210#undef NAME
211#undef ICON
diff --git a/src/bin/tests.h b/src/bin/tests.h
index 0724ee3..b03d0f0 100644
--- a/src/bin/tests.h
+++ b/src/bin/tests.h
@@ -110,6 +110,7 @@
110#include "vg_basic_circle.c" 110#include "vg_basic_circle.c"
111#include "vg_basic_gradient.c" 111#include "vg_basic_gradient.c"
112#include "vg_scaled.c" 112#include "vg_scaled.c"
113#include "snapshot_widgets_file_icons.c"
113#if 0 // test disabled - evas having code disabled 114#if 0 // test disabled - evas having code disabled
114#include "image_mask_14.c" 115#include "image_mask_14.c"
115#include "image_mask_15.c" 116#include "image_mask_15.c"