diff --git a/examples/scale.nim b/examples/scale.nim deleted file mode 100644 index 2003f11..0000000 --- a/examples/scale.nim +++ /dev/null @@ -1,12 +0,0 @@ -import pixie - -let image = newImage(100, 100) -image.fill(rgba(255, 255, 255, 255)) - -let flower = readImage("examples/data/scale.svg") - -image.draw( - flower -) - -image.writeFile("examples/scale.png") diff --git a/src/pixie/fileformats/svg.nim b/src/pixie/fileformats/svg.nim index d3f1769..a01d02e 100644 --- a/src/pixie/fileformats/svg.nim +++ b/src/pixie/fileformats/svg.nim @@ -373,7 +373,8 @@ proc decodeSvg*(data: string, width = 0, height = 0): Image = if viewBoxMinX != 0 or viewBoxMinY != 0: rootCtx.transform = rootCtx.transform * translate( - vec2(-viewBoxMinX.float32, -viewBoxMinY.float32)) + vec2(-viewBoxMinX.float32, -viewBoxMinY.float32) + ) if width == 0 and height == 0: # Default to the view box size result = newImage(viewBoxWidth, viewBoxHeight) diff --git a/tests/images/svg/flat-color-icons.png b/tests/images/svg/flat-color-icons.png index dffa44b..661bd07 100644 Binary files a/tests/images/svg/flat-color-icons.png and b/tests/images/svg/flat-color-icons.png differ diff --git a/tests/images/svg/scale.png b/tests/images/svg/scale.png new file mode 100644 index 0000000..e5e52c0 Binary files /dev/null and b/tests/images/svg/scale.png differ diff --git a/examples/data/scale.svg b/tests/images/svg/scale.svg similarity index 100% rename from examples/data/scale.svg rename to tests/images/svg/scale.svg diff --git a/tests/test_svg.nim b/tests/test_svg.nim index e9dec8d..8acb6d8 100644 --- a/tests/test_svg.nim +++ b/tests/test_svg.nim @@ -10,7 +10,8 @@ const files = [ "ellipse01", "triangle01", "quad01", - "Ghostscript_Tiger" + "Ghostscript_Tiger", + "scale" ] for file in files: @@ -21,4 +22,4 @@ for file in files: let (score, _) = diff(image, gold) doAssert score < 1 - # image.writeFile(&"tests/images/svg/{file}.png") + image.writeFile(&"tests/images/svg/{file}.png")