app/base/color-balance.c app/base/hue-saturation.c

2003-10-16  Dave Neary  <bolsh@gimp.org>

        * 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.
This commit is contained in:
Dave Neary 2003-10-16 19:17:08 +00:00 committed by David Neary
parent 264f5b0acf
commit fb471dabe0
8 changed files with 55 additions and 43 deletions

View File

@ -1,3 +1,15 @@
2003-10-16 Dave Neary <bolsh@gimp.org>
* 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 <sven@gimp.org>
* libgimpbase/gimpbase.def: added gimp_any_to_utf8.

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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 */