app, libgimp, pdb: fix perceptual blend space for linear TRC ICC profiles

In previous versions what has been stored/specified as perceptual blending or
compositing spaces has really been the non-linear variant of the images babl
space.

To maintain loading of old files, the code has been updated to actually mean
non-linear and a new perceptual value has been added to the GimpLayerColorSpace
enum, while preserving all old enum values.

This change bumps XCF file version to 23
This commit is contained in:
Øyvind Kolås 2024-11-30 02:06:53 +01:00 committed by Jehan
parent c380d289eb
commit 3f3b29ba12
13 changed files with 148 additions and 58 deletions

View File

@ -321,6 +321,12 @@ static const GimpRadioActionEntry layers_blend_space_actions[] =
GIMP_LAYER_COLOR_SPACE_RGB_LINEAR,
NULL },
{ "layers-blend-space-rgb-non-linear", NULL,
NC_("layers-action", "RGB (from color profile)"), NULL, { NULL },
NC_("layers-action", "Layer Blend Space: RGB (from color profile)"),
GIMP_LAYER_COLOR_SPACE_RGB_NON_LINEAR,
NULL },
{ "layers-blend-space-rgb-perceptual", NULL,
NC_("layers-action", "RGB (perceptual)"), NULL, { NULL },
NC_("layers-action", "Layer Blend Space: RGB (perceptual)"),
@ -342,6 +348,12 @@ static const GimpRadioActionEntry layers_composite_space_actions[] =
GIMP_LAYER_COLOR_SPACE_RGB_LINEAR,
NULL },
{ "layers-composite-space-rgb-non-linear", NULL,
NC_("layers-action", "RGB (from color profile)"), NULL, { NULL },
NC_("layers-action", "Layer Composite Space: RGB (from color profile)"),
GIMP_LAYER_COLOR_SPACE_RGB_NON_LINEAR,
NULL },
{ "layers-composite-space-rgb-perceptual", NULL,
NC_("layers-action", "RGB (perceptual)"), NULL, { NULL },
NC_("layers-action", "Layer Composite Space: RGB (perceptual)"),
@ -920,6 +932,8 @@ layers_actions_update (GimpActionGroup *group,
action = "layers-blend-space-auto"; break;
case GIMP_LAYER_COLOR_SPACE_RGB_LINEAR:
action = "layers-blend-space-rgb-linear"; break;
case GIMP_LAYER_COLOR_SPACE_RGB_NON_LINEAR:
action = "layers-blend-space-rgb-non-linear"; break;
case GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL:
action = "layers-blend-space-rgb-perceptual"; break;
default:
@ -935,6 +949,8 @@ layers_actions_update (GimpActionGroup *group,
action = "layers-composite-space-auto"; break;
case GIMP_LAYER_COLOR_SPACE_RGB_LINEAR:
action = "layers-composite-space-rgb-linear"; break;
case GIMP_LAYER_COLOR_SPACE_RGB_NON_LINEAR:
action = "layers-composite-space-rgb-non-linear"; break;
case GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL:
action = "layers-composite-space-rgb-perceptual"; break;
default:

View File

@ -2951,6 +2951,20 @@ gimp_image_get_xcf_version (GimpImage *image,
*/
version = MAX (22, version);
}
if ((gimp_layer_get_real_blend_space (layer) == GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL)
||(gimp_layer_get_real_composite_space (layer) == GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL))
{
ADD_REASON (g_strdup_printf (_("Blending space fixes in %s"),
"GIMP 3.0"));
/* The blending space variant corresponding to SPACE_RGB_PERCEPTUAL in <3.0
* corresponds to R'G'B'A which is NON_LINEAR in babl. Perceptual in babl is
* R~G~B~A, >= 3.0 the code, comments and usage matches the existing enum value
* as being NON_LINEAR and new layers created use the new interger value for
* PERCEPTUAL.
*/
version = MAX (23, version);
}
}
g_list_free (items);

View File

@ -194,9 +194,12 @@ layer_options_dialog_new (GimpImage *image,
private);
space_model =
gimp_enum_store_new_with_range (GIMP_TYPE_LAYER_COLOR_SPACE,
GIMP_LAYER_COLOR_SPACE_AUTO,
GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL);
gimp_enum_store_new_with_values (GIMP_TYPE_LAYER_COLOR_SPACE,
4,
GIMP_LAYER_COLOR_SPACE_AUTO,
GIMP_LAYER_COLOR_SPACE_RGB_LINEAR,
GIMP_LAYER_COLOR_SPACE_RGB_NON_LINEAR,
GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL);
private->blend_space_combo = combo =
gimp_enum_combo_box_new_with_model (GIMP_ENUM_STORE (space_model));

View File

@ -42,6 +42,7 @@ gimp_gegl_create_flatten_node (GeglColor *background,
g_return_val_if_fail (GEGL_IS_COLOR (background), NULL);
g_return_val_if_fail (composite_space == GIMP_LAYER_COLOR_SPACE_RGB_LINEAR ||
composite_space == GIMP_LAYER_COLOR_SPACE_RGB_NON_LINEAR ||
composite_space == GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL,
NULL);

View File

@ -65,7 +65,7 @@ static const GimpLayerModeInfo layer_mode_infos[] =
.context = GIMP_LAYER_MODE_CONTEXT_ALL,
.paint_composite_mode = GIMP_LAYER_COMPOSITE_UNION,
.composite_mode = GIMP_LAYER_COMPOSITE_UNION,
.composite_space = GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL
.composite_space = GIMP_LAYER_COLOR_SPACE_RGB_NON_LINEAR
},
{ GIMP_LAYER_MODE_DISSOLVE,
@ -90,7 +90,7 @@ static const GimpLayerModeInfo layer_mode_infos[] =
GIMP_LAYER_MODE_CONTEXT_FILTER,
.paint_composite_mode = GIMP_LAYER_COMPOSITE_UNION,
.composite_mode = GIMP_LAYER_COMPOSITE_UNION,
.composite_space = GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL
.composite_space = GIMP_LAYER_COLOR_SPACE_RGB_NON_LINEAR
},
{ GIMP_LAYER_MODE_MULTIPLY_LEGACY,
@ -103,8 +103,8 @@ static const GimpLayerModeInfo layer_mode_infos[] =
.context = GIMP_LAYER_MODE_CONTEXT_ALL,
.paint_composite_mode = GIMP_LAYER_COMPOSITE_CLIP_TO_BACKDROP,
.composite_mode = GIMP_LAYER_COMPOSITE_CLIP_TO_BACKDROP,
.composite_space = GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL,
.blend_space = GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL
.composite_space = GIMP_LAYER_COLOR_SPACE_RGB_NON_LINEAR,
.blend_space = GIMP_LAYER_COLOR_SPACE_RGB_NON_LINEAR
},
{ GIMP_LAYER_MODE_SCREEN_LEGACY,
@ -117,8 +117,8 @@ static const GimpLayerModeInfo layer_mode_infos[] =
.context = GIMP_LAYER_MODE_CONTEXT_ALL,
.paint_composite_mode = GIMP_LAYER_COMPOSITE_CLIP_TO_BACKDROP,
.composite_mode = GIMP_LAYER_COMPOSITE_CLIP_TO_BACKDROP,
.composite_space = GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL,
.blend_space = GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL
.composite_space = GIMP_LAYER_COLOR_SPACE_RGB_NON_LINEAR,
.blend_space = GIMP_LAYER_COLOR_SPACE_RGB_NON_LINEAR
},
{ GIMP_LAYER_MODE_OVERLAY_LEGACY,
@ -131,8 +131,8 @@ static const GimpLayerModeInfo layer_mode_infos[] =
.context = GIMP_LAYER_MODE_CONTEXT_ALL,
.paint_composite_mode = GIMP_LAYER_COMPOSITE_CLIP_TO_BACKDROP,
.composite_mode = GIMP_LAYER_COMPOSITE_CLIP_TO_BACKDROP,
.composite_space = GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL,
.blend_space = GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL
.composite_space = GIMP_LAYER_COLOR_SPACE_RGB_NON_LINEAR,
.blend_space = GIMP_LAYER_COLOR_SPACE_RGB_NON_LINEAR
},
{ GIMP_LAYER_MODE_DIFFERENCE_LEGACY,
@ -145,8 +145,8 @@ static const GimpLayerModeInfo layer_mode_infos[] =
.context = GIMP_LAYER_MODE_CONTEXT_ALL,
.paint_composite_mode = GIMP_LAYER_COMPOSITE_CLIP_TO_BACKDROP,
.composite_mode = GIMP_LAYER_COMPOSITE_CLIP_TO_BACKDROP,
.composite_space = GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL,
.blend_space = GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL
.composite_space = GIMP_LAYER_COLOR_SPACE_RGB_NON_LINEAR,
.blend_space = GIMP_LAYER_COLOR_SPACE_RGB_NON_LINEAR
},
{ GIMP_LAYER_MODE_ADDITION_LEGACY,
@ -159,8 +159,8 @@ static const GimpLayerModeInfo layer_mode_infos[] =
.context = GIMP_LAYER_MODE_CONTEXT_ALL,
.paint_composite_mode = GIMP_LAYER_COMPOSITE_CLIP_TO_BACKDROP,
.composite_mode = GIMP_LAYER_COMPOSITE_CLIP_TO_BACKDROP,
.composite_space = GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL,
.blend_space = GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL
.composite_space = GIMP_LAYER_COLOR_SPACE_RGB_NON_LINEAR,
.blend_space = GIMP_LAYER_COLOR_SPACE_RGB_NON_LINEAR
},
{ GIMP_LAYER_MODE_SUBTRACT_LEGACY,
@ -173,8 +173,8 @@ static const GimpLayerModeInfo layer_mode_infos[] =
.context = GIMP_LAYER_MODE_CONTEXT_ALL,
.paint_composite_mode = GIMP_LAYER_COMPOSITE_CLIP_TO_BACKDROP,
.composite_mode = GIMP_LAYER_COMPOSITE_CLIP_TO_BACKDROP,
.composite_space = GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL,
.blend_space = GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL
.composite_space = GIMP_LAYER_COLOR_SPACE_RGB_NON_LINEAR,
.blend_space = GIMP_LAYER_COLOR_SPACE_RGB_NON_LINEAR
},
{ GIMP_LAYER_MODE_DARKEN_ONLY_LEGACY,
@ -187,8 +187,8 @@ static const GimpLayerModeInfo layer_mode_infos[] =
.context = GIMP_LAYER_MODE_CONTEXT_ALL,
.paint_composite_mode = GIMP_LAYER_COMPOSITE_CLIP_TO_BACKDROP,
.composite_mode = GIMP_LAYER_COMPOSITE_CLIP_TO_BACKDROP,
.composite_space = GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL,
.blend_space = GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL
.composite_space = GIMP_LAYER_COLOR_SPACE_RGB_NON_LINEAR,
.blend_space = GIMP_LAYER_COLOR_SPACE_RGB_NON_LINEAR
},
{ GIMP_LAYER_MODE_LIGHTEN_ONLY_LEGACY,
@ -201,8 +201,8 @@ static const GimpLayerModeInfo layer_mode_infos[] =
.context = GIMP_LAYER_MODE_CONTEXT_ALL,
.paint_composite_mode = GIMP_LAYER_COMPOSITE_CLIP_TO_BACKDROP,
.composite_mode = GIMP_LAYER_COMPOSITE_CLIP_TO_BACKDROP,
.composite_space = GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL,
.blend_space = GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL
.composite_space = GIMP_LAYER_COLOR_SPACE_RGB_NON_LINEAR,
.blend_space = GIMP_LAYER_COLOR_SPACE_RGB_NON_LINEAR
},
{ GIMP_LAYER_MODE_HSV_HUE_LEGACY,
@ -215,8 +215,8 @@ static const GimpLayerModeInfo layer_mode_infos[] =
.context = GIMP_LAYER_MODE_CONTEXT_ALL,
.paint_composite_mode = GIMP_LAYER_COMPOSITE_CLIP_TO_BACKDROP,
.composite_mode = GIMP_LAYER_COMPOSITE_CLIP_TO_BACKDROP,
.composite_space = GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL,
.blend_space = GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL
.composite_space = GIMP_LAYER_COLOR_SPACE_RGB_NON_LINEAR,
.blend_space = GIMP_LAYER_COLOR_SPACE_RGB_NON_LINEAR
},
{ GIMP_LAYER_MODE_HSV_SATURATION_LEGACY,
@ -229,8 +229,8 @@ static const GimpLayerModeInfo layer_mode_infos[] =
.context = GIMP_LAYER_MODE_CONTEXT_ALL,
.paint_composite_mode = GIMP_LAYER_COMPOSITE_CLIP_TO_BACKDROP,
.composite_mode = GIMP_LAYER_COMPOSITE_CLIP_TO_BACKDROP,
.composite_space = GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL,
.blend_space = GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL
.composite_space = GIMP_LAYER_COLOR_SPACE_RGB_NON_LINEAR,
.blend_space = GIMP_LAYER_COLOR_SPACE_RGB_NON_LINEAR
},
{ GIMP_LAYER_MODE_HSL_COLOR_LEGACY,
@ -243,8 +243,8 @@ static const GimpLayerModeInfo layer_mode_infos[] =
.context = GIMP_LAYER_MODE_CONTEXT_ALL,
.paint_composite_mode = GIMP_LAYER_COMPOSITE_CLIP_TO_BACKDROP,
.composite_mode = GIMP_LAYER_COMPOSITE_CLIP_TO_BACKDROP,
.composite_space = GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL,
.blend_space = GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL
.composite_space = GIMP_LAYER_COLOR_SPACE_RGB_NON_LINEAR,
.blend_space = GIMP_LAYER_COLOR_SPACE_RGB_NON_LINEAR
},
{ GIMP_LAYER_MODE_HSV_VALUE_LEGACY,
@ -257,8 +257,8 @@ static const GimpLayerModeInfo layer_mode_infos[] =
.context = GIMP_LAYER_MODE_CONTEXT_ALL,
.paint_composite_mode = GIMP_LAYER_COMPOSITE_CLIP_TO_BACKDROP,
.composite_mode = GIMP_LAYER_COMPOSITE_CLIP_TO_BACKDROP,
.composite_space = GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL,
.blend_space = GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL
.composite_space = GIMP_LAYER_COLOR_SPACE_RGB_NON_LINEAR,
.blend_space = GIMP_LAYER_COLOR_SPACE_RGB_NON_LINEAR
},
{ GIMP_LAYER_MODE_DIVIDE_LEGACY,
@ -271,8 +271,8 @@ static const GimpLayerModeInfo layer_mode_infos[] =
.context = GIMP_LAYER_MODE_CONTEXT_ALL,
.paint_composite_mode = GIMP_LAYER_COMPOSITE_CLIP_TO_BACKDROP,
.composite_mode = GIMP_LAYER_COMPOSITE_CLIP_TO_BACKDROP,
.composite_space = GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL,
.blend_space = GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL
.composite_space = GIMP_LAYER_COLOR_SPACE_RGB_NON_LINEAR,
.blend_space = GIMP_LAYER_COLOR_SPACE_RGB_NON_LINEAR
},
{ GIMP_LAYER_MODE_DODGE_LEGACY,
@ -285,8 +285,8 @@ static const GimpLayerModeInfo layer_mode_infos[] =
.context = GIMP_LAYER_MODE_CONTEXT_ALL,
.paint_composite_mode = GIMP_LAYER_COMPOSITE_CLIP_TO_BACKDROP,
.composite_mode = GIMP_LAYER_COMPOSITE_CLIP_TO_BACKDROP,
.composite_space = GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL,
.blend_space = GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL
.composite_space = GIMP_LAYER_COLOR_SPACE_RGB_NON_LINEAR,
.blend_space = GIMP_LAYER_COLOR_SPACE_RGB_NON_LINEAR
},
{ GIMP_LAYER_MODE_BURN_LEGACY,
@ -299,8 +299,8 @@ static const GimpLayerModeInfo layer_mode_infos[] =
.context = GIMP_LAYER_MODE_CONTEXT_ALL,
.paint_composite_mode = GIMP_LAYER_COMPOSITE_CLIP_TO_BACKDROP,
.composite_mode = GIMP_LAYER_COMPOSITE_CLIP_TO_BACKDROP,
.composite_space = GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL,
.blend_space = GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL
.composite_space = GIMP_LAYER_COLOR_SPACE_RGB_NON_LINEAR,
.blend_space = GIMP_LAYER_COLOR_SPACE_RGB_NON_LINEAR
},
{ GIMP_LAYER_MODE_HARDLIGHT_LEGACY,
@ -313,8 +313,8 @@ static const GimpLayerModeInfo layer_mode_infos[] =
.context = GIMP_LAYER_MODE_CONTEXT_ALL,
.paint_composite_mode = GIMP_LAYER_COMPOSITE_CLIP_TO_BACKDROP,
.composite_mode = GIMP_LAYER_COMPOSITE_CLIP_TO_BACKDROP,
.composite_space = GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL,
.blend_space = GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL
.composite_space = GIMP_LAYER_COLOR_SPACE_RGB_NON_LINEAR,
.blend_space = GIMP_LAYER_COLOR_SPACE_RGB_NON_LINEAR
},
{ GIMP_LAYER_MODE_SOFTLIGHT_LEGACY,
@ -327,8 +327,8 @@ static const GimpLayerModeInfo layer_mode_infos[] =
.context = GIMP_LAYER_MODE_CONTEXT_ALL,
.paint_composite_mode = GIMP_LAYER_COMPOSITE_CLIP_TO_BACKDROP,
.composite_mode = GIMP_LAYER_COMPOSITE_CLIP_TO_BACKDROP,
.composite_space = GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL,
.blend_space = GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL
.composite_space = GIMP_LAYER_COLOR_SPACE_RGB_NON_LINEAR,
.blend_space = GIMP_LAYER_COLOR_SPACE_RGB_NON_LINEAR
},
{ GIMP_LAYER_MODE_GRAIN_EXTRACT_LEGACY,
@ -341,8 +341,8 @@ static const GimpLayerModeInfo layer_mode_infos[] =
.context = GIMP_LAYER_MODE_CONTEXT_ALL,
.paint_composite_mode = GIMP_LAYER_COMPOSITE_CLIP_TO_BACKDROP,
.composite_mode = GIMP_LAYER_COMPOSITE_CLIP_TO_BACKDROP,
.composite_space = GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL,
.blend_space = GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL
.composite_space = GIMP_LAYER_COLOR_SPACE_RGB_NON_LINEAR,
.blend_space = GIMP_LAYER_COLOR_SPACE_RGB_NON_LINEAR
},
{ GIMP_LAYER_MODE_GRAIN_MERGE_LEGACY,
@ -355,8 +355,8 @@ static const GimpLayerModeInfo layer_mode_infos[] =
.context = GIMP_LAYER_MODE_CONTEXT_ALL,
.paint_composite_mode = GIMP_LAYER_COMPOSITE_CLIP_TO_BACKDROP,
.composite_mode = GIMP_LAYER_COMPOSITE_CLIP_TO_BACKDROP,
.composite_space = GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL,
.blend_space = GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL
.composite_space = GIMP_LAYER_COLOR_SPACE_RGB_NON_LINEAR,
.blend_space = GIMP_LAYER_COLOR_SPACE_RGB_NON_LINEAR
},
{ GIMP_LAYER_MODE_COLOR_ERASE_LEGACY,
@ -372,8 +372,8 @@ static const GimpLayerModeInfo layer_mode_infos[] =
GIMP_LAYER_MODE_CONTEXT_FILTER,
.paint_composite_mode = GIMP_LAYER_COMPOSITE_CLIP_TO_BACKDROP,
.composite_mode = GIMP_LAYER_COMPOSITE_CLIP_TO_BACKDROP,
.composite_space = GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL,
.blend_space = GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL
.composite_space = GIMP_LAYER_COLOR_SPACE_RGB_NON_LINEAR,
.blend_space = GIMP_LAYER_COLOR_SPACE_RGB_NON_LINEAR
},
{ GIMP_LAYER_MODE_OVERLAY,
@ -545,7 +545,7 @@ static const GimpLayerModeInfo layer_mode_infos[] =
.paint_composite_mode = GIMP_LAYER_COMPOSITE_UNION,
.composite_mode = GIMP_LAYER_COMPOSITE_CLIP_TO_BACKDROP,
.composite_space = GIMP_LAYER_COLOR_SPACE_RGB_LINEAR,
.blend_space = GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL
.blend_space = GIMP_LAYER_COLOR_SPACE_RGB_NON_LINEAR
},
{ GIMP_LAYER_MODE_HSV_SATURATION,
@ -557,7 +557,7 @@ static const GimpLayerModeInfo layer_mode_infos[] =
.paint_composite_mode = GIMP_LAYER_COMPOSITE_UNION,
.composite_mode = GIMP_LAYER_COMPOSITE_CLIP_TO_BACKDROP,
.composite_space = GIMP_LAYER_COLOR_SPACE_RGB_LINEAR,
.blend_space = GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL
.blend_space = GIMP_LAYER_COLOR_SPACE_RGB_NON_LINEAR
},
{ GIMP_LAYER_MODE_HSL_COLOR,
@ -569,7 +569,7 @@ static const GimpLayerModeInfo layer_mode_infos[] =
.paint_composite_mode = GIMP_LAYER_COMPOSITE_UNION,
.composite_mode = GIMP_LAYER_COMPOSITE_CLIP_TO_BACKDROP,
.composite_space = GIMP_LAYER_COLOR_SPACE_RGB_LINEAR,
.blend_space = GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL
.blend_space = GIMP_LAYER_COLOR_SPACE_RGB_NON_LINEAR
},
{ GIMP_LAYER_MODE_HSV_VALUE,
@ -581,7 +581,7 @@ static const GimpLayerModeInfo layer_mode_infos[] =
.paint_composite_mode = GIMP_LAYER_COMPOSITE_UNION,
.composite_mode = GIMP_LAYER_COMPOSITE_CLIP_TO_BACKDROP,
.composite_space = GIMP_LAYER_COLOR_SPACE_RGB_LINEAR,
.blend_space = GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL
.blend_space = GIMP_LAYER_COLOR_SPACE_RGB_NON_LINEAR
},
{ GIMP_LAYER_MODE_DIVIDE,
@ -1533,9 +1533,12 @@ gimp_layer_mode_get_format (GimpLayerMode mode,
case GIMP_LAYER_COLOR_SPACE_RGB_LINEAR:
return babl_format_with_space ("RGBA float", preferred_format);
case GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL:
case GIMP_LAYER_COLOR_SPACE_RGB_NON_LINEAR:
return babl_format_with_space ("R'G'B'A float", preferred_format);
case GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL:
return babl_format_with_space ("R~G~B~A float", preferred_format);
case GIMP_LAYER_COLOR_SPACE_LAB:
return babl_format_with_space ("CIE Lab alpha float", preferred_format);
}

View File

@ -657,8 +657,8 @@ gimp_operation_layer_mode_real_process (GeglOperation *operation,
if (blend_space != GIMP_LAYER_COLOR_SPACE_AUTO)
{
gimp_assert (composite_space >= 1 && composite_space < 4);
gimp_assert (blend_space >= 1 && blend_space < 4);
gimp_assert (composite_space >= 1 && composite_space < 5);
gimp_assert (blend_space >= 1 && blend_space < 5);
/* Make sure the cache is set up from the start as the
* operation's prepare() method may have not been run yet.
@ -903,8 +903,15 @@ gimp_operation_layer_mode_cache_fishes (GimpOperationLayerMode *op,
op->space_fish
/* from */ [GIMP_LAYER_COLOR_SPACE_RGB_LINEAR - 1]
/* to */ [GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL - 1] =
babl_fish (babl_format_with_space ("RGBA float", format),
babl_format_with_space ("R~G~B~A float", format));
op->space_fish
/* from */ [GIMP_LAYER_COLOR_SPACE_RGB_LINEAR - 1]
/* to */ [GIMP_LAYER_COLOR_SPACE_RGB_NON_LINEAR - 1] =
babl_fish (babl_format_with_space ("RGBA float", format),
babl_format_with_space ("R'G'B'A float", format));
op->space_fish
/* from */ [GIMP_LAYER_COLOR_SPACE_RGB_LINEAR - 1]
/* to */ [GIMP_LAYER_COLOR_SPACE_LAB - 1] =
@ -912,12 +919,25 @@ gimp_operation_layer_mode_cache_fishes (GimpOperationLayerMode *op,
babl_format_with_space ("CIE Lab alpha float", format));
op->space_fish
/* from */ [GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL - 1]
/* from */ [GIMP_LAYER_COLOR_SPACE_RGB_NON_LINEAR - 1]
/* to */ [GIMP_LAYER_COLOR_SPACE_RGB_LINEAR - 1] =
babl_fish (babl_format_with_space("R'G'B'A float", format),
babl_format_with_space ( "RGBA float", format));
op->space_fish
/* from */ [GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL - 1]
/* to */ [GIMP_LAYER_COLOR_SPACE_RGB_LINEAR - 1] =
babl_fish (babl_format_with_space("R~G~B~A float", format),
babl_format_with_space ( "RGBA float", format));
op->space_fish
/* from */ [GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL - 1]
/* to */ [GIMP_LAYER_COLOR_SPACE_LAB - 1] =
babl_fish (babl_format_with_space("R~G~B~A float", format),
babl_format_with_space ( "CIE Lab alpha float", format));
op->space_fish
/* from */ [GIMP_LAYER_COLOR_SPACE_RGB_NON_LINEAR - 1]
/* to */ [GIMP_LAYER_COLOR_SPACE_LAB - 1] =
babl_fish (babl_format_with_space("R'G'B'A float", format),
babl_format_with_space ( "CIE Lab alpha float", format));
@ -927,11 +947,30 @@ gimp_operation_layer_mode_cache_fishes (GimpOperationLayerMode *op,
/* to */ [GIMP_LAYER_COLOR_SPACE_RGB_LINEAR - 1] =
babl_fish (babl_format_with_space("CIE Lab alpha float", format),
babl_format_with_space ( "RGBA float", format));
op->space_fish
/* from */ [GIMP_LAYER_COLOR_SPACE_LAB - 1]
/* to */ [GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL - 1] =
babl_fish (babl_format_with_space("CIE Lab alpha float", format),
babl_format_with_space ( "R~G~B~A float", format));
op->space_fish
/* from */ [GIMP_LAYER_COLOR_SPACE_LAB - 1]
/* to */ [GIMP_LAYER_COLOR_SPACE_RGB_NON_LINEAR - 1] =
babl_fish (babl_format_with_space("CIE Lab alpha float", format),
babl_format_with_space ( "R'G'B'A float", format));
op->space_fish
/* from */ [GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL - 1]
/* to */ [GIMP_LAYER_COLOR_SPACE_RGB_NON_LINEAR - 1] =
babl_fish (babl_format_with_space("R~G~B~A float", format),
babl_format_with_space ( "R'G'B'A float", format));
op->space_fish
/* from */ [GIMP_LAYER_COLOR_SPACE_RGB_NON_LINEAR - 1]
/* to */ [GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL - 1] =
babl_fish (babl_format_with_space("R'G'B'A float", format),
babl_format_with_space ( "R~G~B~A float", format));
}
}

View File

@ -45,7 +45,7 @@ struct _GimpOperationLayerMode
GimpLayerColorSpace composite_space;
GimpLayerCompositeMode composite_mode;
const Babl *cached_fish_format;
const Babl *space_fish[3 /* from */][3 /* to */];
const Babl *space_fish[4 /* from */][4 /* to */];
gdouble prop_opacity;
GimpLayerCompositeMode prop_composite_mode;

View File

@ -16,8 +16,9 @@ gimp_layer_color_space_get_type (void)
{
{ GIMP_LAYER_COLOR_SPACE_AUTO, "GIMP_LAYER_COLOR_SPACE_AUTO", "auto" },
{ GIMP_LAYER_COLOR_SPACE_RGB_LINEAR, "GIMP_LAYER_COLOR_SPACE_RGB_LINEAR", "rgb-linear" },
{ GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL, "GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL", "rgb-perceptual" },
{ GIMP_LAYER_COLOR_SPACE_RGB_NON_LINEAR, "GIMP_LAYER_COLOR_SPACE_RGB_NON_LINEAR", "rgb-non-linear" },
{ GIMP_LAYER_COLOR_SPACE_LAB, "GIMP_LAYER_COLOR_SPACE_LAB", "lab" },
{ GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL, "GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL", "rgb-perceptual" },
{ 0, NULL, NULL }
};
@ -25,8 +26,9 @@ gimp_layer_color_space_get_type (void)
{
{ GIMP_LAYER_COLOR_SPACE_AUTO, NC_("layer-color-space", "Auto"), NULL },
{ GIMP_LAYER_COLOR_SPACE_RGB_LINEAR, NC_("layer-color-space", "RGB (linear)"), NULL },
{ GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL, NC_("layer-color-space", "RGB (perceptual)"), NULL },
{ GIMP_LAYER_COLOR_SPACE_RGB_NON_LINEAR, NC_("layer-color-space", "RGB (from color profile)"), NULL },
{ GIMP_LAYER_COLOR_SPACE_LAB, NC_("layer-color-space", "LAB"), NULL },
{ GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL, NC_("layer-color-space", "RGB (perceptual)"), NULL },
{ 0, NULL, NULL }
};

View File

@ -29,8 +29,9 @@ typedef enum
{
GIMP_LAYER_COLOR_SPACE_AUTO, /*< desc="Auto" >*/
GIMP_LAYER_COLOR_SPACE_RGB_LINEAR, /*< desc="RGB (linear)" >*/
GIMP_LAYER_COLOR_SPACE_RGB_NON_LINEAR, /*< desc="RGB (from color profile)" >*/
GIMP_LAYER_COLOR_SPACE_LAB, /*< desc="LAB" >*/
GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL, /*< desc="RGB (perceptual)" >*/
GIMP_LAYER_COLOR_SPACE_LAB, /*< desc="LAB", pdb-skip >*/
} GimpLayerColorSpace;

View File

@ -91,6 +91,7 @@ static GimpXcfLoaderFunc * const xcf_loaders[] =
xcf_load_image, /* version 20 */
xcf_load_image, /* version 21 */
xcf_load_image, /* version 22 */
xcf_load_image, /* version 23 */
};

View File

@ -98,6 +98,8 @@ GType gimp_layer_color_space_get_type (void) G_GNUC_CONST;
* GimpLayerColorSpace:
* @GIMP_LAYER_COLOR_SPACE_AUTO: GIMP_LAYER_COLOR_SPACE_AUTO
* @GIMP_LAYER_COLOR_SPACE_RGB_LINEAR: GIMP_LAYER_COLOR_SPACE_RGB_LINEAR
* @GIMP_LAYER_COLOR_SPACE_RGB_NON_LINEAR: GIMP_LAYER_COLOR_SPACE_RGB_NON_LINEAR
* @GIMP_LAYER_COLOR_SPACE_LAB: GIMP_LAYER_COLOR_SPACE_LAB
* @GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL: GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL
*
* Extracted from app/operations/operations-enums.h
@ -106,6 +108,8 @@ typedef enum
{
GIMP_LAYER_COLOR_SPACE_AUTO,
GIMP_LAYER_COLOR_SPACE_RGB_LINEAR,
GIMP_LAYER_COLOR_SPACE_RGB_NON_LINEAR,
GIMP_LAYER_COLOR_SPACE_LAB,
GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL
} GimpLayerColorSpace;

View File

@ -12,12 +12,14 @@
<attribute name="label" translatable="yes" context="layers-action">Blend Space</attribute>
<item><attribute name="action">app.layers-blend-space-auto</attribute></item>
<item><attribute name="action">app.layers-blend-space-rgb-linear</attribute></item>
<item><attribute name="action">app.layers-blend-space-rgb-non-linear</attribute></item>
<item><attribute name="action">app.layers-blend-space-rgb-perceptual</attribute></item>
</submenu>
<submenu>
<attribute name="label" translatable="yes" context="layers-action">Composite Space</attribute>
<item><attribute name="action">app.layers-composite-space-auto</attribute></item>
<item><attribute name="action">app.layers-composite-space-rgb-linear</attribute></item>
<item><attribute name="action">app.layers-composite-space-rgb-non-linear</attribute></item>
<item><attribute name="action">app.layers-composite-space-rgb-perceptual</attribute></item>
</submenu>
<submenu>

View File

@ -679,10 +679,14 @@ package Gimp::CodeGen::enums;
header => 'operations/operations-enums.h',
symbols => [ qw(GIMP_LAYER_COLOR_SPACE_AUTO
GIMP_LAYER_COLOR_SPACE_RGB_LINEAR
GIMP_LAYER_COLOR_SPACE_RGB_NON_LINEAR
GIMP_LAYER_COLOR_SPACE_LAB
GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL) ],
mapping => { GIMP_LAYER_COLOR_SPACE_AUTO => '0',
GIMP_LAYER_COLOR_SPACE_RGB_LINEAR => '1',
GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL => '2' }
GIMP_LAYER_COLOR_SPACE_RGB_NON_LINEAR => '2',
GIMP_LAYER_COLOR_SPACE_LAB => '3',
GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL => '4' }
},
GimpLayerCompositeMode =>
{ contig => 1,