com.threerings.opengl.gui.util
Class Rectangle

java.lang.Object
  extended by com.threerings.opengl.gui.util.Rectangle

public final class Rectangle
extends Object

Represents the bounds of a component.


Field Summary
 int height
          The height of the entity in question.
 int width
          The width of the entity in question.
 int x
          The x position of the entity in question.
 int y
          The y position of the entity in question.
 
Constructor Summary
Rectangle()
          Creates an empty rectangle.
Rectangle(int x, int y, int width, int height)
          Creates a rectangle with the specified location and dimensions.
Rectangle(Rectangle other)
          Copy constructor.
 
Method Summary
 void add(int x, int y, int width, int height)
          Adds the specified rectangle to this rectangle, causing this rectangle to become the union of itself and the specified rectangle.
 boolean equals(Object other)
           
 int getArea()
          Returns the area of the rectangle.
 void grow(int h, int v)
          Increases the size of this rectangle by the specified amounts in the horizontal and vertical dimensions.
 int hashCode()
           
 Rectangle intersect(Rectangle other)
          Computes the intersection of this rectangle and the specified other.
 Rectangle intersect(Rectangle other, Rectangle result)
          Computes the intersection of this rectangle and the specified other, placing the result in the object provided.
 Rectangle intersectLocal(Rectangle other)
          Computes the intersection in-place of this rectangle and the specified other.
 Rectangle set(int x, int y, int width, int height)
          Sets the fields of this rectangle.
 Rectangle set(Rectangle other)
          Sets the state of this rectangle to that of the specified other.
 String toString()
          Generates a string representation of this instance.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

x

public int x
The x position of the entity in question.


y

public int y
The y position of the entity in question.


width

public int width
The width of the entity in question.


height

public int height
The height of the entity in question.

Constructor Detail

Rectangle

public Rectangle(int x,
                 int y,
                 int width,
                 int height)
Creates a rectangle with the specified location and dimensions.


Rectangle

public Rectangle(Rectangle other)
Copy constructor.


Rectangle

public Rectangle()
Creates an empty rectangle.

Method Detail

getArea

public int getArea()
Returns the area of the rectangle.


intersectLocal

public Rectangle intersectLocal(Rectangle other)
Computes the intersection in-place of this rectangle and the specified other.

Returns:
a reference to this rectangle, for chaining.

intersect

public Rectangle intersect(Rectangle other)
Computes the intersection of this rectangle and the specified other.

Returns:
a new rectangle containing the result.

intersect

public Rectangle intersect(Rectangle other,
                           Rectangle result)
Computes the intersection of this rectangle and the specified other, placing the result in the object provided.

Returns:
a reference to the result object, for chaining.

set

public Rectangle set(Rectangle other)
Sets the state of this rectangle to that of the specified other.

Returns:
a reference to this rectangle, for chaining.

set

public Rectangle set(int x,
                     int y,
                     int width,
                     int height)
Sets the fields of this rectangle.

Returns:
a reference to this rectangle, for chaining.

add

public void add(int x,
                int y,
                int width,
                int height)
Adds the specified rectangle to this rectangle, causing this rectangle to become the union of itself and the specified rectangle.


grow

public void grow(int h,
                 int v)
Increases the size of this rectangle by the specified amounts in the horizontal and vertical dimensions.


equals

public boolean equals(Object other)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Generates a string representation of this instance.

Overrides:
toString in class Object


Copyright © 2011. All Rights Reserved.