Rectangle

struct Rectangle : System.ValueType, System.IEquatable<Rectangle>

Describes a 2D-rectangle.

int X

The x coordinate of the top-left corner of this T:Microsoft.Xna.Framework.Rectangle.

int Y

The y coordinate of the top-left corner of this T:Microsoft.Xna.Framework.Rectangle.

int Width

The width of this T:Microsoft.Xna.Framework.Rectangle.

int Height

The height of this T:Microsoft.Xna.Framework.Rectangle.

readonly Rectangle Empty

Returns a T:Microsoft.Xna.Framework.Rectangle with X=0, Y=0, Width=0, Height=0.

readonly int Left

Returns the x coordinate of the left edge of this T:Microsoft.Xna.Framework.Rectangle.

readonly int Right

Returns the x coordinate of the right edge of this T:Microsoft.Xna.Framework.Rectangle.

readonly int Top

Returns the y coordinate of the top edge of this T:Microsoft.Xna.Framework.Rectangle.

readonly int Bottom

Returns the y coordinate of the bottom edge of this T:Microsoft.Xna.Framework.Rectangle.

readonly bool IsEmpty

Whether or not this T:Microsoft.Xna.Framework.Rectangle has a F:Microsoft.Xna.Framework.Rectangle.Width and F:Microsoft.Xna.Framework.Rectangle.Height of 0, and a P:Microsoft.Xna.Framework.Rectangle.Location of (0, 0).

Point Location

The top-left coordinates of this T:Microsoft.Xna.Framework.Rectangle.

Point Size

The width-height coordinates of this T:Microsoft.Xna.Framework.Rectangle.

readonly Point Center

A T:Microsoft.Xna.Framework.Point located in the center of this T:Microsoft.Xna.Framework.Rectangle.

string get_DebugDisplayString()
bool op_Equality(Rectangle a, Rectangle b)

Compares whether two T:Microsoft.Xna.Framework.Rectangle instances are equal.

Parameters:
  • a (Microsoft.Xna.Framework.Rectangle) – T:Microsoft.Xna.Framework.Rectangle instance on the left of the equal sign.
  • b (Microsoft.Xna.Framework.Rectangle) – T:Microsoft.Xna.Framework.Rectangle instance on the right of the equal sign.
Returns:

true if the instances are equal; false otherwise.

bool op_Inequality(Rectangle a, Rectangle b)

Compares whether two T:Microsoft.Xna.Framework.Rectangle instances are not equal.

Parameters:
  • a (Microsoft.Xna.Framework.Rectangle) – T:Microsoft.Xna.Framework.Rectangle instance on the left of the not equal sign.
  • b (Microsoft.Xna.Framework.Rectangle) – T:Microsoft.Xna.Framework.Rectangle instance on the right of the not equal sign.
Returns:

true if the instances are not equal; false otherwise.

bool Contains(int x, int y)

Gets whether or not the provided coordinates lie within the bounds of this T:Microsoft.Xna.Framework.Rectangle.

Parameters:
  • x (int) – The x coordinate of the point to check for containment.
  • y (int) – The y coordinate of the point to check for containment.
Returns:

true if the provided coordinates lie inside this T:Microsoft.Xna.Framework.Rectangle; false otherwise.

bool Contains(float x, float y)

Gets whether or not the provided coordinates lie within the bounds of this T:Microsoft.Xna.Framework.Rectangle.

Parameters:
  • x (float) – The x coordinate of the point to check for containment.
  • y (float) – The y coordinate of the point to check for containment.
Returns:

true if the provided coordinates lie inside this T:Microsoft.Xna.Framework.Rectangle; false otherwise.

bool Contains(Point value)

Gets whether or not the provided T:Microsoft.Xna.Framework.Point lies within the bounds of this T:Microsoft.Xna.Framework.Rectangle.

Parameters:
  • value (Microsoft.Xna.Framework.Point) – The coordinates to check for inclusion in this T:Microsoft.Xna.Framework.Rectangle.
Returns:

true if the provided T:Microsoft.Xna.Framework.Point lies inside this T:Microsoft.Xna.Framework.Rectangle; false otherwise.

void Contains(ref Point value, ref bool result)
Parameters:
  • (ref) value (Microsoft.Xna.Framework.Point) –
  • (ref) result (bool) –
bool Contains(Vector2 value)

Gets whether or not the provided T:Microsoft.Xna.Framework.Vector2 lies within the bounds of this T:Microsoft.Xna.Framework.Rectangle.

Parameters:
  • value (Microsoft.Xna.Framework.Vector2) – The coordinates to check for inclusion in this T:Microsoft.Xna.Framework.Rectangle.
Returns:

true if the provided T:Microsoft.Xna.Framework.Vector2 lies inside this T:Microsoft.Xna.Framework.Rectangle; false otherwise.

void Contains(ref Vector2 value, ref bool result)
Parameters:
  • (ref) value (Microsoft.Xna.Framework.Vector2) –
  • (ref) result (bool) –
bool Contains(Rectangle value)

Gets whether or not the provided T:Microsoft.Xna.Framework.Rectangle lies within the bounds of this T:Microsoft.Xna.Framework.Rectangle.

Parameters:
  • value (Microsoft.Xna.Framework.Rectangle) – The T:Microsoft.Xna.Framework.Rectangle to check for inclusion in this T:Microsoft.Xna.Framework.Rectangle.
Returns:

true if the provided T:Microsoft.Xna.Framework.Rectangle’s bounds lie entirely inside this T:Microsoft.Xna.Framework.Rectangle; false otherwise.

