scale as test

This commit is contained in:
Ryan Oldenburg 2021-04-26 19:50:00 -05:00
parent 41eeb8ce7a
commit 7d3d5acfb5
6 changed files with 5 additions and 15 deletions

View file

@ -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")

View file

@ -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)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 280 KiB

After

Width:  |  Height:  |  Size: 280 KiB

BIN
tests/images/svg/scale.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4 KiB

View file

Before

Width:  |  Height:  |  Size: 459 B

After

Width:  |  Height:  |  Size: 459 B

View file

@ -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")