Show / Hide Table of Contents

Struct Rect

Rect - The primitive which represents a rectangle. Rects are stored as X, Y (Location) and Width and Height (Size). As a result, Rects cannot have negative Width or Height.

Inherited Members
System.Object.Equals(System.Object, System.Object)
System.Object.GetType()
System.Object.ReferenceEquals(System.Object, System.Object)
Namespace:ImGui
Assembly:ImGui.dll
Syntax
[Serializable]
public struct Rect : IFormattable

Constructors

| Improve this Doc

Rect(Point, Point)

Constructor which sets the initial values to bound the two points provided.

Declaration
public Rect(Point point1, Point point2)
Parameters
Type Name Description
Point point1
Point point2
| Improve this Doc

Rect(Point, Size)

Declaration
public Rect(Point center, Size size)
Parameters
Type Name Description
Point center
Size size
| Improve this Doc

Rect(Point, Vector)

Constructor which sets the initial values to bound the point provided and the point which results from point + vector.

Declaration
public Rect(Point point, Vector vector)
Parameters
Type Name Description
Point point
Vector vector
| Improve this Doc

Rect(Size)

Constructor which sets the initial values to bound the (0,0) point and the point that results from (0,0) + size.

Declaration
public Rect(Size size)
Parameters
Type Name Description
Size size
| Improve this Doc

Rect(Double, Double)

Construct a rect by its width and height (top-left is at (0,0))

Declaration
public Rect(double width, double height)
Parameters
Type Name Description
System.Double width

rect width

System.Double height

rect height

| Improve this Doc

Rect(Double, Double, Size)

Construct a rect by its top-left coordinate and its size(width, height)

Declaration
public Rect(double x, double y, Size size)
Parameters
Type Name Description
System.Double x

top

System.Double y

left

Size size

size of the rect

| Improve this Doc

Rect(Double, Double, Double, Double)

Constructor which sets the initial values to the values of the parameters. Width and Height must be non-negative

Declaration
public Rect(double x, double y, double width, double height)
Parameters
Type Name Description
System.Double x
System.Double y
System.Double width
System.Double height

Properties

| Improve this Doc

Big

Big - a static property which provides a Big rectangle. X and Y are zero and Width and Height are 9999.

Declaration
public static Rect Big { get; }
Property Value
Type Description
Rect
| Improve this Doc

Bottom

Bottom Property - This is a read-only alias for Y + Height If this is the empty rectangle, the value will be negative infinity.

Declaration
public double Bottom { get; }
Property Value
Type Description
System.Double
| Improve this Doc

BottomLeft

BottomLeft Property - This is a read-only alias for the Point which is at X, Y + Height If this is the empty rectangle, the value will be positive infinity, negative infinity.

Declaration
public Point BottomLeft { get; }
Property Value
Type Description
Point
| Improve this Doc

BottomRight

BottomRight Property - This is a read-only alias for the Point which is at X + Width, Y + Height If this is the empty rectangle, the value will be negative infinity, negative infinity.

Declaration
public Point BottomRight { get; }
Property Value
Type Description
Point
| Improve this Doc

Center

Declaration
public Point Center { get; }
Property Value
Type Description
Point
| Improve this Doc

Empty

Empty - a static property which provides an Empty rectangle. X and Y are positive-infinity and Width and Height are negative infinity. This is the only situation where Width or Height can be negative.

Declaration
public static Rect Empty { get; }
Property Value
Type Description
Rect
| Improve this Doc

Height

Height - The Height component of the Size. This cannot be set to negative, and will only be negative if this is the empty rectangle, in which case it will be negative infinity. If this rect is Empty, setting this property is illegal.

Declaration
public double Height { get; set; }
Property Value
Type Description
System.Double
| Improve this Doc

IsBig

IsBig - this returns true if this rect is the Big rectangle.

Declaration
public bool IsBig { get; }
Property Value
Type Description
System.Boolean
| Improve this Doc

IsEmpty

IsEmpty - this returns true if this rect is the Empty rectangle. Note: If width or height are 0 this Rectangle still contains a 0 or 1 dimensional set of points, so this method should not be used to check for 0 area.

Declaration
public bool IsEmpty { get; }
Property Value
Type Description
System.Boolean
| Improve this Doc

Left

