public static void ToColorSpace(IRgb color, ICmyk item) { var cmy = new Cmy(); cmy.Initialize(color); var k = 1.0; if (cmy.C < k) { k = cmy.C; } if (cmy.M < k) { k = cmy.M; } if (cmy.Y < k) { k = cmy.Y; } item.K = k; if (k.BasicallyEqualTo(1)) { item.C = 0; item.M = 0; item.Y = 0; } else { item.C = (cmy.C - k) / (1 - k); item.M = (cmy.M - k) / (1 - k); item.Y = (cmy.Y - k) / (1 - k); } }
public static IRgb ToColor(ICmyk item) { var cmy = new Cmy { C = item.C * (1 - item.K) + item.K, M = item.M * (1 - item.K) + item.K, Y = item.Y * (1 - item.K) + item.K }; return(cmy.ToRgb()); }
public Form() { InitializeComponent(); alpha = alphaS.Value; rgb = new Rgb { R = redS.Value, G = greenS.Value, B = blueS.Value }; hsv = rgb.To <Hsv>(); luv = rgb.To <Luv>(); cmy = rgb.To <Cmy>(); xyz = rgb.To <Xyz>(); }
public void CMYvalueChanged() { double multiplier = SS.Maximum; cmy = new Cmy { C = CS.Value / multiplier, M = MS.Value / multiplier, Y = YS.Value / multiplier }; rgb = cmy.To <Rgb>(); BOX.BackColor = Color.FromArgb(alpha, (int)rgb.R, (int)rgb.G, (int)rgb.B); cl.Text = string.Format("C({0:F2})", cmy.C); ml.Text = string.Format("M({0:F2})", cmy.M); yl.Text = string.Format("Y({0:F2})", cmy.Y); CS.Value = (int)(cmy.C * CS.Maximum); MS.Value = (int)(cmy.M * MS.Maximum); YS.Value = (int)(cmy.Y * YS.Maximum); }
public void RGBvalueChanged2() { redS.Value = (int)rgb.R; greenS.Value = (int)rgb.G; blueS.Value = (int)rgb.B; alphaS.Value = alpha; rgb = new Rgb { R = redS.Value, G = greenS.Value, B = blueS.Value }; BOX.BackColor = Color.FromArgb(alpha, (int)rgb.R, (int)rgb.G, (int)rgb.B); gl.Text = string.Format("G({0:000})", rgb.G); bl.Text = string.Format("B({0:000})", rgb.B); rl.Text = string.Format("R({0:000})", rgb.R); al.Text = string.Format("A({0:000})", alpha); hsv = rgb.To <Hsv>(); luv = rgb.To <Luv>(); cmy = rgb.To <Cmy>(); xyz = rgb.To <Xyz>(); }