From aa199103804417abcfe5cf1e3fb08ea0b1045083 Mon Sep 17 00:00:00 2001 From: Ryan Oldenburg Date: Tue, 23 Feb 2021 02:11:34 -0600 Subject: [PATCH] merge into test_paths.nim --- src/pixie/paths.nim | 4 +++- tests/test_paths.nim | 12 ++++++++++++ tests/test_pixelScale_fill.nim | 11 ----------- 3 files changed, 15 insertions(+), 12 deletions(-) delete mode 100644 tests/test_pixelScale_fill.nim diff --git a/src/pixie/paths.nim b/src/pixie/paths.nim index 2cac3a3..d9965e6 100644 --- a/src/pixie/paths.nim +++ b/src/pixie/paths.nim @@ -1256,7 +1256,9 @@ proc strokeShapes( if strokeShape.len > 0: result.add(strokeShape) -proc parseSomePath(path: SomePath, pixelScale:float32 = 1.0): seq[seq[Vec2]] {.inline.} = +proc parseSomePath( + path: SomePath, pixelScale: float32 = 1.0 +): seq[seq[Vec2]] {.inline.} = when type(path) is string: parsePath(path).commandsToShapes(pixelScale) elif type(path) is Path: diff --git a/tests/test_paths.nim b/tests/test_paths.nim index 0ed6582..7018717 100644 --- a/tests/test_paths.nim +++ b/tests/test_paths.nim @@ -202,3 +202,15 @@ block: path.arcTo(x, y, x + w, y, r) mask.fillPath(path) writeFile("tests/images/paths/pathRoundRectMask.png", mask.encodePng()) + +block: + let image = newImage(200, 200) + image.fill(rgba(255, 255, 255, 255)) + + var p = parsePath("M1 0.5C1 0.776142 0.776142 1 0.5 1C0.223858 1 0 0.776142 0 0.5C0 0.223858 0.223858 0 0.5 0C0.776142 0 1 0.223858 1 0.5Z") + image.fillPath(p, rgba(255, 0, 0, 255), scale(vec2(200, 200))) + + image.strokePath(p, rgba(0, 255, 0, 255), scale(vec2(200, 200)), + strokeWidth = 0.01) + + image.writeFile("tests/images/paths/pixelScale.png") diff --git a/tests/test_pixelScale_fill.nim b/tests/test_pixelScale_fill.nim deleted file mode 100644 index 49b02c0..0000000 --- a/tests/test_pixelScale_fill.nim +++ /dev/null @@ -1,11 +0,0 @@ -import pixie - -let image = newImage(200, 200) -image.fill(rgba(255, 255, 255, 255)) - -var p = parsePath("M1 0.5C1 0.776142 0.776142 1 0.5 1C0.223858 1 0 0.776142 0 0.5C0 0.223858 0.223858 0 0.5 0C0.776142 0 1 0.223858 1 0.5Z") -image.fillPath(p, rgba(255, 0, 0, 255), scale(vec2(200, 200))) - -image.strokePath(p, rgba(0, 255, 0, 255), scale(vec2(200, 200)), strokeWidth=0.01) - -image.writeFile("tests/images/paths/pixelScale.png")