struct matrix build_colorant_matrix(qcms_profile *p) { struct matrix result; result.m[0][0] = s15Fixed16Number_to_float(p->redColorant.X); result.m[0][1] = s15Fixed16Number_to_float(p->greenColorant.X); result.m[0][2] = s15Fixed16Number_to_float(p->blueColorant.X); result.m[1][0] = s15Fixed16Number_to_float(p->redColorant.Y); result.m[1][1] = s15Fixed16Number_to_float(p->greenColorant.Y); result.m[1][2] = s15Fixed16Number_to_float(p->blueColorant.Y); result.m[2][0] = s15Fixed16Number_to_float(p->redColorant.Z); result.m[2][1] = s15Fixed16Number_to_float(p->greenColorant.Z); result.m[2][2] = s15Fixed16Number_to_float(p->blueColorant.Z); result.invalid = false; return result; }
static qcms_triangle get_profile_triangle(qcms_profile *profile) { float sumRed = s15Fixed16Number_to_float(profile->redColorant.X) + s15Fixed16Number_to_float(profile->redColorant.Y) + s15Fixed16Number_to_float(profile->redColorant.Z); float xRed = s15Fixed16Number_to_float(profile->redColorant.X) / sumRed; float yRed = s15Fixed16Number_to_float(profile->redColorant.Y) / sumRed; float sumGreen = s15Fixed16Number_to_float(profile->greenColorant.X) + s15Fixed16Number_to_float(profile->greenColorant.Y) + s15Fixed16Number_to_float(profile->greenColorant.Z); float xGreen = s15Fixed16Number_to_float(profile->greenColorant.X) / sumGreen; float yGreen = s15Fixed16Number_to_float(profile->greenColorant.Y) / sumGreen; float sumBlue = s15Fixed16Number_to_float(profile->blueColorant.X) + s15Fixed16Number_to_float(profile->blueColorant.Y) + s15Fixed16Number_to_float(profile->blueColorant.Z); float xBlue = s15Fixed16Number_to_float(profile->blueColorant.X) / sumBlue; float yBlue = s15Fixed16Number_to_float(profile->blueColorant.Y) / sumBlue; qcms_triangle triangle = {{{xRed, yRed}, {xGreen, yGreen}, {xBlue, yBlue}}}; return triangle; }