image ceil, bugfix path fill mask blend

This commit is contained in:
Ryan Oldenburg 2022-07-25 16:35:47 -05:00
parent 91ecfc7282
commit f78b573074
2 changed files with 18 additions and 5 deletions

View file

@ -355,6 +355,16 @@ proc invert*(image: Image) {.hasSimd, raises: [].} =
# We need to convert back to premultiplied alpha after inverting.
image.data.toPremultipliedAlpha()
proc ceil*(image: Image) {.hasSimd, raises: [].} =
## A value of 0 stays 0. Anything else turns into 255.
for i in 0 ..< image.data.len:
var rgbx = image.data[i]
rgbx.r = if rgbx.r == 0: 0 else: 255
rgbx.g = if rgbx.g == 0: 0 else: 255
rgbx.b = if rgbx.b == 0: 0 else: 255
rgbx.a = if rgbx.a == 0: 0 else: 255
image.data[i] = rgbx
proc blur*(
image: Image, radius: float32, outOfBounds: SomeColor = color(0, 0, 0, 0)
) {.raises: [PixieError].} =

View file

@ -2021,6 +2021,8 @@ proc fillShapes(
i += 2
if onlySimpleFillPairs:
numHits = 0
var i: int
while i < numEntryIndices:
let
@ -2126,13 +2128,14 @@ proc fillShapes(
let
fillBegin = leftCoverEnd.clamp(0, image.width)
fillEnd = rightCoverBegin.clamp(0, image.width)
if fillEnd - fillBegin > 0:
hits[0] = (fixed32(fillBegin.float32), 1.int16)
hits[1] = (fixed32(fillEnd.float32), -1.int16)
image.fillHits(rgbx, 0, y, hits, 2, NonZero, blendMode)
hits[numHits] = (fixed32(fillBegin.float32), 1.int16)
hits[numHits + 1] = (fixed32(fillEnd.float32), -1.int16)
numHits += 2
i += 2
if numHits > 0:
image.fillHits(rgbx, 0, y, hits, numHits, NonZero, blendMode)
inc y
continue