[gnome-color-manager] Add gcm_profile_set_vcgt_from_data() to be able to set VCGT from IT8 files in the future
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-color-manager] Add gcm_profile_set_vcgt_from_data() to be able to set VCGT from IT8 files in the future
- Date: Wed, 13 Oct 2010 14:30:48 +0000 (UTC)
commit 86863ba304953f2620471209f10cb3670c9ece97
Author: Richard Hughes <richard hughsie com>
Date: Wed Oct 13 16:26:35 2010 +0100
Add gcm_profile_set_vcgt_from_data() to be able to set VCGT from IT8 files in the future
libcolor-glib/gcm-profile.c | 47 +++++++++++++++++++++++++++++++++++++++++++
libcolor-glib/gcm-profile.h | 6 +++++
2 files changed, 53 insertions(+), 0 deletions(-)
---
diff --git a/libcolor-glib/gcm-profile.c b/libcolor-glib/gcm-profile.c
index 69894e7..3234c78 100644
--- a/libcolor-glib/gcm-profile.c
+++ b/libcolor-glib/gcm-profile.c
@@ -1196,6 +1196,53 @@ out:
}
/**
+ * gcm_profile_set_vcgt_from_data:
+ * @profile: A valid #GcmProfile
+ * @red: red color data
+ * @green: green color data
+ * @blue: blue color data
+ * @size: the size of the color curves.
+ *
+ * Sets a VCGT curve of a specified size.
+ *
+ * Return value: %TRUE for success
+ *
+ * Since: 0.0.1
+ **/
+gboolean
+gcm_profile_set_vcgt_from_data (GcmProfile *profile, guint16 *red, guint16 *green, guint16 *blue, guint size, GError **error)
+{
+ guint i;
+ gboolean ret = FALSE;
+ cmsToneCurve *vcgt_curve[3];
+ GcmProfilePrivate *priv = profile->priv;
+
+ /* not loaded or created */
+ if (priv->lcms_profile == NULL)
+ priv->lcms_profile = cmsCreateProfilePlaceholder (NULL);
+
+ /* print what we've got */
+ for (i=0; i<size; i++)
+ egg_debug ("VCGT%i = %i,%i,%i", i, red[i], green[i], blue[i]);
+
+ /* build tone curve */
+ vcgt_curve[0] = cmsBuildTabulatedToneCurve16 (NULL, size, red);
+ vcgt_curve[1] = cmsBuildTabulatedToneCurve16 (NULL, size, green);
+ vcgt_curve[2] = cmsBuildTabulatedToneCurve16 (NULL, size, blue);
+
+ /* write the tag */
+ ret = cmsWriteTag (priv->lcms_profile, cmsSigVcgtType, vcgt_curve);
+ for (i=0; i<3; i++)
+ cmsFreeToneCurve (vcgt_curve[i]);
+ if (!ret) {
+ g_set_error_literal (error, 1, 0, "Failed to set vcgt");
+ goto out;
+ }
+out:
+ return ret;
+}
+
+/**
* gcm_profile_generate_curve:
* @profile: A valid #GcmProfile
* @size: the size of the curve to generate
diff --git a/libcolor-glib/gcm-profile.h b/libcolor-glib/gcm-profile.h
index c6cc720..c1a5970 100644
--- a/libcolor-glib/gcm-profile.h
+++ b/libcolor-glib/gcm-profile.h
@@ -83,6 +83,12 @@ GcmClut *gcm_profile_generate_vcgt (GcmProfile *profile,
guint size);
GcmClut *gcm_profile_generate_curve (GcmProfile *profile,
guint size);
+gboolean gcm_profile_set_vcgt_from_data (GcmProfile *profile,
+ guint16 *red,
+ guint16 *green,
+ guint16 *blue,
+ guint size,
+ 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]