From fb471dabe02c51b7342728ac07e5e3db0b76c3ee Mon Sep 17 00:00:00 2001 From: Dave Neary Date: Thu, 16 Oct 2003 19:17:08 +0000 Subject: [PATCH] app/base/color-balance.c app/base/hue-saturation.c 2003-10-16 Dave Neary * app/base/color-balance.c * app/base/hue-saturation.c * app/composite/gimp-composite-generic.c * app/paint-funcs/paint-funcs-generic.h * app/tools/gimphuesaturationtool.c * libgimpcolor/gimpcolorspace.[ch]: Changed all occurrences of gimp_rgb_to_hls_int and gimp_hls_to_rgb_int to gimp_rgb_to_hsl_int and gimp_hsl_to_rgb_int respectively. This closes bug #124661. --- ChangeLog | 12 +++++++++ app/base/color-balance.c | 6 ++--- app/base/hue-saturation.c | 8 +++--- app/composite/gimp-composite-generic.c | 8 +++--- app/paint-funcs/paint-funcs-generic.h | 8 +++--- app/tools/gimphuesaturationtool.c | 8 +++--- libgimpcolor/gimpcolorspace.c | 36 +++++++++++++------------- libgimpcolor/gimpcolorspace.h | 12 ++++----- 8 files changed, 55 insertions(+), 43 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7a79e62834..193b9e8640 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2003-10-16 Dave Neary + + * app/base/color-balance.c + * app/base/hue-saturation.c + * app/composite/gimp-composite-generic.c + * app/paint-funcs/paint-funcs-generic.h + * app/tools/gimphuesaturationtool.c + * libgimpcolor/gimpcolorspace.[ch]: Changed all occurrences of + gimp_rgb_to_hls_int and gimp_hls_to_rgb_int to + gimp_rgb_to_hsl_int and gimp_hsl_to_rgb_int respectively. This + closes bug #124661. + 2003-10-16 Sven Neumann * libgimpbase/gimpbase.def: added gimp_any_to_utf8. diff --git a/app/base/color-balance.c b/app/base/color-balance.c index 10b63e2c51..1c214913f4 100644 --- a/app/base/color-balance.c +++ b/app/base/color-balance.c @@ -184,9 +184,9 @@ color_balance (PixelRegion *srcPR, if (cb->preserve_luminosity) { - gimp_rgb_to_hls_int (&r_n, &g_n, &b_n); - g_n = gimp_rgb_to_l_int (r, g, b); - gimp_hls_to_rgb_int (&r_n, &g_n, &b_n); + gimp_rgb_to_hsl_int (&r_n, &g_n, &b_n); + b_n = gimp_rgb_to_l_int (r, g, b); + gimp_hsl_to_rgb_int (&r_n, &g_n, &b_n); } d[RED_PIX] = r_n; diff --git a/app/base/hue-saturation.c b/app/base/hue-saturation.c index 2aad1d6646..6383d52d64 100644 --- a/app/base/hue-saturation.c +++ b/app/base/hue-saturation.c @@ -127,7 +127,7 @@ hue_saturation (PixelRegion *srcPR, g = s[GREEN_PIX]; b = s[BLUE_PIX]; - gimp_rgb_to_hls_int (&r, &g, &b); + gimp_rgb_to_hsl_int (&r, &g, &b); hue = (r + (128 / 6)) / 6; @@ -147,10 +147,10 @@ hue_saturation (PixelRegion *srcPR, hue = 0; r = hs->hue_transfer[hue][r]; - g = hs->lightness_transfer[hue][g]; - b = hs->saturation_transfer[hue][b]; + g = hs->saturation_transfer[hue][g]; + b = hs->lightness_transfer[hue][b]; - gimp_hls_to_rgb_int (&r, &g, &b); + gimp_hsl_to_rgb_int (&r, &g, &b); d[RED_PIX] = r; d[GREEN_PIX] = g; diff --git a/app/composite/gimp-composite-generic.c b/app/composite/gimp-composite-generic.c index 16448f4418..afc559bdc5 100644 --- a/app/composite/gimp-composite-generic.c +++ b/app/composite/gimp-composite-generic.c @@ -551,15 +551,15 @@ gimp_composite_color_only_any_any_any_generic (GimpCompositeContext * ctx) r2 = src2[0]; g2 = src2[1]; b2 = src2[2]; - gimp_rgb_to_hls_int(&r1, &g1, &b1); - gimp_rgb_to_hls_int(&r2, &g2, &b2); + gimp_rgb_to_hsl_int(&r1, &g1, &b1); + gimp_rgb_to_hsl_int(&r2, &g2, &b2); /* transfer hue and saturation to the source pixel */ r1 = r2; - b1 = b2; + g1 = g2; /* set the destination */ - gimp_hls_to_rgb_int(&r1, &g1, &b1); + gimp_hsl_to_rgb_int(&r1, &g1, &b1); dest[0] = r1; dest[1] = g1; diff --git a/app/paint-funcs/paint-funcs-generic.h b/app/paint-funcs/paint-funcs-generic.h index 476860c36d..64e133612c 100644 --- a/app/paint-funcs/paint-funcs-generic.h +++ b/app/paint-funcs/paint-funcs-generic.h @@ -599,15 +599,15 @@ color_only_pixels (const guchar *src1, { r1 = src1[0]; g1 = src1[1]; b1 = src1[2]; r2 = src2[0]; g2 = src2[1]; b2 = src2[2]; - gimp_rgb_to_hls_int (&r1, &g1, &b1); - gimp_rgb_to_hls_int (&r2, &g2, &b2); + gimp_rgb_to_hsl_int (&r1, &g1, &b1); + gimp_rgb_to_hsl_int (&r2, &g2, &b2); /* transfer hue and saturation to the source pixel */ r1 = r2; - b1 = b2; + g1 = g2; /* set the destination */ - gimp_hls_to_rgb_int (&r1, &g1, &b1); + gimp_hsl_to_rgb_int (&r1, &g1, &b1); dest[0] = r1; dest[1] = g1; dest[2] = b1; diff --git a/app/tools/gimphuesaturationtool.c b/app/tools/gimphuesaturationtool.c index 636a270707..f95c06cd22 100644 --- a/app/tools/gimphuesaturationtool.c +++ b/app/tools/gimphuesaturationtool.c @@ -458,13 +458,13 @@ hue_saturation_update (GimpHueSaturationTool *hs_tool, rgb[GREEN_PIX] = default_colors[i][GREEN_PIX]; rgb[BLUE_PIX] = default_colors[i][BLUE_PIX]; - gimp_rgb_to_hls_int (rgb, rgb + 1, rgb + 2); + gimp_rgb_to_hsl_int (rgb, rgb + 1, rgb + 2); rgb[RED_PIX] = hs_tool->hue_saturation->hue_transfer[i][rgb[RED_PIX]]; - rgb[GREEN_PIX] = hs_tool->hue_saturation->lightness_transfer[i][rgb[GREEN_PIX]]; - rgb[BLUE_PIX] = hs_tool->hue_saturation->saturation_transfer[i][rgb[BLUE_PIX]]; + rgb[GREEN_PIX] = hs_tool->hue_saturation->saturation_transfer[i][rgb[GREEN_PIX]]; + rgb[BLUE_PIX] = hs_tool->hue_saturation->lightness_transfer[i][rgb[BLUE_PIX]]; - gimp_hls_to_rgb_int (rgb, rgb + 1, rgb + 2); + gimp_hsl_to_rgb_int (rgb, rgb + 1, rgb + 2); gimp_rgb_set_uchar (&color, (guchar) rgb[0], (guchar) rgb[1], (guchar) rgb[2]); diff --git a/libgimpcolor/gimpcolorspace.c b/libgimpcolor/gimpcolorspace.c index ef3357ab2b..e2c9d538e5 100644 --- a/libgimpcolor/gimpcolorspace.c +++ b/libgimpcolor/gimpcolorspace.c @@ -670,7 +670,7 @@ gimp_hsv_to_rgb_int (gint *hue, } /** - * gimp_rgb_to_hls_int: + * gimp_rgb_to_hsl_int: * @red: Red channel, returns Hue channel * @green: Green channel, returns Lightness channel * @blue: Blue channel, returns Saturation channel @@ -683,12 +683,12 @@ gimp_hsv_to_rgb_int (gint *hue, * L [0, 255], S [0, 255]. **/ void -gimp_rgb_to_hls_int (gint *red, +gimp_rgb_to_hsl_int (gint *red, gint *green, gint *blue) { gint r, g, b; - gdouble h, l, s; + gdouble h, s, l; gint min, max; gint delta; @@ -739,8 +739,8 @@ gimp_rgb_to_hls_int (gint *red, } *red = ROUND (h); - *green = ROUND (l); - *blue = ROUND (s); + *green = ROUND (s); + *blue = ROUND (l); } /** @@ -749,7 +749,7 @@ gimp_rgb_to_hls_int (gint *red, * @green: Green channel * @blue: Blue channel * - * Calculates the luminance value of an RGB triplet with the formula + * Calculates the lightness value of an RGB triplet with the formula * L = (max(R, G, B) + min (R, G, B)) / 2 * * Return value: Luminance vaue corresponding to the input RGB value @@ -776,7 +776,7 @@ gimp_rgb_to_l_int (gint red, } static gint -gimp_hls_value (gdouble n1, +gimp_hsl_value (gdouble n1, gdouble n2, gdouble hue) { @@ -800,10 +800,10 @@ gimp_hls_value (gdouble n1, } /** - * gimp_hls_to_rgb_int: + * gimp_hsl_to_rgb_int: * @hue: Hue channel, returns Red channel - * @lightness: Lightness channel, returns Green channel - * @saturation: Saturation channel, returns Blue channel + * @saturation: Saturation channel, returns Green channel + * @lightness: Lightness channel, returns Blue channel * * The arguments are pointers to int, with the values pointed to in the * following ranges: H [0, 360], L [0, 255], S [0, 255]. @@ -812,15 +812,15 @@ gimp_hls_value (gdouble n1, * corresponding, with the returned values all in the range [0, 255]. **/ void -gimp_hls_to_rgb_int (gint *hue, - gint *lightness, - gint *saturation) +gimp_hsl_to_rgb_int (gint *hue, + gint *saturation, + gint *lightness) { - gdouble h, l, s; + gdouble h, s, l; h = *hue; - l = *lightness; s = *saturation; + l = *lightness; if (s == 0) { @@ -841,9 +841,9 @@ gimp_hls_to_rgb_int (gint *hue, m1 = (l / 127.5) - m2; /* chromatic case */ - *hue = gimp_hls_value (m1, m2, h + 85); - *lightness = gimp_hls_value (m1, m2, h); - *saturation = gimp_hls_value (m1, m2, h - 85); + *hue = gimp_hsl_value (m1, m2, h + 85); + *saturation = gimp_hsl_value (m1, m2, h); + *lightness = gimp_hsl_value (m1, m2, h - 85); } } diff --git a/libgimpcolor/gimpcolorspace.h b/libgimpcolor/gimpcolorspace.h index 500cff1022..6784327e44 100644 --- a/libgimpcolor/gimpcolorspace.h +++ b/libgimpcolor/gimpcolorspace.h @@ -73,15 +73,15 @@ void gimp_cmyk_to_rgb_int (gint *cyan /* returns red */, gint *yellow /* returns blue */, gint *black /* not changed */); -void gimp_rgb_to_hls_int (gint *red /* returns hue */, - gint *green /* returns lightness */, - gint *blue /* returns saturation */); +void gimp_rgb_to_hsl_int (gint *red /* returns hue */, + gint *green /* returns saturation */, + gint *blue /* returns lightness */); gint gimp_rgb_to_l_int (gint red, gint green, gint blue); -void gimp_hls_to_rgb_int (gint *hue /* returns red */, - gint *lightness /* returns green */, - gint *saturation /* returns blue */); +void gimp_hsl_to_rgb_int (gint *hue /* returns red */, + gint *saturation /* returns green */, + gint *lightness /* returns blue */); /* gdouble functions */