blob: 9d17f0517285d2bf833058f03d95ce870ef1947d (
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
48
49
50
51
52
53
54
55
56
57
|
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(SlicerFile);
_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);
}
public override void Callback(ToolWindow.Callbacks callback)
{
switch (callback)
{
case ToolWindow.Callbacks.ProfileLoaded:
MorphSelectedIndex = Operation.MorphOperationIndex;
break;
}
}
}
}
|