public final class Rectangle extends ValueType implements IEquatable<Rectangle>
Modifier and Type | Field and Description |
---|---|
static Rectangle |
Empty
Returns a Rectangle with all of its values set to zero.
|
int |
Height
Specifies the height of the rectangle.
|
int |
Width
Specifies the width of the rectangle.
|
int |
X
Specifies the x-coordinate of the rectangle.
|
int |
Y
Specifies the y-coordinate of the rectangle.
|
Constructor and Description |
---|
Rectangle()
Initializes a new instance of Rectangle.
|
Rectangle(int x,
int y,
int width,
int height)
Initializes a new instance of Rectangle.
|
Modifier and Type | Method and Description |
---|---|
int |
Bottom()
Returns the y-coordinate of the bottom of the rectangle.
|
Point |
Center()
Gets the Point that specifies the center of the rectangle.
|
boolean |
Contains(int x,
int y)
Determines whether this Rectangle contains a specified point represented by its x- and y-coordinates.
|
boolean |
Contains(Point value)
Determines whether this Rectangle contains a specified Point.
|
void |
Contains(Point value,
boolean result)
Determines whether this Rectangle contains a specified Point.
|
boolean |
Contains(Rectangle value)
Determines whether this Rectangle entirely contains a specified Rectangle.
|
void |
Contains(Rectangle value,
boolean result)
Determines whether this Rectangle entirely contains a specified Rectangle.
|
boolean |
equals(java.lang.Object obj)
Determines whether the specified Object is equal to the current instance.
|
boolean |
Equals(Rectangle other)
Determines whether the specified Object is equal to the Rectangle.
|
int |
GetHashCode()
Gets the hash code for this object.
|
Point |
getLocation()
Gets the upper-left value of the Rectangle.
|
void |
Inflate(int horizontalAmount,
int verticalAmount)
Pushes the edges of the Rectangle out by the horizontal and vertical values specified.
|
static Rectangle |
Intersect(Rectangle value1,
Rectangle value2)
Creates a Rectangle defining the area where one rectangle overlaps with another rectangle.
|
static void |
Intersect(Rectangle value1,
Rectangle value2,
Rectangle result)
Creates a Rectangle defining the area where one rectangle overlaps with another rectangle.
|
boolean |
Intersects(Rectangle value)
Determines whether a specified Rectangle intersects with this Rectangle.
|
void |
Intersects(Rectangle value,
boolean result)
Determines whether a specified Rectangle intersects with this Rectangle.
|
boolean |
IsEmpty()
Gets a value that indicates whether the Rectangle is empty.
|
int |
Left()
Returns the x-coordinate of the left side of the rectangle.
|
void |
Offset(int offsetX,
int offsetY)
Changes the position of the Rectangle.
|
void |
Offset(Point amount)
Changes the position of the Rectangle.
|
int |
Right()
Returns the x-coordinate of the right side of the rectangle.
|
void |
setLocation(Point newLocation)
Sets the upper-left value of the Rectangle.
|
int |
Top()
Returns the y-coordinate of the top of the rectangle.
|
java.lang.String |
toString()
Retrieves a string representation of the current object.
|
static Rectangle |
Union(Rectangle value1,
Rectangle value2)
Creates a new Rectangle that exactly contains two other rectangles.
|
static void |
Union(Rectangle value1,
Rectangle value2,
Rectangle result)
Creates a new Rectangle that exactly contains two other rectangles.
|
public static final Rectangle Empty
public int Height
public int Width
public int X
public int Y
public Rectangle(int x, int y, int width, int height)
x
- The x-coordinate of the rectangle.y
- The y-coordinate of the rectangle.width
- Width of the rectangle.height
- Height of the rectangle.public Rectangle()
public int Bottom()
public Point Center()
public boolean IsEmpty()
public int Left()
public Point getLocation()
public void setLocation(Point newLocation)
newLocation
- The new location of the upper-left value of the Rectangle.public int Right()
public int Top()
public boolean Contains(Point value)
value
- The Point to evaluate.public boolean Contains(Rectangle value)
value
- The Rectangle to evaluate.public void Contains(Rectangle value, boolean result)
value
- The Rectangle to evaluate.result
- [OutAttribute] On exit, is true if this Rectangle entirely contains the specified Rectangle, or false if not.public boolean Contains(int x, int y)
x
- The x-coordinate of the specified point.y
- The y-coordinate of the specified point.public void Contains(Point value, boolean result)
value
- The Point to evaluate.result
- [OutAttribute] true if the specified Point is contained within this Rectangle; false otherwise.public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- The Object to compare with the current Ray.public boolean Equals(Rectangle other)
Equals
in interface IEquatable<Rectangle>
other
- The Object to compare with the current Rectangle.public int GetHashCode()
public void Inflate(int horizontalAmount, int verticalAmount)
horizontalAmount
- Value to push the sides out by.verticalAmount
- Value to push the top and bottom out by.public static Rectangle Intersect(Rectangle value1, Rectangle value2)
value1
- The first Rectangle to compare.value2
- The second Rectangle to compare.public static void Intersect(Rectangle value1, Rectangle value2, Rectangle result)
value1
- The first Rectangle to compare.value2
- The second Rectangle to compare.result
- [OutAttribute] The area where the two first parameters overlap.public boolean Intersects(Rectangle value)
value
- The Rectangle to evaluate.public void Intersects(Rectangle value, boolean result)
value
- The Rectangle to evaluateresult
- [OutAttribute] true if the specified Rectangle intersects with this one; false otherwise.public void Offset(Point amount)
amount
- The values to adjust the position of the Rectangle by.public void Offset(int offsetX, int offsetY)
offsetX
- Change in the x-position.offsetY
- Change in the y-position.public java.lang.String toString()
toString
in class java.lang.Object
public static Rectangle Union(Rectangle value1, Rectangle value2)
value1
- The first Rectangle to contain.value2
- The second Rectangle to contain.public static void Union(Rectangle value1, Rectangle value2, Rectangle result)
value1
- The first Rectangle to contain.value2
- The second Rectangle to contain.result
- [OutAttribute] The Rectangle that must be the union of the first two rectangles.