-
Notifications
You must be signed in to change notification settings - Fork 0
/
DrawObjNew.cs
34 lines (31 loc) · 1.09 KB
/
DrawObjNew.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
using System;
using System.Windows.Controls;
using System.Windows.Media;
namespace PenTabletNotebook {
class DrawObjNew {
public static int mNextIdx = 0;
public static DrawObj Load(System.IO.BinaryReader br) {
var doe = (DrawObj.DrawObjEnum)br.ReadInt32();
switch (doe) {
case DrawObj.DrawObjEnum.DOE_FreePen: {
int idx = mNextIdx++;
// idxが入っているが、不要。
br.ReadInt32();
byte r = br.ReadByte();
byte g = br.ReadByte();
byte b = br.ReadByte();
var brush = new SolidColorBrush(Color.FromRgb(r, g, b));
var d = new DrawObjFreePen(idx, null, brush);
bool rv = d.Load(br);
if (!rv) {
Console.WriteLine("E: DrawObjNew Load failed");
return null;
}
return d;
}
default:
return null;
}
}
}
}