Difference between revisions of "SpecIccForCairo"

From Inkscape Wiki
Jump to navigation Jump to search
(Try to match cairo API a little better)
(More work on matching Cairo API style)
Line 5: Line 5:
A set of profiles will apply to the whole Cairo surface.  
A set of profiles will apply to the whole Cairo surface.  
Cairo needs to be able to compute a transform from this set.
Cairo needs to be able to compute a transform from this set.
We can get inspiration from the lcms api [http://www.littlecms.com/LCMSAPI.TXT], in particular the cmsCreateMultiprofileTransform (more generic than cmsCreateTransform that handles only a pair of color profiles).
We can get inspiration from the lcms api [http://www.littlecms.com/LCMSAPI.TXT], in particular the cmsCreateMultiprofileTransform (more generic than cmsCreateTransform that handles only a single pair of color profiles).


So a proposal would be:
So a proposal would be:
Line 17: Line 17:


  typedef struct cairo_color_profile cairo_color_profile_t;
  typedef struct cairo_color_profile cairo_color_profile_t;
void
cairo_surface_set_color_profile(cairo_surface_t *surf,
                                cairo_color_profile_t *profile);
cairo_color_profile_t *
cairo_surface_get_color_profile(cairo_surface_t *surf);
   
   
  void cairo_pattern_add_profile_pair (cairo_pattern_t *pat,  
  void
                                      cairo_color_profile_t *in,  
cairo_surface_add_profile_mapping(cairo_surface_t *surf,  
                                      cairo_color_profile_t *out);
                                  cairo_color_profile_t *in,  
                                  cairo_color_profile_t *out);
   
   
  void cairo_pattern_remove_profiles (cairo_pattern_t *pat);
  void
cairo_surface_remove_profile_mappings(cairo_surface_t *surf);
   
   
  void cairo_pattern_set_color_intent(cairo_pattern_t *pat,
  void
                                    cairo_color_intent_t intent);
cairo_surface_set_color_rendering(cairo_surface_t *surf,
                                  cairo_color_intent_t intent);


== Colors==
  void
All the functions handling colors, like cairo_set_source_rgba and cairo_set_source_rgb, must be complemented (or replaced) with
  cairo_set_source_icc_color(cairo_color_profile_t *profile,
  void cairo_set_source_profiled_color (cairo_t *cr, void* color);
                            const double *components,
format of the color is the one defined by DWORD input_format.
                            int num_components);

Revision as of 19:09, 23 February 2008

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 single pair of color profiles).

So a proposal would be:

typedef enum cairo_color_intent {
  CAIRO_COLOR_INTENT_PERCEPTUAL,
  CAIRO_COLOR_INTENT_RELATIVE_COLORIMETRIC,
  CAIRO_COLOR_INTENT_SATURATION,
  CAIRO_COLOR_INTENT_ABSOLUTE_COLORIMETRIC
} cairo_color_intent_t;
typedef struct cairo_color_profile cairo_color_profile_t;
void
cairo_surface_set_color_profile(cairo_surface_t *surf,
                                cairo_color_profile_t *profile);
cairo_color_profile_t *
cairo_surface_get_color_profile(cairo_surface_t *surf);

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

void
cairo_surface_remove_profile_mappings(cairo_surface_t *surf);

void
cairo_surface_set_color_rendering(cairo_surface_t *surf,
                                  cairo_color_intent_t intent);
void
cairo_set_source_icc_color(cairo_color_profile_t *profile,
                           const double *components,
                           int num_components);