1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-12-25 01:39:23 +01:00

added some padding utility constructors

This commit is contained in:
Ell 2020-10-25 01:33:05 +02:00
parent 3005b3edcb
commit e4081be2ce

View file

@ -46,6 +46,24 @@ namespace MLEM.Misc {
this.Bottom = bottom;
}
/// <summary>
/// Creates a new padding with the specified x and y values, applying them to both edges.
/// </summary>
/// <param name="x">The x padding, which will turn into the left and right padding</param>
/// <param name="y">The y padding, which till turn into the top and bottom padding</param>
public Padding(float x, float y) :
this(x, x, y, y) {
}
/// <summary>
/// Creates a new padding from an existing padding, modifying it by growing or shrinking it.
/// </summary>
/// <param name="padding">The padding whose initial values to use</param>
/// <param name="growth">The amount to grow each border by. Negative values will shrink the padding.</param>
public Padding(Padding padding, float growth) :
this(padding.Left + growth, padding.Right + growth, padding.Top + growth, padding.Bottom + growth) {
}
/// <summary>
/// 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.