Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/sn4k3/UVtools.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'UVtools.Core/Operations/OperationLithophane.cs')
-rw-r--r--UVtools.Core/Operations/OperationLithophane.cs38
1 files changed, 20 insertions, 18 deletions
diff --git a/UVtools.Core/Operations/OperationLithophane.cs b/UVtools.Core/Operations/OperationLithophane.cs
index d497e36..e40caa7 100644
--- a/UVtools.Core/Operations/OperationLithophane.cs
+++ b/UVtools.Core/Operations/OperationLithophane.cs
@@ -91,31 +91,33 @@ public class OperationLithophane : Operation
{
sb.AppendLine("The selected file does not exists");
}
-
- if (_startThresholdRange > _endThresholdRange)
- {
- sb.AppendLine("Start threshold can't be higher than end threshold");
- }
-
- using var mat = GetSourceMat();
- if (mat is null)
- {
- sb.AppendLine("Unable to generate the mat from source file, is it a valid image file?");
- }
else
{
- if (SlicerFile.ResolutionX < mat.Width * _resizeFactor / 100 || SlicerFile.ResolutionY < mat.Height * _resizeFactor / 100)
+ using var mat = GetSourceMat();
+ if (mat is null)
{
- //int differenceX = (int)SlicerFile.ResolutionX - mat.Width;
- //int differenceY = (int)SlicerFile.ResolutionY - mat.Height;
- var scaleX = SlicerFile.ResolutionX * 100f / mat.Width;
- var scaleY = SlicerFile.ResolutionY * 100f / mat.Height;
- var maxScale = Math.Min(scaleX, scaleY);
+ sb.AppendLine("Unable to generate the mat from source file, is it a valid image file?");
+ }
+ else
+ {
+ if (SlicerFile.ResolutionX < mat.Width * _resizeFactor / 100 || SlicerFile.ResolutionY < mat.Height * _resizeFactor / 100)
+ {
+ //int differenceX = (int)SlicerFile.ResolutionX - mat.Width;
+ //int differenceY = (int)SlicerFile.ResolutionY - mat.Height;
+ var scaleX = SlicerFile.ResolutionX * 100f / mat.Width;
+ var scaleY = SlicerFile.ResolutionY * 100f / mat.Height;
+ var maxScale = Math.Min(scaleX, scaleY);
- sb.AppendLine($"The printer resolution is not enough to accomodate the lithophane image, please scale down to a maximum of {maxScale:F0}%");
+ sb.AppendLine($"The printer resolution is not enough to accomodate the lithophane image, please scale down to a maximum of {maxScale:F0}%");
+ }
}
}
+ if (_startThresholdRange > _endThresholdRange)
+ {
+ sb.AppendLine("Start threshold can't be higher than end threshold");
+ }
+
return sb.ToString();
}