pixie/paths

    Dark Mode
Search:
Group by:

Types

WindingRule = enum
  wrNonZero, wrEvenOdd
Winding rules.
LineCap = enum
  lcButt, lcRound, lcSquare
Line cap type for strokes.
LineJoin = enum
  ljMiter, ljRound, ljBevel
Line join type for strokes.
PathCommandKind = enum
  Close, Move, Line, HLine, VLine, Cubic, SCubic, Quad, TQuad, Arc, RMove,
  RLine, RHLine, RVLine, RCubic, RSCubic, RQuad, RTQuad, RArc
Type of path commands
PathCommand = object
  kind*: PathCommandKind
  numbers*: seq[float32]
Binary version of an SVG command
Path = object
  commands*: seq[PathCommand]
  start, at: Vec2
Used to hold paths and create paths.
SomePath = Path | string | seq[seq[Vec2]]

Procs

proc `$`(path: Path): string {...}{.raises: [], tags: [].}
Turn path int into a string.
proc parsePath(path: string): Path {...}{.raises: [PixieError], tags: [].}
Converts a SVG style path string into seq of commands.
proc transform(path: var Path; mat: Mat3) {...}{.raises: [], tags: [].}
Apply a matrix transform to a path.
proc addPath(path: var Path; other: Path) {...}{.raises: [], tags: [].}
Adds a path to the current path.
proc closePath(path: var Path) {...}{.raises: [], tags: [].}
Closes a path (draws a line to the start).
proc moveTo(path: var Path; x, y: float32) {...}{.raises: [], tags: [].}
Moves the current drawing pen to a new position and starts a new shape.
proc moveTo(path: var Path; v: Vec2) {...}{.inline, raises: [], tags: [].}
Moves the current drawing pen to a new position and starts a new shape.
proc lineTo(path: var Path; x, y: float32) {...}{.raises: [], tags: [].}
Adds a line.
proc lineTo(path: var Path; v: Vec2) {...}{.inline, raises: [], tags: [].}
Adds a line.
proc bezierCurveTo(path: var Path; x1, y1, x2, y2, x3, y3: float32) {...}{.
    raises: [], tags: [].}
Adds a cubic Bézier curve to the path. This requires three points. The first two points are control points and the third is the end point. The starting point is the last point in the current path, which can be changed using moveTo() before creating the curve.
proc bezierCurveTo(path: var Path; ctrl1, ctrl2, to: Vec2) {...}{.inline, raises: [],
    tags: [].}
proc quadraticCurveTo(path: var Path; x1, y1, x2, y2: float32) {...}{.raises: [],
    tags: [].}
Adds a quadratic Bézier curve to the path. This requires 2 points. The first point is the control point and the second is the end point. The starting point is the last point in the current path, which can be changed using moveTo() before creating the curve.
proc quadraticCurveTo(path: var Path; ctrl, to: Vec2) {...}{.inline, raises: [],
    tags: [].}
Adds a quadratic Bézier curve to the path. This requires 2 points. The first point is the control point and the second is the end point. The starting point is the last point in the current path, which can be changed using moveTo() before creating the curve.
proc arcTo(path: var Path; ctrl1, ctrl2: Vec2; radius: float32) {...}{.inline,
    raises: [], tags: [].}
Adds a circular arc to the current sub-path, using the given control points and radius.
proc arcTo(path: var Path; x1, y1, x2, y2, radius: float32) {...}{.inline,
    raises: [], tags: [].}
Adds a circular arc to the current sub-path, using the given control points and radius.
proc ellipticalArcTo(path: var Path; rx, ry: float32; xAxisRotation: float32;
                     largeArcFlag, sweepFlag: bool; x, y: float32) {...}{.raises: [],
    tags: [].}
Adds an elliptical arc to the current sub-path, using the given radius ratios, sweep flags, and end position.
proc rect(path: var Path; x, y, w, h: float32; clockwise = true) {...}{.raises: [],
    tags: [].}
