| java.lang.Object org.jfree.report.util.ShapeTransform
ShapeTransform | final public strictfp class ShapeTransform (Code) | | Utility class, which resizes or translates a Shape. The class contains special handlers
for Rectangles and Lines.
author: Thomas Morgner |
Field Summary | |
final public static int | ABOVE Flag for point lying "above" clipping area. | final public static int | BELOW Flag for point lying "below" clipping area. | final public static int | H_CENTER Flag for point lying between horizontal bounds of area. | final public static int | INSIDE Mask for points which are inside. | final public static int | LEFT Flag for point lying left of clipping area. | final public static int | OUTSIDE Mask for points which are outside. | final public static int | RIGHT Flag for point lying right of clipping area. | final public static int | V_CENTER Flag for point lying between vertical bounds of clipping area. |
Method Summary | |
public 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. | public static Shape | performCliping(Shape s, Rectangle2D bounds) Clips the given shape to the given bounds. | public static Shape | resizeRect(RectangularShape rectangularShape, double width, double height) Resizes a rectangle. | public 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. | public static Shape | transformShape(Shape s, boolean scale, boolean keepAR, double width, double height) Translates the given shape. | public static Shape | transformShape(Shape s, boolean scale, boolean keepAR, Dimension2D dim) Translates the given shape. | public static Shape | translateShape(Shape s, double x, double y) Translates a given shape. |
ABOVE | final public static int ABOVE(Code) | | Flag for point lying "above" clipping area.
|
BELOW | final public static int BELOW(Code) | | Flag for point lying "below" clipping area.
|
H_CENTER | final public static int H_CENTER(Code) | | Flag for point lying between horizontal bounds of area.
|
INSIDE | final public static int INSIDE(Code) | | Mask for points which are inside.
|
LEFT | final public static int LEFT(Code) | | Flag for point lying left of clipping area.
|
OUTSIDE | final public static int OUTSIDE(Code) | | Mask for points which are outside.
|
RIGHT | final public static int RIGHT(Code) | | Flag for point lying right of clipping area.
|
V_CENTER | final public static int V_CENTER(Code) | | Flag for point lying between vertical bounds of clipping area.
|
getClipped | public static Point2D[] getClipped(double x1, double y1, double x2, double y2, double xmin, double xmax, double ymin, double ymax)(Code) | | Calculate the clipping points of a line with a rectangle.
Parameters: x1 - starting x of line Parameters: y1 - starting y of line Parameters: x2 - ending x of line Parameters: y2 - ending y of line Parameters: xmin - lower left x of rectangle Parameters: xmax - upper right x of rectangle Parameters: ymin - lower left y of rectangle Parameters: ymax - upper right y of rectangle null (does not clip) or array of two points |
performCliping | public static Shape performCliping(Shape s, Rectangle2D bounds)(Code) | | Clips the given shape to the given bounds. If the shape is a Line2D, manual
clipping is performed, as the built in Area does not handle lines.
Parameters: s - the shape to be clipped Parameters: bounds - the bounds to which the shape should be clipped the clipped shape. |
resizeRect | public static Shape resizeRect(RectangularShape rectangularShape, double width, double height)(Code) | | Resizes a rectangle. This works for real rectangles and produces funny results
for RoundRects etc ..
Parameters: rectangularShape - the rectangle Parameters: width - the new width of the rectangle Parameters: height - the new height of the rectangle. the resized rectangle. |
resizeShape | public static Shape resizeShape(Shape s, float width, float height)(Code) | | Resizes a shape, so that the shape has the given width and height, but the origin of
the shape does not change.
Unlike the AffineTransform, this method tries to preserve the Shape's Type.
Parameters: s - the shape Parameters: width - the new width Parameters: height - the new height the resized shape. |
transformShape | public static Shape transformShape(Shape s, boolean scale, boolean keepAR, double width, double height)(Code) | | Translates the given shape. The shape is translated to the origin supplied in
point . If scaling is requested, the shape will also be scaled using an
AffineTransform.
Parameters: s - the shape that should be transformed Parameters: scale - true, if the shape should be scaled, false otherwise Parameters: keepAR - true, if the scaled shape should keep the aspect ratio Parameters: width - the target width. Parameters: height - the target height. the transformed shape |
transformShape | public static Shape transformShape(Shape s, boolean scale, boolean keepAR, Dimension2D dim)(Code) | | Translates the given shape. The shape is translated to the origin supplied in
point . If scaling is requested, the shape will also be scaled using an
AffineTransform.
Parameters: s - the shape that should be transformed Parameters: scale - true, if the shape should be scaled, false otherwise Parameters: keepAR - true, if the scaled shape should keep the aspect ratio Parameters: dim - the target dimension. the transformed shape |
translateShape | public static Shape translateShape(Shape s, double x, double y)(Code) | | Translates a given shape. Special care is taken to preserve the shape's original
class, if the shape is a rectangle or a line.
Parameters: s - the shape Parameters: x - the x coordinate where the shape is translated to Parameters: y - the y coordinate where the shape is translated to the translated shape |
|
|