public interface Shape
An interface that can be implemented by any class that wants to be drawable as a shape.
Shape can also be used to clip an area e.g.:
Modifier and Type | Method and Description |
---|---|
boolean |
contains(int x,
int y)
Checks if the shape contains the given point.
|
Rectangle |
getBounds()
Returns the bounding rectangle for the shape.
|
float[] |
getBounds2D()
Gets the bounds of the shape as a 4-element array representing the (x,y,width,height)
tuple.
|
PathIterator |
getPathIterator()
Gets an iterator to walk all of the path segments of the shape.
|
PathIterator |
getPathIterator(Transform transform)
Gets an iterator where all points are transformed by the provided transform.
|
Shape |
intersection(Rectangle rect)
Returns the shape formed by the intersection of this shape and the provided
rectangle.
|
boolean |
isRectangle()
Checks if this shape is a rectangle.
|
PathIterator getPathIterator()
PathIterator getPathIterator(Transform transform)
Note: If Transform.isSupported()
is false, then using this iterator will throw a Runtime Exception.
transform
- Rectangle getBounds()
Rectangle
that comprises the bounds of the shape.float[] getBounds2D()
boolean isRectangle()
boolean contains(int x, int y)
x
- The x-coordinate of the point to test.y
- The y-coordinate of the point to test.