import { type SkPath } from "https://deno.land/x/canvaseno@v1.0.2/types.ts";
See SkPath.h for more information on this class.
Methods
Appends arc to SkPath, as the start of new contour. Arc added is part of ellipse bounded by oval, from startAngle through sweepAngle. Both startAngle and sweepAngle are measured in degrees, where zero degrees is aligned with the positive x-axis, and positive sweeps extends arc clockwise. Returns the modified path for easier chaining.
Adds oval to SkPath, appending kMove_Verb, four kConic_Verb, and kClose_Verb. Oval is upright ellipse bounded by SkRect oval with radii equal to half oval width and half oval height. Oval begins at start and continues clockwise by default. Returns the modified path for easier chaining.
Takes 1, 2, 7, or 10 required args, where the first arg is always the path. The last arg is an optional boolean and chooses between add or extend mode. The options for the remaining args are:
- an array of 6 or 9 parameters (perspective is optional)
- the 9 parameters of a full matrix or the 6 non-perspective params of a matrix. Returns the modified path for easier chaining (or null if params were incorrect).
Adds contour created from array of n points, adding (count - 1) line segments. Contour added starts at pts[0], then adds a line for every additional point in pts array. If close is true, appends kClose_Verb to SkPath, connecting pts[count - 1] and pts[0]. Returns the modified path for easier chaining.
Adds SkRect to SkPath, appending kMove_Verb, three kLine_Verb, and kClose_Verb, starting with top-left corner of SkRect; followed by top-right, bottom-right, and bottom-left if isCCW is false; or followed by bottom-left, bottom-right, and top-right if isCCW is true. Returns the modified path for easier chaining.
Adds rrect to SkPath, creating a new closed contour. Returns the modified path for easier chaining.
Adds the given verbs and associated points/weights to the path. The process reads the first verb from verbs and then the appropriate number of points from the FlattenedPointArray (e.g. 2 points for moveTo, 4 points for quadTo, etc). If the verb is a conic, a weight will be read from the WeightList. Returns the modified path for easier chaining
Adds an arc to this path, emulating the Canvas2D behavior. Returns the modified path for easier chaining.
Appends arc to SkPath. Arc added is part of ellipse bounded by oval, from startAngle through sweepAngle. Both startAngle and sweepAngle are measured in degrees, where zero degrees is aligned with the positive x-axis, and positive sweeps extends arc clockwise. Returns the modified path for easier chaining.
Appends arc to SkPath. Arc is implemented by one or more conics weighted to describe part of oval with radii (rx, ry) rotated by xAxisRotate degrees. Arc curves from last SkPath SkPoint to (x, y), choosing one of four possible routes: clockwise or counterclockwise, and smaller or larger. See SkPath.h for more details. Returns the modified path for easier chaining.
Appends arc to SkPath, after appending line if needed. Arc is implemented by conic weighted to describe part of circle. Arc is contained by tangent from last SkPath point to (x1, y1), and tangent from (x1, y1) to (x2, y2). Arc is part of circle sized to radius, positioned so it touches both tangent lines. Returns the modified path for easier chaining.
Appends CLOSE_VERB to SkPath. A closed contour connects the first and last point with a line, forming a continuous loop. Returns the modified path for easier chaining.
Returns minimum and maximum axes values of the lines and curves in SkPath. Returns (0, 0, 0, 0) if SkPath contains no points. Returned bounds width and height may be larger or smaller than area affected when SkPath is drawn.
Behaves identically to getBounds() when SkPath contains only lines. If SkPath contains curves, computed bounds includes the maximum extent of the quad, conic, or cubic; is slower than getBounds(); and unlike getBounds(), does not cache the result.
Adds conic from last point towards (x1, y1), to (x2, y2), weighted by w. If SkPath is empty, or path is closed, the last point is set to (0, 0) before adding conic. Returns the modified path for easier chaining.
Returns true if the point (x, y) is contained by SkPath, taking into account FillType.
Returns a copy of this SkPath.
Adds cubic from last point towards (x1, y1), then towards (x2, y2), ending at (x3, y3). If SkPath is empty, or path is closed, the last point is set to (0, 0) before adding cubic.
Changes this path to be the dashed version of itself. This is the same effect as creating an SkDashPathEffect and calling filterPath on this path.
Returns true if other path is equal to this path.
Returns minimum and maximum axes values of SkPoint array. Returns (0, 0, 0, 0) if SkPath contains no points. Returned bounds width and height may be larger or smaller than area affected when SkPath is drawn.
Return the FillType for this path.
Returns SkPoint at index in SkPoint array. Valid range for index is 0 to countPoints() - 1.
Returns true if the path is volatile; it will not be altered or discarded by the caller after it is drawn. SkPath by default have volatile set false, allowing SkSurface to attach a cache of data which speeds repeated drawing. If true, SkSurface may not speed repeated drawing.
Adds line from last point to (x, y). If SkPath is empty, or last path is closed, last point is set to (0, 0) before adding line. Returns the modified path for easier chaining.
Adds begininning of contour at the given point. Returns the modified path for easier chaining.
Translates all the points in the path by dx, dy. Returns the modified path for easier chaining.
Combines this path with the other path using the given PathOp. Returns false if the operation fails.
Adds quad from last point towards (x1, y1), to (x2, y2). If SkPath is empty, or path is closed, last point is set to (0, 0) before adding quad. Returns the modified path for easier chaining.
Relative version of arcToRotated.
Relative version of conicTo.
Relative version of cubicTo.
Sets SkPath to its initial state. Removes verb array, point array, and weights, and sets FillType to Winding. Internal storage associated with SkPath is released
Sets SkPath to its initial state. Removes verb array, point array, and weights, and sets FillType to Winding. Internal storage associated with SkPath is not released. Use rewind() instead of reset() if SkPath storage will be reused and performance is critical.
Relative version of lineTo.
Relative version of moveTo.
Relative version of quadTo.
Sets FillType, the rule used to fill SkPath.
Specifies whether SkPath is volatile; whether it will be altered or discarded by the caller after it is drawn. SkPath by default have volatile set false.
Mark animating or temporary paths as volatile to improve performance. Mark unchanging SkPath non-volatile to improve repeated rendering.
Set this path to a set of non-overlapping contours that describe the same area as the original path. The curve order is reduced where possible so that cubics may be turned into quadratics, and quadratics maybe turned into lines.
Returns true if operation was able to produce a result.
Turns this path into the filled equivalent of the stroked path. Returns null if the operation fails (e.g. the path is a hairline).
Serializes the contents of this path as a series of commands.
Takes a 3x3 matrix as either an array or as 9 individual params.
Take start and stop "t" values (values between 0...1), and modify this path such that it is a subset of the original path. The trim values apply to the entire path, so if it contains several contours, all of them are including in the calculation. Null is returned if either input value is NaN.