Left Property - This is a read-only alias for X If this is the empty rectangle, the value will be positive infinity.

Declaration
public double Left { get; }
Property Value
Type Description
System.Double
| Improve this Doc

Location

Location - The Point representing the origin of the Rectangle

Declaration
public Point Location { get; set; }
Property Value
Type Description
Point
| Improve this Doc

Right

Right Property - This is a read-only alias for X + Width If this is the empty rectangle, the value will be negative infinity.

Declaration
public double Right { get; }
Property Value
Type Description
System.Double
| Improve this Doc

Size

Size - The Size representing the area of the Rectangle

Declaration
public Size Size { get; set; }
Property Value
Type Description
Size
| Improve this Doc

Top

Top Property - This is a read-only alias for Y If this is the empty rectangle, the value will be positive infinity.

Declaration
public double Top { get; }
Property Value
Type Description
System.Double
| Improve this Doc

TopLeft

TopLeft Property - This is a read-only alias for the Point which is at X, Y If this is the empty rectangle, the value will be positive infinity, positive infinity.

Declaration
public Point TopLeft { get; }
Property Value
Type Description
Point
| Improve this Doc

TopRight

TopRight Property - This is a read-only alias for the Point which is at X + Width, Y If this is the empty rectangle, the value will be negative infinity, positive infinity.

Declaration
public Point TopRight { get; }
Property Value
Type Description
Point
| Improve this Doc

Width

Width - The Width component of the Size. This cannot be set to negative, and will only be negative if this is the empty rectangle, in which case it will be negative infinity. If this rect is Empty, setting this property is illegal.

Declaration
public double Width { get; set; }
Property Value
Type Description
System.Double
| Improve this Doc

X

X - The X coordinate of the Location. If this is the empty rectangle, the value will be positive infinity. If this rect is Empty, setting this property is illegal.

Declaration
public double X { get; set; }
Property Value
Type Description
System.Double
| Improve this Doc

Y

Y - The Y coordinate of the Location If this is the empty rectangle, the value will be positive infinity. If this rect is Empty, setting this property is illegal.

Declaration
public double Y { get; set; }
Property Value
Type Description
System.Double
| Improve this Doc

Zero

Declaration
public static Rect Zero { get; }
Property Value
Type Description
Rect

Methods

| Improve this Doc

Contains(Point)

Contains - Returns true if the Point is within the rectangle, inclusive of the edges. Returns false otherwise.

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

The point which is being tested

Returns
Type Description
System.Boolean

Returns true if the Point is within the rectangle. Returns false otherwise

| Improve this Doc

Contains(Rect)

Contains - Returns true if the Rect non-Empty and is entirely contained within the rectangle, inclusive of the edges. Returns false otherwise

Declaration
public bool Contains(Rect rect)
Parameters
Type Name Description
Rect rect
Returns
Type Description
System.Boolean
| Improve this Doc

Contains(Double, Double)

Contains - Returns true if the Point represented by x,y is within the rectangle inclusive of the edges. Returns false otherwise.

Declaration
public bool Contains(double x, double y)
Parameters
Type Name Description
System.Double x

X coordinate of the point which is being tested

System.Double y

Y coordinate of the point which is being tested

Returns
Type Description
System.Boolean

Returns true if the Point represented by x,y is within the rectangle. Returns false otherwise.

| Improve this Doc

Equals(Rect)

Equals - compares this Rect with the passed in object. In this equality double.NaN is equal to itself, unlike in numeric equality. Note that double values can acquire error when operated upon, such that an exact comparison between two values which are logically equal may fail.

Declaration
public bool Equals(Rect value)
Parameters
Type Name Description
Rect value

The Rect to compare to "this"

Returns
Type Description
System.Boolean

bool - true if "value" is equal to "this".

| Improve this Doc

Equals(Rect, Rect)

Compares two Rect instances for object equality. In this equality double.NaN is equal to itself, unlike in numeric equality. Note that double values can acquire error when operated upon, such that an exact comparison between two values which are logically equal may fail.

Declaration
public static bool Equals(Rect rect1, Rect rect2)
Parameters
Type Name Description
Rect rect1

The first Rect to compare

Rect rect2

The second Rect to compare

Returns
Type Description
System.Boolean

bool - true if the two Rect instances are exactly equal, false otherwise

| Improve this Doc

