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,6 +168,19 @@ image.draw(lines)
### Gradient ### Gradient
[examples/gradient.nim](examples/gradient.nim) [examples/gradient.nim](examples/gradient.nim)
```nim ```nim
let paint = 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.fillPath( image.fillPath(
""" """
M 20 60 M 20 60
@ -177,18 +190,7 @@ image.fillPath(
Q 20 120 20 60 Q 20 120 20 60
z z
""", """,
Paint( 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),
]
)
) )
``` ```
![example output](examples/gradient.png) ![example output](examples/gradient.png)
@ -205,9 +207,9 @@ path.polygon(
image.fillPath( image.fillPath(
path, path,
Paint( Paint(
kind:pkImageTiled, kind: pkImageTiled,
image: readImage("tests/images/png/baboon.png"), image: readImage("tests/images/png/baboon.png"),
imageMat:scale(vec2(0.08, 0.08)) imageMat: scale(vec2(0.08, 0.08))
) )
) )
``` ```

View file

@ -1,9 +1,21 @@
import pixie import pixie
let let image = newImage(200, 200)
image = newImage(200, 200)
image.fill(rgba(255, 255, 255, 255)) image.fill(rgba(255, 255, 255, 255))
let paint = 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.fillPath( image.fillPath(
""" """
M 20 60 M 20 60
@ -13,18 +25,7 @@ image.fillPath(
Q 20 120 20 60 Q 20 120 20 60
z z
""", """,
Paint( 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") image.writeFile("examples/paint.png")

View file

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

View file

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 40 KiB