pixie/examples/blur.nim

19 lines
432 B
Nim
Raw Normal View History

2020-12-04 16:32:03 +00:00
import pixie, chroma, vmath
var trees = readImage("examples/data/trees.png")
var blur = trees.copy()
2020-12-04 17:32:38 +00:00
var image = newImage(200, 200)
image.fill(rgba(255, 255, 255, 255))
2020-12-04 16:32:03 +00:00
var p = newPath()
2020-12-04 17:32:38 +00:00
p.polygon(100, 100, 70, sides=6)
2020-12-04 16:32:03 +00:00
p.closePath()
var mask = newImage(200, 200)
2020-12-04 17:32:38 +00:00
mask.fillPath(p, rgba(255, 255, 255, 255))
blur.blur(10)
2020-12-04 16:32:03 +00:00
blur.draw(mask, blendMode = bmMask)
image.draw(trees)
image.draw(blur)
image.writeFile("examples/blur.png")