221 double hdef[4] = {20.14, 90.00, 164.25, 237.53};
222 double edef[4] = {0.8, 0.7, 1.0, 1.2};
224 for (i = 0; i < 4; i++)
244 return (
icFloatNumber)(edef[j] + (edef[i] - edef[j]) * (hue - hdef[j]) / (offset + hdef[i] - hdef[j]));
476 icFloatNumber la, lb, lc, lchroma, lh, lhr, A, J, et, t, C, ac, bc;
488 if (rgb[0] < 0) rgb[0] = 0.0f;
489 if (rgb[1] < 0) rgb[1] = 0.0f;
490 if (rgb[2] < 0) rgb[2] = 0.0f;
498 la = (
icFloatNumber)(rgbP[0] - 12.0 * rgbP[1] / 11.0 + rgbP[2] / 11.0);
499 lb = (
icFloatNumber)((rgbP[0] + rgbP[1] - 2.0 * rgbP[2] ) / 9.0);
510 t = (
icFloatNumber)(50.0 * lchroma * 100 * et * 10.0/13.0 *
m_Nc *
m_Nbb / (rgbP[0]+rgbP[1]+21.0/20.0*rgbP[2]));
534 icFloatNumber lc, lh, lhr, et, p1, p2, p4, p5, p3, numerator;
536 double exp = 1.0 / 0.9;
537 double A, ratio, C, t;
546 if (h_jab[0] < 1.0e-5)
554 C = sqrt (h_jab[1] * h_jab[1] + h_jab[2] * h_jab[2]);
556 ratio = C / (sqrt (h_jab[0]/100.0) *
m_factor);
557 t = pow (ratio, exp);
570 ab2chDeg (h_jab[1], h_jab[2], lc, lh);
578 numerator = p2 * (2.0f + p3);
580 if ((lh <= 45) || (lh >= 315) || ((lh > 135) && (lh < 225)))
584 if ((lh > 90) && (lh < 270))
585 value = (
icFloatNumber)(- pow (1 + pow ((
double)tanValue, 2.0), 0.5));
587 value = (
icFloatNumber)(pow (1 + pow ((
double)tanValue, 2.0), 0.5));
591 a = (
icFloatNumber)(numerator / (p5 + (2.0f+p3)*(220.0f/1403.0f) - (27.0f/1403.0f - p3*(6300.0f/1403.0f)) * tanValue));
596 if (fabs (lh - 90) < 1.0e-5)
598 else if (fabs (lh - 270) < 1.0e-5)
604 value = (
icFloatNumber)(- pow (1 + pow ((
double)cotan , 2.0), 0.5));
606 value = (
icFloatNumber)(pow (1 + pow ((
double)cotan, 2.0), 0.5));
610 b = (
icFloatNumber)(numerator / (p4 + (2.0f+p3)*(220.0f/1403.0f) * cotan - 27.0f/1403.0f + p3*(6300.0f/1403.0f)));
614 rgbP[0] = (
icFloatNumber)(p2 + ( 451.0 * a + 288.0 * b) / 1403.0);
615 rgbP[1] = (
icFloatNumber)(p2 + (-891.0 * a - 261.0 * b) / 1403.0);
616 rgbP[2] = (
icFloatNumber)(p2 + (-220.0 * a - 6300.0 * b) / 1403.0);
620 if (rgbP[0] < 0) rgbP[0] = 0.0f;
621 if (rgbP[1] < 0) rgbP[1] = 0.0f;
622 if (rgbP[2] < 0) rgbP[2] = 0.0f;