void Contains(ref Rectangle value, ref bool result)
Parameters:
  • (ref) value (Microsoft.Xna.Framework.Rectangle) –
  • (ref) result (bool) –
bool Equals(System.Object obj)

Compares whether current instance is equal to specified T:System.Object.

Parameters:
  • obj (System.Object) – The T:System.Object to compare.
Returns:

true if the instances are equal; false otherwise.

bool Equals(Rectangle other)

Compares whether current instance is equal to specified T:Microsoft.Xna.Framework.Rectangle.

Parameters:
  • other (Microsoft.Xna.Framework.Rectangle) – The T:Microsoft.Xna.Framework.Rectangle to compare.
Returns:

true if the instances are equal; false otherwise.

int GetHashCode()

Gets the hash code of this T:Microsoft.Xna.Framework.Rectangle.

Returns:Hash code of this T:Microsoft.Xna.Framework.Rectangle.
void Inflate(int horizontalAmount, int verticalAmount)

Adjusts the edges of this T:Microsoft.Xna.Framework.Rectangle by specified horizontal and vertical amounts.

Parameters:
  • horizontalAmount (int) – Value to adjust the left and right edges.
  • verticalAmount (int) – Value to adjust the top and bottom edges.
void Inflate(float horizontalAmount, float verticalAmount)

Adjusts the edges of this T:Microsoft.Xna.Framework.Rectangle by specified horizontal and vertical amounts.

Parameters:
  • horizontalAmount (float) – Value to adjust the left and right edges.
  • verticalAmount (float) – Value to adjust the top and bottom edges.
bool Intersects(Rectangle value)

Gets whether or not the other T:Microsoft.Xna.Framework.Rectangle intersects with this rectangle.

Parameters:
  • value (Microsoft.Xna.Framework.Rectangle) – The other rectangle for testing.
Returns:

true if other T:Microsoft.Xna.Framework.Rectangle intersects with this rectangle; false otherwise.

void Intersects(ref Rectangle value, ref bool result)
Parameters:
  • (ref) value (Microsoft.Xna.Framework.Rectangle) –
  • (ref) result (bool) –
Rectangle Intersect(Rectangle value1, Rectangle value2)

Creates a new T:Microsoft.Xna.Framework.Rectangle that contains overlapping region of two other rectangles.

Parameters:
  • value1 (Microsoft.Xna.Framework.Rectangle) – The first T:Microsoft.Xna.Framework.Rectangle.
  • value2 (Microsoft.Xna.Framework.Rectangle) – The second T:Microsoft.Xna.Framework.Rectangle.
Returns:

Overlapping region of the two rectangles.

void Intersect(ref Rectangle value1, ref Rectangle value2, ref Rectangle result)
Parameters:
  • (ref) value1 (Microsoft.Xna.Framework.Rectangle) –
  • (ref) value2 (Microsoft.Xna.Framework.Rectangle) –
  • (ref) result (Microsoft.Xna.Framework.Rectangle) –
void Offset(int offsetX, int offsetY)

Changes the P:Microsoft.Xna.Framework.Rectangle.Location of this T:Microsoft.Xna.Framework.Rectangle.

Parameters:
  • offsetX (int) – The x coordinate to add to this T:Microsoft.Xna.Framework.Rectangle.
  • offsetY (int) – The y coordinate to add to this T:Microsoft.Xna.Framework.Rectangle.
void Offset(float offsetX, float offsetY)

Changes the P:Microsoft.Xna.Framework.Rectangle.Location of this T:Microsoft.Xna.Framework.Rectangle.

Parameters:
  • offsetX (float) – The x coordinate to add to this T:Microsoft.Xna.Framework.Rectangle.
  • offsetY (float) – The y coordinate to add to this T:Microsoft.Xna.Framework.Rectangle.
void Offset(Point amount)

Changes the P:Microsoft.Xna.Framework.Rectangle.Location of this T:Microsoft.Xna.Framework.Rectangle.

Parameters:
  • amount (Microsoft.Xna.Framework.Point) – The x and y components to add to this T:Microsoft.Xna.Framework.Rectangle.
void Offset(Vector2 amount)

Changes the P:Microsoft.Xna.Framework.Rectangle.Location of this T:Microsoft.Xna.Framework.Rectangle.

Parameters:
  • amount (Microsoft.Xna.Framework.Vector2) – The x and y components to add to this T:Microsoft.Xna.Framework.Rectangle.
string ToString()

Returns a T:System.String representation of this T:Microsoft.Xna.Framework.Rectangle in the format: {X:[F:Microsoft.Xna.Framework.Rectangle.X] Y:[F:Microsoft.Xna.Framework.Rectangle.Y] Width:[F:Microsoft.Xna.Framework.Rectangle.Width] Height:[F:Microsoft.Xna.Framework.Rectangle.Height]}

Returns:T:System.String representation of this T:Microsoft.Xna.Framework.Rectangle.
Rectangle Union(Rectangle value1, Rectangle value2)

Creates a new T:Microsoft.Xna.Framework.Rectangle that completely contains two other rectangles.

Parameters:
  • value1 (Microsoft.Xna.Framework.Rectangle) – The first T:Microsoft.Xna.Framework.Rectangle.
  • value2 (Microsoft.Xna.Framework.Rectangle) – The second T:Microsoft.Xna.Framework.Rectangle.
Returns:

The union of the two rectangles.

void Union(ref Rectangle value1, ref Rectangle value2, ref Rectangle result)
Parameters:
  • (ref) value1 (Microsoft.Xna.Framework.Rectangle) –
  • (ref) value2 (Microsoft.Xna.Framework.Rectangle) –
  • (ref) result (Microsoft.Xna.Framework.Rectangle) –