pixie/examples/blur.nim

24 lines
403 B
Nim
Raw Normal View History

2021-02-14 18:27:32 +00:00
import chroma, pixie, vmath
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-01-29 20:17:24 +00:00
var p: Path
2021-02-14 18:27:32 +00:00
p.polygon(100, 100, 70, sides = 6)
2020-12-04 16:32:03 +00:00
p.closePath()
2021-01-29 20:17:24 +00:00
2021-02-09 04:50:39 +00:00
let mask = newMask(200, 200)
mask.fillPath(p)
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")