-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathframework.cs
88 lines (73 loc) · 2.19 KB
/
framework.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Drawing.Drawing2D;
class Helper
{
//----------------------------------
static public Bitmap scaler(Bitmap Source, Int32 Factor, InterpolationMode interpolationMode)
{
var Target = new Bitmap(Source.Width * Factor, Source.Height * Factor, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
var graphics = Graphics.FromImage(Target);
graphics.CompositingMode = CompositingMode.SourceCopy;
graphics.CompositingQuality = CompositingQuality.HighSpeed;
graphics.InterpolationMode = interpolationMode;
graphics.DrawImage(Source,
new Rectangle(0, 0, Target.Width, Target.Height),
new Rectangle(0, 0, Source.Width, Source.Height),
GraphicsUnit.Pixel);
return Target;
}
//----------------------------------
static public Bitmap scaler(Bitmap Source, Int32 NewWidth,Int32 NewHeight, InterpolationMode interpolationMode)
{
var Target = new Bitmap(NewWidth, NewHeight, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
var graphics = Graphics.FromImage(Target);
graphics.CompositingMode = CompositingMode.SourceCopy;
graphics.CompositingQuality = CompositingQuality.HighSpeed;
graphics.InterpolationMode = interpolationMode;
graphics.DrawImage(Source,
new Rectangle(0, 0, Target.Width, Target.Height),
new Rectangle(0, 0, Source.Width, Source.Height),
GraphicsUnit.Pixel);
return Target;
}
//----------------------------------
}
class points
{
public int width;
public int height;
public int index;
public points(int awidth, int aheight)
{
width = awidth;
height = aheight;
}
public void Inc()
{
index = index + 1;
}
public int max
{
get { return width * height; }
}
public int x
{
get { return index % width; }
}
public int y
{
get { return index / width; }
}
public Boolean DoIt
{
get
{
return index < max;
}
}
}