Rectangle

Rectangle structure

Describes a rectangular area on a page or image, for example an OCR text bounds or a redaction box.

public struct Rectangle : IEquatable<Rectangle>

Constructors

Name Description
Rectangle(Point, Size) Creates a rectangle from a top-left point and region size.
Rectangle(int, int, int, int) Creates a rectangle from corner coordinates and dimensions.

Properties

Name Description
static Empty { get; } A rectangle with zero width and height at the origin.
Height { get; } Height of the area, in pixels.
Location { get; } Top-left corner of the rectangle.
Size { get; } Width and height of the rectangle.
Width { get; } Width of the area, in pixels.
X { get; } Horizontal position of the top-left corner, in pixels.
Y { get; } Vertical position of the top-left corner, in pixels.

Methods

Name Description
override Equals(object) Compares this rectangle with another object.
Equals(Rectangle) Compares bounds with another rectangle.
override GetHashCode() Returns a hash code derived from position and size.
override ToString() Returns the bounds in a readable form.

See Also