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.WPF/Controls/KernelControl.axaml.cs')
-rw-r--r--UVtools.WPF/Controls/KernelControl.axaml.cs36
1 files changed, 17 insertions, 19 deletions
diff --git a/UVtools.WPF/Controls/KernelControl.axaml.cs b/UVtools.WPF/Controls/KernelControl.axaml.cs
index 3c8926b..1e4535a 100644
--- a/UVtools.WPF/Controls/KernelControl.axaml.cs
+++ b/UVtools.WPF/Controls/KernelControl.axaml.cs
@@ -46,7 +46,7 @@ namespace UVtools.WPF.Controls
set => RaiseAndSetIfChanged(ref _matrixHeight, value);
}
- public Size MatrixSize => new Size((int)_matrixWidth, (int)_matrixHeight);
+ public Size MatrixSize => new((int)_matrixWidth, (int)_matrixHeight);
public int AnchorX
{
@@ -61,7 +61,7 @@ namespace UVtools.WPF.Controls
}
- public Point Anchor => new Point(_anchorX, _anchorY);
+ public Point Anchor => new(_anchorX, _anchorY);
public KernelControl()
@@ -90,28 +90,26 @@ namespace UVtools.WPF.Controls
return;
}
- using (var kernel = CvInvoke.GetStructuringElement(SelectedKernelShape, MatrixSize, Anchor))
+ using var kernel = CvInvoke.GetStructuringElement(SelectedKernelShape, MatrixSize, Anchor);
+ string text = string.Empty;
+ for (int y = 0; y < kernel.Height; y++)
{
- string text = string.Empty;
- for (int y = 0; y < kernel.Height; y++)
+ var span = kernel.GetPixelRowSpan<byte>(y);
+ var line = string.Empty;
+ for (int x = 0; x < span.Length; x++)
{
- var span = kernel.GetPixelRowSpan<byte>(y);
- var line = string.Empty;
- for (int x = 0; x < span.Length; x++)
- {
- line += $" {span[x]}";
- }
-
- line = line.Remove(0, 1);
- text += line;
- if (y < kernel.Height - 1)
- {
- text += '\n';
- }
+ line += $" {span[x]}";
}
- MatrixText = text;
+ line = line.Remove(0, 1);
+ text += line;
+ if (y < kernel.Height - 1)
+ {
+ text += '\n';
+ }
}
+
+ MatrixText = text;
}
public void ResetKernel()