Table of Contents

Struct Frame

Namespace
Xui.Core.Math2D
Assembly
Core.dll

Represents thickness values for each edge of a rectangular element.

public struct Frame
Inherited Members

Remarks

A Frame defines spacing from the left, top, right, and bottom edges. It is typically used for layout constructs such as Margin, Padding, or BorderWidth. Unlike Rect, it does not represent position or size—only edge offsets.

Constructors

Frame()

Initializes a new Frame with all edges set to zero.

public Frame()

Frame(NFloat, NFloat, NFloat, NFloat)

Initializes a new Frame with the specified edge thicknesses.

public Frame(NFloat top, NFloat right, NFloat bottom, NFloat left)

Parameters

top NFloat

Top edge thickness.

right NFloat

Right edge thickness.

bottom NFloat

Bottom edge thickness.

left NFloat

Left edge thickness.

Fields

Bottom

The thickness of the bottom edge.

public NFloat Bottom

Field Value

NFloat

Left

The thickness of the left edge.

public NFloat Left

Field Value

NFloat

Right

The thickness of the right edge.

public NFloat Right

Field Value

NFloat

Top

The thickness of the top edge.

public NFloat Top

Field Value

NFloat

Zero

A frame with all edge values set to zero.

public static readonly Frame Zero

Field Value

Frame

Properties

IsUniform

Returns true if all four edges have equal thickness.

public bool IsUniform { get; }

Property Value

bool

IsZero

Returns true if all sides (Left, Top, Right, Bottom) are zero.

public readonly bool IsZero { get; }

Property Value

bool

TotalHeight

Gets the total vertical edge thickness (top + bottom).

public NFloat TotalHeight { get; }

Property Value

NFloat

TotalWidth

Gets the total horizontal edge thickness (left + right).

public NFloat TotalWidth { get; }

Property Value

NFloat

Methods

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.

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.

Max(Frame, Frame)

Returns a frame containing the maximum value for each edge from two frames.

public static Frame Max(Frame lhs, Frame rhs)

Parameters

lhs Frame
rhs Frame

Returns

Frame

Min(Frame, Frame)

Returns a frame containing the minimum value for each edge from two frames.

public static Frame Min(Frame lhs, Frame rhs)

Parameters

lhs Frame
rhs Frame

Returns

Frame

ToString()

Returns the fully qualified type name of this instance.

public override string ToString()

Returns

string

The fully qualified type name.

Operators

operator +(Frame, Frame)

Adds the corresponding edge thicknesses of two frames.

public static Frame operator +(Frame lhs, Frame rhs)

Parameters

lhs Frame
rhs Frame

Returns

Frame

operator ==(Frame, Frame)

Returns true if all edge values match exactly.

public static bool operator ==(Frame left, Frame right)

Parameters

left Frame
right Frame

Returns

bool

implicit operator Frame(double)

Implicitly converts a double to a Frame, applying the same value to all four sides (Left, Top, Right, Bottom).

public static implicit operator Frame(double value)

Parameters

value double

The double value to apply uniformly to all sides.

Returns

Frame

A Frame with all sides set to value.

implicit operator Frame(int)

Implicitly converts an int to a Frame, applying the same value to all four sides (Left, Top, Right, Bottom).

public static implicit operator Frame(int value)

Parameters

value int

The integer value to apply uniformly to all sides.

Returns

Frame

A Frame with all sides set to value.

implicit operator Frame(NFloat)

Converts a scalar value into a uniform Frame for all sides.

public static implicit operator Frame(NFloat value)

Parameters

value NFloat

Returns

Frame

implicit operator Frame(float)

Implicitly converts a float to a Frame, applying the same value to all four sides (Left, Top, Right, Bottom).

public static implicit operator Frame(float value)

Parameters

value float

The float value to apply uniformly to all sides.

Returns

Frame

A Frame with all sides set to value.

implicit operator Frame((NFloat top, NFloat right, NFloat bottom, NFloat left))

Converts a 4-tuple (top, right, bottom, left) to a Frame.

public static implicit operator Frame((NFloat top, NFloat right, NFloat bottom, NFloat left) value)

Parameters

value (NFloat topLeft, NFloat topRight, NFloat bottomRight, NFloat bottomLeft)

Returns

Frame

implicit operator Frame((NFloat horizontal, NFloat vertical))

Converts a 2-tuple (horizontal, vertical) to a Frame. Horizontal is applied to left and right; vertical to top and bottom.

public static implicit operator Frame((NFloat horizontal, NFloat vertical) value)

Parameters

value (NFloat horizontal, NFloat vertical)

Returns

Frame

operator !=(Frame, Frame)

Returns true if any edge value differs.

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

Parameters

lhs Frame
rhs Frame

Returns

bool

operator *(Frame, NFloat)

Scales all edges of the frame by the specified scalar.

public static Frame operator *(Frame lhs, NFloat rhs)

Parameters

lhs Frame
rhs NFloat

Returns

Frame

operator -(Frame, Frame)

Subtracts the corresponding edge thicknesses of two frames.

public static Frame operator -(Frame lhs, Frame rhs)

Parameters

lhs Frame
rhs Frame

Returns

Frame