Package snap.geom
Class Path2D
java.lang.Object
snap.geom.Shape
snap.geom.ShapeBuilder
snap.geom.Path2D
- All Implemented Interfaces:
Cloneable
- Direct Known Subclasses:
Path2DX
,QuickDrawPen.PenPath
A standard path shape that can be built/modified by standard moveTo/lineTo/curveTo methods.
-
Field Summary
Modifier and TypeFieldDescriptionprotected int
protected double[]
protected int
protected int[]
protected Seg[]
Fields inherited from class snap.geom.Shape
_bounds, WIND_EVEN_ODD, WIND_NON_ZERO
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
addPoint
(double aX, double aY) Adds a point.protected void
Adds a segment.void
clear()
Clears all segments from path.clone()
Standard clone implementation.void
close()
Close.Override to return as path.void
curveTo
(double cp1x, double cp1y, double cp2x, double cp2y, double endX, double endY) CubicTo.boolean
Standard equals implementation.void
fitToCurveFromPointIndex
(int pointIndex) Fits the path points to a curve starting at the given point index.Returns the last point.double
Returns the last point X.double
Returns the last point Y.Returns the last seg.getPathIter
(Transform aTrans) Returns a path iterator.getPoint
(int anIndex) Returns individual point at given index.int
Returns the number of points.getSeg
(int anIndex) Returns the individual segment at given index.getSegAndPointsForIndex
(int anIndex, double[] theCoords, Transform aTrans) Returns the control points and end point for a given seg index, by copying to given array (should be length of 6).int
Returns the number of segments.int
getSegIndexForPointIndex
(int anIndex) Returns the seg index for given point index.int
getSegPointIndex
(int anIndex) Returns the array of point-indexes for given seg index.int
Returns the winding - how a path determines what to fill when segments intersect.void
lineTo
(double aX, double aY) LineTo.void
moveTo
(double aX, double aY) Moveto.void
quadTo
(double cpX, double cpY, double endX, double endY) QuadTo.void
Removes the last segment.void
setPoint
(int anIndex, double aX, double aY) Sets the individual point at given index.void
setWinding
(int aValue) Sets the winding - how a path determines what to fill when segments intersect.Methods inherited from class snap.geom.ShapeBuilder
appendPathIter, appendSegment, appendShape, appendSvgString, arcTo, curveToFlat, hlineTo, lineBy, quadToFlat, vlineTo
Methods inherited from class snap.geom.Shape
addShapes, contains, contains, contains, contains, containsSeg, copyFor, copyForBounds, crossesSeg, getArcLength, getBounds, getBoundsImpl, getCrossings, getDistance, getFlattenedShape, getFlattenedShape, getHeight, getNotSelfIntersectingShape, getSvgString, getWidth, getX, getY, intersectShapes, intersectsSeg, intersectsShape, intersectsShape, intersectsXY, isClosed, isFlat, isMultiCycle, isSelfIntersecting, isSingleCycle, shapeChanged, subtractShapes, toString
-
Field Details
-
_segs
-
_segCount
protected int _segCount -
_points
protected double[] _points -
_pointCount
protected int _pointCount -
_segPointIndexes
protected int[] _segPointIndexes
-
-
Constructor Details
-
Path2D
public Path2D()Constructor. -
Path2D
Constructor with given shape. -
Path2D
Constructor with given PathIter.
-
-
Method Details
-
getSegCount
public int getSegCount()Returns the number of segments. -
getSeg
Returns the individual segment at given index. -
addSeg
Adds a segment. -
getPointCount
public int getPointCount()Returns the number of points. -
getPoint
Returns individual point at given index. -
setPoint
public void setPoint(int anIndex, double aX, double aY) Sets the individual point at given index. -
addPoint
protected void addPoint(double aX, double aY) Adds a point. -
moveTo
public void moveTo(double aX, double aY) Moveto.- Specified by:
moveTo
in classShapeBuilder
-
lineTo
public void lineTo(double aX, double aY) LineTo.- Specified by:
lineTo
in classShapeBuilder
-
quadTo
public void quadTo(double cpX, double cpY, double endX, double endY) QuadTo.- Specified by:
quadTo
in classShapeBuilder
-
curveTo
public void curveTo(double cp1x, double cp1y, double cp2x, double cp2y, double endX, double endY) CubicTo.- Specified by:
curveTo
in classShapeBuilder
-
close
public void close()Close.- Specified by:
close
in classShapeBuilder
-
clear
public void clear()Clears all segments from path. -
getLastSeg
Returns the last seg. -
getLastPoint
Returns the last point. -
getLastPointX
public double getLastPointX()Returns the last point X.- Specified by:
getLastPointX
in classShapeBuilder
-
getLastPointY
public double getLastPointY()Returns the last point Y.- Specified by:
getLastPointY
in classShapeBuilder
-
getSegPointIndex
public int getSegPointIndex(int anIndex) Returns the array of point-indexes for given seg index. -
getSegAndPointsForIndex
Returns the control points and end point for a given seg index, by copying to given array (should be length of 6). -
getSegIndexForPointIndex
public int getSegIndexForPointIndex(int anIndex) Returns the seg index for given point index. -
removeLastSeg
public void removeLastSeg()Removes the last segment. -
getWinding
public int getWinding()Returns the winding - how a path determines what to fill when segments intersect. -
setWinding
public void setWinding(int aValue) Sets the winding - how a path determines what to fill when segments intersect. -
fitToCurveFromPointIndex
public void fitToCurveFromPointIndex(int pointIndex) Fits the path points to a curve starting at the given point index. -
copyFor
Override to return as path. -
clone
Standard clone implementation. -
equals
Standard equals implementation. -
getPathIter
Returns a path iterator.- Specified by:
getPathIter
in classShape
-