diff options
author | Tiago Conceição <Tiago_caza@hotmail.com> | 2021-10-02 19:07:41 +0300 |
---|---|---|
committer | Tiago Conceição <Tiago_caza@hotmail.com> | 2021-10-02 19:07:41 +0300 |
commit | 89b2798ad8aa8ce8b8fab738f7673ac029036339 (patch) | |
tree | 75e501a1081bf5e22270b4e0d29874a5b060379a | |
parent | 9fd51163b86318aae089f054c65f2f72b361661b (diff) |
v2.23.2v2.23.2
- **Pixel arithmetic**
- (Add) Corrode: Random dithering, use for eliminating visual prominence of layer lines. Can also be used to add a microtexture to enhance paint bonding (#307)
- (Add) Ignore areas smaller or larger than an threshold
- (Add) Preset - Heal anti-aliasing: Discard uncured faded pixels and turn them into solid black (0)
- (Fix) Resin traps: Discard traps with drain holes directly on first layer / build plate
- (Fix) The setting 'Auto flip layer on file load' is not respected when off
-rw-r--r-- | CHANGELOG.md | 9 | ||||
-rw-r--r-- | UVtools.Core/Operations/OperationPixelArithmetic.cs | 51 | ||||
-rw-r--r-- | UVtools.Core/UVtools.Core.csproj | 2 | ||||
-rw-r--r-- | UVtools.WPF/Controls/Tools/ToolMorphControl.axaml | 3 | ||||
-rw-r--r-- | UVtools.WPF/Controls/Tools/ToolPixelArithmeticControl.axaml | 39 | ||||
-rw-r--r-- | UVtools.WPF/UVtools.WPF.csproj | 2 |
6 files changed, 82 insertions, 24 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 3650bc4..72f75b3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## 02/10/2021 - v2.23.2 + +- **Pixel arithmetic** + - (Add) Corrode: Random dithering, use for eliminating visual prominence of layer lines. Can also be used to add a microtexture to enhance paint bonding (#307) + - (Add) Ignore areas smaller or larger than an threshold + - (Add) Preset - Heal anti-aliasing: Discard uncured faded pixels and turn them into solid black (0) +- (Fix) Resin traps: Discard traps with drain holes directly on first layer / build plate +- (Fix) The setting 'Auto flip layer on file load' is not respected when off + ## 23/09/2021 - v2.23.1 - **Issues:** diff --git a/UVtools.Core/Operations/OperationPixelArithmetic.cs b/UVtools.Core/Operations/OperationPixelArithmetic.cs index 47039c4..26d7209 100644 --- a/UVtools.Core/Operations/OperationPixelArithmetic.cs +++ b/UVtools.Core/Operations/OperationPixelArithmetic.cs @@ -7,7 +7,6 @@ */ using System; -using System.Buffers; using System.ComponentModel; using System.Diagnostics; using System.Drawing; @@ -18,7 +17,6 @@ using System.Xml.Serialization; using Emgu.CV; using Emgu.CV.CvEnum; using Emgu.CV.Structure; -using UVtools.Core.EmguCV; using UVtools.Core.Extensions; using UVtools.Core.FileFormats; @@ -27,6 +25,18 @@ namespace UVtools.Core.Operations [Serializable] public class OperationPixelArithmetic : Operation { + #region Enums + + public enum PixelArithmeticIgnoreAreaOperator + { + [Description("Smaller than")] + SmallerThan, + [Description("Larger than")] + LargerThan + } + + #endregion + #region Subclasses class StringMatrix { @@ -46,7 +56,8 @@ namespace UVtools.Core.Operations private uint _wallThicknessStart = 20; private uint _wallThicknessEnd = 20; private bool _wallChamfer; - private uint _ignoreAreasSmallerThan; + private PixelArithmeticIgnoreAreaOperator _ignoreAreaOperator = PixelArithmeticIgnoreAreaOperator.SmallerThan; + private uint _ignoreAreaThreshold; private byte _value = byte.MaxValue; private bool _usePattern; private ThresholdType _thresholdType = ThresholdType.Binary; @@ -311,10 +322,16 @@ namespace UVtools.Core.Operations set => RaiseAndSetIfChanged(ref _wallChamfer, value); } - public uint IgnoreAreasSmallerThan + public PixelArithmeticIgnoreAreaOperator IgnoreAreaOperator { - get => _ignoreAreasSmallerThan; - set => RaiseAndSetIfChanged(ref _ignoreAreasSmallerThan, value); + get => _ignoreAreaOperator; + set => RaiseAndSetIfChanged(ref _ignoreAreaOperator, value); + } + + public uint IgnoreAreaThreshold + { + get => _ignoreAreaThreshold; + set => RaiseAndSetIfChanged(ref _ignoreAreaThreshold, value); } @@ -705,7 +722,17 @@ namespace UVtools.Core.Operations throw new NotImplementedException(); } - originalRoi.CopyAreasSmallerThan(_ignoreAreasSmallerThan, target); + switch (_ignoreAreaOperator) + { + case PixelArithmeticIgnoreAreaOperator.SmallerThan: + originalRoi.CopyAreasSmallerThan(_ignoreAreaThreshold, target); + break; + case PixelArithmeticIgnoreAreaOperator.LargerThan: + originalRoi.CopyAreasLargerThan(_ignoreAreaThreshold, target); + break; + default: + throw new ArgumentOutOfRangeException(nameof(_ignoreAreaOperator)); + } ApplyMask(originalRoi, target); SlicerFile[layerIndex].LayerMat = mat; @@ -888,6 +915,16 @@ namespace UVtools.Core.Operations ThresholdType = ThresholdType.Binary; } + public void PresetHealAntiAliasing() + { + Operator = PixelArithmeticOperators.Threshold; + ApplyMethod = PixelArithmeticApplyMethod.All; + UsePattern = false; + Value = 169; + //ThresholdMaxValue = 255; + ThresholdType = ThresholdType.ToZero; + } + public void PresetHalfBrightness() { Value = 128; diff --git a/UVtools.Core/UVtools.Core.csproj b/UVtools.Core/UVtools.Core.csproj index acf440a..b9d50a4 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.1</Version> + <Version>2.23.2</Version> <Copyright>Copyright © 2020 PTRTECH</Copyright> <PackageIcon>UVtools.png</PackageIcon> <Platforms>AnyCPU;x64</Platforms> diff --git a/UVtools.WPF/Controls/Tools/ToolMorphControl.axaml b/UVtools.WPF/Controls/Tools/ToolMorphControl.axaml index e18f701..d1d8ec1 100644 --- a/UVtools.WPF/Controls/Tools/ToolMorphControl.axaml +++ b/UVtools.WPF/Controls/Tools/ToolMorphControl.axaml @@ -59,8 +59,7 @@ Grid.Column="2" HorizontalAlignment="Stretch" Items="{Binding Operation.MorphOperation, Converter={StaticResource EnumToCollectionConverter}, Mode=OneTime}" - SelectedItem="{Binding Operation.MorphOperation, Converter={StaticResource FromValueDescriptionToEnumConverter}}" - /> + SelectedItem="{Binding Operation.MorphOperation, Converter={StaticResource FromValueDescriptionToEnumConverter}}"/> </Grid> diff --git a/UVtools.WPF/Controls/Tools/ToolPixelArithmeticControl.axaml b/UVtools.WPF/Controls/Tools/ToolPixelArithmeticControl.axaml index 18b2242..27e784b 100644 --- a/UVtools.WPF/Controls/Tools/ToolPixelArithmeticControl.axaml +++ b/UVtools.WPF/Controls/Tools/ToolPixelArithmeticControl.axaml @@ -77,18 +77,19 @@ <StackPanel Grid.Row="6" Grid.Column="2" Grid.ColumnSpan="9" Spacing="5" Orientation="Horizontal"> + <ComboBox + Width="150" + Items="{Binding Operation.IgnoreAreaOperator, Converter={StaticResource EnumToCollectionConverter}, Mode=OneTime}" + SelectedItem="{Binding Operation.IgnoreAreaOperator, Converter={StaticResource FromValueDescriptionToEnumConverter}}"/> + <NumericUpDown Classes="ValueLabel ValueLabel_px2" Minimum="0" Maximum="4294967295" Width="150" - Value="{Binding Operation.IgnoreAreasSmallerThan}" - ToolTip.Tip="Ignore all areas smaller than this threshold. + Value="{Binding Operation.IgnoreAreaThreshold}" + ToolTip.Tip="Ignore all areas smaller or larger than this threshold. 
0 = Disabled"/> - - <TextBlock - VerticalAlignment="Center" - Text="(less than)"/> </StackPanel> @@ -205,9 +206,11 @@ VerticalAlignment="Center" Text="Presets:"/> - <StackPanel Grid.Row="10" Grid.Column="2" - Grid.ColumnSpan="9" - VerticalAlignment="Center" + <StackPanel Grid.Row="10" Grid.Column="2" Grid.ColumnSpan="9" + VerticalAlignment="Center" + Orientation="Vertical" Spacing="5"> + + <StackPanel VerticalAlignment="Center" Orientation="Horizontal" Spacing="5"> <Button @@ -226,16 +229,26 @@ ToolTip.Tip="This preset will lightening pixels with a pattern, on the pattern put the brightness values you want to add to each pixel" Content="Pixel lightening"/> - <Button - Command="{Binding Operation.PresetStripAntiAliasing}" - Content="Strip anti-aliasing"/> - <Button IsVisible="{Binding Operation.ValueEnabled}" Command="{Binding Operation.PresetHalfBrightness}" Content="Half brightness"/> </StackPanel> + <StackPanel VerticalAlignment="Center" + Orientation="Horizontal" Spacing="5"> + + <Button Command="{Binding Operation.PresetStripAntiAliasing}" + Content="Strip anti-aliasing" + ToolTip.Tip="Binary the image where gray pixels below or equal than 127 will be zeroed and above will turn in whites"/> + + <Button Command="{Binding Operation.PresetHealAntiAliasing}" + Content="Heal anti-aliasing" + ToolTip.Tip="Discard uncured faded pixels and turn them into solid black (0)"/> + + </StackPanel> + </StackPanel> + </Grid> <Expander Grid.Row="2" diff --git a/UVtools.WPF/UVtools.WPF.csproj b/UVtools.WPF/UVtools.WPF.csproj index bcb11da..4bc429d 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.1</Version> + <Version>2.23.2</Version> <Platforms>AnyCPU;x64</Platforms> </PropertyGroup> |