using System.Drawing;
namespace LemonUI.Extensions
{
///
/// Extensions for the Size and SizeF classes.
///
public static class SizeExtensions
{
///
/// Converts an absolute 1080-based size into a relative one.
///
/// The absolute SizeF.
/// A new SizeF with relative values.
public static SizeF ToRelative(this SizeF size)
{
Screen.ToRelative(size.Width, size.Height, out float width, out float height);
return new SizeF(width, height);
}
///
/// Converts a normalized 0-1 size into an absolute one.
///
/// The relative SizeF.
/// A new SizeF with absolute values.
public static SizeF ToAbsolute(this SizeF size)
{
Screen.ToAbsolute(size.Width, size.Height, out float width, out float height);
return new SizeF(width, height);
}
}
}