Structure for holding information about a display device.
Exemplo n.º 1
0
        /* 
        * Allocate conversion state structures and make look_up tables for
        * the Yr,Yb,Yg <=> r,g,b conversions.
        */
        public void Init(TiffDisplay refDisplay, float[] refWhite)
        {
            range = CIELABTORGB_TABLE_RANGE;

            display = refDisplay;

            /* Red */
            double gamma = 1.0 / display.d_gammaR;
            rstep = (display.d_YCR - display.d_Y0R) / range;
            for (int i = 0; i <= range; i++)
            {
                Yr2r[i] = display.d_Vrwr * ((float)Math.Pow((double)i / range, gamma));
            }

            /* Green */
            gamma = 1.0 / display.d_gammaG;
            gstep = (display.d_YCR - display.d_Y0R) / range;
            for (int i = 0; i <= range; i++)
            {
                Yg2g[i] = display.d_Vrwg * ((float)Math.Pow((double)i / range, gamma));
            }

            /* Blue */
            gamma = 1.0 / display.d_gammaB;
            bstep = (display.d_YCR - display.d_Y0R) / range;
            for (int i = 0; i <= range; i++)
            {
                Yb2b[i] = display.d_Vrwb * ((float)Math.Pow((double)i / range, gamma));
            }

            /* Init reference white point */
            X0 = refWhite[0];
            Y0 = refWhite[1];
            Z0 = refWhite[2];
        }
Exemplo n.º 2
0
        /*
         * Allocate conversion state structures and make look_up tables for
         * the Yr,Yb,Yg <=> r,g,b conversions.
         */
        public void Init(TiffDisplay refDisplay, float[] refWhite)
        {
            range = CIELABTORGB_TABLE_RANGE;

            display = refDisplay;

            /* Red */
            double gamma = 1.0 / display.d_gammaR;

            rstep = (display.d_YCR - display.d_Y0R) / range;
            for (int i = 0; i <= range; i++)
            {
                Yr2r[i] = display.d_Vrwr * ((float)Math.Pow((double)i / range, gamma));
            }

            /* Green */
            gamma = 1.0 / display.d_gammaG;
            gstep = (display.d_YCR - display.d_Y0R) / range;
            for (int i = 0; i <= range; i++)
            {
                Yg2g[i] = display.d_Vrwg * ((float)Math.Pow((double)i / range, gamma));
            }

            /* Blue */
            gamma = 1.0 / display.d_gammaB;
            bstep = (display.d_YCR - display.d_Y0R) / range;
            for (int i = 0; i <= range; i++)
            {
                Yb2b[i] = display.d_Vrwb * ((float)Math.Pow((double)i / range, gamma));
            }

            /* Init reference white point */
            X0 = refWhite[0];
            Y0 = refWhite[1];
            Z0 = refWhite[2];
        }