[gimp] Bug 766988 - Colors applied to images are not color managed



commit 4fefc3817ce837ffdec224f680f20876d0ca5bcd
Author: Michael Natterer <mitch gimp org>
Date:   Sun May 29 17:49:37 2016 +0200

    Bug 766988 - Colors applied to images are not color managed
    
    Color manage colors applied when painting, and when filling, merging,
    resizing and transforming drawables.

 app/core/gimp-edit.c                |    2 ++
 app/core/gimpdrawable-bucket-fill.c |    2 ++
 app/core/gimpdrawable-fill.c        |    6 ++++++
 app/core/gimpdrawable-offset.c      |    3 +++
 app/core/gimpdrawable-transform.c   |   20 ++++++++++++++++----
 app/core/gimpdrawable.c             |   10 ++++++++--
 app/core/gimpimage-merge.c          |    3 +++
 app/paint/gimperaser.c              |    6 +++++-
 app/paint/gimpink.c                 |    3 +++
 app/paint/gimpmybrushcore.c         |    3 +++
 app/paint/gimppaintbrush.c          |    3 +++
 11 files changed, 54 insertions(+), 7 deletions(-)
---
diff --git a/app/core/gimp-edit.c b/app/core/gimp-edit.c
index 94124c5..0cf1fde 100644
--- a/app/core/gimp-edit.c
+++ b/app/core/gimp-edit.c
@@ -445,6 +445,8 @@ gimp_edit_fill (GimpImage       *image,
     {
     case GIMP_FILL_STYLE_SOLID:
       gimp_context_get_foreground (GIMP_CONTEXT (options), &color);
+      gimp_pickable_srgb_to_image_color (GIMP_PICKABLE (drawable),
+                                         &color, &color);
       break;
 
     case GIMP_FILL_STYLE_PATTERN:
diff --git a/app/core/gimpdrawable-bucket-fill.c b/app/core/gimpdrawable-bucket-fill.c
index a7b4b3b..70a3926 100644
--- a/app/core/gimpdrawable-bucket-fill.c
+++ b/app/core/gimpdrawable-bucket-fill.c
@@ -153,6 +153,8 @@ gimp_drawable_bucket_fill (GimpDrawable         *drawable,
     {
     case GIMP_FILL_STYLE_SOLID:
       gimp_context_get_foreground (GIMP_CONTEXT (options), &color);
+      gimp_pickable_srgb_to_image_color (GIMP_PICKABLE (drawable),
+                                         &color, &color);
       break;
 
     case GIMP_FILL_STYLE_PATTERN:
diff --git a/app/core/gimpdrawable-fill.c b/app/core/gimpdrawable-fill.c
index f7ddde2..1f436c3 100644
--- a/app/core/gimpdrawable-fill.c
+++ b/app/core/gimpdrawable-fill.c
@@ -36,6 +36,7 @@
 #include "gimpfilloptions.h"
 #include "gimpimage.h"
 #include "gimppattern.h"
+#include "gimppickable.h"
 #include "gimpscanconvert.h"
 
 #include "vectors/gimpvectors.h"
@@ -71,6 +72,9 @@ gimp_drawable_fill (GimpDrawable *drawable,
     {
       GeglColor *gegl_color;
 
+      gimp_pickable_srgb_to_image_color (GIMP_PICKABLE (drawable),
+                                         &color, &color);
+
       if (! gimp_drawable_has_alpha (drawable))
         gimp_rgb_set_alpha (&color, 1.0);
 
@@ -221,6 +225,8 @@ gimp_drawable_fill_scan_convert (GimpDrawable    *drawable,
         GeglColor *color;
 
         gimp_context_get_foreground (context, &fg);
+        gimp_pickable_srgb_to_image_color (GIMP_PICKABLE (drawable),
+                                           &fg, &fg);
 
         color = gimp_gegl_color_new (&fg);
         gegl_buffer_set_color (base_buffer, NULL, color);
diff --git a/app/core/gimpdrawable-offset.c b/app/core/gimpdrawable-offset.c
index f5923ae..965fa38 100644
--- a/app/core/gimpdrawable-offset.c
+++ b/app/core/gimpdrawable-offset.c
@@ -35,6 +35,7 @@
 #include "gimpdrawable.h"
 #include "gimpdrawable-offset.h"
 #include "gimpimage.h"
+#include "gimppickable.h"
 
 #include "gimp-intl.h"
 
@@ -97,6 +98,8 @@ gimp_drawable_offset (GimpDrawable   *drawable,
           GeglColor *color;
 
           gimp_context_get_background (context, &bg);
+          gimp_pickable_srgb_to_image_color (GIMP_PICKABLE (drawable),
+                                             &bg, &bg);
 
           color = gimp_gegl_color_new (&bg);
           gegl_buffer_set_color (new_buffer, NULL, color);
diff --git a/app/core/gimpdrawable-transform.c b/app/core/gimpdrawable-transform.c
index c2d6ab5..9f97f2d 100644
--- a/app/core/gimpdrawable-transform.c
+++ b/app/core/gimpdrawable-transform.c
@@ -210,9 +210,15 @@ gimp_drawable_transform_buffer_flip (GimpDrawable        *drawable,
 
       /*  "Outside" a channel is transparency, not the bg color  */
       if (GIMP_IS_CHANNEL (drawable))
-        gimp_rgba_set (&bg, 0.0, 0.0, 0.0, 0.0);
+        {
+          gimp_rgba_set (&bg, 0.0, 0.0, 0.0, 0.0);
+        }
       else
-        gimp_context_get_background (context, &bg);
+        {
+          gimp_context_get_background (context, &bg);
+          gimp_pickable_srgb_to_image_color (GIMP_PICKABLE (drawable),
+                                             &bg, &bg);
+        }
 
       color = gimp_gegl_color_new (&bg);
       gegl_buffer_set_color (new_buffer, NULL, color);
@@ -418,9 +424,15 @@ gimp_drawable_transform_buffer_rotate (GimpDrawable      *drawable,
 
       /*  "Outside" a channel is transparency, not the bg color  */
       if (GIMP_IS_CHANNEL (drawable))
-        gimp_rgba_set (&bg, 0.0, 0.0, 0.0, 0.0);
+        {
+          gimp_rgba_set (&bg, 0.0, 0.0, 0.0, 0.0);
+        }
       else
-        gimp_context_get_background (context, &bg);
+        {
+          gimp_context_get_background (context, &bg);
+          gimp_pickable_srgb_to_image_color (GIMP_PICKABLE (drawable),
+                                             &bg, &bg);
+        }
 
       color = gimp_gegl_color_new (&bg);
       gegl_buffer_set_color (new_buffer, NULL, color);
diff --git a/app/core/gimpdrawable.c b/app/core/gimpdrawable.c
index 5f54d5b..967906e 100644
--- a/app/core/gimpdrawable.c
+++ b/app/core/gimpdrawable.c
@@ -586,9 +586,15 @@ gimp_drawable_resize (GimpItem    *item,
       GeglColor *col;
 
       if (! gimp_drawable_has_alpha (drawable) && ! GIMP_IS_CHANNEL (drawable))
-        gimp_context_get_background (context, &bg);
+        {
+          gimp_context_get_background (context, &bg);
+          gimp_pickable_srgb_to_image_color (GIMP_PICKABLE (drawable),
+                                             &bg, &bg);
+        }
       else
-        gimp_rgba_set (&bg, 0.0, 0.0, 0.0, 0.0);
+        {
+          gimp_rgba_set (&bg, 0.0, 0.0, 0.0, 0.0);
+        }
 
       col = gimp_gegl_color_new (&bg);
 
diff --git a/app/core/gimpimage-merge.c b/app/core/gimpimage-merge.c
index 4f040a1..4a50b02 100644
--- a/app/core/gimpimage-merge.c
+++ b/app/core/gimpimage-merge.c
@@ -47,6 +47,7 @@
 #include "gimplayermask.h"
 #include "gimpmarshal.h"
 #include "gimpparasitelist.h"
+#include "gimppickable.h"
 #include "gimpundostack.h"
 
 #include "gimp-intl.h"
@@ -538,6 +539,8 @@ gimp_image_merge_layers (GimpImage     *image,
 
       /*  get the background for compositing  */
       gimp_context_get_background (context, &bg);
+      gimp_pickable_srgb_to_image_color (GIMP_PICKABLE (layer),
+                                         &bg, &bg);
 
       color = gimp_gegl_color_new (&bg);
       gegl_buffer_set_color (gimp_drawable_get_buffer (GIMP_DRAWABLE (merge_layer)),
diff --git a/app/paint/gimperaser.c b/app/paint/gimperaser.c
index 175c598..79e3f58 100644
--- a/app/paint/gimperaser.c
+++ b/app/paint/gimperaser.c
@@ -29,6 +29,7 @@
 #include "core/gimpdrawable.h"
 #include "core/gimpdynamics.h"
 #include "core/gimpimage.h"
+#include "core/gimppickable.h"
 #include "core/gimpsymmetry.h"
 
 #include "gimperaser.h"
@@ -95,7 +96,8 @@ gimp_eraser_paint (GimpPaintCore    *paint_core,
           if (! gimp_drawable_has_alpha (drawable))
             {
               /* Erasing on a drawable without alpha is equivalent to
-               * drawing with background color. So let's save history. */
+               * drawing with background color. So let's save history.
+               */
               GimpContext *context = GIMP_CONTEXT (paint_options);
               GimpRGB      background;
 
@@ -153,6 +155,8 @@ gimp_eraser_motion (GimpPaintCore    *paint_core,
     return;
 
   gimp_context_get_background (context, &background);
+  gimp_pickable_srgb_to_image_color (GIMP_PICKABLE (drawable),
+                                     &background, &background);
   color = gimp_gegl_color_new (&background);
 
   if (options->anti_erase)
diff --git a/app/paint/gimpink.c b/app/paint/gimpink.c
index 34a0941..fe694a2 100644
--- a/app/paint/gimpink.c
+++ b/app/paint/gimpink.c
@@ -32,6 +32,7 @@
 #include "core/gimpdrawable.h"
 #include "core/gimpimage.h"
 #include "core/gimpimage-undo.h"
+#include "core/gimppickable.h"
 #include "core/gimpsymmetry.h"
 #include "core/gimptempbuf.h"
 
@@ -398,6 +399,8 @@ gimp_ink_motion (GimpPaintCore    *paint_core,
         continue;
 
       gimp_context_get_foreground (context, &foreground);
+      gimp_pickable_srgb_to_image_color (GIMP_PICKABLE (drawable),
+                                         &foreground, &foreground);
       color = gimp_gegl_color_new (&foreground);
 
       gegl_buffer_set_color (paint_buffer, NULL, color);
diff --git a/app/paint/gimpmybrushcore.c b/app/paint/gimpmybrushcore.c
index 79bf752..15d206a 100644
--- a/app/paint/gimpmybrushcore.c
+++ b/app/paint/gimpmybrushcore.c
@@ -37,6 +37,7 @@
 #include "core/gimpdrawable.h"
 #include "core/gimperror.h"
 #include "core/gimpmybrush.h"
+#include "core/gimppickable.h"
 #include "core/gimpsymmetry.h"
 
 #include "gimpmybrushcore.h"
@@ -315,6 +316,8 @@ gimp_mybrush_core_motion (GimpPaintCore    *paint_core,
       GimpHSV             hsv;
 
       gimp_context_get_foreground (context, &fg);
+      gimp_pickable_srgb_to_image_color (GIMP_PICKABLE (drawable),
+                                         &fg, &fg);
       gimp_rgb_to_hsv (&fg, &hsv);
 
       g_list_free_full (mybrush->private->brushes,
diff --git a/app/paint/gimppaintbrush.c b/app/paint/gimppaintbrush.c
index 01bc539..ae8cc35 100644
--- a/app/paint/gimppaintbrush.c
+++ b/app/paint/gimppaintbrush.c
@@ -36,6 +36,7 @@
 #include "core/gimpdynamics.h"
 #include "core/gimpgradient.h"
 #include "core/gimpimage.h"
+#include "core/gimppickable.h"
 #include "core/gimpsymmetry.h"
 #include "core/gimptempbuf.h"
 
@@ -240,6 +241,8 @@ _gimp_paintbrush_motion (GimpPaintCore    *paint_core,
           GeglColor *color;
 
           gimp_context_get_foreground (context, &foreground);
+          gimp_pickable_srgb_to_image_color (GIMP_PICKABLE (drawable),
+                                             &foreground, &foreground);
           color = gimp_gegl_color_new (&foreground);
 
           gegl_buffer_set_color (paint_buffer, NULL, color);


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