Пример #1
0
        public IColor FromXYZColor(XYZColor xyzColor)
        {
            var x = xyzColor.X / (xyzColor.X + xyzColor.Y + xyzColor.Z);
            var y = xyzColor.Y / (xyzColor.X + xyzColor.Y + xyzColor.Z);

            return new xyYColor(xyzColor.Alpha, x, y, xyzColor.Y);
        }
Пример #2
0
        public IColor FromXYZColor(XYZColor xyzColor)
        {
            var xyzVector = new double[3] { xyzColor.X.Value, xyzColor.Y.Value, xyzColor.Z.Value };

            var rgbVector = Multiply(M_XYZToRGB, xyzVector);

            return GetColor(xyzColor.Alpha.Value, rgbVector[0], rgbVector[1], rgbVector[2]);
        }
Пример #3
0
        internal XYZColorSpace()
        {
            Alpha = new ColorChannelDefinition(this, "Alpha", "A");

            // DisplayValue = Value * 100 and up to three fraction digits
            X = new ColorChannelDefinition(this, "X", "X", (v) => Math.Round(100 * v, 3, MidpointRounding.AwayFromZero));
            Y = new ColorChannelDefinition(this, "Y", "Y", (v) => Math.Round(100 * v, 3, MidpointRounding.AwayFromZero));
            Z = new ColorChannelDefinition(this, "Z", "Z", (v) => Math.Round(100 * v, 3, MidpointRounding.AwayFromZero));

            whitePoint = new XYZColor(this, 1.0, 0.95047, 1.0, 1.088969);
        }
Пример #4
0
        public IColor FromXYZColor(XYZColor xyzColor)
        {
            /// conversion algorithm created with help of http://en.wikipedia.org/wiki/Lab_color_space
            
            var fx = f_forward_conversion(xyzColor.X, KnownColorSpaces.XYZ.WhitePoint.X);
            var fy = f_forward_conversion(xyzColor.Y, KnownColorSpaces.XYZ.WhitePoint.Y);
            var fz = f_forward_conversion(xyzColor.Z, KnownColorSpaces.XYZ.WhitePoint.Z);

            var L = 116 * fy - 16;
            var a = 500 * (fx - fy);
            var b = 200 * (fy - fz);

            return new LabColor(xyzColor.Alpha, L, a, b);
        }
Пример #5
0
 public IColor FromXYZColor(XYZColor xyzColor)
 {
     return xyzColor;
 }