Class IntRect


  • public class IntRect
    extends Object
    A class for representing a rectangular region, in integer coordinates.

    It exists mainly to avoid AWT references to Rectangle.

    Author:
    Barry DeZonia
    • Field Detail

      • x

        public int x
      • y

        public int y
      • width

        public int width
      • height

        public int height
    • Constructor Detail

      • IntRect

        public IntRect()
      • IntRect

        public IntRect​(int x,
                       int y,
                       int width,
                       int height)
    • Method Detail

      • intersects

        public boolean intersects​(IntRect r)
        Returns true if this rect intersects the given rect.
      • intersection

        public IntRect intersection​(IntRect r)
        Returns a Rect representing the intersection of this Rect with the given Rect. If the two Rects do not intersect, the result is an empty Rect.
      • contains

        public boolean contains​(IntCoords coords)
        Tests whether the given coordinates lie within the rectangle.
      • getTopLeft

        public IntCoords getTopLeft()
        Gets the top left coordinate of the rectangle.
      • getBottomRight

        public IntCoords getBottomRight()
        Gets the bottom right coordinate of the rectangle.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object