3.0.2 bugfix
|
@ -1,4 +1,4 @@
|
|||
version = "3.0.1"
|
||||
version = "3.0.2"
|
||||
author = "Andre von Houck and Ryan Oldenburg"
|
||||
description = "Full-featured 2d graphics library for Nim."
|
||||
license = "MIT"
|
||||
|
|
|
@ -337,15 +337,13 @@ proc minifyBy2*(image: Image, power = 1): Image {.raises: [PixieError].} =
|
|||
result.setRgbaUnsafe(result.width - 1, y, rgbx)
|
||||
|
||||
if srcHeightIsOdd:
|
||||
let y = result.height - 1
|
||||
|
||||
for x in 0 ..< resultEvenWidth:
|
||||
let rgbx = mix(
|
||||
src.getRgbaUnsafe(x * 2 + 0, y),
|
||||
src.getRgbaUnsafe(x * 2 + 1, y),
|
||||
src.getRgbaUnsafe(x * 2 + 0, src.height - 1),
|
||||
src.getRgbaUnsafe(x * 2 + 1, src.height - 1),
|
||||
0.5
|
||||
) * 0.5
|
||||
result.setRgbaUnsafe(x, y, rgbx)
|
||||
result.setRgbaUnsafe(x, result.height - 1, rgbx)
|
||||
|
||||
if srcWidthIsOdd:
|
||||
result.setRgbaUnsafe(
|
||||
|
|
BIN
tests/images/diffs/rock_minified.png
Normal file
After Width: | Height: | Size: 2.4 KiB |
BIN
tests/images/diffs/rock_minified2.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 479 B After Width: | Height: | Size: 476 B |
BIN
tests/images/masters/rock_minified.png
Normal file
After Width: | Height: | Size: 5.8 KiB |
BIN
tests/images/masters/rock_minified2.png
Normal file
After Width: | Height: | Size: 3 KiB |
Before Width: | Height: | Size: 179 B After Width: | Height: | Size: 178 B |
BIN
tests/images/rendered/minify_rock.png
Normal file
After Width: | Height: | Size: 3.9 KiB |
BIN
tests/images/rendered/rock_minified.png
Normal file
After Width: | Height: | Size: 7.5 KiB |
BIN
tests/images/rendered/rock_minified2.png
Normal file
After Width: | Height: | Size: 3.6 KiB |
BIN
tests/images/rock.png
Normal file
After Width: | Height: | Size: 10 KiB |
|
@ -258,3 +258,15 @@ block:
|
|||
b.fill(rgba(0, 0, 0, 255))
|
||||
a.draw(b, scale(vec2(0.5, 0.5)))
|
||||
doDiff(a, "minify_odd")
|
||||
|
||||
block:
|
||||
let
|
||||
rock = readImage("tests/images/rock.png")
|
||||
minified = rock.minifyBy2()
|
||||
doDiff(minified, "rock_minified")
|
||||
|
||||
block:
|
||||
let
|
||||
rock = readImage("tests/images/rock.png")
|
||||
minified = rock.minifyBy2(2)
|
||||
doDiff(minified, "rock_minified2")
|
||||
|
|