[cairo] Spot colors (and CMYK)
spitzak at gmail.com
Wed Feb 17 11:30:24 PST 2010
ecir hana wrote:
> Yes, I really want to control the CMYK, such API is the topic of this
> If I say CMYK(40, 30, 30, 100) I want CMYK(40, 30, 30, 100). I bet you
> understand what I'm talking about - it's the same as reading Quicktime
> and writing it back as Quicktime, as you wrote above - going from CMYK
> to sRGB and back to CMYK makes no sense.
> Again, the real question is, how do you supply CMYK image to Cairo and
> first, show it on the screen and second, export it to PDF with the
> same set of graphic operators?
I do not think Cairo should understand color profiles. This is an
ENORMOUS complication that will only cause grief. This is why I very
strongly reject any of Kai-Uwe Behrmann's ideas.
I am also under the impression that "CMYK" means "exactly these inks on
this specific device". Printer profiles apparently are defined as "here
is how to turn this CMYK into a matching point in a 3-dimensional color
space". Therefore I believe that any portable information derived from a
CMYK color can be conveyed with a 3-dimensional color api.
Therefore my method to fill a shape with an exact CMYK on an output
1. Specify the color in sRGB. If the application only has CMYK
information, it is the applications responsibility to figure out how to
turn it into sRGB. An obvious way is to use the device profile to turn
it into XYZ and from there into unclamped sRGB.
2. Also specify using a device specific api that this exact spot color
is wanted. A backend that understands this will use the spot color other
than the sRGB. Most backends will ignore this information.
There cannot be any guarantees about compositing of any transparency or
antialiased edge, but a 100% opaque area should produce exactly that
spot color on output. The reason we cannot guarantee anything about
transparency is that the only predictable result would be to convert the
composited sRGB to the device inks, but this would result in a
discontinuity of antialiased edges with the enclosed area. I think users
would prefer an antialiased edge made of the spot color even if the
exact composited result is device-dependent.
As spot colors tend to be one channel, I am uncertain how to do a CMYK
separation image. One way would be to draw 4 monochrome images with
different spot colors (each of C,M,Y,K are a spot color), with the
compositing operator set to subtract (or maybe multiply or maybe some
new operator) which is an indication that ink must accumulate. Since
Cairo has no information about how the colors mix it will be impossible
to produce an accurate sRGB equivalent. Alternative is to use an N+3
channel image, with the sRGB data included so that back ends that do not
understand the spot colors can use the sRGB fallback. Or an api that
takes two different images as input. In any case again anything other
than 100% opacity is going to produce device-dependent results and no
color management is going to fix that.
More information about the cairo