public static Color CMYKToColor(CMYK cmyk) { if (cmyk.Cyan == 0 && cmyk.Magenta == 0 && cmyk.Yellow == 0 && cmyk.Key == 1) { return(Color.FromArgb(cmyk.Alpha, 0, 0, 0)); } double c = (cmyk.Cyan * (1 - cmyk.Key)) + cmyk.Key; double m = (cmyk.Magenta * (1 - cmyk.Key)) + cmyk.Key; double y = (cmyk.Yellow * (1 - cmyk.Key)) + cmyk.Key; int r = (int)Math.Round((1 - c) * 255); int g = (int)Math.Round((1 - m) * 255); int b = (int)Math.Round((1 - y) * 255); return(Color.FromArgb(cmyk.Alpha, r, g, b)); }
public static Color CMYKToColor(CMYK cmyk) { if (cmyk.Cyan == 0 && cmyk.Magenta == 0 && cmyk.Yellow == 0 && cmyk.Key == 1) { return Color.FromArgb(cmyk.Alpha, 0, 0, 0); } double c = cmyk.Cyan * (1 - cmyk.Key) + cmyk.Key; double m = cmyk.Magenta * (1 - cmyk.Key) + cmyk.Key; double y = cmyk.Yellow * (1 - cmyk.Key) + cmyk.Key; int r = (int)Math.Round((1 - c) * 255); int g = (int)Math.Round((1 - m) * 255); int b = (int)Math.Round((1 - y) * 255); return Color.FromArgb(cmyk.Alpha, r, g, b); }
private void tsmiCopyCMYK_Click(object sender, EventArgs e) { CMYK cmyk = colorPicker.SelectedColor.CMYK; ClipboardHelpers.CopyText($"{cmyk.Cyan100:0.0}%, {cmyk.Magenta100:0.0}%, {cmyk.Yellow100:0.0}%, {cmyk.Key100:0.0}%"); }
public void HSBUpdate() { RGBA = HSB; CMYK = HSB; }
public void RGBAUpdate() { HSB = RGBA; CMYK = RGBA; }
public MyColor(Color color) { RGBA = color; HSB = color; CMYK = color; }