Equals(Object)

Equals - compares this Rect with the passed in object. In this equality double.NaN is equal to itself, unlike in numeric equality. Note that double values can acquire error when operated upon, such that an exact comparison between two values which are logically equal may fail.

Declaration
public override bool Equals(object o)
Parameters
Type Name Description
System.Object o

The object to compare to "this"

Returns
Type Description
System.Boolean

bool - true if the object is an instance of Rect and if it's equal to "this".

Overrides
System.ValueType.Equals(System.Object)
| Improve this Doc

GetHashCode()

Returns the HashCode for this Rect

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

int - the HashCode for this Rect

Overrides
System.ValueType.GetHashCode()
| Improve this Doc

Inflate(Rect, Size)

Inflate - return the result of inflating rect by the size provided, in all directions If this is Empty, this method is illegal.

Declaration
public static Rect Inflate(Rect rect, Size size)
Parameters
Type Name Description
Rect rect
Size size
Returns
Type Description
Rect
| Improve this Doc

Inflate(Rect, Double, Double)

Inflate - return the result of inflating rect by the size provided, in all directions If this is Empty, this method is illegal.

Declaration
public static Rect Inflate(Rect rect, double width, double height)
Parameters
Type Name Description
Rect rect
System.Double width
System.Double height
Returns
Type Description
Rect
| Improve this Doc

Inflate(Rect, Double, Double, Double, Double)

Inflate - return the result of inflating rect by the size provided, in all four directions If any paramer is negative, this method is illegal. If this is Empty, this method is illegal.

Declaration
public static Rect Inflate(Rect rect, double top, double right, double bottom, double left)
Parameters
Type Name Description
Rect rect
System.Double top
System.Double right
System.Double bottom
System.Double left
Returns
Type Description
Rect
| Improve this Doc

Inflate(Size)

Inflate - inflate the bounds by the size provided, in all directions If this is Empty, this method is illegal.

Declaration
public void Inflate(Size size)
Parameters
Type Name Description
Size size
| Improve this Doc

Inflate(Double, Double)

Inflate - inflate the bounds by the size provided, in all directions. If -width is > Width / 2 or -height is > Height / 2, this Rect becomes Empty If this is Empty, this method is illegal.

Declaration
public void Inflate(double width, double height)
Parameters
Type Name Description
System.Double width
System.Double height
| Improve this Doc

Inflate(Double, Double, Double, Double)

Inflate - inflate the bounds by the value provided, in all four directions. If any paramer is negative, this method is illegal. If this is Empty, this method is illegal.

Declaration
public void Inflate(double top, double right, double bottom, double left)
Parameters
Type Name Description
System.Double top
System.Double right
System.Double bottom
System.Double left
| Improve this Doc

Intersect(Rect)

Intersect - Update this rectangle to be the intersection of this and rect If either this or rect are Empty, the result is Empty as well.

Declaration
public void Intersect(Rect rect)
Parameters
Type Name Description
Rect rect

The rect to intersect with this

| Improve this Doc

Intersect(Rect, Rect)

Intersect - Return the result of the intersection of rect1 and rect2. If either this or rect are Empty, the result is Empty as well.

Declaration
public static Rect Intersect(Rect rect1, Rect rect2)
Parameters
Type Name Description
Rect rect1
Rect rect2
Returns
Type Description
Rect
| Improve this Doc

IntersectsWith(Rect)

IntersectsWith - Returns true if the Rect intersects with this rectangle Returns false otherwise. Note that if one edge is coincident, this is considered an intersection.

Declaration
public bool IntersectsWith(Rect rect)
Parameters
Type Name Description
Rect rect

Rect

Returns
Type Description
System.Boolean

Returns true if the Rect intersects with this rectangle Returns false otherwise. or Height

| Improve this Doc

Offset(Rect, Vector)

Offset - return the result of offsetting rect by the offset provided If this is Empty, this method is illegal.

Declaration
public static Rect Offset(Rect rect, Vector offsetVector)
Parameters
Type Name Description
Rect rect
Vector offsetVector
Returns
Type Description
Rect
| Improve this Doc

Offset(Rect, Double, Double)

Offset - return the result of offsetting rect by the offset provided If this is Empty, this method is illegal.

