svg to image start blend as overwrite
This commit is contained in:
parent
9396945772
commit
20e3c458eb
1 changed files with 4 additions and 0 deletions
|
@ -550,6 +550,7 @@ proc newImage*(svg: Svg): Image {.raises: [PixieError].} =
|
|||
result = newImage(svg.width, svg.height)
|
||||
|
||||
try:
|
||||
var blendMode = OverwriteBlend # Start as overwrite
|
||||
for (path, props) in svg.elements:
|
||||
if props.display and props.opacity > 0:
|
||||
if props.fill != "none":
|
||||
|
@ -573,9 +574,12 @@ proc newImage*(svg: Svg): Image {.raises: [PixieError].} =
|
|||
paint = parseHtmlColor(props.fill).rgbx
|
||||
|
||||
paint.opacity = props.fillOpacity * props.opacity
|
||||
paint.blendMode = blendMode
|
||||
|
||||
result.fillPath(path, paint, props.transform, props.fillRule)
|
||||
|
||||
blendMode = NormalBlend # Switch to normal when compositing multiple paths
|
||||
|
||||
if props.stroke != rgbx(0, 0, 0, 0) and props.strokeWidth > 0:
|
||||
let paint = newPaint(props.stroke)
|
||||
paint.color.a *= (props.opacity * props.strokeOpacity)
|
||||
|
|
Loading…
Reference in a new issue