[gnome-color-manager] trivial: add gcm_profile_set_whitepoint() and gcm_profile_set_primaries() for future code



commit 4636834f2a0320e9e9790ddaae4a0bb82dc4f7c9
Author: Richard Hughes <richard hughsie com>
Date:   Thu Oct 14 13:04:19 2010 +0100

    trivial: add gcm_profile_set_whitepoint() and gcm_profile_set_primaries() for future code

 libcolor-glib/gcm-profile.c |   88 +++++++++++++++++++++++++++++++++++++++++++
 libcolor-glib/gcm-profile.h |    8 ++++
 2 files changed, 96 insertions(+), 0 deletions(-)
---
diff --git a/libcolor-glib/gcm-profile.c b/libcolor-glib/gcm-profile.c
index 69712ee..cacd11b 100644
--- a/libcolor-glib/gcm-profile.c
+++ b/libcolor-glib/gcm-profile.c
@@ -940,6 +940,94 @@ _cmsWriteTagTextAscii (cmsHPROFILE lcms_profile, cmsTagSignature sig, const gcha
 }
 
 /**
+ * gcm_profile_set_whitepoint:
+ * @profile: A valid #GcmProfile
+ * @whitepoint: the whitepoint
+ * @error: A #GError, or %NULL
+ *
+ * Saves the whitepoint data to a file.
+ *
+ * Return value: %TRUE for success
+ *
+ * Since: 0.0.1
+ **/
+gboolean
+gcm_profile_set_whitepoint (GcmProfile *profile, const GcmColorXYZ *whitepoint, GError **error)
+{
+	gboolean ret;
+	GcmProfilePrivate *priv = profile->priv;
+
+	/* not loaded */
+	if (priv->lcms_profile == NULL)
+		priv->lcms_profile = cmsCreateProfilePlaceholder (NULL);
+
+	/* copy */
+	gcm_color_copy_XYZ (whitepoint, priv->white);
+
+	/* write tag */
+	ret = cmsWriteTag (priv->lcms_profile, cmsSigMediaWhitePointTag, priv->white);
+	if (!ret) {
+		g_set_error_literal (error, 1, 0, "failed to set write cmsSigMediaWhitePointTag");
+		goto out;
+	}
+out:
+	return ret;
+}
+
+/**
+ * gcm_profile_set_primaries:
+ * @profile: A valid #GcmProfile
+ * @red: the red primary
+ * @green: the green primary
+ * @blue: the blue primary
+ * @error: A #GError, or %NULL
+ *
+ * Saves the primaries data to a file.
+ *
+ * Return value: %TRUE for success
+ *
+ * Since: 0.0.1
+ **/
+gboolean
+gcm_profile_set_primaries (GcmProfile *profile,
+			   const GcmColorXYZ *red,
+			   const GcmColorXYZ *green,
+			   const GcmColorXYZ *blue,
+			   GError **error)
+{
+	gboolean ret;
+	GcmProfilePrivate *priv = profile->priv;
+
+	/* not loaded */
+	if (priv->lcms_profile == NULL)
+		priv->lcms_profile = cmsCreateProfilePlaceholder (NULL);
+
+	/* copy */
+	gcm_color_copy_XYZ (red, priv->red);
+	gcm_color_copy_XYZ (green, priv->green);
+	gcm_color_copy_XYZ (blue, priv->blue);
+
+	/* write tags */
+	ret = cmsWriteTag (priv->lcms_profile, cmsSigRedMatrixColumnTag, priv->red);
+	if (!ret) {
+		g_set_error_literal (error, 1, 0, "failed to set write cmsSigRedMatrixColumnTag");
+		goto out;
+	}
+	ret = cmsWriteTag (priv->lcms_profile, cmsSigGreenMatrixColumnTag, priv->green);
+	if (!ret) {
+		g_set_error_literal (error, 1, 0, "failed to set write cmsSigGreenMatrixColumnTag");
+		goto out;
+	}
+	ret = cmsWriteTag (priv->lcms_profile, cmsSigBlueMatrixColumnTag, priv->blue);
+	if (!ret) {
+		g_set_error_literal (error, 1, 0, "failed to set write cmsSigBlueMatrixColumnTag");
+		goto out;
+	}
+out:
+	return ret;
+}
+
+/**
  * gcm_profile_save:
  * @profile: A valid #GcmProfile
  * @filename: the data to parse
diff --git a/libcolor-glib/gcm-profile.h b/libcolor-glib/gcm-profile.h
index c1a5970..e4cb774 100644
--- a/libcolor-glib/gcm-profile.h
+++ b/libcolor-glib/gcm-profile.h
@@ -89,6 +89,14 @@ gboolean	 gcm_profile_set_vcgt_from_data		(GcmProfile	*profile,
 							 guint16	*blue,
 							 guint		 size,
 							 GError		**error);
+gboolean	 gcm_profile_set_whitepoint		(GcmProfile	*profile,
+							 const GcmColorXYZ *whitepoint,
+							 GError		**error);
+gboolean	 gcm_profile_set_primaries		(GcmProfile	*profile,
+							 const GcmColorXYZ *red,
+							 const GcmColorXYZ *green,
+							 const GcmColorXYZ *blue,
+							 GError		**error);
 gboolean	 gcm_profile_create_from_chroma		(GcmProfile	*profile,
 							 gdouble	 gamma,
 							 const GcmColorYxy *red,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]