libgimpcolor: remove most deprecated cruft, rest to follow

This commit is contained in:
Michael Natterer 2018-04-28 17:50:40 +02:00
parent ecceb9967c
commit 1ed586f0f1
7 changed files with 0 additions and 545 deletions

View File

@ -235,79 +235,3 @@ gimp_bilinear_rgba (gdouble x,
return v;
}
/**
* gimp_bilinear_pixels_8:
* @dest: Pixel, where interpolation result is to be stored.
* @x: x-coordinate (0.0 to 1.0).
* @y: y-coordinate (0.0 to 1.0).
* @bpp: Bytes per pixel. @dest and each @values item is an array of
* @bpp bytes.
* @has_alpha: %TRUE if the last channel is an alpha channel.
* @values: Array of four pointers to pixels.
*
* Computes bilinear interpolation of four pixels.
*
* When @has_alpha is %FALSE, it's identical to gimp_bilinear_8() on
* each channel separately. When @has_alpha is %TRUE, it handles
* alpha channel correctly.
*
* The pixels in @values correspond to corner x, y coordinates in the
* following order: [0,0], [1,0], [0,1], [1,1].
**/
void
gimp_bilinear_pixels_8 (guchar *dest,
gdouble x,
gdouble y,
guint bpp,
gboolean has_alpha,
guchar **values)
{
guint i;
g_return_if_fail (dest != NULL);
g_return_if_fail (values != NULL);
x = fmod (x, 1.0);
y = fmod (y, 1.0);
if (x < 0.0)
x += 1.0;
if (y < 0.0)
y += 1.0;
if (has_alpha)
{
guint ai = bpp - 1;
gdouble alpha0 = values[0][ai];
gdouble alpha1 = values[1][ai];
gdouble alpha2 = values[2][ai];
gdouble alpha3 = values[3][ai];
gdouble alpha = ((1.0 - y) * ((1.0 - x) * alpha0 + x * alpha1)
+ y * ((1.0 - x) * alpha2 + x * alpha3));
dest[ai] = (guchar) alpha;
if (dest[ai])
{
for (i = 0; i < ai; i++)
{
gdouble m0 = ((1.0 - x) * values[0][i] * alpha0
+ x * values[1][i] * alpha1);
gdouble m1 = ((1.0 - x) * values[2][i] * alpha2
+ x * values[3][i] * alpha3);
dest[i] = (guchar) (((1.0 - y) * m0 + y * m1) / alpha);
}
}
}
else
{
for (i = 0; i < bpp; i++)
{
gdouble m0 = (1.0 - x) * values[0][i] + x * values[1][i];
gdouble m1 = (1.0 - x) * values[2][i] + x * values[3][i];
dest[i] = (guchar) ((1.0 - y) * m0 + y * m1);
}
}
}

View File

@ -50,13 +50,6 @@ GimpRGB gimp_bilinear_rgba (gdouble x,
gdouble y,
GimpRGB *values);
GIMP_DEPRECATED
void gimp_bilinear_pixels_8 (guchar *dest,
gdouble x,
gdouble y,
guint bpp,
gboolean has_alpha,
guchar **values);
G_END_DECLS

View File

