This commit is contained in:
Ryan Oldenburg 2022-05-21 19:23:46 -05:00
parent ce4ac78b5d
commit 88576efdd3

View file

@ -297,7 +297,6 @@ proc parseSvgProperties(node: XmlNode, inherited: SvgProperties): SvgProperties
failInvalidTransform(transform) failInvalidTransform(transform)
proc fill(img: Image, path: Path, props: SvgProperties) = proc fill(img: Image, path: Path, props: SvgProperties) =
if props.display and props.opacity > 0:
if props.fill == "none": if props.fill == "none":
return return
@ -322,7 +321,6 @@ proc fill(img: Image, path: Path, props: SvgProperties) =
img.fillPath(path, paint, props.transform, props.fillRule) img.fillPath(path, paint, props.transform, props.fillRule)
proc stroke(img: Image, path: Path, props: SvgProperties) = proc stroke(img: Image, path: Path, props: SvgProperties) =
if props.display and props.opacity > 0:
let paint = newPaint(props.stroke) let paint = newPaint(props.stroke)
paint.color.a *= (props.opacity * props.strokeOpacity) paint.color.a *= (props.opacity * props.strokeOpacity)
img.strokePath( img.strokePath(
@ -576,6 +574,7 @@ proc decodeSvg*(
for node in root.items: for node in root.items:
renderInfos.add node.parseSvgElement(propertiesStack) renderInfos.add node.parseSvgElement(propertiesStack)
for (path, props) in renderInfos: for (path, props) in renderInfos:
if props.display and props.opacity > 0:
result.fill(path, props) result.fill(path, props)
if props.stroke != rgbx(0, 0, 0, 0) and props.strokeWidth > 0: if props.stroke != rgbx(0, 0, 0, 0) and props.strokeWidth > 0:
result.stroke(path, props) result.stroke(path, props)