bmOverwrite can be used

This commit is contained in:
Ryan Oldenburg 2021-11-30 16:26:28 -06:00
parent 06f211f735
commit aa6775240f
2 changed files with 10 additions and 7 deletions

View file

@ -175,9 +175,9 @@ block:
# discard surface.writeToPng("cairo4.png")
var a: Image
a = newImage(1000, 1000)
# a = newImage(1000, 1000)
timeIt "pixie4":
# a = newImage(1000, 1000)
a = newImage(1000, 1000)
let p = newPath()
p.moveTo(shapes[0][0])

View file

@ -1546,7 +1546,7 @@ proc fillHits(
filledTo = fillStart + fillLen
if blendMode == bmNormal:
if blendMode == bmNormal or blendMode == bmOverwrite:
fillUnsafe(mask.data, 255, mask.dataIndex(fillStart, y), fillLen)
continue
@ -2454,13 +2454,16 @@ else:
image.clearUnsafe(0, 0, 0, startY)
image.clearUnsafe(0, pathHeight, 0, image.height)
proc fillMask*(path: SomePath, width, height: int): Mask =
result = newMask(width, height)
result.fillPath(path, blendMode = bmOverwrite)
proc fillImage*(path: SomePath, width, height: int, color: SomeColor): Image =
result = newImage(width, height)
let mask = newMask(width, height)
mask.fillPath(path)
let rgbx = color.rgbx()
let
mask = path.fillMask(width, height)
rgbx = color.rgbx()
var i: int
when defined(amd64) and not defined(pixieNoSimd):