-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSchets.cs
57 lines (55 loc) · 1.68 KB
/
Schets.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
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Text.RegularExpressions;
using System.Windows.Forms;
namespace SchetsEditor
{
public class Schets
{
private Bitmap bitmap;
public Schets()
{
bitmap = new Bitmap(1, 1);
}
public Graphics BitmapGraphics
{
get { return Graphics.FromImage(bitmap); }
}
public void VeranderAfmeting(Size sz)
{
if (sz.Width > bitmap.Size.Width || sz.Height > bitmap.Size.Height)
{
Bitmap nieuw = new Bitmap( Math.Max(sz.Width, bitmap.Size.Width)
, Math.Max(sz.Height, bitmap.Size.Height)
);
Graphics gr = Graphics.FromImage(nieuw);
gr.FillRectangle(Brushes.White, 0, 0, sz.Width, sz.Height);
gr.DrawImage(bitmap, 0, 0);
bitmap = nieuw;
}
}
public void Teken(Graphics gr)
{
gr.Clear(Color.White);
gr.DrawImage(bitmap, 0, 0);
}
public void Schoon()
{
Graphics gr = Graphics.FromImage(bitmap);
gr.FillRectangle(Brushes.White, 0, 0, bitmap.Width, bitmap.Height);
}
public void Roteer()
{
bitmap.RotateFlip(RotateFlipType.Rotate90FlipNone);
}
public void Opslaan(string path, List<Tuple<ISchetsTool, Color, Point, Point, String, List<Point>>> Ll)
{
bitmap.Save(path);
}
public void Open(string path)
{
bitmap = new Bitmap(path);
}
}
}