Bug 749902 - Add Hue-Chroma operation/tool and LCH color selector
This patch increases the LCH Chroma slider maximum value from 100 to 200 and also makes the Chroma slider properly display out of gamut Chroma selections for any given Hue/Lightness combinations. The current Chroma slider only runs to 100. But quite a few sRGB colors have LCH chroma values that are greater than 100. For example reddest red has a chroma of 107, and bluest blue has a chroma of 131. So it's inconvenient to have to deal with a Chroma slider limit of 100. Also, the current Chroma slider doesn't properly show out of gamut areas on the Chroma slider. So for example picking a given LCH Hue and then moving the Lightness slider doesn't allow to see which Lightness value allows for choosing the maximum in-gamut chroma for the chosen Hue.
This commit is contained in:
parent
93d2f49c16
commit
d13fa3900a
3 changed files with 11 additions and 11 deletions
|
|
@ -833,7 +833,7 @@ gimp_color_scale_render (GimpColorScale *scale)
|
|||
from_lch = TRUE;
|
||||
break;
|
||||
case GIMP_COLOR_SELECTOR_LCH_CHROMA:
|
||||
multiplier = 100;
|
||||
multiplier = 200;
|
||||
from_lch = TRUE;
|
||||
break;
|
||||
case GIMP_COLOR_SELECTOR_LCH_HUE:
|
||||
|
|
|
|||
|
|
@ -151,7 +151,7 @@ gimp_color_scales_init (GimpColorScales *scales)
|
|||
static const gdouble slider_min_vals[] =
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
static const gdouble slider_max_vals[] =
|
||||
{ 360, 100, 100, 100, 100, 100, 100, 100, 100, 360 };
|
||||
{ 360, 100, 100, 100, 100, 100, 100, 100, 200, 360 };
|
||||
static const gdouble slider_incs[] =
|
||||
{ 30, 10, 10, 16, 16, 16, 10, 10, 10, 30 };
|
||||
|
||||
|
|
|
|||
|
|
@ -691,16 +691,16 @@ gimp_color_select_update_values (GimpColorSelect *select)
|
|||
|
||||
case COLOR_SELECT_LCH_LIGHTNESS:
|
||||
lch.h = select->pos[0] * 360;
|
||||
lch.c = select->pos[1] * 100;
|
||||
lch.c = select->pos[1] * 200;
|
||||
lch.l = select->pos[2] * 100;
|
||||
break;
|
||||
case COLOR_SELECT_LCH_CHROMA:
|
||||
lch.h = select->pos[0] * 360;
|
||||
lch.l = select->pos[1] * 100;
|
||||
lch.c = select->pos[2] * 100;
|
||||
lch.c = select->pos[2] * 200;
|
||||
break;
|
||||
case COLOR_SELECT_LCH_HUE:
|
||||
lch.c = select->pos[0] * 100;
|
||||
lch.c = select->pos[0] * 200;
|
||||
lch.l = select->pos[1] * 100;
|
||||
lch.h = select->pos[2] * 360;
|
||||
break;
|
||||
|
|
@ -779,16 +779,16 @@ gimp_color_select_update_pos (GimpColorSelect *select)
|
|||
|
||||
case COLOR_SELECT_LCH_LIGHTNESS:
|
||||
select->pos[0] = CLAMP (lch.h / 360, 0.0, 1.0);
|
||||
select->pos[1] = CLAMP (lch.c / 100, 0.0, 1.0);
|
||||
select->pos[1] = CLAMP (lch.c / 200, 0.0, 1.0);
|
||||
select->pos[2] = CLAMP (lch.l / 100, 0.0, 1.0);
|
||||
break;
|
||||
case COLOR_SELECT_LCH_CHROMA:
|
||||
select->pos[0] = CLAMP (lch.h / 360, 0.0, 1.0);
|
||||
select->pos[1] = CLAMP (lch.l / 100, 0.0, 1.0);
|
||||
select->pos[2] = CLAMP (lch.c / 100, 0.0, 1.0);
|
||||
select->pos[2] = CLAMP (lch.c / 200, 0.0, 1.0);
|
||||
break;
|
||||
case COLOR_SELECT_LCH_HUE:
|
||||
select->pos[0] = CLAMP (lch.c / 100, 0.0, 1.0);
|
||||
select->pos[0] = CLAMP (lch.c / 200, 0.0, 1.0);
|
||||
select->pos[1] = CLAMP (lch.l / 100, 0.0, 1.0);
|
||||
select->pos[2] = CLAMP (lch.h / 360, 0.0, 1.0);
|
||||
break;
|
||||
|
|
@ -1432,7 +1432,7 @@ color_select_render_lch_chroma (ColorSelectFill *csf)
|
|||
guchar rgb[3];
|
||||
gint i;
|
||||
|
||||
lch.c = (csf->height - 1 - csf->y) * 100.0 / csf->height ;
|
||||
lch.c = (csf->height - 1 - csf->y) * 200.0 / csf->height ;
|
||||
babl_process (fish_lch_to_rgb_u8, &lch, &rgb, 1);
|
||||
|
||||
for (i = 0; i < csf->width; i++)
|
||||
|
|
@ -1821,7 +1821,7 @@ color_select_render_lch_chroma_lightness (ColorSelectFill *csf)
|
|||
{
|
||||
GimpRGB rgb;
|
||||
|
||||
lch.c = i * 100.0 / csf->width;
|
||||
lch.c = i * 200.0 / csf->width;
|
||||
|
||||
babl_process (fish_lch_to_rgb, &lch, &rgb, 1);
|
||||
|
||||
|
|
@ -1885,7 +1885,7 @@ color_select_render_lch_hue_chroma (ColorSelectFill *csf)
|
|||
gint i;
|
||||
|
||||
lch.l = csf->lch.l;
|
||||
lch.c = (csf->height - 1 - csf->y) * 100.0 / csf->height;
|
||||
lch.c = (csf->height - 1 - csf->y) * 200.0 / csf->height;
|
||||
|
||||
for (i = 0; i < csf->width; i++)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue