diff options
author | Yakov Goldberg <yakov.g@samsung.com> | 2015-06-30 11:26:11 +0300 |
---|---|---|
committer | Yakov Goldberg <yakov.g@samsung.com> | 2015-06-30 11:44:23 +0300 |
commit | cc4fa8a76ea2ea230964516993f87ec3edbda9c3 (patch) | |
tree | 925e31b9f750264da9eed2fceb9e612fdd8d2096 | |
parent | 0d6c86f4ab3b8011a17ea37f1e1967bc771360d0 (diff) |
vector: re-add a basic rect test
-rw-r--r-- | src/bin/Makefile.am | 1 | ||||
-rw-r--r-- | src/bin/tests.h | 1 | ||||
-rw-r--r-- | src/bin/vg_basic_rect.c | 116 |
3 files changed, 118 insertions, 0 deletions
diff --git a/src/bin/Makefile.am b/src/bin/Makefile.am index f3c0b02..25a7847 100644 --- a/src/bin/Makefile.am +++ b/src/bin/Makefile.am | |||
@@ -125,6 +125,7 @@ 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_rect.c \ | ||
128 | vg_basic_gradient.c \ | 129 | vg_basic_gradient.c \ |
129 | vg_scaled.c | 130 | vg_scaled.c |
130 | # \ | 131 | # \ |
diff --git a/src/bin/tests.h b/src/bin/tests.h index f3ecffa..c7894bc 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_rect.c" | ||
109 | #include "vg_basic_gradient.c" | 110 | #include "vg_basic_gradient.c" |
110 | #include "vg_scaled.c" | 111 | #include "vg_scaled.c" |
111 | #if 0 // test disabled - evas having code disabled | 112 | #if 0 // test disabled - evas having code disabled |
diff --git a/src/bin/vg_basic_rect.c b/src/bin/vg_basic_rect.c new file mode 100644 index 0000000..472bcf9 --- /dev/null +++ b/src/bin/vg_basic_rect.c | |||
@@ -0,0 +1,116 @@ | |||
1 | #undef FNAME | ||
2 | #undef NAME | ||
3 | #undef ICON | ||
4 | |||
5 | /* metadata */ | ||
6 | #define FNAME vg_basic_rect_start | ||
7 | #define NAME "VG Basic Rect" | ||
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 | /* setup | ||
21 | * Creating Evas Objects, each holds a vector shape. | ||
22 | * Then start moving these Evas Objects. */ | ||
23 | static void _setup(void) | ||
24 | { | ||
25 | unsigned int i; | ||
26 | |||
27 | for (i = 0; i < OBNUM; i++) | ||
28 | { | ||
29 | Efl_VG *root, *rect; | ||
30 | Eo *vector; | ||
31 | double w = 70, h = 70, stroke_w = 3; | ||
32 | |||
33 | vector = eo_add(EVAS_VG_CLASS, evas); | ||
34 | o_shapes[i] = vector; | ||
35 | eo_do(vector, | ||
36 | efl_gfx_size_set(w + stroke_w * 2, h + stroke_w * 2), | ||
37 | efl_gfx_position_set(0, 0), | ||
38 | efl_gfx_visible_set(EINA_TRUE)); | ||
39 | |||
40 | eo_do(vector, root = evas_obj_vg_root_node_get()); | ||
41 | |||
42 | rect = eo_add(EFL_VG_SHAPE_CLASS, root); | ||
43 | eo_do(rect, | ||
44 | efl_gfx_shape_append_rect(0 + stroke_w, 0 + stroke_w, w, h, 10, 10), | ||
45 | efl_gfx_shape_stroke_width_set(stroke_w), | ||
46 | efl_gfx_shape_stroke_color_set(128, 0, 128, 128), | ||
47 | efl_gfx_shape_stroke_join_set(EFL_GFX_JOIN_ROUND)); | ||
48 | } | ||
49 | done = 0; | ||
50 | } | ||
51 | |||
52 | /* cleanup */ | ||
53 | static void _cleanup(void) | ||
54 | { | ||
55 | unsigned int i; | ||
56 | |||
57 | for (i = 0; i < OBNUM; i++) eo_del(o_shapes[i]); | ||
58 | } | ||
59 | |||
60 | /* loop - do things */ | ||
61 | static void _loop(double t, int f) | ||
62 | { | ||
63 | int i; | ||
64 | Evas_Coord x, y, w = 200, h = 200; | ||
65 | for (i = 0; i < OBNUM; i++) | ||
66 | { | ||
67 | x = (win_w / 2) - (w / 2); | ||
68 | x += sin((double)(f + (i * 13)) / (36.7 * SLOW)) * (w / 2); | ||
69 | y = (win_h / 2) - (h / 2); | ||
70 | y += cos((double)(f + (i * 28)) / (43.8 * SLOW)) * (w / 2); | ||
71 | eo_do(o_shapes[i], efl_gfx_position_set(x, y)); | ||
72 | } | ||
73 | FPS_STD(NAME); | ||
74 | } | ||
75 | |||
76 | /* prepend special key handlers if interactive (before STD) */ | ||
77 | static void _key(char *key) | ||
78 | { | ||
79 | KEY_STD; | ||
80 | } | ||
81 | |||
82 | |||
83 | |||
84 | |||
85 | |||
86 | |||
87 | |||
88 | |||
89 | |||
90 | |||
91 | |||
92 | |||
93 | /* template stuff - ignore */ | ||
94 | # endif | ||
95 | #endif | ||
96 | |||
97 | #ifdef UI | ||
98 | _ui_menu_item_add(ICON, NAME, FNAME); | ||
99 | #endif | ||
100 | |||
101 | #ifdef PROTO | ||
102 | void FNAME(void); | ||
103 | #endif | ||
104 | |||
105 | #ifndef PROTO | ||
106 | # ifndef UI | ||
107 | void FNAME(void) | ||
108 | { | ||
109 | ui_func_set(_key, _loop); | ||
110 | _setup(); | ||
111 | } | ||
112 | # endif | ||
113 | #endif | ||
114 | #undef FNAME | ||
115 | #undef NAME | ||
116 | #undef ICON | ||