public class RelativeGeneralPath extends Object implements Shape, Cloneable, Serializable
GeneralPath decorator that adjusts all shape pathing according to specified bounds and orientation.
It is used to simplify shape construction code whenever bounds and/or orientation have to be taken into account| Modifier and Type | Field and Description |
|---|---|
protected Rectangle |
bounds
Additional bounds.
|
protected boolean |
ltr
Whether or not orientation is left-to-right.
|
protected GeneralPath |
shape
GeneralPath used as an actual Shape implementation. |
| Constructor and Description |
|---|
RelativeGeneralPath(Rectangle bounds)
Constructs new
RelativeGeneralPath. |
RelativeGeneralPath(Rectangle bounds,
boolean ltr)
Constructs new
RelativeGeneralPath. |
| Modifier and Type | Method and Description |
|---|---|
void |
closePath()
Closes the current subpath by drawing a straight line back to the coordinates of the last
moveTo. |
boolean |
contains(double x,
double y) |
boolean |
contains(double x,
double y,
double w,
double h) |
boolean |
contains(Point2D p) |
boolean |
contains(Rectangle2D r) |
void |
curveTo(float x1,
float y1,
float x2,
float y2,
float x3,
float y3)
Adds a curved segment, defined by three new points, to the path by drawing a Bezier curve that intersects both the current
coordinates and the specified coordinates
(x3,y3), using the specified points (x1,y1) and (x2,y2) as
Bezier control points. |
Rectangle |
getBounds() |
Rectangle2D |
getBounds2D() |
PathIterator |
getPathIterator(AffineTransform at) |
PathIterator |
getPathIterator(AffineTransform at,
double flatness) |
boolean |
intersects(double x,
double y,
double w,
double h) |
boolean |
intersects(Rectangle2D r) |
void |
lineTo(float x,
float y)
Adds a point to the path by drawing a straight line from the current coordinates to the new specified coordinates.
|
void |
moveTo(float x,
float y)
Adds a point to the path by moving to the specified coordinates.
|
protected float |
orientX(float x)
Returns X coordinate oriented according to
ltr orientation. |
void |
quadTo(float x1,
float y1,
float x2,
float y2)
Adds a curved segment, defined by two new points, to the path by drawing a Quadratic curve that intersects both the current
coordinates and the specified coordinates
(x2,y2), using the specified point (x1,y1) as a quadratic parametric
control point. |
protected final Rectangle bounds
protected final boolean ltr
protected final GeneralPath shape
GeneralPath used as an actual Shape implementation.public RelativeGeneralPath(Rectangle bounds)
RelativeGeneralPath.bounds - additional boundspublic RelativeGeneralPath(Rectangle bounds, boolean ltr)
RelativeGeneralPath.bounds - additional boundsltr - whether or not orientation is left-to-rightpublic final void moveTo(float x,
float y)
x - X coordinatey - Y coordinatepublic final void lineTo(float x,
float y)
x - X coordinatey - Y coordinatepublic final void quadTo(float x1,
float y1,
float x2,
float y2)
(x2,y2), using the specified point (x1,y1) as a quadratic parametric
control point.x1 - X coordinate of the quadratic control pointy1 - Y coordinate of the quadratic control pointx2 - X coordinate of the final end pointy2 - Y coordinate of the final end pointpublic final void curveTo(float x1,
float y1,
float x2,
float y2,
float x3,
float y3)
(x3,y3), using the specified points (x1,y1) and (x2,y2) as
Bezier control points. All coordinates are specified in float precision.x1 - X coordinate of the first Bezier control pointy1 - Y coordinate of the first Bezier control pointx2 - X coordinate of the second Bezier control pointy2 - Y coordinate of the second Bezier control pointx3 - X coordinate of the final end pointy3 - Y coordinate of the final end pointpublic final void closePath()
moveTo.
If the path is already closed then this method has no effect.protected float orientX(float x)
ltr orientation.x - X coordinate to orientltr orientationpublic Rectangle2D getBounds2D()
getBounds2D in interface Shapepublic boolean intersects(double x,
double y,
double w,
double h)
intersects in interface Shapepublic boolean intersects(Rectangle2D r)
intersects in interface Shapepublic boolean contains(double x,
double y,
double w,
double h)
public boolean contains(Rectangle2D r)
public PathIterator getPathIterator(AffineTransform at)
getPathIterator in interface Shapepublic PathIterator getPathIterator(AffineTransform at, double flatness)
getPathIterator in interface ShapeCopyright © 2020. All rights reserved.