[gimp] Bug 768952: Select by color works correctly only in srgb



commit fa621d60bbc4a317114d135c85d2c57a5fdd89d5
Author: Massimo Valentini <mvalentini src gnome org>
Date:   Tue Jul 19 18:00:39 2016 +0200

    Bug 768952: Select by color works correctly only in srgb
    
    pass to pickable_contiguous_region_by_color the
    color in the same color space as the pickable.

 app/tools/gimpbycolorselecttool.c |   22 ++++++++++++++--------
 1 files changed, 14 insertions(+), 8 deletions(-)
---
diff --git a/app/tools/gimpbycolorselecttool.c b/app/tools/gimpbycolorselecttool.c
index 61a0df3..7b8c52a 100644
--- a/app/tools/gimpbycolorselecttool.c
+++ b/app/tools/gimpbycolorselecttool.c
@@ -101,7 +101,7 @@ gimp_by_color_select_tool_get_mask (GimpRegionSelectTool *region_select,
   GimpImage               *image       = gimp_display_get_image (display);
   GimpDrawable            *drawable    = gimp_image_get_active_drawable (image);
   GimpPickable            *pickable;
-  GimpRGB                  color;
+  GimpRGB                  srgb;
   gint                     x, y;
 
   x = region_select->x;
@@ -125,13 +125,19 @@ gimp_by_color_select_tool_get_mask (GimpRegionSelectTool *region_select,
 
   gimp_pickable_flush (pickable);
 
-  if (gimp_pickable_get_color_at (pickable, x, y, &color))
-    return gimp_pickable_contiguous_region_by_color (pickable,
-                                                     sel_options->antialias,
-                                                     options->threshold / 255.0,
-                                                     options->select_transparent,
-                                                     options->select_criterion,
-                                                     &color);
+  if (gimp_pickable_get_color_at (pickable, x, y, &srgb))
+    {
+      GimpRGB color;
+
+      gimp_pickable_srgb_to_image_color (pickable, &srgb, &color);
+
+      return gimp_pickable_contiguous_region_by_color (pickable,
+                                                       sel_options->antialias,
+                                                       options->threshold / 255.0,
+                                                       options->select_transparent,
+                                                       options->select_criterion,
+                                                       &color);
+    }
 
   return NULL;
 }


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