/// <summary> /// Initializes a new instance of the <see cref="ColorD"/> class using values from another instance. /// </summary> /// <param name="color">A <see cref="ColorD"/> instance.</param> public ColorD(ColorD color) { _red = color.Red; _green = color.Green; _blue = color.Blue; _alpha = color.Alpha; }
/// <summary> /// Returns a value indicating whether this instance is equal to /// the specified object. /// </summary> /// <param name="obj">An object to compare to this instance.</param> /// <returns><see langword="true"/> if <paramref name="obj"/> is a <see cref="ColorD"/> and has the same values as this instance; otherwise, <see langword="false"/>.</returns> public override bool Equals(object obj) { ColorD color = obj as ColorD; if (color != null) { return((_red == color.Red) && (_green == color.Green) && (_blue == color.Blue) && (_alpha == color.Alpha)); } else { return(false); } }
/// <summary> /// Initializes a new instance of the <see cref="ColorD"/> class from a blend of two colors. /// </summary> /// <param name="source">The blend source color.</param> /// <param name="dest">The blend destination color.</param> /// <param name="opacity">The opacity value.</param> public ColorD(ColorD source, ColorD dest, double opacity) { _red = MathFunctions.LinearInterpolation(source.Red, dest.Red, opacity); _green = MathFunctions.LinearInterpolation(source.Green, dest.Green, opacity); _blue = MathFunctions.LinearInterpolation(source.Blue, dest.Blue, opacity); }