Skia
2D Graphics Library
SkPath::Iter Class Reference

Iterates through verb array, and associated SkPoint array and conic weight. More...

#include <SkPath.h>

Public Member Functions

 Iter ()
 Initializes SkPath::Iter with an empty SkPath. More...
 
 Iter (const SkPath &path, bool forceClose)
 Sets SkPath::Iter to return elements of verb array, SkPoint array, and conic weight in path. More...
 
void setPath (const SkPath &path, bool forceClose)
 Sets SkPath::Iter to return elements of verb array, SkPoint array, and conic weight in path. More...
 
Verb next (SkPoint pts[4])
 Returns next SkPath::Verb in verb array, and advances SkPath::Iter. More...
 
SkScalar conicWeight () const
 Returns conic weight if next() returned kConic_Verb. More...
 
bool isCloseLine () const
 Returns true if last kLine_Verb returned by next() was generated by kClose_Verb. More...
 
bool isClosedContour () const
 Returns true if subsequent calls to next() return kClose_Verb before returning kMove_Verb. More...
 

Detailed Description

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

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

Constructor & Destructor Documentation

◆ Iter() [1/2]

SkPath::Iter::Iter ( )

Initializes SkPath::Iter with an empty SkPath.

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

Returns
SkPath::Iter of empty SkPath

example: https://fiddle.skia.org/c/@Path_Iter_Iter

◆ Iter() [2/2]

SkPath::Iter::Iter ( const SkPath path,
bool  forceClose 
)

Sets SkPath::Iter to return elements of verb array, SkPoint array, and conic weight in path.

If forceClose is true, SkPath::Iter will add kLine_Verb and kClose_Verb after each open contour. path is not altered.

Parameters
pathSkPath to iterate
forceClosetrue if open contours generate kClose_Verb
Returns
SkPath::Iter of path

example: https://fiddle.skia.org/c/@Path_Iter_const_SkPath

Member Function Documentation

◆ conicWeight()

SkScalar SkPath::Iter::conicWeight ( ) const
inline

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 SkPoint returned by next()

◆ isClosedContour()

bool SkPath::Iter::isClosedContour ( ) const

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

if true, contour SkPath::Iter is processing may end with kClose_Verb, or SkPath::Iter may have been initialized with force close set to true.

Returns
true if contour is closed

example: https://fiddle.skia.org/c/@Path_Iter_isClosedContour

◆ isCloseLine()

bool SkPath::Iter::isCloseLine ( ) const
inline

Returns true if last 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

◆ next()

Verb SkPath::Iter::next ( SkPoint  pts[4])

Returns next SkPath::Verb in verb array, and advances SkPath::Iter.

When verb array is exhausted, returns kDone_Verb.

Zero to four SkPoint are stored in pts, depending on the returned SkPath::Verb.

Parameters
ptsstorage for SkPoint data describing returned SkPath::Verb
Returns
next SkPath::Verb from verb array

example: https://fiddle.skia.org/c/@Path_RawIter_next

◆ setPath()

void SkPath::Iter::setPath ( const SkPath path,
bool  forceClose 
)

Sets SkPath::Iter to return elements of verb array, SkPoint array, and conic weight in path.

If forceClose is true, SkPath::Iter will add kLine_Verb and kClose_Verb after each open contour. path is not altered.

Parameters
pathSkPath to iterate
forceClosetrue if open contours generate kClose_Verb

example: https://fiddle.skia.org/c/@Path_Iter_setPath


The documentation for this class was generated from the following file: