pixie/examples/blur.nim

23 lines
395 B
Nim
Raw Normal View History

2021-02-18 19:39:11 +00:00
import pixie
2020-12-04 16:32:03 +00:00
2021-01-29 20:17:24 +00:00
let
trees = readImage("examples/data/trees.png")
blur = trees.copy()
image = newImage(200, 200)
2020-12-04 17:32:38 +00:00
image.fill(rgba(255, 255, 255, 255))
2021-08-13 02:32:41 +00:00
let path = newPath()
path.polygon(vec2(100, 100), 70, sides = 6)
2021-02-09 04:50:39 +00:00
let mask = newMask(200, 200)
2021-08-13 02:32:41 +00:00
mask.fillPath(path)
2021-01-29 20:17:24 +00:00
2020-12-04 17:43:33 +00:00
blur.blur(20)
2020-12-04 16:32:03 +00:00
blur.draw(mask, blendMode = bmMask)
2021-01-29 20:17:24 +00:00
2020-12-04 16:32:03 +00:00
image.draw(trees)
image.draw(blur)
image.writeFile("examples/blur.png")