Skia
2D Graphics Library
SkPathBuilder Class Reference

#include <SkPathBuilder.h>

Public Types

enum  ArcSize { kSmall_ArcSize , kLarge_ArcSize }
 

Public Member Functions

 SkPathBuilder ()
 
 SkPathBuilder (SkPathFillType)
 
 SkPathBuilder (const SkPath &)
 
 SkPathBuilder (const SkPathBuilder &)=default
 
 ~SkPathBuilder ()
 
SkPathBuilderoperator= (const SkPath &)
 
SkPathBuilderoperator= (const SkPathBuilder &)=default
 
SkPathFillType fillType () const
 
SkRect computeBounds () const
 
SkPath snapshot () const
 
SkPath detach ()
 
SkPathBuildersetFillType (SkPathFillType ft)
 
SkPathBuildersetIsVolatile (bool isVolatile)
 
SkPathBuilderreset ()
 
SkPathBuildermoveTo (SkPoint pt)
 
SkPathBuildermoveTo (SkScalar x, SkScalar y)
 
SkPathBuilderlineTo (SkPoint pt)
 
SkPathBuilderlineTo (SkScalar x, SkScalar y)
 
SkPathBuilderquadTo (SkPoint pt1, SkPoint pt2)
 
SkPathBuilderquadTo (SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2)
 
SkPathBuilderquadTo (const SkPoint pts[2])
 
SkPathBuilderconicTo (SkPoint pt1, SkPoint pt2, SkScalar w)
 
SkPathBuilderconicTo (SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2, SkScalar w)
 
SkPathBuilderconicTo (const SkPoint pts[2], SkScalar w)
 
SkPathBuildercubicTo (SkPoint pt1, SkPoint pt2, SkPoint pt3)
 
SkPathBuildercubicTo (SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2, SkScalar x3, SkScalar y3)
 
SkPathBuildercubicTo (const SkPoint pts[3])
 
SkPathBuilderclose ()
 
SkPathBuilderpolylineTo (const SkPoint pts[], int count)
 
SkPathBuilderpolylineTo (const std::initializer_list< SkPoint > &list)
 
SkPathBuilderrLineTo (SkPoint pt)
 
SkPathBuilderrLineTo (SkScalar x, SkScalar y)
 
SkPathBuilderrQuadTo (SkPoint pt1, SkPoint pt2)
 
SkPathBuilderrQuadTo (SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2)
 
SkPathBuilderrConicTo (SkPoint p1, SkPoint p2, SkScalar w)
 
SkPathBuilderrConicTo (SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2, SkScalar w)
 
SkPathBuilderrCubicTo (SkPoint pt1, SkPoint pt2, SkPoint pt3)
 
SkPathBuilderrCubicTo (SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2, SkScalar x3, SkScalar y3)
 
SkPathBuilderarcTo (const SkRect &oval, SkScalar startAngleDeg, SkScalar sweepAngleDeg, bool forceMoveTo)
 Appends arc to the builder. More...
 
SkPathBuilderarcTo (SkPoint p1, SkPoint p2, SkScalar radius)
 Appends arc to SkPath, after appending line if needed. More...
 
SkPathBuilderarcTo (SkPoint r, SkScalar xAxisRotate, ArcSize largeArc, SkPathDirection sweep, SkPoint xy)
 Appends arc to SkPath. More...
 
SkPathBuilderaddArc (const SkRect &oval, SkScalar startAngleDeg, SkScalar sweepAngleDeg)
 Appends arc to the builder, as the start of new contour. More...
 
SkPathBuilderaddRect (const SkRect &, SkPathDirection, unsigned startIndex)
 
SkPathBuilderaddOval (const SkRect &, SkPathDirection, unsigned startIndex)
 
SkPathBuilderaddRRect (const SkRRect &, SkPathDirection, unsigned startIndex)
 
SkPathBuilderaddRect (const SkRect &rect, SkPathDirection dir=SkPathDirection::kCW)
 
SkPathBuilderaddOval (const SkRect &rect, SkPathDirection dir=SkPathDirection::kCW)
 
SkPathBuilderaddRRect (const SkRRect &rrect, SkPathDirection dir=SkPathDirection::kCW)
 
SkPathBuilderaddCircle (SkScalar center_x, SkScalar center_y, SkScalar radius, SkPathDirection dir=SkPathDirection::kCW)
 
