[gnome-color-manager] If getting the illuminants failed, try running it through the profile
- From: Richard Hughes <rhughes src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnome-color-manager] If getting the illuminants failed, try running it through the profile
- Date: Thu, 10 Dec 2009 21:09:48 +0000 (UTC)
commit 4d23924e022c5d02015ebdc9cd9274fe0473a38e
Author: Richard Hughes <richard hughsie com>
Date: Thu Dec 10 21:09:05 2009 +0000
If getting the illuminants failed, try running it through the profile
This should get more CIE widgets working when using the RGB space, in particular scanner profiles
src/gcm-profile.c | 40 ++++++++++++++++++++++++++++++++++++++++
1 files changed, 40 insertions(+), 0 deletions(-)
---
diff --git a/src/gcm-profile.c b/src/gcm-profile.c
index ba2b410..ddd314e 100644
--- a/src/gcm-profile.c
+++ b/src/gcm-profile.c
@@ -587,6 +587,46 @@ gcm_profile_parse_data (GcmProfile *profile, const guint8 *data, gsize length, G
/* get primary illuminants */
ret = cmsTakeColorants (&cie_illum, priv->lcms_profile);
+
+ /* geting the illuminants failed, try running it through the profile */
+ if (!ret) {
+ cmsHPROFILE xyz_profile;
+ cmsHTRANSFORM transform;
+ gdouble rgb_values[3];
+
+ /* create a transform from profile to XYZ */
+ xyz_profile = cmsCreateXYZProfile ();
+ transform = cmsCreateTransform (priv->lcms_profile, TYPE_RGB_DBL, xyz_profile, TYPE_XYZ_DBL, INTENT_PERCEPTUAL, 0);
+ if (transform != NULL) {
+
+ /* red */
+ rgb_values[0] = 1.0;
+ rgb_values[1] = 0.0;
+ rgb_values[2] = 0.0;
+ cmsDoTransform (transform, rgb_values, &cie_illum.Red, 1);
+
+ /* green */
+ rgb_values[0] = 0.0;
+ rgb_values[1] = 1.0;
+ rgb_values[2] = 0.0;
+ cmsDoTransform (transform, rgb_values, &cie_illum.Green, 1);
+
+ /* blue */
+ rgb_values[0] = 0.0;
+ rgb_values[1] = 0.0;
+ rgb_values[2] = 1.0;
+ cmsDoTransform (transform, rgb_values, &cie_illum.Blue, 1);
+
+ /* we're done */
+ cmsDeleteTransform (transform);
+ ret = TRUE;
+ }
+
+ /* no more need for the output profile */
+ cmsCloseProfile (xyz_profile);
+ }
+
+ /* we've got valid values */
if (ret) {
g_object_set (priv->luminance_red,
"cie-x", cie_illum.Red.X,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]