The magnifyBy2 fix.
|
@ -653,16 +653,22 @@ proc drawUber(
|
||||||
p = matInv * vec2(0 + h, 0 + h)
|
p = matInv * vec2(0 + h, 0 + h)
|
||||||
dx = matInv * vec2(1 + h, 0 + h) - p
|
dx = matInv * vec2(1 + h, 0 + h) - p
|
||||||
dy = matInv * vec2(0 + h, 1 + h) - p
|
dy = matInv * vec2(0 + h, 1 + h) - p
|
||||||
minFilterBy2 = max(dx.length, dy.length)
|
filterBy2 = max(dx.length, dy.length)
|
||||||
b = b
|
b = b
|
||||||
|
|
||||||
while minFilterBy2 >= 2.0:
|
while filterBy2 >= 2.0:
|
||||||
b = b.minifyBy2()
|
b = b.minifyBy2()
|
||||||
p /= 2
|
p /= 2
|
||||||
dx /= 2
|
dx /= 2
|
||||||
dy /= 2
|
dy /= 2
|
||||||
minFilterBy2 /= 2
|
filterBy2 /= 2
|
||||||
matInv = matInv * scale(vec2(0.5, 0.5))
|
|
||||||
|
while filterBy2 <= 0.5:
|
||||||
|
b = b.magnifyBy2()
|
||||||
|
p *= 2
|
||||||
|
dx *= 2
|
||||||
|
dy *= 2
|
||||||
|
filterBy2 *= 2
|
||||||
|
|
||||||
let smooth = not(
|
let smooth = not(
|
||||||
dx.length == 1.0 and
|
dx.length == 1.0 and
|
||||||
|
|
BIN
tests/images/diffs/smooth11.png
Normal file
After Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 775 B After Width: | Height: | Size: 574 B |
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 326 B |
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 326 B |
BIN
tests/images/masters/smooth11.png
Normal file
After Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 763 B After Width: | Height: | Size: 699 B |
BIN
tests/images/rendered/smooth11.png
Normal file
After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 785 B After Width: | Height: | Size: 814 B |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
|
@ -151,7 +151,7 @@ block:
|
||||||
b = newImage(50, 50)
|
b = newImage(50, 50)
|
||||||
a.fill(rgba(255, 255, 255, 255))
|
a.fill(rgba(255, 255, 255, 255))
|
||||||
b.fill(rgbx(0, 0, 0, 255))
|
b.fill(rgbx(0, 0, 0, 255))
|
||||||
a.draw(b, translate(vec2(14.64, 50.4)) * rotate(45.toRadians))
|
a.draw(b, translate(vec2(0, 50)) * rotate(45.toRadians))
|
||||||
doDiff(a, "smooth2")
|
doDiff(a, "smooth2")
|
||||||
|
|
||||||
block:
|
block:
|
||||||
|
@ -226,3 +226,14 @@ block:
|
||||||
let m = translate(vec2(0.5, 0.5)) * scale(vec2(2, 2))
|
let m = translate(vec2(0.5, 0.5)) * scale(vec2(2, 2))
|
||||||
a.draw(b, m)
|
a.draw(b, m)
|
||||||
doDiff(a, "smooth10")
|
doDiff(a, "smooth10")
|
||||||
|
|
||||||
|
block:
|
||||||
|
let
|
||||||
|
a = newImage(100, 100)
|
||||||
|
b = readImage(&"tests/images/turtle.png")
|
||||||
|
a.fill(rgba(255, 255, 255, 255))
|
||||||
|
let m = translate(vec2(-43.29, -103.87)) *
|
||||||
|
rotate(-15.toRadians) *
|
||||||
|
scale(vec2(263.86/40, 263.86/40))
|
||||||
|
a.draw(b, m)
|
||||||
|
doDiff(a, "smooth11")
|
||||||
|
|