public class RMPath
extends Shape
implements java.lang.Cloneable
Modifier and Type | Class and Description |
---|---|
static class |
RMPath.RMPathIter
A PathIter for Path.
|
Modifier and Type | Field and Description |
---|---|
static byte |
CLOSE |
static byte |
CURVE_TO |
static byte |
LINE_TO |
static byte |
MOVE_TO |
static byte |
QUAD_TO |
static byte |
WIND_EVEN_ODD |
static byte |
WIND_NON_ZERO |
Constructor and Description |
---|
RMPath()
Creates an empty path.
|
RMPath(PathIter aPI)
Creates a path for the given path iterator.
|
RMPath(Shape aShape)
Creates a path for the given shape.
|
Modifier and Type | Method and Description |
---|---|
void |
addSegment(RMLine aSegment)
Adds the list of segments to the path, starting with a moveto.
|
void |
addSegments(java.util.List<? extends RMLine> theSegments)
Adds the list of segments to the path, starting with a moveto.
|
void |
appendPathIter(PathIter aPI)
Returns a new path from a PathIter.
|
void |
appendShape(Shape aShape)
Returns a new path from a shape.
|
RMPath |
clone()
Standard clone implementation.
|
void |
closePath()
Adds a Close element to the given path.
|
boolean |
contains(double x,
double y)
Returns whether the given xy coordinate is inside the path.
|
void |
curveTo(double cp1x,
double cp1y,
double cp2x,
double cp2y,
double px,
double py)
Adds a CurveTo element to the path for the given point and control points.
|
void |
curveTo(Point cp1,
Point cp2,
Point p)
Adds a CurveTo element to the path for the given point and control points.
|
boolean |
equals(java.lang.Object anObj)
Standard equals implementation.
|
java.lang.Object |
fromXML(XMLArchiver anArchiver,
XMLElement anElement)
XML unarchival.
|
Rect |
getBounds()
Returns the bounds for the path.
|
byte |
getElmt(int anIndex)
Returns the element type at the given index.
|
int |
getElmtCount()
Returns the number of elements in this path.
|
int |
getElmtIndexForPointIndex(int index)
Returns the element index for the given point index.
|
byte |
getElmtLast()
Returns the last element.
|
int |
getElmtPointIndex(int anIndex)
Returns the point index for a given element.
|
RMHitInfo |
getHitInfo(RMBezier aBezier,
boolean findFirstHit)
Returns the hit info for the given bezier curve against this path.
|
RMHitInfo |
getHitInfo(RMLine aLine,
boolean findFirstHit)
Returns the hit info for the given line against this path.
|
RMPath |
getPathFlattened()
Returns a path with only moveto, lineto.
|
RMPath |
getPathInRect(Rect aRect)
Returns a copy of the path scaled to exactly fit in the given rect.
|
RMPath.RMPathIter |
getPathIter(Transform aTrans)
Returns a PathIter for RMPath.
|
Point |
getPoint(int anIndex)
Returns the point at the given index.
|
int |
getPointCount()
Returns the number of points in the path.
|
Point |
getPointLast()
Returns the last point in the path.
|
java.util.List<? extends RMLine> |
getSegments()
Converts a path into a list of RMLine/RMQuadratic/RMBezier.
|
java.util.List<java.util.List<? extends RMLine>> |
getSubpathsSegments()
Converts a path into a list subpath lists of RMLine/RMQuadratic/RMBezier.
|
byte |
getWindingRule()
Returns the winding rule which describes how inner path perimeters are filled and clipped.
|
int |
handleAtPointForBounds(Point aPoint,
Rect aRect,
int selectedPoint,
Size handleSize)
Returns the handle index for a given point against this path scaled to the given rect.
|
boolean |
intersects(RMLine aLine)
Returns whether path is hit by a line.
|
boolean |
intersects(RMPath aPath,
float lineWidth)
Returns whether path drawn with given linewidth is hit by given path.
|
boolean |
isClosed()
Returns whether path has any open subpaths.
|
void |
lineTo(double px,
double py)
Adds a LineTo element to the path for the given point.
|
void |
lineTo(Point p)
Adds a LineTo element to the path for the given point.
|
void |
moveTo(double px,
double py)
Adds a MoveTo element to the path for the given point.
|
void |
moveTo(Point p)
Adds a MoveTo element to the path for the given point.
|
int |
pointCountForElmt(int element)
Returns the total number of points associated with a given type of path element.
|
Point |
pointInPathCoordsFromPoint(Point aPoint,
Rect aRect)
Returns the given point converted to path coords for given path bounds.
|
boolean |
pointOnPath(int pointIndex)
Returns true of the point at pointIndex is on the path, and false if it is on the convex hull.
|
void |
quadTo(double cpx,
double cpy,
double px,
double py)
Adds a QuadTo element to the path for the given point and control point.
|
void |
quadTo(Point cp,
Point p)
Adds a QuadTo element to the path for the given point and control point.
|
void |
removeElmt(int elmtIndex)
Removes an element, reconnecting the elements on either side of the deleted element.
|
void |
removeLastElmt()
Removes the last element from the path.
|
void |
reset()
Resets the current path with no elements or points.
|
void |
setPoint(int index,
double px,
double py)
Sets the path point at the given index to the given point.
|
void |
setPointStructured(int index,
Point point)
Resets the point at the given index to the given point, while preserving something.
|
void |
setWindingRule(byte windingRule)
Sets the winding rule which describes how inner path perimeters are filled and clipped.
|
XMLElement |
toXML(XMLArchiver anArchiver)
XML archival.
|
void |
transformBy(Transform aTrans)
Transforms the points in the path by the given transform.
|
public static final byte WIND_NON_ZERO
public static final byte WIND_EVEN_ODD
public static final byte MOVE_TO
public static final byte LINE_TO
public static final byte QUAD_TO
public static final byte CURVE_TO
public static final byte CLOSE
public RMPath()
public RMPath(Shape aShape)
public RMPath(PathIter aPI)
public void moveTo(Point p)
public void moveTo(double px, double py)
public void lineTo(Point p)
public void lineTo(double px, double py)
public void quadTo(Point cp, Point p)
public void quadTo(double cpx, double cpy, double px, double py)
public void curveTo(Point cp1, Point cp2, Point p)
public void curveTo(double cp1x, double cp1y, double cp2x, double cp2y, double px, double py)
public void closePath()
public void reset()
public void appendShape(Shape aShape)
public void appendPathIter(PathIter aPI)
public byte getWindingRule()
public void setWindingRule(byte windingRule)
public int getElmtCount()
public byte getElmt(int anIndex)
public byte getElmtLast()
public int getPointCount()
public Point getPoint(int anIndex)
public Point getPointLast()
public Rect getBounds()
public RMPath.RMPathIter getPathIter(Transform aTrans)
public int getElmtPointIndex(int anIndex)
public int getElmtIndexForPointIndex(int index)
public int pointCountForElmt(int element)
public boolean pointOnPath(int pointIndex)
public boolean isClosed()
public RMPath getPathInRect(Rect aRect)
public boolean contains(double x, double y)
public boolean intersects(RMLine aLine)
public boolean intersects(RMPath aPath, float lineWidth)
public RMHitInfo getHitInfo(RMLine aLine, boolean findFirstHit)
public java.util.List<? extends RMLine> getSegments()
public java.util.List<java.util.List<? extends RMLine>> getSubpathsSegments()
public void addSegments(java.util.List<? extends RMLine> theSegments)
public void addSegment(RMLine aSegment)
public RMHitInfo getHitInfo(RMBezier aBezier, boolean findFirstHit)
public int handleAtPointForBounds(Point aPoint, Rect aRect, int selectedPoint, Size handleSize)
public Point pointInPathCoordsFromPoint(Point aPoint, Rect aRect)
public void removeLastElmt()
public void removeElmt(int elmtIndex)
public void setPoint(int index, double px, double py)
public void setPointStructured(int index, Point point)
public RMPath getPathFlattened()
public void transformBy(Transform aTrans)
public boolean equals(java.lang.Object anObj)
public RMPath clone()
public XMLElement toXML(XMLArchiver anArchiver)
public java.lang.Object fromXML(XMLArchiver anArchiver, XMLElement anElement)