cleaner, icons megatest
This commit is contained in:
parent
dfc062e0f2
commit
dbee65c608
3 changed files with 22 additions and 40 deletions
|
@ -221,6 +221,18 @@ proc decodeCtx(inherited: Ctx, node: XmlNode): Ctx =
|
||||||
else:
|
else:
|
||||||
failInvalidTransform(transform)
|
failInvalidTransform(transform)
|
||||||
|
|
||||||
|
proc fill(img: Image, ctx: Ctx, path: Path) {.inline.} =
|
||||||
|
img.fillPath(path, ctx.fill, ctx.transform, ctx.fillRule)
|
||||||
|
|
||||||
|
proc stroke(img: Image, ctx: Ctx, path: Path) {.inline.} =
|
||||||
|
img.strokePath(
|
||||||
|
path,
|
||||||
|
ctx.stroke,
|
||||||
|
ctx.transform,
|
||||||
|
ctx.strokeWidth,
|
||||||
|
miterLimit = ctx.strokeMiterLimit
|
||||||
|
)
|
||||||
|
|
||||||
proc draw(img: Image, node: XmlNode, ctxStack: var seq[Ctx]) =
|
proc draw(img: Image, node: XmlNode, ctxStack: var seq[Ctx]) =
|
||||||
if node.kind != xnElement:
|
if node.kind != xnElement:
|
||||||
# Skip <!-- comments -->
|
# Skip <!-- comments -->
|
||||||
|
@ -243,15 +255,9 @@ proc draw(img: Image, node: XmlNode, ctxStack: var seq[Ctx]) =
|
||||||
ctx = decodeCtx(ctxStack[^1], node)
|
ctx = decodeCtx(ctxStack[^1], node)
|
||||||
path = parsePath(d)
|
path = parsePath(d)
|
||||||
if ctx.fill != ColorRGBX():
|
if ctx.fill != ColorRGBX():
|
||||||
img.fillPath(path, ctx.fill, ctx.transform, ctx.fillRule)
|
img.fill(ctx, path)
|
||||||
if ctx.shouldStroke:
|
if ctx.shouldStroke:
|
||||||
img.strokePath(
|
img.stroke(ctx, path)
|
||||||
path,
|
|
||||||
ctx.stroke,
|
|
||||||
ctx.transform,
|
|
||||||
ctx.strokeWidth,
|
|
||||||
miterLimit = ctx.strokeMiterLimit
|
|
||||||
)
|
|
||||||
|
|
||||||
of "line":
|
of "line":
|
||||||
let
|
let
|
||||||
|
@ -267,15 +273,9 @@ proc draw(img: Image, node: XmlNode, ctxStack: var seq[Ctx]) =
|
||||||
path.closePath()
|
path.closePath()
|
||||||
|
|
||||||
if ctx.fill != ColorRGBX():
|
if ctx.fill != ColorRGBX():
|
||||||
img.fillPath(path, ctx.fill, ctx.transform)
|
img.fill(ctx, path)
|
||||||
if ctx.shouldStroke:
|
if ctx.shouldStroke:
|
||||||
img.strokePath(
|
img.stroke(ctx, path)
|
||||||
path,
|
|
||||||
ctx.stroke,
|
|
||||||
ctx.transform,
|
|
||||||
ctx.strokeWidth,
|
|
||||||
miterLimit = ctx.strokeMiterLimit
|
|
||||||
)
|
|
||||||
|
|
||||||
of "polyline", "polygon":
|
of "polyline", "polygon":
|
||||||
let
|
let
|
||||||
|
@ -309,15 +309,9 @@ proc draw(img: Image, node: XmlNode, ctxStack: var seq[Ctx]) =
|
||||||
path.closePath()
|
path.closePath()
|
||||||
|
|
||||||
if ctx.fill != ColorRGBX():
|
if ctx.fill != ColorRGBX():
|
||||||
img.fillPath(path, ctx.fill, ctx.transform)
|
img.fill(ctx, path)
|
||||||
if ctx.shouldStroke:
|
if ctx.shouldStroke:
|
||||||
img.strokePath(
|
img.stroke(ctx, path)
|
||||||
path,
|
|
||||||
ctx.stroke,
|
|
||||||
ctx.transform,
|
|
||||||
ctx.strokeWidth,
|
|
||||||
miterLimit = ctx.strokeMiterLimit
|
|
||||||
)
|
|
||||||
|
|
||||||
of "rect":
|
of "rect":
|
||||||
let
|
let
|
||||||
|
@ -353,15 +347,9 @@ proc draw(img: Image, node: XmlNode, ctxStack: var seq[Ctx]) =
|
||||||
path.rect(x, y, width, height)
|
path.rect(x, y, width, height)
|
||||||
|
|
||||||
if ctx.fill != ColorRGBX():
|
if ctx.fill != ColorRGBX():
|
||||||
img.fillPath(path, ctx.fill, ctx.transform)
|
img.fill(ctx, path)
|
||||||
if ctx.shouldStroke:
|
if ctx.shouldStroke:
|
||||||
img.strokePath(
|
img.stroke(ctx, path)
|
||||||
path,
|
|
||||||
ctx.stroke,
|
|
||||||
ctx.transform,
|
|
||||||
ctx.strokeWidth,
|
|
||||||
miterLimit = ctx.strokeMiterLimit
|
|
||||||
)
|
|
||||||
|
|
||||||
of "circle", "ellipse":
|
of "circle", "ellipse":
|
||||||
let
|
let
|
||||||
|
@ -381,15 +369,9 @@ proc draw(img: Image, node: XmlNode, ctxStack: var seq[Ctx]) =
|
||||||
path.ellipse(cx, cy, rx, ry)
|
path.ellipse(cx, cy, rx, ry)
|
||||||
|
|
||||||
if ctx.fill != ColorRGBX():
|
if ctx.fill != ColorRGBX():
|
||||||
img.fillPath(path, ctx.fill, ctx.transform)
|
img.fill(ctx, path)
|
||||||
if ctx.shouldStroke:
|
if ctx.shouldStroke:
|
||||||
img.strokePath(
|
img.stroke(ctx, path)
|
||||||
path,
|
|
||||||
ctx.stroke,
|
|
||||||
ctx.transform,
|
|
||||||
ctx.strokeWidth,
|
|
||||||
miterLimit = ctx.strokeMiterLimit
|
|
||||||
)
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
raise newException(PixieError, "Unsupported SVG tag: " & node.tag & ".")
|
raise newException(PixieError, "Unsupported SVG tag: " & node.tag & ".")
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 280 KiB After Width: | Height: | Size: 280 KiB |
Binary file not shown.
Before Width: | Height: | Size: 630 KiB After Width: | Height: | Size: 631 KiB |
Loading…
Reference in a new issue