summaryrefslogtreecommitdiff
path: root/src/bin/vg_basic_gradient.c
diff options
context:
space:
mode:
authorYakov Goldberg <yakov.g@samsung.com>2015-06-30 10:58:01 +0300
committerYakov Goldberg <yakov.g@samsung.com>2015-06-30 10:58:01 +0300
commit0d6c86f4ab3b8011a17ea37f1e1967bc771360d0 (patch)
tree365a203058cf06597109e5a66de4acfb2a56957e /src/bin/vg_basic_gradient.c
parentc290c2d15c34f188b1745c7fc92a9d7992316294 (diff)
Rename test: VG Basic -> Vg Basic Gradient
Diffstat (limited to 'src/bin/vg_basic_gradient.c')
-rw-r--r--src/bin/vg_basic_gradient.c130
1 files changed, 130 insertions, 0 deletions
diff --git a/src/bin/vg_basic_gradient.c b/src/bin/vg_basic_gradient.c
new file mode 100644
index 0000000..66ef482
--- /dev/null
+++ b/src/bin/vg_basic_gradient.c
@@ -0,0 +1,130 @@
1#undef FNAME
2#undef NAME
3#undef ICON
4
5/* metadata */
6#define FNAME vg_basic_gradient_start
7#define NAME "VG Basic Gradient"
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_shapes[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_shapes[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 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 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_shapes[i]);
72}
73
74/* loop - do things */
75static void _loop(double t, int f)
76{
77 int i;
78 Evas_Coord x, y, w = 200, h = 200;
79 for (i = 0; i < OBNUM; i++)
80 {
81 x = (win_w / 2) - (w / 2);
82 x += sin((double)(f + (i * 13)) / (36.7 * SLOW)) * (w / 2);
83 y = (win_h / 2) - (h / 2);
84 y += cos((double)(f + (i * 28)) / (43.8 * SLOW)) * (w / 2);
85 eo_do(o_shapes[i], efl_gfx_position_set(x, y));
86 }
87 FPS_STD(NAME);
88}
89
90/* prepend special key handlers if interactive (before STD) */
91static void _key(char *key)
92{
93 KEY_STD;
94}
95
96
97
98
99
100
101
102
103
104
105
106
107/* template stuff - ignore */
108# endif
109#endif
110
111#ifdef UI
112_ui_menu_item_add(ICON, NAME, FNAME);
113#endif
114
115#ifdef PROTO
116void FNAME(void);
117#endif
118
119#ifndef PROTO
120# ifndef UI
121void FNAME(void)
122{
123 ui_func_set(_key, _loop);
124 _setup();
125}
126# endif
127#endif
128#undef FNAME
129#undef NAME
130#undef ICON