summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunsuChoi <jsuya.choi@samsung.com>2019-08-19 19:46:01 +0900
committerHermet Park <hermetpark@gmail.com>2019-08-19 19:46:02 +0900
commit8f440cdedc090fd71fbda4c10bf2f4af6bafec40 (patch)
tree8635887175bbbcd92d79fe8902aac62dd3f2b182
parentdafd3dc7b82863c8dbd65105fa53fe612d7a655f (diff)
downloadefl-8f440cdedc090fd71fbda4c10bf2f4af6bafec40.tar.gz
vg_common_svg: Apply node opacity to stroke color
Summary: When an object to be converted to a stroke or path uses "opacity" attribute, opacity is also applied. Test Plan: [SVG] <?xml version="1.0" encoding="UTF-8"?> <svg width="40px" height="40px" viewBox="0 0 40 40" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <!-- Generator: Sketch 52.6 (67491) - http://www.bohemiancoding.com/sketch --> <rect fill="#FF0000" opacity="0" x="0" y="0" width="40" height="40"></rect> <path d="M12,20 L25,8 L12,20 Z M12,20 L25,32 L12,20 Z" id="Combined-Shape" stroke="#FFFFFF" stroke-width="2" opacity="0.12" stroke-linecap="round" stroke-linejoin="round" fill-rule="nonzero"></path> </svg> [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, "./i_arrow_l_disable.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, 600, 600); 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/D9620
-rw-r--r--src/static_libs/vg_common/vg_common_svg.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/static_libs/vg_common/vg_common_svg.c b/src/static_libs/vg_common/vg_common_svg.c
index e3866e2018..5f8398d44b 100644
--- a/src/static_libs/vg_common/vg_common_svg.c
+++ b/src/static_libs/vg_common/vg_common_svg.c
@@ -784,6 +784,15 @@ _apply_vg_property(Svg_Node *node, Efl_VG *vg, Efl_VG *parent, Vg_File_Data *vg_
efl_gfx_shape_stroke_color_set(vg, style->stroke.paint.r, style->stroke.paint.g,
style->stroke.paint.b, style->stroke.opacity);
}
+
+ //apply node opacity to stroke color
+ if (style->opacity < 255)
+ {
+ int r, g, b, a;
+ efl_gfx_shape_stroke_color_get(vg, &r, &g, &b, &a);
+ float fa = ((float) style->opacity / 255);
+ efl_gfx_shape_stroke_color_set(vg, ((float) r) * fa, ((float) g) * fa, ((float) b) * fa, ((float) a) * fa);
+ }
}
static void