[cairo] Spot colors (and CMYK)
ajohnson at redneon.com
Wed Jan 13 05:21:43 PST 2010
Carl Worth wrote:
> On Sat, 26 Dec 2009 15:31:12 +0100, ecir hana <ecir.hana at gmail.com> wrote:
>> I've seen some messages about adding spot colors (or named color, or
>> Separation and DeviceN in PDF specs terms) some time ago. Or perhaps
>> even adding CMYK as well.
>> Please, does anyone know if there has been any developments in that
>> direction? Is it perhaps planned to include spot colors in the future?
>> Or, is this not very central to the current development?
> From time to time, the cairo community sees a message like yours where
> we clearly have users interested in these features.
> But we haven't had much in the way of concrete API proposals (nor
> implementations to go along with them!). And it seems that the current
> set of cairo maintainers do not have the expertise to come up with
> either of these on their own.
> So I think we're going to need some further input from *somebody* before
> we'll see concrete progress on this front.
> Do you know of anyone (perhaps yourself) that could provide some or all
> of the following:
> * Concrete use case to describe what is missing at the
> application<->cairo boundary.
> * A concrete API proposal to satisfy that use case, (and a minimal API
> that doesn't multiply existing cairo entry points exponentially).
> * An implementation of that API.
> I'm looking forward to further input here, since I'd love to be able to
> say that cairo has a good answer for people needing whatever is missing
A starting point for an API proposal to support CMYK colors is the
1) Expose cairo_color_t as an opaque type. This will allow supporting
various types of color without an explosion in the number of API
functions every time a new type of color is added.
cairo_color_reference (cairo_color_t *color);
cairo_color_status (cairo_color_t *color);
cairo_color_destroy (cairo_color_t *color);
2) Provide cairo_color_t constructors for rgb[a] colors.
cairo_color_create_rgba (double red, double green,
double blue, double alpha);
cairo_color_create_rgb (double red, double green, double blue);
3) Add cairo_color_t equivalents of all functions that take a rgb[a]
cairo_set_source_color (cairo_t *cr, cairo_color_t *color);
cairo_pattern_create_color (cairo_color_t *color);
cairo_pattern_add_color_stop_color (cairo_pattern_t *pattern,
4) Now cairo_color_t can be extended to handle CMYK colors:
cairo_color_create_cmyka (double cyan,
cairo_color_create_cmyk (double cyan,
5) Add CMYK image format support to the image surface.
cairo_color_t could also be extended to handle spot colors. But I don't
know enough about spot colors to suggest an API.
More information about the cairo