// Code for D50 reference white //public static RGB XYZtoRGB(double x, double y, double z) //{ // double[] Clinear = new double[3]; // // From Rob2412 // Clinear[0] = x * 3.1338561 - y * -1.6168667 - z * -0.4906146; // red // Clinear[1] = -x * -0.9787684 + y * 1.9161415 - z * 0.0334540; // green // Clinear[2] = x * 0.0719453 - y * -0.2289914 + z * 1.4052427; // blue // for (int i = 0; i < 3; i++) // { // Clinear[i] = (Clinear[i]<=0.0031308)? 12.92*Clinear[i] : (1+0.055)* Math.Pow(Clinear[i], (1.0/2.4)) - 0.055; // } // return new RGB( // Convert.ToInt32( Double.Parse(String.Format("{0:0.00}", Clinear[0]*255.0)) ), // Convert.ToInt32( Double.Parse(String.Format("{0:0.00}", Clinear[1]*255.0)) ), // Convert.ToInt32( Double.Parse(String.Format("{0:0.00}", Clinear[2]*255.0)) ) // ); //} /// <summary> /// Converts CIEXYZ to RGB structure. /// </summary> public static RGB XYZtoRGB(CIEXYZ xyz) { return XYZtoRGB(xyz.X, xyz.Y, xyz.Z); }
/// <summary> /// Converts CIEXYZ to CIELab structure. /// </summary> public static CIELab XYZtoLab(CIEXYZ xyz) { return(XYZtoLab(xyz.X, xyz.Y, xyz.Z)); }
/// <summary> /// Converts CIEXYZ to CIELab structure. /// </summary> public static CIELab XYZtoLab(CIEXYZ xyz) { return XYZtoLab(xyz.X, xyz.Y, xyz.Z); }
// Code for D50 reference white //public static RGB XYZtoRGB(double x, double y, double z) //{ // double[] Clinear = new double[3]; // // From Rob2412 // Clinear[0] = x * 3.1338561 - y * -1.6168667 - z * -0.4906146; // red // Clinear[1] = -x * -0.9787684 + y * 1.9161415 - z * 0.0334540; // green // Clinear[2] = x * 0.0719453 - y * -0.2289914 + z * 1.4052427; // blue // for (int i = 0; i < 3; i++) // { // Clinear[i] = (Clinear[i]<=0.0031308)? 12.92*Clinear[i] : (1+0.055)* Math.Pow(Clinear[i], (1.0/2.4)) - 0.055; // } // return new RGB( // Convert.ToInt32( Double.Parse(String.Format("{0:0.00}", Clinear[0]*255.0)) ), // Convert.ToInt32( Double.Parse(String.Format("{0:0.00}", Clinear[1]*255.0)) ), // Convert.ToInt32( Double.Parse(String.Format("{0:0.00}", Clinear[2]*255.0)) ) // ); //} /// <summary> /// Converts CIEXYZ to RGB structure. /// </summary> public static RGB XYZtoRGB(CIEXYZ xyz) { return(XYZtoRGB(xyz.X, xyz.Y, xyz.Z)); }