[gimp] libgimpcolor: remove gimp_rgb_to_hsv_int() and gimp_hsv_to_rgb_int() cruft
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] libgimpcolor: remove gimp_rgb_to_hsv_int() and gimp_hsv_to_rgb_int() cruft
- Date: Mon, 22 Oct 2018 11:08:23 +0000 (UTC)
commit 40df58011fa9a9a479f27eda22b92ec48275d5ef
Author: Michael Natterer <mitch gimp org>
Date: Mon Oct 22 13:06:43 2018 +0200
libgimpcolor: remove gimp_rgb_to_hsv_int() and gimp_hsv_to_rgb_int() cruft
libgimpcolor/gimpcolor.def | 2 -
libgimpcolor/gimpcolorspace.c | 171 ------------------------------------------
libgimpcolor/gimpcolorspace.h | 10 ---
3 files changed, 183 deletions(-)
---
diff --git a/libgimpcolor/gimpcolor.def b/libgimpcolor/gimpcolor.def
index ce058f9d00..4fd5a70e00 100644
--- a/libgimpcolor/gimpcolor.def
+++ b/libgimpcolor/gimpcolor.def
@@ -67,7 +67,6 @@ EXPORTS
gimp_hsv_get_type
gimp_hsv_set
gimp_hsv_to_rgb
- gimp_hsv_to_rgb_int
gimp_hsva_set
gimp_param_rgb_get_type
gimp_param_spec_rgb
@@ -101,7 +100,6 @@ EXPORTS
gimp_rgb_to_hsl
gimp_rgb_to_hsl_int
gimp_rgb_to_hsv
- gimp_rgb_to_hsv_int
gimp_rgb_to_l_int
gimp_rgba_add
gimp_rgba_distance
diff --git a/libgimpcolor/gimpcolorspace.c b/libgimpcolor/gimpcolorspace.c
index 46bff703f6..1dcd8edb35 100644
--- a/libgimpcolor/gimpcolorspace.c
+++ b/libgimpcolor/gimpcolorspace.c
@@ -44,7 +44,6 @@
**/
-#define GIMP_HSV_UNDEFINED -1.0
#define GIMP_HSL_UNDEFINED -1.0
/*********************************
@@ -404,178 +403,8 @@ gimp_cmyk_to_rgb (const GimpCMYK *cmyk,
}
-#define GIMP_RETURN_RGB(x, y, z) { rgb->r = x; rgb->g = y; rgb->b = z; return; }
-
-/****************************************************************************
- * 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.
- ****************************************************************************/
-
-
/* gint functions */
-/**
- * gimp_rgb_to_hsv_int:
- * @red: The red channel value, returns the Hue channel
- * @green: The green channel value, returns the Saturation channel
- * @blue: The blue channel value, returns the Value channel
- *
- * The arguments are pointers to int representing channel values in
- * the RGB colorspace, and the values pointed to are all in the range
- * [0, 255].
- *
- * The function changes the arguments to point to the HSV value
- * corresponding, with the returned values in the following
- * ranges: H [0, 359], S [0, 255], V [0, 255].
- **/
-void
-gimp_rgb_to_hsv_int (gint *red,
- gint *green,
- gint *blue)
-{
- gdouble r, g, b;
- gdouble h, s, v;
- gint min;
- gdouble delta;
-
- r = *red;
- g = *green;
- b = *blue;
-
- if (r > g)
- {
- v = MAX (r, b);
- min = MIN (g, b);
- }
- else
- {
- v = MAX (g, b);
- min = MIN (r, b);
- }
-
- delta = v - min;
-
- if (v == 0.0)
- s = 0.0;
- else
- s = delta / v;
-
- if (s == 0.0)
- {
- h = 0.0;
- }
- else
- {
- if (r == v)
- h = 60.0 * (g - b) / delta;
- else if (g == v)
- h = 120 + 60.0 * (b - r) / delta;
- else
- h = 240 + 60.0 * (r - g) / delta;
-
- if (h < 0.0)
- h += 360.0;
-
- if (h > 360.0)
- h -= 360.0;
- }
-
- *red = ROUND (h);
- *green = ROUND (s * 255.0);
- *blue = ROUND (v);
-
- /* avoid the ambiguity of returning different values for the same color */
- if (*red == 360)
- *red = 0;
-}
-
-/**
- * gimp_hsv_to_rgb_int:
- * @hue: The hue channel, returns the red channel
- * @saturation: The saturation channel, returns the green channel
- * @value: The value channel, returns the blue channel
- *
- * The arguments are pointers to int, with the values pointed to in the
- * following ranges: H [0, 360], S [0, 255], V [0, 255].
- *
- * The function changes the arguments to point to the RGB value
- * corresponding, with the returned values all in the range [0, 255].
- **/
-void
-gimp_hsv_to_rgb_int (gint *hue,
- gint *saturation,
- gint *value)
-{
- gdouble h, s, v, h_temp;
- gdouble f, p, q, t;
- gint i;
-
- if (*saturation == 0)
- {
- *hue = *value;
- *saturation = *value;
- *value = *value;
- }
- else
- {
- h = *hue;
- s = *saturation / 255.0;
- v = *value / 255.0;
-
- if (h == 360)
- h_temp = 0;
- else
- h_temp = h;
-
- h_temp = h_temp / 60.0;
- i = floor (h_temp);
- f = h_temp - i;
- p = v * (1.0 - s);
- q = v * (1.0 - (s * f));
- t = v * (1.0 - (s * (1.0 - f)));
-
- switch (i)
- {
- case 0:
- *hue = ROUND (v * 255.0);
- *saturation = ROUND (t * 255.0);
- *value = ROUND (p * 255.0);
- break;
-
- case 1:
- *hue = ROUND (q * 255.0);
- *saturation = ROUND (v * 255.0);
- *value = ROUND (p * 255.0);
- break;
-
- case 2:
- *hue = ROUND (p * 255.0);
- *saturation = ROUND (v * 255.0);
- *value = ROUND (t * 255.0);
- break;
-
- case 3:
- *hue = ROUND (p * 255.0);
- *saturation = ROUND (q * 255.0);
- *value = ROUND (v * 255.0);
- break;
-
- case 4:
- *hue = ROUND (t * 255.0);
- *saturation = ROUND (p * 255.0);
- *value = ROUND (v * 255.0);
- break;
-
- case 5:
- *hue = ROUND (v * 255.0);
- *saturation = ROUND (p * 255.0);
- *value = ROUND (q * 255.0);
- break;
- }
- }
-}
-
/**
* gimp_rgb_to_hsl_int:
* @red: Red channel, returns Hue channel
diff --git a/libgimpcolor/gimpcolorspace.h b/libgimpcolor/gimpcolorspace.h
index 32df1862fc..f5327c4351 100644
--- a/libgimpcolor/gimpcolorspace.h
+++ b/libgimpcolor/gimpcolorspace.h
@@ -51,16 +51,6 @@ void gimp_cmyk_to_rgb (const GimpCMYK *cmyk,
/* gint functions */
-GIMP_DEPRECATED_FOR (gimp_rgb_to_hsv)
-void gimp_rgb_to_hsv_int (gint *red /* returns hue */,
- gint *green /* returns saturation */,
- gint *blue /* returns value */);
-
-GIMP_DEPRECATED_FOR (gimp_hsv_to_rgb)
-void gimp_hsv_to_rgb_int (gint *hue /* returns red */,
- gint *saturation /* returns green */,
- gint *value /* returns blue */);
-
GIMP_DEPRECATED_FOR (gimp_rgb_to_hsl)
void gimp_rgb_to_hsl_int (gint *red /* returns hue */,
gint *green /* returns saturation */,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]