#include <SkPath.h>
Classes | |
class | Iter |
Public Types | |
enum | FillType { kWinding_FillType, kEvenOdd_FillType, kInverseWinding_FillType, kInverseEvenOdd_FillType } |
enum | Direction { kCW_Direction, kCCW_Direction } |
enum | Verb { kMove_Verb, kLine_Verb, kQuad_Verb, kCubic_Verb, kClose_Verb, kDone_Verb } |
Public Member Functions | |
SkPath () | |
SkPath (const SkPath &) | |
~SkPath () | |
SkPath & | operator= (const SkPath &) |
FillType | getFillType () const |
void | setFillType (FillType ft) |
bool | isInverseFillType () const |
void | toggleInverseFillType () |
bool | isConvex () const |
void | setIsConvex (bool isConvex) |
void | reset () |
void | rewind () |
bool | isEmpty () const |
bool | isRect (SkRect *rect) const |
int | getPoints (SkPoint points[], int max) const |
void | swap (SkPath &other) |
Swap contents of this and other. Guaranteed not to throw. | |
const SkRect & | getBounds () const |
void | updateBoundsCache () const |
void | incReserve (unsigned extraPtCount) |
void | moveTo (SkScalar x, SkScalar y) |
void | moveTo (const SkPoint &p) |
void | rMoveTo (SkScalar dx, SkScalar dy) |
void | lineTo (SkScalar x, SkScalar y) |
void | lineTo (const SkPoint &p) |
void | rLineTo (SkScalar dx, SkScalar dy) |
void | quadTo (SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2) |
void | quadTo (const SkPoint &p1, const SkPoint &p2) |
void | rQuadTo (SkScalar dx1, SkScalar dy1, SkScalar dx2, SkScalar dy2) |
void | cubicTo (SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2, SkScalar x3, SkScalar y3) |
void | cubicTo (const SkPoint &p1, const SkPoint &p2, const SkPoint &p3) |
void | rCubicTo (SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2, SkScalar x3, SkScalar y3) |
void | arcTo (const SkRect &oval, SkScalar startAngle, SkScalar sweepAngle, bool forceMoveTo) |
void | arcTo (SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2, SkScalar radius) |
void | arcTo (const SkPoint p1, const SkPoint p2, SkScalar radius) |
void | close () |
void | addRect (const SkRect &rect, Direction dir=kCW_Direction) |
void | addRect (SkScalar left, SkScalar top, SkScalar right, SkScalar bottom, Direction dir=kCW_Direction) |
void | addOval (const SkRect &oval, Direction dir=kCW_Direction) |
void | addCircle (SkScalar x, SkScalar y, SkScalar radius, Direction dir=kCW_Direction) |
void | addArc (const SkRect &oval, SkScalar startAngle, SkScalar sweepAngle) |
void | addRoundRect (const SkRect &rect, SkScalar rx, SkScalar ry, Direction dir=kCW_Direction) |
void | addRoundRect (const SkRect &rect, const SkScalar radii[], Direction dir=kCW_Direction) |
void | addPath (const SkPath &src, SkScalar dx, SkScalar dy) |
void | addPath (const SkPath &src) |
void | addPath (const SkPath &src, const SkMatrix &matrix) |
void | offset (SkScalar dx, SkScalar dy, SkPath *dst) const |
void | offset (SkScalar dx, SkScalar dy) |
void | transform (const SkMatrix &matrix, SkPath *dst) const |
void | transform (const SkMatrix &matrix) |
void | getLastPt (SkPoint *lastPt) const |
void | setLastPt (SkScalar x, SkScalar y) |
void | setLastPt (const SkPoint &p) |
void | flatten (SkFlattenableWriteBuffer &) const |
void | unflatten (SkFlattenableReadBuffer &) |
void | subdivide (SkScalar dist, bool bendLines, SkPath *dst=NULL) const |
void | computeBounds () const |
void | cons_moveto () |
void | pathTo (const SkPath &path) |
void | reversePathTo (const SkPath &) |
Public Attributes | |
SkDEBUGCODE(void validate() const ;) private SkTDArray < uint8_t > | fVerbs |
SkRect | fBounds |
uint8_t | fBoundsIsDirty |
uint8_t | fFillType |
uint8_t | fIsConvex |
Friends | |
class | Iter |
class | SkPathStroker |
class | SkAutoPathBoundsUpdate |
bool | operator== (const SkPath &, const SkPath &) |
bool | operator!= (const SkPath &a, const SkPath &b) |
const SkPoint * | sk_get_path_points (const SkPath &, int index) |
The SkPath class encapsulates compound (multiple contour) geometric paths consisting of straight line segments, quadratic curves, and cubic curves.
Definition at line 33 of file SkPath.h.
enum SkPath::Direction |
enum SkPath::FillType |
enum SkPath::Verb |
SkPath::SkPath | ( | ) |
SkPath::SkPath | ( | const SkPath & | ) |
SkPath::~SkPath | ( | ) |
Add the specified arc to the path as a new contour.
oval | The bounds of oval used to define the size of the arc | |
startAngle | Starting angle (in degrees) where the arc begins | |
sweepAngle | Sweep angle (in degrees) measured clockwise |
Add a closed circle contour to the path
x | The x-coordinate of the center of a circle to add as a closed contour to the path | |
y | The y-coordinate of the center of a circle to add as a closed contour to the path | |
radius | The radius of a circle to add as a closed contour to the path | |
dir | The direction to wind the circle's contour |
Add a closed oval contour to the path
oval | The bounding oval to add as a closed contour to the path | |
dir | The direction to wind the oval's contour |
Add a copy of src to the path, transformed by matrix
src | The path to add as a new contour |
void SkPath::addPath | ( | const SkPath & | src | ) | [inline] |
Add a copy of src to the path, offset by (dx,dy)
src | The path to add as a new contour | |
dx | The amount to translate the path in X as it is added | |
dx | The amount to translate the path in Y as it is added |
void SkPath::addRect | ( | SkScalar | left, | |
SkScalar | top, | |||
SkScalar | right, | |||
SkScalar | bottom, | |||
Direction | dir = kCW_Direction | |||
) |
Add a closed rectangle contour to the path
left | The left side of a rectangle to add as a closed contour to the path | |
top | The top of a rectangle to add as a closed contour to the path | |
right | The right side of a rectangle to add as a closed contour to the path | |
bottom | The bottom of a rectangle to add as a closed contour to the path | |
dir | The direction to wind the rectangle's contour |
Add a closed rectangle contour to the path
rect | The rectangle to add as a closed contour to the path | |
dir | The direction to wind the rectangle's contour |
void SkPath::addRoundRect | ( | const SkRect & | rect, | |
const SkScalar | radii[], | |||
Direction | dir = kCW_Direction | |||
) |
Add a closed round-rectangle contour to the path. Each corner receives two radius values [X, Y]. The corners are ordered top-left, top-right, bottom-right, bottom-left.
rect | The bounds of a round-rectangle to add as a closed contour | |
radii | Array of 8 scalars, 4 [X,Y] pairs for each corner | |
dir | The direction to wind the round-rectangle's contour |
void SkPath::addRoundRect | ( | const SkRect & | rect, | |
SkScalar | rx, | |||
SkScalar | ry, | |||
Direction | dir = kCW_Direction | |||
) |
Add a closed round-rectangle contour to the path
rect | The bounds of a round-rectangle to add as a closed contour | |
rx | The x-radius of the rounded corners on the round-rectangle | |
ry | The y-radius of the rounded corners on the round-rectangle | |
dir | The direction to wind the round-rectangle's contour |
Append a line and arc to the current path. This is the same as the PostScript call "arct".
void SkPath::arcTo | ( | const SkRect & | oval, | |
SkScalar | startAngle, | |||
SkScalar | sweepAngle, | |||
bool | forceMoveTo | |||
) |
Append the specified arc to the path as a new contour. If the start of the path is different from the path's current last point, then an automatic lineTo() is added to connect the current contour to the start of the arc. However, if the path is empty, then we call moveTo() with the first point of the arc. The sweep angle is treated mod 360.
oval | The bounding oval defining the shape and size of the arc | |
startAngle | Starting angle (in degrees) where the arc begins | |
sweepAngle | Sweep angle (in degrees) measured clockwise. This is treated mod 360. | |
forceMoveTo | If true, always begin a new contour with the arc |
void SkPath::close | ( | ) |
Close the current contour. If the current point is not equal to the first point of the contour, a line segment is automatically added.
void SkPath::computeBounds | ( | ) | const |
void SkPath::cons_moveto | ( | ) |
Add a cubic bezier from the last point, approaching control points p1 and p2, and ending at p3. If no moveTo() call has been made for this contour, the first point is automatically set to (0,0).
p1 | The 1st control point on a cubic curve | |
p2 | The 2nd control point on a cubic curve | |
p3 | The end point on a cubic curve |
void SkPath::cubicTo | ( | SkScalar | x1, | |
SkScalar | y1, | |||
SkScalar | x2, | |||
SkScalar | y2, | |||
SkScalar | x3, | |||
SkScalar | y3 | |||
) |
Add a cubic bezier from the last point, approaching control points (x1,y1) and (x2,y2), and ending at (x3,y3). If no moveTo() call has been made for this contour, the first point is automatically set to (0,0).
x1 | The x-coordinate of the 1st control point on a cubic curve | |
y1 | The y-coordinate of the 1st control point on a cubic curve | |
x2 | The x-coordinate of the 2nd control point on a cubic curve | |
y2 | The y-coordinate of the 2nd control point on a cubic curve | |
x3 | The x-coordinate of the end point on a cubic curve | |
y3 | The y-coordinate of the end point on a cubic curve |
void SkPath::flatten | ( | SkFlattenableWriteBuffer & | ) | const |
const SkRect& SkPath::getBounds | ( | ) | const [inline] |
FillType SkPath::getFillType | ( | ) | const [inline] |
void SkPath::getLastPt | ( | SkPoint * | lastPt | ) | const |
Return the last point on the path. If no points have been added, (0,0) is returned.
lastPt | The last point on the path is returned here |
int SkPath::getPoints | ( | SkPoint | points[], | |
int | max | |||
) | const |
Returns the number of points in the path. Up to max points are copied.
points | If not null, receives up to max points | |
max | The maximum number of points to copy into points |
void SkPath::incReserve | ( | unsigned | extraPtCount | ) |
Hint to the path to prepare for adding more points. This can allow the path to more efficiently grow its storage.
extraPtCount | The number of extra points the path should preallocate for. |
bool SkPath::isConvex | ( | ) | const [inline] |
bool SkPath::isEmpty | ( | ) | const |
Returns true if the path is empty (contains no lines or curves)
bool SkPath::isInverseFillType | ( | ) | const [inline] |
bool SkPath::isRect | ( | SkRect * | rect | ) | const |
Returns true if the path specifies a rectangle. If so, and if rect is not null, set rect to the bounds of the path. If the path does not specify a rectangle, return false and ignore rect.
rect | If not null, returns the bounds of the path if it specifies a rectangle |
void SkPath::lineTo | ( | const SkPoint & | p | ) | [inline] |
Add a line from the last point to the specified point (x,y). If no moveTo() call has been made for this contour, the first point is automatically set to (0,0).
x | The x-coordinate of the end of a line | |
y | The y-coordinate of the end of a line |
void SkPath::moveTo | ( | const SkPoint & | p | ) | [inline] |
Set the beginning of the next contour to the point (x,y).
x | The x-coordinate of the start of a new contour | |
y | The y-coordinate of the start of a new contour |
Offset the path by (dx,dy), returning true on success
dx | The amount in the X direction to offset the entire path | |
dy | The amount in the Y direction to offset the entire path | |
dst | The translated path is written here |
void SkPath::pathTo | ( | const SkPath & | path | ) |
Add a quadratic bezier from the last point, approaching control point p1, and ending at p2. If no moveTo() call has been made for this contour, the first point is automatically set to (0,0).
p1 | The control point on a quadratic curve | |
p2 | The end point on a quadratic curve |
Add a quadratic bezier from the last point, approaching control point (x1,y1), and ending at (x2,y2). If no moveTo() call has been made for this contour, the first point is automatically set to (0,0).
x1 | The x-coordinate of the control point on a quadratic curve | |
y1 | The y-coordinate of the control point on a quadratic curve | |
x2 | The x-coordinate of the end point on a quadratic curve | |
y2 | The y-coordinate of the end point on a quadratic curve |
void SkPath::rCubicTo | ( | SkScalar | x1, | |
SkScalar | y1, | |||
SkScalar | x2, | |||
SkScalar | y2, | |||
SkScalar | x3, | |||
SkScalar | y3 | |||
) |
Same as cubicTo, but the coordinates are considered relative to the current point on this contour. If there is no previous point, then a moveTo(0,0) is inserted automatically.
dx1 | The amount to add to the x-coordinate of the last point on this contour, to specify the 1st control point of a cubic curve | |
dy1 | The amount to add to the y-coordinate of the last point on this contour, to specify the 1st control point of a cubic curve | |
dx2 | The amount to add to the x-coordinate of the last point on this contour, to specify the 2nd control point of a cubic curve | |
dy2 | The amount to add to the y-coordinate of the last point on this contour, to specify the 2nd control point of a cubic curve | |
dx3 | The amount to add to the x-coordinate of the last point on this contour, to specify the end point of a cubic curve | |
dy3 | The amount to add to the y-coordinate of the last point on this contour, to specify the end point of a cubic curve |
void SkPath::reset | ( | ) |
Clear any lines and curves from the path, making it empty. This frees up internal storage associated with those segments. This does NOT change the fill-type setting nor isConvex
void SkPath::reversePathTo | ( | const SkPath & | ) |
void SkPath::rewind | ( | ) |
Similar to reset(), in that all lines and curves are removed from the path. However, any internal storage for those lines/curves is retained, making reuse of the path potentially faster. This does NOT change the fill-type setting nor isConvex
Same as lineTo, but the coordinates are considered relative to the last point on this contour. If there is no previous point, then a moveTo(0,0) is inserted automatically.
dx | The amount to add to the x-coordinate of the previous point on this contour, to specify a line | |
dy | The amount to add to the y-coordinate of the previous point on this contour, to specify a line |
Set the beginning of the next contour relative to the last point on the previous contour. If there is no previous contour, this is treated the same as moveTo().
dx | The amount to add to the x-coordinate of the end of the previous contour, to specify the start of a new contour | |
dy | The amount to add to the y-coordinate of the end of the previous contour, to specify the start of a new contour |
Same as quadTo, but the coordinates are considered relative to the last point on this contour. If there is no previous point, then a moveTo(0,0) is inserted automatically.
dx1 | The amount to add to the x-coordinate of the last point on this contour, to specify the control point of a quadratic curve | |
dy1 | The amount to add to the y-coordinate of the last point on this contour, to specify the control point of a quadratic curve | |
dx2 | The amount to add to the x-coordinate of the last point on this contour, to specify the end point of a quadratic curve | |
dy2 | The amount to add to the y-coordinate of the last point on this contour, to specify the end point of a quadratic curve |
void SkPath::setFillType | ( | FillType | ft | ) | [inline] |
void SkPath::setIsConvex | ( | bool | isConvex | ) | [inline] |
void SkPath::setLastPt | ( | const SkPoint & | p | ) | [inline] |
Set the last point on the path. If no points have been added, moveTo(x,y) is automatically called.
x | The new x-coordinate for the last point | |
y | The new y-coordinate for the last point |
Subdivide the path so that no segment is longer that dist. If bendLines is true, then turn all line segments into curves. If dst == null, then the original path itself is modified (not const!)
void SkPath::swap | ( | SkPath & | other | ) |
Swap contents of this and other. Guaranteed not to throw.
void SkPath::toggleInverseFillType | ( | ) | [inline] |
Toggle between inverse and normal filltypes. This reverse the return value of isInverseFillType()
void SkPath::transform | ( | const SkMatrix & | matrix | ) | [inline] |
Transform the points in this path by matrix, and write the answer into dst.
matrix | The matrix to apply to the path | |
dst | The transformed path is written here |
void SkPath::unflatten | ( | SkFlattenableReadBuffer & | ) |
void SkPath::updateBoundsCache | ( | ) | const [inline] |
SkRect SkPath::fBounds [mutable] |
uint8_t SkPath::fBoundsIsDirty [mutable] |
uint8_t SkPath::fFillType |
uint8_t SkPath::fIsConvex |
SkDEBUGCODE (void validate() const;) private SkTDArray<uint8_t> SkPath::fVerbs |