Struct Rectangle
Represents a normalized image rectangle using 16.16 fixed-point coordinates.
public readonly struct Rectangle : IEquatable<Rectangle>
- Implements
- Inherited Members
Constructors
Rectangle(FixedPoint32, FixedPoint32, FixedPoint32, FixedPoint32)
Represents a normalized image rectangle using 16.16 fixed-point coordinates.
public Rectangle(FixedPoint32 _x, FixedPoint32 _y, FixedPoint32 _w, FixedPoint32 _h)
Parameters
_xFixedPoint32The left coordinate.
_yFixedPoint32The top coordinate.
_wFixedPoint32The width.
_hFixedPoint32The height.
Properties
Bottom
Gets the bottom edge.
public FixedPoint32 Bottom { get; }
Property Value
Center
Gets the center point.
public (FixedPoint32 x, FixedPoint32 y) Center { get; }
Property Value
Diameter
Gets the diagonal length of the rectangle.
public FixedPoint32 Diameter { get; }
Property Value
H
Gets the height.
public FixedPoint32 H { get; }
Property Value
Left
Gets the left edge.
public FixedPoint32 Left { get; }
Property Value
Right
Gets the right edge.
public FixedPoint32 Right { get; }
Property Value
Top
Gets the top edge.
public FixedPoint32 Top { get; }
Property Value
W
Gets the width.
public FixedPoint32 W { get; }
Property Value
X
Gets the left coordinate.
public FixedPoint32 X { get; }
Property Value
Y
Gets the top coordinate.
public FixedPoint32 Y { get; }
Property Value
Methods
Contains(Rectangle)
Determines whether this rectangle fully contains another rectangle.
public bool Contains(Rectangle other)
Parameters
otherRectangle
Returns
Equals(object)
Indicates whether this instance and a specified object are equal.
public override bool Equals(object obj)
Parameters
objobjectThe object to compare with the current instance.
Returns
- bool
true if
objand this instance are the same type and represent the same value; otherwise, false.
Equals(Rectangle)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(Rectangle other)
Parameters
otherRectangleAn object to compare with this object.
Returns
FromFloat(float, float, float, float)
Creates a rectangle from floating-point coordinates.
public static Rectangle FromFloat(float x, float y, float w, float h)
Parameters
Returns
FromJson(JObject)
Creates a rectangle from a JSON object containing raw fixed-point values.
public static Rectangle FromJson(JObject jsonObject)
Parameters
jsonObjectJObject
Returns
FromJsonString(string)
Deserializes a rectangle from JSON text.
public static Rectangle FromJsonString(string jsonString)
Parameters
jsonStringstring
Returns
FromRawValues(int, int, int, int)
Creates a rectangle from raw 16.16 fixed-point coordinates.
public static Rectangle FromRawValues(int x, int y, int w, int h)
Parameters
Returns
GetHashCode()
Returns the hash code for this instance.
public override int GetHashCode()
Returns
- int
A 32-bit signed integer that is the hash code for this instance.
ToJson()
Converts the rectangle to a JSON object containing raw fixed-point values.
public JObject ToJson()
Returns
- JObject
ToJsonString()
Serializes the rectangle to compact JSON.
public string ToJsonString()
Returns
- string
The serialized rectangle.
ToString()
Formats the rectangle as its X, Y, width, and height values.
public override string ToString()
Returns
Operators
operator ==(Rectangle, Rectangle)
Determines whether two rectangles are equal.
public static bool operator ==(Rectangle lhs, Rectangle rhs)
Parameters
Returns
operator !=(Rectangle, Rectangle)
Determines whether two rectangles are not equal.
public static bool operator !=(Rectangle lhs, Rectangle rhs)