public class Rect
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
int |
height
rectangle height
|
int |
width
rectangle width
|
int |
x
x position
|
int |
y
y position
|
Constructor and Description |
---|
Rect()
Constructs a rectangle with x = y = width = height = 0.
|
Rect(Coord topleft,
Coord bottomright)
Constructs a rectangle with the given coords
|
Rect(int x,
int y,
int width,
int height)
Constructs a rectangle with the given x, y, width and height.
|
Rect(Rect r)
Constructs a rectangle with the given rectangle coordinates.
|
Modifier and Type | Method and Description |
---|---|
boolean |
contains(int xx,
int yy)
Returns true if the point xx,yy is inside this rect.
|
boolean |
equals(java.lang.Object other)
Returns true if the bounds of this Rect and the given one are the same
|
int |
hashCode()
Returns the hashcode for this rect, ie, an integer valued 0xXXYYWWHH
|
boolean |
intersects(Rect r)
Returns true if this rectangle intersects with the given one
|
Rect |
intersectWith(Rect r)
Modify this Rect by doing the intersection with the given rect.
|
Rect |
modifiedBy(int deltaX,
int deltaY,
int deltaW,
int deltaH)
Returns a new rect modified by the specified parameters.
|
void |
modify(int deltaX,
int deltaY,
int deltaW,
int deltaH)
Modifies this rect by the specified parameters.
|
void |
set(int x,
int y,
int width,
int height)
Sets the properties of this rect.
|
void |
set(Rect r)
Copies the properties of this rect from the given rect.
|
java.lang.String |
toString() |
void |
translate(int deltaX,
int deltaY)
Translates this rect.
|
Rect |
unionWith(Rect r)
Modify this Rect by doing an union with the given rect.
|
int |
x2()
Returns x+width-1
|
int |
y2()
Returns y+height-1
|
public int x
public int y
public int width
public int height
public Rect()
public Rect(int x, int y, int width, int height)
public Rect(Rect r)
public void set(int x, int y, int width, int height)
public void set(Rect r)
public boolean contains(int xx, int yy)
public java.lang.String toString()
toString
in class java.lang.Object
public void translate(int deltaX, int deltaY)
public Rect modifiedBy(int deltaX, int deltaY, int deltaW, int deltaH)
public void modify(int deltaX, int deltaY, int deltaW, int deltaH)
public int x2()
public int y2()
public boolean intersects(Rect r)
public Rect intersectWith(Rect r)
this
rect.public Rect unionWith(Rect r)
this
rect.public boolean equals(java.lang.Object other)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object