예제 #1
0
        /// <summary>
        /// Calculates the matrix for the chromatic adaption
        /// </summary>
        /// <param name="inXYZ">The pointer to the input whitepoint XYZ values</param>
        /// <param name="outXYZ">The pointer to the output whitepoint XYZ values</param>
        /// <returns>The matrix for the chromatic adaption</returns>
        public double[] CalculateMatrix(double *inXYZ, double *outXYZ)
        {
            double[] result = new double[9];

            fixed(double *ma = MA)
            fixed(double *ma1 = MA1)
            fixed(double *res = result)
            {
                double *M  = stackalloc double[9];
                double *M2 = stackalloc double[9];
                double *S  = stackalloc double[3];
                double *D  = stackalloc double[3];

                UMath.MultiplyMatrix_3x3_3x1(ma, inXYZ, S);
                UMath.MultiplyMatrix_3x3_3x1(ma, outXYZ, D);
                M[0] = D[0] / S[0];
                M[4] = D[1] / S[1];
                M[8] = D[2] / S[2];
                UMath.MultiplyMatrix_3x3_3x3(ma1, M, M2);
                UMath.MultiplyMatrix_3x3_3x3(M2, ma, res);
            }

            return(result);
        }
예제 #2
0
 /// <summary>
 /// The method that does the chromatic adaption
 /// </summary>
 /// <param name="inColor">The pointer to the input color values</param>
 /// <param name="outColor">The pointer to the output color values</param>
 /// <param name="data">The data that is used to perform the chromatic adaption</param>
 public static void CAMethod(double *inColor, double *outColor, ConversionData data)
 {
     UMath.MultiplyMatrix_3x3_3x1((double *)data.CAData, inColor, outColor);
 }