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/Layer/LayerManager.cs')
-rw-r--r--UVtools.Core/Layer/LayerManager.cs22
1 files changed, 20 insertions, 2 deletions
diff --git a/UVtools.Core/Layer/LayerManager.cs b/UVtools.Core/Layer/LayerManager.cs
index d38383f..f568714 100644
--- a/UVtools.Core/Layer/LayerManager.cs
+++ b/UVtools.Core/Layer/LayerManager.cs
@@ -37,7 +37,6 @@ namespace UVtools.Core
Rotate,
Solidify,
PixelDimming,
- //LayerSmash,
Erode,
Dilate,
Opening,
@@ -46,6 +45,7 @@ namespace UVtools.Core
TopHat,
BlackHat,
HitMiss,
+ ThresholdPixels,
PyrDownUp,
SmoothMedian,
SmoothGaussian,
@@ -53,7 +53,7 @@ namespace UVtools.Core
#endregion
#region Properties
- public FileFormats.FileFormat SlicerFile { get; private set; }
+ public FileFormat SlicerFile { get; private set; }
/// <summary>
/// Layers List
@@ -620,6 +620,22 @@ namespace UVtools.Core
progress.Token.ThrowIfCancellationRequested();
}
+ public void MutateThresholdPixels(uint startLayerIndex, uint endLayerIndex, byte threshold, byte maximum, ThresholdType thresholdType, OperationProgress progress)
+ {
+ if (ReferenceEquals(progress, null)) progress = new OperationProgress();
+ progress.Reset("Thresholding", endLayerIndex - startLayerIndex + 1);
+ Parallel.For(startLayerIndex, endLayerIndex + 1, layerIndex =>
+ {
+ if (progress.Token.IsCancellationRequested) return;
+ this[layerIndex].MutateThresholdPixels(threshold, maximum, thresholdType);
+ lock (progress.Mutex)
+ {
+ progress++;
+ }
+ });
+ progress.Token.ThrowIfCancellationRequested();
+ }
+
public void MutatePyrDownUp(uint startLayerIndex, uint endLayerIndex, BorderType borderType = BorderType.Default, OperationProgress progress = null)
{
if (ReferenceEquals(progress, null)) progress = new OperationProgress();
@@ -1480,6 +1496,8 @@ namespace UVtools.Core
PositionZ = (float) (operation.LayerHeight * (newLayerIndex + 1)),
ExposureTime = oldLayer.ExposureTime,
BoundingRectangle = oldLayer.BoundingRectangle,
+ NonZeroPixelCount = oldLayer.NonZeroPixelCount
+
};
newLayerIndex++;
progress++;