blob: 7dac93eee5a3294abd8f228f65099283510ea663 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
using System;
using System.Diagnostics;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
using Emgu.CV.CvEnum;
using UVtools.Core.Operations;
using UVtools.WPF.Windows;
namespace UVtools.WPF.Controls.Tools
{
public class ToolMorphControl : ToolControl
{
private byte _morphSelectedIndex;
public OperationMorph Operation => BaseOperation as OperationMorph;
private KernelControl _kernelCtrl;
public byte MorphSelectedIndex
{
get => _morphSelectedIndex;
set
{
if(!RaiseAndSetIfChanged(ref _morphSelectedIndex, value)) return;
Operation.MorphOperation = (MorphOp)OperationMorph.MorphOperations[_morphSelectedIndex].Tag;
}
}
public ToolMorphControl()
{
InitializeComponent();
BaseOperation = new OperationMorph();
_kernelCtrl = this.Find<KernelControl>("KernelCtrl");
}
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
public override bool UpdateOperation()
{
Operation.Kernel.Matrix = _kernelCtrl.GetMatrix();
Operation.Kernel.Anchor = _kernelCtrl.Anchor;
return !(Operation.Kernel.Matrix is null);
}
}
}
|