fix path parse bug for m 1 2 3 4 5 6...
Before Width: | Height: | Size: 42 KiB After Width: | Height: | Size: 42 KiB |
|
@ -136,6 +136,11 @@ proc parsePath*(path: string): Path =
|
|||
"Invalid path, wrong number of parameters"
|
||||
)
|
||||
for batch in 0 ..< numbers.len div paramCount:
|
||||
if batch > 0:
|
||||
if kind == Move:
|
||||
kind = Line
|
||||
elif kind == RMove:
|
||||
kind = RLine
|
||||
result.commands.add(PathCommand(
|
||||
kind: kind,
|
||||
numbers: numbers[batch * paramCount ..< (batch + 1) * paramCount]
|
||||
|
@ -1523,7 +1528,11 @@ proc fillPath*(
|
|||
mask = newMask(image.width, image.height)
|
||||
fill = newImage(image.width, image.height)
|
||||
|
||||
mask.fillPath(parseSomePath(path), transform, windingRule)
|
||||
mask.fillPath(
|
||||
parseSomePath(path, transform.pixelScale()),
|
||||
transform,
|
||||
windingRule
|
||||
)
|
||||
|
||||
case paint.kind:
|
||||
of pkSolid:
|
||||
|
@ -1595,7 +1604,7 @@ proc strokePath*(
|
|||
fill = newImage(image.width, image.height)
|
||||
|
||||
mask.strokePath(
|
||||
parseSomePath(path),
|
||||
parseSomePath(path, transform.pixelScale()),
|
||||
transform,
|
||||
strokeWidth,
|
||||
lineCap,
|
||||
|
|
Before Width: | Height: | Size: 357 KiB After Width: | Height: | Size: 357 KiB |
Before Width: | Height: | Size: 631 KiB After Width: | Height: | Size: 636 KiB |
Before Width: | Height: | Size: 1.4 MiB After Width: | Height: | Size: 1.4 MiB |
|
@ -5,7 +5,14 @@ block:
|
|||
m 1 2 3 4 5 6
|
||||
"""
|
||||
let path = parsePath(pathStr)
|
||||
doAssert $path == "m1 2 m3 4 m5 6"
|
||||
doAssert $path == "m1 2 l3 4 l5 6"
|
||||
|
||||
block:
|
||||
let pathStr = """
|
||||
l 1 2 3 4 5 6
|
||||
"""
|
||||
let path = parsePath(pathStr)
|
||||
doAssert $path == "l1 2 l3 4 l5 6"
|
||||
|
||||
block:
|
||||
let pathStr = """
|
||||
|
|