commit
bc0a2787f4
10 changed files with 23 additions and 12 deletions
|
@ -99,7 +99,7 @@ exportSeq seq[float32]:
|
||||||
exportSeq seq[Span]:
|
exportSeq seq[Span]:
|
||||||
procs:
|
procs:
|
||||||
typeset(seq[Span], Vec2, HorizontalAlignment, VerticalAlignment, bool)
|
typeset(seq[Span], Vec2, HorizontalAlignment, VerticalAlignment, bool)
|
||||||
computeBounds(seq[Span])
|
layoutBounds(seq[Span])
|
||||||
|
|
||||||
exportRefObject Image:
|
exportRefObject Image:
|
||||||
fields:
|
fields:
|
||||||
|
@ -232,7 +232,7 @@ exportRefObject Font:
|
||||||
scale(Font)
|
scale(Font)
|
||||||
defaultLineHeight
|
defaultLineHeight
|
||||||
typeset(Font, string, Vec2, HorizontalAlignment, VerticalAlignment, bool)
|
typeset(Font, string, Vec2, HorizontalAlignment, VerticalAlignment, bool)
|
||||||
computeBounds(Font, string)
|
layoutBounds(Font, string)
|
||||||
|
|
||||||
exportRefObject Span:
|
exportRefObject Span:
|
||||||
fields:
|
fields:
|
||||||
|
@ -243,7 +243,8 @@ exportRefObject Span:
|
||||||
|
|
||||||
exportRefObject Arrangement:
|
exportRefObject Arrangement:
|
||||||
procs:
|
procs:
|
||||||
computeBounds(Arrangement)
|
layoutBounds(Arrangement)
|
||||||
|
computeBounds(Arrangement, Mat3)
|
||||||
|
|
||||||
exportRefObject Context:
|
exportRefObject Context:
|
||||||
fields:
|
fields:
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 88 KiB After Width: | Height: | Size: 88 KiB |
|
@ -1,4 +1,4 @@
|
||||||
version = "4.1.0"
|
version = "4.2.0"
|
||||||
author = "Andre von Houck and Ryan Oldenburg"
|
author = "Andre von Houck and Ryan Oldenburg"
|
||||||
description = "Full-featured 2d graphics library for Nim."
|
description = "Full-featured 2d graphics library for Nim."
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
@ -6,7 +6,7 @@ license = "MIT"
|
||||||
srcDir = "src"
|
srcDir = "src"
|
||||||
|
|
||||||
requires "nim >= 1.4.8"
|
requires "nim >= 1.4.8"
|
||||||
requires "vmath >= 1.1.0"
|
requires "vmath >= 1.1.4"
|
||||||
requires "chroma >= 0.2.5"
|
requires "chroma >= 0.2.5"
|
||||||
requires "zippy >= 0.9.7"
|
requires "zippy >= 0.9.7"
|
||||||
requires "flatty >= 0.2.4"
|
requires "flatty >= 0.2.4"
|
||||||
|
|
|
@ -598,7 +598,7 @@ proc textUber(
|
||||||
proc computeBounds*(
|
proc computeBounds*(
|
||||||
arrangement: Arrangement,
|
arrangement: Arrangement,
|
||||||
transform = mat3()
|
transform = mat3()
|
||||||
): Rect =
|
): Rect {.raises: [PixieError].} =
|
||||||
let fullPath = newPath()
|
let fullPath = newPath()
|
||||||
for path in arrangement.computePaths():
|
for path in arrangement.computePaths():
|
||||||
fullPath.addPath(path)
|
fullPath.addPath(path)
|
||||||
|
|
|
@ -104,6 +104,7 @@ proc fillGradientLinear(image: Image, paint: Paint) =
|
||||||
if paint.gradientStops.len == 0:
|
if paint.gradientStops.len == 0:
|
||||||
raise newException(PixieError, "Gradient must have at least 1 color stop")
|
raise newException(PixieError, "Gradient must have at least 1 color stop")
|
||||||
|
|
||||||
|
paint.opacity = clamp(paint.opacity, 0, 1)
|
||||||
if paint.opacity == 0:
|
if paint.opacity == 0:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -177,6 +178,7 @@ proc fillGradientRadial(image: Image, paint: Paint) =
|
||||||
if paint.gradientStops.len == 0:
|
if paint.gradientStops.len == 0:
|
||||||
raise newException(PixieError, "Gradient must have at least 1 color stop")
|
raise newException(PixieError, "Gradient must have at least 1 color stop")
|
||||||
|
|
||||||
|
paint.opacity = clamp(paint.opacity, 0, 1)
|
||||||
if paint.opacity == 0:
|
if paint.opacity == 0:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -208,6 +210,7 @@ proc fillGradientAngular(image: Image, paint: Paint) =
|
||||||
if paint.gradientStops.len == 0:
|
if paint.gradientStops.len == 0:
|
||||||
raise newException(PixieError, "Gradient must have at least 1 color stop")
|
raise newException(PixieError, "Gradient must have at least 1 color stop")
|
||||||
|
|
||||||
|
paint.opacity = clamp(paint.opacity, 0, 1)
|
||||||
if paint.opacity == 0:
|
if paint.opacity == 0:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import blends, bumpy, chroma, common, images, internal, masks, paints, strutils, vmath, fenv
|
import blends, bumpy, chroma, common, fenv, images, internal, masks, paints,
|
||||||
|
strutils, vmath
|
||||||
|
|
||||||
when defined(amd64) and not defined(pixieNoSimd):
|
when defined(amd64) and not defined(pixieNoSimd):
|
||||||
import nimsimd/sse2
|
import nimsimd/sse2
|
||||||
|
@ -1922,6 +1923,8 @@ proc fillPath*(
|
||||||
windingRule = NonZero
|
windingRule = NonZero
|
||||||
) {.raises: [PixieError].} =
|
) {.raises: [PixieError].} =
|
||||||
## Fills a path.
|
## Fills a path.
|
||||||
|
paint.opacity = clamp(paint.opacity, 0, 1)
|
||||||
|
|
||||||
if paint.opacity == 0:
|
if paint.opacity == 0:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -2000,6 +2003,8 @@ proc strokePath*(
|
||||||
dashes: seq[float32] = @[]
|
dashes: seq[float32] = @[]
|
||||||
) {.raises: [PixieError].} =
|
) {.raises: [PixieError].} =
|
||||||
## Strokes a path.
|
## Strokes a path.
|
||||||
|
paint.opacity = clamp(paint.opacity, 0, 1)
|
||||||
|
|
||||||
if paint.opacity == 0:
|
if paint.opacity == 0:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import pixie/common, pixie/fileformats/bmp, random, strformat, flatty/binny, os
|
import flatty/binny, os, pixie/common, pixie/fileformats/bmp, random, strformat
|
||||||
|
|
||||||
randomize()
|
randomize()
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import chroma, pixie, pixie/fileformats/bmp, os, strutils
|
import chroma, os, pixie, pixie/fileformats/bmp, strutils
|
||||||
|
|
||||||
# block:
|
# block:
|
||||||
# var image = newImage(4, 2)
|
# var image = newImage(4, 2)
|
||||||
|
|
|
@ -293,7 +293,6 @@ block:
|
||||||
let a = newImage(100, 100)
|
let a = newImage(100, 100)
|
||||||
a.fill(color(1, 1, 1, 1))
|
a.fill(color(1, 1, 1, 1))
|
||||||
|
|
||||||
|
|
||||||
let draws = [
|
let draws = [
|
||||||
# Overlaps in bounds
|
# Overlaps in bounds
|
||||||
(vec2(-50, -50), color(1, 0, 0, 1)),
|
(vec2(-50, -50), color(1, 0, 0, 1)),
|
||||||
|
|
|
@ -460,7 +460,10 @@ block:
|
||||||
block:
|
block:
|
||||||
let mask = newMask(100, 100)
|
let mask = newMask(100, 100)
|
||||||
mask.fillPath("M 10.1 10.1 H 60.1 V 60.1 H 10.1 z")
|
mask.fillPath("M 10.1 10.1 H 60.1 V 60.1 H 10.1 z")
|
||||||
mask.fillPath("M 30.1 30.1 H 80.1 V 80.1 H 30.1 z", blendMode = ExcludeMaskBlend)
|
mask.fillPath(
|
||||||
|
"M 30.1 30.1 H 80.1 V 80.1 H 30.1 z",
|
||||||
|
blendMode = ExcludeMaskBlend
|
||||||
|
)
|
||||||
writeFile("tests/paths/maskRectExcludeMaskAA.png", mask.encodePng())
|
writeFile("tests/paths/maskRectExcludeMaskAA.png", mask.encodePng())
|
||||||
|
|
||||||
block:
|
block:
|
||||||
|
@ -704,7 +707,7 @@ block:
|
||||||
let image = newImage(200, 200)
|
let image = newImage(200, 200)
|
||||||
image.fill(rgba(255, 255, 255, 255))
|
image.fill(rgba(255, 255, 255, 255))
|
||||||
|
|
||||||
let pathStr ="""
|
let pathStr = """
|
||||||
L -16370.0 -18156.0
|
L -16370.0 -18156.0
|
||||||
A 4100 4100 0 1 0 -19670 -14134
|
A 4100 4100 0 1 0 -19670 -14134
|
||||||
Z
|
Z
|
||||||
|
|
Loading…
Reference in a new issue