mirror of
https://github.com/riegera2412/UVtools.git
synced 2026-07-08 17:42:31 +02:00
9276735203
- **File formats:** - (Add) AnyCubic PM3R (#587) - (Add) AnyCubic PMX2 - (Fix) LGS: `LightOffDelay` is `WaitTimeBeforeCure` in this format - **PrusaSlicer printer:** - (Add) AnyCubic Photon M3 Premium - (Add) AnyCubic Photon Mono X2 - (Fix) Scripting: Unable to use sub-classes (#583) - (Fix) Loading an image as file cause application to crash - (Fix) "File - Send to" doesn't ignore case on file extension names resulting in ignore files in a uppercase even if extension is correct - (Fix) Do not show layer material milliliters when value is 0 or the percentage is NaN - (Fix) Auto-upgrade on Linux with AppImage integrated on system causes the file name to grow with hash strings
56 lines
2.2 KiB
C#
56 lines
2.2 KiB
C#
/*
|
|
* GNU AFFERO GENERAL PUBLIC LICENSE
|
|
* Version 3, 19 November 2007
|
|
* Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
|
* Everyone is permitted to copy and distribute verbatim copies
|
|
* of this license document, but changing it is not allowed.
|
|
*/
|
|
|
|
using System.Drawing;
|
|
using UVtools.Core.Extensions;
|
|
|
|
namespace UVtools.Core.Printer
|
|
{
|
|
/// <summary>
|
|
/// Utility methods over a printer screen
|
|
/// </summary>
|
|
public static class Screen
|
|
{
|
|
/// <summary>
|
|
/// Gets the pixel size in mm
|
|
/// </summary>
|
|
/// <param name="resolution">Resolution in pixels</param>
|
|
/// <param name="displaySize">Display size in mm</param>
|
|
/// <returns>Pixel size in mm</returns>
|
|
public static float GetPixelSize(int resolution, float displaySize) => resolution == 0 ? 0 : displaySize / resolution;
|
|
|
|
/// <summary>
|
|
/// Gets the pixel size in microns
|
|
/// </summary>
|
|
/// <param name="resolution">Resolution in pixels</param>
|
|
/// <param name="displaySize">Display size in mm</param>
|
|
/// <returns>Pixel size in microns</returns>
|
|
public static ushort GetPixelSizeMicrons(int resolution, float displaySize) => (ushort)(GetPixelSize(resolution, displaySize) * 1000);
|
|
|
|
/// <summary>
|
|
/// Gets the pixel size in mm
|
|
/// </summary>
|
|
/// <param name="resolution">Resolution in pixels</param>
|
|
/// <param name="displaySize">Display size in mm</param>
|
|
/// <returns>Pixel size in mm</returns>
|
|
public static SizeF GetPixelSize(Size resolution, SizeF displaySize) => displaySize.Divide(resolution);
|
|
|
|
/// <summary>
|
|
/// Gets the pixel size in microns
|
|
/// </summary>
|
|
/// <param name="resolution">Resolution in pixels</param>
|
|
/// <param name="displaySize">Display size in mm</param>
|
|
/// <returns>Pixel size in microns</returns>
|
|
public static Size GetPixelSizeMicrons(Size resolution, SizeF displaySize)
|
|
{
|
|
var pixel = GetPixelSize(resolution, displaySize);
|
|
return new Size((int)(pixel.Width * 1000), (int)(pixel.Height * 1000));
|
|
}
|
|
}
|
|
}
|