@ -4,7 +4,6 @@ EXPORTS
gimp_bilinear_16
gimp_bilinear_32
gimp_bilinear_8
gimp_bilinear_pixels_8
gimp_bilinear_rgb
gimp_bilinear_rgba
gimp_cairo_checkerboard_create
@ -17,7 +16,6 @@ EXPORTS
gimp_cmyk_set
gimp_cmyk_set_uchar
gimp_cmyk_to_rgb
gimp_cmyk_to_rgb_int
gimp_cmyka_get_uchar
gimp_cmyka_set
gimp_cmyka_set_uchar
@ -68,10 +66,8 @@ EXPORTS
gimp_hsv_get_type
gimp_hsv_set
gimp_hsv_to_rgb
gimp_hsv_to_rgb4
gimp_hsv_to_rgb_int
gimp_hsva_set
gimp_hwb_to_rgb
gimp_param_rgb_get_type
gimp_param_spec_rgb
gimp_param_spec_rgb_has_alpha
@ -86,8 +82,6 @@ EXPORTS
gimp_rgb_get_pixel
gimp_rgb_get_type
gimp_rgb_get_uchar
gimp_rgb_intensity
gimp_rgb_intensity_uchar
gimp_rgb_list_names
gimp_rgb_luminance
gimp_rgb_luminance_uchar
@ -103,13 +97,10 @@ EXPORTS
gimp_rgb_set_uchar
gimp_rgb_subtract
gimp_rgb_to_cmyk
gimp_rgb_to_cmyk_int
gimp_rgb_to_hsl
gimp_rgb_to_hsl_int
gimp_rgb_to_hsv
gimp_rgb_to_hsv4
gimp_rgb_to_hsv_int
gimp_rgb_to_hwb
gimp_rgb_to_l_int
gimp_rgba_add
gimp_rgba_distance

View File

