mirror of
https://github.com/riegera2412/UVtools.git
synced 2026-07-13 03:47:40 +02:00
ada646f92d
- **(Add) PrusaSlicer printers:** - Creality HALOT-MAX CL-133 - Nova3D Elfin2 - Nova3D Elfin2 Mono SE - Nova3D Elfin3 Mini - Nova3D Bene4 - Nova3D Bene5 - Nova3D Whale - Nova3D Whale2 - **About box:** - (Add) Runtime information - (Fix) Limit panels width and height to not overgrow - **(Fix) macOS:** - macOS version auto-upgrade (Will only work on future releases and if running v2.16.0 or greater) - Demo file not loading - Auto disable windows scaling factor when on Monjave or greater on new instalations - (Add) Tool: Raise platform on print finish - (Add) CXDLP: Support for Halot MAX CL-133 - (Improvement) Tools: Better handling/validation of tools that are unable to run with abstraction - (Improvement) CWS: Simplify filenames inside the archive - (Upgrade) EmguCV from 4.5.2 to 4.5.3 - (Change) Allow to set layer `LightPWM` to 0 - (Fix) Arrange dropdown arrow from layer image save icon to be at center
87 lines
2.6 KiB
C#
87 lines
2.6 KiB
C#
using Avalonia.Markup.Xaml;
|
|
using Emgu.CV.CvEnum;
|
|
using UVtools.Core.Operations;
|
|
|
|
namespace UVtools.WPF.Controls.Tools
|
|
{
|
|
public class ToolThresholdControl : ToolControl
|
|
{
|
|
private int _selectedPresetIndex;
|
|
private bool _isThresholdEnabled = true;
|
|
private bool _isMaximumEnabled = true;
|
|
private bool _isTypeEnabled = true;
|
|
public OperationThreshold Operation => BaseOperation as OperationThreshold;
|
|
|
|
public string[] Presets => new[]
|
|
{
|
|
"Free use",
|
|
"Strip AntiAliasing",
|
|
"Set pixel brightness"
|
|
};
|
|
|
|
public bool IsThresholdEnabled
|
|
{
|
|
get => _isThresholdEnabled;
|
|
set => RaiseAndSetIfChanged(ref _isThresholdEnabled, value);
|
|
}
|
|
|
|
public bool IsMaximumEnabled
|
|
{
|
|
get => _isMaximumEnabled;
|
|
set => RaiseAndSetIfChanged(ref _isMaximumEnabled, value);
|
|
}
|
|
|
|
public bool IsTypeEnabled
|
|
{
|
|
get => _isTypeEnabled;
|
|
set => RaiseAndSetIfChanged(ref _isTypeEnabled, value);
|
|
}
|
|
|
|
public int SelectedPresetIndex
|
|
{
|
|
get => _selectedPresetIndex;
|
|
set
|
|
{
|
|
if (!RaiseAndSetIfChanged(ref _selectedPresetIndex, value)) return;
|
|
|
|
switch (_selectedPresetIndex)
|
|
{
|
|
case 0:
|
|
IsThresholdEnabled = true;
|
|
IsMaximumEnabled = true;
|
|
IsTypeEnabled = true;
|
|
break;
|
|
case 1:
|
|
IsThresholdEnabled = true;
|
|
IsMaximumEnabled = false;
|
|
IsTypeEnabled = false;
|
|
Operation.Threshold = 127;
|
|
Operation.Maximum = 255;
|
|
Operation.Type = ThresholdType.Binary;
|
|
break;
|
|
case 2:
|
|
IsThresholdEnabled = false;
|
|
IsMaximumEnabled = true;
|
|
IsTypeEnabled = false;
|
|
Operation.Threshold = 254;
|
|
//Operation.Maximum = 254;
|
|
Operation.Type = ThresholdType.Binary;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
public ToolThresholdControl()
|
|
{
|
|
BaseOperation = new OperationThreshold(SlicerFile);
|
|
if (!ValidateSpawn()) return;
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void InitializeComponent()
|
|
{
|
|
AvaloniaXamlLoader.Load(this);
|
|
}
|
|
}
|
|
}
|