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:
authorTiago Conceição <Tiago_caza@hotmail.com>2021-10-04 06:06:29 +0300
committerTiago Conceição <Tiago_caza@hotmail.com>2021-10-04 06:06:29 +0300
commit6f97f2e4ff46a270b339c06e9394dbec8fcc5a23 (patch)
treec8c09413f8e8cdac1badfe9423c4a73fb8f78756
parentb80d0b7655dabe1db0ffa311bdbf211536759e5a (diff)
v2.23.3v2.23.3
- **Pixel arithmetic** - (Add) Apply to - Model surface: Apply only to model surface/visible pixels - (Add) Apply to - Model surface & inset: Apply only to model surface/visible pixels and within a inset from walls - (Add) Preset: Fuzy skin - (Improvement) Speed up the Corrode method - (Change) Heal anti-aliasing threshold from 169 to 119 - **Calibration - Grayscale:** - (Add) Enable or disable text - (Fix) Calibration - Grayscale: Crash program when redo (Ctrl+Z) - (Change) Some defaults to better values - (Fix) Layer arithmetic: Crash program when redo (Ctrl+Z)
-rw-r--r--CHANGELOG.md14
-rw-r--r--UVtools.Core/Extensions/EmguExtensions.cs42
-rw-r--r--UVtools.Core/FileFormats/CWSFile.cs32
-rw-r--r--UVtools.Core/Managers/IssueManager.cs9
-rw-r--r--UVtools.Core/Operations/Operation.cs4
-rw-r--r--UVtools.Core/Operations/OperationCalibrateGrayscale.cs61
-rw-r--r--UVtools.Core/Operations/OperationPixelArithmetic.cs38
-rw-r--r--UVtools.Core/Operations/OperationRedrawModel.cs6
-rw-r--r--UVtools.Core/Operations/OperationRepairLayers.cs2
-rw-r--r--UVtools.Core/UVtools.Core.csproj2
-rw-r--r--UVtools.WPF/Controls/Calibrators/CalibrateGrayscaleControl.axaml14
-rw-r--r--UVtools.WPF/Controls/Calibrators/CalibrateGrayscaleControl.axaml.cs2
-rw-r--r--UVtools.WPF/MainWindow.Issues.cs2
-rw-r--r--UVtools.WPF/MainWindow.LayerPreview.cs2
-rw-r--r--UVtools.WPF/UVtools.WPF.csproj2
-rw-r--r--UVtools.WPF/Windows/BenchmarkWindow.axaml.cs6
16 files changed, 152 insertions, 86 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 72f75b3..f8b5f3c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,19 @@
# Changelog
+## 04/10/2021 - v2.23.3
+
+- **Pixel arithmetic**
+ - (Add) Apply to - Model surface: Apply only to model surface/visible pixels
+ - (Add) Apply to - Model surface & inset: Apply only to model surface/visible pixels and within a inset from walls
+ - (Add) Preset: Fuzy skin
+ - (Improvement) Speed up the Corrode method
+ - (Change) Heal anti-aliasing threshold from 169 to 119
+- **Calibration - Grayscale:**
+ - (Add) Enable or disable text
+ - (Fix) Calibration - Grayscale: Crash program when redo (Ctrl+Z)
+ - (Change) Some defaults to better values
+- (Fix) Layer arithmetic: Crash program when redo (Ctrl+Z)
+
## 02/10/2021 - v2.23.2
- **Pixel arithmetic**
diff --git a/UVtools.Core/Extensions/EmguExtensions.cs b/UVtools.Core/Extensions/EmguExtensions.cs
index bb3674d..efb7327 100644
--- a/UVtools.Core/Extensions/EmguExtensions.cs
+++ b/UVtools.Core/Extensions/EmguExtensions.cs
@@ -181,9 +181,9 @@ namespace UVtools.Core.Extensions
/// </summary>
/// <param name="mat"></param>
/// <returns></returns>
- public static Span<byte> GetDataByteSpan(this Mat mat)
+ public static unsafe Span<byte> GetDataByteSpan(this Mat mat)
{
- return mat.GetDataSpan<byte>();
+ return new(mat.DataPointer.ToPointer(), mat.GetLength());
}
public static unsafe Span<byte> GetDataByteSpan(this Mat mat, int length, int offset = 0)
@@ -240,7 +240,7 @@ namespace UVtools.Core.Extensions
/// <returns></returns>
public static unsafe Span<T> GetRowSpan<T>(this Mat mat, int y, int length = 0, int offset = 0)
{
- return new(IntPtr.Add(mat.DataPointer, y * mat.Step + offset).ToPointer(), length <= 0 ? mat.Step : length);
+ return new(IntPtr.Add(mat.DataPointer, y * mat.GetRealStep() + offset).ToPointer(), length <= 0 ? mat.GetRealStep() : length);
}
/// <summary>
@@ -310,6 +310,18 @@ namespace UVtools.Core.Extensions
#endregion
#region Get/Set methods
+
+ /// <summary>
+ /// .Step return the original Mat step, if ROI step still from original matrix which lead to errors.
+ /// Use this to get the real step size
+ /// </summary>
+ /// <param name="mat"></param>
+ /// <returns></returns>
+ public static int GetRealStep(this Mat mat)
+ {
+ return mat.Width * mat.NumberOfChannels;
+ }
+
/// <summary>
/// Gets the total length of this <see cref="Mat"/></param>
/// </summary>
@@ -317,7 +329,7 @@ namespace UVtools.Core.Extensions
/// <returns>The total length of this <see cref="Mat"/></returns>
public static int GetLength(this Mat mat)
{
- return mat.Step * mat.Height;
+ return mat.Total.ToInt32();
}
/// <summary>
@@ -329,7 +341,7 @@ namespace UVtools.Core.Extensions
/// <returns>The pixel index position</returns>
public static int GetPixelPos(this Mat mat, int x, int y)
{
- return y * mat.Step + x * mat.NumberOfChannels;
+ return y * mat.GetRealStep() + x * mat.NumberOfChannels;
}
/// <summary>
@@ -340,7 +352,7 @@ namespace UVtools.Core.Extensions
/// <returns>The pixel index position</returns>
public static int GetPixelPos(this Mat mat, Point point)
{
- return point.Y * mat.Step + point.X * mat.NumberOfChannels;
+ return mat.GetPixelPos(point.X, point.Y);
}
/// <summary>
@@ -421,7 +433,7 @@ namespace UVtools.Core.Extensions
/// <param name="y"></param>
/// <param name="value"></param>
public static void SetByte(this Mat mat, int x, int y, byte[] value) =>
- SetByte(mat, y * mat.Step + x * mat.NumberOfChannels, value);
+ SetByte(mat, y * mat.GetRealStep() + x * mat.NumberOfChannels, value);
/// <summary>
/// Sets bytes
@@ -451,6 +463,12 @@ namespace UVtools.Core.Extensions
return mask;
}
+ public static Mat CreateMask(this Mat src, Point[][] contours)
+ {
+ using var vec = new VectorOfVectorOfPoint(contours);
+ return src.CreateMask(vec);
+ }
+
#endregion
#region Copy methods
@@ -461,16 +479,18 @@ namespace UVtools.Core.Extensions
/// <param name="dst">Target <see cref="Mat"/> to paste the <param name="src"></param></param>
public static void CopyToCenter(this Mat src, Mat dst)
{
- if (dst.Step > src.Step && dst.Height > src.Height)
+ var srcStep = src.GetRealStep();
+ var dstStep = dst.GetRealStep();
+ if (dstStep > srcStep && dst.Height > src.Height)
{
- var dx = Math.Abs(dst.Step - src.Step) / 2;
+ var dx = Math.Abs(dstStep - srcStep) / 2;
var dy = Math.Abs(dst.Height - src.Height) / 2;
Mat m = new(dst, new Rectangle(dx, dy, src.Width, src.Height));
src.CopyTo(m);
}
- else if (dst.Step < src.Step && dst.Height < src.Height)
+ else if (dstStep < srcStep && dst.Height < src.Height)
{
- var dx = Math.Abs(dst.Step - src.Step) / 2;
+ var dx = Math.Abs(dstStep - srcStep) / 2;
var dy = Math.Abs(dst.Height - src.Height) / 2;
Mat m = new(src, new Rectangle(dx, dy, dst.Width, dst.Height));
m.CopyTo(dst);
diff --git a/UVtools.Core/FileFormats/CWSFile.cs b/UVtools.Core/FileFormats/CWSFile.cs
index 4cfed0e..97b9f8f 100644
--- a/UVtools.Core/FileFormats/CWSFile.cs
+++ b/UVtools.Core/FileFormats/CWSFile.cs
@@ -670,22 +670,20 @@ namespace UVtools.Core.FileFormats
var layer = this[layerIndex];
var layerImagePath = layer.FormatFileName(filename);
- using (var mat = layer.LayerMat)
- using (var matEncode = new Mat(mat.Height, mat.Step / 3, DepthType.Cv8U, 3))
+ using var mat = layer.LayerMat;
+ using var matEncode = new Mat(mat.Height, mat.GetRealStep() / 3, DepthType.Cv8U, 3);
+ var span = mat.GetDataByteSpan();
+ var spanEncode = matEncode.GetDataByteSpan();
+ for (int i = 0; i < span.Length; i++)
{
- var span = mat.GetDataSpan<byte>();
- var spanEncode = matEncode.GetDataSpan<byte>();
- for (int i = 0; i < span.Length; i++)
- {
- spanEncode[i] = span[i];
- }
+ spanEncode[i] = span[i];
+ }
- var bytes = matEncode.GetPngByes();
- lock (progress.Mutex)
- {
- outputFile.PutFileContent(layerImagePath, bytes, ZipArchiveMode.Create);
- progress++;
- }
+ var bytes = matEncode.GetPngByes();
+ lock (progress.Mutex)
+ {
+ outputFile.PutFileContent(layerImagePath, bytes, ZipArchiveMode.Create);
+ progress++;
}
});
}
@@ -869,9 +867,9 @@ namespace UVtools.Core.FileFormats
var layer = this[layerIndex];
using Mat mat = new();
CvInvoke.Imdecode(layer.CompressedBytes, ImreadModes.Color, mat);
- using Mat matDecode = new(mat.Height, mat.Step, DepthType.Cv8U, 1);
- var span = mat.GetDataSpan<byte>();
- var spanDecode = matDecode.GetDataSpan<byte>();
+ using Mat matDecode = new(mat.Height, mat.GetRealStep(), DepthType.Cv8U, 1);
+ var span = mat.GetDataByteSpan();
+ var spanDecode = matDecode.GetDataByteSpan();
for (int i = 0; i < span.Length; i++)
{
spanDecode[i] = span[i];
diff --git a/UVtools.Core/Managers/IssueManager.cs b/UVtools.Core/Managers/IssueManager.cs
index 74022be..515b492 100644
--- a/UVtools.Core/Managers/IssueManager.cs
+++ b/UVtools.Core/Managers/IssueManager.cs
@@ -218,7 +218,7 @@ namespace UVtools.Core.Managers
using (var image = layer.LayerMat)
{
- int step = image.Step;
+ var step = image.GetRealStep();
var span = image.GetDataByteSpan();
if (touchBoundConfig.Enabled)
@@ -396,7 +396,7 @@ namespace UVtools.Core.Managers
if (previousImage is null)
{
previousImage = SlicerFile[layerIndex - 1].LayerMat;
- previousSpan = previousImage.GetDataSpan<byte>();
+ previousSpan = previousImage.GetDataByteSpan();
}
List<Point> points = new();
@@ -463,10 +463,11 @@ namespace UVtools.Core.Managers
anchor, overhangConfig.ErodeIterations, BorderType.Default,
new MCvScalar());
- var subtractedSpan = subtractedImage.GetDataSpan<byte>();
+ var subtractedSpan = subtractedImage.GetDataByteSpan();
+ var subtractedStep = subtractedImage.GetRealStep();
for (int y = 0; y < subtractedImage.Height; y++)
- for (int x = 0; x < subtractedImage.Step; x++)
+ for (int x = 0; x < subtractedStep; x++)
{
int labelX = rect.X + x;
int labelY = rect.Y + y;
diff --git a/UVtools.Core/Operations/Operation.cs b/UVtools.Core/Operations/Operation.cs
index 3fa0261..5623ea6 100644
--- a/UVtools.Core/Operations/Operation.cs
+++ b/UVtools.Core/Operations/Operation.cs
@@ -455,9 +455,7 @@ namespace UVtools.Core.Operations
{
if (!HaveMask) return null;
- var mask = EmguExtensions.InitMat(mat.Size);
- using VectorOfVectorOfPoint vec = new(points);
- CvInvoke.DrawContours(mask, vec, -1, EmguExtensions.WhiteColor, -1);
+ var mask = mat.CreateMask(points);
return GetRoiOrDefault(mask);
}
diff --git a/UVtools.Core/Operations/OperationCalibrateGrayscale.cs b/UVtools.Core/Operations/OperationCalibrateGrayscale.cs
index 1928bcd..91d3b66 100644
--- a/UVtools.Core/Operations/OperationCalibrateGrayscale.cs
+++ b/UVtools.Core/Operations/OperationCalibrateGrayscale.cs
@@ -26,19 +26,20 @@ namespace UVtools.Core.Operations
#region Members
private decimal _layerHeight;
private ushort _bottomLayers;
- private ushort _interfaceLayers = 5;
- private ushort _normalLayers = 30;
+ private ushort _interfaceLayers = 20;
+ private ushort _normalLayers = 20;
private decimal _bottomExposure;
private decimal _normalExposure;
private ushort _outerMargin = 200;
private ushort _innerMargin = 50;
- private bool _enableAntiAliasing = true;
+ private bool _enableAntiAliasing = false;
private bool _mirrorOutput;
private byte _startBrightness = 175;
private byte _endBrightness = 255;
private byte _brightnessSteps = 10;
private bool _enableCenterHoleRelief = true;
private ushort _centerHoleDiameter = 200;
+ private bool _textEnabled = true;
private bool _convertBrightnessToExposureTime;
private bool _enableLineDivisions = true;
private byte _lineDivisionThickness = 30;
@@ -269,6 +270,12 @@ namespace UVtools.Core.Operations
set => RaiseAndSetIfChanged(ref _centerHoleDiameter, value);
}
+ public bool TextEnabled
+ {
+ get => _textEnabled;
+ set => RaiseAndSetIfChanged(ref _textEnabled, value);
+ }
+
public bool ConvertBrightnessToExposureTime
{
get => _convertBrightnessToExposureTime;
@@ -311,7 +318,7 @@ namespace UVtools.Core.Operations
private bool Equals(OperationCalibrateGrayscale other)
{
- return _layerHeight == other._layerHeight && _bottomLayers == other._bottomLayers && _normalLayers == other._normalLayers && _interfaceLayers == other._interfaceLayers && _bottomExposure == other._bottomExposure && _normalExposure == other._normalExposure && _outerMargin == other._outerMargin && _innerMargin == other._innerMargin && _startBrightness == other._startBrightness && _endBrightness == other._endBrightness && _brightnessSteps == other._brightnessSteps && _enableCenterHoleRelief == other._enableCenterHoleRelief && _centerHoleDiameter == other._centerHoleDiameter && _enableLineDivisions == other._enableLineDivisions && _lineDivisionThickness == other._lineDivisionThickness && _lineDivisionBrightness == other._lineDivisionBrightness && _textXOffset == other._textXOffset && _enableAntiAliasing == other._enableAntiAliasing && _mirrorOutput == other._mirrorOutput;
+ return _layerHeight == other._layerHeight && _bottomLayers == other._bottomLayers && _interfaceLayers == other._interfaceLayers && _normalLayers == other._normalLayers && _bottomExposure == other._bottomExposure && _normalExposure == other._normalExposure && _outerMargin == other._outerMargin && _innerMargin == other._innerMargin && _enableAntiAliasing == other._enableAntiAliasing && _mirrorOutput == other._mirrorOutput && _startBrightness == other._startBrightness && _endBrightness == other._endBrightness && _brightnessSteps == other._brightnessSteps && _enableCenterHoleRelief == other._enableCenterHoleRelief && _centerHoleDiameter == other._centerHoleDiameter && _textEnabled == other._textEnabled && _convertBrightnessToExposureTime == other._convertBrightnessToExposureTime && _enableLineDivisions == other._enableLineDivisions && _lineDivisionThickness == other._lineDivisionThickness && _lineDivisionBrightness == other._lineDivisionBrightness && _textXOffset == other._textXOffset;
}
public override bool Equals(object obj)
@@ -324,8 +331,8 @@ namespace UVtools.Core.Operations
var hashCode = new HashCode();
hashCode.Add(_layerHeight);
hashCode.Add(_bottomLayers);
- hashCode.Add(_normalLayers);
hashCode.Add(_interfaceLayers);
+ hashCode.Add(_normalLayers);
hashCode.Add(_bottomExposure);
hashCode.Add(_normalExposure);
hashCode.Add(_outerMargin);
@@ -337,6 +344,8 @@ namespace UVtools.Core.Operations
hashCode.Add(_brightnessSteps);
hashCode.Add(_enableCenterHoleRelief);
hashCode.Add(_centerHoleDiameter);
+ hashCode.Add(_textEnabled);
+ hashCode.Add(_convertBrightnessToExposureTime);
hashCode.Add(_enableLineDivisions);
hashCode.Add(_lineDivisionThickness);
hashCode.Add(_lineDivisionBrightness);
@@ -363,11 +372,13 @@ namespace UVtools.Core.Operations
int innerRadius = Math.Max(100, radius - _innerMargin);
double topLineLength = 0;
- CvInvoke.Circle(layers[0], center, radius, EmguExtensions.WhiteColor, -1, LineType.AntiAlias);
+ LineType lineType = _enableAntiAliasing ? LineType.AntiAlias : LineType.EightConnected;
+
+ CvInvoke.Circle(layers[0], center, radius, EmguExtensions.WhiteColor, -1, lineType);
layers[1] = layers[0].Clone();
layers[2] = layers[0].Clone();
- LineType lineType = _enableAntiAliasing ? LineType.AntiAlias : LineType.EightConnected;
+
int i = 0;
for (ushort brightness = _startBrightness; brightness <= _endBrightness; brightness += _brightnessSteps)
@@ -397,30 +408,36 @@ namespace UVtools.Core.Operations
i++;
}
-
+
+
FontFace fontFace = FontFace.HersheyDuplex;
double fontScale = 2;
int fontThickness = 5;
- Point fontPoint = new((int) (center.X + radius / 2.5f + _textXOffset), (int)(center.Y + AngleStep / 1.5));
- var halfAngleStep = AngleStep / 2;
- var rotatedAngle = halfAngleStep;
+ if (_textEnabled)
+ {
+ Point fontPoint = new((int)(center.X + radius / 2.5f + _textXOffset), (int)(center.Y + AngleStep / 1.5));
+ var halfAngleStep = AngleStep / 2;
+ var rotatedAngle = halfAngleStep;
- layers[2].Rotate(halfAngleStep);
- for (ushort brightness = _startBrightness; brightness <= _endBrightness; brightness += _brightnessSteps)
- {
- var text = brightness.ToString();
- if (_convertBrightnessToExposureTime)
+
+ layers[2].Rotate(halfAngleStep);
+ for (ushort brightness = _startBrightness; brightness <= _endBrightness; brightness += _brightnessSteps)
{
- text = $"{Math.Round(brightness * _normalExposure / byte.MaxValue, 2)}s";
+ var text = brightness.ToString();
+ if (_convertBrightnessToExposureTime)
+ {
+ text = $"{Math.Round(brightness * _normalExposure / byte.MaxValue, 2)}s";
+ }
+
+ CvInvoke.PutText(layers[2], text, fontPoint, fontFace, fontScale, EmguExtensions.BlackColor, fontThickness, lineType);
+ rotatedAngle += AngleStep;
+ layers[2].Rotate(AngleStep);
}
- CvInvoke.PutText(layers[2], text, fontPoint, fontFace, fontScale, EmguExtensions.BlackColor, fontThickness, lineType);
- rotatedAngle += AngleStep;
- layers[2].Rotate(AngleStep);
+
+ layers[2].Rotate(-rotatedAngle);
}
-
- layers[2].Rotate(-rotatedAngle);
if (_enableCenterHoleRelief && _centerHoleDiameter > 1)
{
diff --git a/UVtools.Core/Operations/OperationPixelArithmetic.cs b/UVtools.Core/Operations/OperationPixelArithmetic.cs
index 8026a58..65a0b8b 100644
--- a/UVtools.Core/Operations/OperationPixelArithmetic.cs
+++ b/UVtools.Core/Operations/OperationPixelArithmetic.cs
@@ -733,19 +733,33 @@ namespace UVtools.Core.Operations
if (_applyMethod != PixelArithmeticApplyMethod.All) ApplyMask(originalRoi, target, applyMask);
break;
case PixelArithmeticOperators.Corrode:
- var span = target.GetDataByteSpan();
- var spanMask = applyMask.GetDataByteSpan();
-
- for (var i = 0; i < span.Length; i++)
+ var span = mat.GetDataByteSpan();
+ if (HaveROI)
{
- if (span[i] <= _noiseThreshold || spanMask[i] == 0) continue;
- span[i] = (byte)Math.Clamp(RandomNumberGenerator.GetInt32(_noiseMinOffset, _noiseMaxOffset + 1) + span[i], byte.MinValue, byte.MaxValue);
+ for (var y = ROI.Y; y < ROI.Bottom; y++)
+ for (var x = ROI.X; x < ROI.Right; x++)
+ {
+ var pos = mat.GetPixelPos(x, y);
+ if (span[pos] <= _noiseThreshold) continue;
+ span[pos] = (byte)Math.Clamp(RandomNumberGenerator.GetInt32(_noiseMinOffset, _noiseMaxOffset + 1) + span[pos], byte.MinValue, byte.MaxValue);
+ }
+
+ if (_applyMethod
+ is not PixelArithmeticApplyMethod.All
+ and not PixelArithmeticApplyMethod.Model)
+ ApplyMask(originalRoi, target, applyMask);
}
+ else // Whole image
+ {
+ var spanMask = applyMask is null ? span : applyMask.GetDataByteSpan();
- /*if (_applyMethod
- is not PixelArithmeticApplyMethod.All
- and not PixelArithmeticApplyMethod.Model)
- ApplyMask(originalRoi, target, applyMask);*/
+ for (var i = 0; i < span.Length; i++)
+ {
+ if (span[i] <= _noiseThreshold || spanMask[i] == 0) continue;
+ span[i] = (byte)Math.Clamp(RandomNumberGenerator.GetInt32(_noiseMinOffset, _noiseMaxOffset + 1) + span[i], byte.MinValue, byte.MaxValue);
+ }
+ }
+
break;
case PixelArithmeticOperators.KeepRegion:
{
@@ -951,7 +965,7 @@ namespace UVtools.Core.Operations
ApplyMethod = PixelArithmeticApplyMethod.ModelSurfaceAndInset;
NoiseMinOffset = -200;
NoiseMaxOffset = 127;
- WallThickness = 4;
+ WallThickness = 6;
}
public void PresetStripAntiAliasing()
@@ -969,7 +983,7 @@ namespace UVtools.Core.Operations
Operator = PixelArithmeticOperators.Threshold;
ApplyMethod = PixelArithmeticApplyMethod.All;
UsePattern = false;
- Value = 169;
+ Value = 119;
//ThresholdMaxValue = 255;
ThresholdType = ThresholdType.ToZero;
}
diff --git a/UVtools.Core/Operations/OperationRedrawModel.cs b/UVtools.Core/Operations/OperationRedrawModel.cs
index cd51814..b4e3637 100644
--- a/UVtools.Core/Operations/OperationRedrawModel.cs
+++ b/UVtools.Core/Operations/OperationRedrawModel.cs
@@ -188,9 +188,9 @@ namespace UVtools.Core.Operations
if (contours.Size <= 0) return;
using var nextLayerMat = otherFile[layerIndex + 1].LayerMat;
using var nextLayerMatRoi = GetRoiOrDefault(nextLayerMat);
- var fullSpan = fullMatRoi.GetDataSpan<byte>();
- var supportsSpan = supportsMat.GetDataSpan<byte>();
- var nextSpan = nextLayerMatRoi.GetDataSpan<byte>();
+ var fullSpan = fullMatRoi.GetDataByteSpan();
+ var supportsSpan = supportsMat.GetDataByteSpan();
+ var nextSpan = nextLayerMatRoi.GetDataByteSpan();
for (int i = 0; i < contours.Size; i++)
{
var foundContour = false;
diff --git a/UVtools.Core/Operations/OperationRepairLayers.cs b/UVtools.Core/Operations/OperationRepairLayers.cs
index ba74114..6123229 100644
--- a/UVtools.Core/Operations/OperationRepairLayers.cs
+++ b/UVtools.Core/Operations/OperationRepairLayers.cs
@@ -410,7 +410,7 @@ namespace UVtools.Core.Operations
if (issue.PixelsCount > _removeIslandsBelowEqualPixelCount) continue;
InitImage();
- if (bytes == null) bytes = image.GetDataSpan<byte>();
+ if (bytes == null) bytes = image.GetDataByteSpan();
foreach (var issuePixel in issue.Points)
{
diff --git a/UVtools.Core/UVtools.Core.csproj b/UVtools.Core/UVtools.Core.csproj
index b9d50a4..1f8f028 100644
--- a/UVtools.Core/UVtools.Core.csproj
+++ b/UVtools.Core/UVtools.Core.csproj
@@ -10,7 +10,7 @@
<RepositoryUrl>https://github.com/sn4k3/UVtools</RepositoryUrl>
<PackageProjectUrl>https://github.com/sn4k3/UVtools</PackageProjectUrl>
<Description>MSLA/DLP, file analysis, calibration, repair, conversion and manipulation</Description>
- <Version>2.23.2</Version>
+ <Version>2.23.3</Version>
<Copyright>Copyright © 2020 PTRTECH</Copyright>
<PackageIcon>UVtools.png</PackageIcon>
<Platforms>AnyCPU;x64</Platforms>
diff --git a/UVtools.WPF/Controls/Calibrators/CalibrateGrayscaleControl.axaml b/UVtools.WPF/Controls/Calibrators/CalibrateGrayscaleControl.axaml
index 1b6f95c..b4453dd 100644
--- a/UVtools.WPF/Controls/Calibrators/CalibrateGrayscaleControl.axaml
+++ b/UVtools.WPF/Controls/Calibrators/CalibrateGrayscaleControl.axaml
@@ -222,12 +222,16 @@
IsChecked="{Binding Operation.EnableCenterHoleRelief}"/>
- <StackPanel Grid.Row="6" Grid.Column="2" Grid.ColumnSpan="9"
- Orientation="Horizontal" Spacing="20">
+ <StackPanel Grid.Row="6" Grid.Column="2" Grid.ColumnSpan="9" Orientation="Horizontal" Spacing="20">
<CheckBox VerticalAlignment="Center"
- ToolTip.Tip="Convert the raw brightness text value to exposure time in seconds and intrude on divisions"
- Content="Convert brightness to exposure time"
- IsChecked="{Binding Operation.ConvertBrightnessToExposureTime}"/>
+ ToolTip.Tip="Show divisions text"
+ Content="Enable text"
+ IsChecked="{Binding Operation.TextEnabled}"/>
+
+ <CheckBox VerticalAlignment="Center"
+ ToolTip.Tip="Convert the raw brightness text value to exposure time in seconds and intrude on divisions"
+ Content="Convert brightness to exposure time"
+ IsChecked="{Binding Operation.ConvertBrightnessToExposureTime}"/>
<CheckBox VerticalAlignment="Center"
Content="Enable division lines"
diff --git a/UVtools.WPF/Controls/Calibrators/CalibrateGrayscaleControl.axaml.cs b/UVtools.WPF/Controls/Calibrators/CalibrateGrayscaleControl.axaml.cs
index 02a7a81..5a0987f 100644
--- a/UVtools.WPF/Controls/Calibrators/CalibrateGrayscaleControl.axaml.cs
+++ b/UVtools.WPF/Controls/Calibrators/CalibrateGrayscaleControl.axaml.cs
@@ -59,7 +59,7 @@ namespace UVtools.WPF.Controls.Calibrators
return;
}
};
- ParentWindow.ButtonOkEnabled = Operation.Divisions > 0;
+ if(ParentWindow is not null) ParentWindow.ButtonOkEnabled = Operation.Divisions > 0;
_timer.Stop();
_timer.Start();
break;
diff --git a/UVtools.WPF/MainWindow.Issues.cs b/UVtools.WPF/MainWindow.Issues.cs
index 7d58dbe..6cc6122 100644
--- a/UVtools.WPF/MainWindow.Issues.cs
+++ b/UVtools.WPF/MainWindow.Issues.cs
@@ -179,7 +179,7 @@ namespace UVtools.WPF
if (Progress.Token.IsCancellationRequested) return;
using (var image = SlicerFile[layerIssues.Key].LayerMat)
{
- var bytes = image.GetDataSpan<byte>();
+ var bytes = image.GetDataByteSpan();
bool edited = false;
foreach (var issue in layerIssues.Value)
diff --git a/UVtools.WPF/MainWindow.LayerPreview.cs b/UVtools.WPF/MainWindow.LayerPreview.cs
index 83b3393..a6844f8 100644
--- a/UVtools.WPF/MainWindow.LayerPreview.cs
+++ b/UVtools.WPF/MainWindow.LayerPreview.cs
@@ -890,7 +890,7 @@ namespace UVtools.WPF
//var nextSpan = nextImage.GetPixelSpan<byte>();
- int width = LayerCache.Image.Step;
+ int width = LayerCache.Image.GetRealStep();
int channels = LayerCache.ImageBgr.NumberOfChannels;
bool showSimilarityInstead =
Settings.LayerPreview.LayerDifferenceHighlightSimilarityInstead;
diff --git a/UVtools.WPF/UVtools.WPF.csproj b/UVtools.WPF/UVtools.WPF.csproj
index 4bc429d..337e15e 100644
--- a/UVtools.WPF/UVtools.WPF.csproj
+++ b/UVtools.WPF/UVtools.WPF.csproj
@@ -12,7 +12,7 @@
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<RepositoryUrl>https://github.com/sn4k3/UVtools</RepositoryUrl>
<RepositoryType>Git</RepositoryType>
- <Version>2.23.2</Version>
+ <Version>2.23.3</Version>
<Platforms>AnyCPU;x64</Platforms>
</PropertyGroup>
diff --git a/UVtools.WPF/Windows/BenchmarkWindow.axaml.cs b/UVtools.WPF/Windows/BenchmarkWindow.axaml.cs
index 762eafe..2e0c5e3 100644
--- a/UVtools.WPF/Windows/BenchmarkWindow.axaml.cs
+++ b/UVtools.WPF/Windows/BenchmarkWindow.axaml.cs
@@ -217,7 +217,7 @@ namespace UVtools.WPF.Windows
public byte[] EncodeCbddlpImage(Mat image, byte bit = 0)
{
List<byte> rawData = new();
- var span = image.GetDataSpan<byte>();
+ var span = image.GetDataByteSpan();
bool obit = false;
int rep = 0;
@@ -279,7 +279,7 @@ namespace UVtools.WPF.Windows
List<byte> rawData = new();
byte color = byte.MaxValue >> 1;
uint stride = 0;
- var span = image.GetDataSpan<byte>();
+ var span = image.GetDataByteSpan();
void AddRep()
{
@@ -357,7 +357,7 @@ namespace UVtools.WPF.Windows
public byte[] EncodePW0Image(Mat image)
{
List<byte> rawData = new();
- var span = image.GetDataSpan<byte>();
+ var span = image.GetDataByteSpan();
int lastColor = -1;
int reps = 0;