pixie/tests/benchmark_images.nim

26 lines
443 B
Nim
Raw Normal View History

2020-12-09 00:10:20 +00:00
import chroma, pixie, benchy, system/memory
2020-12-03 20:21:58 +00:00
2021-01-06 20:18:47 +00:00
let a = newImage(2560, 1440)
2020-12-03 20:21:58 +00:00
timeIt "fill":
2020-12-04 06:11:54 +00:00
a.fill(rgba(255, 255, 255, 255))
2020-12-03 20:21:58 +00:00
doAssert a[0, 0] == rgba(255, 255, 255, 255)
2020-12-04 06:11:54 +00:00
keep(a)
2020-12-03 20:21:58 +00:00
2020-12-09 00:10:20 +00:00
timeIt "fill_rgba":
a.fill(rgba(63, 127, 191, 255))
doAssert a[0, 0] == rgba(63, 127, 191, 255)
keep(a)
2020-12-03 20:21:58 +00:00
timeIt "invert":
2020-12-04 06:11:54 +00:00
a.invert()
keep(a)
2020-12-03 20:32:50 +00:00
timeIt "applyOpacity":
2020-12-04 06:11:54 +00:00
a.applyOpacity(0.5)
keep(a)
2020-12-03 20:32:50 +00:00
timeIt "sharpOpacity":
2020-12-04 06:11:54 +00:00
a.sharpOpacity()
keep(a)