blob: 2d326518b2df671d08c2ece8ae378b4ac71840cb (
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
|
using System;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
using Emgu.CV;
using UVtools.Core.Extensions;
using UVtools.Core.Operations;
using UVtools.WPF.Extensions;
namespace UVtools.WPF.Controls.Tools
{
public class ToolPixelDimmingControl : ToolControl
{
public OperationPixelDimming Operation => BaseOperation as OperationPixelDimming;
public ToolPixelDimmingControl()
{
InitializeComponent();
BaseOperation = new OperationPixelDimming(SlicerFile);
Operation.GeneratePixelDimming("Chessboard");
}
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
public async void LoadPatternFromImage(bool isAlternatePattern = false)
{
var dialog = new OpenFileDialog
{
AllowMultiple = false,
Filters = Helpers.ImagesFileFilter,
};
var files = await dialog.ShowAsync(ParentWindow);
if (files is null || files.Length == 0) return;
Operation.LoadPatternFromImage(files[0], isAlternatePattern);
}
}
}
|