pixie/tests/fuzz_image_draw.nim

56 lines
1.6 KiB
Nim
Raw Normal View History

2022-01-03 23:41:36 +00:00
import pixie, random
2021-12-17 04:19:18 +00:00
randomize()
2022-07-31 01:25:09 +00:00
for i in 0 ..< 250:
2021-12-17 04:19:18 +00:00
let a = newImage(rand(1 .. 20), rand(1 .. 20))
for j in 0 ..< 25:
let b = newImage(rand(1 .. 20), rand(1 .. 20))
2022-07-31 01:25:09 +00:00
let translation = vec2(rand(-25..25).float32, rand(-25..25).float32)
2021-12-17 04:19:18 +00:00
2022-07-31 01:25:09 +00:00
echo a, " ", b, " ", translation
2021-12-17 04:19:18 +00:00
a.draw(b, translate(vec2(translation.x.trunc, translation.y.trunc)))
2022-07-31 01:25:09 +00:00
a.draw(b, translate(translation))
2021-12-17 04:19:18 +00:00
2022-07-31 01:25:09 +00:00
for i in 0 ..< 250:
2021-12-17 04:19:18 +00:00
let a = newImage(rand(1 .. 2000), rand(1 .. 2000))
for j in 0 ..< 25:
let b = newImage(rand(1 .. 1000), rand(1 .. 1000))
2022-07-31 01:25:09 +00:00
let translation = vec2(rand(-2500..2500).float32, rand(-2500..2500).float32)
2021-12-17 04:19:18 +00:00
2022-07-31 01:25:09 +00:00
echo a, " ", b, " ", translation
2021-12-17 04:19:18 +00:00
a.draw(b, translate(vec2(translation.x.trunc, translation.y.trunc)))
2022-07-31 01:25:09 +00:00
a.draw(b, translate(translation))
2022-07-31 17:12:10 +00:00
for i in 0 ..< 25:
let a = newImage(rand(1 .. 20), rand(1 .. 20))
for j in 0 ..< 25:
let b = newImage(rand(1 .. 20), rand(1 .. 20))
let
translation = vec2(rand(25.0), rand(25.0)) - vec2(5, 5)
rotation = rand(2 * PI).float32
echo a, " ", b, " ", translation, " ", rotation
a.draw(b, translate(vec2(translation.x, translation.y)))
a.draw(b, translate(translation) * rotate(rotation))
for i in 0 ..< 25:
let a = newImage(rand(1 .. 2000), rand(1 .. 2000))
for j in 0 ..< 25:
let b = newImage(rand(1 .. 1000), rand(1 .. 1000))
let
translation = vec2(rand(2500.0), rand(2500.0)) - vec2(500, 500)
rotation = rand(2 * PI).float32
echo a, " ", b, " ", translation, " ", rotation
a.draw(b, translate(vec2(translation.x, translation.y)))
a.draw(b, translate(translation) * rotate(rotation))