pixie/tests/benchmark_images_draw.nim

63 lines
1.3 KiB
Nim
Raw Normal View History

2021-02-14 18:27:32 +00:00
import benchy, chroma, pixie, vmath
2020-11-22 00:51:29 +00:00
2020-12-04 06:11:54 +00:00
block:
2021-02-11 19:26:30 +00:00
let
a = newImage(1000, 1000)
b = newImage(50, 50)
2020-12-04 06:11:54 +00:00
a.fill(rgba(255, 0, 0, 255))
b.fill(rgba(0, 255, 0, 255))
2021-02-11 19:26:30 +00:00
timeIt "draw small-on-big bmNormal":
a.draw(b, translate(vec2(25, 25)), bmNormal)
2020-12-04 06:11:54 +00:00
keep(b)
block:
2021-02-11 19:26:30 +00:00
let
a = newImage(1000, 1000)
b = newImage(50, 50)
2020-12-04 06:11:54 +00:00
a.fill(rgba(255, 0, 0, 255))
b.fill(rgba(0, 255, 0, 255))
2021-02-11 19:26:30 +00:00
timeIt "draw small-on-big Smooth bmNormal":
a.draw(b, translate(vec2(25.2, 25.2)), bmNormal)
2020-12-04 06:11:54 +00:00
keep(b)
2020-11-26 06:32:50 +00:00
2020-12-09 08:28:49 +00:00
block:
2021-02-11 19:26:30 +00:00
let
a = newImage(1000, 1000)
b = newImage(500, 500)
2020-12-09 08:28:49 +00:00
a.fill(rgba(255, 0, 0, 255))
b.fill(rgba(0, 255, 0, 255))
2021-02-11 19:26:30 +00:00
timeIt "draw big-on-bigger bmNormal":
a.draw(b, translate(vec2(25, 25)), bmNormal)
2020-12-09 08:28:49 +00:00
keep(b)
2020-12-04 06:11:54 +00:00
block:
2021-02-11 19:26:30 +00:00
let
a = newImage(1000, 1000)
b = newImage(500, 500)
2020-12-04 06:11:54 +00:00
a.fill(rgba(255, 0, 0, 255))
b.fill(rgba(0, 255, 0, 255))
2020-11-26 06:32:50 +00:00
2021-02-11 19:26:30 +00:00
timeIt "draw big-on-bigger Smooth bmNormal":
2020-11-28 00:51:37 +00:00
a.draw(b, translate(vec2(25.2, 25.2)), bmNormal)
2020-12-04 06:11:54 +00:00
keep(b)
2021-02-11 21:05:34 +00:00
block:
let
a = newImage(100, 100)
b = newImage(50, 50)
timeIt "shadow":
b.fill(rgba(0, 0, 0, 255))
a.draw(b, vec2(25, 25))
let shadow = a.shadow(
offset = vec2(0, 0),
spread = 10,
blur = 10,
color = rgba(0, 0, 0, 255)
)
keep(shadow)