xmalloc.c \
xmalloc.h
-acre_test_LDFLAGS=$$(pkg-config --libs pangocairo)
+acre_test_LDFLAGS=$$(pkg-config --libs pangocairo lcms)
-acre_test_CFLAGS=$$(pkg-config --cflags pangocairo) \
+acre_test_CFLAGS=$$(pkg-config --cflags pangocairo lcms) \
-Wall -Wextra -Wpointer-arith -Wstrict-prototypes \
-Wmissing-prototypes -Wmissing-declarations \
-Wnested-externs -Wno-unused-parameter
#include <stdarg.h>
#include <math.h>
+#include <lcms.h>
+
typedef struct _acre_data_point_2d {
double x;
double y;
static void
_choose_colors (acre_t *acre)
{
- double hue, saturation, value;
+ cmsHPROFILE lab_profile, srgb_profile;
+ cmsHTRANSFORM lab_to_srgb;
int i;
+ double theta, radius, srgb[3];
+ cmsCIELab lab;
+
+ lab_profile = cmsCreateLabProfile (NULL); /* D50 */
+ srgb_profile = cmsCreate_sRGBProfile ();
+
+ lab_to_srgb = cmsCreateTransform (lab_profile, TYPE_Lab_DBL,
+ srgb_profile, TYPE_RGB_DBL,
+ INTENT_PERCEPTUAL, 0);
acre->num_colors = acre->num_data;
acre->colors_size * sizeof (acre_color_t));
}
- saturation = 1.0;
- value = 0.7;
+ lab.L = 36;
+ radius = 130;
for (i = 0; i < acre->num_colors; i++) {
- hue = 360 * (double) i / acre->num_colors;
- _acre_color_from_hsv (&acre->colors[i],
- hue, saturation, value);
+ theta = 0.713 + 2 * M_PI * (double) i / acre->num_colors;
+ lab.a = radius * cos (theta);
+ lab.b = radius * sin (theta);
+
+ cmsDoTransform (lab_to_srgb, &lab, srgb, 1);
+
+ acre->colors[i].red = srgb[0];
+ acre->colors[i].green = srgb[1];
+ acre->colors[i].blue = srgb[2];
}
+
+ cmsDeleteTransform (lab_to_srgb);
+ cmsCloseProfile (lab_profile);
+ cmsCloseProfile (srgb_profile);
}
static void