Table of Contents

Struct Padding

Namespace
MLEM.Maths
Assembly
MLEM.dll

Represents a generic padding. A padding is an object of data that stores an offset from each side of a rectangle or square.

[DataContract]
public struct Padding : IEquatable<Padding>
Implements
Inherited Members

Constructors

Padding(Padding, float)

Creates a new padding from an existing padding, modifying it by growing or shrinking it.

public Padding(Padding padding, float growth)

Parameters

padding Padding

The padding whose initial values to use

growth float

The amount to grow each border by. Negative values will shrink the padding.

Padding(float)

Creates a new padding with the specified value, which will be applied to each edge.

public Padding(float value)

Parameters

value float

The padding to apply to each edge

Padding(float, float)

Creates a new padding with the specified x and y values, applying them to both edges.

public Padding(float x, float y)

Parameters

x float

The x padding, which will turn into the left and right padding

y float

The y padding, which till turn into the top and bottom padding

Padding(float, float, float, float)

Create a new padding with the specified borders.

public Padding(float left, float right, float top, float bottom)

Parameters

left float

The amount of padding on the left side

right float

The amount of padding on the right side

top float

The amount of padding on the top side

bottom float

The amount of padding on the bottom side

Fields

Bottom

The amount of padding on the bottom side

[DataMember]
public float Bottom

Field Value

float

Left

The amount of padding on the left side

[DataMember]
public float Left

Field Value

float

Right

The amount of padding on the right side

[DataMember]
public float Right

Field Value

float

Top

The amount of padding on the top side

[DataMember]
public float Top

Field Value

float

Properties

Empty

The empty padding, with all borders set to 0

public static Padding Empty { get; }

Property Value

Padding

Height

The total height of this padding, a sum of the top and bottom padding.

public float Height { get; }

Property Value

float

Width

The total width of this padding, a sum of the left and right padding.

public float Width { get; }

Property Value

float

Methods

Equals(Padding)

Indicates whether this instance and a specified object are equal.

public bool Equals(Padding other)

Parameters

other Padding

Returns

bool

true if obj and this instance are the same type and represent the same value; otherwise, false.

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.

Operators

operator +(Padding, Padding)

Adds two paddings together in a memberwise fashion.

public static Padding operator +(Padding left, Padding right)

Parameters

left Padding
right Padding

Returns

Padding

operator ==(Padding, Padding)

Indicates whether this instance and a specified object are equal.

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

Parameters

left Padding
right Padding

Returns

bool

true if obj and this instance are the same type and represent the same value; otherwise, false.

implicit operator Padding(Vector2)

Implicitly creates a padding from the given two-dimensional vector. The left and right padding will both be the vector's x value, and the top and bottom padding will both be the vector's y value.

public static implicit operator Padding(Vector2 vec)

Parameters

vec Vector2

The vector to convert

Returns

Padding

A padding based on the vector's values

operator !=(Padding, Padding)

Indicates whether this instance and a specified object are equal.

public static bool operator !=(Padding left, Padding right)

Parameters

left Padding
right Padding

Returns

bool

true if obj and this instance are the same type and represent the same value; otherwise, false.

operator *(Padding, Vector2)

Scales a padding by a Microsoft.Xna.Framework.Vector2.

public static Padding operator *(Padding p, Vector2 scale)

Parameters

p Padding
scale Vector2

Returns

Padding

operator *(Padding, float)

Scales a padding by a scalar.

public static Padding operator *(Padding p, float scale)

Parameters

p Padding
scale float

Returns

Padding

operator -(Padding, Padding)

Subtracts two paddings in a memberwise fashion.

public static Padding operator -(Padding left, Padding right)

Parameters

left Padding
right Padding

Returns

Padding