diff options
author | Yakov Goldberg <yakov.g@samsung.com> | 2015-06-09 13:28:44 +0300 |
---|---|---|
committer | Cedric BAIL <cedric@osg.samsung.com> | 2015-06-16 17:25:43 +0200 |
commit | 4aa37445c52fc460ea9baddc543fe0202ae74d93 (patch) | |
tree | 234097c80c8eceaba46755040d31eed037372190 | |
parent | 9b7d97d5034de22cf8090f5f598eeceab5aa1165 (diff) |
vector: add a basic test (no change, just moving).
-rw-r--r-- | data/Makefile.am | 3 | ||||
-rw-r--r-- | data/vector.png | bin | 0 -> 1625 bytes | |||
-rw-r--r-- | src/bin/Makefile.am | 3 | ||||
-rw-r--r-- | src/bin/tests.h | 1 | ||||
-rw-r--r-- | src/bin/vg_basic.c | 130 |
5 files changed, 135 insertions, 2 deletions
diff --git a/data/Makefile.am b/data/Makefile.am index 939fc95..3a7182f 100644 --- a/data/Makefile.am +++ b/data/Makefile.am | |||
@@ -55,6 +55,7 @@ data.png \ | |||
55 | widgets.png \ | 55 | widgets.png \ |
56 | e-logo-2.png \ | 56 | e-logo-2.png \ |
57 | e-logo-mask.png \ | 57 | e-logo-mask.png \ |
58 | texture.png | 58 | texture.png \ |
59 | vector.png | ||
59 | 60 | ||
60 | EXTRA_DIST = $(files_DATA) | 61 | EXTRA_DIST = $(files_DATA) |
diff --git a/data/vector.png b/data/vector.png new file mode 100644 index 0000000..a720888 --- /dev/null +++ b/data/vector.png | |||
Binary files differ | |||
diff --git a/src/bin/Makefile.am b/src/bin/Makefile.am index 1cc92a1..253400d 100644 --- a/src/bin/Makefile.am +++ b/src/bin/Makefile.am | |||
@@ -124,7 +124,8 @@ image_mask_9.c \ | |||
124 | image_mask_10.c \ | 124 | image_mask_10.c \ |
125 | image_mask_11.c \ | 125 | image_mask_11.c \ |
126 | image_mask_12.c \ | 126 | image_mask_12.c \ |
127 | image_mask_13.c | 127 | image_mask_13.c \ |
128 | vg_basic.c | ||
128 | # \ | 129 | # \ |
129 | # image_mask_14.c \ | 130 | # image_mask_14.c \ |
130 | # image_mask_15.c | 131 | # image_mask_15.c |
diff --git a/src/bin/tests.h b/src/bin/tests.h index 2189ee4..97b95c9 100644 --- a/src/bin/tests.h +++ b/src/bin/tests.h | |||
@@ -106,6 +106,7 @@ | |||
106 | #include "image_mask_11.c" | 106 | #include "image_mask_11.c" |
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 | #if 0 // test disabled - evas having code disabled | 110 | #if 0 // test disabled - evas having code disabled |
110 | #include "image_mask_14.c" | 111 | #include "image_mask_14.c" |
111 | #include "image_mask_15.c" | 112 | #include "image_mask_15.c" |
diff --git a/src/bin/vg_basic.c b/src/bin/vg_basic.c new file mode 100644 index 0000000..45ea034 --- /dev/null +++ b/src/bin/vg_basic.c | |||
@@ -0,0 +1,130 @@ | |||
1 | #undef FNAME | ||
2 | #undef NAME | ||
3 | #undef ICON | ||
4 | |||
5 | /* metadata */ | ||
6 | #define FNAME vg_basic_start | ||
7 | #define NAME "VG Basic" | ||
8 | #define ICON "vector.png" | ||
9 | |||
10 | #ifndef PROTO | ||
11 | # ifndef UI | ||
12 | # include "main.h" | ||
13 | |||
14 | /* standard var */ | ||
15 | static int done = 0; | ||
16 | |||
17 | /* private data */ | ||
18 | static Eo *o_shapes[OBNUM]; | ||
19 | |||
20 | static 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. */ | ||
29 | static 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(255, 0, 255, 128), | ||
61 | efl_gfx_shape_stroke_join_set(EFL_GFX_JOIN_ROUND)); | ||
62 | } | ||
63 | done = 0; | ||
64 | } | ||
65 | |||
66 | /* cleanup */ | ||
67 | static 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 */ | ||
75 | static 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) */ | ||
91 | static 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 | ||
116 | void FNAME(void); | ||
117 | #endif | ||
118 | |||
119 | #ifndef PROTO | ||
120 | # ifndef UI | ||
121 | void 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 | ||