diff --git a/src/pixie/paths.nim b/src/pixie/paths.nim index 0af752d..d4a9320 100644 --- a/src/pixie/paths.nim +++ b/src/pixie/paths.nim @@ -1304,8 +1304,23 @@ proc fillCoverage( source.a = ((source.a.uint32 * coverage) div 255).uint8 let backdrop = image.getRgbaUnsafe(x, y) image.setRgbaUnsafe(x, y, blender(backdrop, source)) + elif blendMode == bmMask: + image.setRgbaUnsafe(x, y, rgbx(0, 0, 0, 0)) inc x + if blendMode == bmMask: + image.data.fillUnsafe( + rgbx(0, 0, 0, 0), + image.dataIndex(0, y), + image.dataIndex(startX, y) - image.dataIndex(0, y) + ) + # if x < image.width: + # image.data.fillUnsafe( + # rgbx(0, 0, 0, 0), + # image.dataIndex(x, y), + # image.dataIndex(image.width, y) + # ) + proc fillCoverage(mask: Mask, startX, y: int, coverages: seq[uint8]) = var x = startX when defined(amd64) and not defined(pixieNoSimd): @@ -1438,6 +1453,18 @@ proc fillShapes( blendMode ) + if blendMode == bmMask: + image.data.fillUnsafe( + rgbx(0, 0, 0, 0), + image.dataIndex(0, 0), + image.dataIndex(0, startY) + ) + image.data.fillUnsafe( + rgbx(0, 0, 0, 0), + image.dataIndex(0, pathHeight), + image.dataIndex(0, image.height) + ) + proc fillShapes(mask: Mask, shapes: seq[seq[Vec2]], windingRule: WindingRule) = # Figure out the total bounds of all the shapes, # rasterize only within the total bounds