All Packages  Class Hierarchy  This Package  Previous  Next  Index  

Class java.awt.geom.Rectangle2D

java.lang.Object
    |
    +----java.awt.geom.RectangularShape
            |
            +----java.awt.geom.Rectangle2D

public abstract class Rectangle2D
extends RectangularShape
A rectangle defined by a location (x, y) and dimension (w x h).

This class is only the abstract superclass for all objects which store a 2D rectangle. The actual storage representation of the coordinates is left to the subclass.


Class Index

 o Rectangle2D.Double
A rectangle specified in double coordinates.
 o Rectangle2D.Float
A rectangle specified in float coordinates.

Variable Index

 o OUT_BOTTOM
The bitmask which indicates that a point lies below this Rectangle.
 o OUT_LEFT
The bitmask which indicates that a point lies to the left of this Rectangle.
 o OUT_RIGHT
The bitmask which indicates that a point lies to the right of this Rectangle.
 o OUT_TOP
The bitmask which indicates that a point lies above this Rectangle.

Constructor Index

 o Rectangle2D()

Method Index

 o contains(double, double)
Test if a given coordinate is inside the boundary of the shape.
 o contains(double, double, double, double)
Test if the interior of the Shape entirely contains the given set of rectangular coordinates.
 o getBounds2D()
Return the high precision bounding box of the shape.
 o getPathIterator(AffineTransform)
Return an iteration object that defines the boundary of the shape.
 o getPathIterator(AffineTransform, double)
Return an iteration object that defines the boundary of the flattened shape.
 o intersects(double, double, double, double)
Test if the interior of the Shape intersects the interior of a given set of rectangular coordinates.
 o intersectsLine(double, double, double, double)
Tests if the given line segment intersects the interior of this Rectangle.
 o intersectsLine(Line2D)
Tests if the given line segment intersects the interior of this Rectangle.
 o outcode(double, double)
Determines where the specified coordinates lie with respect to this Rectangle.
 o outcode(Point2D)
Determines where the specified point lies with respect to this Rectangle.
 o setBounds(double, double, double, double)
Sets the location and size of the outer bounds of this shape to the specified rectangular values.
 o setRect(double, double, double, double)
Sets the location and size of this rectangle to the specified double values.
 o setRect(Rectangle2D)
Sets this rectangle to be the same as the specified Rectangle.

Variables

 o OUT_LEFT
public static final int OUT_LEFT
The bitmask which indicates that a point lies to the left of this Rectangle.

 o OUT_TOP
public static final int OUT_TOP
The bitmask which indicates that a point lies above this Rectangle.

 o OUT_RIGHT
public static final int OUT_RIGHT
The bitmask which indicates that a point lies to the right of this Rectangle.

 o OUT_BOTTOM
public static final int OUT_BOTTOM
The bitmask which indicates that a point lies below this Rectangle.

Constructors

 o Rectangle2D
protected Rectangle2D()

Methods

 o setRect
public abstract void setRect(double x,
                             double y,
                             double w,
                             double h)
Sets the location and size of this rectangle to the specified double values.

 o setRect
public void setRect(Rectangle2D r)
Sets this rectangle to be the same as the specified Rectangle.

 o intersectsLine
public boolean intersectsLine(double x1,
                              double y1,
                              double x2,
                              double y2)
Tests if the given line segment intersects the interior of this Rectangle.

 o intersectsLine
public boolean intersectsLine(Line2D l)
Tests if the given line segment intersects the interior of this Rectangle.

 o outcode
public abstract int outcode(double x,
                            double y)
Determines where the specified coordinates lie with respect to this Rectangle. This method computes a binary OR of the appropriate mask values indicating which sides of the rectangle the given point is outside of.

Returns:
the logical OR of all appropriate out codes
See Also:
OUT_LEFT, OUT_TOP, OUT_RIGHT, OUT_BOTTOM
 o outcode
public int outcode(Point2D p)
Determines where the specified point lies with respect to this Rectangle. This method computes a binary OR of the appropriate mask values indicating which sides of the rectangle the given point is outside of.

Returns:
the logical OR of all appropriate out codes
See Also:
OUT_LEFT, OUT_TOP, OUT_RIGHT, OUT_BOTTOM
 o setBounds
public void setBounds(double x,
                      double y,
                      double w,
                      double h)
Sets the location and size of the outer bounds of this shape to the specified rectangular values.

Overrides:
setBounds in class RectangularShape
 o getBounds2D
public Rectangle2D getBounds2D()
Return the high precision bounding box of the shape.

 o contains
public boolean contains(double x,
                        double y)
Test if a given coordinate is inside the boundary of the shape.

 o intersects
public boolean intersects(double x,
                          double y,
                          double w,
                          double h)
Test if the interior of the Shape intersects the interior of a given set of rectangular coordinates.

 o contains
public boolean contains(double x,
                        double y,
                        double w,
                        double h)
Test if the interior of the Shape entirely contains the given set of rectangular coordinates.

 o getPathIterator
public PathIterator getPathIterator(AffineTransform at)
Return an iteration object that defines the boundary of the shape.

 o getPathIterator
public PathIterator getPathIterator(AffineTransform at,
                                    double flatness)
Return an iteration object that defines the boundary of the flattened shape.

Overrides:
getPathIterator in class RectangularShape

All Packages  Class Hierarchy  This Package  Previous  Next  Index  

Submit a bug or feature