Struct Rectangle
Represents a rectangle defined by it's position and it's size.
Implements
Inherited Members
Namespace: RGB.NET.Core
Assembly: RGB.NET.Core.dll
Syntax
public readonly struct Rectangle : IEquatable<Rectangle>
Constructors
| Edit this page View SourceRectangle(Point, Size)
Declaration
public Rectangle(Point location, Size size)
Parameters
Type | Name | Description |
---|---|---|
Point | location | The location of this of this Rectangle. |
Size | size | The size of of this Rectangle. |
Rectangle(params Point[])
Initializes a new instance of the Rectangle class using the specified array of Point. The Location and Size is calculated to contain all points provided as parameters.
Declaration
public Rectangle(params Point[] points)
Parameters
Type | Name | Description |
---|---|---|
Point[] | points |
Rectangle(params Rectangle[])
Initializes a new instance of the Rectangle class using the specified array of Rectangle. The Location and Size is calculated to completely contain all rectangles provided as parameters.
Declaration
public Rectangle(params Rectangle[] rectangles)
Parameters
Type | Name | Description |
---|---|---|
Rectangle[] | rectangles | The array of Rectangle used to calculate the Location and Size. |
Rectangle(Size)
Declaration
public Rectangle(Size size)
Parameters
Type | Name | Description |
---|---|---|
Size | size | The size of of this Rectangle. |
Rectangle(IEnumerable<Point>)
Initializes a new instance of the Rectangle class using the specified list of Point. The Location and Size is calculated to contain all points provided as parameters.
Declaration
public Rectangle(IEnumerable<Point> points)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<Point> | points |
Rectangle(IEnumerable<Rectangle>)
Initializes a new instance of the Rectangle class using the specified list of Rectangle. The Location and Size is calculated to completely contain all rectangles provided as parameters.
Declaration
public Rectangle(IEnumerable<Rectangle> rectangles)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<Rectangle> | rectangles | The list of Rectangle used to calculate the Location and Size. |
Rectangle(float, float, float, float)
Declaration
public Rectangle(float x, float y, float width, float height)
Parameters
Type | Name | Description |
---|---|---|
float | x | The x-value of the RGB.NET.Core.Location of this Rectangle. |
float | y | The y-value of the RGB.NET.Core.Location-position of this Rectangle. |
float | width | |
float | height |
Properties
| Edit this page View SourceCenter
Declaration
public Point Center { get; }
Property Value
Type | Description |
---|---|
Point |
IsEmpty
Gets a bool indicating if both, the width and the height of the rectangle is greater than zero.
True
if the rectangle has a width or a height of zero; otherwise, false
.
Declaration
public bool IsEmpty { get; }
Property Value
Type | Description |
---|---|
bool |
Location
Declaration
public Point Location { get; }
Property Value
Type | Description |
---|---|
Point |
Size
Declaration
public Size Size { get; }
Property Value
Type | Description |
---|---|
Size |
Methods
| Edit this page View SourceEquals(Rectangle)
Declaration
public bool Equals(Rectangle other)
Parameters
Type | Name | Description |
---|---|---|
Rectangle | other | The rectangle to test. |
Returns
Type | Description |
---|---|
bool |
|
Equals(object?)
Declaration
public override bool Equals(object? obj)
Parameters
Type | Name | Description |
---|---|---|
object | obj | The object to test. |
Returns
Type | Description |
---|---|
bool |
|
Overrides
| Edit this page View SourceGetHashCode()
Returns a hash code for this Rectangle.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
int | An integer value that specifies the hash code for this Rectangle. |
Overrides
| Edit this page View SourceToString()
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
string | A string that contains the Location and Size of this Rectangle. For example "[Location: [X: 100, Y: 10], Size: [Width: 20, Height: [40]]". |
Overrides
Operators
| Edit this page View Sourceoperator /(in Rectangle, in Rectangle)
Returns a Rectangle normalized to the specified reference.
Declaration
public static Rectangle operator /(in Rectangle rectangle1, in Rectangle rectangle2)
Parameters
Type | Name | Description |
---|---|---|
Rectangle | rectangle1 | The rectangle to nromalize. |
Rectangle | rectangle2 | The reference used for normalization. |
Returns
Type | Description |
---|---|
Rectangle | A normalized rectangle. |
operator ==(in Rectangle, in Rectangle)
Returns a value that indicates whether two specified Rectangle are equal.
Declaration
public static bool operator ==(in Rectangle rectangle1, in Rectangle rectangle2)
Parameters
Type | Name | Description |
---|---|---|
Rectangle | rectangle1 | The first Rectangle to compare. |
Rectangle | rectangle2 | The second Rectangle to compare. |
Returns
Type | Description |
---|---|
bool |
|
operator !=(in Rectangle, in Rectangle)
Returns a value that indicates whether two specified Rectangle are equal.
Declaration
public static bool operator !=(in Rectangle rectangle1, in Rectangle rectangle2)
Parameters
Type | Name | Description |
---|---|---|
Rectangle | rectangle1 | The first Rectangle to compare. |
Rectangle | rectangle2 | The second Rectangle to compare. |
Returns
Type | Description |
---|---|
bool |
|