2021-01-26 22:31:07 +00:00
|
|
|
import cairo, math, benchy, pixie, pixie/paths, chroma
|
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()
|
|
|
|
|
|
|
|
discard surface.writeToPng("cairo.png")
|
|
|
|
|
|
|
|
var a = newImage(1000, 1000)
|
|
|
|
a.fill(rgba(0, 0, 0, 255))
|
|
|
|
|
|
|
|
timeIt "pixie":
|
2021-01-26 00:47:05 +00:00
|
|
|
var p: paths.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))
|
|
|
|
|
|
|
|
discard surface.writeToPng("pixie.png")
|