scale as test
This commit is contained in:
parent
41eeb8ce7a
commit
7d3d5acfb5
6 changed files with 5 additions and 15 deletions
examples
src/pixie/fileformats
tests
|
@ -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")
|
|
|
@ -373,7 +373,8 @@ proc decodeSvg*(data: string, width = 0, height = 0): Image =
|
||||||
|
|
||||||
if viewBoxMinX != 0 or viewBoxMinY != 0:
|
if viewBoxMinX != 0 or viewBoxMinY != 0:
|
||||||
rootCtx.transform = rootCtx.transform * translate(
|
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
|
if width == 0 and height == 0: # Default to the view box size
|
||||||
result = newImage(viewBoxWidth, viewBoxHeight)
|
result = newImage(viewBoxWidth, viewBoxHeight)
|
||||||
|
|
Binary file not shown.
Before ![]() (image error) Size: 280 KiB After ![]() (image error) Size: 280 KiB ![]() ![]() |
BIN
tests/images/svg/scale.png
Normal file
BIN
tests/images/svg/scale.png
Normal file
Binary file not shown.
After ![]() (image error) Size: 4 KiB |
Before (image error) Size: 459 B After (image error) Size: 459 B |
|
@ -10,7 +10,8 @@ const files = [
|
||||||
"ellipse01",
|
"ellipse01",
|
||||||
"triangle01",
|
"triangle01",
|
||||||
"quad01",
|
"quad01",
|
||||||
"Ghostscript_Tiger"
|
"Ghostscript_Tiger",
|
||||||
|
"scale"
|
||||||
]
|
]
|
||||||
|
|
||||||
for file in files:
|
for file in files:
|
||||||
|
@ -21,4 +22,4 @@ for file in files:
|
||||||
|
|
||||||
let (score, _) = diff(image, gold)
|
let (score, _) = diff(image, gold)
|
||||||
doAssert score < 1
|
doAssert score < 1
|
||||||
# image.writeFile(&"tests/images/svg/{file}.png")
|
image.writeFile(&"tests/images/svg/{file}.png")
|
||||||
|
|
Loading…
Reference in a new issue