internal static void ToColorSpace(IRgb color, IHunterLab item)
        {
            var xyz = color.To<Xyz>();

            item.L = 10.0 * Math.Sqrt(xyz.Y);
            item.A = xyz.Y != 0 ? 17.5 * (((1.02 * xyz.X) - xyz.Y) / Math.Sqrt(xyz.Y)) : 0;
            item.B = xyz.Y != 0 ? 7.0 * ((xyz.Y - (.847 * xyz.Z)) / Math.Sqrt(xyz.Y)) : 0;
        }
        internal static void ToColorSpace(IRgb color, IHunterLab item)
        {
            var xyz = color.To <Xyz>();

            item.L = 10.0 * Math.Sqrt(xyz.Y);
            item.A = xyz.Y != 0 ? 17.5 * ((1.02 * xyz.X - xyz.Y) / Math.Sqrt(xyz.Y)) : 0;
            item.B = xyz.Y != 0 ? 7.0 * ((xyz.Y - .847 * xyz.Z) / Math.Sqrt(xyz.Y)) : 0;
        }
        protected static void ExpectedValuesForKnownColor(IColorSpace knownColor, IHunterLab expectedColor)
        {
            var target = knownColor.To <HunterLab>();

            Assert.IsTrue(CloseEnough(expectedColor.L, target.L), "(L)" + expectedColor.L + " != " + target.L);
            Assert.IsTrue(CloseEnough(expectedColor.A, target.A), "(A)" + expectedColor.A + " != " + target.A);
            Assert.IsTrue(CloseEnough(expectedColor.B, target.B), "(B)" + expectedColor.B + " != " + target.B);
        }
示例#4
0
        protected static void ExpectedValuesForKnownColor(IColorSpace knownColor, IHunterLab expectedColor)
        {
            var target = knownColor.To <HunterLab>();

            Assert.AreEqual(expectedColor.L, target.L, 0.5, "(L)" + expectedColor.L + " != " + target.L);
            Assert.AreEqual(expectedColor.A, target.A, 0.64, "(A)" + expectedColor.A + " != " + target.A);
            Assert.AreEqual(expectedColor.B, target.B, 0.64, "(B)" + expectedColor.B + " != " + target.B);
        }
        internal static IRgb ToColor(IHunterLab item)
        {
            var x = (item.A / 17.5) * (item.L / 10.0);
            var y = Math.Pow(item.L / 10.0, 2);
            var z = item.B / 7.0 * item.L / 10.0;

            var xyz = new Xyz
            {
                X = (x + y) / 1.02,
                Y = y,
                Z = -(z - y) / .847
            };

            return(xyz.To <Rgb>());
        }
        internal static IRgb ToColor(IHunterLab item)
        {
            var x = (item.A / 17.5) * (item.L / 10.0);
            var itemL_10 = item.L / 10.0;
            var y = itemL_10 * itemL_10;
            var z = item.B / 7.0 * item.L / 10.0;

            var xyz = new Xyz
                {
                    X = (x + y) / 1.02,
                    Y = y,
                    Z = -(z - y) / .847
                };
            return xyz.To<Rgb>();
        }
示例#7
0
        protected static void ExpectedValuesForKnownColor(IColorSpace knownColor, IHunterLab expectedColor)
        {
            var target = knownColor.To<HunterLab>();

            Assert.IsTrue(CloseEnough(expectedColor.L,target.L),"(L)" + expectedColor.L + " != " + target.L);
            Assert.IsTrue(CloseEnough(expectedColor.A,target.A),"(A)" + expectedColor.A + " != " + target.A);
            Assert.IsTrue(CloseEnough(expectedColor.B,target.B),"(B)" + expectedColor.B + " != " + target.B);
        }
示例#8
0
 public CmyColor(IHunterLab hunterlab)
 {
     Initialize(hunterlab.ToRgb());
 }
示例#9
0
 public HunterLabColor(IHunterLab hunterlab)
 {
     Ordinals = hunterlab.Ordinals;
 }