Path contains Lines and Curves which can be stroked or filled. Contour is composed of a series of connected Lines and Curves. Path may contain zero, one, or more Contours. Each Line and Curve are described by Verb, Points, and optional Conic Weight.
Each pair of connected Lines and Curves share common Point; for instance, Path containing two connected Lines are described the Verb sequence: SkPath::kMove Verb, SkPath::kLine Verb, SkPath::kLine Verb; and a Point sequence with three entries, sharing the middle entry as the end of the first Line and the start of the second Line.
Path components Arc, Rect, Round Rect, Circle, and Oval are composed of Lines and Curves with as many Verbs and Points required for an exact description. Once added to Path, these components may lose their identity; although Path can be inspected to determine if it describes a single Rect, Oval, Round Rect, and so on.
Path contains a Fill Type which determines whether overlapping Contours form fills or holes. Fill Type also determines whether area inside or outside Lines and Curves is filled.
Path contents are never shared. Copying Path by value effectively creates a new Path independent of the original. Internally, the copy does not duplicate its contents until it is edited, to reduce memory use and improve performance.
Contour contains one or more Verbs, and as many Points as are required to satisfy Verb Array. First Verb in Path is always SkPath::kMove Verb; each SkPath::kMove Verb that follows starts a new Contour.
If final Verb in Contour is SkPath::kClose Verb, Line connects Last Point in Contour with first Point. A closed Contour, stroked, draws Paint Stroke Join at Last Point and first Point. Without SkPath::kClose Verb as final Verb, Last Point and first Point are not connected; Contour remains open. An open Contour, stroked, draws Paint Stroke Cap at Last Point and first Point.
Contour length is distance traveled from first Point to Last Point, plus, if Contour is closed, distance from Last Point to first Point. Even if Contour length is zero, stroked Lines are drawn if Paint Stroke Cap makes them visible.
Paths contain geometry. Paths 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. Paths 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 SkPath::updateBoundsCache to make Path thread safe.
SkPath global, struct, and class related member functions share a topic.
SkPath related constants are defined by enum, enum class, #define, const, and constexpr.
SkPath uses C++ classes to declare the public data structures and interfaces.
SkPath can be constructed or initialized by these functions, including C++ class constructors.
SkPath operators inline class member functions with arithmetic equivalents.
SkPath member functions read and modify the structure properties.
Verb instructs Path how to interpret one or more Point and optional Conic Weight; manage Contour, and terminate Path.
Verb | Allocated Points | Iterated Points | Weights |
---|---|---|---|
kMove Verb | 1 | 1 | 0 |
kLine Verb | 1 | 2 | 0 |
kQuad Verb | 2 | 3 | 0 |
kConic Verb | 2 | 3 | 1 |
kCubic Verb | 3 | 4 | 0 |
kClose Verb | 0 | 1 | 0 |
kDone Verb | -- | 0 | 0 |
verb count: 7 verbs: kMove_Verb kLine_Verb kQuad_Verb kClose_Verb kMove_Verb kCubic_Verb kConic_Verb
Direction describes whether Contour is clockwise or counterclockwise. When Path contains multiple overlapping Contours, Direction together with Fill Type determines whether overlaps are filled or form holes.
Direction also determines how Contour is measured. For instance, dashing measures along Path to determine where to start and stop stroke; Direction will change dashed results as it steps clockwise or counterclockwise.
Closed Contours like Rect, Round Rect, Circle, and Oval added with kCW Direction travel clockwise; the same added with kCCW Direction travel counterclockwise.
arcTo[2][3][4][5] rArcTo isRect isNestedFillRects addRect[2][3] addOval[2]
By default, Path has no Verbs, no Points, and no Weights. Fill Type is set to kWinding FillType.
empty Path
path is empty
reset rewind
Copy constructor makes two paths identical by value. Internally, path and the returned result share pointer values. The underlying Verb Array, Point Array and Weights are copied when modified.
Creating a Path copy is very efficient and never allocates memory. Paths are always copied by value from the interface; the underlying shared pointers are not exposed.
copy of Path
path verbs: 2 path2 verbs: 3 after reset path verbs: 0 path2 verbs: 3
operator=(const SkPath& path)
Releases ownership of any shared data and deletes data if Path is sole owner.
SkPath() SkPath(const SkPath& path) operator=(const SkPath& path)
Path assignment makes two paths identical by value. Internally, assignment shares pointer values. The underlying Verb Array, Point Array and Weights are copied when modified.
Copying Paths by assignment is very efficient and never allocates memory. Paths are always copied by value from the interface; the underlying shared pointers are not exposed.
Path copied by value
path1 bounds = 10, 20, 30, 40 path2 bounds = 10, 20, 30, 40
swap SkPath(const SkPath& path)
Compares a and b; returns true if Fill Type, Verb Array, Point Array, and Weights are equivalent.
true if Path pair are equivalent
empty one == two moveTo one != two rewind one == two reset one == two
Compares a and b; returns true if Fill Type, Verb Array, Point Array, and Weights are not equivalent.
true if Path pair are not equivalent
empty one == two addRect one == two setConvexity one == two convexity !=
Return true if Paths contain equal Verbs and equal Weights. If Paths contain one or more Conics, the Weights must match.
conicTo may add different Verbs depending on Conic Weight, so it is not trivial to interpolate a pair of Paths containing Conics with different Conic Weight values.
true if Paths Verb Array and Weights are equivalent
paths are interpolatable
isInterpolatable
Interpolate between Paths with Point Array of equal size. Copy Verb Array and Weights to out, and set out Point Array to a weighted average of this Point Array and ending Point Array, using the formula: (Path Point * weight) + ending Point * (1 - weight) .
weight is most useful when between zero (ending Point Array) and one (this Point Array); will work with values outside of this range.
interpolate returns false and leaves out unchanged if Point Array is not the same size as ending Point Array. Call isInterpolatable to check Path compatibility prior to calling interpolate.
true if Paths contain same number of Points
isInterpolatable
Deprecated.
soonOnly valid for Android framework.
Fill Type selects the rule used to fill Path. Path set to kWinding FillType fills if the sum of Contour edges is not zero, where clockwise edges add one, and counterclockwise edges subtract one. Path set to kEvenOdd FillType fills if the number of Contour edges is odd. Each Fill Type has an inverse variant that reverses the rule: kInverseWinding FillType fills where the sum of Contour edges is zero; kInverseEvenOdd FillType fills where the number of Contour edges is even.
SkPaint::Style Direction getFillType setFillType
Returns FillType, the rule used to fill Path. FillType of a new Path is kWinding FillType.
one of: kWinding FillType, kEvenOdd FillType, kInverseWinding FillType, kInverseEvenOdd FillType
default path fill type is kWinding_FillType
FillType setFillType isInverseFillType
Sets FillType, the rule used to fill Path. While there is no check that ft is legal, values outside of FillType are not supported.
FillType getFillType toggleInverseFillType
Returns if FillType describes area outside Path geometry. The inverse fill area extends indefinitely.
true if FillType is kInverseWinding FillType or kInverseEvenOdd FillType
default path fill type is inverse: false
FillType getFillType setFillType toggleInverseFillType
Replace FillType with its inverse. The inverse of FillType describes the area unmodified by the original FillType.
FillType | toggled FillType |
---|---|
kWinding FillType | kInverseWinding FillType |
kEvenOdd FillType | kInverseEvenOdd FillType |
kInverseWinding FillType | kWinding FillType |
kInverseEvenOdd FillType | kEvenOdd FillType |
FillType getFillType setFillType isInverseFillType
Path is convex if it contains one Contour and Contour loops no more than 360 degrees, and Contour angles all have same Direction. Convex Path may have better performance and require fewer resources on GPU Surface.
Path is concave when either at least one Direction change is clockwise and another is counterclockwise, or the sum of the changes in Direction is not 360 degrees.
Initially Path Convexity is kUnknown Convexity. Path Convexity is computed if needed by destination Surface.
Contour Direction getConvexity getConvexityOrUnknown setConvexity isConvex
Computes Convexity if required, and returns stored value. Convexity is computed if stored value is kUnknown Convexity, or if Path has been altered since Convexity was computed or set.
computed or stored Convexity
Convexity Contour Direction getConvexityOrUnknown setConvexity isConvex
Returns last computed Convexity, or kUnknown Convexity if Path has been altered since Convexity was computed or set.
stored Convexity
Convexity Contour Direction getConvexity setConvexity isConvex
Stores convexity so that it is later returned by getConvexity or getConvexityOrUnknown. convexity may differ from getConvexity, although setting an incorrect value may cause incorrect or inefficient drawing.
If convexity is kUnknown Convexity: getConvexity will compute Convexity, and getConvexityOrUnknown will return kUnknown Convexity.
If convexity is kConvex Convexity or kConcave Convexity, getConvexity and getConvexityOrUnknown will return convexity until the path is altered.
Convexity Contour Direction getConvexity getConvexityOrUnknown isConvex
Computes Convexity if required, and returns true if value is kConvex Convexity. If setConvexity was called with kConvex Convexity or kConcave Convexity, and the path has not been altered, Convexity is not recomputed.
true if Convexity stored or computed is kConvex Convexity
Convexity Contour Direction getConvexity getConvexityOrUnknown setConvexity
Returns true if this path is recognized as an oval or circle.
bounds receives bounds of Oval.
bounds is unmodified if Oval is not found.
true if Path is recognized as an oval or circle
Oval addCircle addOval[2]
Returns true if this path is recognized as a SkRRect (but not an oval/circle or rect).
rrect receives bounds of Round Rect.
rrect is unmodified if Round Rect is not found.
true if Path contains only Round Rect
Round Rect addRoundRect[2] addRRect[2]
Sets Path to its initial state. Removes Verb Array, Point Array, and Weights, and sets FillType to kWinding FillType. Internal storage associated with Path is released.
rewind
Sets Path to its initial state, preserving internal storage. Removes Verb Array, Point Array, and Weights, and sets FillType to kWinding FillType. Internal storage associated with Path is retained.
Use rewind instead of reset if Path storage will be reused and performance is critical.
reset
Empty Path may have FillType but has no SkPoint, Verb, or Conic Weight. SkPath() constructs empty Path; reset and (rewind) make Path empty.
true if the path contains no Verb array
initial path is empty after moveTo path is not empty after rewind path is empty after lineTo path is not empty after reset path is empty
SkPath() reset rewind
Contour is closed if Path Verb array was last modified by close. When stroked, closed Contour draws Paint Stroke Join instead of Paint Stroke Cap at first and last Point.
true if the last Contour ends with a kClose Verb
initial last contour is not closed after close last contour is not closed after lineTo last contour is not closed after close last contour is closed
close
Returns true for finite Point array values between negative SK ScalarMax and positive SK ScalarMax. Returns false for any Point array value of SK ScalarInfinity, SK ScalarNegativeInfinity, or SK ScalarNaN.
true if all Point values are finite
initial path is finite after line path is finite after scale path is not finite
SkScalar
Returns true if the path is volatile; it will not be altered or discarded by the caller after it is drawn. Paths by default have volatile set false, allowing Surface to attach a cache of data which speeds repeated drawing. If true, Surface may not speed repeated drawing.
true if caller will alter Path after drawing
volatile by default is false
setIsVolatile
Specify whether Path is volatile; whether it will be altered or discarded by the caller after it is drawn. Paths by default have volatile set false, allowing Device to attach a cache of data which speeds repeated drawing.
Mark temporary paths, discarded or modified after use, as volatile to inform Device that the path need not be cached.
Mark animating Path volatile to improve performance. Mark unchanging Path non-volatile to improve repeated rendering.
Raster Surface Path draws are affected by volatile for some shadows. GPU Surface Path draws are affected by volatile for some shadows and concave geometries.
isVolatile
Test if Line between Point pair is degenerate. Line with no length or that moves a very short distance is degenerate; it is treated as a point.
exact changes the equality test. If true, returns true only if p1 equals p2. If false, returns true if p1 equals or nearly equals p2.
true if Line is degenerate; its length is effectively zero
line from (100,100) to (100,100) is degenerate, nearly line from (100,100) to (100,100) is degenerate, exactly line from (100,100) to (100.0001,100.0001) is degenerate, nearly line from (100,100) to (100.0001,100.0001) is not degenerate, exactly
IsQuadDegenerate IsCubicDegenerate
Test if Quad is degenerate. Quad with no length or that moves a very short distance is degenerate; it is treated as a point.
true if Quad is degenerate; its length is effectively zero
quad (100,100), (100.00001,100.00001), (100.00002,100.00002) is degenerate, nearly quad (1100,1100), (1100,1100), (1100,1100) is degenerate, nearly quad (100,100), (100.00001,100.00001), (100.00002,100.00002) is not degenerate, exactly quad (1100,1100), (1100,1100), (1100,1100) is degenerate, exactly
IsLineDegenerate IsCubicDegenerate
Test if Cubic is degenerate. Cubic with no length or that moves a very short distance is degenerate; it is treated as a point.
true if Cubic is degenerate; its length is effectively zero
0.00024414062 is degenerate 0.00024414065 is length
Returns true if Path contains only one Line; Path Verb array has two entries: kMove Verb, kLine Verb. If Path contains one Line and line is not nullptr, line is set to Line start point and Line end point. Returns false if Path is not one Line; line is unaltered.
true if Path contains exactly one Line
empty is not line zero line is line (0,0) (0,0) line is line (10,10) (20,20) second move is not line
Point Array contains Points satisfying the allocated Points for each Verb in Verb Array. For instance, Path containing one Contour with Line and Quad is described by Verb Array: Verb::kMoveTo, Verb::kLineTo, Verb::kQuadTo; and one Point for move, one Point for Line, two Points for Quad; totaling four Points.
Point Array may be read directly from Path with getPoints, or inspected with getPoint, with Iter, or with RawIter.
Returns number of points in Path. Up to max points are copied. points may be nullptr; then, max must be zero. If max is greater than number of points, excess points storage is unaltered.
Path Point array length
no points point count: 3 zero max point count: 3 too small point count: 3 (0,0) (20,20) just right point count: 3 (0,0) (20,20) (-10,-10)
countPoints getPoint
Returns the number of points in Path. Point count is initially zero.
Path Point array length
empty point count: 0 zero line point count: 2 line point count: 2 second move point count: 3
getPoints
Returns Point at index in Point Array. Valid range for index is 0 to countPoints - 1. Returns (0, 0) if index is out of range.
Point array value or (0, 0)
point 0: (-10,-10) point 1: (10,10)
countPoints getPoints
Verb Array always starts with kMove Verb. If kClose Verb is not the last entry, it is always followed by kMove Verb; the quantity of kMove Verb equals the Contour count. Verb Array does not include or count kDone Verb; it is a convenience returned when iterating through Verb Array.
Verb Array may be read directly from Path with getVerbs, or inspected with Iter, or with RawIter.
Returns the number of Verbs: kMove Verb, kLine Verb, kQuad Verb, kConic Verb, kCubic Verb, and kClose Verb; added to Path.
length of Verb Array
empty verb count: 0 round rect verb count: 10
getVerbs Iter RawIter
Returns the number of verbs in the path. Up to max verbs are copied. The verbs are copied as one byte per verb.
the actual number of verbs in the path
no verbs verb count: 3 zero max verb count: 3 too small verb count: 3 move line just right verb count: 3 move line line
countVerbs getPoints Iter RawIter
Exchanges the Verb Array, Point Array, Weights, and Fill Type with other. Cached state is also exchanged. swap internally exchanges pointers, so it is lightweight and does not allocate memory.
swap usage has largely been replaced by operator=(const SkPath& path). Paths do not copy their content on assignment until they are written to, making assignment as efficient as swap.
path1 bounds = 0, 0, 0, 0 path2 bounds = 10, 20, 30, 40
operator=(const SkPath& path)
Returns minimum and maximum axes values of Point Array. 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.
Rect returned includes all Points added to Path, including Points associated with kMove Verb that define empty Contours.
bounds of all Points in Point Array
empty bounds = 0, 0, 0, 0 circle bounds = 25, 20, 75, 70 rotated circle bounds = 14.6447, 9.64466, 85.3553, 80.3553
computeTightBounds updateBoundsCache
Update internal bounds so that subsequent calls to getBounds are instantaneous. Unaltered copies of Path may also access cached bounds through getBounds.
For now, identical to calling getBounds and ignoring the returned value.
Call to prepare Path subsequently drawn from multiple threads, to avoid a race condition where each draw separately computes the bounds.
#Volatile uncached avg: 0.18048 ms cached avg: 0.182784 ms
getBounds
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.
Includes Points associated with kMove Verb that define empty Contours.
Behaves identically to getBounds when Path contains only lines. If Path 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.
tight bounds of curves in Path
empty bounds = 0, 0, 0, 0 circle bounds = 25, 20, 75, 70 rotated circle bounds = 25, 20, 75, 70
getBounds
Returns true if rect is contained by Path. May return false when rect is contained by Path.
For now, only returns true if Path has one Contour and is convex. rect may share points and edges with Path and be contained. Returns true if rect is empty, that is, it has zero width or height; and the Point or Line described by rect is contained by Path.
true if rect is contained
contains Op Rect Convexity
grows Path Verb Array and Point Array to contain extraPtCount additional Points. May improve performance and use less memory by reducing the number and size of allocations when creating Path.
Point Array
Adds beginning of Contour at Point (x, y).
Contour lineTo[2] rMoveTo quadTo[2] conicTo[2] cubicTo[2] close
Adds beginning of Contour at Point p.
Contour lineTo[2] rMoveTo quadTo[2] conicTo[2] cubicTo[2] close
Adds beginning of Contour relative to Last Point. If Path is empty, starts Contour at (dx, dy). Otherwise, start Contour at Last Point offset by (dx, dy). Function name stands for "relative move to".
Contour lineTo[2] moveTo[2] quadTo[2] conicTo[2] cubicTo[2] close
Adds Line from Last Point to (x, y). If Path is empty, or last Verb is kClose Verb, Last Point is set to (0, 0) before adding Line.
lineTo appends kMove Verb to Verb Array and (0, 0) to Point Array, if needed. lineTo then appends kLine Verb to Verb Array and (x, y) to Point Array.
Contour moveTo[2] rLineTo addRect[2][3]
Adds Line from Last Point to Point p. If Path is empty, or last Verb is kClose Verb, Last Point is set to (0, 0) before adding Line.
lineTo first appends kMove Verb to Verb Array and (0, 0) to Point Array, if needed. lineTo then appends kLine Verb to Verb Array and Point p to Point Array.
Contour moveTo[2] rLineTo addRect[2][3]
Adds Line from Last Point to Vector (dx, dy). If Path is empty, or last Verb is kClose Verb, Last Point is set to (0, 0) before adding Line.
Appends kMove Verb to Verb Array and (0, 0) to Point Array, if needed; then appends kLine Verb to Verb Array and Line end to Point Array. Line end is Last Point plus Vector (dx, dy). Function name stands for "relative line to".
Contour moveTo[2] lineTo[2] addRect[2][3]
Quad describes a quadratic Bezier, a second-order curve identical to a section of a parabola. Quad begins at a start Point, curves towards a control Point, and then curves to an end Point.
Quad is a special case of Conic where Conic Weight is set to one.
Quad is always contained by the triangle connecting its three Points. Quad begins tangent to the line between start Point and control Point, and ends tangent to the line between control Point and end Point.
Adds Quad from Last Point towards (x1, y1), to (x2, y2). If Path is empty, or last Verb is kClose Verb, Last Point is set to (0, 0) before adding Quad.
Appends kMove Verb to Verb Array and (0, 0) to Point Array, if needed; then appends kQuad Verb to Verb Array; and (x1, y1), (x2, y2) to Point Array.
Contour moveTo[2] conicTo[2] rQuadTo
Adds Quad from Last Point towards Point p1, to Point p2. If Path is empty, or last Verb is kClose Verb, Last Point is set to (0, 0) before adding Quad.
Appends kMove Verb to Verb Array and (0, 0) to Point Array, if needed; then appends kQuad Verb to Verb Array; and Points p1, p2 to Point Array.
Contour moveTo[2] conicTo[2] rQuadTo
Adds Quad from Last Point towards Vector (dx1, dy1), to Vector (dx2, dy2). If Path is empty, or last Verb is kClose Verb, Last Point is set to (0, 0) before adding Quad.
Appends kMove Verb to Verb Array and (0, 0) to Point Array, if needed; then appends kQuad Verb to Verb Array; and appends Quad control and Quad end to Point Array. Quad control is Last Point plus Vector (dx1, dy1). Quad end is Last Point plus Vector (dx2, dy2). Function name stands for "relative quad to".
Contour moveTo[2] conicTo[2] quadTo[2]
Conic describes a conical section: a piece of an ellipse, or a piece of a parabola, or a piece of a hyperbola. Conic begins at a start Point, curves towards a control Point, and then curves to an end Point. The influence of the control Point is determined by Conic Weight.
Each Conic in Path adds two Points and one Conic Weight. Conic Weights in Path may be inspected with Iter, or with RawIter.
Weight determines both the strength of the control Point and the type of Conic. Weight varies from zero to infinity. At zero, Weight causes the control Point to have no effect; Conic is identical to a line segment from start Point to end point. If Weight is less than one, Conic follows an elliptical arc. If Weight is exactly one, then Conic is identical to Quad; Conic follows a parabolic arc. If Weight is greater than one, Conic follows a hyperbolic arc. If Weight is infinity, Conic is identical to two line segments, connecting start Point to control Point, and control Point to end Point.
move {0, 0}, quad {0, 0}, {20, 30}, {50, 60}, done
If weight is less than one, Conic is an elliptical segment.
move {0, 0}, conic {0, 0}, {20, 0}, {20, 20}, weight = 0.707107 done
If weight is greater than one, Conic is a hyperbolic segment. As weight gets large, a hyperbolic segment can be approximated by straight lines connecting the control Point with the end Points.
move {0, 0}, line {0, 0}, {20, 0}, line {20, 0}, {20, 20}, done
Adds Conic from Last Point towards (x1, y1), to (x2, y2), weighted by w. If Path is empty, or last Verb is kClose Verb, Last Point is set to (0, 0) before adding Conic.
Appends kMove Verb to Verb Array and (0, 0) to Point Array, if needed.
If w is finite and not one, appends kConic Verb to Verb Array; and (x1, y1), (x2, y2) to Point Array; and w to Conic Weights.
If w is one, appends kQuad Verb to Verb Array, and (x1, y1), (x2, y2) to Point Array.
If w is not finite, appends kLine Verb twice to Verb Array, and (x1, y1), (x2, y2) to Point Array.
rConicTo arcTo[2][3][4][5] addArc quadTo[2]
Adds Conic from Last Point towards Point p1, to Point p2, weighted by w. If Path is empty, or last Verb is kClose Verb, Last Point is set to (0, 0) before adding Conic.
Appends kMove Verb to Verb Array and (0, 0) to Point Array, if needed.
If w is finite and not one, appends kConic Verb to Verb Array; and Points p1, p2 to Point Array; and w to Conic Weights.
If w is one, appends kQuad Verb to Verb Array, and Points p1, p2 to Point Array.
If w is not finite, appends kLine Verb twice to Verb Array, and Points p1, p2 to Point Array.
rConicTo arcTo[2][3][4][5] addArc quadTo[2]
Adds Conic from Last Point towards Vector (dx1, dy1), to Vector (dx2, dy2), weighted by w. If Path is empty, or last Verb is kClose Verb, Last Point is set to (0, 0) before adding Conic.
Appends kMove Verb to Verb Array and (0, 0) to Point Array, if needed.
If w is finite and not one, next appends kConic Verb to Verb Array, and w is recorded as Conic Weight; otherwise, if w is one, appends kQuad Verb to Verb Array; or if w is not finite, appends kLine Verb twice to Verb Array.
In all cases appends Points control and end to Point Array. control is Last Point plus Vector (dx1, dy1). end is Last Point plus Vector (dx2, dy2).
Function name stands for "relative conic to".
conicTo[2] arcTo[2][3][4][5] addArc quadTo[2]
Cubic describes a Bezier Curve segment described by a third-order polynomial. Cubic begins at a start Point, curving towards the first control Point; and curves from the end Point towards the second control Point.
Adds Cubic from Last Point towards (x1, y1), then towards (x2, y2), ending at (x3, y3). If Path is empty, or last Verb is kClose Verb, Last Point is set to (0, 0) before adding Cubic.
Appends kMove Verb to Verb Array and (0, 0) to Point Array, if needed; then appends kCubic Verb to Verb Array; and (x1, y1), (x2, y2), (x3, y3) to Point Array.
Contour moveTo[2] rCubicTo quadTo[2]
Adds Cubic from Last Point towards Point p1, then towards Point p2, ending at Point p3. If Path is empty, or last Verb is kClose Verb, Last Point is set to (0, 0) before adding Cubic.
Appends kMove Verb to Verb Array and (0, 0) to Point Array, if needed; then appends kCubic Verb to Verb Array; and Points p1, p2, p3 to Point Array.
Contour moveTo[2] rCubicTo quadTo[2]
Adds Cubic from Last Point towards Vector (dx1, dy1), then towards Vector (dx2, dy2), to Vector (dx3, dy3). If Path is empty, or last Verb is kClose Verb, Last Point is set to (0, 0) before adding Cubic.
Appends kMove Verb to Verb Array and (0, 0) to Point Array, if needed; then appends kCubic Verb to Verb Array; and appends Cubic control and Cubic end to Point Array. Cubic control is Last Point plus Vector (dx1, dy1). Cubic end is Last Point plus Vector (dx2, dy2). Function name stands for "relative cubic to".
Contour moveTo[2] cubicTo[2] quadTo[2]
Arc can be constructed in a number of ways. Arc may be described by part of Oval and angles, by start point and end point, and by radius and tangent lines. Each construction has advantages, and some constructions correspond to Arc drawing in graphics standards.
All Arc draws are implemented by one or more Conic draws. When Conic Weight is less than one, Conic describes an Arc of some Oval or Circle.
arcTo(const SkRect& oval, SkScalar startAngle, SkScalar sweepAngle, bool forceMoveTo) describes Arc as a piece of Oval, beginning at start angle, sweeping clockwise or counterclockwise, which may continue Contour or start a new one. This construction is similar to PostScript and HTML Canvas arcs. Variation addArc always starts new Contour. Canvas::drawArc draws without requiring Path.
arcTo(SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2, SkScalar radius) describes Arc as tangent to the line (x0, y0), (x1, y1) and tangent to the line (x1, y1), (x2, y2) where (x0, y0) is the last Point added to Path. This construction is similar to PostScript and HTML Canvas arcs.
arcTo(SkScalar rx, SkScalar ry, SkScalar xAxisRotate, ArcSize largeArc, Direction sweep, SkScalar x, SkScalar y) describes Arc as part of Oval with radii (rx, ry), beginning at last Point added to Path and ending at (x, y). More than one Arc satisfies this criteria, so additional values choose a single solution. This construction is similar to SVG arcs.
conicTo describes Arc of less than 180 degrees as a pair of tangent lines and Conic Weight. conicTo can represent any Arc with a sweep less than 180 degrees at any rotation. All arcTo constructions are converted to Conic data when added to Path.
Append 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.
arcTo adds Line connecting Path last Point to initial Arc Point if forceMoveTo is false and Path is not empty. Otherwise, added Contour begins with first point of Arc. Angles greater than -360 and less than 360 are treated modulo 360.
addArc SkCanvas::drawArc conicTo[2]
Append 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 (x0, y0) 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.
If last Path Point does not start Arc, arcTo appends connecting Line to Path. The length of Vector from (x1, y1) to (x2, y2) does not affect Arc.
Arc sweep is always less than 180 degrees. If radius is zero, or if tangents are nearly parallel, arcTo appends Line from last Path Point to (x1, y1).
arcTo appends at most one Line and one Conic. arcTo implements the functionality of PostScript Arct and HTML Canvas ArcTo.
move to (156,20) line (156,20),(79.2893,20) conic (79.2893,20),(200,20),(114.645,105.355) weight 0.382683
conicTo[2]
Append 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.
If last Path Point does not start Arc, arcTo appends connecting Line to Path. The length of Vector from p1 to p2 does not affect Arc.
Arc sweep is always less than 180 degrees. If radius is zero, or if tangents are nearly parallel, arcTo appends Line from last Path Point to p1.
arcTo appends at most one Line and one Conic. arcTo implements the functionality of PostScript Arct and HTML Canvas ArcTo.
move to (156,20) line (156,20),(200,20)
conicTo[2]
Four Oval parts with radii (rx, ry) start at last Path Point and ends at (x, y). ArcSize and Direction select one of the four Oval parts.
arcTo[2][3][4][5] Direction
Append 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.
Arc sweep is always less than 360 degrees. arcTo appends Line to (x, y) if either radii are zero, or if last Path Point equals (x, y). arcTo scales radii (rx, ry) to fit last Path Point and (x, y) if both are greater than zero but too small.
arcTo appends up to four Conic curves. arcTo implements the functionality of SVG Arc, although SVG "sweep-flag" value is opposite the integer value of sweep; SVG "sweep-flag" uses 1 for clockwise, while kCW Direction cast to int is zero.
rArcTo ArcSize Direction
Append 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.
Arc sweep is always less than 360 degrees. arcTo appends Line to xy if either radii are zero, or if last Path Point equals (x, y). arcTo scales radii r to fit last Path Point and xy if both are greater than zero but too small to describe an arc.
arcTo appends up to four Conic curves. arcTo implements the functionality of SVG Arc, although SVG "sweep-flag" value is opposite the integer value of sweep; SVG "sweep-flag" uses 1 for clockwise, while kCW Direction cast to int is zero.
rArcTo ArcSize Direction
Append 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 (x0, y0) to end Point:
(x0 + dx, y0 + 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).
Arc sweep is always less than 360 degrees. arcTo appends Line to end Point if either radii are zero, or if last Path Point equals end Point. arcTo scales radii (rx, ry) to fit last Path Point and end Point if both are greater than zero but too small to describe an arc.
arcTo appends up to four Conic curves. arcTo implements the functionality of SVG Arc, although SVG "sweep-flag" value is opposite the integer value of sweep; SVG "sweep-flag" uses 1 for clockwise, while kCW Direction cast to int is zero.
arcTo[2][3][4][5] ArcSize Direction
Append kClose Verb 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 SkPaint::kFill Style. With SkPaint::kStroke Style, open Contour draws Paint Stroke Cap at Contour start and end; closed Contour draws Paint Stroke Join at Contour start and end.
close has no effect if Path is empty or last Path Verb is kClose Verb.
Returns true if fill is inverted and Path with fill represents area outside of its geometric bounds.
FillType | is inverse |
---|---|
kWinding FillType | false |
kEvenOdd FillType | false |
kInverseWinding FillType | true |
kInverseEvenOdd FillType | true |
true if Path fills outside its bounds
IsInverseFillType(kWinding_FillType) == false IsInverseFillType(kEvenOdd_FillType) == false IsInverseFillType(kInverseWinding_FillType) == true IsInverseFillType(kInverseEvenOdd_FillType) == true
FillType getFillType setFillType ConvertToNonInverseFillType
Returns equivalent Fill Type representing Path fill inside its bounds. .
FillType | inside FillType |
---|---|
kWinding FillType | kWinding FillType |
kEvenOdd FillType | kEvenOdd FillType |
kInverseWinding FillType | kWinding FillType |
kInverseEvenOdd FillType | kEvenOdd FillType |
fill, or kWinding FillType or kEvenOdd FillType if fill is inverted
ConvertToNonInverseFillType(kWinding_FillType) == kWinding_FillType ConvertToNonInverseFillType(kEvenOdd_FillType) == kEvenOdd_FillType ConvertToNonInverseFillType(kInverseWinding_FillType) == kWinding_FillType ConvertToNonInverseFillType(kInverseEvenOdd_FillType) == kEvenOdd_FillType
FillType getFillType setFillType IsInverseFillType
Approximates Conic with Quad array. Conic is constructed from start Point p0, control Point p1, end Point p2, and weight w. Quad array is stored in pts; this storage is supplied by caller. Maximum Quad count is 2 to the pow2. Every third point in array shares last Point of previous Quad and first Point of next Quad. Maximum pts storage size is given by: (1 + 2 * (1 << pow2)) * sizeof(SkPoint).
Returns Quad count used the approximation, which may be smaller than the number requested.
Conic Weight determines the amount of influence Conic control point has on the curve. w less than one represents an elliptical section. w greater than one represents a hyperbolic section. w equal to one represents a parabolic section.
Two Quad curves are sufficient to approximate an elliptical Conic with a sweep of up to 90 degrees; in this case, set pow2 to one.
number of Quad curves written to pts
Conic Quad
Returns true if Path is equivalent to Rect when filled. If false: rect, isClosed, and direction are unchanged. If true: rect, isClosed, and direction are written to if not nullptr.
rect may be smaller than the Path bounds. Path bounds may include kMove Verb points that do not alter the area drawn by the returned rect.
true if Path contains Rect
empty is not rect addRect is rect (10, 20, 30, 40); is closed; direction CW moveTo is rect (10, 20, 30, 40); is closed; direction CW lineTo is not rect addPoly is rect (0, 0, 80, 80); is not closed; direction CCW
computeTightBounds conservativelyContainsRect getBounds isConvex isLastContourClosed isNestedFillRects
Returns true if Path is equivalent to nested Rect pair when filled. If false, rect and dirs are unchanged. If true, rect and dirs are written to if not nullptr: setting rect[0] to outer Rect, and rect[1] to inner Rect; setting dirs[0] to Direction of outer Rect, and dirs[1] to Direction of inner Rect.
true if Path contains nested Rect pair
outer (7.5, 17.5, 32.5, 42.5); direction CW inner (12.5, 22.5, 27.5, 37.5); direction CCW
computeTightBounds conservativelyContainsRect getBounds isConvex isLastContourClosed isRect
Add Rect to Path, appending kMove Verb, three kLine Verb, and kClose Verb, starting with top-left corner of Rect; followed by top-right, bottom-right, and bottom-left if dir is kCW Direction; or followed by bottom-left, bottom-right, and top-right if dir is kCCW Direction.
SkCanvas::drawRect Direction
Add Rect to Path, appending kMove Verb, three kLine Verb, and kClose Verb. If dir is kCW Direction, Rect corners are added clockwise; if dir is kCCW Direction, Rect corners are added counterclockwise. start determines the first corner added.
start | first corner |
---|---|
0 | top-left |
1 | top-right |
2 | bottom-right |
3 | bottom-left |
SkCanvas::drawRect Direction
Add Rect (left, top, right, bottom) to Path, appending kMove Verb, three kLine Verb, and kClose Verb, starting with top-left corner of Rect; followed by top-right, bottom-right, and bottom-left if dir is kCW Direction; or followed by bottom-left, bottom-right, and top-right if dir is kCCW Direction.
SkCanvas::drawRect Direction
Add Oval to path, appending kMove Verb, four kConic Verb, and kClose Verb. Oval is upright ellipse bounded by Rect oval with radii equal to half oval width and half oval height. Oval begins at (oval.fRight, oval.centerY()) and continues clockwise if dir is kCW Direction, counterclockwise if dir is kCCW Direction.
SkCanvas::drawOval Direction Oval
Add Oval to Path, appending kMove Verb, four kConic Verb, and kClose Verb. Oval is upright ellipse bounded by Rect oval with radii equal to half oval width and half oval height. Oval begins at start and continues clockwise if dir is kCW Direction, counterclockwise if dir is kCCW Direction.
start | Point |
---|---|
0 | oval.centerX(), oval.fTop |
1 | oval.fRight, oval.centerY() |
2 | oval.centerX(), oval.fBottom |
3 | oval.fLeft, oval.centerY() |
SkCanvas::drawOval Direction Oval
Add Circle centered at (x, y) of size radius to Path, appending kMove Verb, four kConic Verb, and kClose Verb. Circle begins at: (x + radius, y) , continuing clockwise if dir is kCW Direction, and counterclockwise if dir is kCCW Direction.
Has no effect if radius is zero or negative.
SkCanvas::drawCircle[2] Direction Circle
Append 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.
If sweepAngle <= -360, or sweepAngle >= 360; and startAngle modulo 90 is nearly zero, append Oval instead of Arc. Otherwise, sweepAngle values are treated modulo 360, and Arc may or may not draw depending on numeric rounding.
Arc arcTo[2][3][4][5] SkCanvas::drawArc
Append Round Rect to Path, creating a new closed Contour. Round Rect has bounds equal to rect; each corner is 90 degrees of an ellipse with radii (rx, ry). If dir is kCW Direction, Round Rect starts at top-left of the lower-left corner and winds clockwise. If dir is kCCW Direction, Round Rect starts at the bottom-left of the upper-left corner and winds counterclockwise.
If either rx or ry is too large, rx and ry are scaled uniformly until the corners fit. If rx or ry is less than or equal to zero, addRoundRect appends Rect rect to Path.
After appending, Path may be empty, or may contain: Rect, Oval, or RoundRect.
addRRect[2] SkCanvas::drawRoundRect
Append Round Rect to Path, creating a new closed Contour. Round Rect has bounds equal to rect; each corner is 90 degrees of an ellipse with radii from the array.
radii index | location |
---|---|
0 | x-axis radius of top-left corner |
1 | y-axis radius of top-left corner |
2 | x-axis radius of top-right corner |
3 | y-axis radius of top-right corner |
4 | x-axis radius of bottom-right corner |
5 | y-axis radius of bottom-right corner |
6 | x-axis radius of bottom-left corner |
7 | y-axis radius of bottom-left corner |
If dir is kCW Direction, Round Rect starts at top-left of the lower-left corner and winds clockwise. If dir is kCCW Direction, Round Rect starts at the bottom-left of the upper-left corner and winds counterclockwise.
If both radii on any side of rect exceed its length, all radii are scaled uniformly until the corners fit. If either radius of a corner is less than or equal to zero, both are treated as zero.
After appending, Path may be empty, or may contain: Rect, Oval, or RoundRect.
addRRect[2] SkCanvas::drawRoundRect
Add rrect to Path, creating a new closed Contour. If dir is kCW Direction, rrect starts at top-left of the lower-left corner and winds clockwise. If dir is kCCW Direction, rrect starts at the bottom-left of the upper-left corner and winds counterclockwise.
After appending, Path may be empty, or may contain: Rect, Oval, or Round Rect.
addRoundRect[2] SkCanvas::drawRRect
Add rrect to Path, creating a new closed Contour. If dir is kCW Direction, rrect winds clockwise; if dir is kCCW Direction, rrect winds counterclockwise. start determines the first point of rrect to add.
start | location |
---|---|
0 | right of top-left corner |
1 | left of top-right corner |
2 | bottom of top-right corner |
3 | top of bottom-right corner |
4 | left of bottom-right corner |
5 | right of bottom-left corner |
6 | top of bottom-left corner |
7 | bottom of top-left corner |
After appending, Path may be empty, or may contain: Rect, Oval, or Round Rect.
addRoundRect[2] SkCanvas::drawRRect
Add Contour created from Line array, 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 Path, connecting pts[count - 1] and pts[0].
If count is zero, append kMove Verb to path. Has no effect if count is less than one.
SkCanvas::drawPoints
AddPathMode chooses how addPath appends. Adding one Path to another can extend the last Contour or start a new Contour.
addPath[2][3] reverseAddPath
Append src to Path, offset by (dx, dy).
If mode is kAppend AddPathMode, src Verb Array, Point Array, and Conic Weights are added unaltered. If mode is kExtend AddPathMode, add Line before appending Verbs, Points, and Conic Weights.
AddPathMode offset[2] reverseAddPath
Append src to Path.
If mode is kAppend AddPathMode, src Verb Array, Point Array, and Conic Weights are added unaltered. If mode is kExtend AddPathMode, add Line before appending Verbs, Points, and Conic Weights.
AddPathMode reverseAddPath
Append src to Path, transformed by matrix. Transformed curves may have different Verbs, Points, and Conic Weights.
If mode is kAppend AddPathMode, src Verb Array, Point Array, and Conic Weights are added unaltered. If mode is kExtend AddPathMode, add Line before appending Verbs, Points, and Conic Weights.
AddPathMode transform[2] offset[2] reverseAddPath
Append src to Path, from back to front. Reversed src always appends a new Contour to Path.
AddPathMode transform[2] offset[2] addPath[2][3]
Offset Point Array by (dx, dy). Offset Path replaces dst. If dst is nullptr, Path is replaced by offset data.
addPath[2][3] transform[2]
Offset Point Array by (dx, dy). Path is replaced by offset data.
addPath[2][3] transform[2] SkCanvas::translate()
Transform Verb Array, Point Array, and weight by matrix. transform may change Verbs and increase their number. Transformed Path replaces dst; if dst is nullptr, original data is replaced.
addPath[2][3] offset[2] SkCanvas::concat() SkMatrix
Transform Verb Array, Point Array, and weight by matrix. transform may change Verbs and increase their number. Path is replaced by transformed data.
addPath[2][3] offset[2] SkCanvas::concat() SkMatrix
Path is defined cumulatively, often by adding a segment to the end of last Contour. Last Point of Contour is shared as first Point of added Line or Curve. Last Point can be read and written directly with getLastPt and setLastPt.
Returns Last Point on Path in lastPt. Returns false if Point Array is empty, storing (0, 0) if lastPt is not nullptr.
true if Point Array contains one or more Points
last point: 35.2786, 52.9772
setLastPt[2]
Set Last Point to (x, y). If Point Array is empty, append kMove Verb to Verb Array and append (x, y) to Point Array.
getLastPt
Set the last point on the path. If Point Array is empty, append kMove Verb to Verb Array and append p to Point Array.
getLastPt
SegmentMask constants correspond to each drawing Verb type in Path; for instance, if Path only contains Lines, only the kLine SegmentMask bit is set.
Path kConic_SegmentMask is clear Path kQuad_SegmentMask is set
getSegmentMasks Verb
Returns a mask, where each set bit corresponds to a SegmentMask constant if Path contains one or more Verbs of that type. Returns zero if Path contains no Lines, or Curves: Quads, Conics, or Cubics.
getSegmentMasks returns a cached result; it is very fast.
SegmentMask bits or zero
mask quad set
getSegmentMasks Verb
Returns true if the point (x, y) is contained by Path, taking into account FillType.
FillType | contains returns true if Point is enclosed by |
---|---|
kWinding FillType | a non-zero sum of Contour Directions. |
kEvenOdd FillType | an odd number of Contours. |
kInverseWinding FillType | a zero sum of Contour Directions. |
kInverseEvenOdd FillType | and even number of Contours. |
true if Point is in Path
conservativelyContainsRect Fill Type Op
Writes text representation of Path to stream. If stream is nullptr, writes to standard output. Set forceClose to true to get edges used to fill Path. Set dumpAsHex true to generate exact binary representations of floating point numbers used in Point Array and Conic Weights.
path.setFillType(SkPath::kWinding_FillType); path.moveTo(0, 0); path.quadTo(20, 30, 40, 50); path.setFillType(SkPath::kWinding_FillType); path.moveTo(SkBits2Float(0x00000000), SkBits2Float(0x00000000)); // 0, 0 path.quadTo(SkBits2Float(0x41a00000), SkBits2Float(0x41f00000), SkBits2Float(0x42200000), SkBits2Float(0x42480000)); // 20, 30, 40, 50 path.setFillType(SkPath::kWinding_FillType); path.moveTo(0, 0); path.quadTo(20, 30, 40, 50); path.lineTo(0, 0); path.close(); path.setFillType(SkPath::kWinding_FillType); path.moveTo(SkBits2Float(0x00000000), SkBits2Float(0x00000000)); // 0, 0 path.quadTo(SkBits2Float(0x41a00000), SkBits2Float(0x41f00000), SkBits2Float(0x42200000), SkBits2Float(0x42480000)); // 20, 30, 40, 50 path.lineTo(SkBits2Float(0x00000000), SkBits2Float(0x00000000)); // 0, 0 path.close();
dumpHex SkRect::dump()[2] SkRRect::dump()[2] SkPathMeasure::dump()
Writes text representation of Path to standard output. The representation may be directly compiled as C++ code. Floating point values are written with limited precision; it may not be possible to reconstruct original Path from output.
path.setFillType(SkPath::kWinding_FillType); path.moveTo(0, 0); path.lineTo(0.857143f, 0.666667f); path is not equal to copy
dumpHex SkRect::dump()[2] SkRRect::dump()[2] SkPathMeasure::dump() writeToMemory
Writes text representation of Path to standard output. The representation may be directly compiled as C++ code. Floating point values are written in hexadecimal to preserve their exact bit pattern. The output reconstructs the original Path.
Use instead of dump when submitting bug reports against Skia .
path.setFillType(SkPath::kWinding_FillType); path.moveTo(SkBits2Float(0x00000000), SkBits2Float(0x00000000)); // 0, 0 path.lineTo(SkBits2Float(0x3f5b6db7), SkBits2Float(0x3f2aaaab)); // 0.857143f, 0.666667f path is equal to copy
dump[2] SkRect::dumpHex SkRRect::dumpHex writeToMemory
Writes Path to buffer, returning the number of bytes written. Pass nullptr to obtain the storage size.
Writes Fill Type, Verb Array, Point Array, Conic Weight, and additionally writes computed information like Convexity and bounds.
Use only be used in concert with readFromMemory; the format used for Path in memory is not guaranteed.
size of storage required for Path; always a multiple of 4
path is equal to copy
serialize readFromMemory dump[2] dumpHex
Write Path to buffer, returning the buffer written to, wrapped in Data.
serialize writes Fill Type, Verb Array, Point Array, Conic Weight, and additionally writes computed information like Convexity and bounds.
serialize should only be used in concert with readFromMemory. The format used for Path in memory is not guaranteed.
Path data wrapped in Data buffer
path is equal to copy
writeToMemory readFromMemory dump[2] dumpHex
Initializes Path from buffer of size length. Returns zero if the buffer is data is inconsistent, or the length is too small.
Reads Fill Type, Verb Array, Point Array, Conic Weight, and additionally reads computed information like Convexity and bounds.
Used only in concert with writeToMemory; the format used for Path in memory is not guaranteed.
number of bytes read, or zero on failure
length = 32; returned by readFromMemory = 0 length = 40; returned by readFromMemory = 36
writeToMemory
Generation ID provides a quick way to check if Verb Array, Point Array, or Conic Weight has changed. Generation ID is not a hash; identical Paths will not necessarily have matching Generation IDs.
Empty Paths have a Generation ID of one.
Returns a non-zero, globally unique value. A different value is returned if Verb Array, Point Array, or Conic Weight changes.
Setting Fill Type does not change Generation ID.
Each time the path is modified, a different Generation ID will be returned.
Fill Type does affect Generation ID on Android framework.
non-zero, globally unique value
empty genID = 1 1st lineTo genID = 2 empty genID = 1 2nd lineTo genID = 3
operator==(const SkPath& a, const SkPath& b)
Returns if Path data is consistent. Corrupt Path data is detected if internal values are out of range or internal storage does not match array dimensions.
true if Path data is consistent
Deprecated.
soon
SkPath can be constructed or initialized by these functions, including C++ class constructors.
SkPath member functions read and modify the structure properties.
Iterates through Verb Array, and associated Point Array and Conic Weight. Provides options to treat open Contours as closed, and to ignore degenerate data.
RawIter
Initializes Iter with an empty Path. next on Iter returns kDone Verb. Call setPath to initialize Iter at a later time.
Iter of empty Path
iter is done iter is done
setPath
Sets Iter to return elements of Verb Array, Point Array, and Conic Weight in path. If forceClose is true, Iter will add kLine Verb and kClose Verb after each open Contour. path is not altered.
Iter of path
open: kMove_Verb {0, 0}, kQuad_Verb {0, 0}, {10, 20}, {30, 40}, kDone_Verb closed: kMove_Verb {0, 0}, kQuad_Verb {0, 0}, {10, 20}, {30, 40}, kLine_Verb {30, 40}, {0, 0}, kClose_Verb {0, 0}, kDone_Verb
setPath
Sets Iter to return elements of Verb Array, Point Array, and Conic Weight in path. If forceClose is true, Iter will add kLine Verb and kClose Verb after each open Contour. path is not altered.
quad open: kMove_Verb {0, 0}, kQuad_Verb {0, 0}, {10, 20}, {30, 40}, kDone_Verb conic closed: kMove_Verb {0, 0}, kConic_Verb {0, 0}, {1, 2}, {3, 4}, weight = 0.5 kLine_Verb {3, 4}, {0, 0}, kClose_Verb {0, 0}, kDone_Verb
Iter(const SkPath& path, bool forceClose)
Returns next Verb in Verb Array, and advances Iter. When Verb Array is exhausted, returns kDone Verb.
Zero to four Points are stored in pts, depending on the returned Verb.
If doConsumeDegenerates is true, skip consecutive kMove Verb entries, returning only the last in the series; and skip very small Lines, Quads, and Conics; and skip kClose Verb following kMove Verb. if doConsumeDegenerates is true and exact is true, only skip Lines, Quads, and Conics with zero lengths.
next Verb from Verb Array
skip degenerate if exact skips the same as skip degenerate, but shows the very small Line.
skip none shows all of the Verbs and Points in Path.
skip degenerate: kMove_Verb {20, 20}, kQuad_Verb {20, 20}, {10, 20}, {30, 40}, kDone_Verb skip degenerate if exact: kMove_Verb {20, 20}, kQuad_Verb {20, 20}, {10, 20}, {30, 40}, kMove_Verb {30, 30}, kLine_Verb {30, 30}, {30.00001, 30}, kDone_Verb skip none: kMove_Verb {10, 10}, kMove_Verb {20, 20}, kQuad_Verb {20, 20}, {10, 20}, {30, 40}, kMove_Verb {1, 1}, kClose_Verb {1, 1}, kMove_Verb {30, 30}, kLine_Verb {30, 30}, {30, 30}, kMove_Verb {30, 30}, kLine_Verb {30, 30}, {30.00001, 30}, kDone_Verb
Verb IsLineDegenerate IsCubicDegenerate IsQuadDegenerate
Returns Conic Weight if next returned kConic Verb.
If next has not been called, or next did not return kConic Verb, result is undefined.
Conic Weight for Conic Points returned by next
first verb is move next verb is conic conic points: {0,0}, {1,2}, {3,4} conic weight: 0.5
Conic Weight
Returns true if last kLine Verb returned by next was generated by kClose Verb. When true, the end point returned by next is also the start point of Contour.
If next has not been called, or next did not return kLine Verb, result is undefined.
true if last kLine Verb was generated by kClose Verb
1st verb is move moveTo point: {6,7} 2nd verb is conic 3rd verb is line line points: {3,4}, {6,7} line generated by close 4th verb is close
close
Returns true if subsequent calls to next return kClose Verb before returning kMove Verb. if true, Contour Iter is processing may end with kClose Verb, or Iter may have been initialized with force close set to true.
true if Contour is closed
without close(), forceClose is false: isClosedContour returns false with close(), forceClose is false: isClosedContour returns true without close(), forceClose is true : isClosedContour returns true with close(), forceClose is true : isClosedContour returns true
Iter(const SkPath& path, bool forceClose)
SkPath can be constructed or initialized by these functions, including C++ class constructors.
SkPath member functions read and modify the structure properties.
Iterates through Verb Array, and associated Point Array and Conic Weight. Verb Array, Point Array, and Conic Weight are returned unaltered.
Initializes RawIter with an empty Path. next on RawIter returns kDone Verb. Call setPath to initialize SkPath::Iter at a later time.
RawIter of empty Path
Sets RawIter to return elements of Verb Array, Point Array, and Conic Weight in path.
RawIter of path
Sets SkPath::Iter to return elements of Verb Array, Point Array, and Conic Weight in path.
Returns next Verb in Verb Array, and advances RawIter. When Verb Array is exhausted, returns kDone Verb. Zero to four Points are stored in pts, depending on the returned Verb.
next Verb from Verb Array
kMove_Verb {50, 60}, kQuad_Verb {50, 60}, {10, 20}, {30, 40}, kClose_Verb {50, 60}, kMove_Verb {50, 60}, kLine_Verb {50, 60}, {30, 30}, kConic_Verb {30, 30}, {1, 2}, {3, 4}, weight = 0.5 kCubic_Verb {3, 4}, {-1, -2}, {-3, -4}, {-5, -6}, kDone_Verb
peek
Returns next Verb, but does not advance RawIter.
next Verb from Verb Array
#Volatile peek Move == verb Move peek Quad == verb Quad peek Conic == verb Conic peek Cubic == verb Cubic peek Done == verb Done peek Done == verb Done
StdOut is not really volatile, it just produces the wrong result. A simple fix changes the output of hairlines and needs to be investigated to see if the change is correct or not. see change 21340 (abandoned for now)
next
Returns Conic Weight if next returned kConic Verb.
If next has not been called, or next did not return kConic Verb, result is undefined.
Conic Weight for Conic Points returned by next
first verb is move next verb is conic conic points: {0,0}, {1,2}, {3,4} conic weight: 0.5
Conic Weight