From 2c624af18ae739cb1e4ef2d84d251f01127c3b19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=C5=99=C3=ADk?= Date: Sat, 28 Oct 2023 11:09:00 +0200 Subject: [PATCH] Fixed SVG import - Do not use fill winding nonzero when only stroking --- CHANGELOG.md | 1 + .../flash/importers/svg/SvgImporter.java | 17 ++++++++++------- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3ef4d9731..6b954b81b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,7 @@ All notable changes to this project will be documented in this file. - Do not display lines with zero width - Not updating Morphshape end bounds - SVG import - linear gradients +- SVG import - Do not use fill winding nonzero when only stroking ### Changed - Basic tag info panel always visible even when nothing to display (to avoid flickering) diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/importers/svg/SvgImporter.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/importers/svg/SvgImporter.java index a86602222..5e5bbada1 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/importers/svg/SvgImporter.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/importers/svg/SvgImporter.java @@ -557,13 +557,16 @@ public class SvgImporter { private void processCommands(int shapeNum, SHAPEWITHSTYLE shapes, List commands, Matrix transform, SvgStyle style, boolean morphShape, boolean shape2) { if ("nonzero".equals(style.getFillRule())) { - if (!shape2 && (shapeTag instanceof DefineShape4Tag)) { - DefineShape4Tag shape4 = (DefineShape4Tag) shapeTag; - shape4.usesFillWindingRule = true; - } - if (shape2 && (endShape instanceof DefineShape4Tag)) { - DefineShape4Tag shape4 = (DefineShape4Tag) endShape; - shape4.usesFillWindingRule = true; + SvgFill fill = style.getFill(); + if (fill != null && !(fill instanceof SvgTransparentFill)) { + if (!shape2 && (shapeTag instanceof DefineShape4Tag)) { + DefineShape4Tag shape4 = (DefineShape4Tag) shapeTag; + shape4.usesFillWindingRule = true; + } + if (shape2 && (endShape instanceof DefineShape4Tag)) { + DefineShape4Tag shape4 = (DefineShape4Tag) endShape; + shape4.usesFillWindingRule = true; + } } }