nimpretty bandaid

This commit is contained in:
Ryan Oldenburg 2021-02-25 12:05:46 -06:00
parent 3c3cd499ea
commit 29479a7c6a
5 changed files with 34 additions and 35 deletions

View file

@ -168,16 +168,7 @@ image.draw(lines)
### Gradient
[examples/gradient.nim](examples/gradient.nim)
```nim
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(
let paint = Paint(
kind: pkGradientRadial,
gradientHandlePositions: @[
vec2(100, 100),
@ -189,6 +180,17 @@ image.fillPath(
ColorStop(color: rgba(255, 0, 0, 40).color, position: 1.0),
]
)
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
)
```
![example output](examples/gradient.png)

View file

@ -1,19 +1,9 @@
import pixie
let
image = newImage(200, 200)
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(
let paint = Paint(
kind: pkGradientRadial,
gradientHandlePositions: @[
vec2(100, 100),
@ -25,6 +15,17 @@ image.fillPath(
ColorStop(color: rgba(255, 0, 0, 40).color, position: 1.0),
]
)
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
)
image.writeFile("examples/paint.png")

View file

@ -1,8 +1,6 @@
import pixie
let
image = newImage(200, 200)
let image = newImage(200, 200)
image.fill(rgba(255, 255, 255, 255))
image.fillPath(

View file

@ -1,8 +1,6 @@
import pixie
let
image = newImage(200, 200)
let image = newImage(200, 200)
image.fill(rgba(255, 255, 255, 255))
var path: Path

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 40 KiB