nimpretty bandaid
This commit is contained in:
parent
3c3cd499ea
commit
29479a7c6a
30
README.md
30
README.md
|
@ -168,6 +168,19 @@ image.draw(lines)
|
|||
### Gradient
|
||||
[examples/gradient.nim](examples/gradient.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(
|
||||
"""
|
||||
M 20 60
|
||||
|
@ -177,18 +190,7 @@ image.fillPath(
|
|||
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),
|
||||
]
|
||||
)
|
||||
paint
|
||||
)
|
||||
```
|
||||
![example output](examples/gradient.png)
|
||||
|
@ -205,9 +207,9 @@ path.polygon(
|
|||
image.fillPath(
|
||||
path,
|
||||
Paint(
|
||||
kind:pkImageTiled,
|
||||
kind: pkImageTiled,
|
||||
image: readImage("tests/images/png/baboon.png"),
|
||||
imageMat:scale(vec2(0.08, 0.08))
|
||||
imageMat: scale(vec2(0.08, 0.08))
|
||||
)
|
||||
)
|
||||
```
|
||||
|
|
|
@ -1,9 +1,21 @@
|
|||
import pixie
|
||||
|
||||
let
|
||||
image = newImage(200, 200)
|
||||
|
||||
let image = newImage(200, 200)
|
||||
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(
|
||||
"""
|
||||
M 20 60
|
||||
|
@ -13,18 +25,7 @@ image.fillPath(
|
|||
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),
|
||||
]
|
||||
)
|
||||
paint
|
||||
)
|
||||
|
||||
image.writeFile("examples/paint.png")
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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 |
Loading…
Reference in a new issue