protected static void ExpectedValuesForKnownColor(IColorSpace knownColor, IYxy expectedColor) { var target = knownColor.To<Yxy>(); Assert.IsTrue(CloseEnough(expectedColor.Y1,target.Y1),"(Y1)" + expectedColor.Y1 + " != " + target.Y1); Assert.IsTrue(CloseEnough(expectedColor.X,target.X),"(X)" + expectedColor.X + " != " + target.X); Assert.IsTrue(CloseEnough(expectedColor.Y2,target.Y2),"(Y2)" + expectedColor.Y2 + " != " + target.Y2); }
protected static void ExpectedValuesForKnownColor(IColorSpace knownColor, IYxy expectedColor) { var target = knownColor.To <Yxy>(); Assert.IsTrue(CloseEnough(expectedColor.Y1, target.Y1), "(Y1)" + expectedColor.Y1 + " != " + target.Y1); Assert.IsTrue(CloseEnough(expectedColor.X, target.X), "(X)" + expectedColor.X + " != " + target.X); Assert.IsTrue(CloseEnough(expectedColor.Y2, target.Y2), "(Y2)" + expectedColor.Y2 + " != " + target.Y2); }
protected static void ExpectedValuesForKnownColor(IColorSpace knownColor, IYxy expectedColor) { var target = knownColor.To <Yxy>(); Assert.AreEqual(expectedColor.Y1, target.Y1, 0.5, "(Y1)" + expectedColor.Y1 + " != " + target.Y1); Assert.AreEqual(expectedColor.X, target.X, 0.005, "(X)" + expectedColor.X + " != " + target.X); Assert.AreEqual(expectedColor.Y2, target.Y2, 0.005, "(Y2)" + expectedColor.Y2 + " != " + target.Y2); }
internal static IRgb ToColor(IYxy item) { var xyz = new Xyz { X = item.X * (item.Y1 / item.Y2), Y = item.Y1, Z = (1.0 - item.X - item.Y2) * (item.Y1 / item.Y2) }; return xyz.ToRgb(); }
internal static IRgb ToColor(IYxy item) { var xyz = new Xyz { X = item.X * (item.Y1 / item.Y2), Y = item.Y1, Z = (1.0 - item.X - item.Y2) * (item.Y1 / item.Y2) }; return(xyz.ToRgb()); }
internal static void ToColorSpace(IRgb color, IYxy item) { var xyz = new Xyz(); xyz.Initialize(color); item.Y1 = xyz.Y; var xDividend = xyz.X + xyz.Y + xyz.Z; item.X = xDividend.BasicallyEqualTo(0) ? 0.0 : xyz.X / xDividend; var y2Dividend = xyz.X + xyz.Y + xyz.Z; item.Y2 = y2Dividend.BasicallyEqualTo(0) ? 0.0 : xyz.Y / (xyz.X + xyz.Y + xyz.Z); }
public CmyColor(IYxy yxy) { Initialize(yxy.ToRgb()); }
public YxyColor(IYxy yxy) { Ordinals = yxy.Ordinals; }
public HunterLabColor(IYxy yxy) { Initialize(yxy.ToRgb()); }