Skia
2DGraphicsLibrary
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SkPath::Iter Class Reference

Iterate through all of the segments (lines, quadratics, cubics) of each contours in a path. More...

#include <SkPath.h>

Public Member Functions

 Iter (const SkPath &, bool forceClose)
 
void setPath (const SkPath &, bool forceClose)
 
Verb next (SkPoint pts[4], bool doConsumeDegerates=true, bool exact=false)
 Return the next verb in this iteration of the path. More...
 
SkScalar conicWeight () const
 Return the weight for the current conic. More...
 
bool isCloseLine () const
 If next() returns kLine_Verb, then this query returns true if the line was the result of a close() command (i.e. More...
 
bool isClosedContour () const
 Returns true if the current contour is closed (has a kClose_Verb) More...
 

Private Member Functions

const SkPointcons_moveTo ()
 
Verb autoClose (SkPoint pts[2])
 
void consumeDegenerateSegments (bool exact)
 
Verb doNext (SkPoint pts[4])
 

Private Attributes

const SkPointfPts
 
const uint8_t * fVerbs
 
const uint8_t * fVerbStop
 
const SkScalar * fConicWeights
 
SkPoint fMoveTo
 
SkPoint fLastPt
 
SkBool8 fForceClose
 
SkBool8 fNeedClose
 
SkBool8 fCloseLine
 
SkBool8 fSegmentState
 

Detailed Description

Iterate through all of the segments (lines, quadratics, cubics) of each contours in a path.

The iterator cleans up the segments along the way, removing degenerate segments and adding close verbs where necessary. When the forceClose argument is provided, each contour (as defined by a new starting move command) will be completed with a close verb regardless of the contour's contents.

Member Function Documentation

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

Return the weight for the current conic.

Only valid if the current segment return by next() was a conic.

bool SkPath::Iter::isClosedContour ( ) const

Returns true if the current contour is closed (has a kClose_Verb)

Returns
true if the current contour is closed (has a kClose_Verb)
bool SkPath::Iter::isCloseLine ( ) const
inline

If next() returns kLine_Verb, then this query returns true if the line was the result of a close() command (i.e.

the end point is the initial moveto for this contour). If next() returned a different verb, this returns an undefined value.

Returns
If the last call to next() returned kLine_Verb, return true if it was the result of an explicit close command.
Verb SkPath::Iter::next ( SkPoint  pts[4],
bool  doConsumeDegerates = true,
bool  exact = false 
)
inline

Return the next verb in this iteration of the path.

When all segments have been visited, return kDone_Verb.

Parameters
ptsThe points representing the current verb and/or segment
doConsumeDegeratesIf true, first scan for segments that are deemed degenerate (too short) and skip those.
exactif doConsumeDegenerates is true and exact is true, skip only degenerate elements with lengths exactly equal to zero. If exact is false, skip degenerate elements with lengths close to zero. If doConsumeDegenerates is false, exact has no effect.
Returns
The verb for the current segment

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