[gimp] Bug 773461 - Color picker lacks L*a*b* mode



commit 127e7daeb2654569d44834822a2af8769449c103
Author: Elle Stone <ellestone ninedegreesbelow com>
Date:   Wed May 17 10:27:53 2017 -0400

    Bug 773461 - Color picker lacks L*a*b* mode
    
    Add LAB readout to Pointer and Sample Points dialogs

 app/widgets/gimpcolorframe.c |   28 ++++++++++++++++++++++++++++
 app/widgets/widgets-enums.c  |    2 ++
 app/widgets/widgets-enums.h  |    1 +
 3 files changed, 31 insertions(+), 0 deletions(-)
---
diff --git a/app/widgets/gimpcolorframe.c b/app/widgets/gimpcolorframe.c
index deccf27..05cc56c 100644
--- a/app/widgets/gimpcolorframe.c
+++ b/app/widgets/gimpcolorframe.c
@@ -816,6 +816,34 @@ gimp_color_frame_update (GimpColorFrame *frame)
         }
       break;
 
+    case GIMP_COLOR_FRAME_MODE_LAB:
+      names[0] = _("Lab_L*:");
+      names[1] = _("Lab_a*:");
+      names[2] = _("Lab_b*:");
+
+      if (has_alpha)
+        names[3] = _("Alpha:");
+
+      if (frame->sample_valid)
+        {
+          static const Babl *fish = NULL;
+          gfloat             lab[4];
+
+          if (G_UNLIKELY (! fish))
+            fish = babl_fish (babl_format ("R'G'B'A double"),
+                              babl_format ("CIE Lab alpha float"));
+
+          babl_process (fish, &frame->color, lab, 1);
+
+          values = g_new0 (gchar *, 5);
+
+          values[0] = g_strdup_printf ("%.01f  ",        lab[0]);
+          values[1] = g_strdup_printf ("%.01f  ",        lab[1]);
+          values[2] = g_strdup_printf ("%.01f  ",        lab[2]);
+          values[3] = g_strdup_printf ("%.01f %%",       lab[3] * 100.0);
+        }
+      break;
+
     case GIMP_COLOR_FRAME_MODE_CMYK:
       names[0] = _("Cyan:");
       names[1] = _("Magenta:");
diff --git a/app/widgets/widgets-enums.c b/app/widgets/widgets-enums.c
index 37e1041..87cb281 100644
--- a/app/widgets/widgets-enums.c
+++ b/app/widgets/widgets-enums.c
@@ -107,6 +107,7 @@ gimp_color_frame_mode_get_type (void)
     { GIMP_COLOR_FRAME_MODE_RGB_U8, "GIMP_COLOR_FRAME_MODE_RGB_U8", "rgb-u8" },
     { GIMP_COLOR_FRAME_MODE_HSV, "GIMP_COLOR_FRAME_MODE_HSV", "hsv" },
     { GIMP_COLOR_FRAME_MODE_LCH, "GIMP_COLOR_FRAME_MODE_LCH", "lch" },
+    { GIMP_COLOR_FRAME_MODE_LAB, "GIMP_COLOR_FRAME_MODE_LAB", "lab" },
     { GIMP_COLOR_FRAME_MODE_CMYK, "GIMP_COLOR_FRAME_MODE_CMYK", "cmyk" },
     { 0, NULL, NULL }
   };
@@ -118,6 +119,7 @@ gimp_color_frame_mode_get_type (void)
     { GIMP_COLOR_FRAME_MODE_RGB_U8, NC_("color-frame-mode", "RGB (0..255)"), NULL },
     { GIMP_COLOR_FRAME_MODE_HSV, NC_("color-frame-mode", "HSV"), NULL },
     { GIMP_COLOR_FRAME_MODE_LCH, NC_("color-frame-mode", "CIE LCH"), NULL },
+    { GIMP_COLOR_FRAME_MODE_LAB, NC_("color-frame-mode", "CIE LAB"), NULL },
     { GIMP_COLOR_FRAME_MODE_CMYK, NC_("color-frame-mode", "CMYK"), NULL },
     { 0, NULL, NULL }
   };
diff --git a/app/widgets/widgets-enums.h b/app/widgets/widgets-enums.h
index 30fcc4f..270a79c 100644
--- a/app/widgets/widgets-enums.h
+++ b/app/widgets/widgets-enums.h
@@ -68,6 +68,7 @@ typedef enum
   GIMP_COLOR_FRAME_MODE_RGB_U8,      /*< desc="RGB (0..255)" >*/
   GIMP_COLOR_FRAME_MODE_HSV,         /*< desc="HSV"          >*/
   GIMP_COLOR_FRAME_MODE_LCH,         /*< desc="CIE LCH"      >*/
+  GIMP_COLOR_FRAME_MODE_LAB,         /*< desc="CIE LAB"      >*/
   GIMP_COLOR_FRAME_MODE_CMYK         /*< desc="CMYK"         >*/
 } GimpColorFrameMode;
 


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