Issue #15962: initialize Levels dialog in Perceptual.

Unlike for Curves (commit 7b4f0993e8), we cannot just change the "trc"
default of "gimp:levels", because then it could break any existing
script, made during the 3.0 series, which was applying this filter on
layers.
Instead, the "trc" stays linear by default for the op, but the tool's
dialog will override it to perceptual.

When we'll have implemented proper op versioning, we will be able to
change the default.
This commit is contained in:
Jehan 2026-03-09 14:15:03 +01:00
parent 21e7e4e576
commit 045c818d0e
2 changed files with 18 additions and 0 deletions

View file

@ -106,6 +106,11 @@ gimp_levels_config_class_init (GimpLevelsConfigClass *klass)
viewable_class->default_icon_name = "gimp-tool-levels";
/* "trc" should default to GIMP_TRC_PERCEPTUAL (cf. #15962).
* We cannot change it until we implement GEGL op versioning.
* In GIMP 3.0, calling this op from the public API was always run in
* linear (#15681).
*/
GIMP_CONFIG_PROP_ENUM (object_class, PROP_TRC,
"trc",
_("Tone Reproduction Curve"),

View file

@ -407,6 +407,13 @@ gimp_levels_tool_dialog (GimpFilterTool *filter_tool)
gtk_box_pack_end (GTK_BOX (hbox), hbox2, FALSE, FALSE, 0);
/* The linear/perceptual radio buttons */
/* XXX: override the default to Perceptual for the time being, until
* we are able to change "gimp:levels" default for "trc" directly.
* See #15962.
*/
g_object_set (config,
"trc", GIMP_TRC_PERCEPTUAL,
NULL);
hbox2 = gimp_prop_enum_icon_box_new (G_OBJECT (config), "trc",
"gimp-color-space",
-1, -1);
@ -668,6 +675,12 @@ gimp_levels_tool_reset (GimpFilterTool *filter_tool)
g_object_set (filter_tool->config,
"channel", channel,
NULL);
/* XXX: the tool defaults to Perceptual, unlike the op.
* See #15962.
*/
g_object_set (filter_tool->config,
"trc", GIMP_TRC_PERCEPTUAL,
NULL);
}
static void