-
Notifications
You must be signed in to change notification settings - Fork 0
/
E3ColorTable.cs
29 lines (28 loc) · 951 Bytes
/
E3ColorTable.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
using System.Collections.Generic;
using System.Windows.Media;
using e3;
namespace KSPE3Lib
{
static class E3ColorTable
{
public static Dictionary<int, Color> GetColorByCode(int processId)
{
int maxColorIndex = 255;
E3ObjectFabric e3Objects = new E3ObjectFabric(processId);
Dictionary<int, Color> colorByCode = new Dictionary<int, Color>();
colorByCode.Add(-1, Colors.Black);
dynamic r = default(dynamic);
dynamic g = default(dynamic);
dynamic b = default(dynamic);
e3Job job = e3Objects.GetJob();
for (int i = 0; i <= maxColorIndex; i++)
{
job.GetRGBValue(i, ref r, ref g, ref b);
colorByCode.Add(i, Color.FromArgb(0xFF, (byte)r, (byte)g, (byte)b));
}
job = null;
e3Objects.Release();
return colorByCode;
}
}
}