@ -412,118 +412,6 @@ gimp_cmyk_to_rgb (const GimpCMYK *cmyk,
* be defined as 0 in situations where only unsigned numbers are desired.
****************************************************************************/
/**
* gimp_rgb_to_hwb:
* @rgb: A color value in the RGB colorspace
* @hue: The hue value of the above color, in the range 0 to 6
* @whiteness: The whiteness value of the above color, in the range 0 to 1
* @blackness: The blackness value of the above color, in the range 0 to 1
*
* Theoretically, hue 0 (pure red) is identical to hue 6 in these transforms.
* Pure red always maps to 6 in this implementation. Therefore UNDEFINED can
* be defined as 0 in situations where only unsigned numbers are desired.
*
* RGB are each on [0, 1]. Whiteness and Blackness are returned in the
* range [0, 1] and H is returned in the range [0, 6]. If W == 1 - B, H is
* undefined.
**/
void
gimp_rgb_to_hwb (const GimpRGB *rgb,
gdouble *hue,
gdouble *whiteness,
gdouble *blackness)
{
/* RGB are each on [0, 1]. W and B are returned on [0, 1] and H is */
/* returned on [0, 6]. Exception: H is returned UNDEFINED if W == 1 - B. */
/* ====================================================================== */
gdouble R = rgb->r, G = rgb->g, B = rgb->b, w, v, b, f;
gint i;
w = gimp_rgb_min (rgb);
v = gimp_rgb_max (rgb);
b = 1.0 - v;
if (v == w)
{
*hue = GIMP_HSV_UNDEFINED;
*whiteness = w;
*blackness = b;
}
else
{
f = (R == w) ? G - B : ((G == w) ? B - R : R - G);
i = (R == w) ? 3.0 : ((G == w) ? 5.0 : 1.0);
*hue = (360.0 / 6.0) * (i - f / (v - w));
*whiteness = w;
*blackness = b;
}
}
/**
* gimp_hwb_to_rgb:
* @hue: A hue value, in the range 0 to 6
* @whiteness: A whiteness value, in the range 0 to 1
* @blackness: A blackness value, in the range 0 to 1
* @rgb: The above color converted to the RGB colorspace
*
* H is defined in the range [0, 6] or UNDEFINED, B and W are both in the
* range [0, 1]. The returned RGB values are all in the range [0, 1].
**/
void
gimp_hwb_to_rgb (gdouble hue,
gdouble whiteness,
gdouble blackness,
GimpRGB *rgb)
{
/* H is given on [0, 6] or UNDEFINED. whiteness and
* blackness are given on [0, 1].
* RGB are each returned on [0, 1].
*/
gdouble h = hue, w = whiteness, b = blackness, v, n, f;
gint i;
h = 6.0 * h/ 360.0;
v = 1.0 - b;
if (h == GIMP_HSV_UNDEFINED)
{
rgb->r = v;
rgb->g = v;
rgb->b = v;
}
else
{
i = floor (h);
f = h - i;
if (i & 1)
f = 1.0 - f; /* if i is odd */
n = w + f * (v - w); /* linear interpolation between w and v */
switch (i)
{
case 6:
case 0: GIMP_RETURN_RGB (v, n, w);
break;
case 1: GIMP_RETURN_RGB (n, v, w);
break;
case 2: GIMP_RETURN_RGB (w, v, n);
break;
case 3: GIMP_RETURN_RGB (w, n, v);
break;
case 4: GIMP_RETURN_RGB (n, w, v);
break;
case 5: GIMP_RETURN_RGB (v, w, n);
break;
}
}
}
/* gint functions */
@ -865,239 +753,3 @@ gimp_hsl_to_rgb_int (gint *hue,
*lightness = gimp_hsl_value_int (m1, m2, h - 85);
}
}
/**
* gimp_rgb_to_cmyk_int:
* @red: the red channel; returns the cyan value (0-255)
* @green: the green channel; returns the magenta value (0-255)
* @blue: the blue channel; returns the yellow value (0-255)
* @pullout: the percentage of black to pull out (0-100); returns
* the black value (0-255)
*
* Does a naive conversion from RGB to CMYK colorspace. A simple
* formula that doesn't take any color-profiles into account is used.
* The amount of black pullout how can be controlled via the @pullout
* parameter. A @pullout value of 0 makes this a conversion to CMY.
* A value of 100 causes the maximum amount of black to be pulled out.
**/
void
gimp_rgb_to_cmyk_int (gint *red,
gint *green,
gint *blue,
gint *pullout)
{
gint c, m, y;
c = 255 - *red;
m = 255 - *green;
y = 255 - *blue;
if (*pullout == 0)
{
*red = c;
*green = m;
*blue = y;
}
else
{
gint k = 255;
if (c < k) k = c;
if (m < k) k = m;
if (y < k) k = y;
k = (k * CLAMP (*pullout, 0, 100)) / 100;
*red = ((c - k) << 8) / (256 - k);
*green = ((m - k) << 8) / (256 - k);
*blue = ((y - k) << 8) / (256 - k);
*pullout = k;
}
}
/**
* gimp_cmyk_to_rgb_int:
* @cyan: the cyan channel; returns the red value (0-255)
* @magenta: the magenta channel; returns the green value (0-255)
* @yellow: the yellow channel; returns the blue value (0-255)
* @black: the black channel (0-255); doesn't change
*
* Does a naive conversion from CMYK to RGB colorspace. A simple
* formula that doesn't take any color-profiles into account is used.
**/
void
gimp_cmyk_to_rgb_int (gint *cyan,
gint *magenta,
gint *yellow,
gint *black)
{
gint c, m, y, k;
c = *cyan;
m = *magenta;
y = *yellow;
k = *black;
if (k)
{
c = ((c * (256 - k)) >> 8) + k;
m = ((m * (256 - k)) >> 8) + k;
y = ((y * (256 - k)) >> 8) + k;
}
*cyan = 255 - c;
*magenta = 255 - m;
*yellow = 255 - y;
}
/**
* gimp_rgb_to_hsv4:
* @rgb: RGB triplet, rgb[0] is red channel, rgb[1] is green,
* rgb[2] is blue (0..255)
* @hue: Pointer to hue channel (0..1)
* @saturation: Pointer to saturation channel (0..1)
* @value: Pointer to value channel (0..1)
**/
void
gimp_rgb_to_hsv4 (const guchar *rgb,
gdouble *hue,
gdouble *saturation,
gdouble *value)
{
gdouble red, green, blue;
gdouble h, s, v;
gdouble min, max;
gdouble delta;
red = rgb[0] / 255.0;
green = rgb[1] / 255.0;
blue = rgb[2] / 255.0;
if (red > green)
{
max = MAX (red, blue);
min = MIN (green, blue);
}
else
{
max = MAX (green, blue);
min = MIN (red, blue);
}
v = max;
if (max != 0.0)
s = (max - min) / max;
else
s = 0.0;
if (s == 0.0)
h = 0.0;
else
{
delta = max - min;
if (delta == 0.0)
delta = 1.0;
if (red == max)
h = (green - blue) / delta;
else if (green == max)
h = 2 + (blue - red) / delta;
else
h = 4 + (red - green) / delta;
h /= 6.0;
if (h < 0.0)
h += 1.0;
else if (h > 1.0)
h -= 1.0;
}
*hue = h;
*saturation = s;
*value = v;
}
/**
* gimp_hsv_to_rgb4:
* @rgb: RGB triplet, rgb[0] is red channel, rgb[1] is green,
* rgb[2] is blue (0..255)
* @hue: Hue channel (0..1)
* @saturation: Saturation channel (0..1)
* @value: Value channel (0..1)
**/
void
gimp_hsv_to_rgb4 (guchar *rgb,
gdouble hue,
gdouble saturation,
gdouble value)
{
gdouble h, s, v;
gdouble f, p, q, t;
if (saturation == 0.0)
{
hue = value;
saturation = value;
/*value = value;*/
}
else
{
h = hue * 6.0;
s = saturation;
v = value;
if (h == 6.0)
h = 0.0;
f = h - (gint) h;
p = v * (1.0 - s);
q = v * (1.0 - s * f);
t = v * (1.0 - s * (1.0 - f));
switch ((int) h)
{
case 0:
hue = v;
saturation = t;
value = p;
break;
case 1:
hue = q;
saturation = v;
value = p;
break;
case 2:
hue = p;
saturation = v;
value = t;
break;
case 3:
hue = p;
saturation = q;
value = v;
break;
case 4:
hue = t;
saturation = p;
value = v;
break;
case 5:
hue = v;
saturation = p;
value = q;
break;
}
}
rgb[0] = ROUND (hue * 255.0);
rgb[1] = ROUND (saturation * 255.0);
rgb[2] = ROUND (value * 255.0);
}

