Path
Path contain geometry. Path may be empty, or contain one or more verbs that outline a figure. Path always starts with a move verb to a Cartesian coordinate, and may be followed by additional verbs that add lines or curves.
Adding a close verb makes the geometry into a continuous loop, a closed contour. Path may contain any number of contours, each beginning with a move verb.
Path contours may contain only a move verb, or may also contain lines, quadratic beziers, conics, and cubic beziers. Path contours may be open or closed.
When used to draw a filled area, Path describes whether the fill is inside or outside the geometry. Path also describes the winding rule used to fill overlapping contours.
Internally, Path lazily computes metrics likes bounds and convexity. Call .updateBoundsCache to make Path thread safe.
Constructors
Constructs an empty Path. By default, Path has no verbs, no Point, and no weights. FillMode is set to PathFillMode.WINDING.
Properties
Returns the approximate byte size of the Path in memory.
Returns array of two points if Path contains only one line; Verb array has two entries: PathVerb.MOVE, PathVerb.LINE. Returns null if Path is not one line.
Returns a non-zero, globally unique value. A different value is returned if verb array, Point array, or conic weight changes.
Returns if contour is closed.
Specifies whether Path is volatile; whether it will be altered or discarded by the caller after it is drawn. Path by default have volatile set false, allowing SkBaseDevice to attach a cache of data which speeds repeated drawing.
Returns the number of points in Path. Point count is initially zero.
Returns a mask, where each set bit corresponds to a SegmentMask constant if Path contains one or more verbs of that type.
Returns the number of verbs: PathVerb.MOVE, PathVerb.LINE, PathVerb.QUAD, PathVerb.CONIC, PathVerb.CUBIC, and PathVerb.CLOSE; added to Path.
Functions
Appends arc to Path, 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.
Adds circle centered at (x, y) of size radius to Path, appending PathVerb.MOVE, four PathVerb.CONIC, and PathVerb.CLOSE. Circle begins at: (x + radius, y)
Adds oval to path, appending PathVerb.MOVE, four PathVerb.CONIC, and PathVerb.CLOSE.
Appends src to Path.
Appends src to Path, transformed by matrix. Transformed curves may have different verbs, Point, and conic weights.
Appends src to Path, offset by (dx, dy).
Adds contour created from line array, adding (pts.length - 1) line segments. Contour added starts at pts0, then adds a line for every additional Point in pts array. If close is true, appends PathVerb.CLOSE to Path, connecting ptspts.length - 1 and pts0.
Adds contour created from line array, adding (pts.length / 2 - 1) line segments. Contour added starts at (pts0, pts1), then adds a line for every additional pair of floats in pts array. If close is true, appends PathVerb.CLOSE to Path, connecting (ptscount - 2, ptscount - 1) and (pts0, pts1).
Adds Rect to Path, appending PathVerb.MOVE, three PathVerb.LINE, and PathVerb.CLOSE, starting with top-left corner of Rect; followed by top-right, bottom-right, and bottom-left if dir is PathDirection.CLOCKWISE; or followed by bottom-left, bottom-right, and top-right if dir is PathDirection.COUNTER_CLOCKWISE.
Appends arc to Path. 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.
Appends PathVerb.CLOSE to Path. A closed contour connects the first and last Point with line, forming a continuous loop. Open and closed contour draw the same with PaintMode.FILL. With PaintMode.STROKE, open contour draws PaintStrokeCap at contour start and end; closed contour draws PaintStrokeJoin at contour start and end.
Returns minimum and maximum axes values of the lines and curves in Path. Returns (0, 0, 0, 0) if Path contains no points. Returned bounds width and height may be larger or smaller than area affected when Path is drawn.
Returns true if rect is contained by Path. May return false when rect is contained by Path.
Returns true if the point is contained by Path, taking into account PathFillMode.
Returns true if the point (x, y) is contained by Path, taking into account PathFillMode.
Adds cubic from last point towards Point p1, then towards Point p2, ending at Point p3. If Path is empty, or last PathVerb is PathVerb.CLOSE, last point is set to (0, 0) before adding cubic.
Adds cubic from last point towards (x1, y1), then towards (x2, y2), ending at (x3, y3). If Path is empty, or last PathVerb is PathVerb.CLOSE, last point is set to (0, 0) before adding cubic.
Appends arc to Path. Arc is implemented by one or more conic weighted to describe part of oval with radii (r.fX, r.fY) rotated by xAxisRotate degrees. Arc curves from last Path Point to (xy.fX, xy.fY), choosing one of four possible routes: clockwise or counterclockwise, and smaller or larger.
Appends arc to Path. 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 Path Point to (x, y), choosing one of four possible routes: clockwise or counterclockwise, and smaller or larger.
Grows Path verb array and Point array to contain extraPtCount additional Point. May improve performance and use less memory by reducing the number and size of allocations when creating Path.
Returns true if Path contain equal verbs and equal weights. If Path contain one or more conics, the weights must match.
Adds line from last point to Point p. If Path is empty, or last PathVerb is PathVerb.CLOSE, last point is set to (0, 0) before adding line.
Adds line from last point to (x, y). If Path is empty, or last Verb is PathVerb.CLOSE, last point is set to (0, 0) before adding line.
Adds quad from last point towards Point p1, to Point p2.
Adds quad from last point towards (x1, y1), to (x2, y2). If Path is empty, or last PathVerb is PathVerb.CLOSE, last point is set to (0, 0) before adding quad.
Adds cubic from last point towards vector (dx1, dy1), then towards vector (dx2, dy2), to vector (dx3, dy3). If Path is empty, or last PathVerb is PathVerb.CLOSE, last point is set to (0, 0) before adding cubic.
Appends arc to Path, relative to last Path Point. Arc is implemented by one or more conic, weighted to describe part of oval with radii (rx, ry) rotated by xAxisRotate degrees. Arc curves from last Path Point to relative end Point: (dx, dy), choosing one of four possible routes: clockwise or counterclockwise, and smaller or larger. If Path is empty, the start arc Point is (0, 0).
Appends src to Path, from back to front. Reversed src always appends a new contour to Path.
Writes Path to byte buffer.
Specifies whether Path is volatile; whether it will be altered or discarded by the caller after it is drawn. Path by default have volatile set false, allowing SkBaseDevice to attach a cache of data which speeds repeated drawing.
Appends arc to Path, after appending line if needed. Arc is implemented by conic weighted to describe part of circle. Arc is contained by tangent from last Path point to p1, and tangent from p1 to p2. Arc is part of circle sized to radius, positioned so it touches both tangent lines.
Appends arc to Path, after appending line if needed. Arc is implemented by conic weighted to describe part of circle. Arc is contained by tangent from last Path 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.
Transforms verb array, Point array, and weight by matrix. transform may change verbs and increase their number. Path is replaced by transformed data.
Transforms verb array, Point array, and weight by matrix. transform may change verbs and increase their number. Transformed Path replaces dst; if dst is null, original data is replaced.
Updates internal bounds so that subsequent calls to .getBounds are instantaneous. Unaltered copies of Path may also access cached bounds through .getBounds.