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
Overloaded function.
Returns conic weight if
next()
returnedkConic_Verb
.Returns true if last:py:attr:~skia.Path.kLine_Verb returned by
next()
was generated bykClose_Verb
.Returns true if subsequent calls to
next()
returnkClose_Verb
before returningkMove_Verb
.Sets
Iter
to return elements of verb array,Point
array, and conic weight in path.
Methods
- Iter.__init__(*args, **kwargs)
Overloaded function.
__init__(self: skia.Path.Iter) -> None
Initializes
Iter
with an emptyPath
.next() on
Iter
returnskDone_Verb
. Call setPath to initializeIter
at a later time.- return:
Iter
of empty SkPath
__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 addkLine_Verb
andkClose_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()
returnedkConic_Verb
.If
next()
has not been called, ornext()
did not returnkConic_Verb
, result is undefined.- Returns:
conic weight for conic
Point
returned bynext()
- Iter.isCloseLine(self: skia.Path.Iter) bool
Returns true if last:py:attr:~skia.Path.kLine_Verb returned by
next()
was generated bykClose_Verb
.When true, the end point returned by
next()
is also the start point of contour.If
next()
has not been called, ornext()
did not returnkLine_Verb
, result is undefined.- Returns:
true if last
kLine_Verb
was generated bykClose_Verb
- Iter.isClosedContour(self: skia.Path.Iter) bool
Returns true if subsequent calls to
next()
returnkClose_Verb
before returningkMove_Verb
.if true, contour
Iter
is processing may end withkClose_Verb
, orIter
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 advancesIter
.When verb array is exhausted, returns
kDone_Verb
.Zero to four
Point
are stored in pts, depending on the returnedVerb
.- Returns:
tuple of the following: next
Verb
from verb array; and storage forPoint
data describing returnedVerb
- 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 addkLine_Verb
andkClose_Verb
after each open contour. path is not altered.- Parameters:
path (skia.Path) –
Path
to iterateforceClose (bool) – true if open contours generate
kClose_Verb