public class ShapeUtil extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
ShapeUtil.BooleanOperator |
static interface |
ShapeUtil.ShapeConsumer |
static class |
ShapeUtil.ShapeOperation
Deprecated.
Use
ShapeUtil.BooleanOperator instead. |
Constructor and Description |
---|
ShapeUtil() |
Modifier and Type | Method and Description |
---|---|
static java.awt.geom.Area |
add(java.awt.Shape shape1,
java.awt.Shape shape2)
Deprecated.
Use
union(Shape, Shape) instead |
static java.awt.geom.Path2D |
buildPathFromAnchors(java.awt.geom.Path2D path,
java.util.List<PathAnchor2D> points)
Update specified path from the specified list of PathAnchor2D
|
static boolean |
consumeShapeFromPath(java.awt.geom.PathIterator path,
ShapeUtil.ShapeConsumer consumer)
Permit to describe any PathIterator in a list of Shape which are returned
to the specified ShapeConsumer
|
static void |
drawFromPath(java.awt.geom.PathIterator path,
java.awt.Graphics2D g)
Deprecated.
|
static void |
enlarge(java.awt.geom.RectangularShape shape,
double width,
double height,
boolean centered)
Enlarge the specified
RectangularShape by specified width and height. |
static java.awt.geom.Area |
exclusiveUnion(java.awt.Shape shape1,
java.awt.Shape shape2)
Do exclusive union between the 2 shapes and return result in an
Area type shape. |
static java.util.ArrayList<PathAnchor2D> |
getAnchorsFromShape(java.awt.Shape shape)
Return all PathAnchor points from the specified shape
|
static java.awt.geom.Path2D |
getPathFromAnchors(java.util.List<PathAnchor2D> points)
Create and return a path from the specified list of PathAnchor2D
|
static java.awt.geom.Area |
intersect(java.awt.Shape shape1,
java.awt.Shape shape2)
Intersect 2 shapes and return result in an
Area type shape. |
static boolean |
isVisible(java.awt.Graphics g,
java.awt.Shape shape)
Use the
Graphics clip area and Shape bounds informations to determine if
the specified Shape is visible in the specified Graphics object. |
static java.awt.geom.Area |
merge(java.util.List<java.awt.Shape> shapes,
ShapeUtil.BooleanOperator operator)
Merge the specified list of
Shape with the given ShapeUtil.BooleanOperator . |
static java.awt.geom.Area |
merge(java.awt.Shape[] shapes,
ShapeUtil.ShapeOperation operation)
Deprecated.
Use
merge(List, BooleanOperator) instead. |
static boolean |
pathIntersects(java.awt.geom.PathIterator path,
java.awt.geom.Rectangle2D rect)
Return true if the specified PathIterator intersects with the specified Rectangle
|
static void |
scale(java.awt.geom.RectangularShape shape,
double factor,
boolean centered)
Scale the specified
RectangularShape by specified factor. |
static java.awt.geom.Area |
subtract(java.awt.Shape shape1,
java.awt.Shape shape2)
Subtract shape2 from shape1 return result in an
Area type shape. |
static void |
translate(java.awt.geom.RectangularShape shape,
double dx,
double dy)
Translate a rectangular shape by the specified dx and dy value
|
static void |
translate(java.awt.geom.RectangularShape shape,
int dx,
int dy)
Translate a rectangular shape by the specified dx and dy value
|
static java.awt.geom.Area |
union(java.awt.Shape shape1,
java.awt.Shape shape2)
Do union between the 2 shapes and return result in an
Area type shape. |
static java.awt.geom.Area |
xor(java.awt.Shape shape1,
java.awt.Shape shape2)
Deprecated.
Use
exclusiveUnion(Shape, Shape) instead. |
public ShapeUtil()
public static boolean isVisible(java.awt.Graphics g, java.awt.Shape shape)
Graphics
clip area and Shape
bounds informations to determine if
the specified Shape
is visible in the specified Graphics object.public static java.awt.geom.Area merge(java.util.List<java.awt.Shape> shapes, ShapeUtil.BooleanOperator operator)
shapes
- Shapes we want to merge.operator
- ShapeUtil.BooleanOperator
to apply.Area
shape representing the result of the merge operation.@Deprecated public static java.awt.geom.Area merge(java.awt.Shape[] shapes, ShapeUtil.ShapeOperation operation)
merge(List, BooleanOperator)
instead.public static java.awt.geom.Area union(java.awt.Shape shape1, java.awt.Shape shape2)
Area
type shape.@Deprecated public static java.awt.geom.Area add(java.awt.Shape shape1, java.awt.Shape shape2)
union(Shape, Shape)
insteadpublic static java.awt.geom.Area intersect(java.awt.Shape shape1, java.awt.Shape shape2)
Area
type shape.public static java.awt.geom.Area exclusiveUnion(java.awt.Shape shape1, java.awt.Shape shape2)
Area
type shape.@Deprecated public static java.awt.geom.Area xor(java.awt.Shape shape1, java.awt.Shape shape2)
exclusiveUnion(Shape, Shape)
instead.public static java.awt.geom.Area subtract(java.awt.Shape shape1, java.awt.Shape shape2)
Area
type shape.public static void scale(java.awt.geom.RectangularShape shape, double factor, boolean centered)
RectangularShape
by specified factor.shape
- the RectangularShape
to scalefactor
- the scale factorcentered
- if true then scaling is centered (shape location is modified)public static void enlarge(java.awt.geom.RectangularShape shape, double width, double height, boolean centered)
RectangularShape
by specified width and height.shape
- the RectangularShape
to scalewidth
- the width to addheight
- the height to addcentered
- if true then enlargement is centered (shape location is modified)public static void translate(java.awt.geom.RectangularShape shape, int dx, int dy)
public static void translate(java.awt.geom.RectangularShape shape, double dx, double dy)
public static boolean consumeShapeFromPath(java.awt.geom.PathIterator path, ShapeUtil.ShapeConsumer consumer)
public static java.util.ArrayList<PathAnchor2D> getAnchorsFromShape(java.awt.Shape shape)
public static java.awt.geom.Path2D buildPathFromAnchors(java.awt.geom.Path2D path, java.util.List<PathAnchor2D> points)
public static java.awt.geom.Path2D getPathFromAnchors(java.util.List<PathAnchor2D> points)
@Deprecated public static void drawFromPath(java.awt.geom.PathIterator path, java.awt.Graphics2D g)
GraphicsUtil.drawPathIterator(PathIterator, Graphics2D)
insteadpublic static boolean pathIntersects(java.awt.geom.PathIterator path, java.awt.geom.Rectangle2D rect)