SkPathBuilderaddPolygon (const SkPoint pts[], int count, bool isClosed)
 
SkPathBuilderaddPolygon (const std::initializer_list< SkPoint > &list, bool isClosed)
 
SkPathBuilderaddPath (const SkPath &)
 
void incReserve (int extraPtCount, int extraVerbCount)
 
void incReserve (int extraPtCount)
 
SkPathBuilderoffset (SkScalar dx, SkScalar dy)
 
SkPathBuildertoggleInverseFillType ()
 

Friends

class SkPathPriv
 

Member Enumeration Documentation

◆ ArcSize

Enumerator
kSmall_ArcSize 

smaller of arc pair

kLarge_ArcSize 

larger of arc pair

Constructor & Destructor Documentation

◆ SkPathBuilder() [1/4]

SkPathBuilder::SkPathBuilder ( )

◆ SkPathBuilder() [2/4]

SkPathBuilder::SkPathBuilder ( SkPathFillType  )

◆ SkPathBuilder() [3/4]

SkPathBuilder::SkPathBuilder ( const SkPath )

◆ SkPathBuilder() [4/4]

SkPathBuilder::SkPathBuilder ( const SkPathBuilder )
default

◆ ~SkPathBuilder()

SkPathBuilder::~SkPathBuilder ( )

Member Function Documentation

◆ addArc()

SkPathBuilder& SkPathBuilder::addArc ( const SkRect oval,
SkScalar  startAngleDeg,
SkScalar  sweepAngleDeg 
)

Appends arc to the builder, as the start of new contour.

Arc added is part of ellipse bounded by oval, from startAngle through sweepAngle. Both startAngle and sweepAngle are measured in degrees, where zero degrees is aligned with the positive x-axis, and positive sweeps extends arc clockwise.

If sweepAngle <= -360, or sweepAngle >= 360; and startAngle modulo 90 is nearly zero, append oval instead of arc. Otherwise, sweepAngle values are treated modulo 360, and arc may or may not draw depending on numeric rounding.

Parameters
ovalbounds of ellipse containing arc
startAngleDegstarting angle of arc in degrees
sweepAngleDegsweep, in degrees. Positive is clockwise; treated modulo 360
Returns
reference to this builder

◆ addCircle()

SkPathBuilder& SkPathBuilder::addCircle ( SkScalar  center_x,
SkScalar  center_y,
SkScalar  radius,
SkPathDirection  dir = SkPathDirection::kCW 
)

◆ addOval() [1/2]

SkPathBuilder& SkPathBuilder::addOval ( const SkRect ,
SkPathDirection  ,
unsigned  startIndex 
)

◆ addOval() [2/2]

SkPathBuilder& SkPathBuilder::addOval ( const SkRect rect,
SkPathDirection  dir = SkPathDirection::kCW 
)
inline

◆ addPath()

SkPathBuilder& SkPathBuilder::addPath ( const SkPath )

◆ addPolygon() [1/2]

SkPathBuilder& SkPathBuilder::addPolygon ( const SkPoint  pts[],
int  count,
bool  isClosed 
)

◆ addPolygon() [2/2]

SkPathBuilder& SkPathBuilder::addPolygon ( const std::initializer_list< SkPoint > &  list,
bool  isClosed 
)
inline

◆ addRect() [1/2]

SkPathBuilder& SkPathBuilder::addRect ( const SkRect ,
SkPathDirection  ,
unsigned  startIndex 
)

◆ addRect() [2/2]

SkPathBuilder& SkPathBuilder::addRect ( const SkRect rect,
SkPathDirection  dir = SkPathDirection::kCW 
)
inline

◆ addRRect() [1/2]

SkPathBuilder& SkPathBuilder::addRRect ( const SkRRect ,
SkPathDirection  ,
unsigned  startIndex 
)

◆ addRRect() [2/2]

SkPathBuilder& SkPathBuilder::addRRect ( const SkRRect rrect,
SkPathDirection  dir = SkPathDirection::kCW 
)
inline

◆ arcTo() [1/3]

SkPathBuilder& SkPathBuilder::arcTo ( const SkRect oval,
SkScalar  startAngleDeg,
SkScalar  sweepAngleDeg,
bool  forceMoveTo 
)

Appends arc to the builder.

