---
Product: psd
Platform: net
Page Type: reference
Canonical URL: https://reference.aspose.org/psd/net/rectangle
---

# Rectangle

## Overview

`Rectangle` is a struct in Aspose.PSD FOSS for .NET.
Inherits from: `IEquatable<Rectangle>`.

Stores a set of four integers that represent the location and size of a rectangle.

This struct declares 24 methods for Rectangle objects in .NET programs.
Available methods include: `Ceiling`, `Contains`, `Equals`, `FromLeftTopRightBottom`, `FromPoints`, `GetHashCode`, `Inflate`, `Intersect`, `IntersectsWith`, `Normalize`, `Offset`, `Rectangle`, and 4 additional methods.
Public members are accessible to any .NET application after installing the Aspose.PSD FOSS for .NET package.
Properties: `Bottom`, `Empty`, `Height`, `IsEmpty`, `Left`, `Location`, and 6 more.

## Properties

| Name | Type | Access | Description |
|------|------|--------|-------------|
| `X` | `int` | Read/Write | Gets or sets the x-coordinate of the upper-left corner of this Rectangle. |
| `Y` | `int` | Read/Write | Gets or sets the y-coordinate of the upper-left corner of this Rectangle. |
| `Width` | `int` | Read/Write | Gets or sets the width of this Rectangle. |
| `Height` | `int` | Read/Write | Gets or sets the height of this Rectangle. |
| `Bottom` | `int` | Read/Write | Gets or sets the y-coordinate of the bottom edge of this Rectangle. |
| `IsEmpty` | `bool` | Read | Gets a value indicating whether this Rectangle has no location or size. |
| `Left` | `int` | Read/Write | Gets or sets the x-coordinate of the left edge of this Rectangle. |
| `Location` | `Point` | Read/Write | Gets or sets the coordinates of the upper-left corner of this Rectangle. |
| `Right` | `int` | Read/Write | Gets or sets the x-coordinate of the right edge of this Rectangle. |
| `Size` | `Size` | Read/Write | Gets or sets the size of this Rectangle. |
| `Top` | `int` | Read/Write | Gets or sets the y-coordinate of the top edge of this Rectangle. |
| `Empty` | `Rectangle` | Read | Represents a Rectangle structure with its properties left uninitialized. |

## Methods

| Signature | Description |
|-----------|-------------|
| `Rectangle(location: Point, size: Size)` | Initializes a new instance of the Rectangle structure with the specified location and size. |
| `Rectangle(x: int, y: int, width: int, height: int)` | Initializes a new instance of the Rectangle structure with the specified coordinates. |
| `Ceiling(value: RectangleF)` | Converts a RectangleF structure to a Rectangle structure by rounding up the coordinates and size. |
| `FromLeftTopRightBottom(left: int, top: int, right: int, bottom: int)` | Creates a rectangle from edge coordinates. |
| `FromPoints(point1: Point, point2: Point)` | Creates a rectangle that spans the specified points. |
| `Inflate(rectangle: Rectangle, x: int, y: int)` | Creates and returns an inflated copy of the specified rectangle. |
| `Intersect(a: Rectangle, b: Rectangle)` | Returns a rectangle that represents the intersection of two rectangles. |
| `Round(value: RectangleF)` | Converts a RectangleF structure to a Rectangle structure by rounding the coordinates and size. |
| `Truncate(value: RectangleF)` | Converts a RectangleF structure to a Rectangle structure by truncating the coordinates and size. |
| `Union(a: Rectangle, b: Rectangle)` | Returns a rectangle that contains the union of two rectangles. |
| `Contains(point: Point)` | Determines whether the specified point is contained within this Rectangle. |
| `Contains(rectangle: Rectangle)` | Determines whether the rectangular region represented by the specified rectangle is entirely contained within this Rectangle. |
| `Contains(x: int, y: int)` | Determines whether the specified point is contained within this Rectangle. |
| `Equals(other: Rectangle)` | Determines whether the specified rectangle is equal to this rectangle. |
| `Equals(obj: object?)` | Determines whether the specified object is equal to this rectangle. |
| `GetHashCode()` | Returns a hash code for this rectangle. |
| `Inflate(size: Size)` | Inflates this rectangle by the specified size. |
| `Inflate(width: int, height: int)` | Inflates this rectangle by the specified horizontal and vertical amounts. |
| `Intersect(rectangle: Rectangle)` | Replaces this rectangle with its intersection with the specified rectangle. |
| `IntersectsWith(rectangle: Rectangle)` | Determines whether this rectangle intersects with the specified rectangle. |
| `Normalize()` | Normalizes this rectangle so that width and height are non-negative. |
| `Offset(point: Point)` | Moves this rectangle by the specified point. |
| `Offset(x: int, y: int)` | Moves this rectangle by the specified horizontal and vertical amounts. |
| `ToString()` | Returns a string representation of this rectangle. |

## See Also

- [Aspose.PSD for .NET — Enterprise API Reference](https://reference.aspose.com/psd/net/)