fix context masking
This commit is contained in:
parent
b4cc7cdefc
commit
c50cc6babf
1 changed files with 5 additions and 2 deletions
|
@ -131,7 +131,7 @@ proc restore*(ctx: Context) {.raises: [PixieError].} =
|
||||||
|
|
||||||
if poppedLayer != nil: # If there is a layer being popped
|
if poppedLayer != nil: # If there is a layer being popped
|
||||||
if poppedMask != nil: # If there is a mask, apply it
|
if poppedMask != nil: # If there is a mask, apply it
|
||||||
poppedLayer.draw(poppedMask)
|
poppedLayer.draw(poppedMask, blendMode = MaskBlend)
|
||||||
if ctx.layer != nil: # If we popped to another layer, draw to it
|
if ctx.layer != nil: # If we popped to another layer, draw to it
|
||||||
ctx.layer.draw(poppedLayer)
|
ctx.layer.draw(poppedLayer)
|
||||||
else: # Otherwise draw to the root image
|
else: # Otherwise draw to the root image
|
||||||
|
@ -390,7 +390,10 @@ proc clip*(
|
||||||
## the new clipping region.
|
## the new clipping region.
|
||||||
if ctx.mask == nil:
|
if ctx.mask == nil:
|
||||||
ctx.mask = newImage(ctx.image.width, ctx.image.height)
|
ctx.mask = newImage(ctx.image.width, ctx.image.height)
|
||||||
ctx.mask.fillPath(path, color(1, 1, 1, 1), windingRule = windingRule)
|
let maskPaint = newPaint(SolidPaint)
|
||||||
|
maskPaint.color = color(1, 1, 1, 1)
|
||||||
|
maskPaint.blendMode = OverwriteBlend
|
||||||
|
ctx.mask.fillPath(path, maskPaint, windingRule = windingRule)
|
||||||
else:
|
else:
|
||||||
let maskPaint = newPaint(SolidPaint)
|
let maskPaint = newPaint(SolidPaint)
|
||||||
maskPaint.color = color(1, 1, 1, 1)
|
maskPaint.color = color(1, 1, 1, 1)
|
||||||
|
|
Loading…
Reference in a new issue