namespace WPFluent.Hardware; /// /// Stores DPI information from which a or is rendered. /// public readonly struct DisplayDpi { /// /// Initializes a new instance of the structure. /// /// The DPI scale on the X axis. /// The DPI scale on the Y axis. public DisplayDpi(double dpiScaleX, double dpiScaleY) { DpiScaleX = dpiScaleX; DpiScaleY = dpiScaleY; DpiX = (int)Math.Round(DpiHelper.DefaultDpi * dpiScaleX, MidpointRounding.AwayFromZero); DpiY = (int)Math.Round(DpiHelper.DefaultDpi * dpiScaleY, MidpointRounding.AwayFromZero); } /// /// Initializes a new instance of the structure. /// /// The DPI on the X axis. /// The DPI on the Y axis. public DisplayDpi(int dpiX, int dpiY) { DpiX = dpiX; DpiY = dpiY; DpiScaleX = dpiX / (double)DpiHelper.DefaultDpi; DpiScaleY = dpiY / (double)DpiHelper.DefaultDpi; } /// /// Gets the DPI scale on the X axis. /// public double DpiScaleX { get; } /// /// Gets the DPI scale on the Y axis. /// public double DpiScaleY { get; } /// /// Gets the DPI on the X axis. /// public int DpiX { get; } /// /// Gets the DPI on the Y axis. /// public int DpiY { get; } }