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.
This commit is contained in:
Elle Stone 2019-06-29 12:16:55 -04:00 committed by Michael Natterer
parent a11ada4ce2
commit bb660c5821
3 changed files with 37 additions and 1 deletions

View File

@ -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 }
};

View File

@ -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;

View File

@ -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:");