Example #1
0
        /// <summary>
        /// Determine if two <c>BaseColorCollections</c> are equivalent
        /// </summary>
        /// <param name="obj">The other <c>BaseColorCollection</c></param>
        /// <returns>
        /// <see langword="true"/> if the two collections are equal, <see langword="false"/>
        /// otherwise
        /// </returns>
        public override bool Equals(object obj)
        {
            if ((obj == null) || !(obj is BaseColorCollection))
            {
                return(false);
            }

            BaseColorCollection other = obj as BaseColorCollection;

            if (other == this)
            {
                return(true);
            }

            if (Count != other.Count)
            {
                return(false);
            }

            for (int i = 0; i < Count; i++)
            {
                if (colors[i] != other.colors[i])
                {
                    return(false);
                }
            }

            return(true);
        }
        /// <summary>
        /// Copy construct a new <c>BaseColorCollection</c>
        /// </summary>
        /// <param name="other">The BaseColorCollection to copy</param>
        public BaseColorCollection(BaseColorCollection other)
        {
            if (other == null) {
                throw new ArgumentNullException("other","Cannot copy construct a null reference") ;
            }

            this.colors = (Color []) other.colors.Clone() ;
        }
Example #3
0
        /// <summary>
        /// Copy construct a new <c>BaseColorCollection</c>
        /// </summary>
        /// <param name="other">The BaseColorCollection to copy</param>
        public BaseColorCollection(BaseColorCollection other)
        {
            if (other == null)
            {
                throw new ArgumentNullException("other", "Cannot copy construct a null reference");
            }

            this.colors = (Color [])other.colors.Clone();
        }
Example #4
0
        /// <summary>
        /// Create an <c>AbstractColorPair</c> from another
        /// <c>BaseColorCollection</c>
        /// </summary>
        /// <param name="colors">The other <c>BaseColorCollection</c></param>
        /// <remarks>
        /// Only the 1st and 2nd color are considered. If the <c>colors</c>
        /// collection only contains a single color, both color entries are
        /// equal to that value. If zero colors are specified in colors
        /// then both values are the default, <see cref="Color.Empty"/>
        /// </remarks>
        public AbstractColorPair(BaseColorCollection colors) : base(2)
        {
            if (colors == null)
            {
                throw new ArgumentNullException("colors", "BaseColorCollection cannot be null");
            }

            if (colors.Count > 0)
            {
                this[AbstractColorPairType.Color1] = colors[0];
            }

            if (colors.Count > 1)
            {
                this[AbstractColorPairType.Color2] = colors[1];
            }
            else
            {
                this[AbstractColorPairType.Color2] = Color1;
            }
        }
Example #5
0
 /// <summary>
 /// Create a <c>ColorPair</c> form the specified <see cref="BaseColorCollection"/>
 /// </summary>
 /// <param name="colors">The <see cref="BaseColorCollection"/> to initialize
 /// from</param>
 /// <remarks>
 /// See <see cref="AbstractColorPair(BaseColorCollection)"/> for more
 /// details
 /// </remarks>
 public ColorPair(BaseColorCollection colors) : base(colors)
 {
 }
Example #6
0
 /// <summary>
 /// Create a <c>GradientColor</c> from a <see cref="BaseColorCollection"/>
 /// </summary>
 /// <remarks>
 /// See <see cref="AbstractColorPair(BaseColorCollection)"/> for more information
 /// </remarks>
 public GradientColor(BaseColorCollection colors) : base(colors)
 {
 }
Example #7
0
		/// <summary>
		/// Create a <c>ColorPair</c> form the specified <see cref="BaseColorCollection"/>
		/// </summary>
		/// <param name="colors">The <see cref="BaseColorCollection"/> to initialize
		/// from</param>
		/// <remarks>
		/// See <see cref="AbstractColorPair(BaseColorCollection)"/> for more
		/// details
		/// </remarks>
		public ColorPair(BaseColorCollection colors) : base(colors) {}
Example #8
0
		/// <summary>
		/// Create an <c>AbstractColorPair</c> from another 
		/// <c>BaseColorCollection</c>
		/// </summary>
		/// <param name="colors">The other <c>BaseColorCollection</c></param>
		/// <remarks>
		/// Only the 1st and 2nd color are considered. If the <c>colors</c>
		/// collection only contains a single color, both color entries are
		/// equal to that value. If zero colors are specified in colors
		/// then both values are the default, <see cref="Color.Empty"/>
		/// </remarks>
		public AbstractColorPair(BaseColorCollection colors) : base(2) {
			if (colors == null) {
				throw new ArgumentNullException("colors","BaseColorCollection cannot be null") ;
			}

			if (colors.Count > 0) {
				this[AbstractColorPairType.Color1] = colors[0] ;
			}
			
			if (colors.Count > 1) {
				this[AbstractColorPairType.Color2] = colors[1] ;
			} else {
				this[AbstractColorPairType.Color2] = Color1 ;
			}
		}
Example #9
0
		/// <summary>
		/// Create a <c>GradientColor</c> from a <see cref="BaseColorCollection"/>
		/// </summary>
		/// <remarks>
		/// See <see cref="AbstractColorPair(BaseColorCollection)"/> for more information
		/// </remarks>
		public GradientColor(BaseColorCollection colors) : base(colors) {}