[gimp] Bug 723787 - Neutral sRGB profile matching Argyllcms sRGB.icm
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] Bug 723787 - Neutral sRGB profile matching Argyllcms sRGB.icm
- Date: Sun, 9 Feb 2014 22:13:00 +0000 (UTC)
commit 05c5ca32160f37b9a36b07f465bb834dc8af27c3
Author: Elle Stone <ellestone ninedegreesbelow com>
Date: Thu Feb 6 09:53:37 2014 -0500
Bug 723787 - Neutral sRGB profile matching Argyllcms sRGB.icm
Add gimp_lcms_create_srgb_profile() to libgimpcolor and use it where
we used to call cmsCreate_sRGBProfile().
libgimpcolor/Makefile.am | 5 ++
libgimpcolor/gimpcolor.h | 1 +
libgimpcolor/gimplcms.c | 99 ++++++++++++++++++++++++++++++++++++++++
libgimpcolor/gimplcms.h | 40 ++++++++++++++++
modules/color-selector-cmyk.c | 2 +-
modules/display-filter-lcms.c | 8 ++--
modules/display-filter-proof.c | 2 +-
plug-ins/common/lcms.c | 12 ++--
plug-ins/file-jpeg/jpeg-load.c | 4 +-
9 files changed, 159 insertions(+), 14 deletions(-)
---
diff --git a/libgimpcolor/Makefile.am b/libgimpcolor/Makefile.am
index c2fd45f..8ba746d 100644
--- a/libgimpcolor/Makefile.am
+++ b/libgimpcolor/Makefile.am
@@ -53,6 +53,7 @@ AM_CPPFLAGS = \
$(GEGL_CFLAGS) \
$(CAIRO_CFLAGS) \
$(GDK_PIXBUF_CFLAGS) \
+ $(LCMS_CFLAGS) \
-I$(includedir)
EXTRA_DIST = \
@@ -79,6 +80,8 @@ libgimpcolor_ GIMP_API_VERSION@_la_SOURCES = \
gimphsl.h \
gimphsv.c \
gimphsv.h \
+ gimplcms.c \
+ gimplcms.h \
gimppixbuf.c \
gimppixbuf.h \
gimprgb.c \
@@ -96,6 +99,7 @@ libgimpcolorinclude_HEADERS = \
gimpcolorspace.h \
gimphsl.h \
gimphsv.h \
+ gimplcms.h \
gimppixbuf.h \
gimprgb.h
@@ -112,6 +116,7 @@ libgimpcolor_ GIMP_API_VERSION@_la_LIBADD = \
$(GEGL_LIBS) \
$(CAIRO_LIBS) \
$(GDK_PIXBUF_LIBS) \
+ $(LCMS_LIBS) \
$(libm)
diff --git a/libgimpcolor/gimpcolor.h b/libgimpcolor/gimpcolor.h
index 0cd1024..696977a 100644
--- a/libgimpcolor/gimpcolor.h
+++ b/libgimpcolor/gimpcolor.h
@@ -31,6 +31,7 @@
#include <libgimpcolor/gimpcmyk.h>
#include <libgimpcolor/gimphsl.h>
#include <libgimpcolor/gimphsv.h>
+#include <libgimpcolor/gimplcms.h>
#include <libgimpcolor/gimppixbuf.h>
#include <libgimpcolor/gimprgb.h>
diff --git a/libgimpcolor/gimplcms.c b/libgimpcolor/gimplcms.c
new file mode 100644
index 0000000..e9a23d2
--- /dev/null
+++ b/libgimpcolor/gimplcms.c
@@ -0,0 +1,99 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-1997 Spencer Kimball and Peter Mattis
+ *
+ * gimplcms.c
+ * Copyright (C) 2014 Michael Natterer <mitch gimp org>
+ * Elle Stone <ellestone ninedegreesbelow com>
+ *
+ * This library is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see
+ * <http://www.gnu.org/licenses/>.
+ */
+
+#include "config.h"
+
+#include <glib.h> /* lcms.h uses the "inline" keyword */
+
+#include <lcms2.h>
+
+#include <gegl.h>
+
+#include "gimpcolortypes.h"
+
+#include "gimplcms.h"
+
+
+/**
+ * SECTION: gimplcms
+ * @title: GimpLcms
+ * @short_description: Definitions and Functions relating to LCMS.
+ *
+ * Definitions and Functions relating to LCMS.
+ **/
+
+
+/**
+ * gimp_lcms_create_srgb_profile:
+ *
+ * This function is a replacement for cmsCreate_sRGBProfile() and
+ * returns an sRGB profile that is functionally the same as the
+ * ArgyllCMS sRGB.icm profile. "Functionally the same" means it has
+ * the same red, green, and blue colorants and the V4 "chad"
+ * equivalent of the ArgyllCMS V2 white point. The profile TRC is also
+ * functionally equivalent to the ArgyllCMS sRGB.icm TRC and is the
+ * same as the LCMS sRGB built-in profile TRC.
+ *
+ * Return value: the sRGB cmsHPROFILE.
+ *
+ * Since: GIMP 2.10
+ **/
+gpointer
+gimp_lcms_create_srgb_profile (void)
+{
+ cmsHPROFILE srgb_profile;
+ cmsMLU *description;
+ cmsCIExyY d65_srgb_specs = { 0.3127, 0.3290, 1.0 };
+ cmsCIExyYTRIPLE srgb_primaries_pre_quantized =
+ {
+ { 0.639998686, 0.330010138, 1.0 },
+ { 0.300003784, 0.600003357, 1.0 },
+ { 0.150002046, 0.059997204, 1.0 }
+ };
+
+ cmsFloat64Number srgb_parameters[5] =
+ { 2.4, 1.0 / 1.055, 0.055 / 1.055, 1.0 / 12.92, 0.04045 };
+
+ cmsToneCurve *srgb_parametric_curve =
+ cmsBuildParametricToneCurve (NULL, 4, srgb_parameters);
+
+ cmsToneCurve *tone_curve[3];
+
+ tone_curve[0] = tone_curve[1] = tone_curve[2] = srgb_parametric_curve;
+
+ srgb_profile = cmsCreateRGBProfile (&d65_srgb_specs,
+ &srgb_primaries_pre_quantized,
+ tone_curve);
+
+ cmsFreeToneCurve (srgb_parametric_curve);
+
+ description = cmsMLUalloc (NULL, 1);
+ cmsMLUsetASCII (description,
+ "en", "US",
+ "sRGB made with the correct white point and primaries.");
+ cmsWriteTag (srgb_profile, cmsSigProfileDescriptionTag, description);
+ cmsMLUfree (description);
+
+ cmsSetProfileVersion (srgb_profile, 2.1);
+
+ return srgb_profile;
+}
diff --git a/libgimpcolor/gimplcms.h b/libgimpcolor/gimplcms.h
new file mode 100644
index 0000000..fa8712d
--- /dev/null
+++ b/libgimpcolor/gimplcms.h
@@ -0,0 +1,40 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-1997 Spencer Kimball and Peter Mattis
+ *
+ * gimplcms.h
+ * Copyright (C) 2014 Michael Natterer <mitch gimp org>
+ * Elle Stone <ellestone ninedegreesbelow com>
+ *
+ * This library is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see
+ * <http://www.gnu.org/licenses/>.
+ */
+
+#if !defined (__GIMP_COLOR_H_INSIDE__) && !defined (GIMP_COLOR_COMPILATION)
+#error "Only <libgimpcolor/gimpcolor.h> can be included directly."
+#endif
+
+#ifndef __GIMP_LCMS_H__
+#define __GIMP_LCMS_H__
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+
+gpointer gimp_lcms_create_srgb_profile (void);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_LCMS_H__ */
diff --git a/modules/color-selector-cmyk.c b/modules/color-selector-cmyk.c
index f081e0e..5d7772b 100644
--- a/modules/color-selector-cmyk.c
+++ b/modules/color-selector-cmyk.c
@@ -357,7 +357,7 @@ color_config_get_rgb_profile (GimpColorConfig *config)
if (config->rgb_profile)
profile = cmsOpenProfileFromFile (config->rgb_profile, "r");
- return profile ? profile : cmsCreate_sRGBProfile ();
+ return profile ? profile : gimp_lcms_create_srgb_profile ();
}
static void
diff --git a/modules/display-filter-lcms.c b/modules/display-filter-lcms.c
index 17966b7..68f4819 100644
--- a/modules/display-filter-lcms.c
+++ b/modules/display-filter-lcms.c
@@ -369,10 +369,10 @@ cdisplay_lcms_changed (GimpColorDisplay *display)
cmsUInt32Number softproof_flags = 0;
if (! src_profile)
- src_profile = cmsCreate_sRGBProfile ();
+ src_profile = gimp_lcms_create_srgb_profile ();
if (! dest_profile)
- dest_profile = cmsCreate_sRGBProfile ();
+ dest_profile = gimp_lcms_create_srgb_profile ();
softproof_flags |= cmsFLAGS_SOFTPROOFING;
@@ -409,10 +409,10 @@ cdisplay_lcms_changed (GimpColorDisplay *display)
cmsUInt32Number display_flags = 0;
if (! src_profile)
- src_profile = cmsCreate_sRGBProfile ();
+ src_profile = gimp_lcms_create_srgb_profile ();
if (! dest_profile)
- dest_profile = cmsCreate_sRGBProfile ();
+ dest_profile = gimp_lcms_create_srgb_profile ();
if (config->display_use_black_point_compensation)
{
diff --git a/modules/display-filter-proof.c b/modules/display-filter-proof.c
index ed764f1..3e15b24 100644
--- a/modules/display-filter-proof.c
+++ b/modules/display-filter-proof.c
@@ -460,7 +460,7 @@ cdisplay_proof_changed (GimpColorDisplay *display)
if (! proof->profile)
return;
- rgbProfile = cmsCreate_sRGBProfile ();
+ rgbProfile = gimp_lcms_create_srgb_profile ();
proofProfile = cmsOpenProfileFromFile (proof->profile, "r");
diff --git a/plug-ins/common/lcms.c b/plug-ins/common/lcms.c
index ccd2b81..937dffb 100644
--- a/plug-ins/common/lcms.c
+++ b/plug-ins/common/lcms.c
@@ -644,13 +644,13 @@ lcms_icc_apply (GimpColorConfig *config,
if (! src_profile)
{
- src_profile = cmsCreate_sRGBProfile ();
+ src_profile = gimp_lcms_create_srgb_profile ();
lcms_sRGB_checksum (src_md5);
}
if (! dest_profile)
{
- dest_profile = cmsCreate_sRGBProfile ();
+ dest_profile = gimp_lcms_create_srgb_profile ();
lcms_sRGB_checksum (dest_md5);
}
@@ -726,7 +726,7 @@ lcms_icc_info (GimpColorConfig *config,
else
{
if (name) *name = g_strdup ("sRGB");
- if (desc) *desc = g_strdup ("sRGB built-in");
+ if (desc) *desc = g_strdup ("sRGB made with the correct white point and primaries");
if (info) *info = g_strdup (_("Default RGB working space"));
}
@@ -1503,7 +1503,7 @@ lcms_icc_combo_box_new (GimpColorConfig *config,
profile = lcms_load_profile (config->rgb_profile, NULL);
if (! profile)
- profile = cmsCreate_sRGBProfile ();
+ profile = gimp_lcms_create_srgb_profile ();
name = lcms_icc_profile_get_desc (profile);
if (! name)
@@ -1556,7 +1556,7 @@ lcms_dialog (GimpColorConfig *config,
}
if (! src_profile)
- src_profile = cmsCreate_sRGBProfile ();
+ src_profile = gimp_lcms_create_srgb_profile ();
gimp_ui_init (PLUG_IN_BINARY, FALSE);
@@ -1666,7 +1666,7 @@ lcms_dialog (GimpColorConfig *config,
}
else
{
- dest_profile = cmsCreate_sRGBProfile ();
+ dest_profile = gimp_lcms_create_srgb_profile ();
}
if (dest_profile)
diff --git a/plug-ins/file-jpeg/jpeg-load.c b/plug-ins/file-jpeg/jpeg-load.c
index f306a87..d31aa88 100644
--- a/plug-ins/file-jpeg/jpeg-load.c
+++ b/plug-ins/file-jpeg/jpeg-load.c
@@ -645,10 +645,10 @@ jpeg_load_cmyk_transform (guint8 *profile_data,
}
}
- /* use the built-in sRGB profile as fallback */
+ /* make the real sRGB profile as a fallback */
if (! rgb_profile)
{
- rgb_profile = cmsCreate_sRGBProfile ();
+ rgb_profile = gimp_lcms_create_srgb_profile ();
}
if (config->display_intent ==
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]