[gimp/pippin/linear-is-the-new-black: 6/14] app: duplicate normal mode, one linear and one sRGB



commit f81b125e18e23227cf96c701170a23d1fffb0566
Author: Øyvind Kolås <pippin gimp org>
Date:   Fri Dec 23 00:42:23 2016 +0100

    app: duplicate normal mode, one linear and one sRGB
    
    The normal mode at the enum position of old normal composites with the sRGB
    gamma TRC, which should make XCFs created with older versions of GIMP using
    normal mode render correctly/as expected, being able to create new compositions
    that blend in non-linear sRGB is also important for testing how things will
    look with default web blending and similar.
    
    Note: XCFs saved with this version of GIMP will not work with master of GIMP
    since GIMP master does not have a linear normal mode enum.

 app/actions/context-commands.c          |    3 ++-
 app/actions/layers-commands.c           |    1 +
 app/core/core-enums.c                   |    6 ++++--
 app/core/core-enums.h                   |    3 ++-
 app/gegl/gimp-gegl-nodes.c              |    2 ++
 app/operations/gimplayermodefunctions.c |    3 ++-
 app/widgets/gimpwidgets-constructors.c  |    5 +++--
 7 files changed, 16 insertions(+), 7 deletions(-)
---
diff --git a/app/actions/context-commands.c b/app/actions/context-commands.c
index 449557c..39dff8f 100644
--- a/app/actions/context-commands.c
+++ b/app/actions/context-commands.c
@@ -76,7 +76,8 @@ static const GimpLayerModeEffects paint_modes[] =
   GIMP_LCH_HUE_MODE,
   GIMP_LCH_CHROMA_MODE,
   GIMP_LCH_COLOR_MODE,
-  GIMP_LCH_LIGHTNESS_MODE
+  GIMP_LCH_LIGHTNESS_MODE,
+  GIMP_NORMAL_SRGB_MODE
 };
 
 
