Top |
GimpColorSpaceGimpColorSpace — Utility functions which convert colors between different color models. |
Functions
void | gimp_rgb_to_hsv () |
void | gimp_rgb_to_hsl () |
void | gimp_rgb_to_cmyk () |
void | gimp_hsv_to_rgb () |
void | gimp_hsl_to_rgb () |
void | gimp_cmyk_to_rgb () |
void | gimp_rgb_to_hwb () |
void | gimp_hwb_to_rgb () |
void | gimp_rgb_to_hsv_int () |
void | gimp_hsv_to_rgb_int () |
void | gimp_rgb_to_hsl_int () |
void | gimp_rgb_to_cmyk_int () |
void | gimp_cmyk_to_rgb_int () |
gint | gimp_rgb_to_l_int () |
void | gimp_hsl_to_rgb_int () |
void | gimp_rgb_to_hsv4 () |
void | gimp_hsv_to_rgb4 () |
Description
When programming pixel data manipulation functions you will often use algorithms operating on a color model different from the one GIMP uses. This file provides utility functions to convert colors between different color spaces.
Functions
gimp_rgb_to_hsv ()
void gimp_rgb_to_hsv (const GimpRGB *rgb
,GimpHSV *hsv
);
Does a conversion from RGB to HSV (Hue, Saturation, Value) colorspace.
gimp_rgb_to_hsl ()
void gimp_rgb_to_hsl (const GimpRGB *rgb
,GimpHSL *hsl
);
Convert an RGB color value to a HSL (Hue, Saturation, Lightness) color value.
gimp_rgb_to_cmyk ()
void gimp_rgb_to_cmyk (const GimpRGB *rgb
,gdouble pullout
,GimpCMYK *cmyk
);
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 1 causes the maximum amount of black to be pulled out.
gimp_hsv_to_rgb ()
void gimp_hsv_to_rgb (const GimpHSV *hsv
,GimpRGB *rgb
);
Converts a color value from HSV to RGB colorspace
gimp_hsl_to_rgb ()
void gimp_hsl_to_rgb (const GimpHSL *hsl
,GimpRGB *rgb
);
Convert a HSL color value to an RGB color value.
gimp_cmyk_to_rgb ()
void gimp_cmyk_to_rgb (const GimpCMYK *cmyk
,GimpRGB *rgb
);
Does a simple transformation from the CMYK colorspace to the RGB colorspace, without taking color profiles into account.
gimp_rgb_to_hwb ()
void gimp_rgb_to_hwb (const GimpRGB *rgb
,gdouble *hue
,gdouble *whiteness
,gdouble *blackness
);
gimp_rgb_to_hwb
is deprecated and should not be used in newly-written code.
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.
gimp_hwb_to_rgb ()
void gimp_hwb_to_rgb (gdouble hue
,gdouble whiteness
,gdouble blackness
,GimpRGB *rgb
);
gimp_hwb_to_rgb
is deprecated and should not be used in newly-written code.
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].
gimp_rgb_to_hsv_int ()
void gimp_rgb_to_hsv_int (gint *red
,gint *green
,gint *blue
);
gimp_rgb_to_hsv_int
is deprecated and should not be used in newly-written code.
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].
gimp_hsv_to_rgb_int ()
void gimp_hsv_to_rgb_int (gint *hue
,gint *saturation
,gint *value
);
gimp_hsv_to_rgb_int
is deprecated and should not be used in newly-written code.
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].
gimp_rgb_to_hsl_int ()
void gimp_rgb_to_hsl_int (gint *red
,gint *green
,gint *blue
);
gimp_rgb_to_hsl_int
is deprecated and should not be used in newly-written code.
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 corresponding HLS value with the values pointed to in the following ranges: H [0, 360], L [0, 255], S [0, 255].
gimp_rgb_to_cmyk_int ()
void gimp_rgb_to_cmyk_int (gint *red
,gint *green
,gint *blue
,gint *pullout
);
gimp_rgb_to_cmyk_int
is deprecated and should not be used in newly-written code.
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.
gimp_cmyk_to_rgb_int ()
void gimp_cmyk_to_rgb_int (gint *cyan
,gint *magenta
,gint *yellow
,gint *black
);
gimp_cmyk_to_rgb_int
is deprecated and should not be used in newly-written code.
Does a naive conversion from CMYK to RGB colorspace. A simple formula that doesn't take any color-profiles into account is used.
gimp_rgb_to_l_int ()
gint gimp_rgb_to_l_int (gint red
,gint green
,gint blue
);
gimp_rgb_to_l_int
is deprecated and should not be used in newly-written code.
Calculates the lightness value of an RGB triplet with the formula L = (max(R, G, B) + min (R, G, B)) / 2
gimp_hsl_to_rgb_int ()
void gimp_hsl_to_rgb_int (gint *hue
,gint *saturation
,gint *lightness
);
gimp_hsl_to_rgb_int
is deprecated and should not be used in newly-written code.
The arguments are pointers to int, with the values pointed to in the following ranges: H [0, 360], L [0, 255], S [0, 255].
The function changes the arguments to point to the RGB value corresponding, with the returned values all in the range [0, 255].
gimp_rgb_to_hsv4 ()
void gimp_rgb_to_hsv4 (const guchar *rgb
,gdouble *hue
,gdouble *saturation
,gdouble *value
);
gimp_rgb_to_hsv4
is deprecated and should not be used in newly-written code.