private void Verify(Colorspace space, params double[] values) { if (space == null) { throw new ArgumentNullException(nameof(space)); } if (values == null) { throw new ArgumentNullException(nameof(values)); } if (values.Length > MaxChannels) { throw new ArgumentOutOfRangeException(nameof(values)); } if (values.Length != ChannelCount) { throw new ArgumentOutOfRangeException(nameof(values)); } for (int i = 0; i < ValueArray.Length; i++) { this[i] = values[i]; } Space = space; var iccSpace = space as ColorspaceICC; if (iccSpace != null) { CheckColorTypeICC(iccSpace.Profile); } }
/// <summary> /// Compares this colorspace with another for their equality of values /// </summary> /// <param name="obj">The colorspace to compare to</param> /// <returns>True if they are the same, false otherwise</returns> public override bool Equals(object obj) { Colorspace c = obj as Colorspace; if ((object)c == null) { return(false); } return(this == c); }
/// <summary> /// Creates a new instance of the <see cref="Color"/> class /// </summary> /// <param name="space">The colorspace of this color</param> /// <param name="values">The values of this color</param> protected Color(Colorspace space, params double[] values) { if (ChannelCount < 1) { Values = new double[values.Length]; } else { Values = new double[ChannelCount]; } Verify(space, values); }