diff --git a/src/pixie/fileformats/svg.nim b/src/pixie/fileformats/svg.nim index 3982508..4b421c8 100644 --- a/src/pixie/fileformats/svg.nim +++ b/src/pixie/fileformats/svg.nim @@ -151,12 +151,6 @@ proc decodeCtxInternal(inherited: Ctx, node: XmlNode): Ctx = if opacity.len > 0: result.opacity = clamp(parseFloat(opacity), 0, 1) - if fillOpacity.len > 0: - result.fill.opacity = clamp(parseFloat(fillOpacity), 0, 1) - - if strokeOpacity.len > 0: - result.strokeOpacity = clamp(parseFloat(strokeOpacity), 0, 1) - if fillRule == "": discard # Inherit elif fillRule == "nonzero": @@ -197,6 +191,12 @@ proc decodeCtxInternal(inherited: Ctx, node: XmlNode): Ctx = result.stroke = parseHtmlColor(stroke).rgbx result.shouldStroke = true + if fillOpacity.len > 0: + result.fill.opacity = parseFloat(fillOpacity).clamp(0, 1) + + if strokeOpacity.len > 0: + result.strokeOpacity = parseFloat(strokeOpacity).clamp(0, 1) + if strokeWidth == "": discard # Inherit else: diff --git a/tests/fileformats/svg/diffs/dragon2.png b/tests/fileformats/svg/diffs/dragon2.png new file mode 100644 index 0000000..18ecc64 Binary files /dev/null and b/tests/fileformats/svg/diffs/dragon2.png differ diff --git a/tests/fileformats/svg/dragon2.svg b/tests/fileformats/svg/dragon2.svg new file mode 100644 index 0000000..e27b53a --- /dev/null +++ b/tests/fileformats/svg/dragon2.svg @@ -0,0 +1,1379 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + --> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tests/fileformats/svg/masters/dragon2.png b/tests/fileformats/svg/masters/dragon2.png new file mode 100644 index 0000000..ef957cc Binary files /dev/null and b/tests/fileformats/svg/masters/dragon2.png differ diff --git a/tests/fileformats/svg/rendered/dragon2.png b/tests/fileformats/svg/rendered/dragon2.png new file mode 100644 index 0000000..5f1b8c5 Binary files /dev/null and b/tests/fileformats/svg/rendered/dragon2.png differ diff --git a/tests/test_svg.nim b/tests/test_svg.nim index e978626..c9f6d43 100644 --- a/tests/test_svg.nim +++ b/tests/test_svg.nim @@ -13,7 +13,8 @@ const files = [ "Ghostscript_Tiger", "scale", "miterlimit", - "dashes" + "dashes", + "dragon2" ] proc doDiff(rendered: Image, name: string) =