[dia] svg: fix over-filling if only fill-opacity="0" is given
- From: Hans Breuer <hans src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dia] svg: fix over-filling if only fill-opacity="0" is given
- Date: Sun, 21 Jul 2013 10:15:48 +0000 (UTC)
commit 6e36a791f71d69fb489c57de77ef739d856897dd
Author: Hans Breuer <hans breuer org>
Date: Sun Jul 21 12:08:27 2013 +0200
svg: fix over-filling if only fill-opacity="0" is given
My render-test-idraw.svg marks fill="none" not as such, but
instead uses no fill attribute but instead fill-opacity="0".
This led to black background where full transparent should
be used.
plug-ins/svg/svg-import.c | 4 +-
samples/path-variations.svg | 62 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 64 insertions(+), 2 deletions(-)
---
diff --git a/plug-ins/svg/svg-import.c b/plug-ins/svg/svg-import.c
index a239d7a..0b64772 100644
--- a/plug-ins/svg/svg-import.c
+++ b/plug-ins/svg/svg-import.c
@@ -331,7 +331,7 @@ apply_style(DiaObject *obj, xmlNodePtr node, DiaSvgStyle *parent_style, gboolean
cprop = g_ptr_array_index(props,3);
if (gs->fill == DIA_SVG_COLOUR_DEFAULT_FILL) {
if (init_fill)
- cprop->color_data = get_colour(0x000000, 1.0); /* black */
+ cprop->color_data = get_colour(0x000000, gs->fill_opacity); /* black */
else
cprop->common.experience |= PXP_NOTSET; /* no overwrite */
} else if (gs->fill == DIA_SVG_COLOUR_NONE) /* transparent */
@@ -401,7 +401,7 @@ read_path_svg(xmlNodePtr node, DiaSvgStyle *parent_style, GList *list, DiaContex
dia_svg_parse_style(node, gs, user_scale);
if (gs->font)
dia_font_unref (gs->font);
- closed = (gs->fill != DIA_SVG_COLOUR_NONE);
+ closed = (gs->fill != DIA_SVG_COLOUR_NONE && gs->fill != DIA_SVG_COLOUR_DEFAULT_FILL);
/* if we close it here add an explicit line-to */
if (closed) {
bp.type = BEZ_LINE_TO;
diff --git a/samples/path-variations.svg b/samples/path-variations.svg
new file mode 100644
index 0000000..3ed0980
--- /dev/null
+++ b/samples/path-variations.svg
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
+ x="0px" y="0px" width="28cm" height="21cm" viewBox="0, 0, 560, 420">
+ <!-- variation on path definitions all leading to a 1x1 square -->
+ <defs>
+ <path d="M0,0 20,0 20,20 0,20 0,0z" fill="red" stroke="none" id="box"/>
+ <path d="M10,0 20,0 20,20 0,20 0,0z" fill="red" stroke="none" id="box"/>
+ <path d="M0,0 10,0 10,10 0,10 0,0z" fill="red" stroke="none" id="box-sm"/>
+ <path d="M0,0h20v20h-20z" fill="lime" id="box-lime"/>
+ <path d="M0,0h20v20h-20z" id="box-nofill"/>
+ </defs>
+ <!-- the explicit fill attribute closes the path -->
+ <path d="M20,20L40,20 40,40 20,40 20,20" fill="black" stroke="none" id="box11"/>
+ <!-- should be black, but is white with Dia today ... -->
+ <path d="M60,20h20v20h-20z" style="stroke:none,fill:#000000" id="box21"/>
+ <!-- the trailing semicolon should be optional -->
+ <path d="M100,20h20v20h-20z" style="stroke:none;fill:#000000" id="box31"/>
+ <!-- implicit line-to -->
+ <path d="M140,20,160,20,160,40,140,40z" fill="black" stroke="none" id="box41"/>
+ <!-- start is alway absolute -->
+ <path d="m180,20 20,0 0,20 -20,0 z" fill="black" stroke="none" id="box51"/>
+ <text x="220" y="40">Data and style</text>
+ <!-- style from group, offset in path -->
+ <g style="stroke:none;fill:blue" id="boxX2">
+ <!-- implicit close is supposed to be inherited by the group style -->
+ <path d="M20,20L40,20 40,40 20,40 20,20" transform="translate(0,40)" id="box12"/>
+ <path d="M60,20h20v20h-20z" transform="translate(0,40)" id="box22"/>
+ <path d="M100,20h20v20h-20z" transform="translate(0,40)" id="box32"/>
+ <path d="M140,20,160,20,160,40,140,40z" transform="translate(0,40)" id="box42"/>
+ <path d="m180,20 20,0 0,20 -20,0 z" transform="translate(0,40)" id="box52"/>
+ <text x="220" y="80">Group style and translate</text>
+ </g>
+ <!-- Use use variations -->
+ <use x="20" y="100" xlink:href="#box"/>
+ <use x="0" y="0" xlink:href="#box" transform="translate(60,100)" id="box13"/>
+ <use x="10" y="100" xlink:href="#box1" transform="translate(80,0)" id="box23"/>
+ <use xlink:href="#box-sm" transform="matrix(2,0,0,2,100,100)"/>
+ <g id="scaled-use" transform="matrix(2,0,0,2,140,100)">
+ <use x="0" y="0" xlink:href="#box-sm" id="box43"/>
+ <use x="0" y="0" xlink:href="#box-sm" transform="translate(20,0)" id="box53"/>
+ </g>
+ <text x="220" y="120" fill="red">Use and transform</text>
+ <!-- Use coloring: Firefox 23.0 and Inkscape 0.48 have it all lime -->
+ <use x="20" y="140" xlink:href="#box-lime"/>
+ <use x="60" y="140" fill="yellow" xlink:href="#box-lime"/>
+ <g style="fill:cyan">
+ <use x="100" y="140" xlink:href="#box-lime"/>
+ </g>
+ <use x="140" y="140" style="fill:magenta" xlink:href="#box-lime"/>
+ <use x="180" y="140" xlink:href="#box-lime" style="fill:gray" />
+ <text x="220" y="160" fill="lime">Use: lime, yellow, cyan, magenta, gray?</text>
+ <!-- Use coloring: this time compatible -->
+ <use x="20" y="180" xlink:href="#box-nofill"/>
+ <use x="60" y="180" fill="yellow" xlink:href="#box-nofill"/>
+ <g style="fill:cyan">
+ <use x="100" y="180" xlink:href="#box-nofill"/>
+ </g>
+ <use x="140" y="180" style="fill:magenta" xlink:href="#box-nofill"/>
+ <use x="180" y="180" xlink:href="#box-nofill" style="fill:gray" />
+ <text x="220" y="200" fill="black">Use: black, yellow, cyan, magenta, gray?</text>
+</svg>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]