BitMiracle.LibTiff.Classic.Internal.TiffCIELabToRGB.CIELabToXYZ C# (CSharp) Method

CIELabToXYZ() public method

public CIELabToXYZ ( int l, int a, int b, float &X, float &Y, float &Z ) : void
l int
a int
b int
X float
Y float
Z float
return void
        public void CIELabToXYZ(int l, int a, int b, out float X, out float Y, out float Z)
        {
            float L = (float)l * 100.0F / 255.0F;
            float cby;

            if (L < 8.856F)
            {
                Y = (L * Y0) / 903.292F;
                cby = 7.787F * (Y / Y0) + 16.0F / 116.0F;
            }
            else
            {
                cby = (L + 16.0F) / 116.0F;
                Y = Y0 * cby * cby * cby;
            }

            float tmp = (float)a / 500.0F + cby;
            if (tmp < 0.2069F)
                X = X0 * (tmp - 0.13793F) / 7.787F;
            else
                X = X0 * tmp * tmp * tmp;

            tmp = cby - (float)b / 200.0F;
            if (tmp < 0.2069F)
                Z = Z0 * (tmp - 0.13793F) / 7.787F;
            else
                Z = Z0 * tmp * tmp * tmp;
        }