[cairo] [RFC] Color space API (partial proposal)
Adrian Johnson
ajohnson at redneon.com
Sun Feb 28 05:37:43 PST 2010
Kai-Uwe Behrmann wrote:
> Am 27.02.10, 00:45 +1030 schrieb Adrian Johnson:
>> /* Set a CMYK profile to be used as the page color space
>> * (and blending space)
>> */
>>
>> dest_col_space = cairo_color_space_create_icc_from_file
>> ("my_cmyk_profile.icc");
>> cairo_surface_set_color_space (surface, dest_col_space);
>
> Is this a once only call to each surface? Then it probably could be
> nicely interwoven into the create surface call?
Yes it is a once only call. It could be either part of a constructor or
a separate call as above. The PDF backend allows each page to have a
different color space so for PDF the cairo_surface_set_color_space()
function makes more sense. In this case it is like the
cairo_pdf_surface_set_size() call. If used it must be called before
drawing on the page. It can not be changed after drawing starts.
> If not it would be trivial to switch the blending space. As mentioned,
> the cost of such a switch should, in my opinion, be expressed in more
> development work, like requiring a new surface with the new blending
> colour space. The cost of such a switch is not only a computational one.
> A single blending space space per document mean less complitcation else
> where. API wise I think a single blending space per surface makes the
> concept of blending spaces in cairo even stronger and better
> understandable.
>
> I must admit I have not much glue about spot colours and can only hope
> the blending space concept maps well to spot colours.
I recommend reading the sections of the PDF standard [1] applicable to
blending spaces and spot colors as all of this is explained in the
standard.
The PDF color spaces that can be used as a blending color space are
DeviceGray, DeviceRGB, DeviceCMYK, CalGray, CalRGB, and ICC color
spaces that are CMYK, RGB, or Gray. The color components of these
spaces must be between 0 and 1. Spot and DeviceN colors are never
converted to the blending color space (unless the alternate color space
is used).
Spot and DeviceN source colors are blended with the corresponding
spot or DeviceN components in the group. In other words surfaces
maintain separate color components for each spot color or DeviceN
color component independent of the surface's blending color space.
When blending subtractive color spaces (CMYK, spot, DeviceN) the
components are subtracted from 1.0 before blending and the results are
subtracted from 1.0 before being used.
[1] http://www.adobe.com/devnet/acrobat/pdfs/PDF32000_2008.pdf
More information about the cairo
mailing list