pixie/paths

    Dark Mode
Search:
Group by:

Types

WindingRule = enum
  wrNonZero, wrEvenOdd
Winding rules.   Source Edit
LineCap = enum
  lcButt, lcRound, lcSquare
Line cap type for strokes.   Source Edit
LineJoin = enum
  ljMiter, ljRound, ljBevel
Line join type for strokes.   Source Edit
Path = ref object
  commands: seq[PathCommand]
  start, at: Vec2
Used to hold paths and create paths.   Source Edit
SomePath = Path | string
  Source Edit

Consts

defaultMiterLimit: float32 = 4.0
  Source Edit

Procs

proc newPath(): Path {...}{.raises: [], tags: [].}
Create a new Path.   Source Edit
proc `$`(path: Path): string {...}{.raises: [], tags: [].}
Turn path int into a string.   Source Edit
proc parsePath(path: string): Path {...}{.raises: [PixieError], tags: [].}
Converts a SVG style path string into seq of commands.   Source Edit
proc transform(path: Path; mat: Mat3) {...}{.raises: [], tags: [].}
Apply a matrix transform to a path.   Source Edit
proc addPath(path: Path; other: Path) {...}{.raises: [], tags: [].}
Adds a path to the current path.   Source Edit
proc closePath(path: Path) {...}{.raises: [], tags: [].}
Attempts to add a straight line from the current point to the start of the current sub-path. If the shape has already been closed or has only one point, this function does nothing.   Source Edit
proc moveTo(path: Path; x, y: float32) {...}{.raises: [], tags: [].}
Begins a new sub-path at the point (x, y).   Source Edit
proc moveTo(path: Path; v: Vec2) {...}{.inline, raises: [], tags: [].}
Begins a new sub-path at the point (x, y).   Source Edit
proc lineTo(path: Path; x, y: float32) {...}{.raises: [], tags: [].}
Adds a straight line to the current sub-path by connecting the sub-path's last point to the specified (x, y) coordinates.   Source Edit
proc lineTo(path: Path; v: Vec2) {...}{.inline, raises: [], tags: [].}
Adds a straight line to the current sub-path by connecting the sub-path's last point to the specified (x, y) coordinates.   Source Edit
proc bezierCurveTo(path: Path; x1, y1, x2, y2, x3, y3: float32) {...}{.raises: [],
    tags: [].}
Adds a cubic Bézier curve to the current sub-path. It requires three points: the first two are control points and the third one is the end point. The starting point is the latest point in the current path, which can be changed using moveTo() before creating the Bézier curve.   Source Edit
proc bezierCurveTo(path: Path; ctrl1, ctrl2, to: Vec2) {...}{.inline, raises: [],
    tags: [].}
Adds a cubic Bézier curve to the current sub-path. It requires three points: the first two are control points and the third one is the end point. The starting point is the latest point in the current path, which can be changed using moveTo() before creating the Bézier curve.   Source Edit
proc quadraticCurveTo(path: Path; x1, y1, x2, y2: float32) {...}{.raises: [],
    tags: [].}
