GimpColorSpace

GimpColorSpace — Utility functions which convert colors between different color models.

Functions

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.

Parameters

rgb

A color value in the RGB colorspace

 

hsv

The value converted to the HSV colorspace.

[out caller-allocates]

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.

Parameters

rgb

A color value in the RGB colorspace

 

hsl

The value converted to HSL.

[out caller-allocates]

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.

Parameters

rgb

A value in the RGB colorspace

 

pullout

A scaling value (0-1) indicating how much black should be pulled out

 

cmyk

The input value naively converted to the CMYK colorspace.

[out caller-allocates]

gimp_hsv_to_rgb ()

void
gimp_hsv_to_rgb (const GimpHSV *hsv,
                 GimpRGB *rgb);

Converts a color value from HSV to RGB colorspace

Parameters

hsv

A color value in the HSV colorspace

 

rgb

The returned RGB value.

[out caller-allocates]

gimp_hsl_to_rgb ()

void
gimp_hsl_to_rgb (const GimpHSL *hsl,
                 GimpRGB *rgb);

Convert a HSL color value to an RGB color value.

Parameters

hsl

A color value in the HSL colorspace

 

rgb

The value converted to a value in the RGB colorspace.

[out caller-allocates]

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.

Parameters

cmyk

A color value in the CMYK colorspace

 

rgb

The value converted to the RGB colorspace.

[out caller-allocates]