2 // System.Drawing.Drawing2D.ColorBlend.cs
\r
5 // Dennis Hayes (dennish@Raytek.com)
\r
7 // (C) 2002/3 Ximian, Inc
\r
11 namespace System.Drawing.Drawing2D
\r
13 public sealed class ColorBlend {
\r
15 private float [] positions;
\r
16 private Color [] colors;
\r
18 public ColorBlend(int count) {
\r
21 throw new ArgumentOutOfRangeException("Count", count, "Must be at least 2");
\r
24 //FIXME: call ColorBlend!
\r
26 positions = new float [1];
\r
27 colors = new Color [1];
\r
28 positions[0] = 0.0F;
\r
29 positions[1] = 1.0F;
\r
30 colors[0] = Color.FromArgb(0,0,0);
\r
31 colors[1] = Color.FromArgb(255,255,255);
\r
35 for(i = 0; i < count; i++){
\r
36 positions[i] = (1.0F/count) * i;
\r
37 //FIXME: Do real default color blend
\r
38 //FIXME: I used 254 to prevent overflow, should use 255, if anyone cares?
\r
39 colors[i] = Color.FromArgb((1/count) * i * 254,(1/count) * i * 254,(1/count) * i * 254);
\r
41 //fix any rounding errors that would generate an invald list.
\r
42 positions[0] = 0.0F;
\r
43 positions[1] = 1.0F;
\r
44 colors[0] = Color.FromArgb(0,0,0);
\r
45 colors[1] = Color.FromArgb(255,255,255);
\r
49 public ColorBlend() {
\r
51 positions = new float [1];
\r
52 colors = new Color [1];
\r
53 positions[0] = 0.0F;
\r
54 positions[1] = 1.0F;
\r
55 colors[0] = Color.FromArgb(0,0,0);
\r
56 colors[1] = Color.FromArgb(255,255,255);
\r
59 public Color [] Colors{
\r
64 count = value.GetUpperBound(0) + 1;
\r
69 public float [] Positions{
\r
74 count = value.GetUpperBound(0) + 1;
\r