private ColorGray(IMagickColor <QuantumType> color) : base(color) { _shade = (0.212656 * Quantum.ScaleToDouble(color.R)) + (0.715158 * Quantum.ScaleToDouble(color.G)) + (0.072186 * Quantum.ScaleToDouble(color.B)); }
/// <summary> /// Converts the value of this instance to an equivalent Color. /// </summary> /// <returns>A <see cref="Color"/> instance.</returns> public Color ToColor() { if (!_isCmyk) { return(Color.FromArgb(Quantum.ScaleToByte(A), Quantum.ScaleToByte(R), Quantum.ScaleToByte(G), Quantum.ScaleToByte(B))); } var r = Quantum.ScaleToQuantum(Quantum.Max - ((Quantum.ScaleToDouble(R) * (Quantum.Max - K)) + K)); var g = Quantum.ScaleToQuantum(Quantum.Max - ((Quantum.ScaleToDouble(G) * (Quantum.Max - K)) + K)); var b = Quantum.ScaleToQuantum(Quantum.Max - ((Quantum.ScaleToDouble(B) * (Quantum.Max - K)) + K)); return(Color.FromArgb(Quantum.ScaleToByte(A), Quantum.ScaleToByte(r), Quantum.ScaleToByte(g), Quantum.ScaleToByte(b))); }