summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorsubhransu mohanty <sub.mohanty@samsung.com>2017-10-27 09:24:25 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2017-10-27 14:58:38 +0900
commit4c47200c49ef4e178c4785e8b0b73db93c1ddbe7 (patch)
treedec484d2af2ea82565a9c61d3d33ebc1322c24ba /src/lib
parentd5c882210744eafb75ebec057eadbedd748777fa (diff)
edje: cleanup old implementation of handling svg file.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/edje/edje_data.c424
-rw-r--r--src/lib/edje/edje_edit.c3
-rw-r--r--src/lib/edje/edje_load.c411
-rw-r--r--src/lib/edje/edje_private.h293
4 files changed, 2 insertions, 1129 deletions
diff --git a/src/lib/edje/edje_data.c b/src/lib/edje/edje_data.c
index a11fd07df6..13f94fc51d 100644
--- a/src/lib/edje/edje_data.c
+++ b/src/lib/edje/edje_data.c
@@ -89,429 +89,6 @@ Eet_Data_Descriptor *_edje_edd_edje_part_description_vector = NULL;
89Eet_Data_Descriptor *_edje_edd_edje_part_description_vector_pointer = NULL; 89Eet_Data_Descriptor *_edje_edd_edje_part_description_vector_pointer = NULL;
90 90
91 91
92Eet_Data_Descriptor *_edje_edd_edje_rect_node = NULL;
93Eet_Data_Descriptor *_edje_edd_edje_circle_node = NULL;
94Eet_Data_Descriptor *_edje_edd_edje_ellipse_node = NULL;
95Eet_Data_Descriptor *_edje_edd_edje_gradient_stops_node = NULL;
96Eet_Data_Descriptor *_edje_edd_edje_linear_gradient_node = NULL;
97Eet_Data_Descriptor *_edje_edd_edje_radial_gradient_node = NULL;
98Eet_Data_Descriptor *_edje_edd_edje_style_gradient_node = NULL;
99Eet_Data_Descriptor *_edje_edd_edje_style_property_node = NULL;
100Eet_Data_Descriptor *_edje_edd_edje_matrix3_node = NULL;
101Eet_Data_Descriptor *_edje_edd_edje_doc_node = NULL;
102Eet_Data_Descriptor *_edje_edd_edje_defs_node = NULL;
103Eet_Data_Descriptor *_edje_edd_edje_g_node = NULL;
104Eet_Data_Descriptor *_edje_edd_edje_arc_node = NULL;
105Eet_Data_Descriptor *_edje_edd_edje_path_node = NULL;
106Eet_Data_Descriptor *_edje_edd_edje_polygon_node = NULL;
107Eet_Data_Descriptor *_edje_edd_edje_vg_node = NULL;
108
109#define FREE_DESCRIPTOR(eed) \
110 if (eed) \
111 { \
112 eet_data_descriptor_free((eed)); \
113 (eed) = NULL; \
114 }
115
116
117static inline Eet_Data_Descriptor*
118_eet_for_rect_node(void)
119{
120 Eet_Data_Descriptor *eet;
121 Eet_Data_Descriptor_Class eetc;
122
123 EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(&eetc, Svg_Rect_Node);
124 eet = eet_data_descriptor_stream_new(&eetc);
125 EET_DATA_DESCRIPTOR_ADD_BASIC(eet, Svg_Rect_Node, "x", x, EET_T_DOUBLE);
126 EET_DATA_DESCRIPTOR_ADD_BASIC(eet, Svg_Rect_Node, "y", y, EET_T_DOUBLE);
127 EET_DATA_DESCRIPTOR_ADD_BASIC(eet, Svg_Rect_Node, "w", w, EET_T_DOUBLE);
128 EET_DATA_DESCRIPTOR_ADD_BASIC(eet, Svg_Rect_Node, "h", h, EET_T_DOUBLE);
129 EET_DATA_DESCRIPTOR_ADD_BASIC(eet, Svg_Rect_Node, "rx", rx, EET_T_DOUBLE);
130 EET_DATA_DESCRIPTOR_ADD_BASIC(eet, Svg_Rect_Node, "ry", ry, EET_T_DOUBLE);
131 return eet;
132}
133
134static inline Eet_Data_Descriptor*
135_eet_for_circle_node(void)
136{
137 Eet_Data_Descriptor *eet;
138 Eet_Data_Descriptor_Class eetc;
139
140 EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(&eetc, Svg_Circle_Node);
141 eet = eet_data_descriptor_stream_new(&eetc);
142 EET_DATA_DESCRIPTOR_ADD_BASIC(eet, Svg_Circle_Node, "cx", cx, EET_T_DOUBLE);
143 EET_DATA_DESCRIPTOR_ADD_BASIC(eet, Svg_Circle_Node, "cy", cy, EET_T_DOUBLE);
144 EET_DATA_DESCRIPTOR_ADD_BASIC(eet, Svg_Circle_Node, "r", r, EET_T_DOUBLE);
145 return eet;
146}
147
148static inline Eet_Data_Descriptor*
149_eet_for_ellipse_node(void)
150{
151 Eet_Data_Descriptor *eet;
152 Eet_Data_Descriptor_Class eetc;
153
154 EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(&eetc, Svg_Ellipse_Node);
155 eet = eet_data_descriptor_stream_new(&eetc);
156 EET_DATA_DESCRIPTOR_ADD_BASIC(eet, Svg_Ellipse_Node, "cx", cx, EET_T_DOUBLE);
157 EET_DATA_DESCRIPTOR_ADD_BASIC(eet, Svg_Ellipse_Node, "cy", cy, EET_T_DOUBLE);
158 EET_DATA_DESCRIPTOR_ADD_BASIC(eet, Svg_Ellipse_Node, "rx", rx, EET_T_DOUBLE);
159 EET_DATA_DESCRIPTOR_ADD_BASIC(eet, Svg_Ellipse_Node, "ry", ry, EET_T_DOUBLE);
160 return eet;
161}
162
163
164static inline Eet_Data_Descriptor*
165_eet_for_gradient_stops(void)
166{
167 Eet_Data_Descriptor *eet;
168 Eet_Data_Descriptor_Class eetc;
169
170 EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(&eetc, Efl_Gfx_Gradient_Stop);
171 eet = eet_data_descriptor_stream_new(&eetc);
172 EET_DATA_DESCRIPTOR_ADD_BASIC(eet, Efl_Gfx_Gradient_Stop, "offset", offset, EET_T_DOUBLE);
173 EET_DATA_DESCRIPTOR_ADD_BASIC(eet, Efl_Gfx_Gradient_Stop, "r", r, EET_T_INT);
174 EET_DATA_DESCRIPTOR_ADD_BASIC(eet, Efl_Gfx_Gradient_Stop, "g", g, EET_T_INT);
175 EET_DATA_DESCRIPTOR_ADD_BASIC(eet, Efl_Gfx_Gradient_Stop, "b", b, EET_T_INT);
176 EET_DATA_DESCRIPTOR_ADD_BASIC(eet, Efl_Gfx_Gradient_Stop, "a", a, EET_T_INT);
177 return eet;
178}
179
180static inline Eet_Data_Descriptor*
181_eet_for_linear_gradient(void)
182{
183 Eet_Data_Descriptor *eet;
184 Eet_Data_Descriptor_Class eetc;
185
186 EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(&eetc, Svg_Linear_Gradient);
187 eet = eet_data_descriptor_stream_new(&eetc);
188 EET_DATA_DESCRIPTOR_ADD_BASIC(eet, Svg_Linear_Gradient, "x1", x1, EET_T_DOUBLE);
189 EET_DATA_DESCRIPTOR_ADD_BASIC(eet, Svg_Linear_Gradient, "y1", y1, EET_T_DOUBLE);
190 EET_DATA_DESCRIPTOR_ADD_BASIC(eet, Svg_Linear_Gradient, "x2", x2, EET_T_DOUBLE);
191 EET_DATA_DESCRIPTOR_ADD_BASIC(eet, Svg_Linear_Gradient, "y2", y2, EET_T_DOUBLE);
192 return eet;
193}
194
195static inline Eet_Data_Descriptor*
196_eet_for_radial_gradient(void)
197{
198 Eet_Data_Descriptor *eet;
199 Eet_Data_Descriptor_Class eetc;
200
201 EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(&eetc, Svg_Radial_Gradient);
202 eet = eet_data_descriptor_stream_new(&eetc);
203 EET_DATA_DESCRIPTOR_ADD_BASIC(eet, Svg_Radial_Gradient, "cx", cx, EET_T_DOUBLE);
204 EET_DATA_DESCRIPTOR_ADD_BASIC(eet, Svg_Radial_Gradient, "cy", cy, EET_T_DOUBLE);
205 EET_DATA_DESCRIPTOR_ADD_BASIC(eet, Svg_Radial_Gradient, "fx", fx, EET_T_DOUBLE);
206 EET_DATA_DESCRIPTOR_ADD_BASIC(eet, Svg_Radial_Gradient, "fy", fy, EET_T_DOUBLE);
207 EET_DATA_DESCRIPTOR_ADD_BASIC(eet, Svg_Radial_Gradient, "r", r, EET_T_DOUBLE);
208 return eet;
209}
210
211static inline Eet_Data_Descriptor*
212_eet_for_style_gradient(void)
213{
214 Eet_Data_Descriptor_Class eetc;
215
216 if (_edje_edd_edje_style_gradient_node) return _edje_edd_edje_style_gradient_node;
217
218 EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(&eetc, Svg_Style_Gradient);
219 _edje_edd_edje_style_gradient_node = eet_data_descriptor_stream_new(&eetc);
220 _edje_edd_edje_gradient_stops_node = _eet_for_gradient_stops();
221 _edje_edd_edje_linear_gradient_node = _eet_for_linear_gradient();
222 _edje_edd_edje_radial_gradient_node = _eet_for_radial_gradient();
223
224 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_style_gradient_node, Svg_Style_Gradient, "type", type, EET_T_INT);
225 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_style_gradient_node, Svg_Style_Gradient, "id", id, EET_T_STRING);
226 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_style_gradient_node, Svg_Style_Gradient, "spread", spread, EET_T_INT);
227 EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_edje_style_gradient_node, Svg_Style_Gradient, "stops", stops, _edje_edd_edje_gradient_stops_node);
228 EET_DATA_DESCRIPTOR_ADD_SUB(_edje_edd_edje_style_gradient_node, Svg_Style_Gradient, "radial", radial, _edje_edd_edje_radial_gradient_node);
229 EET_DATA_DESCRIPTOR_ADD_SUB(_edje_edd_edje_style_gradient_node, Svg_Style_Gradient, "linear", linear, _edje_edd_edje_linear_gradient_node);
230
231 return _edje_edd_edje_style_gradient_node;
232}
233
234static inline Eet_Data_Descriptor*
235_eet_for_style_property(void)
236{
237 Eet_Data_Descriptor *eet, *eet_gradient, *eet_dash;
238 Eet_Data_Descriptor_Class eetc, eetc_dash;
239
240 EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(&eetc, Svg_Style_Property);
241 eet = eet_data_descriptor_stream_new(&eetc);
242 eet_gradient = _eet_for_style_gradient();
243
244 EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(&eetc_dash, Efl_Gfx_Dash);
245 eet_dash = eet_data_descriptor_stream_new(&eetc_dash);
246 EET_DATA_DESCRIPTOR_ADD_BASIC(eet_dash, Efl_Gfx_Dash, "length", length, EET_T_DOUBLE);
247 EET_DATA_DESCRIPTOR_ADD_BASIC(eet_dash, Efl_Gfx_Dash, "gap", gap, EET_T_DOUBLE);
248
249 EET_DATA_DESCRIPTOR_ADD_BASIC(eet, Svg_Style_Property, "r", r, EET_T_INT);
250 EET_DATA_DESCRIPTOR_ADD_BASIC(eet, Svg_Style_Property, "g", g, EET_T_INT);
251 EET_DATA_DESCRIPTOR_ADD_BASIC(eet, Svg_Style_Property, "b", b, EET_T_INT);
252 // for fill
253 EET_DATA_DESCRIPTOR_ADD_BASIC(eet, Svg_Style_Property, "fill.flags", fill.flags, EET_T_INT);
254 EET_DATA_DESCRIPTOR_ADD_BASIC(eet, Svg_Style_Property, "fill.paint.r", fill.paint.r, EET_T_INT);
255 EET_DATA_DESCRIPTOR_ADD_BASIC(eet, Svg_Style_Property, "fill.paint.g", fill.paint.g, EET_T_INT);
256 EET_DATA_DESCRIPTOR_ADD_BASIC(eet, Svg_Style_Property, "fill.paint.b", fill.paint.b, EET_T_INT);
257 EET_DATA_DESCRIPTOR_ADD_BASIC(eet, Svg_Style_Property, "fill.paint.none", fill.paint.none, EET_T_INT);
258 EET_DATA_DESCRIPTOR_ADD_BASIC(eet, Svg_Style_Property, "fill.paint.cur_color", fill.paint.cur_color, EET_T_INT);
259 EET_DATA_DESCRIPTOR_ADD_SUB(eet, Svg_Style_Property, "fill.paint.gradient", fill.paint.gradient, eet_gradient);
260 EET_DATA_DESCRIPTOR_ADD_BASIC(eet, Svg_Style_Property, "fill.paint.url", fill.paint.url, EET_T_STRING);
261 EET_DATA_DESCRIPTOR_ADD_BASIC(eet, Svg_Style_Property, "fill.opacity", fill.opacity, EET_T_INT);
262 EET_DATA_DESCRIPTOR_ADD_BASIC(eet, Svg_Style_Property, "fill.fill_rule", fill.fill_rule, EET_T_INT);
263
264 // for stroke
265 EET_DATA_DESCRIPTOR_ADD_BASIC(eet, Svg_Style_Property, "stroke.flags", stroke.flags, EET_T_INT);
266 EET_DATA_DESCRIPTOR_ADD_BASIC(eet, Svg_Style_Property, "stroke.paint.r", stroke.paint.r, EET_T_INT);
267 EET_DATA_DESCRIPTOR_ADD_BASIC(eet, Svg_Style_Property, "stroke.paint.g", stroke.paint.g, EET_T_INT);
268 EET_DATA_DESCRIPTOR_ADD_BASIC(eet, Svg_Style_Property, "stroke.paint.b", stroke.paint.b, EET_T_INT);
269 EET_DATA_DESCRIPTOR_ADD_BASIC(eet, Svg_Style_Property, "stroke.paint.none", stroke.paint.none, EET_T_INT);
270 EET_DATA_DESCRIPTOR_ADD_BASIC(eet, Svg_Style_Property, "stroke.paint.cur_color", stroke.paint.cur_color, EET_T_INT);
271 EET_DATA_DESCRIPTOR_ADD_SUB(eet, Svg_Style_Property, "stroke.paint.gradient", stroke.paint.gradient, eet_gradient);
272 EET_DATA_DESCRIPTOR_ADD_BASIC(eet, Svg_Style_Property, "stroke.paint.url", stroke.paint.url, EET_T_STRING);
273 EET_DATA_DESCRIPTOR_ADD_BASIC(eet, Svg_Style_Property, "stroke.opacity", stroke.opacity, EET_T_INT);
274 EET_DATA_DESCRIPTOR_ADD_BASIC(eet, Svg_Style_Property, "stroke.scale", stroke.scale, EET_T_DOUBLE);
275 EET_DATA_DESCRIPTOR_ADD_BASIC(eet, Svg_Style_Property, "stroke.width", stroke.width, EET_T_DOUBLE);
276 EET_DATA_DESCRIPTOR_ADD_BASIC(eet, Svg_Style_Property, "stroke.centered", stroke.centered, EET_T_DOUBLE);
277 EET_DATA_DESCRIPTOR_ADD_BASIC(eet, Svg_Style_Property, "stroke.cap", stroke.cap, EET_T_INT);
278 EET_DATA_DESCRIPTOR_ADD_BASIC(eet, Svg_Style_Property, "stroke.join", stroke.join, EET_T_INT);
279 EET_DATA_DESCRIPTOR_ADD_VAR_ARRAY(eet, Svg_Style_Property, "stroke.dash", stroke.dash, eet_dash);
280 EET_DATA_DESCRIPTOR_ADD_BASIC(eet, Svg_Style_Property, "stroke.dash_count", stroke.dash_count, EET_T_INT);
281
282 return eet;
283}
284
285static Eet_Data_Descriptor*
286_eet_for_eina_matrix3(void)
287{
288 Eet_Data_Descriptor *eet;
289 Eet_Data_Descriptor_Class eetc;
290
291 EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(&eetc, Eina_Matrix3);
292 eet = eet_data_descriptor_stream_new(&eetc);
293 EET_DATA_DESCRIPTOR_ADD_BASIC(eet, Eina_Matrix3, "xx", xx, EET_T_DOUBLE);
294 EET_DATA_DESCRIPTOR_ADD_BASIC(eet, Eina_Matrix3, "xy", xy, EET_T_DOUBLE);
295 EET_DATA_DESCRIPTOR_ADD_BASIC(eet, Eina_Matrix3, "xz", xz, EET_T_DOUBLE);
296 EET_DATA_DESCRIPTOR_ADD_BASIC(eet, Eina_Matrix3, "yx", yx, EET_T_DOUBLE);
297 EET_DATA_DESCRIPTOR_ADD_BASIC(eet, Eina_Matrix3, "yy", yy, EET_T_DOUBLE);
298 EET_DATA_DESCRIPTOR_ADD_BASIC(eet, Eina_Matrix3, "yz", yz, EET_T_DOUBLE);
299 EET_DATA_DESCRIPTOR_ADD_BASIC(eet, Eina_Matrix3, "zx", zx, EET_T_DOUBLE);
300 EET_DATA_DESCRIPTOR_ADD_BASIC(eet, Eina_Matrix3, "zy", zy, EET_T_DOUBLE);
301 EET_DATA_DESCRIPTOR_ADD_BASIC(eet, Eina_Matrix3, "zz", zz, EET_T_DOUBLE);
302
303 return eet;
304}
305
306static inline Eet_Data_Descriptor*
307_eet_for_doc_node(void)
308{
309 Eet_Data_Descriptor *eet;
310 Eet_Data_Descriptor_Class eetc;
311
312 EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(&eetc, Svg_Doc_Node);
313 eet = eet_data_descriptor_stream_new(&eetc);
314 EET_DATA_DESCRIPTOR_ADD_BASIC(eet, Svg_Doc_Node, "width", width, EET_T_DOUBLE);
315 EET_DATA_DESCRIPTOR_ADD_BASIC(eet, Svg_Doc_Node, "height", height, EET_T_DOUBLE);
316 EET_DATA_DESCRIPTOR_ADD_BASIC(eet, Svg_Doc_Node, "vx", vx, EET_T_DOUBLE);
317 EET_DATA_DESCRIPTOR_ADD_BASIC(eet, Svg_Doc_Node, "vy", vy, EET_T_DOUBLE);
318 EET_DATA_DESCRIPTOR_ADD_BASIC(eet, Svg_Doc_Node, "vw", vw, EET_T_DOUBLE);
319 EET_DATA_DESCRIPTOR_ADD_BASIC(eet, Svg_Doc_Node, "vh", vh, EET_T_DOUBLE);
320 return eet;
321}
322
323static inline Eet_Data_Descriptor*
324_eet_for_defs_node(void)
325{
326 Eet_Data_Descriptor *eet, *eet_gradient;
327 Eet_Data_Descriptor_Class eetc;
328
329 EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(&eetc, Svg_Defs_Node);
330 eet = eet_data_descriptor_stream_new(&eetc);
331 eet_gradient = _eet_for_style_gradient();
332
333 EET_DATA_DESCRIPTOR_ADD_LIST(eet, Svg_Defs_Node, "gradients", gradients, eet_gradient);
334 return eet;
335}
336
337static inline Eet_Data_Descriptor*
338_eet_for_g_node(void)
339{
340 Eet_Data_Descriptor *eet;
341 Eet_Data_Descriptor_Class eetc;
342
343 EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(&eetc, Svg_G_Node);
344 eet = eet_data_descriptor_stream_new(&eetc);
345 return eet;
346}
347
348static inline Eet_Data_Descriptor*
349_eet_for_arc_node(void)
350{
351 Eet_Data_Descriptor *eet;
352 Eet_Data_Descriptor_Class eetc;
353
354 EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(&eetc, Svg_Arc_Node);
355 eet = eet_data_descriptor_stream_new(&eetc);
356 return eet;
357}
358
359static inline Eet_Data_Descriptor*
360_eet_for_polygon_node(void)
361{
362 Eet_Data_Descriptor *eet;
363 Eet_Data_Descriptor_Class eetc;
364
365 EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(&eetc, Svg_Polygon_Node);
366 eet = eet_data_descriptor_stream_new(&eetc);
367 EET_DATA_DESCRIPTOR_ADD_BASIC(eet, Svg_Polygon_Node, "points_count", points_count, EET_T_INT);
368 EET_DATA_DESCRIPTOR_ADD_BASIC_VAR_ARRAY(eet, Svg_Polygon_Node, "points", points, EET_T_DOUBLE);
369 return eet;
370}
371
372static inline Eet_Data_Descriptor*
373_eet_for_path_node(void)
374{
375 Eet_Data_Descriptor *eet;
376 Eet_Data_Descriptor_Class eetc;
377
378 EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(&eetc, Svg_Path_Node);
379 eet = eet_data_descriptor_stream_new(&eetc);
380 EET_DATA_DESCRIPTOR_ADD_BASIC(eet, Svg_Path_Node, "path", path, EET_T_STRING);
381 return eet;
382}
383
384struct
385{
386 Svg_Node_Type u;
387 const char *name;
388} eet_mapping[] = {
389 { SVG_NODE_DOC, "doc" },
390 { SVG_NODE_G, "g" },
391 { SVG_NODE_DEFS, "defs" },
392 { SVG_NODE_ARC, "arc" },
393 { SVG_NODE_CIRCLE, "circle" },
394 { SVG_NODE_ELLIPSE, "ellipse" },
395 { SVG_NODE_POLYGON, "polygon" },
396 { SVG_NODE_POLYLINE, "polyline" },
397 { SVG_NODE_RECT, "rect" },
398 { SVG_NODE_PATH, "path" },
399 { SVG_NODE_UNKNOWN, NULL }
400};
401
402static const char *
403/* union
404 type_get() */
405_union_type_get(const void *data,
406 Eina_Bool *unknow)
407{
408 const Svg_Node_Type *u = data;
409 int i;
410
411 if (unknow)
412 *unknow = EINA_FALSE;
413
414 for (i = 0; eet_mapping[i].name != NULL; ++i)
415 if (*u == eet_mapping[i].u)
416 return eet_mapping[i].name;
417
418 if (unknow)
419 *unknow = EINA_TRUE;
420 return NULL;
421} /* _union_type_get */
422
423static Eina_Bool
424_union_type_set(const char *type,
425 void *data,
426 Eina_Bool unknow)
427{
428 Svg_Node_Type *u = data;
429 int i;
430
431 if (unknow)
432 return EINA_FALSE;
433
434 for (i = 0; eet_mapping[i].name != NULL; ++i)
435 if (strcmp(eet_mapping[i].name, type) == 0)
436 {
437 *u = eet_mapping[i].u;
438 return EINA_TRUE;
439 }
440 return EINA_FALSE;
441} /* _union_type_set */
442
443EAPI Eet_Data_Descriptor *
444_edje_svg_node_eet(void)
445{
446 Eet_Data_Descriptor *eet_union;
447 Eet_Data_Descriptor_Class eetc;
448
449 if (_edje_edd_edje_vg_node) return _edje_edd_edje_vg_node;
450
451 EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(&eetc, Svg_Node);
452 _edje_edd_edje_vg_node = eet_data_descriptor_stream_new(&eetc);
453
454 eetc.version = EET_DATA_DESCRIPTOR_CLASS_VERSION;
455 eetc.func.type_get = _union_type_get;
456 eetc.func.type_set = _union_type_set;
457 eet_union = eet_data_descriptor_stream_new(&eetc);
458
459 _edje_edd_edje_doc_node = _eet_for_doc_node();
460 _edje_edd_edje_g_node = _eet_for_g_node();
461 _edje_edd_edje_defs_node = _eet_for_defs_node();
462 _edje_edd_edje_arc_node = _eet_for_arc_node();
463 _edje_edd_edje_circle_node = _eet_for_circle_node();
464 _edje_edd_edje_ellipse_node = _eet_for_ellipse_node();
465 _edje_edd_edje_rect_node = _eet_for_rect_node();
466 _edje_edd_edje_path_node = _eet_for_path_node();
467 _edje_edd_edje_polygon_node = _eet_for_polygon_node();
468 _edje_edd_edje_style_property_node = _eet_for_style_property();
469 _edje_edd_edje_matrix3_node = _eet_for_eina_matrix3();
470
471
472 EET_DATA_DESCRIPTOR_ADD_MAPPING(eet_union, "doc", _edje_edd_edje_doc_node);
473 EET_DATA_DESCRIPTOR_ADD_MAPPING(eet_union, "g", _edje_edd_edje_g_node);
474 EET_DATA_DESCRIPTOR_ADD_MAPPING(eet_union, "defs", _edje_edd_edje_defs_node);
475 EET_DATA_DESCRIPTOR_ADD_MAPPING(eet_union, "arc", _edje_edd_edje_arc_node);
476 EET_DATA_DESCRIPTOR_ADD_MAPPING(eet_union, "circle", _edje_edd_edje_circle_node);
477 EET_DATA_DESCRIPTOR_ADD_MAPPING(eet_union, "ellipse", _edje_edd_edje_ellipse_node);
478 EET_DATA_DESCRIPTOR_ADD_MAPPING(eet_union, "rect", _edje_edd_edje_rect_node);
479 EET_DATA_DESCRIPTOR_ADD_MAPPING(eet_union, "path", _edje_edd_edje_path_node);
480 EET_DATA_DESCRIPTOR_ADD_MAPPING(eet_union, "polygon", _edje_edd_edje_polygon_node);
481 EET_DATA_DESCRIPTOR_ADD_MAPPING(eet_union, "polyline", _edje_edd_edje_polygon_node);
482
483 EET_DATA_DESCRIPTOR_ADD_UNION(_edje_edd_edje_vg_node, Svg_Node, "node", node, type, eet_union);
484
485
486 EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_edje_vg_node, Svg_Node, "child", child, _edje_edd_edje_vg_node);
487 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_vg_node, Svg_Node, "id", id, EET_T_STRING);
488 EET_DATA_DESCRIPTOR_ADD_SUB(_edje_edd_edje_vg_node, Svg_Node, "style", style, _edje_edd_edje_style_property_node);
489 EET_DATA_DESCRIPTOR_ADD_SUB(_edje_edd_edje_vg_node, Svg_Node, "transform", transform, _edje_edd_edje_matrix3_node);
490
491 return _edje_edd_edje_vg_node;
492}
493
494EAPI void
495_edje_svg_node_destroy_eet(void)
496{
497 FREE_DESCRIPTOR(_edje_edd_edje_rect_node);
498 FREE_DESCRIPTOR(_edje_edd_edje_circle_node);
499 FREE_DESCRIPTOR(_edje_edd_edje_ellipse_node);
500 FREE_DESCRIPTOR(_edje_edd_edje_gradient_stops_node);
501 FREE_DESCRIPTOR(_edje_edd_edje_linear_gradient_node);
502 FREE_DESCRIPTOR(_edje_edd_edje_radial_gradient_node);
503 FREE_DESCRIPTOR(_edje_edd_edje_style_gradient_node);
504 FREE_DESCRIPTOR(_edje_edd_edje_style_property_node);
505 FREE_DESCRIPTOR(_edje_edd_edje_matrix3_node);
506 FREE_DESCRIPTOR(_edje_edd_edje_doc_node);
507 FREE_DESCRIPTOR(_edje_edd_edje_defs_node);
508 FREE_DESCRIPTOR(_edje_edd_edje_g_node);
509 FREE_DESCRIPTOR(_edje_edd_edje_arc_node);
510 FREE_DESCRIPTOR(_edje_edd_edje_path_node);
511 FREE_DESCRIPTOR(_edje_edd_edje_polygon_node);
512 FREE_DESCRIPTOR(_edje_edd_edje_vg_node);
513}
514
515/* allocate a description struct. 92/* allocate a description struct.
516 * this initializes clip_to_id as this field will not be present in most 93 * this initializes clip_to_id as this field will not be present in most
517 * edje files. 94 * edje files.
@@ -751,7 +328,6 @@ _edje_edd_shutdown(void)
751 328
752 FREED(_edje_edd_edje_file); 329 FREED(_edje_edd_edje_file);
753 FREED(_edje_edd_edje_part_collection); 330 FREED(_edje_edd_edje_part_collection);
754 _edje_svg_node_destroy_eet();
755} 331}
756 332
757#define EDJE_DEFINE_POINTER_TYPE(Type, Name) \ 333#define EDJE_DEFINE_POINTER_TYPE(Type, Name) \
diff --git a/src/lib/edje/edje_edit.c b/src/lib/edje/edje_edit.c
index 0a83ff0739..4aebf29726 100644
--- a/src/lib/edje/edje_edit.c
+++ b/src/lib/edje/edje_edit.c
@@ -3231,9 +3231,6 @@ _edje_edit_real_part_add(Evas_Object *obj, const char *name, Edje_Part_Type type
3231 else if (ep->type == EDJE_PART_TYPE_VECTOR) 3231 else if (ep->type == EDJE_PART_TYPE_VECTOR)
3232 { 3232 {
3233 rp->type = EDJE_PART_TYPE_VECTOR; 3233 rp->type = EDJE_PART_TYPE_VECTOR;
3234 rp->typedata.vector = calloc(1, sizeof(Edje_Real_Part_Vector));
3235 if (rp->typedata.vector)
3236 rp->typedata.vector->cur.svg_id = -1;
3237 rp->object = evas_object_vg_add(ed->base.evas); 3234 rp->object = evas_object_vg_add(ed->base.evas);
3238 } 3235 }
3239 else if (ep->type == EDJE_PART_TYPE_IMAGE || ep->type == EDJE_PART_TYPE_PROXY) 3236 else if (ep->type == EDJE_PART_TYPE_IMAGE || ep->type == EDJE_PART_TYPE_PROXY)
diff --git a/src/lib/edje/edje_load.c b/src/lib/edje/edje_load.c
index e6d767736d..94f8c0e401 100644
--- a/src/lib/edje/edje_load.c
+++ b/src/lib/edje/edje_load.c
@@ -27,7 +27,6 @@ struct _Edje_Drag_Items
27}; 27};
28 28
29void _edje_file_add(Edje *ed, const Eina_File *f); 29void _edje_file_add(Edje *ed, const Eina_File *f);
30static void _edje_vector_data_free(Edje *ed);
31 30
32/* START - Nested part support */ 31/* START - Nested part support */
33#define _edje_smart_nested_type "Evas_Smart_Nested" 32#define _edje_smart_nested_type "Evas_Smart_Nested"
@@ -986,15 +985,6 @@ _edje_object_file_set_internal(Evas_Object *obj, const Eina_File *file, const ch
986 if (!rp->typedata.text) memerr = EINA_TRUE; 985 if (!rp->typedata.text) memerr = EINA_TRUE;
987 break; 986 break;
988 987
989 case EDJE_PART_TYPE_VECTOR:
990 rp->type = EDJE_PART_TYPE_VECTOR;
991 rp->typedata.vector = calloc(1, sizeof(Edje_Real_Part_Vector));
992 if (!rp->typedata.vector)
993 memerr = EINA_TRUE;
994 else
995 rp->typedata.vector->cur.svg_id = -1;
996 break;
997
998 case EDJE_PART_TYPE_GROUP: 988 case EDJE_PART_TYPE_GROUP:
999 case EDJE_PART_TYPE_SWALLOW: 989 case EDJE_PART_TYPE_SWALLOW:
1000 case EDJE_PART_TYPE_EXTERNAL: 990 case EDJE_PART_TYPE_EXTERNAL:
@@ -1895,7 +1885,6 @@ _edje_file_del(Edje *ed)
1895 _edje_message_del(ed); 1885 _edje_message_del(ed);
1896 _edje_block_violate(ed); 1886 _edje_block_violate(ed);
1897 _edje_var_shutdown(ed); 1887 _edje_var_shutdown(ed);
1898 _edje_vector_data_free(ed);
1899 if (!((ed->file) && (ed->collection))) 1888 if (!((ed->file) && (ed->collection)))
1900 { 1889 {
1901 if (tev) 1890 if (tev)
@@ -1977,12 +1966,6 @@ _edje_file_del(Edje *ed)
1977 free(rp->typedata.text); 1966 free(rp->typedata.text);
1978 rp->typedata.text = NULL; 1967 rp->typedata.text = NULL;
1979 } 1968 }
1980 else if ((rp->type == EDJE_PART_TYPE_VECTOR) &&
1981 (rp->typedata.vector))
1982 {
1983 free(rp->typedata.vector);
1984 rp->typedata.vector = NULL;
1985 }
1986 else if ((rp->type == EDJE_RP_TYPE_SWALLOW) && 1969 else if ((rp->type == EDJE_RP_TYPE_SWALLOW) &&
1987 (rp->typedata.swallow)) 1970 (rp->typedata.swallow))
1988 { 1971 {
@@ -2682,330 +2665,6 @@ _cb_signal_repeat(void *data, Evas_Object *obj, const char *sig, const char *sou
2682 EDJE_MESSAGE_SIGNAL, 0, &emsg); 2665 EDJE_MESSAGE_SIGNAL, 0, &emsg);
2683} 2666}
2684 2667
2685static Efl_VG *
2686_apply_gradient_property(Svg_Style_Gradient *g)
2687{
2688 Efl_VG *grad_obj = NULL;
2689 Efl_Gfx_Gradient_Stop *stops, *stop;
2690 int stop_count = 0, i = 0;
2691 Eina_List *l;
2692
2693 if (g->type == SVG_LINEAR_GRADIENT)
2694 {
2695 grad_obj = efl_add(EFL_VG_GRADIENT_LINEAR_CLASS, NULL);
2696 evas_vg_gradient_linear_start_set(grad_obj, g->linear->x1, g->linear->y1);
2697 evas_vg_gradient_linear_end_set(grad_obj, g->linear->x2, g->linear->y2);
2698 }
2699 else if (g->type == SVG_RADIAL_GRADIENT)
2700 {
2701 grad_obj = efl_add(EFL_VG_GRADIENT_RADIAL_CLASS, NULL);
2702 evas_vg_gradient_radial_center_set(grad_obj, g->radial->cx, g->radial->cy);
2703 evas_vg_gradient_radial_radius_set(grad_obj, g->radial->r);
2704 evas_vg_gradient_radial_focal_set(grad_obj, g->radial->fx, g->radial->fy);
2705 }
2706 else
2707 {
2708 // not a known gradient
2709 return NULL;
2710 }
2711 // apply common prperty
2712 evas_vg_gradient_spread_set(grad_obj, g->spread);
2713 // update the stops
2714 stop_count = eina_list_count(g->stops);
2715 if (stop_count)
2716 {
2717 stops = calloc(stop_count, sizeof(Efl_Gfx_Gradient_Stop));
2718 i = 0;
2719 EINA_LIST_FOREACH(g->stops, l, stop)
2720 {
2721 stops[i].r = stop->r;
2722 stops[i].g = stop->g;
2723 stops[i].b = stop->b;
2724 stops[i].a = stop->a;
2725 stops[i].offset = stop->offset;
2726 i++;
2727 }
2728 evas_vg_gradient_stop_set(grad_obj, stops, stop_count);
2729 free(stops);
2730 }
2731 return grad_obj;
2732}
2733
2734// vg tree creation
2735static void
2736_apply_vg_property(Svg_Node *node, Efl_VG *vg)
2737{
2738 Svg_Style_Property *style = node->style;
2739
2740 // update the vg name
2741 if (node->id)
2742 evas_vg_node_name_set(vg, node->id);
2743
2744 // apply the transformation
2745 if (node->transform)
2746 evas_vg_node_transformation_set(vg, node->transform);
2747
2748 if (node->type == SVG_NODE_G) return;
2749
2750 // apply the fill style property
2751 efl_gfx_shape_fill_rule_set(vg, style->fill.fill_rule);
2752 // if fill property is NULL then do nothing
2753 if (style->fill.paint.none)
2754 {
2755 //do nothing
2756 }
2757 else if (style->fill.paint.gradient)
2758 {
2759 // if the fill has gradient then apply.
2760 evas_vg_shape_fill_set(vg, _apply_gradient_property(style->fill.paint.gradient));
2761 }
2762 else if (style->fill.paint.cur_color)
2763 {
2764 // apply the current style color
2765 evas_vg_node_color_set(vg, style->r, style->g,
2766 style->b, style->fill.opacity);
2767 }
2768 else
2769 {
2770 // apply the fill color
2771 evas_vg_node_color_set(vg, style->fill.paint.r, style->fill.paint.g,
2772 style->fill.paint.b, style->fill.opacity);
2773 }
2774
2775 // apply the stroke style property
2776 //@TODO HACK, fix the below api to take the stroke width as pixels
2777 evas_vg_shape_stroke_width_set(vg, style->stroke.width/2.0);
2778 evas_vg_shape_stroke_cap_set(vg, style->stroke.cap);
2779 evas_vg_shape_stroke_join_set(vg, style->stroke.join);
2780 evas_vg_shape_stroke_scale_set(vg, style->stroke.scale);
2781 // if stroke property is NULL then do nothing
2782 if (style->stroke.paint.none)
2783 {
2784 //do nothing
2785 }
2786 else if (style->stroke.paint.gradient)
2787 {
2788 // if the fill has gradient then apply.
2789 evas_vg_shape_stroke_fill_set(vg, _apply_gradient_property(style->stroke.paint.gradient));
2790 }
2791 else if (style->stroke.paint.url)
2792 {
2793 // apply the color pointed by url
2794 // TODO
2795 }
2796 else if (style->stroke.paint.cur_color)
2797 {
2798 // apply the current style color
2799 evas_vg_shape_stroke_color_set(vg, style->r, style->g,
2800 style->b, style->stroke.opacity);
2801 }
2802 else
2803 {
2804 // apply the stroke color
2805 evas_vg_shape_stroke_color_set(vg, style->stroke.paint.r, style->stroke.paint.g,
2806 style->stroke.paint.b, style->stroke.opacity);
2807 }
2808}
2809
2810static void
2811_add_polyline(Efl_VG *vg, double *array, int size, Eina_Bool polygon)
2812{
2813 int i;
2814
2815 if (size < 2) return;
2816
2817 evas_vg_shape_append_move_to(vg, array[0], array[1]);
2818 for (i=2; i < size; i+=2)
2819 evas_vg_shape_append_line_to(vg, array[i], array[i+1]);
2820
2821 if (polygon)
2822 evas_vg_shape_append_close(vg);
2823}
2824
2825static void
2826_create_vg_node(Svg_Node *node, Efl_VG *parent)
2827{
2828 Efl_VG *vg = NULL;
2829 Svg_Node *child;
2830 Eina_List *l;
2831
2832 switch (node->type)
2833 {
2834 case SVG_NODE_G:
2835 {
2836 vg = evas_vg_container_add(parent);
2837 _apply_vg_property(node, vg);
2838 EINA_LIST_FOREACH(node->child, l, child)
2839 {
2840 _create_vg_node(child, vg);
2841 }
2842 return;
2843 }
2844 break;
2845 case SVG_NODE_PATH:
2846 vg = evas_vg_shape_add(parent);
2847 evas_vg_shape_append_svg_path(vg, node->node.path.path);
2848 break;
2849 case SVG_NODE_POLYGON:
2850 vg = evas_vg_shape_add(parent);
2851 _add_polyline(vg, node->node.polygon.points, node->node.polygon.points_count, EINA_TRUE);
2852 break;
2853 case SVG_NODE_POLYLINE:
2854 vg = evas_vg_shape_add(parent);
2855 _add_polyline(vg, node->node.polyline.points, node->node.polyline.points_count, EINA_FALSE);
2856 break;
2857 case SVG_NODE_ELLIPSE:
2858 vg = evas_vg_shape_add(parent);
2859 evas_vg_shape_append_arc(vg, node->node.ellipse.cx - node->node.ellipse.rx,
2860 node->node.ellipse.cy - node->node.ellipse.ry,
2861 2*node->node.ellipse.rx, 2*node->node.ellipse.ry, 0, 360);
2862 evas_vg_shape_append_close(vg);
2863 break;
2864 case SVG_NODE_CIRCLE:
2865 vg = evas_vg_shape_add(parent);
2866 evas_vg_shape_append_circle(vg, node->node.circle.cx, node->node.circle.cy, node->node.circle.r);
2867 break;
2868 case SVG_NODE_RECT:
2869 vg = evas_vg_shape_add(parent);
2870 evas_vg_shape_append_rect(vg, node->node.rect.x, node->node.rect.y, node->node.rect.w, node->node.rect.h,
2871 node->node.rect.rx, node->node.rect.ry);
2872 break;
2873 default:
2874 break;
2875 }
2876 _apply_vg_property(node, vg);
2877}
2878
2879static void
2880_edje_vector_data_free(Edje *ed)
2881{
2882 Edje_Vector_Data *vector;
2883
2884 EINA_LIST_FREE(ed->vector_cache, vector)
2885 {
2886 if (vector->vg) efl_del(vector->vg);
2887 free(vector);
2888 }
2889}
2890
2891Edje_Vector_Data *
2892_edje_ref_vector_data(Edje *ed, int svg_id)
2893{
2894 Eina_List *l;
2895 Edje_Vector_Data *vector;
2896 char svg_key[20];
2897 Eet_Data_Descriptor *svg_node_eet;
2898 Svg_Node *child;
2899 Svg_Node *node;
2900 Efl_VG *root = NULL;
2901
2902 // check in the cache
2903 EINA_LIST_FOREACH(ed->vector_cache, l, vector)
2904 {
2905 if (vector->svg_id == svg_id)
2906 return vector;
2907 }
2908
2909 // create and put it in the cache.
2910 vector = calloc(1, sizeof(Edje_Vector_Data));
2911 vector->svg_id = svg_id;
2912
2913 snprintf(svg_key, sizeof(svg_key), "edje/vectors/%i", svg_id);
2914 svg_node_eet = _edje_svg_node_eet();
2915 node = eet_data_read(ed->file->ef, svg_node_eet, svg_key);
2916
2917 if (!node || (node->type != SVG_NODE_DOC))
2918 {
2919 ERR("Failed to read Data from Eet for svg : %d", svg_id);
2920 root = NULL;
2921 }
2922 else
2923 {
2924 root = evas_vg_container_add(NULL);
2925 EINA_LIST_FOREACH(node->child, l, child)
2926 {
2927 _create_vg_node(child, root);
2928 }
2929 vector->x = node->node.doc.vx;
2930 vector->y = node->node.doc.vy;
2931 vector->w = node->node.doc.vw;
2932 vector->h = node->node.doc.vh;
2933 }
2934 vector->vg = root;
2935 ed->vector_cache = eina_list_append(ed->vector_cache, vector);
2936 _edje_svg_node_free(node);
2937 return vector;
2938}
2939
2940static void
2941_apply_stroke_scale(Efl_VG *node, double scale)
2942{
2943 Efl_VG *child;
2944 Eina_Iterator *itr;
2945
2946 if (efl_isa(node, EFL_VG_CONTAINER_CLASS))
2947 {
2948 itr = efl_vg_container_children_get(node);
2949 EINA_ITERATOR_FOREACH(itr, child)
2950 _apply_stroke_scale(child, scale);
2951 eina_iterator_free(itr);
2952 }
2953 else
2954 {
2955 evas_vg_shape_stroke_scale_set(node, scale);
2956 }
2957}
2958
2959void
2960_apply_transformation(Efl_VG *root, double w, double h, Edje_Vector_Data *vg_data)
2961{
2962 double sx, sy, scale;
2963 Eina_Matrix3 m;
2964
2965 sx = w/vg_data->w;
2966 sy = h/vg_data->h;
2967 scale = sx < sy ? sx: sy;
2968 eina_matrix3_identity(&m);
2969 // allign hcenter and vcenter
2970 //@TODO take care of the preserveaspectratio attribute
2971 eina_matrix3_translate(&m, (w - vg_data->w * scale)/2.0, (h - vg_data->h * scale)/2.0);
2972 eina_matrix3_scale(&m, scale, scale);
2973 eina_matrix3_translate(&m, -vg_data->x, -vg_data->y);
2974 evas_vg_node_transformation_set(root, &m);
2975 _apply_stroke_scale(root, scale);
2976}
2977
2978
2979void
2980_edje_dupe_vector_data(Edje *ed, int svg_id, double width, double height,
2981 Edje_Vector_Data *data)
2982{
2983 Edje_Vector_Data *vector;
2984 Efl_VG *root;
2985
2986 vector = _edje_ref_vector_data(ed, svg_id);
2987 if (!vector->vg)
2988 {
2989 data->vg = NULL;
2990 return;
2991 }
2992
2993 root = evas_vg_container_add(NULL);
2994 efl_vg_dup(root, vector->vg);
2995
2996 if (!EINA_DBL_EQ(vector->w, 0) &&
2997 !EINA_DBL_EQ(vector->h, 0))
2998 {
2999 _apply_transformation(root, width, height, vector);
3000 }
3001
3002 data->vg = root;
3003 data->x = vector->x;
3004 data->y = vector->y;
3005 data->w = vector->w;
3006 data->h = vector->h;
3007}
3008
3009EAPI Eina_Bool 2668EAPI Eina_Bool
3010edje_3d_object_add(Evas_Object *obj, Eo **root_node, Eo *scene) 2669edje_3d_object_add(Evas_Object *obj, Eo **root_node, Eo *scene)
3011{ 2670{
@@ -3061,73 +2720,3 @@ edje_3d_object_add(Evas_Object *obj, Eo **root_node, Eo *scene)
3061 return EINA_TRUE; 2720 return EINA_TRUE;
3062} 2721}
3063 2722
3064static void
3065_svg_style_gradient_free(Svg_Style_Gradient *grad)
3066{
3067 Efl_Gfx_Gradient_Stop *stop;
3068
3069 if (!grad) return;
3070
3071 eina_stringshare_del(grad->id);
3072 eina_stringshare_del(grad->ref);
3073 free(grad->radial);
3074 free(grad->linear);
3075
3076 EINA_LIST_FREE(grad->stops, stop)
3077 {
3078 free(stop);
3079 }
3080 free(grad);
3081}
3082
3083static void
3084_node_style_free(Svg_Style_Property *style)
3085{
3086 if (!style) return;
3087
3088 _svg_style_gradient_free(style->fill.paint.gradient);
3089 eina_stringshare_del(style->fill.paint.url);
3090 _svg_style_gradient_free(style->stroke.paint.gradient);
3091 eina_stringshare_del(style->stroke.paint.url);
3092 free(style);
3093}
3094
3095EAPI void
3096_edje_svg_node_free(Svg_Node *node)
3097{
3098 Svg_Node *child;
3099 Svg_Style_Gradient *grad;
3100
3101 if (!node) return;
3102
3103 EINA_LIST_FREE(node->child, child)
3104 {
3105 _edje_svg_node_free(child);
3106 }
3107
3108 eina_stringshare_del(node->id);
3109 free(node->transform);
3110 _node_style_free(node->style);
3111 switch (node->type)
3112 {
3113 case SVG_NODE_PATH:
3114 eina_stringshare_del(node->node.path.path);
3115 break;
3116 case SVG_NODE_POLYGON:
3117 case SVG_NODE_POLYLINE:
3118 free(node->node.polygon.points);
3119 break;
3120 case SVG_NODE_DOC:
3121 _edje_svg_node_free(node->node.doc.defs);
3122 break;
3123 case SVG_NODE_DEFS:
3124 EINA_LIST_FREE(node->node.defs.gradients, grad)
3125 {
3126 _svg_style_gradient_free(grad);
3127 }
3128 break;
3129 default:
3130 break;
3131 }
3132 free(node);
3133}
diff --git a/src/lib/edje/edje_private.h b/src/lib/edje/edje_private.h
index 2096362a89..5063b0080b 100644
--- a/src/lib/edje/edje_private.h
+++ b/src/lib/edje/edje_private.h
@@ -385,8 +385,6 @@ typedef struct _Edje_Part_Limit Edje_Part_Limit;
385typedef struct _Edje_Part_Description_Vector Edje_Part_Description_Vector; 385typedef struct _Edje_Part_Description_Vector Edje_Part_Description_Vector;
386typedef struct _Edje_Part_Description_Spec_Svg Edje_Part_Description_Spec_Svg; 386typedef struct _Edje_Part_Description_Spec_Svg Edje_Part_Description_Spec_Svg;
387typedef struct _Edje_Part_Allowed_Seat Edje_Part_Allowed_Seat; 387typedef struct _Edje_Part_Allowed_Seat Edje_Part_Allowed_Seat;
388typedef struct _Edje_Real_Part_Vector Edje_Real_Part_Vector;
389typedef struct _Edje_Vector_Data Edje_Vector_Data;
390 388
391typedef struct _Edje Edje; 389typedef struct _Edje Edje;
392typedef struct _Edje_Real_Part_Text Edje_Real_Part_Text; 390typedef struct _Edje_Real_Part_Text Edje_Real_Part_Text;
@@ -1694,7 +1692,6 @@ struct _Edje
1694 Eina_List *subobjs; 1692 Eina_List *subobjs;
1695 Eina_List *text_insert_filter_callbacks; 1693 Eina_List *text_insert_filter_callbacks;
1696 Eina_List *markup_filter_callbacks; 1694 Eina_List *markup_filter_callbacks;
1697 Eina_List *vector_cache; /* list of Edje_Vector_Data */
1698 1695
1699 Eina_List *groups; 1696 Eina_List *groups;
1700 1697
@@ -1996,19 +1993,6 @@ struct _Edje_Real_Part_Swallow
1996 } swallow_params; // 28 // FIXME: only if type SWALLOW 1993 } swallow_params; // 28 // FIXME: only if type SWALLOW
1997}; 1994};
1998 1995
1999struct _Edje_Vector_Data
2000{
2001 int svg_id;
2002 double x, y, w, h;
2003 Eina_Bool preserve_aspect;
2004 Efl_VG *vg;
2005};
2006
2007struct _Edje_Real_Part_Vector
2008{
2009 Edje_Vector_Data cur;
2010};
2011
2012struct _Edje_Real_Part 1996struct _Edje_Real_Part
2013{ 1997{
2014 Edje_Real_Part_State param1; // 32 1998 Edje_Real_Part_State param1; // 32
@@ -2031,7 +2015,6 @@ struct _Edje_Real_Part
2031 Edje_Real_Part_Text *text; 2015 Edje_Real_Part_Text *text;
2032 Edje_Real_Part_Container *container; 2016 Edje_Real_Part_Container *container;
2033 Edje_Real_Part_Swallow *swallow; 2017 Edje_Real_Part_Swallow *swallow;
2034 Edje_Real_Part_Vector *vector;
2035 } typedata; // 4 2018 } typedata; // 4
2036 FLOAT_T description_pos; // 8 2019 FLOAT_T description_pos; // 8
2037 Edje_Rectangle req; // 16 2020 Edje_Rectangle req; // 16
@@ -2248,13 +2231,13 @@ struct _Edje_Patterns
2248 2231
2249 int ref; 2232 int ref;
2250 Eina_Bool delete_me : 1; 2233 Eina_Bool delete_me : 1;
2251 2234
2252 size_t patterns_size; 2235 size_t patterns_size;
2253 size_t max_length; 2236 size_t max_length;
2254 unsigned int finals[]; 2237 unsigned int finals[];
2255}; 2238};
2256 2239
2257typedef enum _Edje_User_Defined_Type 2240typedef enum _Edje_User_Defined_Type
2258{ 2241{
2259 EDJE_USER_SWALLOW, 2242 EDJE_USER_SWALLOW,
2260 EDJE_USER_BOX_PACK, 2243 EDJE_USER_BOX_PACK,
@@ -3185,278 +3168,6 @@ void _edje_object_part_text_insert(Edje *ed, Edje_Real_Part *rp, const char *tex
3185 3168
3186void _edje_internal_proxy_shutdown(void); 3169void _edje_internal_proxy_shutdown(void);
3187 3170
3188// Svg loader
3189typedef enum _Svg_Node_Type Svg_Node_Type;
3190typedef enum _Svg_Length_Type Svg_Length_Type;
3191
3192typedef struct _Svg_Node Svg_Node;
3193typedef struct _Svg_Doc_Node Svg_Doc_Node;
3194typedef struct _Svg_G_Node Svg_G_Node;
3195typedef struct _Svg_Defs_Node Svg_Defs_Node;
3196typedef struct _Svg_Arc_Node Svg_Arc_Node;
3197typedef struct _Svg_Circle_Node Svg_Circle_Node;
3198typedef struct _Svg_Ellipse_Node Svg_Ellipse_Node;
3199typedef struct _Svg_Polygon_Node Svg_Polygon_Node;
3200typedef struct _Svg_Rect_Node Svg_Rect_Node;
3201typedef struct _Svg_Path_Node Svg_Path_Node;
3202typedef struct _Svg_Style_Property Svg_Style_Property;
3203
3204typedef struct _Svg_Style_Stroke Svg_Style_Stroke;
3205typedef struct _Svg_Style_Fill Svg_Style_Fill;
3206typedef enum _Svg_Fill_Flags Svg_Fill_Flags;
3207typedef enum _Svg_Stroke_Flags Svg_Stroke_Flags;
3208
3209
3210typedef enum _Svg_Gradient_Type Svg_Gradient_Type;
3211typedef struct _Svg_Style_Gradient Svg_Style_Gradient;
3212typedef struct _Svg_Linear_Gradient Svg_Linear_Gradient;
3213typedef struct _Svg_Radial_Gradient Svg_Radial_Gradient;
3214typedef struct _Svg_Paint Svg_Paint;
3215
3216enum _Svg_Node_Type
3217{
3218 SVG_NODE_DOC,
3219 SVG_NODE_G,
3220 SVG_NODE_DEFS,
3221 SVG_NODE_SWITCH,
3222 SVG_NODE_ANIMATION,
3223 SVG_NODE_ARC,
3224 SVG_NODE_CIRCLE,
3225 SVG_NODE_ELLIPSE,
3226 SVG_NODE_IMAGE,
3227 SVG_NODE_LINE,
3228 SVG_NODE_PATH,
3229 SVG_NODE_POLYGON,
3230 SVG_NODE_POLYLINE,
3231 SVG_NODE_RECT,
3232 SVG_NODE_TEXT,
3233 SVG_NODE_TEXTAREA,
3234 SVG_NODE_TSPAN,
3235 SVG_NODE_USE,
3236 SVG_NODE_VIDEO,
3237 SVG_NODE_UNKNOWN
3238};
3239
3240enum _Svg_Length_Type
3241{
3242 SVG_LT_PERCENT,
3243 SVG_LT_PX,
3244 SVG_LT_PC,
3245 SVG_LT_PT,
3246 SVG_LT_MM,
3247 SVG_LT_CM,
3248 SVG_LT_IN,
3249};
3250
3251struct _Svg_Doc_Node
3252{
3253 double width;
3254 double height;
3255 double vx;
3256 double vy;
3257 double vw;
3258 double vh;
3259 Svg_Node *defs;
3260};
3261
3262struct _Svg_G_Node
3263{
3264
3265};
3266
3267struct _Svg_Defs_Node
3268{
3269 Eina_List *gradients;
3270};
3271
3272struct _Svg_Arc_Node
3273{
3274
3275};
3276
3277struct _Svg_Ellipse_Node
3278{
3279 double cx;
3280 double cy;
3281 double rx;
3282 double ry;
3283};
3284
3285struct _Svg_Circle_Node
3286{
3287 double cx;
3288 double cy;
3289 double r;
3290};
3291
3292struct _Svg_Rect_Node
3293{
3294 double x;
3295 double y;
3296 double w;
3297 double h;
3298 double rx;
3299 double ry;
3300};
3301
3302struct _Svg_Path_Node
3303{
3304 Eina_Stringshare *path;
3305};
3306
3307struct _Svg_Polygon_Node
3308{
3309 int points_count;
3310 double *points;
3311};
3312
3313
3314enum _Svg_Gradient_Type
3315{
3316 SVG_LINEAR_GRADIENT,
3317 SVG_RADIAL_GRADIENT
3318};
3319struct _Svg_Linear_Gradient
3320{
3321 double x1;
3322 double y1;
3323 double x2;
3324 double y2;
3325};
3326
3327struct _Svg_Radial_Gradient
3328{
3329 double cx;
3330 double cy;
3331 double fx;
3332 double fy;
3333 double r;
3334};
3335
3336struct _Svg_Style_Gradient
3337{
3338 Svg_Gradient_Type type;
3339 Eina_Stringshare *id;
3340 Eina_Stringshare *ref;
3341 Efl_Gfx_Gradient_Spread spread;
3342 Eina_List *stops; // Efl_Gfx_Gradient_Stop
3343 Svg_Radial_Gradient *radial;
3344 Svg_Linear_Gradient *linear;
3345};
3346
3347struct _Svg_Paint
3348{
3349 int r;
3350 int g;
3351 int b;
3352 Eina_Bool none;
3353 Eina_Bool cur_color;
3354 Svg_Style_Gradient *gradient;
3355 Eina_Stringshare *url;
3356};
3357
3358enum _Svg_Fill_Flags
3359{
3360 SVG_FILL_FLAGS_PAINT = 0x1,
3361 SVG_FILL_FLAGS_OPACITY = 0x2,
3362 SVG_FILL_FLAGS_GRADIENT = 0x4,
3363 SVG_FILL_FLAGS_FILL_RULE = 0x8
3364};
3365
3366enum _Svg_Stroke_Flags
3367{
3368 SVG_STROKE_FLAGS_PAINT = 0x1,
3369 SVG_STROKE_FLAGS_OPACITY = 0x2,
3370 SVG_STROKE_FLAGS_GRADIENT = 0x4,
3371 SVG_STROKE_FLAGS_SCALE = 0x8,
3372 SVG_STROKE_FLAGS_WIDTH = 0x10,
3373 SVG_STROKE_FLAGS_CAP = 0x20,
3374 SVG_STROKE_FLAGS_JOIN = 0x40,
3375 SVG_STROKE_FLAGS_DASH = 0x80,
3376};
3377
3378struct _Svg_Style_Fill
3379{
3380 Svg_Fill_Flags flags;
3381 Svg_Paint paint;
3382 int opacity;
3383 Efl_Gfx_Fill_Rule fill_rule;
3384};
3385
3386struct _Svg_Style_Stroke
3387{
3388 Svg_Stroke_Flags flags;
3389 Svg_Paint paint;
3390 int opacity;
3391 double scale;
3392 double width;
3393 double centered;
3394 Efl_Gfx_Cap cap;
3395 Efl_Gfx_Join join;
3396 Efl_Gfx_Dash *dash;
3397 int dash_count;
3398};
3399
3400struct _Svg_Style_Property
3401{
3402 Svg_Style_Fill fill;
3403 Svg_Style_Stroke stroke;
3404 // the color property indirectly
3405 // used by fill and stroke
3406 int r;
3407 int g;
3408 int b;
3409};
3410
3411struct _Svg_Node
3412{
3413 Svg_Node_Type type;
3414 Svg_Node *parent;
3415 Eina_List *child;
3416 Eina_Stringshare *id;
3417 Svg_Style_Property *style;
3418 Eina_Matrix3 *transform;
3419 union
3420 {
3421 Svg_G_Node g;
3422 Svg_Doc_Node doc;
3423 Svg_Defs_Node defs;
3424 Svg_Arc_Node arc;
3425 Svg_Circle_Node circle;
3426 Svg_Ellipse_Node ellipse;
3427 Svg_Polygon_Node polygon;
3428 Svg_Polygon_Node polyline;
3429 Svg_Rect_Node rect;
3430 Svg_Path_Node path;
3431 }node;
3432};
3433
3434enum _Svg_Style_Type
3435{
3436 SVG_STYLE_QUALITY,
3437 SVG_STYLE_FILL,
3438 SVG_STYLE_VIEWPORT_FILL,
3439 SVG_STYLE_FONT,
3440 SVG_STYLE_STROKE,
3441 SVG_STYLE_SOLID_COLOR,
3442 SVG_STYLE_GRADIENT,
3443 SVG_STYLE_TRANSFORM,
3444 SVG_STYLE_OPACITY,
3445 SVG_STYLE_COMP_OP
3446};
3447
3448EAPI Eet_Data_Descriptor * _edje_svg_node_eet(void);
3449void _edje_svg_node_destroy_eet(void);
3450
3451void _edje_dupe_vector_data(Edje *ed, int svg_id, double width, double height,
3452 Edje_Vector_Data *data);
3453void _apply_transformation(Efl_VG *root, double w, double h,
3454 Edje_Vector_Data *vg_data);
3455
3456Edje_Vector_Data * _edje_ref_vector_data(Edje *ed, int svg_id);
3457
3458EAPI void _edje_svg_node_free(Svg_Node *node);
3459
3460#ifdef HAVE_EPHYSICS 3171#ifdef HAVE_EPHYSICS
3461Eina_Bool _edje_ephysics_load(void); 3172Eina_Bool _edje_ephysics_load(void);
3462 3173