public final class ShapeTransform extends Object
Modifier and Type | Field and Description |
---|---|
static int |
ABOVE
Flag for point lying "above" clipping area.
|
static int |
BELOW
Flag for point lying "below" clipping area.
|
static int |
H_CENTER
Flag for point lying between horizontal bounds of area.
|
static int |
INSIDE
Mask for points which are inside.
|
static int |
LEFT
Flag for point lying left of clipping area.
|
static int |
OUTSIDE
Mask for points which are outside.
|
static int |
RIGHT
Flag for point lying right of clipping area.
|
static int |
V_CENTER
Flag for point lying between vertical bounds of clipping area.
|
Modifier and Type | Method and Description |
---|---|
static Point2D[] |
getClipped(double x1,
double y1,
double x2,
double y2,
double xmin,
double xmax,
double ymin,
double ymax)
Calculate the clipping points of a line with a rectangle.
|
static Shape |
performCliping(Shape s,
Rectangle2D bounds)
Clips the given shape to the given bounds.
|
static Shape |
resizeRect(RectangularShape rectangularShape,
double width,
double height)
Resizes a rectangle.
|
static Shape |
resizeShape(Shape s,
float width,
float height)
Resizes a shape, so that the shape has the given width and height, but the origin of the shape does not change.
|
static Shape |
transformShape(Shape s,
boolean scale,
boolean keepAR,
Dimension2D dim)
Translates the given shape.
|
static Shape |
transformShape(Shape s,
boolean scale,
boolean keepAR,
double width,
double height)
Translates the given shape.
|
static Shape |
translateShape(Shape s,
double x,
double y)
Translates a se.
|
public static final int LEFT
public static final int H_CENTER
public static final int RIGHT
public static final int BELOW
public static final int V_CENTER
public static final int ABOVE
public static final int INSIDE
public static final int OUTSIDE
public static Shape resizeShape(Shape s, float width, float height)
s
- the shapewidth
- the new widthheight
- the new heightpublic static Shape resizeRect(RectangularShape rectangularShape, double width, double height)
rectangularShape
- the rectanglewidth
- the new width of the rectangleheight
- the new height of the rectangle.public static Shape transformShape(Shape s, boolean scale, boolean keepAR, double width, double height)
point
. If scaling is
requested, the shape will also be scaled using an AffineTransform.s
- the shape that should be transformedscale
- true, if the shape should be scaled, false otherwisekeepAR
- true, if the scaled shape should keep the aspect ratiowidth
- the target width.height
- the target height.public static Shape transformShape(Shape s, boolean scale, boolean keepAR, Dimension2D dim)
point
. If scaling is
requested, the shape will also be scaled using an AffineTransform.s
- the shape that should be transformedscale
- true, if the shape should be scaled, false otherwisekeepAR
- true, if the scaled shape should keep the aspect ratiodim
- the target dimension.public static Shape performCliping(Shape s, Rectangle2D bounds)
s
- the shape to be clippedbounds
- the bounds to which the shape should be clippedpublic static Shape translateShape(Shape s, double x, double y)
s
- the shapex
- the x coordinate where the shape is translated toy
- the y coordinate where the shape is translated topublic static Point2D[] getClipped(double x1, double y1, double x2, double y2, double xmin, double xmax, double ymin, double ymax)
x1
- starting x of liney1
- starting y of linex2
- ending x of liney2
- ending y of linexmin
- lower left x of rectanglexmax
- upper right x of rectangleymin
- lower left y of rectangleymax
- upper right y of rectanglenull
(does not clip) or array of two pointsCopyright © 2017 Hitachi Vantara. All rights reserved.