[gimp] Issue #3588 - Add Yu'v' (CIE 1976 UCS) to GIMP color picker
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] Issue #3588 - Add Yu'v' (CIE 1976 UCS) to GIMP color picker
- Date: Mon, 6 Jan 2020 18:23:43 +0000 (UTC)
commit bb660c5821f591b7fc17bff3f0c32f4ded1a7b3f
Author: Elle Stone <ellestone ninedegreesbelow com>
Date: Sat Jun 29 12:16:55 2019 -0400
Issue #3588 - Add Yu'v' (CIE 1976 UCS) to GIMP color picker
Which is a linear transform of xyY that is more perceptually
uniform, and so well-suited for eventually adding chromaticity
diagrams to GIMP color tools. ACES documentation uses this color
space instead of xyY for showing chromaticity diagrams. Moving
forward I expect other venues also will start using Yu'v' as
the advantages over xyY chromaticity diagrams are fairly obvious.
app/core/core-enums.c | 2 ++
app/core/core-enums.h | 3 ++-
app/widgets/gimpcolorframe.c | 33 +++++++++++++++++++++++++++++++++
3 files changed, 37 insertions(+), 1 deletion(-)
---
diff --git a/app/core/core-enums.c b/app/core/core-enums.c
index 3baf9ee169..97437fa587 100644
--- a/app/core/core-enums.c
+++ b/app/core/core-enums.c
@@ -173,6 +173,7 @@ gimp_color_pick_mode_get_type (void)
{ GIMP_COLOR_PICK_MODE_LAB, "GIMP_COLOR_PICK_MODE_LAB", "lab" },
{ GIMP_COLOR_PICK_MODE_CMYK, "GIMP_COLOR_PICK_MODE_CMYK", "cmyk" },
{ GIMP_COLOR_PICK_MODE_XYY, "GIMP_COLOR_PICK_MODE_XYY", "xyy" },
+ { GIMP_COLOR_PICK_MODE_YUV, "GIMP_COLOR_PICK_MODE_YUV", "yuv" },
{ 0, NULL, NULL }
};
@@ -186,6 +187,7 @@ gimp_color_pick_mode_get_type (void)
{ GIMP_COLOR_PICK_MODE_LAB, NC_("color-pick-mode", "CIE LAB"), NULL },
{ GIMP_COLOR_PICK_MODE_CMYK, NC_("color-pick-mode", "CMYK"), NULL },
{ GIMP_COLOR_PICK_MODE_XYY, NC_("color-pick-mode", "CIE xyY"), NULL },
+ { GIMP_COLOR_PICK_MODE_YUV, NC_("color-pick-mode", "CIE Yu'v'"), NULL },
{ 0, NULL, NULL }
};
diff --git a/app/core/core-enums.h b/app/core/core-enums.h
index 7b569c9ffd..3e2f0ca9f0 100644
--- a/app/core/core-enums.h
+++ b/app/core/core-enums.h
@@ -124,8 +124,9 @@ typedef enum /*< pdb-skip >*/
GIMP_COLOR_PICK_MODE_LAB, /*< desc="CIE LAB" >*/
GIMP_COLOR_PICK_MODE_CMYK, /*< desc="CMYK" >*/
GIMP_COLOR_PICK_MODE_XYY, /*< desc="CIE xyY" >*/
+ GIMP_COLOR_PICK_MODE_YUV, /*< desc="CIE Yu'v'" >*/
- GIMP_COLOR_PICK_MODE_LAST = GIMP_COLOR_PICK_MODE_XYY /*< skip >*/
+ GIMP_COLOR_PICK_MODE_LAST = GIMP_COLOR_PICK_MODE_YUV /*< skip >*/
} GimpColorPickMode;
diff --git a/app/widgets/gimpcolorframe.c b/app/widgets/gimpcolorframe.c
index dccc8b21d8..8b0114d2d7 100644
--- a/app/widgets/gimpcolorframe.c
+++ b/app/widgets/gimpcolorframe.c
@@ -158,6 +158,7 @@ gimp_color_frame_init (GimpColorFrame *frame)
GIMP_COLOR_PICK_MODE_LCH,
GIMP_COLOR_PICK_MODE_LAB,
GIMP_COLOR_PICK_MODE_XYY,
+ GIMP_COLOR_PICK_MODE_YUV,
GIMP_COLOR_PICK_MODE_CMYK);
frame->combo = gimp_enum_combo_box_new_with_model (GIMP_ENUM_STORE (store));
g_object_unref (store);
@@ -969,6 +970,38 @@ gimp_color_frame_update (GimpColorFrame *frame)
}
break;
+ case GIMP_COLOR_PICK_MODE_YUV:
+ /* TRANSLATORS: Y from Yu'v' color space */
+ names[0] = C_("Yu'v' color space", "Y:");
+ /* TRANSLATORS: u' from Yu'v' color space */
+ names[1] = C_("Yu'v' color space", "u':");
+ /* TRANSLATORS: v' from Yu'v' color space */
+ names[2] = C_("Yu'v' color space", "v':");
+
+ if (has_alpha)
+ /* TRANSLATORS: A for Alpha (color transparency) */
+ names[3] = C_("Alpha channel", "A:");
+
+ if (frame->sample_valid)
+ {
+ static const Babl *fish = NULL;
+ gfloat Yuv[4];
+
+ if (G_UNLIKELY (! fish))
+ fish = babl_fish (babl_format ("R'G'B'A double"),
+ babl_format ("CIE Yuv alpha float"));
+
+ babl_process (fish, &frame->color, Yuv, 1);
+
+ values = g_new0 (gchar *, 5);
+
+ values[0] = g_strdup_printf ("%1.6f ", Yuv[0]);
+ values[1] = g_strdup_printf ("%1.6f ", Yuv[1]);
+ values[2] = g_strdup_printf ("%1.6f ", Yuv[2]);
+ values[3] = g_strdup_printf ("%.01f %%", Yuv[3] * 100.0);
+ }
+ break;
+
case GIMP_COLOR_PICK_MODE_CMYK:
/* TRANSLATORS: C for Cyan (CMYK) */
names[0] = C_("CMYK", "C:");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]