pixie/examples/shadow.nim

23 lines
442 B
Nim
Raw Normal View History

2021-02-18 19:39:11 +00:00
import pixie
2021-02-14 04:45:27 +00:00
2021-02-18 22:40:35 +00:00
let image = newImage(200, 200)
2021-02-14 04:45:27 +00:00
image.fill(rgba(255, 255, 255, 255))
2021-09-08 02:13:36 +00:00
let path = newPath()
path.polygon(vec2(100, 100), 70, sides = 8)
2021-09-08 02:13:36 +00:00
let polygonImage = newImage(200, 200)
polygonImage.fillPath(path, rgba(255, 255, 255, 255))
2021-02-14 04:45:27 +00:00
2021-02-19 18:04:27 +00:00
let shadow = polygonImage.shadow(
2021-02-14 04:45:27 +00:00
offset = vec2(2, 2),
spread = 2,
blur = 10,
color = rgba(0, 0, 0, 200)
2021-02-19 18:04:27 +00:00
)
image.draw(shadow)
2021-02-18 22:40:35 +00:00
image.draw(polygonImage)
2021-02-14 04:45:27 +00:00
image.writeFile("examples/shadow.png")