libgimpconfig: add "optimize" options for display and softproofing

Honor them in gimp_widget_get_color_transform() and make them
configurable in prefs. The code and GUI avoid the negation in
the lcms "NOOPTIMIZE" flag.
This commit is contained in:
Michael Natterer 2016-06-06 01:15:26 +02:00
parent 8abf1aab5e
commit a743ae712b
5 changed files with 108 additions and 14 deletions

View file

@ -1367,7 +1367,6 @@ prefs_dialog_new (Gimp *gimp,
"display-profile-from-gdk", "display-profile-from-gdk",
_("_Try to use the system monitor " _("_Try to use the system monitor "
"profile")); "profile"));
gtk_table_attach_defaults (GTK_TABLE (table), gtk_table_attach_defaults (GTK_TABLE (table),
button, 1, 2, row, row + 1); button, 1, 2, row, row + 1);
gtk_widget_show (button); gtk_widget_show (button);
@ -1381,10 +1380,18 @@ prefs_dialog_new (Gimp *gimp,
button = gimp_prop_check_button_new (color_config, button = gimp_prop_check_button_new (color_config,
"display-use-black-point-compensation", "display-use-black-point-compensation",
_("Use _black point compensation")); _("Use _black point compensation"));
gtk_table_attach_defaults (GTK_TABLE (table), gtk_table_attach_defaults (GTK_TABLE (table),
button, 1, 2, row, row + 1); button, 1, 2, row, row + 1);
gtk_widget_show (button); gtk_widget_show (button);
row++;
button = gimp_prop_check_button_new (color_config,
"display-optimize",
_("_Optimize display color transforms"));
gtk_table_attach_defaults (GTK_TABLE (table),
button, 1, 2, row, row + 1);
gtk_widget_show (button);
row++;
/* Print Simulation (Softproofing) */ /* Print Simulation (Softproofing) */
vbox2 = prefs_frame_new (_("Print Simulation (Softproofing)"), vbox2 = prefs_frame_new (_("Print Simulation (Softproofing)"),
@ -1409,7 +1416,14 @@ prefs_dialog_new (Gimp *gimp,
button = gimp_prop_check_button_new (color_config, button = gimp_prop_check_button_new (color_config,
"simulation-use-black-point-compensation", "simulation-use-black-point-compensation",
_("Use black _point compensation")); _("Use black _point compensation"));
gtk_table_attach_defaults (GTK_TABLE (table),
button, 1, 2, row, row + 1);
gtk_widget_show (button);
row++;
button = gimp_prop_check_button_new (color_config,
"simulation-optimize",
_("O_ptimize simulation color transforms"));
gtk_table_attach_defaults (GTK_TABLE (table), gtk_table_attach_defaults (GTK_TABLE (table),
button, 1, 2, row, row + 1); button, 1, 2, row, row + 1);
gtk_widget_show (button); gtk_widget_show (button);

View file

@ -84,7 +84,11 @@
#define DISPLAY_USE_BPC_BLURB \ #define DISPLAY_USE_BPC_BLURB \
_("Do use black point compensation (unless you know you have a reason " \ _("Do use black point compensation (unless you know you have a reason " \
"not to). ") "not to).")
#define DISPLAY_OPTIMIZE_BLURB \
_("When disabled, image display might be of better quality " \
"at the cost of speed.")
#define SIMULATION_RENDERING_INTENT_BLURB \ #define SIMULATION_RENDERING_INTENT_BLURB \
_("How colors are converted from your image's color space to the " \ _("How colors are converted from your image's color space to the " \
@ -95,6 +99,10 @@
_("Try with and without black point compensation "\ _("Try with and without black point compensation "\
"and choose what looks best. ") "and choose what looks best. ")
#define SIMULATION_OPTIMIZE_BLURB \
_("When disabled, simulation might be of better quality " \
"at the cost of speed.")
#define SIMULATION_GAMUT_CHECK_BLURB \ #define SIMULATION_GAMUT_CHECK_BLURB \
_("When enabled, the print simulation will mark colors " \ _("When enabled, the print simulation will mark colors " \
"which can not be represented in the target color space.") "which can not be represented in the target color space.")
@ -115,14 +123,30 @@ enum
PROP_SIMULATION_PROFILE, PROP_SIMULATION_PROFILE,
PROP_DISPLAY_RENDERING_INTENT, PROP_DISPLAY_RENDERING_INTENT,
PROP_DISPLAY_USE_BPC, PROP_DISPLAY_USE_BPC,
PROP_DISPLAY_OPTIMIZE,
PROP_SIMULATION_RENDERING_INTENT, PROP_SIMULATION_RENDERING_INTENT,
PROP_SIMULATION_USE_BPC, PROP_SIMULATION_USE_BPC,
PROP_SIMULATION_OPTIMIZE,
PROP_SIMULATION_GAMUT_CHECK, PROP_SIMULATION_GAMUT_CHECK,
PROP_OUT_OF_GAMUT_COLOR, PROP_OUT_OF_GAMUT_COLOR,
PROP_DISPLAY_MODULE PROP_DISPLAY_MODULE
}; };
typedef struct _GimpColorConfigPrivate GimpColorConfigPrivate;
struct _GimpColorConfigPrivate
{
gboolean display_optimize;
gboolean simulation_optimize;
};
#define GET_PRIVATE(obj) \
G_TYPE_INSTANCE_GET_PRIVATE (obj, \
GIMP_TYPE_COLOR_CONFIG, \
GimpColorConfigPrivate)
static void gimp_color_config_finalize (GObject *object); static void gimp_color_config_finalize (GObject *object);
static void gimp_color_config_set_property (GObject *object, static void gimp_color_config_set_property (GObject *object,
guint property_id, guint property_id,
@ -236,6 +260,13 @@ gimp_color_config_class_init (GimpColorConfigClass *klass)
TRUE, TRUE,
GIMP_PARAM_STATIC_STRINGS); GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_PROP_BOOLEAN (object_class, PROP_DISPLAY_OPTIMIZE,
"display-optimize",
_("Optimize display color transformations"),
DISPLAY_OPTIMIZE_BLURB,
TRUE,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_PROP_ENUM (object_class, PROP_SIMULATION_RENDERING_INTENT, GIMP_CONFIG_PROP_ENUM (object_class, PROP_SIMULATION_RENDERING_INTENT,
"simulation-rendering-intent", "simulation-rendering-intent",
_("Softproof rendering intent"), _("Softproof rendering intent"),
@ -251,6 +282,13 @@ gimp_color_config_class_init (GimpColorConfigClass *klass)
FALSE, FALSE,
GIMP_PARAM_STATIC_STRINGS); GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_PROP_BOOLEAN (object_class, PROP_SIMULATION_OPTIMIZE,
"simulation-optimize",
_("Optimize simulation color transformations"),
SIMULATION_OPTIMIZE_BLURB,
TRUE,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_PROP_BOOLEAN (object_class, PROP_SIMULATION_GAMUT_CHECK, GIMP_CONFIG_PROP_BOOLEAN (object_class, PROP_SIMULATION_GAMUT_CHECK,
"simulation-gamut-check", "simulation-gamut-check",
_("Mark out of gamut colors"), _("Mark out of gamut colors"),
@ -270,6 +308,8 @@ gimp_color_config_class_init (GimpColorConfigClass *klass)
NULL, NULL, NULL, NULL,
"CdisplayLcms", "CdisplayLcms",
GIMP_PARAM_STATIC_STRINGS); GIMP_PARAM_STATIC_STRINGS);
g_type_class_add_private (object_class, sizeof (GimpColorConfigPrivate));
} }
static void static void
@ -309,8 +349,9 @@ gimp_color_config_set_property (GObject *object,
const GValue *value, const GValue *value,
GParamSpec *pspec) GParamSpec *pspec)
{ {
GimpColorConfig *color_config = GIMP_COLOR_CONFIG (object); GimpColorConfig *color_config = GIMP_COLOR_CONFIG (object);
GError *error = NULL; GimpColorConfigPrivate *priv = GET_PRIVATE (object);
GError *error = NULL;
switch (property_id) switch (property_id)
{ {
@ -351,12 +392,18 @@ gimp_color_config_set_property (GObject *object,
case PROP_DISPLAY_USE_BPC: case PROP_DISPLAY_USE_BPC:
color_config->display_use_black_point_compensation = g_value_get_boolean (value); color_config->display_use_black_point_compensation = g_value_get_boolean (value);
break; break;
case PROP_DISPLAY_OPTIMIZE:
priv->display_optimize = g_value_get_boolean (value);
break;
case PROP_SIMULATION_RENDERING_INTENT: case PROP_SIMULATION_RENDERING_INTENT:
color_config->simulation_intent = g_value_get_enum (value); color_config->simulation_intent = g_value_get_enum (value);
break; break;
case PROP_SIMULATION_USE_BPC: case PROP_SIMULATION_USE_BPC:
color_config->simulation_use_black_point_compensation = g_value_get_boolean (value); color_config->simulation_use_black_point_compensation = g_value_get_boolean (value);
break; break;
case PROP_SIMULATION_OPTIMIZE:
priv->simulation_optimize = g_value_get_boolean (value);
break;
case PROP_SIMULATION_GAMUT_CHECK: case PROP_SIMULATION_GAMUT_CHECK:
color_config->simulation_gamut_check = g_value_get_boolean (value); color_config->simulation_gamut_check = g_value_get_boolean (value);
break; break;
@ -386,7 +433,8 @@ gimp_color_config_get_property (GObject *object,
GValue *value, GValue *value,
GParamSpec *pspec) GParamSpec *pspec)
{ {
GimpColorConfig *color_config = GIMP_COLOR_CONFIG (object); GimpColorConfig *color_config = GIMP_COLOR_CONFIG (object);
GimpColorConfigPrivate *priv = GET_PRIVATE (object);
switch (property_id) switch (property_id)
{ {
@ -417,12 +465,18 @@ gimp_color_config_get_property (GObject *object,
case PROP_DISPLAY_USE_BPC: case PROP_DISPLAY_USE_BPC:
g_value_set_boolean (value, color_config->display_use_black_point_compensation); g_value_set_boolean (value, color_config->display_use_black_point_compensation);
break; break;
case PROP_DISPLAY_OPTIMIZE:
g_value_set_boolean (value, priv->display_optimize);
break;
case PROP_SIMULATION_RENDERING_INTENT: case PROP_SIMULATION_RENDERING_INTENT:
g_value_set_enum (value, color_config->simulation_intent); g_value_set_enum (value, color_config->simulation_intent);
break; break;
case PROP_SIMULATION_USE_BPC: case PROP_SIMULATION_USE_BPC:
g_value_set_boolean (value, color_config->simulation_use_black_point_compensation); g_value_set_boolean (value, color_config->simulation_use_black_point_compensation);
break; break;
case PROP_SIMULATION_OPTIMIZE:
g_value_set_boolean (value, priv->simulation_optimize);
break;
case PROP_SIMULATION_GAMUT_CHECK: case PROP_SIMULATION_GAMUT_CHECK:
g_value_set_boolean (value, color_config->simulation_gamut_check); g_value_set_boolean (value, color_config->simulation_gamut_check);
break; break;
@ -486,6 +540,20 @@ gimp_color_config_get_display_bpc (GimpColorConfig *config)
return config->display_use_black_point_compensation; return config->display_use_black_point_compensation;
} }
/**
* gimp_color_config_get_display_optimize:
* @config: a #GimpColorConfig
*
* Since: 2.10
**/
gboolean
gimp_color_config_get_display_optimize (GimpColorConfig *config)
{
g_return_val_if_fail (GIMP_IS_COLOR_CONFIG (config), FALSE);
return GET_PRIVATE (config)->display_optimize;
}
/** /**
* gimp_color_config_get_display_profile_from_gdk: * gimp_color_config_get_display_profile_from_gdk:
* @config: a #GimpColorConfig * @config: a #GimpColorConfig
@ -529,6 +597,20 @@ gimp_color_config_get_simulation_bpc (GimpColorConfig *config)
return config->simulation_use_black_point_compensation; return config->simulation_use_black_point_compensation;
} }
/**
* gimp_color_config_get_simulation_optimize:
* @config: a #GimpColorConfig
*
* Since: 2.10
**/
gboolean
gimp_color_config_get_simulation_optimize (GimpColorConfig *config)
{
g_return_val_if_fail (GIMP_IS_COLOR_CONFIG (config), FALSE);
return GET_PRIVATE (config)->simulation_optimize;
}
/** /**
* gimp_color_config_get_simulation_gamut_check: * gimp_color_config_get_simulation_gamut_check:
* @config: a #GimpColorConfig * @config: a #GimpColorConfig

View file

@ -86,11 +86,13 @@ GimpColorManagementMode
GimpColorRenderingIntent GimpColorRenderingIntent
gimp_color_config_get_display_intent (GimpColorConfig *config); gimp_color_config_get_display_intent (GimpColorConfig *config);
gboolean gimp_color_config_get_display_bpc (GimpColorConfig *config); gboolean gimp_color_config_get_display_bpc (GimpColorConfig *config);
gboolean gimp_color_config_get_display_optimize (GimpColorConfig *config);
gboolean gimp_color_config_get_display_profile_from_gdk (GimpColorConfig *config); gboolean gimp_color_config_get_display_profile_from_gdk (GimpColorConfig *config);
GimpColorRenderingIntent GimpColorRenderingIntent
gimp_color_config_get_simulation_intent (GimpColorConfig *config); gimp_color_config_get_simulation_intent (GimpColorConfig *config);
gboolean gimp_color_config_get_simulation_bpc (GimpColorConfig *config); gboolean gimp_color_config_get_simulation_bpc (GimpColorConfig *config);
gboolean gimp_color_config_get_simulation_optimize (GimpColorConfig *config);
gboolean gimp_color_config_get_simulation_gamut_check (GimpColorConfig *config); gboolean gimp_color_config_get_simulation_gamut_check (GimpColorConfig *config);
GimpColorProfile * gimp_color_config_get_rgb_color_profile (GimpColorConfig *config, GimpColorProfile * gimp_color_config_get_rgb_color_profile (GimpColorConfig *config,

View file

@ -3,6 +3,7 @@ EXPORTS
gimp_color_config_get_display_bpc gimp_color_config_get_display_bpc
gimp_color_config_get_display_color_profile gimp_color_config_get_display_color_profile
gimp_color_config_get_display_intent gimp_color_config_get_display_intent
gimp_color_config_get_display_optimize
gimp_color_config_get_display_profile_from_gdk gimp_color_config_get_display_profile_from_gdk
gimp_color_config_get_gray_color_profile gimp_color_config_get_gray_color_profile
gimp_color_config_get_mode gimp_color_config_get_mode
@ -11,6 +12,7 @@ EXPORTS
gimp_color_config_get_simulation_color_profile gimp_color_config_get_simulation_color_profile
gimp_color_config_get_simulation_gamut_check gimp_color_config_get_simulation_gamut_check
gimp_color_config_get_simulation_intent gimp_color_config_get_simulation_intent
gimp_color_config_get_simulation_optimize
gimp_color_config_get_type gimp_color_config_get_type
gimp_color_management_mode_get_type gimp_color_management_mode_get_type
gimp_color_rendering_intent_get_type gimp_color_rendering_intent_get_type

View file

@ -774,11 +774,8 @@ gimp_widget_get_color_transform (GtkWidget *widget,
if (gimp_color_config_get_simulation_bpc (config)) if (gimp_color_config_get_simulation_bpc (config))
flags |= GIMP_COLOR_TRANSFORM_FLAGS_BLACK_POINT_COMPENSATION; flags |= GIMP_COLOR_TRANSFORM_FLAGS_BLACK_POINT_COMPENSATION;
#if 0 if (! gimp_color_config_get_simulation_optimize (config))
/* FIXME add this to GimpColorConfig */
if (gimp_color_config_get_simulation_nooptimize (config))
flags |= GIMP_COLOR_TRANSFORM_FLAGS_NOOPTIMIZE; flags |= GIMP_COLOR_TRANSFORM_FLAGS_NOOPTIMIZE;
#endif
if (gimp_color_config_get_simulation_gamut_check (config)) if (gimp_color_config_get_simulation_gamut_check (config))
{ {
@ -813,11 +810,8 @@ gimp_widget_get_color_transform (GtkWidget *widget,
if (gimp_color_config_get_display_bpc (config)) if (gimp_color_config_get_display_bpc (config))
flags |= GIMP_COLOR_TRANSFORM_FLAGS_BLACK_POINT_COMPENSATION; flags |= GIMP_COLOR_TRANSFORM_FLAGS_BLACK_POINT_COMPENSATION;
#if 0 if (! gimp_color_config_get_display_optimize (config))
/* FIXME add this to GimpColorConfig */
if (gimp_color_config_get_display_nooptimize (config))
flags |= GIMP_COLOR_TRANSFORM_FLAGS_NOOPTIMIZE; flags |= GIMP_COLOR_TRANSFORM_FLAGS_NOOPTIMIZE;
#endif
cache->transform = cache->transform =
gimp_color_transform_new (cache->src_profile, gimp_color_transform_new (cache->src_profile,