| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- //
- // System.Drawing.Drawing2D.Blend.cs
- //
- // Author:
- // Dennis Hayes ([email protected])
- //
- // (C) 2002/3 Ximian, Inc
- //
- using System;
- namespace System.Drawing.Drawing2D
- {
- /// <summary>
- /// Summary description for Blend.
- /// </summary>
- public sealed class Blend
- {
- private int count;
- private float [] positions;
- private float [] factors;
- public Blend(int count) {
- this.count = count;
- if(count < 2){
- throw new ArgumentOutOfRangeException("Count", count, "Must be at least 2");
- }
- positions = new float [count];
- factors = new float [count];
- //FIXME: call Blend!
- for (int i = 0; i < count; i++){
- positions[i] = (1.0F/count) * i;
- factors[i] = (1.0F/count) * i;
- }
- //fix any rounding errors that would generate an invald list.
- positions[0] = 0.0F;
- positions[1] = 1.0F;
- factors[0] = 0.0F;
- factors[1] = 1.0F;
- }
- public Blend() {
- count = 2;
- positions = new float [2];
- factors = new float [2];
- positions[0] = 0.0F;
- positions[1] = 1.0F;
- factors[0] = 0.0F;
- factors[1] = 1.0F;
- }
- public float [] Factors{
- get {
- return factors;
- }
- set{
- count = value.GetUpperBound(0) + 1;
- if((value[0] !=0) | (value[count-1] != 1.0F)){
- throw new ArgumentException(" First value must be 0.0, last value must be 1.0","Factors");
- }
- factors = value;
- }
- }
- public float [] Positions{
- get {
- return positions;
- }
- set{
- count = value.GetUpperBound(0) + 1;
- if((value[0] !=0) | (value[count-1] != 1.0F)){
- throw new ArgumentException(" First value must be 0.0, last value must be 1.0","Positon");
- }
- positions = value;
-
- }
- }
- }
- }
|