SpecIccForCairo

From Inkscape Wiki
Revision as of 19:24, 22 February 2008 by Aubanel (talk | contribs) (→‎Profiles)
Jump to navigation Jump to search

Why

In order for inkscape to produce CMYK PDFs and PSs with cairo, Cairo needs to support ICC. This is an intent to propose a Cairo API that would be suitable with inkscape needs.

Profiles

A set of profiles will apply to the whole Cairo surface. Cairo needs to be able to compute a transform from this set. We can get inspiration from the lcms api [1], in particular the cmsCreateMultiprofileTransform (more generic than cmsCreateTransform that handles only a pair of color profiles).

So a proposal would be:

typedef struct {
DWORD :size;
void *:data;
} cairo_color_profile_t

void cairo_surface_add_profile_pair (cairo_surface_t *surf, 
                                    cairo_color_profile_t in, 
                                    cairo_color_profile_t out);

void cairo_surface_remove_profiles (cairo_surface_t *surf);

void cairo_surface_set_transformation (cairo_surface_t *surf, 
                                      DWORD input_format,                 
                                      DWORD output_format, 
                                      int intent, 
                                      DWORD flags)

Profiles and transformation must be set before any call to a cairo function using a color.

Colors

All the functions handling colors, like cairo_set_source_rgba and cairo_set_source_rgb, must be complemented (or replaced) with

void cairo_set_source_profileded_color  (cairo_t *cr, void* color);

format of the color is the one defined by DWORD input_format.