Adds a rectangle. Clockwise param can be used to subtract a rect from a path when using even-odd winding rule.
proc rect(path: var Path; pos: Vec2; wh: Vec2; clockwise = true) {...}{.inline,
    raises: [], tags: [].}
Adds a rectangle. Clockwise param can be used to subtract a rect from a path when using even-odd winding rule.
proc rect(path: var Path; rect: Rect; clockwise = true) {...}{.inline, raises: [],
    tags: [].}
Adds a rectangle. Clockwise param can be used to subtract a rect from a path when using even-odd winding rule.
proc roundedRect(path: var Path; x, y, w, h, nw, ne, se, sw: float32;
                 clockwise = true) {...}{.raises: [], tags: [].}
Adds a rounded rectangle. Clockwise param can be used to subtract a rect from a path when using even-odd winding rule.
proc roundedRect(path: var Path; pos, wh: Vec2; nw, ne, se, sw: float32;
                 clockwise = true) {...}{.inline, raises: [], tags: [].}
Adds a rounded rectangle. Clockwise param can be used to subtract a rect from a path when using even-odd winding rule.
proc roundedRect(path: var Path; rect: Rect; nw, ne, se, sw: float32;
                 clockwise = true) {...}{.inline, raises: [], tags: [].}
Adds a rounded rectangle. Clockwise param can be used to subtract a rect from a path when using even-odd winding rule.
proc ellipse(path: var Path; cx, cy, rx, ry: float32) {...}{.raises: [], tags: [].}
Adds a ellipse.
proc ellipse(path: var Path; center: Vec2; rx, ry: float32) {...}{.inline,
    raises: [], tags: [].}
Adds a ellipse.
proc circle(path: var Path; center: Vec2; r: float32) {...}{.inline, raises: [],
    tags: [].}
Adds a circle.
proc polygon(path: var Path; x, y, size: float32; sides: int) {...}{.raises: [],
    tags: [].}
Draws an n-sided regular polygon at (x, y) with the parameter size.
proc polygon(path: var Path; pos: Vec2; size: float32; sides: int) {...}{.inline,
    raises: [], tags: [].}
Draws a n-sided regular polygon at (x, y) with the parameter size.
proc commandsToShapes(path: Path; pixelScale: float32 = 1.0): seq[seq[Vec2]] {...}{.
    raises: [PixieError], tags: [].}
Converts SVG-like commands to line segments.
proc fillPath(image: Image; path: SomePath; color: SomeColor;
              windingRule = wrNonZero; blendMode = bmNormal) {...}{.inline.}
Fills a path.
proc fillPath(image: Image; path: SomePath; color: SomeColor;
              transform: Vec2 | Mat3; windingRule = wrNonZero;
              blendMode = bmNormal)
Fills a path.
proc fillPath(mask: Mask; path: SomePath; windingRule = wrNonZero) {...}{.inline.}
Fills a path.
proc fillPath(mask: Mask; path: SomePath; transform: Vec2 | Mat3;
              windingRule = wrNonZero)
Fills a path.
proc fillPath(image: Image; path: SomePath; paint: Paint;
              windingRule = wrNonZero)
Fills a path.
proc strokePath(image: Image; path: SomePath; color: SomeColor;
                strokeWidth = 1.0; lineCap = lcButt; lineJoin = ljMiter;
                blendMode = bmNormal)
Strokes a path.
proc strokePath(image: Image; path: SomePath; color: SomeColor;
                transform: Vec2 | Mat3; strokeWidth = 1.0; lineCap = lcButt;
                lineJoin = ljMiter; blendMode = bmNormal)
Strokes a path.
proc strokePath(mask: Mask; path: SomePath; strokeWidth = 1.0; lineCap = lcButt;
                lineJoin = ljMiter)
Strokes a path.
proc strokePath(mask: Mask; path: SomePath; transform: Vec2 | Mat3;
                strokeWidth = 1.0; lineCap = lcButt; lineJoin = ljMiter)
Strokes a path.