Table of Contents

Struct Rectangle

Namespace
TCSystem.MetaData
Assembly
TCSystem.MetaData.dll

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

_x FixedPoint32

The left coordinate.

_y FixedPoint32

The top coordinate.

_w FixedPoint32

The width.

_h FixedPoint32

The height.

Properties

Bottom

Gets the bottom edge.

public FixedPoint32 Bottom { get; }

Property Value

FixedPoint32

Center

Gets the center point.

public (FixedPoint32 x, FixedPoint32 y) Center { get; }

Property Value

(FixedPoint32 x, FixedPoint32 y)

Diameter

Gets the diagonal length of the rectangle.

public FixedPoint32 Diameter { get; }

Property Value

FixedPoint32

H

Gets the height.

public FixedPoint32 H { get; }

Property Value

FixedPoint32

Left

Gets the left edge.

public FixedPoint32 Left { get; }

Property Value

FixedPoint32

Right

Gets the right edge.

public FixedPoint32 Right { get; }

Property Value

FixedPoint32

Top

Gets the top edge.

public FixedPoint32 Top { get; }

Property Value

FixedPoint32

W

Gets the width.

public FixedPoint32 W { get; }

Property Value

FixedPoint32

X

Gets the left coordinate.

public FixedPoint32 X { get; }

Property Value

FixedPoint32

Y

Gets the top coordinate.

public FixedPoint32 Y { get; }

Property Value

FixedPoint32

Methods

Contains(Rectangle)

Determines whether this rectangle fully contains another rectangle.

public bool Contains(Rectangle other)

Parameters

other Rectangle

Returns

bool

Equals(object)

Indicates whether this instance and a specified object are equal.

public override bool Equals(object obj)

Parameters

obj object

The object to compare with the current instance.

Returns

bool

true if obj and 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

other Rectangle

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

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

x float
y float
w float
h float

Returns

Rectangle

FromJson(JObject)

Creates a rectangle from a JSON object containing raw fixed-point values.

public static Rectangle FromJson(JObject jsonObject)

Parameters

jsonObject JObject

Returns

Rectangle

FromJsonString(string)

Deserializes a rectangle from JSON text.

public static Rectangle FromJsonString(string jsonString)

Parameters

jsonString string

Returns

Rectangle

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

x int
y int
w int
h int

Returns

Rectangle

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

string

Operators

operator ==(Rectangle, Rectangle)

Determines whether two rectangles are equal.

public static bool operator ==(Rectangle lhs, Rectangle rhs)

Parameters

lhs Rectangle
rhs Rectangle

Returns

bool

operator !=(Rectangle, Rectangle)

Determines whether two rectangles are not equal.

public static bool operator !=(Rectangle lhs, Rectangle rhs)

Parameters

lhs Rectangle
rhs Rectangle

Returns

bool