diff options
-rw-r--r-- | src/Makefile_Evas.am | 21 | ||||
-rw-r--r-- | src/lib/evas/Evas_Eo.h | 86 | ||||
-rw-r--r-- | src/lib/evas/canvas/evas_object_vg.c | 315 | ||||
-rw-r--r-- | src/lib/evas/canvas/evas_vg.eo | 17 | ||||
-rw-r--r-- | src/lib/evas/canvas/evas_vg_container.c | 33 | ||||
-rw-r--r-- | src/lib/evas/canvas/evas_vg_container.eo | 8 | ||||
-rw-r--r-- | src/lib/evas/canvas/evas_vg_gradient.c | 58 | ||||
-rw-r--r-- | src/lib/evas/canvas/evas_vg_gradient.eo | 26 | ||||
-rw-r--r-- | src/lib/evas/canvas/evas_vg_gradient_linear.c | 50 | ||||
-rw-r--r-- | src/lib/evas/canvas/evas_vg_gradient_linear.eo | 27 | ||||
-rw-r--r-- | src/lib/evas/canvas/evas_vg_gradient_radial.c | 64 | ||||
-rw-r--r-- | src/lib/evas/canvas/evas_vg_gradient_radial.eo | 36 | ||||
-rw-r--r-- | src/lib/evas/canvas/evas_vg_node.c | 167 | ||||
-rw-r--r-- | src/lib/evas/canvas/evas_vg_node.eo | 162 | ||||
-rw-r--r-- | src/lib/evas/canvas/evas_vg_private.h | 10 | ||||
-rw-r--r-- | src/lib/evas/canvas/evas_vg_root_node.c | 41 | ||||
-rw-r--r-- | src/lib/evas/canvas/evas_vg_root_node.eo | 8 | ||||
-rw-r--r-- | src/lib/evas/canvas/evas_vg_shape.c | 39 | ||||
-rw-r--r-- | src/lib/evas/canvas/evas_vg_shape.eo | 113 | ||||
-rw-r--r-- | src/lib/evas/include/evas_private.h | 1 |
20 files changed, 1281 insertions, 1 deletions
diff --git a/src/Makefile_Evas.am b/src/Makefile_Evas.am index bd3d377..d2410e3 100644 --- a/src/Makefile_Evas.am +++ b/src/Makefile_Evas.am | |||
@@ -31,7 +31,15 @@ evas_eolian_files = \ | |||
31 | lib/evas/canvas/evas_3d_mesh.eo\ | 31 | lib/evas/canvas/evas_3d_mesh.eo\ |
32 | lib/evas/canvas/evas_3d_node.eo\ | 32 | lib/evas/canvas/evas_3d_node.eo\ |
33 | lib/evas/canvas/evas_3d_scene.eo\ | 33 | lib/evas/canvas/evas_3d_scene.eo\ |
34 | lib/evas/canvas/evas_3d_object.eo | 34 | lib/evas/canvas/evas_3d_object.eo \ |
35 | lib/evas/canvas/evas_vg.eo \ | ||
36 | lib/evas/canvas/evas_vg_node.eo \ | ||
37 | lib/evas/canvas/evas_vg_container.eo \ | ||
38 | lib/evas/canvas/evas_vg_shape.eo \ | ||
39 | lib/evas/canvas/evas_vg_root_node.eo \ | ||
40 | lib/evas/canvas/evas_vg_gradient.eo \ | ||
41 | lib/evas/canvas/evas_vg_gradient_radial.eo \ | ||
42 | lib/evas/canvas/evas_vg_gradient_linear.eo | ||
35 | 43 | ||
36 | evas_eolian_c = $(evas_eolian_files:%.eo=%.eo.c) | 44 | evas_eolian_c = $(evas_eolian_files:%.eo=%.eo.c) |
37 | evas_eolian_h = $(evas_eolian_files:%.eo=%.eo.h) \ | 45 | evas_eolian_h = $(evas_eolian_files:%.eo=%.eo.h) \ |
@@ -176,6 +184,7 @@ lib/evas/file/evas_path.h | |||
176 | lib_evas_libevas_la_SOURCES += \ | 184 | lib_evas_libevas_la_SOURCES += \ |
177 | $(lib_evas_file_SOURCES) | 185 | $(lib_evas_file_SOURCES) |
178 | 186 | ||
187 | # Evas_3D | ||
179 | noinst_HEADERS += \ | 188 | noinst_HEADERS += \ |
180 | lib/evas/include/evas_3d_utils.h | 189 | lib/evas/include/evas_3d_utils.h |
181 | 190 | ||
@@ -201,6 +210,16 @@ modules/evas/model_savers/obj/evas_model_save_obj.c \ | |||
201 | modules/evas/model_savers/ply/evas_model_save_ply.c \ | 210 | modules/evas/model_savers/ply/evas_model_save_ply.c \ |
202 | lib/evas/canvas/evas_3d_eet.c | 211 | lib/evas/canvas/evas_3d_eet.c |
203 | 212 | ||
213 | # Evas_VG | ||
214 | lib_evas_libevas_la_SOURCES += \ | ||
215 | lib/evas/canvas/evas_object_vg.c \ | ||
216 | lib/evas/canvas/evas_vg_node.c \ | ||
217 | lib/evas/canvas/evas_vg_container.c \ | ||
218 | lib/evas/canvas/evas_vg_root_node.c \ | ||
219 | lib/evas/canvas/evas_vg_gradient.c \ | ||
220 | lib/evas/canvas/evas_vg_gradient_linear.c \ | ||
221 | lib/evas/canvas/evas_vg_gradient_radial.c | ||
222 | |||
204 | # Engine | 223 | # Engine |
205 | lib_evas_libevas_la_SOURCES += \ | 224 | lib_evas_libevas_la_SOURCES += \ |
206 | lib/evas/common/evas_op_copy_main_.c \ | 225 | lib/evas/common/evas_op_copy_main_.c \ |
diff --git a/src/lib/evas/Evas_Eo.h b/src/lib/evas/Evas_Eo.h index 34ab6a4..cfadf6d 100644 --- a/src/lib/evas/Evas_Eo.h +++ b/src/lib/evas/Evas_Eo.h | |||
@@ -845,3 +845,89 @@ typedef enum _Evas_3D_Material_Attrib | |||
845 | 845 | ||
846 | #include "canvas/evas_3d_object.eo.h" | 846 | #include "canvas/evas_3d_object.eo.h" |
847 | 847 | ||
848 | /** | ||
849 | * Path command enum. | ||
850 | * | ||
851 | * @since 1.14 | ||
852 | * @ingroup Evas_VG_Shape | ||
853 | */ | ||
854 | typedef enum _Evas_VG_Path_Command | ||
855 | { | ||
856 | EVAS_VG_PATH_COMMAND_TYPE_END = 0, /**< End of the stream of command */ | ||
857 | EVAS_VG_PATH_COMMAND_TYPE_MOVE_TO, /**< A move command type */ | ||
858 | EVAS_VG_PATH_COMMAND_TYPE_LINE_TO, /**< A line command type */ | ||
859 | EVAS_VG_PATH_COMMAND_TYPE_QUADRATIC_TO, /**< A quadratic command type */ | ||
860 | EVAS_VG_PATH_COMMAND_TYPE_SQUADRATIC_TO, /**< A smooth quadratic command type */ | ||
861 | EVAS_VG_PATH_COMMAND_TYPE_CUBIC_TO, /**< A cubic command type */ | ||
862 | EVAS_VG_PATH_COMMAND_TYPE_SCUBIC_TO, /**< A smooth cubic command type */ | ||
863 | EVAS_VG_PATH_COMMAND_TYPE_ARC_TO, /**< An arc command type */ | ||
864 | EVAS_VG_PATH_COMMAND_TYPE_CLOSE, /**< A close command type */ | ||
865 | EVAS_VG_PATH_COMMAND_TYPE_LAST, /**< Not a valid command, but last one according to this version header */ | ||
866 | } Evas_VG_Path_Command; | ||
867 | |||
868 | /** | ||
869 | * Type of abstract VG node | ||
870 | */ | ||
871 | typedef Eo Evas_VG_Node; | ||
872 | |||
873 | |||
874 | /** | ||
875 | * Type describing dash | ||
876 | */ | ||
877 | typedef struct _Evas_VG_Dash Evas_VG_Dash; | ||
878 | struct _Evas_VG_Dash | ||
879 | { | ||
880 | double length; | ||
881 | double gap; | ||
882 | }; | ||
883 | |||
884 | typedef struct _Evas_VG_Gradient_Stop Evas_VG_Gradient_Stop; | ||
885 | struct _Evas_VG_Gradient_Stop | ||
886 | { | ||
887 | double offset; | ||
888 | int r; | ||
889 | int g; | ||
890 | int b; | ||
891 | int a; | ||
892 | }; | ||
893 | |||
894 | typedef enum _Evas_VG_Cap | ||
895 | { | ||
896 | EVAS_VG_CAP_BUTT, | ||
897 | EVAS_VG_CAP_ROUND, | ||
898 | EVAS_VG_CAP_SQUARE, | ||
899 | EVAS_VG_CAP_LAST | ||
900 | } Evas_VG_Cap; | ||
901 | |||
902 | typedef enum _Evas_VG_Join | ||
903 | { | ||
904 | EVAS_VG_JOIN_MITER, | ||
905 | EVAS_VG_JOIN_ROUND, | ||
906 | EVAS_VG_JOIN_BEVEL, | ||
907 | EVAS_VG_JOIN_LAST | ||
908 | } Evas_VG_Join; | ||
909 | |||
910 | typedef enum _Evas_VG_Gradient_Spread | ||
911 | { | ||
912 | EVAS_VG_GRADIENT_SPREAD_PAD, | ||
913 | EVAS_VG_GRADIENT_SPREAD_REFLECT, | ||
914 | EVAS_VG_GRADIENT_SPREAD_REPEAT, | ||
915 | EVAS_VG_GRADIENT_SPREAD_LAST | ||
916 | } Evas_VG_Gradient_Spread; | ||
917 | |||
918 | /** | ||
919 | * @ingroup Evas_Object_VG | ||
920 | * | ||
921 | * @{ | ||
922 | */ | ||
923 | #include "canvas/evas_vg.eo.h" | ||
924 | /** | ||
925 | * @} | ||
926 | */ | ||
927 | |||
928 | #include "canvas/evas_vg_node.eo.h" | ||
929 | #include "canvas/evas_vg_container.eo.h" | ||
930 | #include "canvas/evas_vg_shape.eo.h" | ||
931 | #include "canvas/evas_vg_gradient.eo.h" | ||
932 | #include "canvas/evas_vg_gradient_linear.eo.h" | ||
933 | #include "canvas/evas_vg_gradient_radial.eo.h" | ||
diff --git a/src/lib/evas/canvas/evas_object_vg.c b/src/lib/evas/canvas/evas_object_vg.c new file mode 100644 index 0000000..c956fb8 --- /dev/null +++ b/src/lib/evas/canvas/evas_object_vg.c | |||
@@ -0,0 +1,315 @@ | |||
1 | #include "evas_common_private.h" | ||
2 | #include "evas_private.h" | ||
3 | |||
4 | #include "evas_vg_root_node.eo.h" | ||
5 | |||
6 | #define MY_CLASS EVAS_VG_CLASS | ||
7 | |||
8 | |||
9 | /* private magic number for rectangle objects */ | ||
10 | static const char o_type[] = "rectangle"; | ||
11 | |||
12 | const char *o_vg_type = o_type; | ||
13 | |||
14 | /* private struct for rectangle object internal data */ | ||
15 | typedef struct _Evas_VG_Data Evas_VG_Data; | ||
16 | |||
17 | struct _Evas_VG_Data | ||
18 | { | ||
19 | void *engine_data; | ||
20 | Evas_VG_Node *root; | ||
21 | }; | ||
22 | |||
23 | static void evas_object_vg_render(Evas_Object *eo_obj, | ||
24 | Evas_Object_Protected_Data *obj, | ||
25 | void *type_private_data, | ||
26 | void *output, void *context, void *surface, | ||
27 | int x, int y, Eina_Bool do_async); | ||
28 | static void evas_object_vg_render_pre(Evas_Object *eo_obj, | ||
29 | Evas_Object_Protected_Data *obj, | ||
30 | void *type_private_data); | ||
31 | static void evas_object_vg_render_post(Evas_Object *eo_obj, | ||
32 | Evas_Object_Protected_Data *obj, | ||
33 | void *type_private_data); | ||
34 | static unsigned int evas_object_vg_id_get(Evas_Object *eo_obj); | ||
35 | static unsigned int evas_object_vg_visual_id_get(Evas_Object *eo_obj); | ||
36 | static void *evas_object_vg_engine_data_get(Evas_Object *eo_obj); | ||
37 | static int evas_object_vg_is_opaque(Evas_Object *eo_obj, | ||
38 | Evas_Object_Protected_Data *obj, | ||
39 | void *type_private_data); | ||
40 | static int evas_object_vg_was_opaque(Evas_Object *eo_obj, | ||
41 | Evas_Object_Protected_Data *obj, | ||
42 | void *type_private_data); | ||
43 | |||
44 | static const Evas_Object_Func object_func = | ||
45 | { | ||
46 | /* methods (compulsory) */ | ||
47 | NULL, | ||
48 | evas_object_vg_render, | ||
49 | evas_object_vg_render_pre, | ||
50 | evas_object_vg_render_post, | ||
51 | evas_object_vg_id_get, | ||
52 | evas_object_vg_visual_id_get, | ||
53 | evas_object_vg_engine_data_get, | ||
54 | /* these are optional. NULL = nothing */ | ||
55 | NULL, | ||
56 | NULL, | ||
57 | NULL, | ||
58 | NULL, | ||
59 | evas_object_vg_is_opaque, | ||
60 | evas_object_vg_was_opaque, | ||
61 | NULL, | ||
62 | NULL, | ||
63 | NULL, | ||
64 | NULL, | ||
65 | NULL, | ||
66 | NULL, | ||
67 | NULL | ||
68 | }; | ||
69 | |||
70 | /* the actual api call to add a vector graphic object */ | ||
71 | EAPI Evas_Object * | ||
72 | evas_object_vg_add(Evas *e) | ||
73 | { | ||
74 | MAGIC_CHECK(e, Evas, MAGIC_EVAS); | ||
75 | return NULL; | ||
76 | MAGIC_CHECK_END(); | ||
77 | Evas_Object *eo_obj = eo_add(MY_CLASS, e); | ||
78 | return eo_obj; | ||
79 | } | ||
80 | |||
81 | void | ||
82 | _evas_vg_root_node_set(Eo *obj EINA_UNUSED, Evas_VG_Data *pd, Evas_VG_Node *container) | ||
83 | { | ||
84 | Evas_VG_Node *tmp; | ||
85 | |||
86 | tmp = pd->root; | ||
87 | pd->root = eo_ref(container); | ||
88 | eo_unref(tmp); | ||
89 | } | ||
90 | |||
91 | Evas_VG_Node * | ||
92 | _evas_vg_root_node_get(Eo *obj EINA_UNUSED, Evas_VG_Data *pd) | ||
93 | { | ||
94 | return pd->root; | ||
95 | } | ||
96 | |||
97 | void | ||
98 | _evas_vg_eo_base_constructor(Eo *eo_obj, Evas_VG_Data *pd EINA_UNUSED) | ||
99 | { | ||
100 | Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS); | ||
101 | Eo *parent = NULL; | ||
102 | |||
103 | eo_do_super(eo_obj, MY_CLASS, eo_constructor()); | ||
104 | |||
105 | /* set up methods (compulsory) */ | ||
106 | obj->func = &object_func; | ||
107 | obj->private_data = eo_data_ref(eo_obj, MY_CLASS); | ||
108 | obj->type = o_type; | ||
109 | |||
110 | eo_do(eo_obj, parent = eo_parent_get()); | ||
111 | evas_object_inject(eo_obj, obj, evas_object_evas_get(parent)); | ||
112 | } | ||
113 | |||
114 | static void | ||
115 | evas_object_vg_render(Evas_Object *eo_obj EINA_UNUSED, | ||
116 | Evas_Object_Protected_Data *obj EINA_UNUSED, | ||
117 | void *type_private_data EINA_UNUSED, | ||
118 | void *output EINA_UNUSED, void *context EINA_UNUSED, void *surface EINA_UNUSED, | ||
119 | int x EINA_UNUSED, int y EINA_UNUSED, Eina_Bool do_async EINA_UNUSED) | ||
120 | { | ||
121 | /* render object to surface with context, and offxet by x,y */ | ||
122 | /* obj->layer->evas->engine.func->context_color_set(output, */ | ||
123 | /* context, */ | ||
124 | /* obj->cur->cache.clip.r, */ | ||
125 | /* obj->cur->cache.clip.g, */ | ||
126 | /* obj->cur->cache.clip.b, */ | ||
127 | /* obj->cur->cache.clip.a); */ | ||
128 | /* obj->layer->evas->engine.func->context_anti_alias_set(output, context, */ | ||
129 | /* obj->cur->anti_alias); */ | ||
130 | /* obj->layer->evas->engine.func->context_multiplier_unset(output, */ | ||
131 | /* context); */ | ||
132 | /* obj->layer->evas->engine.func->context_render_op_set(output, context, */ | ||
133 | /* obj->cur->render_op); */ | ||
134 | /* obj->layer->evas->engine.func->rectangle_draw(output, */ | ||
135 | /* context, */ | ||
136 | /* surface, */ | ||
137 | /* obj->cur->geometry.x + x, */ | ||
138 | /* obj->cur->geometry.y + y, */ | ||
139 | /* obj->cur->geometry.w, */ | ||
140 | /* obj->cur->geometry.h, */ | ||
141 | /* do_async); */ | ||
142 | // FIXME: I guess I should create an image, get the pixels data and | ||
143 | // start using that for Cairo. | ||
144 | } | ||
145 | |||
146 | static void | ||
147 | evas_object_vg_render_pre(Evas_Object *eo_obj, | ||
148 | Evas_Object_Protected_Data *obj, | ||
149 | void *type_private_data EINA_UNUSED) | ||
150 | { | ||
151 | int is_v, was_v; | ||
152 | |||
153 | // FIXME: Later on start doing precalc of span and stuff for all shape. | ||
154 | |||
155 | /* dont pre-render the obj twice! */ | ||
156 | if (obj->pre_render_done) return; | ||
157 | obj->pre_render_done = EINA_TRUE; | ||
158 | /* pre-render phase. this does anything an object needs to do just before */ | ||
159 | /* rendering. this could mean loading the image data, retrieving it from */ | ||
160 | /* elsewhere, decoding video etc. */ | ||
161 | /* then when this is done the object needs to figure if it changed and */ | ||
162 | /* if so what and where and add the appropriate redraw rectangles */ | ||
163 | /* if someone is clipping this obj - go calculate the clipper */ | ||
164 | if (obj->cur->clipper) | ||
165 | { | ||
166 | if (obj->cur->cache.clip.dirty) | ||
167 | evas_object_clip_recalc(obj->cur->clipper); | ||
168 | obj->cur->clipper->func->render_pre(obj->cur->clipper->object, | ||
169 | obj->cur->clipper, | ||
170 | obj->cur->clipper->private_data); | ||
171 | } | ||
172 | /* now figure what changed and add draw rects */ | ||
173 | /* if it just became visible or invisible */ | ||
174 | is_v = evas_object_is_visible(eo_obj, obj); | ||
175 | was_v = evas_object_was_visible(eo_obj,obj); | ||
176 | if (!(is_v | was_v)) goto done; | ||
177 | if (is_v != was_v) | ||
178 | { | ||
179 | evas_object_render_pre_visible_change(&obj->layer->evas->clip_changes, eo_obj, is_v, was_v); | ||
180 | goto done; | ||
181 | } | ||
182 | if (obj->changed_map || obj->changed_src_visible) | ||
183 | { | ||
184 | evas_object_render_pre_prev_cur_add(&obj->layer->evas->clip_changes, eo_obj, obj); | ||
185 | goto done; | ||
186 | } | ||
187 | /* it's not visible - we accounted for it appearing or not so just abort */ | ||
188 | if (!is_v) goto done; | ||
189 | /* clipper changed this is in addition to anything else for obj */ | ||
190 | evas_object_render_pre_clipper_change(&obj->layer->evas->clip_changes, eo_obj); | ||
191 | /* if we restacked (layer or just within a layer) and don't clip anyone */ | ||
192 | if ((obj->restack) && (!obj->clip.clipees)) | ||
193 | { | ||
194 | evas_object_render_pre_prev_cur_add(&obj->layer->evas->clip_changes, eo_obj, obj); | ||
195 | goto done; | ||
196 | } | ||
197 | /* if it changed render op */ | ||
198 | if (obj->cur->render_op != obj->prev->render_op) | ||
199 | { | ||
200 | evas_object_render_pre_prev_cur_add(&obj->layer->evas->clip_changes, eo_obj, obj); | ||
201 | goto done; | ||
202 | } | ||
203 | /* if it changed color */ | ||
204 | if ((obj->cur->color.r != obj->prev->color.r) || | ||
205 | (obj->cur->color.g != obj->prev->color.g) || | ||
206 | (obj->cur->color.b != obj->prev->color.b) || | ||
207 | (obj->cur->color.a != obj->prev->color.a)) | ||
208 | { | ||
209 | evas_object_render_pre_prev_cur_add(&obj->layer->evas->clip_changes, eo_obj, obj); | ||
210 | goto done; | ||
211 | } | ||
212 | /* if it changed geometry - and obviously not visibility or color */ | ||
213 | /* calculate differences since we have a constant color fill */ | ||
214 | /* we really only need to update the differences */ | ||
215 | if ((obj->cur->geometry.x != obj->prev->geometry.x) || | ||
216 | (obj->cur->geometry.y != obj->prev->geometry.y) || | ||
217 | (obj->cur->geometry.w != obj->prev->geometry.w) || | ||
218 | (obj->cur->geometry.h != obj->prev->geometry.h)) | ||
219 | { | ||
220 | evas_rects_return_difference_rects(&obj->layer->evas->clip_changes, | ||
221 | obj->cur->geometry.x, | ||
222 | obj->cur->geometry.y, | ||
223 | obj->cur->geometry.w, | ||
224 | obj->cur->geometry.h, | ||
225 | obj->prev->geometry.x, | ||
226 | obj->prev->geometry.y, | ||
227 | obj->prev->geometry.w, | ||
228 | obj->prev->geometry.h); | ||
229 | goto done; | ||
230 | } | ||
231 | /* it obviously didn't change - add a NO obscure - this "unupdates" this */ | ||
232 | /* area so if there were updates for it they get wiped. don't do it if we */ | ||
233 | /* arent fully opaque and we are visible */ | ||
234 | if (evas_object_is_visible(eo_obj, obj) && | ||
235 | evas_object_is_opaque(eo_obj, obj) && | ||
236 | (!obj->clip.clipees)) | ||
237 | { | ||
238 | Evas_Coord x, y, w, h; | ||
239 | |||
240 | x = obj->cur->cache.clip.x; | ||
241 | y = obj->cur->cache.clip.y; | ||
242 | w = obj->cur->cache.clip.w; | ||
243 | h = obj->cur->cache.clip.h; | ||
244 | if (obj->cur->clipper) | ||
245 | { | ||
246 | RECTS_CLIP_TO_RECT(x, y, w, h, | ||
247 | obj->cur->clipper->cur->cache.clip.x, | ||
248 | obj->cur->clipper->cur->cache.clip.y, | ||
249 | obj->cur->clipper->cur->cache.clip.w, | ||
250 | obj->cur->clipper->cur->cache.clip.h); | ||
251 | } | ||
252 | obj->layer->evas->engine.func->output_redraws_rect_del | ||
253 | (obj->layer->evas->engine.data.output, | ||
254 | x + obj->layer->evas->framespace.x, | ||
255 | y + obj->layer->evas->framespace.y, | ||
256 | w, h); | ||
257 | } | ||
258 | done: | ||
259 | evas_object_render_pre_effect_updates(&obj->layer->evas->clip_changes, eo_obj, is_v, was_v); | ||
260 | } | ||
261 | |||
262 | static void | ||
263 | evas_object_vg_render_post(Evas_Object *eo_obj, | ||
264 | Evas_Object_Protected_Data *obj EINA_UNUSED, | ||
265 | void *type_private_data EINA_UNUSED) | ||
266 | { | ||
267 | /* this moves the current data to the previous state parts of the object */ | ||
268 | /* in whatever way is safest for the object. also if we don't need object */ | ||
269 | /* data anymore we can free it if the object deems this is a good idea */ | ||
270 | /* remove those pesky changes */ | ||
271 | evas_object_clip_changes_clean(eo_obj); | ||
272 | /* move cur to prev safely for object data */ | ||
273 | evas_object_cur_prev(eo_obj); | ||
274 | } | ||
275 | |||
276 | static unsigned int | ||
277 | evas_object_vg_id_get(Evas_Object *eo_obj) | ||
278 | { | ||
279 | Evas_VG_Data *o = eo_data_scope_get(eo_obj, MY_CLASS); | ||
280 | if (!o) return 0; | ||
281 | return MAGIC_OBJ_VG; | ||
282 | } | ||
283 | |||
284 | static unsigned int | ||
285 | evas_object_vg_visual_id_get(Evas_Object *eo_obj) | ||
286 | { | ||
287 | Evas_VG_Data *o = eo_data_scope_get(eo_obj, MY_CLASS); | ||
288 | if (!o) return 0; | ||
289 | return MAGIC_OBJ_SHAPE; | ||
290 | } | ||
291 | |||
292 | static void * | ||
293 | evas_object_vg_engine_data_get(Evas_Object *eo_obj) | ||
294 | { | ||
295 | Evas_VG_Data *o = eo_data_scope_get(eo_obj, MY_CLASS); | ||
296 | return o->engine_data; | ||
297 | } | ||
298 | |||
299 | static int | ||
300 | evas_object_vg_is_opaque(Evas_Object *eo_obj EINA_UNUSED, | ||
301 | Evas_Object_Protected_Data *obj EINA_UNUSED, | ||
302 | void *type_private_data EINA_UNUSED) | ||
303 | { | ||
304 | return 0; | ||
305 | } | ||
306 | |||
307 | static int | ||
308 | evas_object_vg_was_opaque(Evas_Object *eo_obj EINA_UNUSED, | ||
309 | Evas_Object_Protected_Data *obj EINA_UNUSED, | ||
310 | void *type_private_data EINA_UNUSED) | ||
311 | { | ||
312 | return 0; | ||
313 | } | ||
314 | |||
315 | #include "evas_vg.eo.c" | ||
diff --git a/src/lib/evas/canvas/evas_vg.eo b/src/lib/evas/canvas/evas_vg.eo new file mode 100644 index 0000000..fef9e8a --- /dev/null +++ b/src/lib/evas/canvas/evas_vg.eo | |||
@@ -0,0 +1,17 @@ | |||
1 | class Evas.VG (Evas.Object) | ||
2 | { | ||
3 | legacy_prefix: evas_object_vg; | ||
4 | eo_prefix: evas_obj_vg; | ||
5 | properties { | ||
6 | root_node { | ||
7 | get { | ||
8 | } | ||
9 | values { | ||
10 | Evas_VG_Node *container; | ||
11 | } | ||
12 | } | ||
13 | } | ||
14 | implements { | ||
15 | Eo.Base.constructor; | ||
16 | } | ||
17 | } \ No newline at end of file | ||
diff --git a/src/lib/evas/canvas/evas_vg_container.c b/src/lib/evas/canvas/evas_vg_container.c new file mode 100644 index 0000000..fc008bb --- /dev/null +++ b/src/lib/evas/canvas/evas_vg_container.c | |||
@@ -0,0 +1,33 @@ | |||
1 | #include "evas_common_private.h" | ||
2 | #include "evas_private.h" | ||
3 | |||
4 | #include "evas_vg_private.h" | ||
5 | |||
6 | #define MY_CLASS EVAS_VG_CONTAINER_CLASS | ||
7 | |||
8 | void | ||
9 | _evas_vg_container_eo_base_constructor(Eo *obj, Evas_VG_Container_Data *pd) | ||
10 | { | ||
11 | Eo *parent; | ||
12 | |||
13 | eo_do_super(obj, MY_CLASS, eo_constructor()); | ||
14 | |||
15 | eo_do(obj, parent = eo_parent_get()); | ||
16 | if (!eo_isa(obj, EVAS_VG_CONTAINER_CLASS) && | ||
17 | !eo_isa(obj, EVAS_VG_CLASS)) | ||
18 | { | ||
19 | ERR("Parent must be either an Evas_Object_VG or an Evas_VG_Container."); | ||
20 | eo_error_set(obj); | ||
21 | } | ||
22 | } | ||
23 | |||
24 | Eina_Bool | ||
25 | _evas_vg_container_evas_vg_node_bound_get(Eo *obj, | ||
26 | Evas_VG_Container_Data *pd, | ||
27 | Eina_Rectangle *r) | ||
28 | { | ||
29 | // FIXME: iterate children and get their boundary to | ||
30 | } | ||
31 | |||
32 | |||
33 | #include "evas_vg_container.eo.c" | ||
diff --git a/src/lib/evas/canvas/evas_vg_container.eo b/src/lib/evas/canvas/evas_vg_container.eo new file mode 100644 index 0000000..423a202 --- /dev/null +++ b/src/lib/evas/canvas/evas_vg_container.eo | |||
@@ -0,0 +1,8 @@ | |||
1 | class Evas.VG_Container (Evas.VG_Node) | ||
2 | { | ||
3 | eo_prefix: evas_vg_container; | ||
4 | implements { | ||
5 | Eo.Base.constructor; | ||
6 | Evas.VG_Node.bound_get; | ||
7 | } | ||
8 | } | ||
diff --git a/src/lib/evas/canvas/evas_vg_gradient.c b/src/lib/evas/canvas/evas_vg_gradient.c new file mode 100644 index 0000000..df7edc6 --- /dev/null +++ b/src/lib/evas/canvas/evas_vg_gradient.c | |||
@@ -0,0 +1,58 @@ | |||
1 | #include "evas_common_private.h" | ||
2 | #include "evas_private.h" | ||
3 | |||
4 | #include <strings.h> | ||
5 | |||
6 | typedef struct _Evas_VG_Gradient_Data Evas_VG_Gradient_Data; | ||
7 | struct _Evas_VG_Gradient_Data | ||
8 | { | ||
9 | // FIXME: Later on we should deduplicate it somehow. | ||
10 | Evas_VG_Gradient_Stop *colors; | ||
11 | unsigned int colors_count; | ||
12 | |||
13 | Evas_VG_Gradient_Spread s; | ||
14 | }; | ||
15 | |||
16 | void | ||
17 | _evas_vg_gradient_stop_set(Eo *obj EINA_UNUSED, | ||
18 | Evas_VG_Gradient_Data *pd, | ||
19 | const Evas_VG_Gradient_Stop *colors, | ||
20 | unsigned int length) | ||
21 | { | ||
22 | pd->colors = realloc(pd->colors, length * sizeof(Evas_VG_Gradient_Stop)); | ||
23 | if (!pd->colors) | ||
24 | { | ||
25 | pd->colors_count = 0; | ||
26 | return ; | ||
27 | } | ||
28 | |||
29 | memcpy(pd->colors, colors, length * sizeof(Evas_VG_Gradient_Stop)); | ||
30 | pd->colors_count = length; | ||
31 | } | ||
32 | |||
33 | void | ||
34 | _evas_vg_gradient_stop_get(Eo *obj EINA_UNUSED, | ||
35 | Evas_VG_Gradient_Data *pd, | ||
36 | const Evas_VG_Gradient_Stop **colors, | ||
37 | unsigned int *length) | ||
38 | { | ||
39 | if (colors) *colors = pd->colors; | ||
40 | if (length) *length = pd->colors_count; | ||
41 | } | ||
42 | |||
43 | void | ||
44 | _evas_vg_gradient_spread_set(Eo *obj EINA_UNUSED, | ||
45 | Evas_VG_Gradient_Data *pd, | ||
46 | Evas_VG_Gradient_Spread s) | ||
47 | { | ||
48 | pd->s = s; | ||
49 | } | ||
50 | |||
51 | Evas_VG_Gradient_Spread | ||
52 | _evas_vg_gradient_spread_get(Eo *obj EINA_UNUSED, | ||
53 | Evas_VG_Gradient_Data *pd) | ||
54 | { | ||
55 | return pd->s; | ||
56 | } | ||
57 | |||
58 | #include "evas_vg_gradient.eo.c" | ||
diff --git a/src/lib/evas/canvas/evas_vg_gradient.eo b/src/lib/evas/canvas/evas_vg_gradient.eo new file mode 100644 index 0000000..549d28a --- /dev/null +++ b/src/lib/evas/canvas/evas_vg_gradient.eo | |||
@@ -0,0 +1,26 @@ | |||
1 | abstract Evas.VG_Gradient (Evas.VG_Node) | ||
2 | { | ||
3 | eo_prefix: evas_vg_gradient; | ||
4 | legacy_prefix: null; | ||
5 | properties { | ||
6 | stop { | ||
7 | set { | ||
8 | } | ||
9 | get { | ||
10 | } | ||
11 | values { | ||
12 | const(Evas_VG_Gradient_Stop) *colors; | ||
13 | uint length; | ||
14 | } | ||
15 | } | ||
16 | spread { | ||
17 | set { | ||
18 | } | ||
19 | get { | ||
20 | } | ||
21 | values { | ||
22 | Evas_VG_Gradient_Spread s; | ||
23 | } | ||
24 | } | ||
25 | } | ||
26 | } | ||
diff --git a/src/lib/evas/canvas/evas_vg_gradient_linear.c b/src/lib/evas/canvas/evas_vg_gradient_linear.c new file mode 100644 index 0000000..9332178 --- /dev/null +++ b/src/lib/evas/canvas/evas_vg_gradient_linear.c | |||
@@ -0,0 +1,50 @@ | |||
1 | #include "evas_common_private.h" | ||
2 | #include "evas_private.h" | ||
3 | |||
4 | #include <strings.h> | ||
5 | |||
6 | typedef struct _Evas_VG_Gradient_Linear_Data Evas_VG_Gradient_Linear_Data; | ||
7 | struct _Evas_VG_Gradient_Linear_Data | ||
8 | { | ||
9 | struct { | ||
10 | double x, y; | ||
11 | } start, end; | ||
12 | }; | ||
13 | |||
14 | void | ||
15 | _evas_vg_gradient_linear_start_set(Eo *obj EINA_UNUSED, | ||
16 | Evas_VG_Gradient_Linear_Data *pd, | ||
17 | double x, double y) | ||
18 | { | ||
19 | pd->start.x = x; | ||
20 | pd->start.y = y; | ||
21 | } | ||
22 | |||
23 | void | ||
24 | _evas_vg_gradient_linear_start_get(Eo *obj EINA_UNUSED, | ||
25 | Evas_VG_Gradient_Linear_Data *pd, | ||
26 | double *x, double *y) | ||
27 | { | ||
28 | if (x) *x = pd->start.x; | ||
29 | if (y) *y = pd->start.y; | ||
30 | } | ||
31 | |||
32 | void | ||
33 | _evas_vg_gradient_linear_end_set(Eo *obj EINA_UNUSED, | ||
34 | Evas_VG_Gradient_Linear_Data *pd, | ||
35 | double x, double y) | ||
36 | { | ||
37 | pd->end.x = x; | ||
38 | pd->end.y = y; | ||
39 | } | ||
40 | |||
41 | void | ||
42 | _evas_vg_gradient_linear_end_get(Eo *obj EINA_UNUSED, | ||
43 | Evas_VG_Gradient_Linear_Data *pd, | ||
44 | double *x, double *y) | ||
45 | { | ||
46 | if (x) *x = pd->end.x; | ||
47 | if (y) *y = pd->end.y; | ||
48 | } | ||
49 | |||
50 | #include "evas_vg_gradient_linear.eo.c" | ||
diff --git a/src/lib/evas/canvas/evas_vg_gradient_linear.eo b/src/lib/evas/canvas/evas_vg_gradient_linear.eo new file mode 100644 index 0000000..07c0539 --- /dev/null +++ b/src/lib/evas/canvas/evas_vg_gradient_linear.eo | |||
@@ -0,0 +1,27 @@ | |||
1 | class Evas.VG_Gradient_Linear (Evas.VG_Gradient) | ||
2 | { | ||
3 | eo_prefix: evas_vg_gradient_linear; | ||
4 | legacy_prefix: null; | ||
5 | properties { | ||
6 | start { | ||
7 | set { | ||
8 | } | ||
9 | get { | ||
10 | } | ||
11 | values { | ||
12 | double x; | ||
13 | double y; | ||
14 | } | ||
15 | } | ||
16 | end { | ||
17 | set { | ||
18 | } | ||
19 | get { | ||
20 | } | ||
21 | values { | ||
22 | double x; | ||
23 | double y; | ||
24 | } | ||
25 | } | ||
26 | } | ||
27 | } | ||
diff --git a/src/lib/evas/canvas/evas_vg_gradient_radial.c b/src/lib/evas/canvas/evas_vg_gradient_radial.c new file mode 100644 index 0000000..04ab5bb --- /dev/null +++ b/src/lib/evas/canvas/evas_vg_gradient_radial.c | |||
@@ -0,0 +1,64 @@ | |||
1 | #include "evas_common_private.h" | ||
2 | #include "evas_private.h" | ||
3 | |||
4 | typedef struct _Evas_VG_Gradient_Radial_Data Evas_VG_Gradient_Radial_Data; | ||
5 | struct _Evas_VG_Gradient_Radial_Data | ||
6 | { | ||
7 | struct { | ||
8 | double x, y; | ||
9 | } center, focal; | ||
10 | double radius; | ||
11 | }; | ||
12 | |||
13 | void | ||
14 | _evas_vg_gradient_radial_center_set(Eo *obj EINA_UNUSED, | ||
15 | Evas_VG_Gradient_Radial_Data *pd, | ||
16 | double x, double y) | ||
17 | { | ||
18 | pd->center.x = x; | ||
19 | pd->center.y = y; | ||
20 | } | ||
21 | |||
22 | void | ||
23 | _evas_vg_gradient_radial_center_get(Eo *obj EINA_UNUSED, | ||
24 | Evas_VG_Gradient_Radial_Data *pd, | ||
25 | double *x, double *y) | ||
26 | { | ||
27 | if (x) *x = pd->center.x; | ||
28 | if (y) *y = pd->center.y; | ||
29 | } | ||
30 | |||
31 | void | ||
32 | _evas_vg_gradient_radial_radius_set(Eo *obj EINA_UNUSED, | ||
33 | Evas_VG_Gradient_Radial_Data *pd, | ||
34 | double r) | ||
35 | { | ||
36 | pd->radius = r; | ||
37 | } | ||
38 | |||
39 | double | ||
40 | _evas_vg_gradient_radial_radius_get(Eo *obj EINA_UNUSED, | ||
41 | Evas_VG_Gradient_Radial_Data *pd) | ||
42 | { | ||
43 | return pd->radius; | ||
44 | } | ||
45 | |||
46 | void | ||
47 | _evas_vg_gradient_radial_focal_set(Eo *obj EINA_UNUSED, | ||
48 | Evas_VG_Gradient_Radial_Data *pd, | ||
49 | double x, double y) | ||
50 | { | ||
51 | pd->focal.x = x; | ||
52 | pd->focal.y = y; | ||
53 | } | ||
54 | |||
55 | void | ||
56 | _evas_vg_gradient_radial_focal_get(Eo *obj EINA_UNUSED, | ||
57 | Evas_VG_Gradient_Radial_Data *pd, | ||
58 | double *x, double *y) | ||
59 | { | ||
60 | if (x) *x = pd->focal.x; | ||
61 | if (y) *y = pd->focal.y; | ||
62 | } | ||
63 | |||
64 | #include "evas_vg_gradient_radial.eo.c" | ||
diff --git a/src/lib/evas/canvas/evas_vg_gradient_radial.eo b/src/lib/evas/canvas/evas_vg_gradient_radial.eo new file mode 100644 index 0000000..0a7d548 --- /dev/null +++ b/src/lib/evas/canvas/evas_vg_gradient_radial.eo | |||
@@ -0,0 +1,36 @@ | |||
1 | class Evas.VG_Gradient_Radial (Evas.VG_Gradient) | ||
2 | { | ||
3 | eo_prefix: evas_vg_gradient_radial; | ||
4 | legacy_prefix: null; | ||
5 | properties { | ||
6 | center { | ||
7 | set { | ||
8 | } | ||
9 | get { | ||
10 | } | ||
11 | values { | ||
12 | double x; | ||
13 | double y; | ||
14 | } | ||
15 | } | ||
16 | radius { | ||
17 | set { | ||
18 | } | ||
19 | get { | ||
20 | } | ||
21 | values { | ||
22 | double r; | ||
23 | } | ||
24 | } | ||
25 | focal { | ||
26 | set { | ||
27 | } | ||
28 | get { | ||
29 | } | ||
30 | values { | ||
31 | double x; | ||
32 | double y; | ||
33 | } | ||
34 | } | ||
35 | } | ||
36 | } | ||
diff --git a/src/lib/evas/canvas/evas_vg_node.c b/src/lib/evas/canvas/evas_vg_node.c new file mode 100644 index 0000000..029b986 --- /dev/null +++ b/src/lib/evas/canvas/evas_vg_node.c | |||
@@ -0,0 +1,167 @@ | |||
1 | #include "evas_common_private.h" | ||
2 | #include "evas_private.h" | ||
3 | |||
4 | #include <string.h> | ||
5 | |||
6 | #define MY_CLASS EVAS_VG_NODE_CLASS | ||
7 | |||
8 | typedef struct _Evas_VG_Node_Data Evas_VG_Node_Data; | ||
9 | struct _Evas_VG_Node_Data | ||
10 | { | ||
11 | Eina_Matrix3 *m; | ||
12 | Evas_VG_Node *mask; | ||
13 | |||
14 | double x, y; | ||
15 | int r, g, b, a; | ||
16 | Eina_Bool visibility; | ||
17 | }; | ||
18 | |||
19 | // FIXME: | ||
20 | // - share private structure with evas_object_vg | ||
21 | // - mark parent canvas evas_object dirty after any change on the object | ||
22 | // - add a virtual render function as part of the private data field | ||
23 | |||
24 | void | ||
25 | _evas_vg_node_transformation_set(Eo *obj EINA_UNUSED, | ||
26 | Evas_VG_Node_Data *pd, | ||
27 | const Eina_Matrix3 *m) | ||
28 | { | ||
29 | if (!pd->m) | ||
30 | { | ||
31 | pd->m = malloc(sizeof (Eina_Matrix3)); | ||
32 | if (!pd->m) return ; | ||
33 | } | ||
34 | memcpy(pd->m, m, sizeof (Eina_Matrix3)); | ||
35 | } | ||
36 | |||
37 | const Eina_Matrix3 * | ||
38 | _evas_vg_node_transformation_get(Eo *obj EINA_UNUSED, Evas_VG_Node_Data *pd) | ||
39 | { | ||
40 | return pd->m; | ||
41 | } | ||
42 | |||
43 | void | ||
44 | _evas_vg_node_origin_set(Eo *obj EINA_UNUSED, | ||
45 | Evas_VG_Node_Data *pd, | ||
46 | double x, double y) | ||
47 | { | ||
48 | pd->x = x; | ||
49 | pd->y = y; | ||
50 | } | ||
51 | |||
52 | void | ||
53 | _evas_vg_node_origin_get(Eo *obj EINA_UNUSED, | ||
54 | Evas_VG_Node_Data *pd, | ||
55 | double *x, double *y) | ||
56 | { | ||
57 | if (x) *x = pd->x; | ||
58 | if (y) *y = pd->y; | ||
59 | } | ||
60 | |||
61 | void | ||
62 | _evas_vg_node_visibility_set(Eo *obj EINA_UNUSED, | ||
63 | Evas_VG_Node_Data *pd, | ||
64 | Eina_Bool v) | ||
65 | { | ||
66 | pd->visibility = v; | ||
67 | } | ||
68 | |||
69 | Eina_Bool | ||
70 | _evas_vg_node_visibility_get(Eo *obj EINA_UNUSED, Evas_VG_Node_Data *pd) | ||
71 | { | ||
72 | return pd->visibility; | ||
73 | } | ||
74 | |||
75 | void | ||
76 | _evas_vg_node_color_set(Eo *obj EINA_UNUSED, | ||
77 | Evas_VG_Node_Data *pd, | ||
78 | int r, int g, int b, int a) | ||
79 | { | ||
80 | pd->r = r; | ||
81 | pd->g = g; | ||
82 | pd->b = b; | ||
83 | pd->a = a; | ||
84 | } | ||
85 | |||
86 | void | ||
87 | _evas_vg_node_color_get(Eo *obj EINA_UNUSED, | ||
88 | Evas_VG_Node_Data *pd, | ||
89 | int *r, int *g, int *b, int *a) | ||
90 | { | ||
91 | if (r) *r = pd->r; | ||
92 | if (g) *g = pd->g; | ||
93 | if (b) *b = pd->b; | ||
94 | if (a) *a = pd->a; | ||
95 | } | ||
96 | |||
97 | void | ||
98 | _evas_vg_node_mask_set(Eo *obj EINA_UNUSED, | ||
99 | Evas_VG_Node_Data *pd, | ||
100 | Evas_VG_Node *r) | ||
101 | { | ||
102 | Evas_VG_Node *tmp = pd->mask; | ||
103 | |||
104 | pd->mask = eo_ref(r); | ||
105 | eo_unref(tmp); | ||
106 | } | ||
107 | |||
108 | Evas_VG_Node* | ||
109 | _evas_vg_node_mask_get(Eo *obj EINA_UNUSED, Evas_VG_Node_Data *pd) | ||
110 | { | ||
111 | return pd->mask; | ||
112 | } | ||
113 | |||
114 | // Parent should be a container otherwise dismissing the stacking operation | ||
115 | void | ||
116 | _evas_vg_node_eo_base_constructor(Eo *obj, Evas_VG_Node_Data *pd) | ||
117 | { | ||
118 | Eo *parent; | ||
119 | |||
120 | eo_do_super(obj, MY_CLASS, eo_constructor()); | ||
121 | eo_do(obj, parent = eo_parent_get()); | ||
122 | if (!eo_isa(parent, EVAS_VG_CONTAINER_CLASS)) | ||
123 | eo_error_set(obj); | ||
124 | } | ||
125 | |||
126 | void | ||
127 | _evas_vg_node_eo_base_parent_set(Eo *obj, Evas_VG_Node_Data *pd, Eo *parent) | ||
128 | { | ||
129 | } | ||
130 | |||
131 | void | ||
132 | _evas_vg_node_raise(Eo *obj, Evas_VG_Node_Data *pd EINA_UNUSED) | ||
133 | { | ||
134 | Eo *parent; | ||
135 | |||
136 | eo_do(obj, parent = eo_parent_get()); | ||
137 | } | ||
138 | |||
139 | void | ||
140 | _evas_vg_node_stack_above(Eo *obj, | ||
141 | Evas_VG_Node_Data *pd EINA_UNUSED, | ||
142 | Evas_VG_Node *above) | ||
143 | { | ||
144 | Eo *parent; | ||
145 | |||
146 | eo_do(obj, parent = eo_parent_get()); | ||
147 | } | ||
148 | |||
149 | void | ||
150 | _evas_vg_node_stack_below(Eo *obj, | ||
151 | Evas_VG_Node_Data *pd EINA_UNUSED, | ||
152 | Evas_Object *below) | ||
153 | { | ||
154 | Eo *parent; | ||
155 | |||
156 | eo_do(obj, parent = eo_parent_get()); | ||
157 | } | ||
158 | |||
159 | void | ||
160 | _evas_vg_node_lower(Eo *obj, Evas_VG_Node_Data *pd EINA_UNUSED) | ||
161 | { | ||
162 | Eo *parent; | ||
163 | |||
164 | eo_do(obj, parent = eo_parent_get()); | ||
165 | } | ||
166 | |||
167 | #include "evas_vg_node.eo.c" | ||
diff --git a/src/lib/evas/canvas/evas_vg_node.eo b/src/lib/evas/canvas/evas_vg_node.eo new file mode 100644 index 0000000..e989f7a --- /dev/null +++ b/src/lib/evas/canvas/evas_vg_node.eo | |||
@@ -0,0 +1,162 @@ | |||
1 | abstract Evas.VG_Node (Eo.Base) | ||
2 | { | ||
3 | eo_prefix: evas_vg_node; | ||
4 | legacy_prefix: null; | ||
5 | properties { | ||
6 | transformation { | ||
7 | set { | ||
8 | } | ||
9 | get { | ||
10 | } | ||
11 | values { | ||
12 | const(Eina_Matrix3) *m; | ||
13 | } | ||
14 | } | ||
15 | origin { | ||
16 | set { | ||
17 | } | ||
18 | get { | ||
19 | } | ||
20 | values { | ||
21 | double x; | ||
22 | double y; | ||
23 | } | ||
24 | } | ||
25 | visibility { | ||
26 | set { | ||
27 | /*@ Makes the given Evas_VG node visible or invisible. */ | ||
28 | } | ||
29 | get { | ||
30 | /*@ Retrieves whether or not the given Evas_VG node is visible. */ | ||
31 | } | ||
32 | values { | ||
33 | Eina_Bool v; /*@ @c EINA_TRUE if to make the object visible, @c EINA_FALSE otherwise */ | ||
34 | } | ||
35 | } | ||
36 | color { | ||
37 | set { | ||
38 | /*@ | ||
39 | Sets the general/main color of the given Evas_VG node to the given | ||
40 | one. | ||
41 | |||
42 | @note These color values are expected to be premultiplied by @p a. | ||
43 | |||
44 | @ingroup Evas_VG_Node_Group */ | ||
45 | } | ||
46 | get { | ||
47 | /*@ | ||
48 | Retrieves the general/main color of the given Evas_VG node. | ||
49 | |||
50 | Retrieves the “main” color's RGB component (and alpha channel) | ||
51 | values, <b>which range from 0 to 255</b>. For the alpha channel, | ||
52 | which defines the object's transparency level, 0 means totally | ||
53 | transparent, while 255 means opaque. These color values are | ||
54 | premultiplied by the alpha value. | ||
55 | |||
56 | @note Use @c NULL pointers on the components you're not interested | ||
57 | in: they'll be ignored by the function. | ||
58 | |||
59 | @ingroup Evas_VG_Node_Group */ | ||
60 | } | ||
61 | values { | ||
62 | int r; /*@ The red component of the given color. */ | ||
63 | int g; /*@ The green component of the given color. */ | ||
64 | int b; /*@ The blue component of the given color. */ | ||
65 | int a; /*@ The alpha component of the given color. */ | ||
66 | } | ||
67 | } | ||
68 | mask { | ||
69 | set { | ||
70 | } | ||
71 | get { | ||
72 | } | ||
73 | values { | ||
74 | Evas_VG_Node *m; | ||
75 | } | ||
76 | } | ||
77 | /* quality { | ||
78 | set { | ||
79 | } | ||
80 | get { | ||
81 | } | ||
82 | values { | ||
83 | Evas_VG_Quality q; | ||
84 | } | ||
85 | } */ | ||
86 | } | ||
87 | methods { | ||
88 | bound_get { | ||
89 | return: bool @warn_unused; | ||
90 | params { | ||
91 | @out Eina_Rectangle r; | ||
92 | } | ||
93 | } | ||
94 | raise { | ||
95 | /*@ | ||
96 | Raise @p obj to the top of its layer. | ||
97 | |||
98 | @p obj will, then, be the highest one in the layer it belongs | ||
99 | to. Object on other layers won't get touched. | ||
100 | |||
101 | @see evas_vg_node_stack_above() | ||
102 | @see evas_vg_node_stack_below() | ||
103 | @see evas_vg_node_lower() */ | ||
104 | } | ||
105 | stack_above { | ||
106 | /*@ | ||
107 | Stack @p obj immediately above @p above | ||
108 | |||
109 | Objects, in a given Evas_VG_Container, are stacked in the order they get added | ||
110 | to it. This means that, if they overlap, the highest ones will | ||
111 | cover the lowest ones, in that order. This function is a way to | ||
112 | change the stacking order for the objects. | ||
113 | |||
114 | This function is intended to be used with <b>objects belonging to | ||
115 | the same container</b>, otherwise it will fail (and | ||
116 | accomplish nothing). | ||
117 | |||
118 | @see evas_vg_node_stack_below() */ | ||
119 | |||
120 | params { | ||
121 | @in Evas_VG_Node *above @nonull; /*@ the object above which to stack */ | ||
122 | } | ||
123 | } | ||
124 | stack_below { | ||
125 | /*@ | ||
126 | Stack @p obj immediately below @p below | ||
127 | |||
128 | Objects, in a given container, are stacked in the order they get added | ||
129 | to it. This means that, if they overlap, the highest ones will | ||
130 | cover the lowest ones, in that order. This function is a way to | ||
131 | change the stacking order for the objects. | ||
132 | |||
133 | This function is intended to be used with <b>objects belonging to | ||
134 | the same container</b>, otherwise it will fail (and | ||
135 | accomplish nothing). | ||
136 | |||
137 | @see evas_vg_node_layer_get() | ||
138 | @see evas_vg_node_layer_set() | ||
139 | @see evas_vg_node_stack_below() */ | ||
140 | |||
141 | params { | ||
142 | @in Evas_Object *below @nonull; /*@ the object below which to stack */ | ||
143 | } | ||
144 | } | ||
145 | lower { | ||
146 | /*@ | ||
147 | Lower @p obj to the bottom of its layer. | ||
148 | |||
149 | @p obj will, then, be the lowest one in the layer it belongs | ||
150 | to. Objects on other layers won't get touched. | ||
151 | |||
152 | @see evas_vg_node_stack_above() | ||
153 | @see evas_vg_node_stack_below() | ||
154 | @see evas_vg_node_raise() */ | ||
155 | } | ||
156 | } | ||
157 | implements { | ||
158 | Eo.Base.parent.set; | ||
159 | Eo.Base.constructor; | ||
160 | @virtual .bound_get; | ||
161 | } | ||
162 | } \ No newline at end of file | ||
diff --git a/src/lib/evas/canvas/evas_vg_private.h b/src/lib/evas/canvas/evas_vg_private.h new file mode 100644 index 0000000..0578b53 --- /dev/null +++ b/src/lib/evas/canvas/evas_vg_private.h | |||
@@ -0,0 +1,10 @@ | |||
1 | #ifndef EVAS_VG_PRIVATE_H_ | ||
2 | # define EVAS_VG_PRIVATE_H_ | ||
3 | |||
4 | typedef struct _Evas_VG_Container_Data Evas_VG_Container_Data; | ||
5 | struct _Evas_VG_Container_Data | ||
6 | { | ||
7 | Eina_List *children; | ||
8 | }; | ||
9 | |||
10 | #endif | ||
diff --git a/src/lib/evas/canvas/evas_vg_root_node.c b/src/lib/evas/canvas/evas_vg_root_node.c new file mode 100644 index 0000000..33f9d218 --- /dev/null +++ b/src/lib/evas/canvas/evas_vg_root_node.c | |||
@@ -0,0 +1,41 @@ | |||
1 | #include "evas_common_private.h" | ||
2 | #include "evas_private.h" | ||
3 | |||
4 | #include "evas_vg_root_node.eo.h" | ||
5 | |||
6 | #include <string.h> | ||
7 | |||
8 | #define MY_CLASS EVAS_VG_ROOT_NODE_CLASS | ||
9 | |||
10 | typedef struct _Evas_VG_Root_Node_Data Evas_VG_Root_Node_Data; | ||
11 | struct _Evas_VG_Root_Node_Data | ||
12 | { | ||
13 | }; | ||
14 | |||
15 | void | ||
16 | _evas_vg_root_node_eo_base_parent_set(Eo *obj, | ||
17 | Evas_VG_Root_Node_Data *pd EINA_UNUSED, | ||
18 | Eo *parent) | ||
19 | { | ||
20 | // Nice little hack, jump over parent parent_set in Evas_VG_Root | ||
21 | eo_do_super(obj, EVAS_VG_NODE_CLASS, eo_constructor()); | ||
22 | if (!eo_isa(parent, EVAS_VG_CLASS) && | ||
23 | !eo_isa(parent, EVAS_VG_CONTAINER_CLASS)) | ||
24 | eo_error_set(obj); | ||
25 | } | ||
26 | |||
27 | void | ||
28 | _evas_vg_root_node_eo_base_constructor(Eo *obj, | ||
29 | Evas_VG_Root_Node_Data *pd EINA_UNUSED) | ||
30 | { | ||
31 | Eo *parent; | ||
32 | |||
33 | // Nice little hack, jump over parent constructor in Evas_VG_Root | ||
34 | eo_do_super(obj, EVAS_VG_NODE_CLASS, eo_constructor()); | ||
35 | eo_do(obj, parent = eo_parent_get()); | ||
36 | if (!eo_isa(parent, EVAS_VG_CLASS) && | ||
37 | !eo_isa(parent, EVAS_VG_CONTAINER_CLASS)) | ||
38 | eo_error_set(obj); | ||
39 | } | ||
40 | |||
41 | #include "evas_vg_root_node.eo.c" | ||
diff --git a/src/lib/evas/canvas/evas_vg_root_node.eo b/src/lib/evas/canvas/evas_vg_root_node.eo new file mode 100644 index 0000000..db0837d --- /dev/null +++ b/src/lib/evas/canvas/evas_vg_root_node.eo | |||
@@ -0,0 +1,8 @@ | |||
1 | class Evas.VG_Root_Node (Evas.VG_Node) | ||
2 | { | ||
3 | eo_prefix: evas_vg_root_node; | ||
4 | implements { | ||
5 | Eo.Base.parent.set; | ||
6 | Eo.Base.constructor; | ||
7 | } | ||
8 | } | ||
diff --git a/src/lib/evas/canvas/evas_vg_shape.c b/src/lib/evas/canvas/evas_vg_shape.c new file mode 100644 index 0000000..878cc7e --- /dev/null +++ b/src/lib/evas/canvas/evas_vg_shape.c | |||
@@ -0,0 +1,39 @@ | |||
1 | #include "evas_common_private.h" | ||
2 | #include "evas_private.h" | ||
3 | |||
4 | #define MY_CLASS EVAS_VG_SHAPE_CLASS | ||
5 | |||
6 | typedef struct _Evas_VG_Shape_Data Evas_VG_Shape_Data; | ||
7 | struct _Evas_VG_Shape_Data | ||
8 | { | ||
9 | Evas_VG_Path_Command *op; | ||
10 | double *points; | ||
11 | unsigned int op_count; | ||
12 | unsigned int pts_counts; | ||
13 | }; | ||
14 | |||
15 | Eina_Bool | ||
16 | _evas_vg_shape_path_set(Eo *obj, Evas_VG_Shape_Data *pd, Evas_VG_Path_Command *op, double *points) | ||
17 | { | ||
18 | } | ||
19 | |||
20 | Eina_Bool | ||
21 | _evas_vg_shape_bounds_get(Eo *obj, Evas_VG_Shape_Data *pd, Eina_Rectangle *r) | ||
22 | { | ||
23 | } | ||
24 | |||
25 | void | ||
26 | _evas_vg_shape_eo_base_constructor(Eo *obj, Evas_VG_Shape_Data *pd) | ||
27 | { | ||
28 | Eo *parent; | ||
29 | |||
30 | eo_super_do(obj, MY_CLASS, eo_constructor()); | ||
31 | |||
32 | eo_do(obj, parent = eo_parent_get()); | ||
33 | if (!eo_isa(obj, EVAS_VG_CONTAINER_CLASS) && | ||
34 | !eo_isa(obj, EVAS_VG_CLASS)) | ||
35 | { | ||
36 | ERR("Parent must be either an Evas_Object_VG or an Evas_VG_Container."); | ||
37 | eo_error_set(obj); | ||
38 | } | ||
39 | } | ||
diff --git a/src/lib/evas/canvas/evas_vg_shape.eo b/src/lib/evas/canvas/evas_vg_shape.eo new file mode 100644 index 0000000..32d959d --- /dev/null +++ b/src/lib/evas/canvas/evas_vg_shape.eo | |||
@@ -0,0 +1,113 @@ | |||
1 | class Evas.VG_Shape (Evas.VG_Node) | ||
2 | { | ||
3 | eo_prefix: evas_vg_shape; | ||
4 | properties { | ||
5 | fill { | ||
6 | set { | ||
7 | } | ||
8 | get { | ||
9 | } | ||
10 | values { | ||
11 | Evas_VG_Node *f; | ||
12 | } | ||
13 | } | ||
14 | stroke_scale { | ||
15 | set { | ||
16 | } | ||
17 | get { | ||
18 | } | ||
19 | values { | ||
20 | double s; | ||
21 | } | ||
22 | } | ||
23 | stroke_color { | ||
24 | set { | ||
25 | } | ||
26 | get { | ||
27 | } | ||
28 | values { | ||
29 | int r; | ||
30 | int g; | ||
31 | int b; | ||
32 | int a; | ||
33 | } | ||
34 | } | ||
35 | stroke_fill { | ||
36 | set { | ||
37 | } | ||
38 | get { | ||
39 | } | ||
40 | values { | ||
41 | Evas_VG_Node *f; | ||
42 | } | ||
43 | } | ||
44 | stroke_width { | ||
45 | set { | ||
46 | } | ||
47 | get { | ||
48 | } | ||
49 | values { | ||
50 | double w; | ||
51 | } | ||
52 | } | ||
53 | stroke_location { | ||
54 | set { | ||
55 | } | ||
56 | get { | ||
57 | } | ||
58 | values { | ||
59 | double centered; | ||
60 | } | ||
61 | } | ||
62 | stroke_dash { | ||
63 | set { | ||
64 | } | ||
65 | get { | ||
66 | } | ||
67 | values { | ||
68 | const(Evas_VG_Dash) *dash; | ||
69 | uint length; | ||
70 | } | ||
71 | } | ||
72 | stroke_marker { | ||
73 | set { | ||
74 | } | ||
75 | get { | ||
76 | } | ||
77 | values { | ||
78 | Evas_VG_Shape *m; | ||
79 | } | ||
80 | } | ||
81 | stroke_cap { | ||
82 | set { | ||
83 | } | ||
84 | get { | ||
85 | } | ||
86 | values { | ||
87 | Evas_VG_Cap c; | ||
88 | } | ||
89 | } | ||
90 | stroke_join { | ||
91 | set { | ||
92 | } | ||
93 | get { | ||
94 | } | ||
95 | values { | ||
96 | Evas_VG_Join j; | ||
97 | } | ||
98 | } | ||
99 | } | ||
100 | methods { | ||
101 | path_set { | ||
102 | return: bool; | ||
103 | params { | ||
104 | @in const(Evas_VG_Path_Command) *op; | ||
105 | @in const(double) *points; | ||
106 | } | ||
107 | } | ||
108 | } | ||
109 | implements { | ||
110 | Eo.Base.constructor; | ||
111 | Eo.Base.destructor; | ||
112 | } | ||
113 | } | ||
diff --git a/src/lib/evas/include/evas_private.h b/src/lib/evas/include/evas_private.h index b1c82e5..bc3421d 100644 --- a/src/lib/evas/include/evas_private.h +++ b/src/lib/evas/include/evas_private.h | |||
@@ -488,6 +488,7 @@ OPAQUE_TYPE(Evas_Font_Instance); /* General type for RGBA_Font_Int */ | |||
488 | #define MAGIC_SMART 0x7c6977c5 | 488 | #define MAGIC_SMART 0x7c6977c5 |
489 | #define MAGIC_OBJ_SHAPE 0x747297f7 | 489 | #define MAGIC_OBJ_SHAPE 0x747297f7 |
490 | #define MAGIC_OBJ_CONTAINER 0x71877776 | 490 | #define MAGIC_OBJ_CONTAINER 0x71877776 |
491 | #define MAGIC_OBJ_VG 0x77817EE7 | ||
491 | #define MAGIC_OBJ_CUSTOM 0x7b7857ab | 492 | #define MAGIC_OBJ_CUSTOM 0x7b7857ab |
492 | #define MAGIC_EVAS_GL 0x77976718 | 493 | #define MAGIC_EVAS_GL 0x77976718 |
493 | #define MAGIC_MAP 0x7575177d | 494 | #define MAGIC_MAP 0x7575177d |