PathIterator
public
class
PathIterator
extends Object
implements
Iterator<PathIterator.Segment>
java.lang.Object | |
↳ | android.graphics.PathIterator |
PathIterator
can be used to query a given Path
object, to discover its
operations and point values.
Summary
Nested classes | |
---|---|
class |
PathIterator.Segment
This class holds the data for a given segment in a path, as returned by
|
Constants | |
---|---|
int |
VERB_CLOSE
|
int |
VERB_CONIC
|
int |
VERB_CUBIC
|
int |
VERB_DONE
|
int |
VERB_LINE
|
int |
VERB_MOVE
|
int |
VERB_QUAD
|
Public methods | |
---|---|
boolean
|
hasNext()
Returns true if the there are more elements in this iterator to be returned. |
int
|
next(float[] points, int offset)
Returns the next verb in this iterator's |
PathIterator.Segment
|
next()
Returns the next |
int
|
peek()
Returns the next verb in the iteration, or |
Inherited methods | |
---|---|
Constants
Public methods
hasNext
public boolean hasNext ()
Returns true if the there are more elements in this iterator to be returned.
A return value of false
means there are no more elements, and an
ensuing call to next()
or next(float[], int)
)} will return
VERB_DONE
.
Returns | |
---|---|
boolean |
true if there are more elements to be iterated through, false otherwise |
Throws | |
---|---|
ConcurrentModificationException |
if the underlying path was modified since this iterator was created. |
next
public int next (float[] points, int offset)
Returns the next verb in this iterator's Path
, and fills entries in the
points
array with the point data (if any) for that operation.
Each two floats represent the data for a single point of that operation.
The number of pairs of floats supplied in the resulting array depends on the verb:
VERB_MOVE
: 1 pair (indices 0 to 1)VERB_LINE
: 2 pairs (indices 0 to 3)VERB_QUAD
: 3 pairs (indices 0 to 5)VERB_CONIC
: 3.5 pairs (indices 0 to 6), the seventh entry has the conic weightVERB_CUBIC
: 4 pairs (indices 0 to 7)VERB_CLOSE
: 0 pairsVERB_DONE
: 0 pairs
Parameters | |
---|---|
points |
float : The point data for this operation, must have at least
8 items available to hold up to 4 pairs of point values
This value cannot be null . |
offset |
int : An offset into the points array where entries should be placed. |
Returns | |
---|---|
int |
the operation for the next element in the iteration
This value cannot be null .
Value is VERB_MOVE , VERB_LINE , VERB_QUAD , VERB_CONIC , VERB_CUBIC , VERB_CLOSE , or VERB_DONE |
Throws | |
---|---|
ArrayIndexOutOfBoundsException |
if the points array is too small |
ConcurrentModificationException |
if the underlying path was modified since this iterator was created. |
next
public PathIterator.Segment next ()
Returns the next Segment
element in this iterator.
There are two versions of next()
. This version is slightly more
expensive at runtime, since it allocates a new Segment
object with
every call. The other version, next(float[], int)
requires no such allocation, but
requires a little more manual effort to use.
Returns | |
---|---|
PathIterator.Segment |
the next segment in this iterator
This value cannot be null . |
Throws | |
---|---|
ConcurrentModificationException |
if the underlying path was modified since this iterator was created. |
peek
public int peek ()
Returns the next verb in the iteration, or VERB_DONE
if there are no more
elements.
Returns | |
---|---|
int |
the next verb in the iteration, or VERB_DONE if there are no more
elements
This value cannot be null .
Value is VERB_MOVE , VERB_LINE , VERB_QUAD , VERB_CONIC , VERB_CUBIC , VERB_CLOSE , or VERB_DONE |
Throws | |
---|---|
ConcurrentModificationException |
if the underlying path was modified since this iterator was created. |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2024-04-04 UTC.