[gimp/wip/pippin: 44/48] app: make levels config request linear colors



commit 6f2b21907ccd234974c56b6dd99bbf37c97de943
Author: Øyvind Kolås <pippin gimp org>
Date:   Wed Dec 14 21:31:25 2016 +0100

    app: make levels config request linear colors

 app/operations/gimplevelsconfig.c |   18 +++++++++++-------
 1 files changed, 11 insertions(+), 7 deletions(-)
---
diff --git a/app/operations/gimplevelsconfig.c b/app/operations/gimplevelsconfig.c
index b6c9339..9237741 100644
--- a/app/operations/gimplevelsconfig.c
+++ b/app/operations/gimplevelsconfig.c
@@ -516,27 +516,31 @@ static gdouble
 gimp_levels_config_input_from_color (GimpHistogramChannel  channel,
                                      const GimpRGB        *color)
 {
+  float rgba[4];
+  gimp_rgba_get_pixel (color, babl_format ("RGBA float"), rgba);
+
   switch (channel)
     {
     case GIMP_HISTOGRAM_VALUE:
-      return MAX (MAX (color->r, color->g), color->b);
+      return MAX (MAX (rgba[0], rgba[1]), rgba[2]);
 
     case GIMP_HISTOGRAM_RED:
-      return color->r;
+      return rgba[0];
 
     case GIMP_HISTOGRAM_GREEN:
-      return color->g;
+      return rgba[1];
 
     case GIMP_HISTOGRAM_BLUE:
-      return color->b;
+      return rgba[2];
 
     case GIMP_HISTOGRAM_ALPHA:
-      return color->a;
+      return rgba[3];
 
     case GIMP_HISTOGRAM_RGB:
-      return MIN (MIN (color->r, color->g), color->b);
+      return MIN (MIN (rgba[0], rgba[1]), rgba[2]);
 
-    case GIMP_HISTOGRAM_LUMINANCE:
+    case GIMP_HISTOGRAM_LUMINANCE: // XXX: does this macro expect linear or
+                                   //  gamma TRC?
       return GIMP_RGB_LUMINANCE (color->r, color->g, color->b);
     }
 


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