View File

@ -48,18 +48,6 @@ void gimp_hsl_to_rgb (const GimpHSL *hsl,
void gimp_cmyk_to_rgb (const GimpCMYK *cmyk,
GimpRGB *rgb);
GIMP_DEPRECATED
void gimp_rgb_to_hwb (const GimpRGB *rgb,
gdouble *hue,
gdouble *whiteness,
gdouble *blackness);
GIMP_DEPRECATED
void gimp_hwb_to_rgb (gdouble hue,
gdouble whiteness,
gdouble blackness,
GimpRGB *rgb);
/* gint functions */
@ -73,18 +61,6 @@ void gimp_hsv_to_rgb_int (gint *hue /* returns red */,
gint *saturation /* returns green */,
gint *value /* returns blue */);
GIMP_DEPRECATED_FOR (gimp_rgb_to_cmyk)
void gimp_rgb_to_cmyk_int (gint *red /* returns cyan */,
gint *green /* returns magenta */,
gint *blue /* returns yellow */,
gint *pullout /* returns black */);
GIMP_DEPRECATED_FOR (gimp_cmyk_to_rgb)
void gimp_cmyk_to_rgb_int (gint *cyan /* returns red */,
gint *magenta /* returns green */,
gint *yellow /* returns blue */,
gint *black /* not changed */);
GIMP_DEPRECATED_FOR (gimp_rgb_to_hsl)
void gimp_rgb_to_hsl_int (gint *red /* returns hue */,
gint *green /* returns saturation */,
@ -101,21 +77,6 @@ void gimp_hsl_to_rgb_int (gint *hue /* returns red */,
gint *lightness /* returns blue */);
/* gdouble functions */
GIMP_DEPRECATED_FOR (gimp_rgb_to_hsv)
void gimp_rgb_to_hsv4 (const guchar *rgb,
gdouble *hue,
gdouble *saturation,
gdouble *value);
GIMP_DEPRECATED_FOR (gimp_hsv_to_rgb)
void gimp_hsv_to_rgb4 (guchar *rgb,
gdouble hue,
gdouble saturation,
gdouble value);
G_END_DECLS
#endif /* __GIMP_COLOR_SPACE_H__ */

View File

@ -21,12 +21,9 @@
#include <babl/babl.h>
#include <glib-object.h>
#define GIMP_DISABLE_DEPRECATION_WARNINGS /* for GIMP_RGB_INTENSITY() */
#include "libgimpmath/gimpmath.h"
#include "gimpcolortypes.h"
#undef GIMP_DISABLE_DEPRECATED /* for GIMP_RGB_INTENSITY() */
#include "gimprgb.h"
@ -354,42 +351,6 @@ gimp_rgb_luminance_uchar (const GimpRGB *rgb)
return ROUND (gimp_rgb_luminance (rgb) * 255.0);
}
/**
* gimp_rgb_intensity:
* @rgb: a #GimpRGB struct
*
* This function is deprecated! Use gimp_rgb_luminance() instead.
*
* Return value: the intensity in the range from 0.0 to 1.0.
**/
gdouble
gimp_rgb_intensity (const GimpRGB *rgb)
{
gdouble intensity;
g_return_val_if_fail (rgb != NULL, 0.0);
intensity = GIMP_RGB_INTENSITY (rgb->r, rgb->g, rgb->b);
return CLAMP (intensity, 0.0, 1.0);
}
/**
* gimp_rgb_intensity_uchar:
* @rgb: a #GimpRGB struct
*
* This function is deprecated! Use gimp_rgb_luminance_uchar() instead.
*
* Return value: the intensity in the range from 0 to 255.
**/
guchar
gimp_rgb_intensity_uchar (const GimpRGB *rgb)
{
g_return_val_if_fail (rgb != NULL, 0);
return ROUND (gimp_rgb_intensity (rgb) * 255.0);
}
void
gimp_rgb_composite (GimpRGB *color1,
const GimpRGB *color2,

View File

@ -125,11 +125,6 @@ void gimp_rgb_gamma (GimpRGB *rgb,
gdouble gimp_rgb_luminance (const GimpRGB *rgb);
guchar gimp_rgb_luminance_uchar (const GimpRGB *rgb);
GIMP_DEPRECATED_FOR(gimp_rgb_luminance)
gdouble gimp_rgb_intensity (const GimpRGB *rgb);
GIMP_DEPRECATED_FOR(gimp_rgb_luminance_uchar)
guchar gimp_rgb_intensity_uchar (const GimpRGB *rgb);
void gimp_rgb_composite (GimpRGB *color1,
const GimpRGB *color2,
GimpRGBCompositeMode mode);
@ -198,28 +193,6 @@ gdouble gimp_rgba_distance (const GimpRGB *rgba1,
(b) * GIMP_RGB_LUMINANCE_BLUE)
#ifndef GIMP_DISABLE_DEPRECATED
/*
* The coefficients below properly computed luminance for monitors
* having phosphors that were contemporary at the introduction of NTSC
* television in 1953. They are still appropriate for computing video
* luma. However, these coefficients do not accurately compute
* luminance for contemporary monitors. The use of these definitions
* is deprecated.
*/
#define GIMP_RGB_INTENSITY_RED (0.30)
#define GIMP_RGB_INTENSITY_GREEN (0.59)
#define GIMP_RGB_INTENSITY_BLUE (0.11)
#define GIMP_RGB_INTENSITY(r,g,b) ((r) * GIMP_RGB_INTENSITY_RED + \
(g) * GIMP_RGB_INTENSITY_GREEN + \
(b) * GIMP_RGB_INTENSITY_BLUE)
#endif
G_END_DECLS
#endif /* __GIMP_RGB_H__ */