Added in API level 34

PathIterator


open class PathIterator : MutableIterator<PathIterator.Segment!>
kotlin.Any
   ↳ android.graphics.PathIterator

PathIterator can be used to query a given Path object, to discover its operations and point values.

Summary

Nested classes
open

This class holds the data for a given segment in a path, as returned by next().

Constants
static Int

static Int

static Int

static Int

static Int

static Int

static Int

Public methods
open Boolean

Returns true if the there are more elements in this iterator to be returned.

open PathIterator.Segment

Returns the next Segment element in this iterator.

open Int
next(points: FloatArray, offset: Int)

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.

open Int

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

Constants

VERB_CLOSE

Added in API level 34
static val VERB_CLOSE: Int
Value: 5

VERB_CONIC

Added in API level 34
static val VERB_CONIC: Int
Value: 3

VERB_CUBIC

Added in API level 34
static val VERB_CUBIC: Int
Value: 4

VERB_DONE

Added in API level 34
static val VERB_DONE: Int
Value: 6

VERB_LINE

Added in API level 34
static val VERB_LINE: Int
Value: 1

VERB_MOVE

Added in API level 34
static val VERB_MOVE: Int
Value: 0

VERB_QUAD

Added in API level 34
static val VERB_QUAD: Int
Value: 2

Public methods

hasNext

Added in API level 34
open fun hasNext(): Boolean

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.

Return
Boolean true if there are more elements to be iterated through, false otherwise
Exceptions
java.util.ConcurrentModificationException if the underlying path was modified since this iterator was created.

next

Added in API level 34
open fun next(): PathIterator.Segment

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.

Return
PathIterator.Segment the next segment in this iterator This value cannot be null.
Exceptions
java.util.NoSuchElementException if the iteration has no more elements
java.util.ConcurrentModificationException if the underlying path was modified since this iterator was created.

next

Added in API level 34
open fun next(
    points: FloatArray,
    offset: Int
): Int

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 FloatArray: 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.
Return
Int the operation for the next element in the iteration This value cannot be null. Value is android.graphics.PathIterator#VERB_MOVE, android.graphics.PathIterator#VERB_LINE, android.graphics.PathIterator#VERB_QUAD, android.graphics.PathIterator#VERB_CONIC, android.graphics.PathIterator#VERB_CUBIC, android.graphics.PathIterator#VERB_CLOSE, or android.graphics.PathIterator#VERB_DONE
Exceptions
java.lang.ArrayIndexOutOfBoundsException if the points array is too small
java.util.ConcurrentModificationException if the underlying path was modified since this iterator was created.

peek

Added in API level 34
open fun peek(): Int

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

Return
Int the next verb in the iteration, or VERB_DONE if there are no more elements This value cannot be null. Value is android.graphics.PathIterator#VERB_MOVE, android.graphics.PathIterator#VERB_LINE, android.graphics.PathIterator#VERB_QUAD, android.graphics.PathIterator#VERB_CONIC, android.graphics.PathIterator#VERB_CUBIC, android.graphics.PathIterator#VERB_CLOSE, or android.graphics.PathIterator#VERB_DONE
Exceptions
java.util.ConcurrentModificationException if the underlying path was modified since this iterator was created.