summaryrefslogtreecommitdiff
path: root/src/static_libs
diff options
context:
space:
mode:
authorJunsuChoi <jsuya.choi@samsung.com>2019-08-20 20:32:15 +0900
committerHermet Park <hermetpark@gmail.com>2019-08-20 20:32:15 +0900
commite850e3e5dcbd1080a6e879f67ede1533632dade1 (patch)
treed30683251f0ad847942bb2a2bde29f2bd1d4365a /src/static_libs
parentb0737c743458818ea79338c15c15d0c3d4819051 (diff)
evas_vg_load_svg: Support "display" attribute.
Summary: If the display attribute is "none", VG object is not show. The default is "inline" which means visible and "none" means invisible. Depending on the type of node, additional functionality may be required. refer to https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/display Test Plan: [SVG] <svg viewBox="0 0 220 100" xmlns="http://www.w3.org/2000/svg"> <!-- Here the yellow rectangle is displayed --> <g display="none"> <rect x="0" y="0" width="100" height="100" fill="skyblue"></rect> </g> <rect x="20" y="20" width="60" height="60" fill="yellow"></rect> <!-- Here the yellow rectangle is not displayed --> <rect x="120" y="0" width="100" height="100" fill="skyblue"></rect> <rect x="140" y="20" width="60" height="60" fill="yellow" display="none"></rect> </svg> [C CODE] int main(int argc, char **argv) { setenv("ECTOR_BACKEND", "default", 1); elm_init(argc, argv); Evas_Object *win = elm_win_util_standard_add(NULL, "test"); evas_object_smart_callback_add(win, "delete,request", win_del, 0); elm_win_autodel_set(win, 1); Evas *evas = evas_object_evas_get(win); Evas_Object *vg = evas_object_vg_add(evas); evas_object_show(vg); Evas_Object *container = evas_vg_container_add(vg); evas_object_vg_root_node_set(vg, container); Evas_Object *svg = efl_add(EFL_CANVAS_VG_OBJECT_CLASS, container); efl_file_simple_load(svg, "./test.svg", NULL); efl_gfx_entity_size_set(svg, EINA_SIZE2D(600, 600)); efl_gfx_entity_visible_set(svg, EINA_TRUE); evas_object_size_hint_weight_set(svg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(svg, EVAS_HINT_FILL, EVAS_HINT_FILL); elm_win_resize_object_add(win, vg); evas_object_resize(win, WIDTH, HEIGHT); evas_object_show(win); elm_run(); elm_shutdown(); return 0; } Reviewers: Hermet, smohanty, kimcinoo Reviewed By: Hermet Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D9640
Diffstat (limited to 'src/static_libs')
-rw-r--r--src/static_libs/vg_common/vg_common.h1
-rw-r--r--src/static_libs/vg_common/vg_common_svg.c3
2 files changed, 4 insertions, 0 deletions
diff --git a/src/static_libs/vg_common/vg_common.h b/src/static_libs/vg_common/vg_common.h
index 731a8d2..520fcdb 100644
--- a/src/static_libs/vg_common/vg_common.h
+++ b/src/static_libs/vg_common/vg_common.h
@@ -283,6 +283,7 @@ struct _Svg_Node
283 Eina_Stringshare *id; 283 Eina_Stringshare *id;
284 Svg_Style_Property *style; 284 Svg_Style_Property *style;
285 Eina_Matrix3 *transform; 285 Eina_Matrix3 *transform;
286 Eina_Bool display;
286 union 287 union
287 { 288 {
288 Svg_G_Node g; 289 Svg_G_Node g;
diff --git a/src/static_libs/vg_common/vg_common_svg.c b/src/static_libs/vg_common/vg_common_svg.c
index d15e753..4f96bec 100644
--- a/src/static_libs/vg_common/vg_common_svg.c
+++ b/src/static_libs/vg_common/vg_common_svg.c
@@ -441,6 +441,7 @@ vg_common_svg_node_eet(void)
441 EET_DATA_DESCRIPTOR_ADD_BASIC(_eet_vg_node, Svg_Node, "id", id, EET_T_STRING); 441 EET_DATA_DESCRIPTOR_ADD_BASIC(_eet_vg_node, Svg_Node, "id", id, EET_T_STRING);
442 EET_DATA_DESCRIPTOR_ADD_SUB(_eet_vg_node, Svg_Node, "style", style, _eet_style_property_node); 442 EET_DATA_DESCRIPTOR_ADD_SUB(_eet_vg_node, Svg_Node, "style", style, _eet_style_property_node);
443 EET_DATA_DESCRIPTOR_ADD_SUB(_eet_vg_node, Svg_Node, "transform", transform, _eet_matrix3_node); 443 EET_DATA_DESCRIPTOR_ADD_SUB(_eet_vg_node, Svg_Node, "transform", transform, _eet_matrix3_node);
444 EET_DATA_DESCRIPTOR_ADD_BASIC(_eet_vg_node, Svg_Node, "display", display, EET_T_INT);
444 445
445 return _eet_vg_node; 446 return _eet_vg_node;
446} 447}
@@ -715,6 +716,8 @@ _apply_vg_property(Svg_Node *node, Efl_VG *vg, Efl_VG *parent, Vg_File_Data *vg_
715 // apply the transformation 716 // apply the transformation
716 if (node->transform) efl_canvas_vg_node_transformation_set(vg, node->transform); 717 if (node->transform) efl_canvas_vg_node_transformation_set(vg, node->transform);
717 718
719 if (!node->display) efl_gfx_entity_visible_set(vg, EINA_FALSE);
720
718 if ((node->type == SVG_NODE_G) || (node->type == SVG_NODE_DOC)) return; 721 if ((node->type == SVG_NODE_G) || (node->type == SVG_NODE_DOC)) return;
719 722
720 // apply the fill style property 723 // apply the fill style property