Show / Hide Table of Contents

Class RectangleI

Represent a rectangle.

Inheritance
System.Object
RectangleI
Implements
System.IEquatable<RectangleI>
Namespace: BonEngineSharp.Framework
Assembly: BonEngineSharp.dll
Syntax
public sealed class RectangleI : ValueType, IEquatable<RectangleI>

Constructors

RectangleI(Int32, Int32, Int32, Int32)

Create the rectangle.

Declaration
public RectangleI(int x = 0, int y = 0, int width = 0, int height = 0)
Parameters
Type Name Description
System.Int32 x
System.Int32 y
System.Int32 width
System.Int32 height

Fields

Empty

An empty rectangle const.

Declaration
public static readonly RectangleI Empty
Field Value
Type Description
RectangleI

Height

Rectangle height.

Declaration
public int Height
Field Value
Type Description
System.Int32

Width

Rectangle width.

Declaration
public int Width
Field Value
Type Description
System.Int32

X

X position.

Declaration
public int X
Field Value
Type Description
System.Int32

Y

Y position.

Declaration
public int Y
Field Value
Type Description
System.Int32

Properties

Bottom

Set / get rectangle bottom position.

Declaration
public int Bottom { get; set; }
Property Value
Type Description
System.Int32

Center

Get absolute center point. Check if contains a point.

Declaration
public PointI Center { get; }
Property Value
Type Description
PointI

Left

Set / get rectangle left position.

Declaration
public int Left { get; set; }
Property Value
Type Description
System.Int32

Right

Set / get rectangle right position.

Declaration
public int Right { get; set; }
Property Value
Type Description
System.Int32

Top

Set / get rectangle top position.

Declaration
public int Top { get; set; }
Property Value
Type Description
System.Int32

Methods

Clone()

Clone this rectangle.

Declaration
public RectangleI Clone()
Returns
Type Description
RectangleI

Cloned rectangle.

Contains(PointI)

Check if contains a point.

Declaration
public bool Contains(PointI point)
Parameters
Type Name Description
PointI point

Point to check.

Returns
Type Description
System.Boolean

If point is within the rectangle.

Contains(RectangleI)

Check if containing another rectangle.

Declaration
public bool Contains(RectangleI other)
Parameters
Type Name Description
RectangleI other

Other rectangle to test.

Returns
Type Description
System.Boolean

True if other rectangle is inside this rectangle.

Equals(RectangleI)

Check if this Rectangle equals to another Rectangle.

Declaration
public bool Equals(RectangleI other)
Parameters
Type Name Description
RectangleI other
Returns
Type Description
System.Boolean

Equals(Object)

Check if this Rectangle equals to another object.

Declaration
public override bool Equals(object obj)
Parameters
Type Name Description
System.Object obj
Returns
Type Description
System.Boolean

FromString(String)

Create rectangle from string.

Declaration
public static RectangleI FromString(string str)
Parameters
Type Name Description
System.String str

String to convert to rectangle (x,y,wight,height)

Returns
Type Description
RectangleI

Rectangle instance.

GetHashCode()

Implement hash code of color.

Declaration
public override int GetHashCode()
Returns
Type Description
System.Int32

Overlaps(RectangleI)

Check if intersects with or containing another rectangle.

Declaration
public bool Overlaps(RectangleI other)
Parameters
Type Name Description
RectangleI other

Other rectangle to check.

Returns
Type Description
System.Boolean

True if containing or intersecting with given rectangle.

Reset()

Reset the rectangle.

Declaration
public void Reset()

Set(Int32, Int32, Int32, Int32)

Set the rectangle components.

Declaration
public void Set(int x, int y, int w, int h)
Parameters
Type Name Description
System.Int32 x
System.Int32 y
System.Int32 w
System.Int32 h

Operators

Equality(RectangleI, RectangleI)

Implement == operator.

Declaration
public static bool operator ==(RectangleI obj1, RectangleI obj2)
Parameters
Type Name Description
RectangleI obj1
RectangleI obj2
Returns
Type Description
System.Boolean

Implicit(RectangleI to RectangleF)

Implicit conversion to RectangleF.

Declaration
public static implicit operator RectangleF(RectangleI p)
Parameters
Type Name Description
RectangleI p
Returns
Type Description
RectangleF

Inequality(RectangleI, RectangleI)

Implement != operator.

Declaration
public static bool operator !=(RectangleI obj1, RectangleI obj2)
Parameters
Type Name Description
RectangleI obj1
RectangleI obj2
Returns
Type Description
System.Boolean

Implements

System.IEquatable<>
Back to top Generated by DocFX