diff --git a/app/actions/layers-commands.c b/app/actions/layers-commands.c
index 394fa7b..fd26c1c 100644
--- a/app/actions/layers-commands.c
+++ b/app/actions/layers-commands.c
@@ -84,6 +84,7 @@
 static const GimpLayerModeEffects layer_modes[] =
 {
   GIMP_NORMAL_MODE,
+  GIMP_NORMAL_SRGB_MODE,
   GIMP_DISSOLVE_MODE,
   GIMP_MULTIPLY_MODE,
   GIMP_DIVIDE_MODE,
diff --git a/app/core/core-enums.c b/app/core/core-enums.c
index cbdcf44..81d6f50 100644
--- a/app/core/core-enums.c
+++ b/app/core/core-enums.c
@@ -289,7 +289,7 @@ gimp_layer_mode_effects_get_type (void)
 {
   static const GEnumValue values[] =
   {
-    { GIMP_NORMAL_MODE, "GIMP_NORMAL_MODE", "normal-mode" },
+    { GIMP_NORMAL_SRGB_MODE, "GIMP_NORMAL_SRGB_MODE", "normal-srgb-mode" },
     { GIMP_DISSOLVE_MODE, "GIMP_DISSOLVE_MODE", "dissolve-mode" },
     { GIMP_BEHIND_MODE, "GIMP_BEHIND_MODE", "behind-mode" },
     { GIMP_MULTIPLY_MODE, "GIMP_MULTIPLY_MODE", "multiply-mode" },
@@ -317,6 +317,7 @@ gimp_layer_mode_effects_get_type (void)
     { GIMP_LCH_CHROMA_MODE, "GIMP_LCH_CHROMA_MODE", "lch-chroma-mode" },
     { GIMP_LCH_COLOR_MODE, "GIMP_LCH_COLOR_MODE", "lch-color-mode" },
     { GIMP_LCH_LIGHTNESS_MODE, "GIMP_LCH_LIGHTNESS_MODE", "lch-lightness-mode" },
+    { GIMP_NORMAL_MODE, "GIMP_NORMAL_MODE", "normal-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" },
@@ -325,7 +326,7 @@ gimp_layer_mode_effects_get_type (void)
 
   static const GimpEnumDesc descs[] =
   {
-    { GIMP_NORMAL_MODE, NC_("layer-mode-effects", "Normal"), NULL },
+    { GIMP_NORMAL_SRGB_MODE, NC_("layer-mode-effects", "Normal (with sRGB gamma)"), NULL },
     { GIMP_DISSOLVE_MODE, NC_("layer-mode-effects", "Dissolve"), NULL },
     { GIMP_BEHIND_MODE, NC_("layer-mode-effects", "Behind"), NULL },
     { GIMP_MULTIPLY_MODE, NC_("layer-mode-effects", "Multiply"), NULL },
@@ -353,6 +354,7 @@ gimp_layer_mode_effects_get_type (void)
     { GIMP_LCH_CHROMA_MODE, NC_("layer-mode-effects", "Chroma (LCH)"), NULL },
     { GIMP_LCH_COLOR_MODE, NC_("layer-mode-effects", "Color (LCH)"), NULL },
     { GIMP_LCH_LIGHTNESS_MODE, NC_("layer-mode-effects", "Lightness (LCH)"), NULL },
+    { GIMP_NORMAL_MODE, NC_("layer-mode-effects", "Normal"), 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 95616e6..172a5b9 100644
--- a/app/core/core-enums.h
+++ b/app/core/core-enums.h
@@ -154,7 +154,7 @@ GType gimp_layer_mode_effects_get_type (void) G_GNUC_CONST;
 
 typedef enum
 {
-  GIMP_NORMAL_MODE,          /*< desc="Normal"               >*/
+  GIMP_NORMAL_SRGB_MODE,     /*< desc="Normal (with sRGB gamma)" >*/
   GIMP_DISSOLVE_MODE,        /*< desc="Dissolve"             >*/
   GIMP_BEHIND_MODE,          /*< desc="Behind"               >*/
   GIMP_MULTIPLY_MODE,        /*< desc="Multiply"             >*/
@@ -182,6 +182,7 @@ typedef enum
   GIMP_LCH_CHROMA_MODE,      /*< desc="Chroma (LCH)"         >*/
   GIMP_LCH_COLOR_MODE,       /*< desc="Color (LCH)"          >*/
   GIMP_LCH_LIGHTNESS_MODE,   /*< desc="Lightness (LCH)"      >*/
+  GIMP_NORMAL_MODE,          /*< desc="Normal"               >*/
 
   /* internal modes, not available to the PDB */
   GIMP_ERASE_MODE      = 1000, /*< pdb-skip, desc="Erase"      >*/
diff --git a/app/gegl/gimp-gegl-nodes.c b/app/gegl/gimp-gegl-nodes.c
index 7f2a77b..905eda8 100644
--- a/app/gegl/gimp-gegl-nodes.c
+++ b/app/gegl/gimp-gegl-nodes.c
@@ -151,6 +151,7 @@ gimp_gegl_mode_node_set_mode (GeglNode             *node,
   switch (mode)
     {
     case GIMP_NORMAL_MODE:        operation = "gimp:normal-mode"; break;
+    case GIMP_NORMAL_SRGB_MODE:   operation = "gimp:normal-mode"; break;
     case GIMP_DISSOLVE_MODE:      operation = "gimp:dissolve-mode"; break;
     case GIMP_BEHIND_MODE:        operation = "gimp:behind-mode"; break;
     case GIMP_MULTIPLY_MODE:      operation = "gimp:multiply-mode"; break;
@@ -213,6 +214,7 @@ gimp_gegl_mode_node_set_mode (GeglNode             *node,
            "linear",    TRUE,
            NULL);
         break;
+    case GIMP_NORMAL_SRGB_MODE:
     case GIMP_OVERLAY_MODE:
     case GIMP_DIFFERENCE_MODE:
     case GIMP_HUE_MODE:
diff --git a/app/operations/gimplayermodefunctions.c b/app/operations/gimplayermodefunctions.c
index 31cf54a..f1cc537 100644
--- a/app/operations/gimplayermodefunctions.c
+++ b/app/operations/gimplayermodefunctions.c
@@ -66,7 +66,8 @@ get_layer_mode_function (GimpLayerModeEffects paint_mode,
 
   switch (paint_mode)
     {
-      case GIMP_NORMAL_MODE:        func = gimp_operation_normal_mode_process_pixels; break;
+      case GIMP_NORMAL_MODE:        func = gimp_operation_normal_mode_process_pixels; break; // XXX : does 
code using these functions properly
+      case GIMP_NORMAL_SRGB_MODE:   func = gimp_operation_normal_mode_process_pixels; break; // XXX : dealt 
with linear or not?
       case GIMP_DISSOLVE_MODE:      func = gimp_operation_dissolve_mode_process_pixels; break;
       case GIMP_BEHIND_MODE:        func = gimp_operation_behind_mode_process_pixels; break;
       case GIMP_MULTIPLY_MODE:      func = gimp_operation_multiply_mode_process_pixels; break;
diff --git a/app/widgets/gimpwidgets-constructors.c b/app/widgets/gimpwidgets-constructors.c
index de47f96..f85fe05 100644
--- a/app/widgets/gimpwidgets-constructors.c
+++ b/app/widgets/gimpwidgets-constructors.c
@@ -104,8 +104,9 @@ gimp_paint_mode_menu_new (gboolean with_behind_mode,
   GtkWidget    *combo;
 
   store = gimp_enum_store_new_with_values (GIMP_TYPE_LAYER_MODE_EFFECTS,
-                                           25,
+                                           26,
                                            GIMP_NORMAL_MODE,
+                                           GIMP_NORMAL_SRGB_MODE,
                                            GIMP_DISSOLVE_MODE,
 
                                            GIMP_LIGHTEN_ONLY_MODE,
@@ -168,7 +169,7 @@ gimp_paint_mode_menu_new (gboolean with_behind_mode,
   if (with_replace_modes)
     {
       gimp_enum_store_insert_value_after (GIMP_ENUM_STORE (store),
-                                          GIMP_NORMAL_MODE,
+                                          GIMP_NORMAL_SRGB_MODE,
                                           GIMP_REPLACE_MODE);
       gimp_enum_store_insert_value_after (GIMP_ENUM_STORE (store),
                                           GIMP_COLOR_ERASE_MODE,


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