Interface Rect


public interface Rect
A rectangle described by the location and dimensions.
  • Method Summary

    Modifier and Type
    Method
    Description
    static Rect
    Returns an empty Rect with empty origin and size.
    default int
    Returns the rectangle vertical dimension.
    static Rect
    of(int width, int height)
    Returns the Rect instance for the given width and height values.
    static Rect
    of(int x, int y, int width, int height)
    Returns the Rect instance for the given x, y, width, and height values.
    static Rect
    of(Point origin, Size size)
    Returns the Rect instance for the given origin and size values.
    static Rect
    of(Size size)
    Returns the Rect instance for the empty origin and the given size value.
    default Point
    Returns the upper-left corner of the rectangle.
    default Size
    Returns the rectangle dimensions.
    default int
    Returns the rectangle horizontal dimension.
    default int
    x()
    Returns the horizontal coordinate of the upper-left corner of the rectangle.
    default int
    y()
    Returns the vertical coordinate of the upper-left corner of the rectangle.
  • Method Details

    • empty

      static Rect empty()
      Returns an empty Rect with empty origin and size.
    • of

      static Rect of(int width, int height)
      Returns the Rect instance for the given width and height values.
      Throws:
      IllegalArgumentException - when width or height is negative
    • of

      static Rect of(int x, int y, int width, int height)
      Returns the Rect instance for the given x, y, width, and height values.
      Throws:
      IllegalArgumentException - when width or height is negative
    • of

      static Rect of(Size size)
      Returns the Rect instance for the empty origin and the given size value.
    • of

      static Rect of(Point origin, Size size)
      Returns the Rect instance for the given origin and size values.
    • origin

      default Point origin()
      Returns the upper-left corner of the rectangle.
    • x

      default int x()
      Returns the horizontal coordinate of the upper-left corner of the rectangle.
    • y

      default int y()
      Returns the vertical coordinate of the upper-left corner of the rectangle.
    • width

      default int width()
      Returns the rectangle horizontal dimension.
    • height

      default int height()
      Returns the rectangle vertical dimension.
    • size

      default Size size()
      Returns the rectangle dimensions.