summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYakov Goldberg <yakov.g@samsung.com>2015-06-23 17:03:49 +0300
committerYakov Goldberg <yakov.g@samsung.com>2015-06-23 17:11:48 +0300
commitb1931c5146f90b9b7767eaad523b460a6b67e84f (patch)
treeba2fedebf204d6cef5de47d5fc5b70e59cd95cc2
parent817b8c3500f647260957512826b618ff012d667e (diff)
vector: add a scaling test
-rw-r--r--src/bin/Makefile.am3
-rw-r--r--src/bin/tests.h1
-rw-r--r--src/bin/vg_scaled.c145
3 files changed, 148 insertions, 1 deletions
diff --git a/src/bin/Makefile.am b/src/bin/Makefile.am
index 253400d..afe6caf 100644
--- a/src/bin/Makefile.am
+++ b/src/bin/Makefile.am
@@ -125,7 +125,8 @@ image_mask_10.c \
125image_mask_11.c \ 125image_mask_11.c \
126image_mask_12.c \ 126image_mask_12.c \
127image_mask_13.c \ 127image_mask_13.c \
128vg_basic.c 128vg_basic.c \
129vg_scaled.c
129# \ 130# \
130# image_mask_14.c \ 131# image_mask_14.c \
131# image_mask_15.c 132# image_mask_15.c
diff --git a/src/bin/tests.h b/src/bin/tests.h
index 97b95c9..ed9e3ef 100644
--- a/src/bin/tests.h
+++ b/src/bin/tests.h
@@ -107,6 +107,7 @@
107#include "image_mask_12.c" 107#include "image_mask_12.c"
108#include "image_mask_13.c" 108#include "image_mask_13.c"
109#include "vg_basic.c" 109#include "vg_basic.c"
110#include "vg_scaled.c"
110#if 0 // test disabled - evas having code disabled 111#if 0 // test disabled - evas having code disabled
111#include "image_mask_14.c" 112#include "image_mask_14.c"
112#include "image_mask_15.c" 113#include "image_mask_15.c"
diff --git a/src/bin/vg_scaled.c b/src/bin/vg_scaled.c
new file mode 100644
index 0000000..1e270a3
--- /dev/null
+++ b/src/bin/vg_scaled.c
@@ -0,0 +1,145 @@
1#undef FNAME
2#undef NAME
3#undef ICON
4
5/* metadata */
6#define FNAME vg_scaled_start
7#define NAME "VG Scaled"
8#define ICON "vector.png"
9
10#ifndef PROTO
11# ifndef UI
12# include "main.h"
13
14/* standard var */
15static int done = 0;
16
17/* private data */
18static Eo *o_objects[OBNUM], *o_shapes[OBNUM], *o_gradient[OBNUM];
19
20static const Efl_Gfx_Gradient_Stop stops[3] = {
21 { 0, 255, 0, 0, 255 },
22 { 0.5, 0, 255, 0, 255 },
23 { 1, 0, 0, 255, 255 }
24};
25
26/* setup
27 * Creating Evas Objects, each holds a vector shape.
28 * Then start moving these Evas Objects. */
29static void _setup(void)
30{
31 unsigned int i;
32
33 for (i = 0; i < OBNUM; i++)
34 {
35 Efl_VG *root, *gradient, *rect;
36 Eo *vector;
37 double w = 70, h = 70, stroke_w = 3;
38
39 vector = eo_add(EVAS_VG_CLASS, evas);
40 o_objects[i] = vector;
41 eo_do(vector,
42 efl_gfx_size_set(w + stroke_w * 2, h + stroke_w * 2),
43 efl_gfx_position_set(0, 0),
44 efl_gfx_visible_set(EINA_TRUE));
45
46 eo_do(vector, root = evas_obj_vg_root_node_get());
47
48 o_gradient[i] = gradient = eo_add(EFL_VG_GRADIENT_LINEAR_CLASS, root);
49 eo_do(gradient,
50 efl_gfx_gradient_stop_set(stops, 3),
51 efl_gfx_gradient_spread_set(EFL_GFX_GRADIENT_SPREAD_REFLECT),
52 efl_gfx_gradient_linear_start_set(10, 10),
53 efl_gfx_gradient_linear_end_set(50, 50));
54
55 o_shapes[i] = rect = eo_add(EFL_VG_SHAPE_CLASS, root);
56 eo_do(rect,
57 efl_gfx_shape_append_rect(0 + stroke_w, 0 + stroke_w, w, h, 10, 10),
58 efl_vg_shape_fill_set(gradient),
59 efl_gfx_shape_stroke_width_set(stroke_w),
60 efl_gfx_shape_stroke_color_set(128, 0, 128, 128),
61 efl_gfx_shape_stroke_join_set(EFL_GFX_JOIN_ROUND));
62 }
63 done = 0;
64}
65
66/* cleanup */
67static void _cleanup(void)
68{
69 unsigned int i;
70
71 for (i = 0; i < OBNUM; i++) eo_del(o_objects[i]);
72}
73
74/* loop - do things */
75static void _loop(double t, int f)
76{
77 int i;
78 Evas_Coord x, y, w, h, w0 = 70, h0 = 70;
79 double stroke_w = 3;
80 for (i = 0; i < OBNUM; i++)
81 {
82 w = 5 + ((1.0 + cos((double)(f + (i * 10)) / (7.4 * SLOW) )) * w0 * 2);
83 h = 5 + ((1.0 + sin((double)(f + (i * 19)) / (12.6 * SLOW) )) * h0 * 2);
84 x = (win_w / 2) - (w / 2);
85 x += sin((double)(f + (i * 13)) / (36.7 * SLOW)) * (w0 / 2);
86 y = (win_h / 2) - (h / 2);
87 y += cos((double)(f + (i * 28)) / (43.8 * SLOW)) * (h0 / 2);
88 eo_do(o_objects[i],
89 efl_gfx_position_set(x, y),
90 efl_gfx_size_set(w + stroke_w * 2, h + stroke_w * 2),
91 efl_gfx_fill_set(0, 0, w, h)
92 );
93 eo_do(o_shapes[i],
94 efl_gfx_shape_reset(),
95 efl_gfx_shape_append_rect(0 + stroke_w, 0 + stroke_w, w, h, 10, 10),
96 efl_vg_shape_fill_set(o_gradient[i]),
97 efl_gfx_shape_stroke_width_set(stroke_w),
98 efl_gfx_shape_stroke_color_set(128, 0, 128, 128),
99 efl_gfx_shape_stroke_join_set(EFL_GFX_JOIN_ROUND));
100
101 }
102 FPS_STD(NAME);
103}
104
105/* prepend special key handlers if interactive (before STD) */
106static void _key(char *key)
107{
108 KEY_STD;
109}
110
111
112
113
114
115
116
117
118
119
120
121
122/* template stuff - ignore */
123# endif
124#endif
125
126#ifdef UI
127_ui_menu_item_add(ICON, NAME, FNAME);
128#endif
129
130#ifdef PROTO
131void FNAME(void);
132#endif
133
134#ifndef PROTO
135# ifndef UI
136void FNAME(void)
137{
138 ui_func_set(_key, _loop);
139 _setup();
140}
141# endif
142#endif
143#undef FNAME
144#undef NAME
145#undef ICON