[gimp] Make grayscale profile with LAB companding curve TRC
- From: Elle Stone <ellestone src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] Make grayscale profile with LAB companding curve TRC
- Date: Thu, 21 Apr 2016 09:34:16 +0000 (UTC)
commit db400d558a5f18a6d6905726f4376f38b88ecfcc
Author: Elle Stone <ellestone ninedegreesbelow com>
Date: Wed Apr 20 17:01:17 2016 -0400
Make grayscale profile with LAB companding curve TRC
libgimpcolor/gimpcolor.def | 1 +
libgimpcolor/gimpcolorprofile.c | 66 +++++++++++++++++++++++++++++++++++++++
libgimpcolor/gimpcolorprofile.h | 1 +
3 files changed, 68 insertions(+), 0 deletions(-)
---
diff --git a/libgimpcolor/gimpcolor.def b/libgimpcolor/gimpcolor.def
index 127f79e..9cd03ff 100644
--- a/libgimpcolor/gimpcolor.def
+++ b/libgimpcolor/gimpcolor.def
@@ -40,6 +40,7 @@ EXPORTS
gimp_color_profile_is_gray
gimp_color_profile_is_linear
gimp_color_profile_is_rgb
+ gimp_color_profile_new_d50_gray_lab_trc
gimp_color_profile_new_d65_gray_linear
gimp_color_profile_new_d65_gray_srgb_trc
gimp_color_profile_new_from_file
diff --git a/libgimpcolor/gimpcolorprofile.c b/libgimpcolor/gimpcolorprofile.c
index 8c1ae71..39a25ab 100644
--- a/libgimpcolor/gimpcolorprofile.c
+++ b/libgimpcolor/gimpcolorprofile.c
@@ -1344,6 +1344,72 @@ gimp_color_profile_new_d65_gray_linear (void)
return gimp_color_profile_new_from_icc_profile (data, length, NULL);
}
+static cmsHPROFILE *
+gimp_color_profile_new_d50_gray_lab_trc_internal (void)
+{
+ cmsHPROFILE profile;
+
+ /* white point is D50 from the ICC profile illuminant specs */
+ cmsCIExyY whitepoint = {0.345702915, 0.358538597, 1.0};
+
+ cmsFloat64Number lab_parameters[5] =
+ { 3.0, 1.0 / 1.16, 0.16 / 1.16, 2700.0 / 24389.0, 0.08000 };
+
+ cmsToneCurve *curve = cmsBuildParametricToneCurve (NULL, 4,
+ lab_parameters);
+
+ profile = cmsCreateGrayProfile (&whitepoint, curve);
+
+ cmsFreeToneCurve (curve);
+
+ gimp_color_profile_set_tag (profile, cmsSigProfileDescriptionTag,
+ "GIMP built-in D50 Grayscale with LAB L TRC");
+ gimp_color_profile_set_tag (profile, cmsSigDeviceMfgDescTag,
+ "GIMP");
+ gimp_color_profile_set_tag (profile, cmsSigDeviceModelDescTag,
+ "D50 Grayscale with LAB L TRC");
+ gimp_color_profile_set_tag (profile, cmsSigCopyrightTag,
+ "Public Domain");
+
+ return profile;
+}
+
+
+/**
+ * gimp_color_profile_new_d50_gray_lab_trc
+ *
+ * This function creates a grayscale #GimpColorProfile with the
+ * D50 ICC profile illuminant as the profile white point and the
+ * LAB companding curve as the TRC.
+ *
+ * Return value: a gray profile with the D50 ICC profile illuminant
+ * as the profile white point and the LAB companding curve as the TRC.
+ * as the TRC.
+ *
+ * Since: 2.10
+ **/
+GimpColorProfile *
+gimp_color_profile_new_d50_gray_lab_trc (void)
+{
+ static GimpColorProfile *profile = NULL;
+
+ const guint8 *data;
+ gsize length;
+
+ if (G_UNLIKELY (profile == NULL))
+ {
+ cmsHPROFILE lcms_profile = gimp_color_profile_new_d50_gray_lab_trc_internal ();
+
+ profile = gimp_color_profile_new_from_lcms_profile (lcms_profile, NULL);
+
+ cmsCloseProfile (lcms_profile);
+ }
+
+ data = gimp_color_profile_get_icc_profile (profile, &length);
+
+ return gimp_color_profile_new_from_icc_profile (data, length, NULL);
+}
+
/**
* gimp_color_profile_get_format:
* @format: a #Babl format
diff --git a/libgimpcolor/gimpcolorprofile.h b/libgimpcolor/gimpcolorprofile.h
index 881385e..222c1e1 100644
--- a/libgimpcolor/gimpcolorprofile.h
+++ b/libgimpcolor/gimpcolorprofile.h
@@ -70,6 +70,7 @@ GimpColorProfile * gimp_color_profile_new_rgb_adobe (void);
GimpColorProfile * gimp_color_profile_new_d65_gray_srgb_trc (void);
GimpColorProfile * gimp_color_profile_new_d65_gray_linear (void);
+GimpColorProfile * gimp_color_profile_new_d50_gray_lab_trc (void);
GimpColorProfile *
gimp_color_profile_new_srgb_trc_from_color_profile (GimpColorProfile *profile);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]