morepretty
This commit is contained in:
parent
7b9d968381
commit
751b804679
|
@ -14,17 +14,17 @@ image.fillPath(
|
|||
z
|
||||
""",
|
||||
Paint(
|
||||
kind:pkGradientRadial,
|
||||
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),
|
||||
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")
|
||||
|
|
|
@ -14,9 +14,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,8 @@
|
|||
import bumpy, chroma, flatty/binny, os, pixie/blends, pixie/common,
|
||||
pixie/fileformats/bmp, pixie/fileformats/jpg, pixie/fileformats/png,
|
||||
pixie/fileformats/svg, pixie/paints, pixie/images, pixie/masks,
|
||||
pixie/paths, vmath
|
||||
pixie/fileformats/svg, pixie/images, pixie/masks, pixie/paints, pixie/paths, vmath
|
||||
|
||||
export blends, bumpy, chroma, common, paints, images, masks, paths, vmath
|
||||
export blends, bumpy, chroma, common, images, masks, paints, paths, vmath
|
||||
|
||||
type
|
||||
FileFormat* = enum
|
||||
|
|
|
@ -35,7 +35,6 @@ type
|
|||
bmIntersectMask
|
||||
bmExcludeMask
|
||||
|
||||
|
||||
Blender* = proc(backdrop, source: ColorRGBA): ColorRGBA ## Function signature
|
||||
## returned by blender.
|
||||
Masker* = proc(backdrop, source: uint8): uint8 ## Function signature returned
|
||||
|
|
|
@ -543,7 +543,9 @@ proc getRgbaSmooth*(image: Image, x, y: float32, wrapped = false): ColorRGBA =
|
|||
|
||||
lerp(bottomMix, topMix, diffY)
|
||||
|
||||
proc drawCorrect(a, b: Image | Mask, mat = mat3(), tiled = false, blendMode = bmNormal) =
|
||||
proc drawCorrect(
|
||||
a, b: Image | Mask, mat = mat3(), tiled = false, blendMode = bmNormal
|
||||
) =
|
||||
## Draws one image onto another using matrix with color blending.
|
||||
|
||||
when type(a) is Image:
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import chroma, common, images, vmath, blends
|
||||
import blends, chroma, common, images, vmath
|
||||
|
||||
type
|
||||
PaintKind* = enum
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import blends, bumpy, chroma, common, images, masks, strutils, vmath, paints
|
||||
import blends, bumpy, chroma, common, images, masks, paints, strutils, vmath
|
||||
|
||||
when defined(amd64) and not defined(pixieNoSimd):
|
||||
import nimsimd/sse2
|
||||
|
|
|
@ -14,8 +14,8 @@ block:
|
|||
image.fillPath(
|
||||
heartShape,
|
||||
Paint(
|
||||
kind:pkSolid,
|
||||
color:rgba(255, 0, 0, 255)
|
||||
kind: pkSolid,
|
||||
color: rgba(255, 0, 0, 255)
|
||||
)
|
||||
)
|
||||
image.writeFile("tests/images/paths/paintSolid.png")
|
||||
|
@ -26,9 +26,9 @@ block:
|
|||
image.fillPath(
|
||||
heartShape,
|
||||
Paint(
|
||||
kind:pkImage,
|
||||
image:decodePng(readFile("tests/images/png/baboon.png")),
|
||||
imageMat:scale(vec2(0.2, 0.2))
|
||||
kind: pkImage,
|
||||
image: decodePng(readFile("tests/images/png/baboon.png")),
|
||||
imageMat: scale(vec2(0.2, 0.2))
|
||||
)
|
||||
)
|
||||
image.writeFile("tests/images/paths/paintImage.png")
|
||||
|
@ -39,28 +39,27 @@ block:
|
|||
image.fillPath(
|
||||
heartShape,
|
||||
Paint(
|
||||
kind:pkImageTiled,
|
||||
image:decodePng(readFile("tests/images/png/baboon.png")),
|
||||
imageMat:scale(vec2(0.02, 0.02))
|
||||
kind: pkImageTiled,
|
||||
image: decodePng(readFile("tests/images/png/baboon.png")),
|
||||
imageMat: scale(vec2(0.02, 0.02))
|
||||
)
|
||||
)
|
||||
image.writeFile("tests/images/paths/paintImageTiled.png")
|
||||
|
||||
|
||||
block:
|
||||
let
|
||||
image = newImage(100, 100)
|
||||
image.fillPath(
|
||||
heartShape,
|
||||
Paint(
|
||||
kind:pkGradientLinear,
|
||||
kind: pkGradientLinear,
|
||||
gradientHandlePositions: @[
|
||||
vec2(0, 50),
|
||||
vec2(100, 50),
|
||||
],
|
||||
gradientStops: @[
|
||||
ColorStop(color:rgba(255, 0, 0, 255).color, position: 0),
|
||||
ColorStop(color:rgba(255, 0, 0, 40).color, position: 1.0),
|
||||
ColorStop(color: rgba(255, 0, 0, 255).color, position: 0),
|
||||
ColorStop(color: rgba(255, 0, 0, 40).color, position: 1.0),
|
||||
]
|
||||
)
|
||||
)
|
||||
|
@ -72,15 +71,15 @@ block:
|
|||
image.fillPath(
|
||||
heartShape,
|
||||
Paint(
|
||||
kind:pkGradientRadial,
|
||||
kind: pkGradientRadial,
|
||||
gradientHandlePositions: @[
|
||||
vec2(50, 50),
|
||||
vec2(100, 50),
|
||||
vec2(50, 100)
|
||||
],
|
||||
gradientStops: @[
|
||||
ColorStop(color:rgba(255, 0, 0, 255).color, position: 0),
|
||||
ColorStop(color:rgba(255, 0, 0, 40).color, position: 1.0),
|
||||
ColorStop(color: rgba(255, 0, 0, 255).color, position: 0),
|
||||
ColorStop(color: rgba(255, 0, 0, 40).color, position: 1.0),
|
||||
]
|
||||
)
|
||||
)
|
||||
|
@ -93,15 +92,15 @@ block:
|
|||
image.fillPath(
|
||||
heartShape,
|
||||
Paint(
|
||||
kind:pkGradientAngular,
|
||||
kind: pkGradientAngular,
|
||||
gradientHandlePositions: @[
|
||||
vec2(50, 50),
|
||||
vec2(100, 50),
|
||||
vec2(50, 100)
|
||||
],
|
||||
gradientStops: @[
|
||||
ColorStop(color:rgba(255, 0, 0, 255).color, position: 0),
|
||||
ColorStop(color:rgba(255, 0, 0, 40).color, position: 1.0),
|
||||
ColorStop(color: rgba(255, 0, 0, 255).color, position: 0),
|
||||
ColorStop(color: rgba(255, 0, 0, 40).color, position: 1.0),
|
||||
]
|
||||
)
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue