cd-color

cd-color — Color object data functionality

Synopsis

                    CdColorLab;
                    CdColorRGB;
                    CdColorRGB8;
                    CdColorXYZ;
                    CdColorYxy;
void                cd_color_get_blackbody_rgb          (guint temp,
                                                         CdColorRGB *result);
void                cd_color_rgb8_to_rgb                (const CdColorRGB8 *src,
                                                         CdColorRGB *dest);
GPtrArray *         cd_color_rgb_array_interpolate      (const GPtrArray *array,
                                                         guint new_length);
gboolean            cd_color_rgb_array_is_monotonic     (const GPtrArray *array);
GPtrArray *         cd_color_rgb_array_new              (void);
void                cd_color_rgb_copy                   (const CdColorRGB *src,
                                                         CdColorRGB *dest);
CdColorRGB *        cd_color_rgb_dup                    (const CdColorRGB *src);
void                cd_color_rgb_free                   (CdColorRGB *src);
void                cd_color_rgb_interpolate            (const CdColorRGB *p1,
                                                         const CdColorRGB *p2,
                                                         gdouble index,
                                                         CdColorRGB *result);
CdColorRGB *        cd_color_rgb_new                    (void);
void                cd_color_rgb_set                    (CdColorRGB *dest,
                                                         gdouble R,
                                                         gdouble G,
                                                         gdouble B);
void                cd_color_rgb_to_rgb8                (const CdColorRGB *src,
                                                         CdColorRGB8 *dest);
void                cd_color_xyz_clear                  (CdColorXYZ *dest);
void                cd_color_xyz_copy                   (const CdColorXYZ *src,
                                                         CdColorXYZ *dest);
CdColorXYZ *        cd_color_xyz_dup                    (const CdColorXYZ *src);
void                cd_color_xyz_free                   (CdColorXYZ *src);
CdColorXYZ *        cd_color_xyz_new                    (void);
void                cd_color_xyz_set                    (CdColorXYZ *dest,
                                                         gdouble X,
                                                         gdouble Y,
                                                         gdouble Z);
void                cd_color_xyz_to_yxy                 (const CdColorXYZ *src,
                                                         CdColorYxy *dest);
void                cd_color_yxy_copy                   (const CdColorYxy *src,
                                                         CdColorYxy *dest);
CdColorYxy *        cd_color_yxy_dup                    (const CdColorYxy *src);
void                cd_color_yxy_free                   (CdColorYxy *src);
CdColorYxy *        cd_color_yxy_new                    (void);
void                cd_color_yxy_set                    (CdColorYxy *dest,
                                                         gdouble Y,
                                                         gdouble x,
                                                         gdouble y);
void                cd_color_yxy_to_xyz                 (const CdColorYxy *src,
                                                         CdColorXYZ *dest);

Object Hierarchy

  GBoxed
   +----CdColorRGB
  GBoxed
   +----CdColorXYZ
  GBoxed
   +----CdColorYxy

Description

Functions to manipulate color values.

Details

CdColorLab

typedef struct {
	gdouble	 L;
	gdouble	 a;
	gdouble	 b;
} CdColorLab;


CdColorRGB

typedef struct {
	gdouble	 R;
	gdouble	 G;
	gdouble	 B;
} CdColorRGB;


CdColorRGB8

typedef struct {
	guint8	 R;
	guint8	 G;
	guint8	 B;
} CdColorRGB8;


CdColorXYZ

typedef struct {
	gdouble	 X;
	gdouble	 Y;
	gdouble	 Z;
} CdColorXYZ;


CdColorYxy

typedef struct {
	gdouble	 Y;
	gdouble	 x;
	gdouble	 y;
} CdColorYxy;


cd_color_get_blackbody_rgb ()

void                cd_color_get_blackbody_rgb          (guint temp,
                                                         CdColorRGB *result);

Get the blackbody color for a specific temperature.

temp :

the temperature in Kelvin

result :

the destination color

Since 0.1.26


cd_color_rgb8_to_rgb ()

void                cd_color_rgb8_to_rgb                (const CdColorRGB8 *src,
                                                         CdColorRGB *dest);

Convert from one color format to another.

src :

the source color

dest :

the destination color

Since 0.1.27


cd_color_rgb_array_interpolate ()

GPtrArray *         cd_color_rgb_array_interpolate      (const GPtrArray *array,
                                                         guint new_length);

Interpolate the RGB array to a different size. This uses the Akima interpolation algorithm unless the array would become non-monotonic, in which case it falls back to linear interpolation.

array :

Input array. [element-type CdColorRGB]

new_length :

the target length of the return array

Returns :

An array of size new_length or NULL. [element-type CdColorRGB][transfer full]

Since 0.1.31


cd_color_rgb_array_is_monotonic ()

gboolean            cd_color_rgb_array_is_monotonic     (const GPtrArray *array);

Checks the array for monotonicity.

array :

Input array. [element-type CdColorRGB]

Returns :

TRUE if the array is monotonic

Since 0.1.31


cd_color_rgb_array_new ()

GPtrArray *         cd_color_rgb_array_new              (void);

Creates a new RGB array.

Returns :

New array. [element-type CdColorRGB][transfer full]

Since 0.1.31


cd_color_rgb_copy ()

void                cd_color_rgb_copy                   (const CdColorRGB *src,
                                                         CdColorRGB *dest);

Deep copies a color value.

src :

the source color

dest :

the destination color

Since 0.1.27


cd_color_rgb_dup ()

CdColorRGB *        cd_color_rgb_dup                    (const CdColorRGB *src);

Since 0.1.27


cd_color_rgb_free ()

void                cd_color_rgb_free                   (CdColorRGB *src);

Deallocates a color value.

src :

the color object

Since 0.1.0


cd_color_rgb_interpolate ()

void                cd_color_rgb_interpolate            (const CdColorRGB *p1,
                                                         const CdColorRGB *p2,
                                                         gdouble index,
                                                         CdColorRGB *result);

Since 0.1.26


cd_color_rgb_new ()

CdColorRGB *        cd_color_rgb_new                    (void);

Allocates a color value.

Returns :

A newly allocated CdColorRGB object

Since 0.1.0


cd_color_rgb_set ()

void                cd_color_rgb_set                    (CdColorRGB *dest,
                                                         gdouble R,
                                                         gdouble G,
                                                         gdouble B);

Initialises a color value.

dest :

the destination color

R :

component value

G :

component value

B :

component value

Since 0.1.27


cd_color_rgb_to_rgb8 ()

void                cd_color_rgb_to_rgb8                (const CdColorRGB *src,
                                                         CdColorRGB8 *dest);

Convert from one color format to another.

src :

the source color

dest :

the destination color

Since 0.1.27


cd_color_xyz_clear ()

void                cd_color_xyz_clear                  (CdColorXYZ *dest);

Initialises a color value.

dest :

the destination color

Since 0.1.27


cd_color_xyz_copy ()

void                cd_color_xyz_copy                   (const CdColorXYZ *src,
                                                         CdColorXYZ *dest);

Deep copies a color value.

src :

the source color

dest :

the destination color

Since 0.1.27


cd_color_xyz_dup ()

CdColorXYZ *        cd_color_xyz_dup                    (const CdColorXYZ *src);

Since 0.1.27


cd_color_xyz_free ()

void                cd_color_xyz_free                   (CdColorXYZ *src);

Deallocates a color value.

src :

the color object

Since 0.1.0


cd_color_xyz_new ()

CdColorXYZ *        cd_color_xyz_new                    (void);

Allocates a color value.

Returns :

A newly allocated CdColorXYZ object

Since 0.1.0


cd_color_xyz_set ()

void                cd_color_xyz_set                    (CdColorXYZ *dest,
                                                         gdouble X,
                                                         gdouble Y,
                                                         gdouble Z);

Initialises a color value.

dest :

the destination color

X :

component value

Y :

component value

Z :

component value

Since 0.1.27


cd_color_xyz_to_yxy ()

void                cd_color_xyz_to_yxy                 (const CdColorXYZ *src,
                                                         CdColorYxy *dest);

Convert from one color format to another.

src :

the source color

dest :

the destination color

Since 0.1.27


cd_color_yxy_copy ()

void                cd_color_yxy_copy                   (const CdColorYxy *src,
                                                         CdColorYxy *dest);

Deep copies a color value.

src :

the source color

dest :

the destination color

Since 0.1.27


cd_color_yxy_dup ()

CdColorYxy *        cd_color_yxy_dup                    (const CdColorYxy *src);

Since 0.1.27


cd_color_yxy_free ()

void                cd_color_yxy_free                   (CdColorYxy *src);

Deallocates a color value.

src :

the color object

Since 0.1.0


cd_color_yxy_new ()

CdColorYxy *        cd_color_yxy_new                    (void);

Allocates a color value.

Returns :

A newly allocated CdColorYxy object

Since 0.1.0


cd_color_yxy_set ()

void                cd_color_yxy_set                    (CdColorYxy *dest,
                                                         gdouble Y,
                                                         gdouble x,
                                                         gdouble y);

Initialises a color value.

dest :

the destination color

Y :

component value

x :

component value

y :

component value

Since 0.1.27


cd_color_yxy_to_xyz ()

void                cd_color_yxy_to_xyz                 (const CdColorYxy *src,
                                                         CdColorXYZ *dest);

Convert from one color format to another.

src :

the source color

dest :

the destination color

Since 0.1.27