internal 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 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); } }
protected static void ExpectedValuesForKnownColor(IColorSpace knownColor, ICmyk expectedColor) { var target = knownColor.To<Cmyk>(); Assert.IsTrue(CloseEnough(expectedColor.C,target.C),"(C)" + expectedColor.C + " != " + target.C); Assert.IsTrue(CloseEnough(expectedColor.M,target.M),"(M)" + expectedColor.M + " != " + target.M); Assert.IsTrue(CloseEnough(expectedColor.Y,target.Y),"(Y)" + expectedColor.Y + " != " + target.Y); Assert.IsTrue(CloseEnough(expectedColor.K,target.K),"(K)" + expectedColor.K + " != " + target.K); }
protected static void ExpectedValuesForKnownColor(IColorSpace knownColor, ICmyk expectedColor) { var target = knownColor.To <Cmyk>(); Assert.IsTrue(CloseEnough(expectedColor.C, target.C), "(C)" + expectedColor.C + " != " + target.C); Assert.IsTrue(CloseEnough(expectedColor.M, target.M), "(M)" + expectedColor.M + " != " + target.M); Assert.IsTrue(CloseEnough(expectedColor.Y, target.Y), "(Y)" + expectedColor.Y + " != " + target.Y); Assert.IsTrue(CloseEnough(expectedColor.K, target.K), "(K)" + expectedColor.K + " != " + target.K); }
protected static void ExpectedValuesForKnownColor(IColorSpace knownColor, ICmyk expectedColor) { var target = knownColor.To <Cmyk>(); Assert.AreEqual(expectedColor.C, target.C, 0.005, "(C)" + expectedColor.C + " != " + target.C); Assert.AreEqual(expectedColor.M, target.M, 0.005, "(M)" + expectedColor.M + " != " + target.M); Assert.AreEqual(expectedColor.Y, target.Y, 0.005, "(Y)" + expectedColor.Y + " != " + target.Y); Assert.AreEqual(expectedColor.K, target.K, 0.005, "(K)" + expectedColor.K + " != " + target.K); }
internal 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 static IRgb ToColor(ICmyk item, Uri profile) { var points = new[] { (float)item.C, (float)item.M, (float)item.Y, (float)item.K }; var color = Color.FromValues(points, profile); return new Rgb { R = color.R, G = color.G, B = color.B }; }
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 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 static IRgb ToColor(ICmyk item, Uri profile) { var points = new[] { (float)item.C, (float)item.M, (float)item.Y, (float)item.K }; var color = Color.FromValues(points, profile); return(new Rgb { R = color.R, G = color.G, B = color.B }); }
public static void ToColorSpace(IRgb color, ICmyk item, Uri cmykProfile, Uri rgbProfile) { if (rgbProfile == null) { ToColorSpace(color, item, cmykProfile); return; } var cmyk = WindowsColorSystem.TranslateColor(color, cmykProfile, rgbProfile); item.C = cmyk.C; item.M = cmyk.M; item.Y = cmyk.Y; item.K = cmyk.K; }
public static void ToColorSpace(IRgb color, ICmyk item, Uri cmykProfile) { if (cmykProfile == null) { ToColorSpace(color, item); return; } var cmyk = CmykProfileConverter.TranslateColor(color, cmykProfile); item.C = cmyk.C; item.M = cmyk.M; item.Y = cmyk.Y; item.K = cmyk.K; }
public static void ToColorSpace(IRgb color, ICmyk item, Uri cmykProfile, Uri rgbProfile) { if (rgbProfile == null) { ToColorSpace(color, item, cmykProfile); return; } var cmyk = CmykProfileConverter.TranslateColor(color, cmykProfile, rgbProfile); item.C = cmyk.C; item.M = cmyk.M; item.Y = cmyk.Y; item.K = cmyk.K; }
public CmyColor(ICmyk cmyk) { Initialize(cmyk.ToRgb()); }
public HunterLabColor(ICmyk cmyk) { Initialize(cmyk.ToRgb()); }
public CmykColor(ICmyk cmyk) { Ordinals = cmyk.Ordinals; }