Class Path
- All Implemented Interfaces:
PathConsumer
,PathIterable
Path
object contains mutable path elements.
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 Béziers, and cubic Béziers. 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.
-
Nested Class Summary
Nested classes/interfaces inherited from class icyllis.arc3d.core.Path
Path.FillRule, Path.RawIterator, Path.SegmentMask
-
Field Summary
Fields inherited from class icyllis.arc3d.core.Path
APPROXIMATE_ARC_WITH_CUBICS, APPROXIMATE_CONIC_WITH_QUADS, DIRECTION_CCW, DIRECTION_CW, FILL_EVEN_ODD, FILL_NON_ZERO, SEGMENT_CUBIC, SEGMENT_LINE, SEGMENT_QUAD, VERB_CLOSE, VERB_CUBIC, VERB_LINE, VERB_MOVE, VERB_QUAD
-
Constructor Summary
ConstructorDescriptionPath()
Creates an empty Path with a default fill rule ofPath.FILL_NON_ZERO
.Creates a copy of an existing Path object. -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Resets the path to its initial state, clears points and verbs and sets fill rule toPath.FILL_NON_ZERO
.final void
void
recycle()
Resets the path to its initial state, clears points and verbs and sets fill rule toPath.FILL_NON_ZERO
.final void
relativeCubicTo
(float dx1, float dy1, float dx2, float dy2, float dx3, float dy3) Relative version of "cubic to".final void
relativeLineTo
(float dx, float dy) Relative version of "line to".final void
relativeMoveTo
(float dx, float dy) Relative version of "move to".final void
relativeQuadTo
(float dx1, float dy1, float dx2, float dy2) Relative version of "quad to".void
reset()
Resets the path to its initial state, clears points and verbs and sets fill rule toPath.FILL_NON_ZERO
.Methods inherited from class icyllis.arc3d.core.Path
close, countPoints, countVerbs, cubicTo, cubicToRel, done, equals, estimatedByteSize, forEach, getBounds, getBounds, getFillRule, getPathIterator, getSegmentMask, hashCode, isEmpty, isFinite, lineTo, lineToRel, move, moveTo, moveToRel, quadTo, quadToRel, set, setFillRule, transform, transform, trimToSize, updateBoundsCache
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface icyllis.arc3d.core.PathConsumer
cubicTo, quadTo
-
Constructor Details
-
Path
public Path()Creates an empty Path with a default fill rule ofPath.FILL_NON_ZERO
. -
Path
Creates a copy of an existing Path object.Internally, the two paths share reference values. The underlying verb array, coordinate array and weights are copied when modified.
-
-
Method Details
-
reset
public void reset()Resets the path to its initial state, clears points and verbs and sets fill rule toPath.FILL_NON_ZERO
.Preserves internal storage if it's unique, otherwise discards.
-
clear
public void clear()Resets the path to its initial state, clears points and verbs and sets fill rule toPath.FILL_NON_ZERO
.Preserves internal storage if it's unique, otherwise allocates new storage with the same size.
-
recycle
public void recycle()Resets the path to its initial state, clears points and verbs and sets fill rule toPath.FILL_NON_ZERO
.This explicitly discards the internal storage, it is recommended to call when the path object will be no longer used.
-
relativeMoveTo
public final void relativeMoveTo(float dx, float dy) Relative version of "move to".- Parameters:
dx
- offset from last point to contour start on x-axisdy
- offset from last point to contour start on y-axis
-
relativeLineTo
public final void relativeLineTo(float dx, float dy) Relative version of "line to".Adds a line from the last point to the specified vector (dx, dy).
- Parameters:
dx
- the offset from last point to line end on x-axisdy
- the offset from last point to line end on y-axis
-
relativeQuadTo
public final void relativeQuadTo(float dx1, float dy1, float dx2, float dy2) Relative version of "quad to".Adds quad from last point towards vector (dx1, dy1), to vector (dx2, dy2).
- Parameters:
dx1
- offset from last point to quad control on x-axisdy1
- offset from last point to quad control on y-axisdx2
- offset from last point to quad end on x-axisdy2
- offset from last point to quad end on y-axis
-
relativeCubicTo
public final void relativeCubicTo(float dx1, float dy1, float dx2, float dy2, float dx3, float dy3) Relative version of "cubic to".Adds cubic from last point towards vector (dx1, dy1), vector (dx2, dy2), to vector (dx3, dy3).
- Parameters:
dx1
- offset from last point to first cubic control on x-axisdy1
- offset from last point to first cubic control on y-axisdx2
- offset from last point to second cubic control on x-axisdy2
- offset from last point to second cubic control on y-axisdx3
- offset from last point to cubic end on x-axisdy3
- offset from last point to cubic end on y-axis
-
getBounds
-