Table of Contents

Struct Rect

Namespace
OpenCvSharp
Assembly
OpenCvSharp.dll

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

[Serializable]
public record struct Rect : IEquatable<Rect>
Implements
Inherited Members

Constructors

Rect(Point, Size)

Initializes a new instance of the Rectangle class with the specified location and size.

Rect(int, int, int, int)

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

Fields

Height

The height of the rectangle.

Width

The width of the rectangle.

X

The x-coordinate of the upper-left corner of the rectangle.

Y

The y-coordinate of the upper-left corner of the rectangle.

Properties

Bottom

Gets the y-coordinate that is the sum of the Y and Height property values of this Rect structure.

BottomRight

Coordinate of the right-most rectangle corner [Point(X+Width, Y+Height)]

Left

Gets the x-coordinate of the left edge of this Rect structure.

Location

Coordinate of the left-most rectangle corner [Point(X, Y)]

Right

Gets the x-coordinate that is the sum of X and Width property values of this Rect structure.

Size

Size of the rectangle [CvSize(Width, Height)]

Top

Gets the y-coordinate of the top edge of this Rect structure.

TopLeft

Coordinate of the left-most rectangle corner [Point(X, Y)]

Methods

Add(Point)

Shifts rectangle by a certain offset

Add(Size)

Expands or shrinks rectangle by a certain amount

Contains(Point)

Determines if the specified point is contained within the rectangular region defined by this Rectangle.

Contains(Rect)

Determines if the specified rectangle is contained within the rectangular region defined by this Rectangle.

Contains(int, int)

Determines if the specified point is contained within the rectangular region defined by this Rectangle.

FromLTRB(int, int, int, int)

Creates a Rectangle structure with the specified edge locations.

Inflate(Rect, int, int)

Creates and returns an inflated copy of the specified Rect structure.

Inflate(Size)

Inflates this Rect by the specified amount.

Inflate(int, int)

Inflates this Rect by the specified amount.

Intersect(Rect)

Determines the Rect structure that represents the intersection of two rectangles.

Intersect(Rect, Rect)

Determines the Rect structure that represents the intersection of two rectangles.

IntersectsWith(Rect)

Determines if this rectangle intersects with rect.

Subtract(Point)

Shifts rectangle by a certain offset

Subtract(Size)

Expands or shrinks rectangle by a certain amount

Union(Rect)

Gets a Rect structure that contains the union of two Rect structures.

Union(Rect, Rect)

Gets a Rect structure that contains the union of two Rect structures.

Operators

operator +(Rect, Point)

Shifts rectangle by a certain offset

operator +(Rect, Size)

Expands or shrinks rectangle by a certain amount

operator &(Rect, Rect)

Determines the Rect structure that represents the intersection of two rectangles.

operator |(Rect, Rect)

Gets a Rect structure that contains the union of two Rect structures.

operator -(Rect, Point)

Shifts rectangle by a certain offset

operator -(Rect, Size)

Expands or shrinks rectangle by a certain amount