[gimp] Bug 720045 - Add black point compensation to Preferences/Color Management
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] Bug 720045 - Add black point compensation to Preferences/Color Management
- Date: Mon, 9 Dec 2013 01:27:01 +0000 (UTC)
commit a4821914d355afc2f45a7491cc7746cd39ac6846
Author: Elle Stone <ellestone ninedegreesbelow com>
Date: Sat Dec 7 13:42:11 2013 -0500
Bug 720045 - Add black point compensation to Preferences/Color Management
Make black point compensation configurable separately for both proof
and display.
app/dialogs/preferences-dialog.c | 24 ++++++++++++++++-
libgimpconfig/gimpcolorconfig.c | 53 ++++++++++++++++++++++++++++++-------
libgimpconfig/gimpcolorconfig.h | 6 +++-
modules/display-filter-lcms.c | 29 +++++++++++++--------
4 files changed, 89 insertions(+), 23 deletions(-)
---
diff --git a/app/dialogs/preferences-dialog.c b/app/dialogs/preferences-dialog.c
index 7a9c118..be14267 100644
--- a/app/dialogs/preferences-dialog.c
+++ b/app/dialogs/preferences-dialog.c
@@ -2342,7 +2342,18 @@ prefs_dialog_new (Gimp *gimp,
"display-rendering-intent", 0, 0,
_("_Display rendering intent:"),
GTK_TABLE (table), row++, NULL);
- gtk_table_set_row_spacing (GTK_TABLE (table), row - 1, 12);
+
+ button =
+ gimp_prop_check_button_new (color_config,
+ "display-use-black-point-compensation",
+ _("Use _black point compensation for "
+ "the display"));
+
+ gtk_table_attach_defaults (GTK_TABLE (table),
+ button, 1, 2, row, row + 1);
+ gtk_widget_show (button);
+ gtk_table_set_row_spacing (GTK_TABLE (table), row, 12);
+ row++;
}
if (i == 3) /* printer profile */
@@ -2351,6 +2362,17 @@ prefs_dialog_new (Gimp *gimp,
"simulation-rendering-intent", 0, 0,
_("_Softproof rendering intent:"),
GTK_TABLE (table), row++, NULL);
+
+ button =
+ gimp_prop_check_button_new (color_config,
+ "simulation-use-black-point-compensation",
+ _("Use black _point compensation "
+ "for softproofing"));
+
+ gtk_table_attach_defaults (GTK_TABLE (table),
+ button, 1, 2, row, row + 1);
+ gtk_widget_show (button);
+ row++;
}
}
diff --git a/libgimpconfig/gimpcolorconfig.c b/libgimpconfig/gimpcolorconfig.c
index 1277941..7698337 100644
--- a/libgimpconfig/gimpcolorconfig.c
+++ b/libgimpconfig/gimpcolorconfig.c
@@ -62,19 +62,31 @@
#define CMYK_PROFILE_BLURB \
N_("The CMYK color profile used to convert between RGB and CMYK.")
#define PRINTER_PROFILE_BLURB \
- N_("The color profile used for simulating a printed version (softproof).")
+ N_("The color profile to use for soft proofing from your image's " \
+ "color space to some other color space, including " \
+ "soft proofing to a printer or other output device profile. ")
#define DISPLAY_RENDERING_INTENT_BLURB \
- N_("Sets how colors are mapped for your display.")
+ N_("How colors are converted from your image's color space to your display device. " \
+ "Relative colorimetric is usually the best choice. " \
+ "Unless you use a LUT monitor profile (most monitor profiles are matrix), " \
+ "choosing perceptual intent really gives you relative colorimetric." )
+#define DISPLAY_USE_BPC_BLURB \
+ N_("Do use black point compensation (unless you know you have a reason not to). ")
#define SIMULATION_RENDERING_INTENT_BLURB \
- N_("Sets how colors are converted from RGB working space to the " \
- "print simulation device.")
+ N_("How colors are converted from your image's color space to the " \
+ "output simulation device (usually your monitor). " \
+ "Try them all and choose what looks the best. ")
+#define SIMULATION_USE_BPC_BLURB \
+ N_("Try with and without black point compensation "\
+ "and choose what looks best. ")
#define SIMULATION_GAMUT_CHECK_BLURB \
- N_("When enabled, the print simulation will mark colors which can not be " \
- "represented in the target color space.")
+ N_("When enabled, the print simulation will mark colors " \
+ "which can not be represented in the target color space.")
#define OUT_OF_GAMUT_COLOR_BLURB \
N_("The color to use for marking colors which are out of gamut.")
+
enum
{
PROP_0,
@@ -85,7 +97,9 @@ enum
PROP_DISPLAY_PROFILE_FROM_GDK,
PROP_PRINTER_PROFILE,
PROP_DISPLAY_RENDERING_INTENT,
+ PROP_DISPLAY_USE_BPC,
PROP_SIMULATION_RENDERING_INTENT,
+ PROP_SIMULATION_USE_BPC,
PROP_SIMULATION_GAMUT_CHECK,
PROP_OUT_OF_GAMUT_COLOR,
PROP_DISPLAY_MODULE
@@ -153,14 +167,24 @@ gimp_color_config_class_init (GimpColorConfigClass *klass)
"display-rendering-intent",
DISPLAY_RENDERING_INTENT_BLURB,
GIMP_TYPE_COLOR_RENDERING_INTENT,
- GIMP_COLOR_RENDERING_INTENT_PERCEPTUAL,
+ GIMP_COLOR_RENDERING_INTENT_RELATIVE_COLORIMETRIC,
GIMP_PARAM_STATIC_STRINGS);
+ GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_DISPLAY_USE_BPC,
+ "display-use-black-point-compensation",
+ DISPLAY_USE_BPC_BLURB,
+ TRUE,
+ GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_SIMULATION_RENDERING_INTENT,
"simulation-rendering-intent",
SIMULATION_RENDERING_INTENT_BLURB,
GIMP_TYPE_COLOR_RENDERING_INTENT,
GIMP_COLOR_RENDERING_INTENT_PERCEPTUAL,
GIMP_PARAM_STATIC_STRINGS);
+ GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_SIMULATION_USE_BPC,
+ "simulation-use-black-point-compensation",
+ SIMULATION_USE_BPC_BLURB,
+ FALSE,
+ GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_SIMULATION_GAMUT_CHECK,
"simulation-gamut-check",
SIMULATION_GAMUT_CHECK_BLURB,
@@ -171,7 +195,6 @@ gimp_color_config_class_init (GimpColorConfigClass *klass)
OUT_OF_GAMUT_COLOR_BLURB,
FALSE, &color,
GIMP_PARAM_STATIC_STRINGS);
-
GIMP_CONFIG_INSTALL_PROP_STRING (object_class, PROP_DISPLAY_MODULE,
"display-module", NULL,
"CdisplayLcms",
@@ -241,9 +264,15 @@ gimp_color_config_set_property (GObject *object,
case PROP_DISPLAY_RENDERING_INTENT:
color_config->display_intent = g_value_get_enum (value);
break;
+ case PROP_DISPLAY_USE_BPC:
+ color_config->display_use_black_point_compensation = g_value_get_boolean (value);
+ break;
case PROP_SIMULATION_RENDERING_INTENT:
color_config->simulation_intent = g_value_get_enum (value);
break;
+ case PROP_SIMULATION_USE_BPC:
+ color_config->simulation_use_black_point_compensation = g_value_get_boolean (value);
+ break;
case PROP_SIMULATION_GAMUT_CHECK:
color_config->simulation_gamut_check = g_value_get_boolean (value);
break;
@@ -254,7 +283,6 @@ gimp_color_config_set_property (GObject *object,
g_free (color_config->display_module);
color_config->display_module = g_value_dup_string (value);
break;
-
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
@@ -292,9 +320,15 @@ gimp_color_config_get_property (GObject *object,
case PROP_DISPLAY_RENDERING_INTENT:
g_value_set_enum (value, color_config->display_intent);
break;
+ case PROP_DISPLAY_USE_BPC:
+ g_value_set_boolean (value, color_config->display_use_black_point_compensation);
+ break;
case PROP_SIMULATION_RENDERING_INTENT:
g_value_set_enum (value, color_config->simulation_intent);
break;
+ case PROP_SIMULATION_USE_BPC:
+ g_value_set_boolean (value, color_config->simulation_use_black_point_compensation);
+ break;
case PROP_SIMULATION_GAMUT_CHECK:
g_value_set_boolean (value, color_config->simulation_gamut_check);
break;
@@ -304,7 +338,6 @@ gimp_color_config_get_property (GObject *object,
case PROP_DISPLAY_MODULE:
g_value_set_string (value, color_config->display_module);
break;
-
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
diff --git a/libgimpconfig/gimpcolorconfig.h b/libgimpconfig/gimpcolorconfig.h
index 22cf17b..9d99428 100644
--- a/libgimpconfig/gimpcolorconfig.h
+++ b/libgimpconfig/gimpcolorconfig.h
@@ -55,10 +55,14 @@ struct _GimpColorConfig
gboolean simulation_gamut_check;
GimpRGB out_of_gamut_color;
+ gboolean display_use_black_point_compensation;
+ gboolean simulation_use_black_point_compensation;
+
/*< private >*/
/* Padding for future expansion */
- void (* _gimp_reserved1) (void);
+#if (GLIB_SIZEOF_VOID_P == 8)
void (* _gimp_reserved2) (void);
+#endif
void (* _gimp_reserved3) (void);
void (* _gimp_reserved4) (void);
void (* _gimp_reserved5) (void);
diff --git a/modules/display-filter-lcms.c b/modules/display-filter-lcms.c
index 7510360..17966b7 100644
--- a/modules/display-filter-lcms.c
+++ b/modules/display-filter-lcms.c
@@ -338,7 +338,6 @@ cdisplay_lcms_changed (GimpColorDisplay *display)
cmsHPROFILE src_profile = NULL;
cmsHPROFILE dest_profile = NULL;
cmsHPROFILE proof_profile = NULL;
- cmsUInt32Number flags = 0;
cmsUInt16Number alarmCodes[cmsMAXCHANNELS] = { 0, };
if (lcms->transform)
@@ -365,27 +364,28 @@ cdisplay_lcms_changed (GimpColorDisplay *display)
break;
}
- if (config->display_intent ==
- GIMP_COLOR_RENDERING_INTENT_RELATIVE_COLORIMETRIC)
- {
- flags |= cmsFLAGS_BLACKPOINTCOMPENSATION;
- }
-
if (proof_profile)
{
+ cmsUInt32Number softproof_flags = 0;
+
if (! src_profile)
src_profile = cmsCreate_sRGBProfile ();
if (! dest_profile)
dest_profile = cmsCreate_sRGBProfile ();
- flags |= cmsFLAGS_SOFTPROOFING;
+ softproof_flags |= cmsFLAGS_SOFTPROOFING;
+
+ if (config->simulation_use_black_point_compensation)
+ {
+ softproof_flags |= cmsFLAGS_BLACKPOINTCOMPENSATION;
+ }
if (config->simulation_gamut_check)
{
guchar r, g, b;
- flags |= cmsFLAGS_GAMUTCHECK;
+ softproof_flags |= cmsFLAGS_GAMUTCHECK;
gimp_rgb_get_uchar (&config->out_of_gamut_color, &r, &g, &b);
@@ -401,21 +401,28 @@ cdisplay_lcms_changed (GimpColorDisplay *display)
proof_profile,
config->simulation_intent,
config->display_intent,
- flags);
+ softproof_flags);
cmsCloseProfile (proof_profile);
}
else if (src_profile || dest_profile)
{
+ cmsUInt32Number display_flags = 0;
+
if (! src_profile)
src_profile = cmsCreate_sRGBProfile ();
if (! dest_profile)
dest_profile = cmsCreate_sRGBProfile ();
+ if (config->display_use_black_point_compensation)
+ {
+ display_flags |= cmsFLAGS_BLACKPOINTCOMPENSATION;
+ }
+
lcms->transform = cmsCreateTransform (src_profile, TYPE_RGBA_FLT,
dest_profile, TYPE_RGBA_FLT,
config->display_intent,
- flags);
+ display_flags);
}
if (dest_profile)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]