From bc4cf9918ff9e5a3cfbd2a0dd92f919224a8522f Mon Sep 17 00:00:00 2001 From: Michael Natterer Date: Mon, 27 Apr 2015 17:48:00 -0400 Subject: [PATCH] Bug 673501 - Issue with Overlay GIMP's OVERLAY mode was identical to SOFTLIGHT. This commit fixes the issue and introduces a NEW_OVERLAY mode and enum value. - change gimp:overlay-mode to be a real (svg-ish) overlay mode - when compositing, map OVERLAY to gimp:softlight-mode - when compisiting, map NEW_OVERLAY to gimp:overlay-mode - bump the XCF version when NEW_OVERLAY is used - map OVERLAY to SOFTLIGHT when loading and saving XCF - map OVERLAY to softlight in all PDB setters - map OVERLAY to softlight when deserializing a GimpContext - change all paint mode menus to show an entry for NEW_OVERLAY instead of OVERLAY - change PSP, PSD and OpenRaster to use NEW_OVERLAY These changes should (redundantly) make sure that no OVERLAY enum value is used in the core any longer because it gets mapped to SOFTLIGHT at all entry points, with the downside of introducing a setter/getter asymmetry when OVERLAY was set in a PDB api. --- app/actions/context-commands.c | 2 +- app/actions/layers-commands.c | 2 +- app/core/core-enums.c | 4 +++- app/core/core-enums.h | 3 ++- app/core/gimpcontext.c | 26 +++++++++++++++++++++ app/core/gimpimage.c | 6 +++++ app/gegl/gimp-gegl-nodes.c | 3 ++- app/operations/gimplayermodefunctions.c | 3 ++- app/operations/gimpoperationoverlaymode.c | 7 +++++- app/operations/gimpoperationsoftlightmode.c | 16 +++++++++++-- app/pdb/brush-select-cmds.c | 6 +++++ app/pdb/brushes-cmds.c | 3 +++ app/pdb/context-cmds.c | 3 +++ app/pdb/edit-cmds.c | 9 +++++++ app/pdb/layer-cmds.c | 6 +++++ app/widgets/gimpwidgets-constructors.c | 2 +- app/xcf/xcf-load.c | 4 ++++ app/xcf/xcf-save.c | 3 +++ app/xcf/xcf.c | 3 ++- devel-docs/libgimp/tmpl/gimpenums.sgml | 1 + libgimp/gimpenums.h | 3 ++- plug-ins/common/file-psp.c | 2 +- plug-ins/file-psd/psd-save.c | 3 ++- plug-ins/file-psd/psd-util.c | 18 +++----------- plug-ins/pygimp/gimpenums-types.defs | 1 + plug-ins/pygimp/plug-ins/file-openraster.py | 2 +- tools/pdbgen/enums.pl | 6 +++-- tools/pdbgen/pdb/brush_select.pdb | 6 +++++ tools/pdbgen/pdb/brushes.pdb | 3 +++ tools/pdbgen/pdb/context.pdb | 3 +++ tools/pdbgen/pdb/edit.pdb | 9 +++++++ tools/pdbgen/pdb/layer.pdb | 6 +++++ 32 files changed, 142 insertions(+), 32 deletions(-) diff --git a/app/actions/context-commands.c b/app/actions/context-commands.c index d0e3d002c8..321bada99b 100644 --- a/app/actions/context-commands.c +++ b/app/actions/context-commands.c @@ -57,7 +57,7 @@ static const GimpLayerModeEffects paint_modes[] = GIMP_MULTIPLY_MODE, GIMP_DIVIDE_MODE, GIMP_SCREEN_MODE, - GIMP_OVERLAY_MODE, + GIMP_NEW_OVERLAY_MODE, GIMP_DODGE_MODE, GIMP_BURN_MODE, GIMP_HARDLIGHT_MODE, diff --git a/app/actions/layers-commands.c b/app/actions/layers-commands.c index fc8c482ef2..bd0e7829d1 100644 --- a/app/actions/layers-commands.c +++ b/app/actions/layers-commands.c @@ -82,7 +82,7 @@ static const GimpLayerModeEffects layer_modes[] = GIMP_MULTIPLY_MODE, GIMP_DIVIDE_MODE, GIMP_SCREEN_MODE, - GIMP_OVERLAY_MODE, + GIMP_NEW_OVERLAY_MODE, GIMP_DODGE_MODE, GIMP_BURN_MODE, GIMP_HARDLIGHT_MODE, diff --git a/app/core/core-enums.c b/app/core/core-enums.c index c6dcc62e83..cfad22ed1b 100644 --- a/app/core/core-enums.c +++ b/app/core/core-enums.c @@ -275,6 +275,7 @@ gimp_layer_mode_effects_get_type (void) { GIMP_GRAIN_EXTRACT_MODE, "GIMP_GRAIN_EXTRACT_MODE", "grain-extract-mode" }, { GIMP_GRAIN_MERGE_MODE, "GIMP_GRAIN_MERGE_MODE", "grain-merge-mode" }, { GIMP_COLOR_ERASE_MODE, "GIMP_COLOR_ERASE_MODE", "color-erase-mode" }, + { GIMP_NEW_OVERLAY_MODE, "GIMP_NEW_OVERLAY_MODE", "new-overlay-mode" }, { GIMP_ERASE_MODE, "GIMP_ERASE_MODE", "erase-mode" }, { GIMP_REPLACE_MODE, "GIMP_REPLACE_MODE", "replace-mode" }, { GIMP_ANTI_ERASE_MODE, "GIMP_ANTI_ERASE_MODE", "anti-erase-mode" }, @@ -288,7 +289,7 @@ gimp_layer_mode_effects_get_type (void) { GIMP_BEHIND_MODE, NC_("layer-mode-effects", "Behind"), NULL }, { GIMP_MULTIPLY_MODE, NC_("layer-mode-effects", "Multiply"), NULL }, { GIMP_SCREEN_MODE, NC_("layer-mode-effects", "Screen"), NULL }, - { GIMP_OVERLAY_MODE, NC_("layer-mode-effects", "Overlay"), NULL }, + { GIMP_OVERLAY_MODE, NC_("layer-mode-effects", "Old broken Overlay"), NULL }, { GIMP_DIFFERENCE_MODE, NC_("layer-mode-effects", "Difference"), NULL }, { GIMP_ADDITION_MODE, NC_("layer-mode-effects", "Addition"), NULL }, { GIMP_SUBTRACT_MODE, NC_("layer-mode-effects", "Subtract"), NULL }, @@ -306,6 +307,7 @@ gimp_layer_mode_effects_get_type (void) { GIMP_GRAIN_EXTRACT_MODE, NC_("layer-mode-effects", "Grain extract"), NULL }, { GIMP_GRAIN_MERGE_MODE, NC_("layer-mode-effects", "Grain merge"), NULL }, { GIMP_COLOR_ERASE_MODE, NC_("layer-mode-effects", "Color erase"), NULL }, + { GIMP_NEW_OVERLAY_MODE, NC_("layer-mode-effects", "Overlay"), NULL }, { GIMP_ERASE_MODE, NC_("layer-mode-effects", "Erase"), NULL }, { GIMP_REPLACE_MODE, NC_("layer-mode-effects", "Replace"), NULL }, { GIMP_ANTI_ERASE_MODE, NC_("layer-mode-effects", "Anti erase"), NULL }, diff --git a/app/core/core-enums.h b/app/core/core-enums.h index a19f2fcb76..4ec137b278 100644 --- a/app/core/core-enums.h +++ b/app/core/core-enums.h @@ -144,7 +144,7 @@ typedef enum GIMP_BEHIND_MODE, /*< desc="Behind" >*/ GIMP_MULTIPLY_MODE, /*< desc="Multiply" >*/ GIMP_SCREEN_MODE, /*< desc="Screen" >*/ - GIMP_OVERLAY_MODE, /*< desc="Overlay" >*/ + GIMP_OVERLAY_MODE, /*< desc="Old broken Overlay" >*/ GIMP_DIFFERENCE_MODE, /*< desc="Difference" >*/ GIMP_ADDITION_MODE, /*< desc="Addition" >*/ GIMP_SUBTRACT_MODE, /*< desc="Subtract" >*/ @@ -162,6 +162,7 @@ typedef enum GIMP_GRAIN_EXTRACT_MODE, /*< desc="Grain extract" >*/ GIMP_GRAIN_MERGE_MODE, /*< desc="Grain merge" >*/ GIMP_COLOR_ERASE_MODE, /*< desc="Color erase" >*/ + GIMP_NEW_OVERLAY_MODE, /*< desc="Overlay" >*/ /* internal modes, not available to the PDB */ GIMP_ERASE_MODE = 1000, /*< pdb-skip, desc="Erase" >*/ diff --git a/app/core/gimpcontext.c b/app/core/gimpcontext.c index 02e6f1f646..32daaf0fff 100644 --- a/app/core/gimpcontext.c +++ b/app/core/gimpcontext.c @@ -86,6 +86,10 @@ static gint64 gimp_context_get_memsize (GimpObject *object, static gboolean gimp_context_serialize (GimpConfig *config, GimpConfigWriter *writer, gpointer data); +static gboolean gimp_context_deserialize (GimpConfig *config, + GScanner *scanner, + gint nest_level, + gpointer data); static gboolean gimp_context_serialize_property (GimpConfig *config, guint property_id, const GValue *value, @@ -777,6 +781,7 @@ static void gimp_context_config_iface_init (GimpConfigInterface *iface) { iface->serialize = gimp_context_serialize; + iface->deserialize = gimp_context_deserialize; iface->serialize_property = gimp_context_serialize_property; iface->deserialize_property = gimp_context_deserialize_property; } @@ -1251,6 +1256,27 @@ gimp_context_serialize (GimpConfig *config, return gimp_config_serialize_changed_properties (config, writer); } +static gboolean +gimp_context_deserialize (GimpConfig *config, + GScanner *scanner, + gint nest_level, + gpointer data) +{ + GimpContext *context = GIMP_CONTEXT (config); + GimpLayerModeEffects old_paint_mode = context->paint_mode; + gboolean success; + + success = gimp_config_deserialize_properties (config, scanner, nest_level); + + if (context->paint_mode != old_paint_mode) + { + if (context->paint_mode == GIMP_OVERLAY_MODE) + g_object_set (context, "paint-mode", GIMP_SOFTLIGHT_MODE, NULL); + } + + return success; +} + static gboolean gimp_context_serialize_property (GimpConfig *config, guint property_id, diff --git a/app/core/gimpimage.c b/app/core/gimpimage.c index 809c989045..baf707d348 100644 --- a/app/core/gimpimage.c +++ b/app/core/gimpimage.c @@ -2315,6 +2315,11 @@ gimp_image_get_xcf_version (GimpImage *image, version = MAX (2, version); break; + /* new layer modes not supported by gimp-2.8 */ + case GIMP_NEW_OVERLAY_MODE: + version = MAX (9, version); + break; + default: break; } @@ -2355,6 +2360,7 @@ gimp_image_get_xcf_version (GimpImage *image, case 6: case 7: case 8: + case 9: if (gimp_version) *gimp_version = 210; if (version_string) *version_string = "GIMP 2.10"; break; diff --git a/app/gegl/gimp-gegl-nodes.c b/app/gegl/gimp-gegl-nodes.c index 42ff698f4a..7db279cb58 100644 --- a/app/gegl/gimp-gegl-nodes.c +++ b/app/gegl/gimp-gegl-nodes.c @@ -155,7 +155,7 @@ gimp_gegl_mode_node_set_mode (GeglNode *node, case GIMP_BEHIND_MODE: operation = "gimp:behind-mode"; break; case GIMP_MULTIPLY_MODE: operation = "gimp:multiply-mode"; break; case GIMP_SCREEN_MODE: operation = "gimp:screen-mode"; break; - case GIMP_OVERLAY_MODE: operation = "gimp:overlay-mode"; break; + case GIMP_OVERLAY_MODE: operation = "gimp:softlight-mode"; break; case GIMP_DIFFERENCE_MODE: operation = "gimp:difference-mode"; break; case GIMP_ADDITION_MODE: operation = "gimp:addition-mode"; break; case GIMP_SUBTRACT_MODE: operation = "gimp:subtract-mode"; break; @@ -173,6 +173,7 @@ gimp_gegl_mode_node_set_mode (GeglNode *node, case GIMP_GRAIN_EXTRACT_MODE: operation = "gimp:grain-extract-mode"; break; case GIMP_GRAIN_MERGE_MODE: operation = "gimp:grain-merge-mode"; break; case GIMP_COLOR_ERASE_MODE: operation = "gimp:color-erase-mode"; break; + case GIMP_NEW_OVERLAY_MODE: operation = "gimp:overlay-mode"; break; case GIMP_ERASE_MODE: operation = "gimp:erase-mode"; break; case GIMP_REPLACE_MODE: operation = "gimp:replace-mode"; break; case GIMP_ANTI_ERASE_MODE: operation = "gimp:anti-erase-mode"; break; diff --git a/app/operations/gimplayermodefunctions.c b/app/operations/gimplayermodefunctions.c index 059f756882..b1bdad0f28 100644 --- a/app/operations/gimplayermodefunctions.c +++ b/app/operations/gimplayermodefunctions.c @@ -65,7 +65,7 @@ get_layer_mode_function (GimpLayerModeEffects paint_mode) case GIMP_BEHIND_MODE: func = gimp_operation_behind_mode_process_pixels; break; case GIMP_MULTIPLY_MODE: func = gimp_operation_multiply_mode_process_pixels; break; case GIMP_SCREEN_MODE: func = gimp_operation_screen_mode_process_pixels; break; - case GIMP_OVERLAY_MODE: func = gimp_operation_overlay_mode_process_pixels; break; + case GIMP_OVERLAY_MODE: func = gimp_operation_softlight_mode_process_pixels; break; case GIMP_DIFFERENCE_MODE: func = gimp_operation_difference_mode_process_pixels; break; case GIMP_ADDITION_MODE: func = gimp_operation_addition_mode_process_pixels; break; case GIMP_SUBTRACT_MODE: func = gimp_operation_subtract_mode_process_pixels; break; @@ -83,6 +83,7 @@ get_layer_mode_function (GimpLayerModeEffects paint_mode) case GIMP_GRAIN_EXTRACT_MODE: func = gimp_operation_grain_extract_mode_process_pixels; break; case GIMP_GRAIN_MERGE_MODE: func = gimp_operation_grain_merge_mode_process_pixels; break; case GIMP_COLOR_ERASE_MODE: func = gimp_operation_color_erase_mode_process_pixels; break; + case GIMP_NEW_OVERLAY_MODE: func = gimp_operation_overlay_mode_process_pixels; break; case GIMP_ERASE_MODE: func = gimp_operation_erase_mode_process_pixels; break; case GIMP_REPLACE_MODE: func = gimp_operation_replace_mode_process_pixels; break; case GIMP_ANTI_ERASE_MODE: func = gimp_operation_anti_erase_mode_process_pixels; break; diff --git a/app/operations/gimpoperationoverlaymode.c b/app/operations/gimpoperationoverlaymode.c index 4436b164d5..cb7e573dd2 100644 --- a/app/operations/gimpoperationoverlaymode.c +++ b/app/operations/gimpoperationoverlaymode.c @@ -108,7 +108,12 @@ gimp_operation_overlay_mode_process_pixels (gfloat *in, for (b = RED; b < ALPHA; b++) { - gfloat comp = in[b] * (in[b] + (2.0 * layer[b]) * (1.0 - in[b])); + gfloat comp; + + if (in[b] < 0.5) + comp = 2.0 * in[b] * layer[b]; + else + comp = 1.0 - 2.0 * (1.0 - layer[b]) * (1.0 - in[b]); out[b] = comp * ratio + in[b] * (1.0 - ratio); } diff --git a/app/operations/gimpoperationsoftlightmode.c b/app/operations/gimpoperationsoftlightmode.c index e7cc0c7034..baaeefa7b6 100644 --- a/app/operations/gimpoperationsoftlightmode.c +++ b/app/operations/gimpoperationsoftlightmode.c @@ -126,9 +126,21 @@ gimp_operation_softlight_mode_process_pixels (gfloat *in, for (b = RED; b < ALPHA; b++) { +#if 0 + /* softlight is now used for what GIMP formerly called + * OVERLAY. We fixed OVERLAY to use the right math + * (under the name NEW_OVERLAY), and redirect uses of + * the old OVERLAY blend mode here. This math was + * formerly used for OVERLAY and is exactly the same as + * the multiply, screen, comp math used below. + * See bug #673501. + */ + gfloat comp = in[b] * (in[b] + (2.0 * layer[b]) * (1.0 - in[b])); +#endif + gfloat multiply = in[b] * layer[b]; - gfloat screen = 1.0 - (1.0 - in[b]) * (1.0 - layer[b]); - gfloat comp = (1.0 - in[b]) * multiply + in[b] * screen; + gfloat screen = 1.0 - (1.0 - in[b]) * (1.0 - layer[b]); + gfloat comp = (1.0 - in[b]) * multiply + in[b] * screen; out[b] = comp * ratio + in[b] * (1.0 - ratio); } diff --git a/app/pdb/brush-select-cmds.c b/app/pdb/brush-select-cmds.c index 79335c415f..a28baff62e 100644 --- a/app/pdb/brush-select-cmds.c +++ b/app/pdb/brush-select-cmds.c @@ -61,6 +61,9 @@ brushes_popup_invoker (GimpProcedure *procedure, if (success) { + if (paint_mode == GIMP_OVERLAY_MODE) + paint_mode = GIMP_SOFTLIGHT_MODE; + if (gimp->no_interface || ! gimp_pdb_lookup_procedure (gimp->pdb, brush_callback) || ! gimp_pdb_dialog_new (gimp, context, progress, @@ -126,6 +129,9 @@ brushes_set_popup_invoker (GimpProcedure *procedure, if (success) { + if (paint_mode == GIMP_OVERLAY_MODE) + paint_mode = GIMP_SOFTLIGHT_MODE; + if (gimp->no_interface || ! gimp_pdb_lookup_procedure (gimp->pdb, brush_callback) || ! gimp_pdb_dialog_set (gimp, gimp_data_factory_get_container (gimp->brush_factory), diff --git a/app/pdb/brushes-cmds.c b/app/pdb/brushes-cmds.c index b1ed7329cf..30e7e84046 100644 --- a/app/pdb/brushes-cmds.c +++ b/app/pdb/brushes-cmds.c @@ -207,6 +207,9 @@ brushes_get_brush_data_invoker (GimpProcedure *procedure, { GimpBrush *brush; + if (paint_mode == GIMP_OVERLAY_MODE) + paint_mode = GIMP_SOFTLIGHT_MODE; + if (name && strlen (name)) brush = gimp_pdb_get_brush (gimp, name, FALSE, error); else diff --git a/app/pdb/context-cmds.c b/app/pdb/context-cmds.c index 7de9cf2fad..a850ba4632 100644 --- a/app/pdb/context-cmds.c +++ b/app/pdb/context-cmds.c @@ -366,6 +366,9 @@ context_set_paint_mode_invoker (GimpProcedure *procedure, if (success) { + if (paint_mode == GIMP_OVERLAY_MODE) + paint_mode = GIMP_SOFTLIGHT_MODE; + gimp_context_set_paint_mode (context, paint_mode); } diff --git a/app/pdb/edit-cmds.c b/app/pdb/edit-cmds.c index f8f64f3c63..4009d57376 100644 --- a/app/pdb/edit-cmds.c +++ b/app/pdb/edit-cmds.c @@ -604,6 +604,9 @@ edit_bucket_fill_invoker (GimpProcedure *procedure, GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable)); GimpFillType fill_type; + if (paint_mode == GIMP_OVERLAY_MODE) + paint_mode = GIMP_SOFTLIGHT_MODE; + switch (fill_mode) { default: @@ -685,6 +688,9 @@ edit_bucket_fill_full_invoker (GimpProcedure *procedure, GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable)); GimpFillType fill_type; + if (paint_mode == GIMP_OVERLAY_MODE) + paint_mode = GIMP_SOFTLIGHT_MODE; + switch (fill_mode) { default: @@ -788,6 +794,9 @@ edit_blend_invoker (GimpProcedure *procedure, { GimpGradient *gradient; + if (paint_mode == GIMP_OVERLAY_MODE) + paint_mode = GIMP_SOFTLIGHT_MODE; + if (progress) gimp_progress_start (progress, FALSE, _("Blending")); diff --git a/app/pdb/layer-cmds.c b/app/pdb/layer-cmds.c index 93c0239f6c..52eae7de57 100644 --- a/app/pdb/layer-cmds.c +++ b/app/pdb/layer-cmds.c @@ -83,6 +83,9 @@ layer_new_invoker (GimpProcedure *procedure, gboolean has_alpha = FALSE; const Babl *format; + if (mode == GIMP_OVERLAY_MODE) + mode = GIMP_SOFTLIGHT_MODE; + switch (type) { case GIMP_RGB_IMAGE: @@ -1128,6 +1131,9 @@ layer_set_mode_invoker (GimpProcedure *procedure, if (success) { + if (mode == GIMP_OVERLAY_MODE) + mode = GIMP_SOFTLIGHT_MODE; + gimp_layer_set_mode (layer, mode, TRUE); } diff --git a/app/widgets/gimpwidgets-constructors.c b/app/widgets/gimpwidgets-constructors.c index efa2329a55..53cfc00d3b 100644 --- a/app/widgets/gimpwidgets-constructors.c +++ b/app/widgets/gimpwidgets-constructors.c @@ -116,7 +116,7 @@ gimp_paint_mode_menu_new (gboolean with_behind_mode, GIMP_MULTIPLY_MODE, GIMP_BURN_MODE, - GIMP_OVERLAY_MODE, + GIMP_NEW_OVERLAY_MODE, GIMP_SOFTLIGHT_MODE, GIMP_HARDLIGHT_MODE, diff --git a/app/xcf/xcf-load.c b/app/xcf/xcf-load.c index 3dc72c6251..caaa1103f2 100644 --- a/app/xcf/xcf-load.c +++ b/app/xcf/xcf-load.c @@ -1050,6 +1050,10 @@ xcf_load_layer_props (XcfInfo *info, guint32 mode; info->cp += xcf_read_int32 (info->input, &mode, 1); + + if (mode == GIMP_OVERLAY_MODE) + mode = GIMP_SOFTLIGHT_MODE; + gimp_layer_set_mode (*layer, (GimpLayerModeEffects) mode, FALSE); } break; diff --git a/app/xcf/xcf-save.c b/app/xcf/xcf-save.c index 92b1dc6b06..269075d2b1 100644 --- a/app/xcf/xcf-save.c +++ b/app/xcf/xcf-save.c @@ -683,6 +683,9 @@ xcf_save_prop (XcfInfo *info, mode = va_arg (args, gint32); size = 4; + if (mode == GIMP_OVERLAY_MODE) + mode = GIMP_SOFTLIGHT_MODE; + xcf_write_prop_type_check_error (info, prop_type); xcf_write_int32_check_error (info, &size, 1); xcf_write_int32_check_error (info, (guint32 *) &mode, 1); diff --git a/app/xcf/xcf.c b/app/xcf/xcf.c index 15c34adfdd..92176ca5ae 100644 --- a/app/xcf/xcf.c +++ b/app/xcf/xcf.c @@ -75,7 +75,8 @@ static GimpXcfLoaderFunc * const xcf_loaders[] = xcf_load_image, /* version 5 */ xcf_load_image, /* version 6 */ xcf_load_image, /* version 7 */ - xcf_load_image /* version 8 */ + xcf_load_image, /* version 8 */ + xcf_load_image /* version 9 */ }; diff --git a/devel-docs/libgimp/tmpl/gimpenums.sgml b/devel-docs/libgimp/tmpl/gimpenums.sgml index ae5c0acde0..6490ec850b 100644 --- a/devel-docs/libgimp/tmpl/gimpenums.sgml +++ b/devel-docs/libgimp/tmpl/gimpenums.sgml @@ -94,4 +94,5 @@ gimpenums @GIMP_GRAIN_EXTRACT_MODE: @GIMP_GRAIN_MERGE_MODE: @GIMP_COLOR_ERASE_MODE: +@GIMP_NEW_OVERLAY_MODE: diff --git a/libgimp/gimpenums.h b/libgimp/gimpenums.h index a26defa022..4a1a3d8bfd 100644 --- a/libgimp/gimpenums.h +++ b/libgimp/gimpenums.h @@ -90,7 +90,8 @@ typedef enum GIMP_SOFTLIGHT_MODE, GIMP_GRAIN_EXTRACT_MODE, GIMP_GRAIN_MERGE_MODE, - GIMP_COLOR_ERASE_MODE + GIMP_COLOR_ERASE_MODE, + GIMP_NEW_OVERLAY_MODE } GimpLayerModeEffects; diff --git a/plug-ins/common/file-psp.c b/plug-ins/common/file-psp.c index d2146d4d61..b35ff8cb4d 100644 --- a/plug-ins/common/file-psp.c +++ b/plug-ins/common/file-psp.c @@ -1009,7 +1009,7 @@ gimp_layer_mode_from_psp_blend_mode (PSPBlendModes mode) case PSP_BLEND_DISSOLVE: return GIMP_DISSOLVE_MODE; case PSP_BLEND_OVERLAY: - return GIMP_OVERLAY_MODE; + return GIMP_NEW_OVERLAY_MODE; case PSP_BLEND_HARD_LIGHT: return GIMP_HARDLIGHT_MODE; case PSP_BLEND_SOFT_LIGHT: diff --git a/plug-ins/file-psd/psd-save.c b/plug-ins/file-psd/psd-save.c index 39bc623164..807719bad4 100644 --- a/plug-ins/file-psd/psd-save.c +++ b/plug-ins/file-psd/psd-save.c @@ -234,10 +234,11 @@ psd_lmode_layer (gint32 idLayer, case GIMP_HARDLIGHT_MODE: strcpy (psdMode, "hLit"); break; + case GIMP_OVERLAY_MODE: case GIMP_SOFTLIGHT_MODE: strcpy (psdMode, "sLit"); break; - case GIMP_OVERLAY_MODE: + case GIMP_NEW_OVERLAY_MODE: strcpy (psdMode, "over"); break; default: diff --git a/plug-ins/file-psd/psd-util.c b/plug-ins/file-psd/psd-util.c index f5cca19b00..0fac559c91 100644 --- a/plug-ins/file-psd/psd-util.c +++ b/plug-ins/file-psd/psd-util.c @@ -649,16 +649,7 @@ psd_to_gimp_blend_mode (const gchar *psd_mode) if (g_ascii_strncasecmp (psd_mode, "diss", 4) == 0) /* Dissolve (ps3) */ return GIMP_DISSOLVE_MODE; if (g_ascii_strncasecmp (psd_mode, "over", 4) == 0) /* Overlay (ps3) */ - { - if (CONVERSION_WARNINGS) - { - static gchar *mode_name = "OVERLAY"; - g_message ("Gimp uses a different equation to photoshop for " - "blend mode: %s. Results will differ.", - mode_name); - } - return GIMP_OVERLAY_MODE; - } + return GIMP_NEW_OVERLAY_MODE; if (g_ascii_strncasecmp (psd_mode, "hLit", 4) == 0) /* Hard light (ps3) */ return GIMP_HARDLIGHT_MODE; if (g_ascii_strncasecmp (psd_mode, "sLit", 4) == 0) /* Soft light (ps3) */ @@ -776,11 +767,7 @@ gimp_to_psd_blend_mode (GimpLayerModeEffects gimp_layer_mode) case GIMP_SCREEN_MODE: psd_mode = g_strndup ("scrn", 4); /* Screen (ps3) */ break; - case GIMP_OVERLAY_MODE: - if (CONVERSION_WARNINGS) - g_message ("Gimp uses a different equation to photoshop for " - "blend mode: %s. Results will differ.", - gimp_layer_mode_effects_name (gimp_layer_mode)); + case GIMP_NEW_OVERLAY_MODE: psd_mode = g_strndup ("over", 4); /* Overlay (ps3) */ break; case GIMP_DIFFERENCE_MODE: @@ -836,6 +823,7 @@ gimp_to_psd_blend_mode (GimpLayerModeEffects gimp_layer_mode) case GIMP_HARDLIGHT_MODE: psd_mode = g_strndup ("hLit", 4); /* Hard Light (ps3) */ break; + case GIMP_OVERLAY_MODE: case GIMP_SOFTLIGHT_MODE: if (CONVERSION_WARNINGS) g_message ("Unsupported blend mode: %s. Mode reverts to normal", diff --git a/plug-ins/pygimp/gimpenums-types.defs b/plug-ins/pygimp/gimpenums-types.defs index c145ba9fc5..5cf93c9738 100644 --- a/plug-ins/pygimp/gimpenums-types.defs +++ b/plug-ins/pygimp/gimpenums-types.defs @@ -162,6 +162,7 @@ '("grain-extract-mode" "GIMP_GRAIN_EXTRACT_MODE") '("grain-merge-mode" "GIMP_GRAIN_MERGE_MODE") '("color-erase-mode" "GIMP_COLOR_ERASE_MODE") + '("new-overlay-mode" "GIMP_NEW_OVERLAY_MODE") ) ) diff --git a/plug-ins/pygimp/plug-ins/file-openraster.py b/plug-ins/pygimp/plug-ins/file-openraster.py index 135b9b4d30..c6b2949e7f 100755 --- a/plug-ins/pygimp/plug-ins/file-openraster.py +++ b/plug-ins/pygimp/plug-ins/file-openraster.py @@ -26,7 +26,7 @@ layermodes_map = { "svg:src-over": NORMAL_MODE, "svg:multiply": MULTIPLY_MODE, "svg:screen": SCREEN_MODE, - "svg:overlay": OVERLAY_MODE, + "svg:overlay": NEW_OVERLAY_MODE, "svg:darken": DARKEN_ONLY_MODE, "svg:lighten": LIGHTEN_ONLY_MODE, "svg:color-dodge": DODGE_MODE, diff --git a/tools/pdbgen/enums.pl b/tools/pdbgen/enums.pl index 85c5efc4a2..e06e71fc96 100644 --- a/tools/pdbgen/enums.pl +++ b/tools/pdbgen/enums.pl @@ -637,7 +637,8 @@ package Gimp::CodeGen::enums; GIMP_VALUE_MODE GIMP_DIVIDE_MODE GIMP_DODGE_MODE GIMP_BURN_MODE GIMP_HARDLIGHT_MODE GIMP_SOFTLIGHT_MODE GIMP_GRAIN_EXTRACT_MODE - GIMP_GRAIN_MERGE_MODE GIMP_COLOR_ERASE_MODE) ], + GIMP_GRAIN_MERGE_MODE GIMP_COLOR_ERASE_MODE + GIMP_NEW_OVERLAY_MODE) ], mapping => { GIMP_NORMAL_MODE => '0', GIMP_DISSOLVE_MODE => '1', GIMP_BEHIND_MODE => '2', @@ -660,7 +661,8 @@ package Gimp::CodeGen::enums; GIMP_SOFTLIGHT_MODE => '19', GIMP_GRAIN_EXTRACT_MODE => '20', GIMP_GRAIN_MERGE_MODE => '21', - GIMP_COLOR_ERASE_MODE => '22' } + GIMP_COLOR_ERASE_MODE => '22', + GIMP_NEW_OVERLAY_MODE => '23' } }, GimpBrushApplicationMode => { contig => 1, diff --git a/tools/pdbgen/pdb/brush_select.pdb b/tools/pdbgen/pdb/brush_select.pdb index 0df1c3cef1..bc7c274619 100644 --- a/tools/pdbgen/pdb/brush_select.pdb +++ b/tools/pdbgen/pdb/brush_select.pdb @@ -42,6 +42,9 @@ sub brushes_popup { %invoke = ( code => <<'CODE' { + if (paint_mode == GIMP_OVERLAY_MODE) + paint_mode = GIMP_SOFTLIGHT_MODE; + if (gimp->no_interface || ! gimp_pdb_lookup_procedure (gimp->pdb, brush_callback) || ! gimp_pdb_dialog_new (gimp, context, progress, @@ -104,6 +107,9 @@ sub brushes_set_popup { %invoke = ( code => <<'CODE' { + if (paint_mode == GIMP_OVERLAY_MODE) + paint_mode = GIMP_SOFTLIGHT_MODE; + if (gimp->no_interface || ! gimp_pdb_lookup_procedure (gimp->pdb, brush_callback) || ! gimp_pdb_dialog_set (gimp, gimp_data_factory_get_container (gimp->brush_factory), diff --git a/tools/pdbgen/pdb/brushes.pdb b/tools/pdbgen/pdb/brushes.pdb index 21661d8959..58462994c8 100644 --- a/tools/pdbgen/pdb/brushes.pdb +++ b/tools/pdbgen/pdb/brushes.pdb @@ -173,6 +173,9 @@ sub brushes_get_brush_data { { GimpBrush *brush; + if (paint_mode == GIMP_OVERLAY_MODE) + paint_mode = GIMP_SOFTLIGHT_MODE; + if (name && strlen (name)) brush = gimp_pdb_get_brush (gimp, name, FALSE, error); else diff --git a/tools/pdbgen/pdb/context.pdb b/tools/pdbgen/pdb/context.pdb index b72f4e4320..80a8385165 100644 --- a/tools/pdbgen/pdb/context.pdb +++ b/tools/pdbgen/pdb/context.pdb @@ -419,6 +419,9 @@ HELP %invoke = ( code => <<'CODE' { + if (paint_mode == GIMP_OVERLAY_MODE) + paint_mode = GIMP_SOFTLIGHT_MODE; + gimp_context_set_paint_mode (context, paint_mode); } CODE diff --git a/tools/pdbgen/pdb/edit.pdb b/tools/pdbgen/pdb/edit.pdb index a80cd2c3c7..c725a71da8 100644 --- a/tools/pdbgen/pdb/edit.pdb +++ b/tools/pdbgen/pdb/edit.pdb @@ -640,6 +640,9 @@ HELP GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable)); GimpFillType fill_type; + if (paint_mode == GIMP_OVERLAY_MODE) + paint_mode = GIMP_SOFTLIGHT_MODE; + switch (fill_mode) { default: @@ -749,6 +752,9 @@ HELP GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable)); GimpFillType fill_type; + if (paint_mode == GIMP_OVERLAY_MODE) + paint_mode = GIMP_SOFTLIGHT_MODE; + switch (fill_mode) { default: @@ -861,6 +867,9 @@ HELP { GimpGradient *gradient; + if (paint_mode == GIMP_OVERLAY_MODE) + paint_mode = GIMP_SOFTLIGHT_MODE; + if (progress) gimp_progress_start (progress, FALSE, _("Blending")); diff --git a/tools/pdbgen/pdb/layer.pdb b/tools/pdbgen/pdb/layer.pdb index 221bc15e91..ca2f25b5c2 100644 --- a/tools/pdbgen/pdb/layer.pdb +++ b/tools/pdbgen/pdb/layer.pdb @@ -59,6 +59,9 @@ HELP gboolean has_alpha = FALSE; const Babl *format; + if (mode == GIMP_OVERLAY_MODE) + mode = GIMP_SOFTLIGHT_MODE; + switch (type) { case GIMP_RGB_IMAGE: @@ -1182,6 +1185,9 @@ sub layer_set_mode { %invoke = ( code => <<'CODE' { + if (mode == GIMP_OVERLAY_MODE) + mode = GIMP_SOFTLIGHT_MODE; + gimp_layer_set_mode (layer, mode, TRUE); } CODE