[cairo] Creating CMYK and spot colors using Postscript backend

Markus Meyer meyer at mesw.de
Fri May 11 13:06:35 PDT 2007


Behdad Esfahbod schrieb:
> On Fri, 2007-05-11 at 18:13 +0200, Markus Meyer wrote:
>   
>> 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);
>>     
> This is actually pretty good already.
>   
Thanks :-)

> 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?
>   
It would just be consistent if they did, but I want to set the bar for
implementing this low (don't want to over-engineer this so it is too
much work and/or it doesn't get implemented at all). At the moment I'm
only interested in solid colors, especially as alpha transparency is of
more use on screens than it is on paper.

Regarding conversion to RGB: problem is, conversion from CMYK to RGB is
not unambiguous. In a real world environment, it depends e.g. on the
color profile used for the given screen, the output device (say, the
type of paper and ink) and the actual conversion method used. It could
be argued that someone who uses CMYK probably knows what he's doing and
will probably not use any simple conversion method anyway. OTOH, I
wouldn't mind if Cairo would implement a simple default conversion
method and direct the user to direct set_rgb/set_cmyk calls for the
cases when he wants to have more control.

> 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.
>   
A cairo_color_t type makes sense to me, especially as it would reduce
the number of API functions in the long run. Of course,
cairo_set_color_rgb[a] must still be maintained for backward
compatibility and ease of use.

So where to go from here? Are you a Cairo developer? Any directions on
how this could be implemented? I can provide the needed output templates
for Postscript (and probably PDF) output to write CMYK and Spot color
information, if this is of any use.


Markus



More information about the cairo mailing list