[gimp] Bug 749902 - Add Hue-Chroma operation/tool and LCH color selector
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] Bug 749902 - Add Hue-Chroma operation/tool and LCH color selector
- Date: Sun, 16 Jul 2017 13:21:31 +0000 (UTC)
commit d13fa3900a40cbbc9da321205b499c80ee84cfca
Author: Elle Stone <ellestone ninedegreesbelow com>
Date: Thu Jun 1 04:38:19 2017 -0400
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.
libgimpwidgets/gimpcolorscale.c | 2 +-
libgimpwidgets/gimpcolorscales.c | 2 +-
libgimpwidgets/gimpcolorselect.c | 18 +++++++++---------
3 files changed, 11 insertions(+), 11 deletions(-)
---
diff --git a/libgimpwidgets/gimpcolorscale.c b/libgimpwidgets/gimpcolorscale.c
index e9ad36a..52ca7d5 100644
--- a/libgimpwidgets/gimpcolorscale.c
+++ b/libgimpwidgets/gimpcolorscale.c
@@ -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:
diff --git a/libgimpwidgets/gimpcolorscales.c b/libgimpwidgets/gimpcolorscales.c
index 5e16e3e..77b523c 100644
--- a/libgimpwidgets/gimpcolorscales.c
+++ b/libgimpwidgets/gimpcolorscales.c
@@ -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 };
diff --git a/libgimpwidgets/gimpcolorselect.c b/libgimpwidgets/gimpcolorselect.c
index 99e5d5f..5eb439b 100644
--- a/libgimpwidgets/gimpcolorselect.c
+++ b/libgimpwidgets/gimpcolorselect.c
@@ -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++)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]