Esempio n. 1
0
        public CIERGBDefinition(CIEXYZColour red, CIEXYZColour green, CIEXYZColour blue, CIEXYZColour white)
        {
            this.Red   = red;
            this.Green = green;
            this.Blue  = blue;
            this.White = white;

            // Calculate the RGB transform model
            var m = DenseMatrix.OfArray(new double[, ] {
                { Red.X, Green.X, Blue.X },
                { Red.Y, Green.Y, Blue.Y }, //NB: Y should be 1.0
                { Red.Z, Green.Z, Blue.Z }
            });
            var mi = m.Inverse();

            var refwhite = (Vector <double>)White;
            var srgb     = mi * refwhite;

            this.rgb2xyz = DenseMatrix.OfArray(new double[, ] {
                { srgb[0] * m[0, 0], srgb[1] * m[0, 1], srgb[2] * m[0, 2] },
                { srgb[0] * m[1, 0], srgb[1] * m[1, 1], srgb[2] * m[1, 2] },
                { srgb[0] * m[2, 0], srgb[1] * m[2, 1], srgb[2] * m[2, 2] },
            }).Transpose();
            this.xyz2rgb = rgb2xyz.Inverse();
        }
Esempio n. 2
0
        public CIERGBDefinition(CIEXYZColour red, CIEXYZColour green, CIEXYZColour blue, CIEXYZColour white)
        {
            this.Red = red;
            this.Green = green;
            this.Blue = blue;
            this.White = white;

            // Calculate the RGB transform model
            var m = DenseMatrix.OfArray(new double[,] {
                {Red.X, Green.X, Blue.X},
                {Red.Y, Green.Y, Blue.Y}, //NB: Y should be 1.0
                {Red.Z, Green.Z, Blue.Z}
            });
            var mi = m.Inverse();

            var refwhite = (Vector<double>)White;
            var srgb = mi * refwhite;

            this.rgb2xyz = DenseMatrix.OfArray(new double[,] {
                {srgb[0]*m[0,0], srgb[1]*m[0,1], srgb[2]*m[0,2]},
                {srgb[0]*m[1,0], srgb[1]*m[1,1], srgb[2]*m[1,2]},
                {srgb[0]*m[2,0], srgb[1]*m[2,1], srgb[2]*m[2,2]},
            }).Transpose();
            this.xyz2rgb = rgb2xyz.Inverse();
        }
Esempio n. 3
0
        // Not valid, because the PWM value isn't available for reading
        /*public PWMStruct GetPWM()
        {
            SendPacket(CMD_GET_PWM);
            return ReadReply<PWMStruct>(CMD_GET_PWM);
        }*/

        public void SetXYZ(CIEXYZColour xyz)
        {
            TransferPacket<XYZStruct>(CMD_SET_XYZ, new XYZStruct
            {
                X = (float)xyz.X,
                Y = (float)xyz.Y,
                Z = (float)xyz.Z
            });
        }
Esempio n. 4
0
 private void TemperatureChanged()
 {
     xyzColor = (CIEXYZColour)temperature;
     xyyColor = (CIEXYYColor)xyzColor;
     rgbColor = (RGBColor)xyzColor;
     hsvColor = (HSVColor)rgbColor;
     //this.RgbChanged();
 }
Esempio n. 5
0
 private void RgbChanged()
 {
     hsvColor = (HSVColor)rgbColor;
     xyzColor = rgbColor;
     xyyColor = xyzColor;
     //application.color = rgbColor;
 }
Esempio n. 6
0
 private void HsvChanged()
 {
     rgbColor = hsvColor.ToRGB();
     xyzColor = rgbColor;
     xyyColor = xyzColor;
     //application.color = rgbColor;
 }
Esempio n. 7
0
 private void CiexyYChanged()
 {
     xyzColor = xyyColor;
     rgbColor = xyzColor;
     hsvColor = rgbColor;
 }