pixie/examples/rounded_rectangle.nim
2021-01-29 14:21:48 -06:00

24 lines
436 B
Nim

import pixie, chroma
let image = newImage(200, 200)
image.fill(rgba(255, 255, 255, 255))
let
x = 50.0
y = 50.0
w = 100.0
h = 100.0
r = 25.0
var path: Path
path.moveTo(x+r, y)
path.arcTo(x+w, y, x+w, y+h, r)
path.arcTo(x+w, y+h, x, y+h, r)
path.arcTo(x, y+h, x, y, r)
path.arcTo(x, y, x+w, y, r)
path.closePath()
image.fillPath(path, rgba(255, 0, 0, 255))
image.writeFile("examples/rounded_rectangle.png")