pixie/experiments/benchmark_cairo.nim

36 lines
663 B
Nim
Raw Normal View History

2021-02-14 18:27:32 +00:00
import benchy, cairo, chroma, math, pixie
2020-12-13 08:35:02 +00:00
var
surface = imageSurfaceCreate(FORMAT_ARGB32, 1000, 1000)
ctx = surface.create()
ctx.setSourceRgba(0, 0, 0, 1)
ctx.fill()
ctx.setSourceRgba(0, 0, 1, 1)
timeIt "cairo":
ctx.newPath()
ctx.moveTo(0, 0)
ctx.lineTo(500, 0)
ctx.lineTo(500, 500)
ctx.lineTo(0, 500)
ctx.closePath()
ctx.fill()
surface.flush()
2021-02-13 23:37:59 +00:00
# discard surface.writeToPng("cairo.png")
2020-12-13 08:35:02 +00:00
var a = newImage(1000, 1000)
a.fill(rgba(0, 0, 0, 255))
timeIt "pixie":
2021-03-03 21:18:20 +00:00
var p: pixie.Path
2020-12-13 08:35:02 +00:00
p.moveTo(0, 0)
p.lineTo(500, 0)
p.lineTo(500, 500)
p.lineTo(0, 500)
p.closePath()
a.fillPath(p, rgba(0, 0, 255, 255))
2021-02-13 23:37:59 +00:00
# a.writeFile("pixie.png")