3.1.2 bugfix

This commit is contained in:
Ryan Oldenburg 2021-12-23 13:17:22 -06:00
parent a8072c132a
commit 34d96df323
7 changed files with 44 additions and 3 deletions

View file

@ -1,4 +1,4 @@
version = "3.1.1"
version = "3.1.2"
author = "Andre von Houck and Ryan Oldenburg"
description = "Full-featured 2d graphics library for Nim."
license = "MIT"

View file

@ -1601,11 +1601,16 @@ proc fillShapes(
bounds = computeBounds(segments).snapToPixels()
startX = max(0, bounds.x.int)
startY = max(0, bounds.y.int)
pathWidth =
if startX < image.width:
min(bounds.w.int, image.width - startX)
else:
0
pathHeight = min(image.height, (bounds.y + bounds.h).int)
partitioning = partitionSegments(segments, startY, pathHeight - startY)
var
coverages = newSeq[uint8](bounds.w.int)
coverages = newSeq[uint8](pathWidth)
hits = newSeq[(float32, int16)](partitioning.maxEntryCount)
numHits: int
aa: bool
@ -1659,11 +1664,16 @@ proc fillShapes(
bounds = computeBounds(segments).snapToPixels()
startX = max(0, bounds.x.int)
startY = max(0, bounds.y.int)
pathWidth =
if startX < mask.width:
min(bounds.w.int, mask.width - startX)
else:
0
pathHeight = min(mask.height, (bounds.y + bounds.h).int)
partitioning = partitionSegments(segments, startY, pathHeight)
var
coverages = newSeq[uint8](bounds.w.int)
coverages = newSeq[uint8](pathWidth)
hits = newSeq[(float32, int16)](partitioning.maxEntryCount)
numHits: int
aa: bool

Binary file not shown.

After

Width:  |  Height:  |  Size: 313 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 315 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 432 B

View file

@ -634,3 +634,34 @@ block:
image.strokePath(path, paint, strokeWidth = 10)
image.writeFile("tests/paths/opacityStroke.png")
block:
let
image = newImage(100, 100)
pathStr = "M0 0 L200 200"
color = rgba(255, 0, 0, 255)
image.strokePath(pathStr, color, strokeWidth = 10)
image.writeFile("tests/paths/pathStroke1Big.png")
block:
let
image = newMask(100, 100)
pathStr = "M0 0 L200 200"
image.strokePath(pathStr, strokeWidth = 10)
image.writeFile("tests/paths/pathStroke1BigMask.png")
block:
let
image = newImage(100, 100)
pathStr = "M99 99 L999 99 L999 100 L99 100 Z"
color = rgba(255, 0, 0, 255)
image.fillPath(pathStr, color)
image.writeFile("tests/paths/path1pxCover.png")
block:
let
image = newImage(100, 100)
pathStr = "M100 100 L999 100 L999 101 L100 101 Z"
color = rgba(255, 0, 0, 255)
image.fillPath(pathStr, color)
image.writeFile("tests/paths/path0pxCover.png")