Path.Iter

class Iter

Iterates through verb array, and associated Point array and conic weight.

Provides options to treat open contours as closed, and to ignore degenerate data.

Example:

it = iter(path)
verb, points = it.next()
while verb != skia.Path.kDone_Verb:
    print(verb)
    print(points)
    print(it.conicWeight())
    verb, points = it.next()

Methods

__init__

Overloaded function.

conicWeight

Returns conic weight if next() returned kConic_Verb.

isCloseLine

Returns true if last:py:attr:~skia.Path.kLine_Verb returned by next() was generated by kClose_Verb.

isClosedContour

Returns true if subsequent calls to next() return kClose_Verb before returning kMove_Verb.

next

Returns next Verb in verb array, and advances Iter.

setPath

Sets Iter to return elements of verb array, Point array, and conic weight in path.

Methods

Iter.__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: skia.Path.Iter) -> None

    Initializes Iter with an empty Path.

    next() on Iter returns kDone_Verb. Call setPath to initialize Iter at a later time.

    return:

    Iter of empty SkPath

  2. __init__(self: skia.Path.Iter, path: skia.Path, forceClose: bool) -> None

    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.

    path:

    Path to iterate

    forceClose:

    true if open contours generate kClose_Verb

    return:

    Iter of path

Iter.conicWeight(self: skia.Path.Iter) float

Returns conic weight if next() returned kConic_Verb.

If next() has not been called, or next() did not return kConic_Verb, result is undefined.

Returns:

conic weight for conic Point returned by next()

Iter.isCloseLine(self: skia.Path.Iter) bool

Returns true if last:py:attr:~skia.Path.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.

Returns:

true if last kLine_Verb was generated by kClose_Verb

Iter.isClosedContour(self: skia.Path.Iter) bool

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.

Returns:

true if contour is closed

Iter.next(self: skia.Path.Iter) tuple

Returns next Verb in verb array, and advances Iter.

When verb array is exhausted, returns kDone_Verb.

Zero to four Point are stored in pts, depending on the returned Verb.

Returns:

tuple of the following: next Verb from verb array; and storage for Point data describing returned Verb

Return type:

Tuple[skia.Path.Verb,List[skia.Point]]

Iter.setPath(self: skia.Path.Iter, path: skia.Path, forceClose: bool) None

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.

Parameters:
  • path (skia.Path) – Path to iterate

  • forceClose (bool) – true if open contours generate kClose_Verb