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
|
public ColorMap[] CreateColorMap()
{
ColorMap[] colorMap = new ColorMap[256];
for (int i = 0; i < colorMap.Length; i++)
{
colorMap[i] = new ColorMap();
// Alte Farbe:
Color oldColor = Color.FromArgb(i, i, i);
colorMap[i].OldColor = oldColor;
// Neue Farbe [-1,1]:
double red = Math.Sin(i * 2 * Math.PI / 255d - Math.PI);
double green = Math.Sin(i * 2 * Math.PI / 255d - Math.PI / 2);
double blue = Math.Sin(i * 2 * Math.PI / 255d);
// Neue Farbe [0,255]:
red = (red + 1) * 0.5 * 255;
green = (green + 1) * 0.5 * 255;
blue = (blue + 1) * 0.5 * 255;
Color newColor = Color.FromArgb(
(int)red,
(int)green,
(int)blue);
colorMap[i].NewColor = newColor;
}
return colorMap;
}
|