private static void TestLabToCieXYZ(float l, float a, float b, float expectedX, float expectedY, float expectedZ)
        {
            float x, y, z;

            CieLabUtils.LabToCieXYZ(l, a, b, out x, out y, out z);

            Assert.That(x, Is.EqualTo(expectedX).Within(Epsilon));
            Assert.That(y, Is.EqualTo(expectedY).Within(Epsilon));
            Assert.That(z, Is.EqualTo(expectedZ).Within(Epsilon));
        }
Example #2
0
        public static void LChToCieXYZ(
            float l, float c, float h,
            out float x, out float y, out float z,
            LxyModel model = LxyModel.Lab, float[] referenceWhiteXyz = null)
        {
            float lxy_l, lxy_x, lxy_y;

            LChToLxy(l, c, h, out lxy_l, out lxy_x, out lxy_y);

            switch (model)
            {
            case LxyModel.Lab:
                CieLabUtils.LabToCieXYZ(lxy_l, lxy_x, lxy_y, out x, out y, out z, referenceWhiteXyz);
                break;

            case LxyModel.Luv:
                CieLuvUtils.LuvToCieXYZ(lxy_l, lxy_x, lxy_y, out x, out y, out z, referenceWhiteXyz);
                break;

            default:
                throw new ArgumentException("Illegal model!");
            }
        }