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") # discard surface.writeToPng("cairo4.png")
var a: Image var a: Image
a = newImage(1000, 1000) # a = newImage(1000, 1000)
timeIt "pixie4": timeIt "pixie4":
# a = newImage(1000, 1000) a = newImage(1000, 1000)
let p = newPath() let p = newPath()
p.moveTo(shapes[0][0]) p.moveTo(shapes[0][0])

View file

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