[cairo] Creating CMYK and spot colors using Postscript backend

Behdad Esfahbod behdad at behdad.org
Fri May 11 11:04:45 PDT 2007


On Fri, 2007-05-11 at 18:13 +0200, Markus Meyer wrote:
> Behdad Esfahbod schrieb:
> > There is currently no support for other color spaces in cairo, no.
> > What it takes to implement is is a solid proposal of involved API and
> > how it should work, and well, a patch implementing that :).  Many times
> > though a solid proposals finds someone implementing it automagically.
> >   
> Hi Behdad,
> 
> I'd definitely be interested to implement/help implementing/sponsor such
> support, but I'm afraid my current state of knowledge of the inner
> workings of Cairo will not allow me to create a "solid proposal". But I
> can somewhat sketch what I'd like to do:
> 
> I'd like to have two functions like this:
> 
> cairo_set_source_cmyk(cairo_t *cr, double c, double m, double y, double k);
> cairo_set_source_spot(cairo_t *cr, const char* name, double c, double m,
> double y, double k);
> 
> Those would allow to set a CMYK or a Postscript spot color for EPS
> output (the spot color has an alternative representation in CMYK for
> devices which don't support direct output of spot colors). It would be
> acceptable if only the Postscript (and PDF?) backends would support
> those commands; the other backends would just throw an error if those
> commands are used. At least in the first implementation, it would be the
> responsibility of the client controlling Cairo to use the apropriate
> color space depending on the output device and hence the client would do
> all the color management.

This is actually pretty good already.

Instead of erring if CMYK/spot are not supported by a backend I suggest
cairo automatically converts to RGB.  Also, how do they play with alpha?
Should they both accept an alpha too?

Also, instead of adding cairo_set_source_*, we probably want to add
cairo_pattern_create_* instead.  Probably need
cairo_pattern_add_color_stop_cmyk/etc too.  Maybe if going that far we
should export a cairo_color_t type to reduce the number of new API
needed.

> Markus
> 
-- 
behdad
http://behdad.org/

"Those who would give up Essential Liberty to purchase a little
 Temporary Safety, deserve neither Liberty nor Safety."
        -- Benjamin Franklin, 1759





More information about the cairo mailing list