Arc added is part of ellipse bounded by oval, from startAngle through sweepAngle. Both startAngle and sweepAngle are measured in degrees, where zero degrees is aligned with the positive x-axis, and positive sweeps extends arc clockwise.

arcTo() adds line connecting the builder's last point to initial arc point if forceMoveTo is false and the builder is not empty. Otherwise, added contour begins with first point of arc. Angles greater than -360 and less than 360 are treated modulo 360.

Parameters
ovalbounds of ellipse containing arc
startAngleDegstarting angle of arc in degrees
sweepAngleDegsweep, in degrees. Positive is clockwise; treated modulo 360
forceMoveTotrue to start a new contour with arc
Returns
reference to the builder

◆ arcTo() [2/3]

SkPathBuilder& SkPathBuilder::arcTo ( SkPoint  p1,
SkPoint  p2,
SkScalar  radius 
)

Appends arc to SkPath, after appending line if needed.

Arc is implemented by conic weighted to describe part of circle. Arc is contained by tangent from last SkPath point to p1, and tangent from p1 to p2. Arc is part of circle sized to radius, positioned so it touches both tangent lines.

If last SkPath SkPoint does not start arc, arcTo() appends connecting line to SkPath. The length of vector from p1 to p2 does not affect arc.

Arc sweep is always less than 180 degrees. If radius is zero, or if tangents are nearly parallel, arcTo() appends line from last SkPath SkPoint to p1.

arcTo() appends at most one line and one conic. arcTo() implements the functionality of PostScript arct and HTML Canvas arcTo.

Parameters
p1SkPoint common to pair of tangents
p2end of second tangent
radiusdistance from arc to circle center
Returns
reference to SkPath

◆ arcTo() [3/3]

SkPathBuilder& SkPathBuilder::arcTo ( SkPoint  r,
SkScalar  xAxisRotate,
ArcSize  largeArc,
SkPathDirection  sweep,
SkPoint  xy 
)

Appends arc to SkPath.

Arc is implemented by one or more conic weighted to describe part of oval with radii (r.fX, r.fY) rotated by xAxisRotate degrees. Arc curves from last SkPath SkPoint to (xy.fX, xy.fY), choosing one of four possible routes: clockwise or counterclockwise, and smaller or larger.

Arc sweep is always less than 360 degrees. arcTo() appends line to xy if either radii are zero, or if last SkPath SkPoint equals (xy.fX, xy.fY). arcTo() scales radii r to fit last SkPath SkPoint and xy if both are greater than zero but too small to describe an arc.

arcTo() appends up to four conic curves. arcTo() implements the functionality of SVG arc, although SVG sweep-flag value is opposite the integer value of sweep; SVG sweep-flag uses 1 for clockwise, while kCW_Direction cast to int is zero.

Parameters
rradii on axes before x-axis rotation
xAxisRotatex-axis rotation in degrees; positive values are clockwise
largeArcchooses smaller or larger arc
sweepchooses clockwise or counterclockwise arc
xyend of arc
Returns
reference to SkPath

◆ close()

SkPathBuilder& SkPathBuilder::close ( )

◆ computeBounds()

SkRect SkPathBuilder::computeBounds ( ) const

◆ conicTo() [1/3]

SkPathBuilder& SkPathBuilder::conicTo ( const SkPoint  pts[2],
SkScalar  w 
)
inline

◆ conicTo() [2/3]

SkPathBuilder& SkPathBuilder::conicTo ( SkPoint  pt1,
SkPoint  pt2,
SkScalar  w 
)

◆ conicTo() [3/3]

SkPathBuilder& SkPathBuilder::conicTo ( SkScalar  x1,
SkScalar  y1,
SkScalar  x2,
SkScalar  y2,
SkScalar  w 
)
inline

◆ cubicTo() [1/3]

SkPathBuilder& SkPathBuilder::cubicTo ( const SkPoint  pts[3])
inline

◆ cubicTo() [2/3]

SkPathBuilder& SkPathBuilder::cubicTo ( SkPoint  pt1,
SkPoint  pt2,
SkPoint  pt3 
)

◆ cubicTo() [3/3]

SkPathBuilder& SkPathBuilder::cubicTo ( SkScalar  x1,
SkScalar  y1,
SkScalar  x2,
SkScalar  y2,
SkScalar  x3,
SkScalar  y3 
)
inline

