-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathClearColorWin.cs
46 lines (41 loc) · 1.37 KB
/
ClearColorWin.cs
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
using System;
using System.Drawing;
using System.Windows.Forms;
namespace AutoCGAligner
{
public partial class ClearColorWin : Form
{
public ClearColorWin(Image image, Color color, Action<Image> callback)
{
InitializeComponent();
this.color = color;
this.image = new Bitmap(image);
this.callback = callback;
CGBox.BackgroundImage = Program.LatticeImage(CGBox.Width, CGBox.Height);
}
private readonly Color color;
private readonly Bitmap image;
private Bitmap tempImage;
private readonly Action<Image> callback;
private void ClearDegree_ValueChanged(object sender, EventArgs e)
{
double ratio = (double)degreeValue.Value / (double)degreeValue.Maximum;
ClearColor((int)(ratio * ratio * Program.MaxPixelDis));
}
public void ClearColor(int distance)
{
tempImage = new Bitmap(image);
Program.ClearColor(ref tempImage, color, distance);
Program.ShowImage(tempImage, CGBox);
}
private void ClearColorWin_Load(object sender, EventArgs e)
{
ClearColor(Program.MaxPixelDis / 100);
}
private void ConfirmButton_Click(object sender, EventArgs e)
{
callback(tempImage);
Close();
}
}
}