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 PathIterator.next()

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 Path, and fills entries in the points array with the point data (if any) for that operation.

PathIterator.Segment next()

Returns the next Segment element in this iterator.

int peek()

Returns the next verb in the iteration, or VERB_DONE if there are no more elements.

Inherited methods

Object clone()

Creates and returns a copy of this object.

boolean equals(Object obj)

Indicates whether some other object is "equal to" this one.

void finalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

final Class<?> getClass()

Returns the runtime class of this Object.

int hashCode()

Returns a hash code value for the object.

final void notify()

Wakes up a single thread that is waiting on this object's monitor.

final void notifyAll()

Wakes up all threads that are waiting on this object's monitor.

String toString()

Returns a string representation of the object.

final void wait(long timeoutMillis, int nanos)

Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

final void wait(long timeoutMillis)

Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

final void wait()

Causes the current thread to wait until it is awakened, typically by being notified or interrupted.

default void forEachRemaining(Consumer<? super E> action)

Performs the given action for each remaining element until all elements have been processed or the action throws an exception.

abstract boolean hasNext()

Returns true if the iteration has more elements.

abstract PathIterator.Segment next()

Returns the next element in the iteration.

default void remove()

Removes from the underlying collection the last element returned by this iterator (optional operation).

Constants

VERB_CLOSE

Added in API level 34
public static final int VERB_CLOSE

Constant Value: 5 (0x00000005)

VERB_CONIC

Added in API level 34
public static final int VERB_CONIC

Constant Value: 3 (0x00000003)

VERB_CUBIC

Added in API level 34
public static final int VERB_CUBIC

Constant Value: 4 (0x00000004)

VERB_DONE

Added in API level 34
public static final int VERB_DONE

Constant Value: 6 (0x00000006)

VERB_LINE

Added in API level 34
public static final int VERB_LINE

Constant Value: 1 (0x00000001)

VERB_MOVE

Added in API level 34
public static final int VERB_MOVE

Constant Value: 0 (0x00000000)

VERB_QUAD

Added in API level 34
public static final int VERB_QUAD

Constant Value: 2 (0x00000002)

Public methods

hasNext

Added in API level 34
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

Added in API level 34
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:

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

Added in API level 34
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

Added in API level 34
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.