Adds a quadratic Bézier curve to the current sub-path. It requires two points: the first one is a control point and the second one is the end point. The starting point is the latest point in the current path, which can be changed using moveTo() before creating the quadratic Bézier curve.   Source Edit
proc quadraticCurveTo(path: Path; ctrl, to: Vec2) {...}{.inline, raises: [], tags: [].}
Adds a quadratic Bézier curve to the current sub-path. It requires two points: the first one is a control point and the second one is the end point. The starting point is the latest point in the current path, which can be changed using moveTo() before creating the quadratic Bézier curve.   Source Edit
proc ellipticalArcTo(path: 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.   Source Edit
proc arc(path: Path; x, y, r, a0, a1: float32; ccw: bool = false) {...}{.
    raises: [PixieError], tags: [].}
Adds a circular arc to the current sub-path.   Source Edit
proc arc(path: Path; pos: Vec2; r: float32; a: Vec2; ccw: bool = false) {...}{.
    inline, raises: [PixieError], tags: [].}
Adds a circular arc to the current sub-path.   Source Edit
proc arcTo(path: Path; x1, y1, x2, y2, r: float32) {...}{.raises: [PixieError],
    tags: [].}
Adds a circular arc using the given control points and radius. Commonly used for making rounded corners.   Source Edit
proc arcTo(path: Path; a, b: Vec2; r: float32) {...}{.inline, raises: [PixieError],
    tags: [].}
Adds a circular arc using the given control points and radius.   Source Edit
proc rect(path: 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.   Source Edit
proc rect(path: 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.   Source Edit
proc roundedRect(path: 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.   Source Edit
proc roundedRect(path: 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.   Source Edit
proc ellipse(path: Path; cx, cy, rx, ry: float32) {...}{.raises: [], tags: [].}
Adds a ellipse.   Source Edit
proc ellipse(path: Path; center: Vec2; rx, ry: float32) {...}{.inline, raises: [],
    tags: [].}
Adds a ellipse.   Source Edit
proc circle(path: Path; cx, cy, r: float32) {...}{.inline, raises: [], tags: [].}
Adds a circle.   Source Edit
proc circle(path: Path; circle: Circle) {...}{.inline, raises: [], tags: [].}
Adds a circle.   Source Edit
proc polygon(path: Path; x, y, size: float32; sides: int) {...}{.raises: [], tags: [].}
Adds an n-sided regular polygon at (x, y) with the parameter size.   Source Edit
proc polygon(path: Path; pos: Vec2; size: float32; sides: int) {...}{.inline,
    raises: [], tags: [].}
Adds a n-sided regular polygon at (x, y) with the parameter size.   Source Edit
proc computeBounds(path: Path; transform = mat3()): Rect {...}{.raises: [PixieError],
    tags: [].}
Compute the bounds of the path.   Source Edit
proc miterLimitToAngle(limit: float32): float32 {...}{.inline, raises: [], tags: [].}
Converts miter-limit-ratio to miter-limit-angle.   Source Edit
proc angleToMiterLimit(angle: float32): float32 {...}{.inline, raises: [], tags: [].}
Converts miter-limit-angle to miter-limit-ratio.   Source Edit
proc fillPath(mask: Mask; path: SomePath; transform = mat3();
              windingRule = wrNonZero; blendMode = bmNormal) {...}{.
    raises: [PixieError].}
Fills a path.   Source Edit
proc fillPath(image: Image; path: SomePath; paint: Paint; transform = mat3();
              windingRule = wrNonZero) {...}{.raises: [PixieError].}
Fills a path.   Source Edit
proc strokePath(mask: Mask; path: SomePath; transform = mat3();
                strokeWidth: float32 = 1.0; lineCap = lcButt;
                lineJoin = ljMiter; miterLimit = defaultMiterLimit;
                dashes: seq[float32] = @[]; blendMode = bmNormal) {...}{.
    raises: [PixieError].}
Strokes a path.   Source Edit
proc strokePath(image: Image; path: SomePath; paint: Paint; transform = mat3();
                strokeWidth: float32 = 1.0; lineCap = lcButt;
                lineJoin = ljMiter; miterLimit = defaultMiterLimit;
                dashes: seq[float32] = @[]) {...}{.raises: [PixieError].}
Strokes a path.   Source Edit
proc fillOverlaps(path: Path; test: Vec2; transform = mat3(); ## Applied to the path, not the test point.
                  windingRule = wrNonZero): bool {...}{.raises: [PixieError],
    tags: [].}
Returns whether or not the specified point is contained in the current path.   Source Edit
proc strokeOverlaps(path: Path; test: Vec2; transform = mat3(); ## Applied to the path, not the test point.
                    strokeWidth: float32 = 1.0; lineCap = lcButt;
                    lineJoin = ljMiter; miterLimit = defaultMiterLimit;
                    dashes: seq[float32] = @[]): bool {...}{.raises: [PixieError],
    tags: [].}
Returns whether or not the specified point is inside the area contained by the stroking of a path.   Source Edit