Beispiel #1
0
        public void GetStateCodeTest()
        {
            Color a = Color.FromArgb(255, 102, 0);

            double[] rgba = ColorConverters.ColorToDouble(a);

            double[] xyz = ColorConverters.ColorToXYZ(a);
            double[] lab = ColorConverters.ColorToLab(a);

            Assert.IsNotNull(lab);

            // XYZ = 45.9914, 30.7627, 3.5138
            // LAB = 62.3068, 55.0094, 71.3368
        }
Beispiel #2
0
        public void DoubleByteConvertTest()
        {
            double[] lab     = new double[] { 62.3068, 55.0094, 71.3368 };
            byte[]   b       = ByteUtil.DoublesToBytes(lab);
            double[] results = ByteUtil.BytesToDoubles(b);

            lab     = ColorConverters.ColorToLab(Color.White);
            b       = ByteUtil.DoublesToBytes(lab);
            results = ByteUtil.BytesToDoubles(b);

            lab     = ColorConverters.ColorToLab(Color.Black);
            b       = ByteUtil.DoublesToBytes(lab);
            results = ByteUtil.BytesToDoubles(b);

            Assert.IsTrue(results[0] == 62.3068);
        }