Esempio n. 1
0
 protected override Rgb ToRgb()
 {
     Xyz xyz;
     if (Y2.Equals(0))
     {
         xyz = new Xyz(0, 0, 0);
     }
     else
     {
         xyz = new Xyz
         {
             X = X * (Y1 / Y2),
             Y = Y1,
             Z = (1.0 - X - Y2) * (Y1 / Y2)
         };
     }
     return xyz.ToColorSpace<Rgb>();
 }
Esempio n. 2
0
 protected override Rgb ToRgb()
 {
     var referenceDenominator = Xyz.WhiteReference[0] + 15.0 * Xyz.WhiteReference[1] + 3.0 * Xyz.WhiteReference[2];
     var u1 = 4.0 * Xyz.WhiteReference[0] / referenceDenominator;
     var v1 = 9.0 * Xyz.WhiteReference[1] / referenceDenominator;
     var a = 1.0 / 3.0 * (52.0 * L / (U + 13.0 * L * u1) - 1.0);
     var y = L > Xyz.Kappa * Xyz.Epsilon ? System.Math.Pow((L + 16.0) / 116.0, 3) : L / Xyz.Kappa;
     var b = -5.0 * y;
     var d = y * (39.0 * L / (V + 13.0 * L * v1) - 5.0);
     var x = (d - b) / (a - -1.0 / 3.0);
     var z = x * a + b;
     var xyz = new Xyz
     {
         X = 100 * x,
         Y = 100 * y,
         Z = 100 * z
     };
     return xyz.ToColorSpace<Rgb>();
 }
Esempio n. 3
0
        protected override Rgb ToRgb()
        {
            var y = (L + 16.0) / 116.0;
            var x = A / 500.0 + y;
            var z = y - B / 200.0;
            var xCubed = System.Math.Pow(x, 3);
            var zCubed = System.Math.Pow(z, 3);

            var xyz = new Xyz
            {
                X = Xyz.WhiteReference[0] * (xCubed > Xyz.Epsilon ? xCubed : (x - 16.0 / 116.0) / 7.787),
                Y = Xyz.WhiteReference[1] * (L > Xyz.Kappa * Xyz.Epsilon ? System.Math.Pow((L + 16.0) / 116.0, 3) : L / Xyz.Kappa),
                Z = Xyz.WhiteReference[2] * (zCubed > Xyz.Epsilon ? zCubed : (z - 16.0 / 116.0) / 7.787)
            };

            return xyz.ToColorSpace<Rgb>();
        }
        protected override Rgb ToRgb()
        {
            var x = A / 17.5 * (L / 10.0);
            var y = L / 10.0 * (L / 10.0);
            var z = B / 7.0 * (L / 10.0);

            var xyz = new Xyz
            {
                X = (x + y) / 1.02,
                Y = y,
                Z = -(z - y) / 0.847
            };
            return xyz.ToColorSpace<Rgb>();
        }