Merge pull request #478 from treeform/guzba
image ceil, bugfix path fill mask blend
This commit is contained in:
commit
c3438f8ff3
2 changed files with 18 additions and 5 deletions
|
@ -355,6 +355,16 @@ proc invert*(image: Image) {.hasSimd, raises: [].} =
|
||||||
# We need to convert back to premultiplied alpha after inverting.
|
# We need to convert back to premultiplied alpha after inverting.
|
||||||
image.data.toPremultipliedAlpha()
|
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*(
|
proc blur*(
|
||||||
image: Image, radius: float32, outOfBounds: SomeColor = color(0, 0, 0, 0)
|
image: Image, radius: float32, outOfBounds: SomeColor = color(0, 0, 0, 0)
|
||||||
) {.raises: [PixieError].} =
|
) {.raises: [PixieError].} =
|
||||||
|
|
|
@ -2021,6 +2021,8 @@ proc fillShapes(
|
||||||
i += 2
|
i += 2
|
||||||
|
|
||||||
if onlySimpleFillPairs:
|
if onlySimpleFillPairs:
|
||||||
|
numHits = 0
|
||||||
|
|
||||||
var i: int
|
var i: int
|
||||||
while i < numEntryIndices:
|
while i < numEntryIndices:
|
||||||
let
|
let
|
||||||
|
@ -2126,13 +2128,14 @@ proc fillShapes(
|
||||||
let
|
let
|
||||||
fillBegin = leftCoverEnd.clamp(0, image.width)
|
fillBegin = leftCoverEnd.clamp(0, image.width)
|
||||||
fillEnd = rightCoverBegin.clamp(0, image.width)
|
fillEnd = rightCoverBegin.clamp(0, image.width)
|
||||||
if fillEnd - fillBegin > 0:
|
hits[numHits] = (fixed32(fillBegin.float32), 1.int16)
|
||||||
hits[0] = (fixed32(fillBegin.float32), 1.int16)
|
hits[numHits + 1] = (fixed32(fillEnd.float32), -1.int16)
|
||||||
hits[1] = (fixed32(fillEnd.float32), -1.int16)
|
numHits += 2
|
||||||
image.fillHits(rgbx, 0, y, hits, 2, NonZero, blendMode)
|
|
||||||
|
|
||||||
i += 2
|
i += 2
|
||||||
|
|
||||||
|
if numHits > 0:
|
||||||
|
image.fillHits(rgbx, 0, y, hits, numHits, NonZero, blendMode)
|
||||||
|
|
||||||
inc y
|
inc y
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue