[cairo] [RFC] Color space API (partial proposal)
spitzak at gmail.com
Fri Feb 26 11:12:11 PST 2010
James Cloos wrote:
> Since it takes several API calls to build up a gradient, I suspect that
> cairo should demand that the colour stops in a given gradient all be in
> the same colour space, thus the API for specifying the alternate colour
> should not need to specify the alternate's space explicitly.
I would make it match the normal gradient.
The gradient itself has a color space (the "blending" space). When you
specify the stops in it, you can specify a different color space with
each color. These colors are immediately translated to the blending
space and then the gradient is a linear interpolation of the stops in
the gradient's blending space.
When the spot color is drawn a backend that does not understand the spot
color then mixes the colors from the gradient. This is done the same way
you would render a point from a normal gradient: the color from the
gradient is translated from the gradient's blending space to the final
blending space and mixed in the final space.
I'm sure in reality a lot of these color spaces will be identical, but
this makes the api consistent.
PS: I also think that whatever pdf wants is going to have to be catered
to. If an api is made that cannot be trivially translated to some pdf
api then this is not going to work for the majority of users. This does
not mean that 100% of pdf needs to be implemented, there are probably
many ways of specifying spot colors and only one needs to be supported.
More information about the cairo