pixie/examples/paint.nim
treeform c8c981b04e
Add paints to pixie. (#127)
Add paints for: solid, image, image tiled, linear, radial and angular gradients.
2021-02-24 21:49:21 -08:00

31 lines
567 B
Nim

import pixie
let
image = newImage(200, 200)
image.fill(rgba(255, 255, 255, 255))
image.fillPath(
"""
M 20 60
A 40 40 90 0 1 100 60
A 40 40 90 0 1 180 60
Q 180 120 100 180
Q 20 120 20 60
z
""",
Paint(
kind:pkGradientRadial,
gradientHandlePositions: @[
vec2(100, 100),
vec2(200, 100),
vec2(100, 200)
],
gradientStops: @[
ColorStop(color:rgba(255, 0, 0, 255).color, position: 0),
ColorStop(color:rgba(255, 0, 0, 40).color, position: 1.0),
]
)
)
image.writeFile("examples/paint.png")