◆ detach()

SkPath SkPathBuilder::detach ( )

◆ fillType()

SkPathFillType SkPathBuilder::fillType ( ) const
inline

◆ incReserve() [1/2]

void SkPathBuilder::incReserve ( int  extraPtCount)
inline

◆ incReserve() [2/2]

void SkPathBuilder::incReserve ( int  extraPtCount,
int  extraVerbCount 
)

◆ lineTo() [1/2]

SkPathBuilder& SkPathBuilder::lineTo ( SkPoint  pt)

◆ lineTo() [2/2]

SkPathBuilder& SkPathBuilder::lineTo ( SkScalar  x,
SkScalar  y 
)
inline

◆ moveTo() [1/2]

SkPathBuilder& SkPathBuilder::moveTo ( SkPoint  pt)

◆ moveTo() [2/2]

SkPathBuilder& SkPathBuilder::moveTo ( SkScalar  x,
SkScalar  y 
)
inline

◆ offset()

SkPathBuilder& SkPathBuilder::offset ( SkScalar  dx,
SkScalar  dy 
)

◆ operator=() [1/2]

SkPathBuilder& SkPathBuilder::operator= ( const SkPath )

◆ operator=() [2/2]

SkPathBuilder& SkPathBuilder::operator= ( const SkPathBuilder )
default

◆ polylineTo() [1/2]

SkPathBuilder& SkPathBuilder::polylineTo ( const SkPoint  pts[],
int  count 
)

◆ polylineTo() [2/2]

SkPathBuilder& SkPathBuilder::polylineTo ( const std::initializer_list< SkPoint > &  list)
inline

◆ quadTo() [1/3]

SkPathBuilder& SkPathBuilder::quadTo ( const SkPoint  pts[2])
inline

◆ quadTo() [2/3]

SkPathBuilder& SkPathBuilder::quadTo ( SkPoint  pt1,
SkPoint  pt2 
)

◆ quadTo() [3/3]

SkPathBuilder& SkPathBuilder::quadTo ( SkScalar  x1,
SkScalar  y1,
SkScalar  x2,
SkScalar  y2 
)
inline

◆ rConicTo() [1/2]

SkPathBuilder& SkPathBuilder::rConicTo ( SkPoint  p1,
SkPoint  p2,
SkScalar  w 
)

◆ rConicTo() [2/2]

SkPathBuilder& SkPathBuilder::rConicTo ( SkScalar  x1,
SkScalar  y1,
SkScalar  x2,
SkScalar  y2,
SkScalar  w 
)
inline

◆ rCubicTo() [1/2]

SkPathBuilder& SkPathBuilder::rCubicTo ( SkPoint  pt1,
SkPoint  pt2,
SkPoint  pt3 
)

◆ rCubicTo() [2/2]

SkPathBuilder& SkPathBuilder::rCubicTo ( SkScalar  x1,
SkScalar  y1,
SkScalar  x2,
SkScalar  y2,
SkScalar  x3,
SkScalar  y3 
)
inline

◆ reset()

SkPathBuilder& SkPathBuilder::reset ( )

◆ rLineTo() [1/2]

SkPathBuilder& SkPathBuilder::rLineTo ( SkPoint  pt)

◆ rLineTo() [2/2]

SkPathBuilder& SkPathBuilder::rLineTo ( SkScalar  x,
SkScalar  y 
)
inline

◆ rQuadTo() [1/2]

SkPathBuilder& SkPathBuilder::rQuadTo ( SkPoint  pt1,
SkPoint  pt2 
)

◆ rQuadTo() [2/2]

SkPathBuilder& SkPathBuilder::rQuadTo ( SkScalar  x1,
SkScalar  y1,
SkScalar  x2,
SkScalar  y2 
)
inline

◆ setFillType()

SkPathBuilder& SkPathBuilder::setFillType ( SkPathFillType  ft)
inline

◆ setIsVolatile()

SkPathBuilder& SkPathBuilder::setIsVolatile ( bool  isVolatile)
inline

◆ snapshot()

SkPath SkPathBuilder::snapshot ( ) const

◆ toggleInverseFillType()

SkPathBuilder& SkPathBuilder::toggleInverseFillType ( )
inline

Friends And Related Function Documentation

◆ SkPathPriv

friend class SkPathPriv
friend

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