[gimp/pippin/linear-is-the-new-black: 3/8] app: make curves tool pick in linear



commit 3829b909e435a340b8f09bb1f53d3290b8fd966f
Author: Øyvind Kolås <pippin gimp org>
Date:   Wed Dec 14 21:39:40 2016 +0100

    app: make curves tool pick in linear

 app/tools/gimpcurvestool.c |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)
---
diff --git a/app/tools/gimpcurvestool.c b/app/tools/gimpcurvestool.c
index 8045936..da756e6 100644
--- a/app/tools/gimpcurvestool.c
+++ b/app/tools/gimpcurvestool.c
@@ -381,20 +381,23 @@ gimp_curves_tool_color_picked (GimpColorTool      *color_tool,
   GimpFilterTool   *filter_tool = GIMP_FILTER_TOOL (color_tool);
   GimpCurvesConfig *config      = GIMP_CURVES_CONFIG (filter_tool->config);
   GimpDrawable     *drawable;
+  float rgba[4];
+
+  gimp_rgba_get_pixel (color, babl_format ("RGBA float"), rgba);
 
   drawable = GIMP_FILTER_TOOL (tool)->drawable;
 
-  tool->picked_color[GIMP_HISTOGRAM_RED]   = color->r;
-  tool->picked_color[GIMP_HISTOGRAM_GREEN] = color->g;
-  tool->picked_color[GIMP_HISTOGRAM_BLUE]  = color->b;
+  tool->picked_color[GIMP_HISTOGRAM_RED]   = rgba[0];
+  tool->picked_color[GIMP_HISTOGRAM_GREEN] = rgba[1];
+  tool->picked_color[GIMP_HISTOGRAM_BLUE]  = rgba[2];
 
   if (gimp_drawable_has_alpha (drawable))
-    tool->picked_color[GIMP_HISTOGRAM_ALPHA] = color->a;
+    tool->picked_color[GIMP_HISTOGRAM_ALPHA] = rgba[3];
   else
     tool->picked_color[GIMP_HISTOGRAM_ALPHA] = -1;
 
-  tool->picked_color[GIMP_HISTOGRAM_VALUE] = MAX (MAX (color->r, color->g),
-                                                  color->b);
+  tool->picked_color[GIMP_HISTOGRAM_VALUE] = MAX (MAX (rgba[0], rgba[1]),
+                                                  rgba[2]);
 
   gimp_curve_view_set_xpos (GIMP_CURVE_VIEW (tool->graph),
                             tool->picked_color[config->channel]);


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