summaryrefslogtreecommitdiff
path: root/src/static_libs
diff options
context:
space:
mode:
authorHermet Park <hermetpark@gmail.com>2019-08-20 11:23:59 +0900
committerHermet Park <hermetpark@gmail.com>2019-08-20 11:25:44 +0900
commit5c39e68d2bcd0ccd3dff21e378f2638509b81a39 (patch)
tree46d1da522e6fbd3d2fd5eb05ab1f0db9d243f9b5 /src/static_libs
parent3c59e23b7d3b62dc676b1838555f2641a910ea33 (diff)
canvas svg: fix to apply premultipled color.
fill colors should be premultiplied with fill opcaity.
Diffstat (limited to 'src/static_libs')
-rw-r--r--src/static_libs/vg_common/vg_common_svg.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/static_libs/vg_common/vg_common_svg.c b/src/static_libs/vg_common/vg_common_svg.c
index 5f8398d..d15e753 100644
--- a/src/static_libs/vg_common/vg_common_svg.c
+++ b/src/static_libs/vg_common/vg_common_svg.c
@@ -710,17 +710,16 @@ _apply_vg_property(Svg_Node *node, Efl_VG *vg, Efl_VG *parent, Vg_File_Data *vg_
710 Svg_Style_Property *style = node->style; 710 Svg_Style_Property *style = node->style;
711 711
712 // update the vg name 712 // update the vg name
713 if (node->id) 713 if (node->id) efl_name_set(vg, node->id);
714 efl_name_set(vg, node->id);
715 714
716 // apply the transformation 715 // apply the transformation
717 if (node->transform) 716 if (node->transform) efl_canvas_vg_node_transformation_set(vg, node->transform);
718 efl_canvas_vg_node_transformation_set(vg, node->transform);
719 717
720 if ((node->type == SVG_NODE_G) || (node->type == SVG_NODE_DOC)) return; 718 if ((node->type == SVG_NODE_G) || (node->type == SVG_NODE_DOC)) return;
721 719
722 // apply the fill style property 720 // apply the fill style property
723 efl_gfx_shape_fill_rule_set(vg, style->fill.fill_rule); 721 efl_gfx_shape_fill_rule_set(vg, style->fill.fill_rule);
722
724 // if fill property is NULL then do nothing 723 // if fill property is NULL then do nothing
725 if (style->fill.paint.none) 724 if (style->fill.paint.none)
726 { 725 {
@@ -734,14 +733,16 @@ _apply_vg_property(Svg_Node *node, Efl_VG *vg, Efl_VG *parent, Vg_File_Data *vg_
734 else if (style->fill.paint.cur_color) 733 else if (style->fill.paint.cur_color)
735 { 734 {
736 // apply the current style color 735 // apply the current style color
737 efl_gfx_color_set(vg, style->r, style->g, 736 float fa = ((float) style->fill.opacity / 255);
738 style->b, style->fill.opacity); 737 efl_gfx_color_set(vg, ((float) style->r) * fa, ((float) style->g) * fa, ((float) style->b) * fa,
738 style->fill.opacity);
739 } 739 }
740 else 740 else
741 { 741 {
742 // apply the fill color 742 // apply the fill color
743 efl_gfx_color_set(vg, style->fill.paint.r, style->fill.paint.g, 743 float fa = ((float) style->fill.opacity / 255);
744 style->fill.paint.b, style->fill.opacity); 744 efl_gfx_color_set(vg, ((float) style->fill.paint.r) * fa, ((float) style->fill.paint.g) * fa,
745 ((float) style->fill.paint.b) * fa, style->fill.opacity);
745 } 746 }
746 747
747 //apply node opacity 748 //apply node opacity