|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnodebox.graphics.AbstractTransformable
nodebox.graphics.AbstractGeometry
nodebox.graphics.Path
public class Path
Base class for all geometric (vector) data.
| Field Summary |
|---|
| Fields inherited from interface nodebox.graphics.IGeometry |
|---|
DEFAULT_POINT_AMOUNT |
| Constructor Summary | |
|---|---|
Path()
|
|
Path(Contour c)
|
|
Path(Path other)
|
|
Path(Path other,
boolean cloneContours)
|
|
Path(Shape s)
|
|
| Method Summary | |
|---|---|
void |
add(Contour c)
Add the given contour. |
void |
addPoint(double x,
double y)
Add a new point to the geometry specified by its x and y coordinates. |
void |
addPoint(Point pt)
Add the given point to the geometry. |
Geometry |
asGeometry()
Wrap the current path in a geometry object. |
void |
clear()
|
Path |
clone()
Clone the geometry, returning a new copy that is totally independent from the original. |
Path |
cloneAndClear()
|
void |
close()
|
boolean |
contains(double x,
double y)
|
boolean |
contains(Point p)
|
boolean |
contains(Rect r)
|
Contour |
contourAt(double t)
|
void |
cornerEllipse(double x,
double y,
double width,
double height)
|
void |
cornerRect(double x,
double y,
double width,
double height)
|
void |
cornerRect(double cx,
double cy,
double width,
double height,
double r)
|
void |
cornerRect(double cx,
double cy,
double width,
double height,
double rx,
double ry)
|
void |
cornerRect(Rect r)
|
void |
cornerRect(Rect r,
double roundness)
|
void |
cornerRect(Rect r,
double rx,
double ry)
|
static double |
curveLength(double x0,
double y0,
double x1,
double y1,
double x2,
double y2,
double x3,
double y3)
Returns the length of the spline. |
static double |
curveLength(double x0,
double y0,
double x1,
double y1,
double x2,
double y2,
double x3,
double y3,
int n)
Returns the length of the spline. |
static Point |
curvePoint(double t,
double x0,
double y0,
double x1,
double y1,
double x2,
double y2,
double x3,
double y3)
Returns coordinates for point at t on the spline. |
void |
curveto(double x1,
double y1,
double x2,
double y2,
double x3,
double y3)
|
void |
draw(Graphics2D g)
|
void |
ellipse(double cx,
double cy,
double width,
double height)
Add an ellipse shape to the path. |
void |
extend(Path p)
|
void |
extend(Shape s)
|
static Path |
findPath(List<Point> points)
|
static Path |
findPath(List<Point> points,
double curvature)
|
static Path |
findPath(Point[] points)
|
static Path |
findPath(Point[] points,
double curvature)
Constructs a path between the given list of points. |
void |
flatten()
Flatten the geometry. |
Path |
flattened()
Make a flattened copy of the geometry. |
Rect |
getBounds()
|
List<Contour> |
getContours()
Get the contours of a geometry object. |
Color |
getFill()
|
Color |
getFillColor()
|
GeneralPath |
getGeneralPath()
|
double |
getLength()
Calculate the length of the path. |
int |
getPointCount()
|
List<Point> |
getPoints()
Get the points for this geometry. |
Color |
getStroke()
|
Color |
getStrokeColor()
|
double |
getStrokeWidth()
|
Path |
intersected(Path p)
|
boolean |
intersects(Path p)
|
boolean |
intersects(Rect r)
|
void |
invalidate()
Invalidates the cache. |
boolean |
isClosed()
Check if the last contour on this path is closed. |
boolean |
isEmpty()
|
Iterator<Point> |
iterator()
|
void |
line(double x1,
double y1,
double x2,
double y2)
|
static double |
lineLength(double x0,
double y0,
double x1,
double y1)
Returns the length of the line. |
static Point |
linePoint(double t,
double x0,
double y0,
double x1,
double y1)
Returns coordinates for point at t on the line. |
void |
lineto(double x,
double y)
|
Point[] |
makePoints(int amount,
boolean perContour)
Make new points along the contours of the existing path. |
AbstractGeometry |
mapPoints(com.google.common.base.Function<Point,Point> pointFunction)
Change all points in the geometry and return a mutated copy. |
void |
moveto(double x,
double y)
|
void |
newContour()
Start a new contour without closing the current contour first. |
Point |
point(double t)
Same as pointAt(t). |
Point |
pointAt(double t)
Returns coordinates for point at t on the path. |
void |
rect(double cx,
double cy,
double width,
double height)
Add a rectangle shape to the path. |
void |
rect(double cx,
double cy,
double width,
double height,
double r)
|
void |
rect(double cx,
double cy,
double width,
double height,
double rx,
double ry)
|
void |
rect(Rect r)
|
void |
rect(Rect r,
double roundness)
|
void |
rect(Rect r,
double rx,
double ry)
|
Path |
resampleByAmount(int amount,
boolean perContour)
Generate new geometry with the given amount of points along the shape of the original geometry. |
Path |
resampleByLength(double segmentLength)
Generate new geometry with points along the shape of the original geometry, spaced at the given length. |
void |
roundedRect(double cx,
double cy,
double width,
double height,
double r)
|
void |
roundedRect(double cx,
double cy,
double width,
double height,
double rx,
double ry)
|
void |
roundedRect(Rect r,
double roundness)
|
void |
roundedRect(Rect r,
double rx,
double ry)
|
void |
setFill(Color c)
|
void |
setFillColor(Color fillColor)
|
void |
setStroke(Color c)
|
void |
setStrokeColor(Color strokeColor)
|
void |
setStrokeWidth(double strokeWidth)
|
int |
size()
|
Path |
subtracted(Path p)
|
void |
text(Text t)
|
String |
toString()
|
void |
transform(Transform t)
|
Path |
united(Path p)
|
| Methods inherited from class nodebox.graphics.AbstractGeometry |
|---|
extend, extend, makePoints, makePoints, pointDelta |
| Methods inherited from class nodebox.graphics.AbstractTransformable |
|---|
getTransformDelegate, rotate, rotateRadians, scale, scale, setTransformDelegate, skew, skew, translate |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface nodebox.graphics.Grob |
|---|
getTransformDelegate, rotate, rotateRadians, scale, scale, setTransformDelegate, skew, skew, translate |
| Constructor Detail |
|---|
public Path()
public Path(Path other)
public Path(Path other,
boolean cloneContours)
public Path(Shape s)
public Path(Contour c)
| Method Detail |
|---|
public Geometry asGeometry()
public Color getFillColor()
public Color getFill()
public void setFillColor(Color fillColor)
setFillColor in interface Colorizablepublic void setFill(Color c)
setFill in interface Colorizablepublic Color getStrokeColor()
public Color getStroke()
public void setStrokeColor(Color strokeColor)
setStrokeColor in interface Colorizablepublic void setStroke(Color c)
setStroke in interface Colorizablepublic double getStrokeWidth()
public void setStrokeWidth(double strokeWidth)
setStrokeWidth in interface Colorizablepublic int getPointCount()
getPointCount in interface IGeometrypublic List<Point> getPoints()
getPoints in interface IGeometry
public void moveto(double x,
double y)
public void lineto(double x,
double y)
public void curveto(double x1,
double y1,
double x2,
double y2,
double x3,
double y3)
public void close()
public void newContour()
public void addPoint(Point pt)
IGeometry
addPoint in interface IGeometrypt - the point to add.
public void addPoint(double x,
double y)
IGeometry
addPoint in interface IGeometryx - the X coordinate.y - the Y coordinate.public void invalidate()
public void rect(Rect r)
public void rect(double cx,
double cy,
double width,
double height)
cx - the horizontal center of the rectanglecy - the vertical center of the rectanglewidth - the widthheight - the height
public void rect(Rect r,
double roundness)
public void rect(Rect r,
double rx,
double ry)
public void rect(double cx,
double cy,
double width,
double height,
double r)
public void rect(double cx,
double cy,
double width,
double height,
double rx,
double ry)
public void cornerRect(double x,
double y,
double width,
double height)
public void cornerRect(Rect r)
public void cornerRect(Rect r,
double roundness)
public void cornerRect(Rect r,
double rx,
double ry)
public void cornerRect(double cx,
double cy,
double width,
double height,
double r)
public void cornerRect(double cx,
double cy,
double width,
double height,
double rx,
double ry)
public void roundedRect(Rect r,
double roundness)
public void roundedRect(Rect r,
double rx,
double ry)
public void roundedRect(double cx,
double cy,
double width,
double height,
double r)
public void roundedRect(double cx,
double cy,
double width,
double height,
double rx,
double ry)
public void ellipse(double cx,
double cy,
double width,
double height)
cx - the horizontal center of the ellipsecy - the vertical center of the ellipsewidth - the widthheight - the height
public void cornerEllipse(double x,
double y,
double width,
double height)
public void line(double x1,
double y1,
double x2,
double y2)
public void text(Text t)
public void add(Contour c)
c - the contour to add.public int size()
public boolean isEmpty()
isEmpty in interface Grobpublic void clear()
public void extend(Path p)
public void extend(Shape s)
public List<Contour> getContours()
public boolean isClosed()
public static double lineLength(double x0,
double y0,
double x1,
double y1)
x0 - X start coordinatey0 - Y start coordinatex1 - X end coordinatey1 - Y end coordinate
public static Point linePoint(double t,
double x0,
double y0,
double x1,
double y1)
t - a number between 0.0 and 1.0 defining the position on the path.x0 - X start coordinatey0 - Y start coordinatex1 - X end coordinatey1 - Y end coordinate
public static double curveLength(double x0,
double y0,
double x1,
double y1,
double x2,
double y2,
double x3,
double y3)
x0 - X start coordinatey0 - Y start coordinatex1 - X control point 1y1 - Y control point 1x2 - X control point 2y2 - Y control point 2x3 - X end coordinatey3 - Y end coordinate
public static double curveLength(double x0,
double y0,
double x1,
double y1,
double x2,
double y2,
double x3,
double y3,
int n)
x0 - X start coordinatey0 - Y start coordinatex1 - X control point 1y1 - Y control point 1x2 - X control point 2y2 - Y control point 2x3 - X end coordinatey3 - Y end coordinaten - accuracy
public static Point curvePoint(double t,
double x0,
double y0,
double x1,
double y1,
double x2,
double y2,
double x3,
double y3)
t - a number between 0.0 and 1.0 defining the position on the path.x0 - X start coordinatey0 - Y start coordinatex1 - X control point 1y1 - Y control point 1x2 - X control point 2y2 - Y control point 2x3 - X end coordinatey3 - Y end coordinate
public double getLength()
public Contour contourAt(double t)
public Point pointAt(double t)
pointAt in class AbstractGeometryt - relative coordinate of the point (between 0.0 and 1.0)
Results outside of this range are undefined.
public Point point(double t)
t - relative coordinate of the point.
pointAt(double)
public Point[] makePoints(int amount,
boolean perContour)
makePoints in interface IGeometryamount - the number of points to create.perContour - if true, the amount of points is generated per contour, otherwise the amount
is for the entire path.
public Path resampleByAmount(int amount,
boolean perContour)
IGeometry
resampleByAmount in interface IGeometryamount - the number of points to generate.perContour - whether the given points are per contour, or for the entire geometry.
public Path resampleByLength(double segmentLength)
IGeometry
resampleByLength in interface IGeometrysegmentLength - the maximum length of each resampled segment.
public static Path findPath(List<Point> points)
public static Path findPath(List<Point> points,
double curvature)
public static Path findPath(Point[] points)
public static Path findPath(Point[] points,
double curvature)
points - the points of which to construct the path from.curvature - the smoothness of the generated path (0: straight, 1: smooth)
public boolean contains(Point p)
public boolean contains(double x,
double y)
public boolean contains(Rect r)
public boolean intersects(Rect r)
public boolean intersects(Path p)
public Path intersected(Path p)
public Path subtracted(Path p)
public Path united(Path p)
public GeneralPath getGeneralPath()
public Rect getBounds()
getBounds in interface Grobpublic void transform(Transform t)
transform in interface Grobpublic void flatten()
flatten in interface IGeometrypublic Path flattened()
flattened in interface IGeometrypublic void draw(Graphics2D g)
draw in interface Drawablepublic Path clone()
IGeometry
clone in interface Colorizableclone in interface Grobclone in interface IGeometryclone in class AbstractGeometrypublic Path cloneAndClear()
public AbstractGeometry mapPoints(com.google.common.base.Function<Point,Point> pointFunction)
AbstractGeometry
mapPoints in class AbstractGeometrypointFunction - The function to apply to each point.
public Iterator<Point> iterator()
iterator in interface Iterable<Point>public String toString()
toString in class Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||