pixie/examples/rounded_rectangle.nim

22 lines
440 B
Nim
Raw Normal View History

2020-12-01 17:49:41 +00:00
import pixie, chroma
2020-12-04 16:32:03 +00:00
var image = newImage(200, 200)
image.fill(rgba(255, 255, 255, 255))
2020-12-01 17:49:41 +00:00
var path = newPath()
let
x = 50.0
y = 50.0
w = 100.0
h = 100.0
2020-12-04 17:33:58 +00:00
r = 25.0
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)
2020-12-01 17:49:41 +00:00
path.closePath()
image.fillPath(path, rgba(255, 0, 0, 255))
image.writeFile("examples/rounded_rectangle.png")