Declaration
public static Rect Offset(Rect rect, double offsetX, double offsetY)
Parameters
Type Name Description
Rect rect
System.Double offsetX
System.Double offsetY
Returns
Type Description
Rect
| Improve this Doc

Offset(Vector)

Offset - translate the Location by the offset provided. If this is Empty, this method is illegal.

Declaration
public void Offset(Vector offsetVector)
Parameters
Type Name Description
Vector offsetVector
| Improve this Doc

Offset(Double, Double)

Offset - translate the Location by the offset provided If this is Empty, this method is illegal.

Declaration
public void Offset(double offsetX, double offsetY)
Parameters
Type Name Description
System.Double offsetX
System.Double offsetY
| Improve this Doc

Parse(String)

Parse - returns an instance converted from the provided string using the culture "en-US"

string with Rect data
Declaration
public static Rect Parse(string source)
Parameters
Type Name Description
System.String source
Returns
Type Description
Rect
| Improve this Doc

Scale(Double, Double)

Scale the rectangle in the X and Y directions

Declaration
public void Scale(double scaleX, double scaleY)
Parameters
Type Name Description
System.Double scaleX

The scale in X

System.Double scaleY

The scale in Y

| Improve this Doc

ToString()

Creates a string representation of this object based on the current culture.

Declaration
public override string ToString()
Returns
Type Description
System.String

A string representation of this object.

Overrides
System.ValueType.ToString()
| Improve this Doc

ToString(IFormatProvider)

Creates a string representation of this object based on the IFormatProvider passed in. If the provider is null, the CurrentCulture is used.

Declaration
public string ToString(IFormatProvider provider)
Parameters
Type Name Description
System.IFormatProvider provider
Returns
Type Description
System.String

A string representation of this object.

| Improve this Doc

Union(Point)

Union - Update this rectangle to be the union of this and point.

Declaration
public void Union(Point point)
Parameters
Type Name Description
Point point
| Improve this Doc

Union(Rect)

Union - Update this rectangle to be the union of this and rect.

Declaration
public void Union(Rect rect)
Parameters
Type Name Description
Rect rect
| Improve this Doc

Union(Rect, Point)

Union - Return the result of the union of rect and point.

Declaration
public static Rect Union(Rect rect, Point point)
Parameters
Type Name Description
Rect rect
Point point
Returns
Type Description
Rect
| Improve this Doc

Union(Rect, Rect)

Union - Return the result of the union of rect1 and rect2.

Declaration
public static Rect Union(Rect rect1, Rect rect2)
Parameters
Type Name Description
Rect rect1
Rect rect2
Returns
Type Description
Rect

Operators

| Improve this Doc

Equality(Rect, Rect)

Compares two Rect instances for exact equality. Note that double values can acquire error when operated upon, such that an exact comparison between two values which are logically equal may fail. Furthermore, using this equality operator, double.NaN is not equal to itself.

Declaration
public static bool operator ==(Rect rect1, Rect rect2)
Parameters
Type Name Description
Rect rect1

The first Rect to compare

Rect rect2

The second Rect to compare

Returns
Type Description
System.Boolean

bool - true if the two Rect instances are exactly equal, false otherwise

| Improve this Doc

Inequality(Rect, Rect)

Compares two Rect instances for exact inequality. Note that double values can acquire error when operated upon, such that an exact comparison between two values which are logically equal may fail. Furthermore, using this equality operator, double.NaN is not equal to itself.

Declaration
public static bool operator !=(Rect rect1, Rect rect2)
Parameters
Type Name Description
Rect rect1

The first Rect to compare

Rect rect2

The second Rect to compare

Returns
Type Description
System.Boolean

bool - true if the two Rect instances are exactly unequal, false otherwise

Explicit Interface Implementations

| Improve this Doc

IFormattable.ToString(String, IFormatProvider)

Creates a string representation of this object based on the format string and IFormatProvider passed in. If the provider is null, the CurrentCulture is used. See the documentation for IFormattable for more information.

Declaration
string IFormattable.ToString(string format, IFormatProvider provider)
Parameters
Type Name Description
System.String format
System.IFormatProvider provider
Returns
Type Description
System.String

A string representation of this object.

Implements
System.IFormattable.ToString(System.String, System.IFormatProvider)
  • Improve this Doc
Back to top Copyright © 2016 zwcloud
Generated by DocFX