summaryrefslogtreecommitdiff
path: root/src/modules/evas/vg_loaders/svg/evas_vg_load_svg.c
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/modules/evas/vg_loaders/svg/evas_vg_load_svg.c
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 '')
-rw-r--r--src/modules/evas/vg_loaders/svg/evas_vg_load_svg.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/modules/evas/vg_loaders/svg/evas_vg_load_svg.c b/src/modules/evas/vg_loaders/svg/evas_vg_load_svg.c
index 82e6fc9df0..c277ee9d26 100644
--- a/src/modules/evas/vg_loaders/svg/evas_vg_load_svg.c
+++ b/src/modules/evas/vg_loaders/svg/evas_vg_load_svg.c
@@ -911,6 +911,16 @@ _handle_transform_attr(Evas_SVG_Loader *loader EINA_UNUSED, Svg_Node* node, cons
911 node->transform = _parse_transformation_matrix(value); 911 node->transform = _parse_transformation_matrix(value);
912} 912}
913 913
914static void
915_handle_display_attr(Evas_SVG_Loader *loader EINA_UNUSED, Svg_Node* node, const char *value)
916{
917 //TODO : The display attribute can have various values as well as "none".
918 // The default is "inline" which means visible and "none" means invisible.
919 // Depending on the type of node, additional functionality may be required.
920 // refer to https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/display
921 if (!strcmp(value, "none")) node->display = EINA_FALSE;
922 else node->display = EINA_TRUE;
923}
914 924
915typedef void (*Style_Method)(Evas_SVG_Loader *loader, Svg_Node *node, const char *value); 925typedef void (*Style_Method)(Evas_SVG_Loader *loader, Svg_Node *node, const char *value);
916 926
@@ -932,7 +942,8 @@ static const struct {
932 STYLE_DEF(stroke-linejoin, stroke_linejoin), 942 STYLE_DEF(stroke-linejoin, stroke_linejoin),
933 STYLE_DEF(stroke-linecap, stroke_linecap), 943 STYLE_DEF(stroke-linecap, stroke_linecap),
934 STYLE_DEF(stroke-opacity, stroke_opacity), 944 STYLE_DEF(stroke-opacity, stroke_opacity),
935 STYLE_DEF(transform, transform) 945 STYLE_DEF(transform, transform),
946 STYLE_DEF(display, display)
936}; 947};
937 948
938static Eina_Bool 949static Eina_Bool
@@ -1030,6 +1041,9 @@ _create_node(Svg_Node *parent, Svg_Node_Type type)
1030 node->style->stroke.join = EFL_GFX_JOIN_MITER; 1041 node->style->stroke.join = EFL_GFX_JOIN_MITER;
1031 node->style->stroke.scale = 1.0; 1042 node->style->stroke.scale = 1.0;
1032 1043
1044 // default display is true("inline").
1045 node->display = EINA_TRUE;
1046
1033 node->parent = parent; 1047 node->parent = parent;
1034 node->type = type; 1048 node->type = type;
1035 node->child = NULL; 1049 node->child = NULL;