[gimp] plug-ins: in file-psd, use SRC_OVER and RGB_PERCEPTUAL for all layers



commit dccaa5d5d12cf85960a54445c7f1f2c07b688515
Author: Ell <ell_se yahoo com>
Date:   Wed Aug 9 09:45:22 2017 -0400

    plug-ins: in file-psd, use SRC_OVER and RGB_PERCEPTUAL for all layers
    
    Use SRC_OVER, instead of SRC_ATOP, as the composite mode for all
    layers (or use AUTO, when it results in SRC_OVER), to match
    Photoshop's behavior.  Use RGB_PERCEPTUAL as the blend and composite
    space, instead of AUTO, whose interpretation depends on the specific
    layer mode, to match Photoshop's behavior for RGB images.  Use NORMAL
    mode, instead of NORMAL_LEGACY, with the above properties, for normal
    layers, for consistency with the other layer modes, which don't (and,
    indeed, can't) use the legacy modes.

 plug-ins/file-psd/psd-load.c |   10 ++++++++++
 plug-ins/file-psd/psd-util.c |   13 ++++++++-----
 2 files changed, 18 insertions(+), 5 deletions(-)
---
diff --git a/plug-ins/file-psd/psd-load.c b/plug-ins/file-psd/psd-load.c
index 6bddd6f..6691e6e 100644
--- a/plug-ins/file-psd/psd-load.c
+++ b/plug-ins/file-psd/psd-load.c
@@ -1412,6 +1412,11 @@ add_layers (gint32     image_id,
                       layer_mode = psd_to_gimp_blend_mode (lyr_a[lidx]->blend_mode, &layer_composite);
                       gimp_layer_set_mode (layer_id, layer_mode);
                       gimp_layer_set_composite_mode (layer_id, layer_composite);
+                      /* FIXME: use perceptual blending and compositing
+                       * unconditionally for now
+                       */
+                      gimp_layer_set_blend_space (layer_id, GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL);
+                      gimp_layer_set_composite_space (layer_id, GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL);
                       gimp_layer_set_opacity (layer_id,
                                               lyr_a[lidx]->opacity * 100 / 255);
                       gimp_item_set_name (layer_id, lyr_a[lidx]->name);
@@ -1469,6 +1474,11 @@ add_layers (gint32     image_id,
                                          image_type, lyr_a[lidx]->opacity * 100 / 255,
                                          layer_mode);
               gimp_layer_set_composite_mode (layer_id, layer_composite);
+              /* FIXME: use perceptual blending and compositing for all layers
+               * for now
+               */
+              gimp_layer_set_blend_space (layer_id, GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL);
+              gimp_layer_set_composite_space (layer_id, GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL);
               IFDBG(3) g_debug ("Layer tattoo: %d", layer_id);
               g_free (lyr_a[lidx]->name);
               gimp_image_insert_layer (image_id, layer_id, parent_group_id, 0);
diff --git a/plug-ins/file-psd/psd-util.c b/plug-ins/file-psd/psd-util.c
index 2f856f6..342b669 100644
--- a/plug-ins/file-psd/psd-util.c
+++ b/plug-ins/file-psd/psd-util.c
@@ -613,15 +613,18 @@ psd_to_gimp_blend_mode (const gchar            *psd_mode,
    * "union", effectively, only returning "auto" for modes that default to
    * "union", to reduce UI clutter.
    */
-  if (layer_composite) *layer_composite = GIMP_LAYER_COMPOSITE_SRC_ATOP;
+  if (layer_composite) *layer_composite = GIMP_LAYER_COMPOSITE_SRC_OVER;
 
   if (g_ascii_strncasecmp (psd_mode, "pass", 4) == 0)           /* Pass through (CS)*/
+    {
+      if (layer_composite) *layer_composite = GIMP_LAYER_COMPOSITE_AUTO;
       return GIMP_LAYER_MODE_PASS_THROUGH;
+    }
 
   if (g_ascii_strncasecmp (psd_mode, "norm", 4) == 0)           /* Normal (ps3) */
     {
       if (layer_composite) *layer_composite = GIMP_LAYER_COMPOSITE_AUTO;
-      return GIMP_LAYER_MODE_NORMAL_LEGACY;
+      return GIMP_LAYER_MODE_NORMAL;
     }
 
   if (g_ascii_strncasecmp (psd_mode, "dark", 4) == 0)           /* Darken (ps3) */
@@ -732,7 +735,7 @@ psd_to_gimp_blend_mode (const gchar            *psd_mode,
                      mode_name);
         }
       if (layer_composite) *layer_composite = GIMP_LAYER_COMPOSITE_AUTO;
-      return GIMP_LAYER_MODE_NORMAL_LEGACY;
+      return GIMP_LAYER_MODE_NORMAL;
     }
 
   if (g_ascii_strncasecmp (psd_mode, "lgCl", 4) == 0)           /* Lighter Color */
@@ -744,7 +747,7 @@ psd_to_gimp_blend_mode (const gchar            *psd_mode,
                      mode_name);
         }
       if (layer_composite) *layer_composite = GIMP_LAYER_COMPOSITE_AUTO;
-      return GIMP_LAYER_MODE_NORMAL_LEGACY;
+      return GIMP_LAYER_MODE_NORMAL;
     }
 
   if (CONVERSION_WARNINGS)
@@ -757,7 +760,7 @@ psd_to_gimp_blend_mode (const gchar            *psd_mode,
 
   if (layer_composite) *layer_composite = GIMP_LAYER_COMPOSITE_AUTO;
 
-  return GIMP_LAYER_MODE_NORMAL_LEGACY;
+  return GIMP_LAYER_MODE_NORMAL;
 }
 
 gchar *


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]