[cairo] [RFC] Color space API (partial proposal)

Adrian Johnson ajohnson at redneon.com
Thu Feb 25 02:51:08 PST 2010


ecir hana wrote:
> On Wed, Feb 24, 2010 at 12:52 PM, Adrian Johnson <ajohnson at redneon.com> wrote:
>> After looking at the ICC specification it should be possible for the PDF
>> backend to generate a tint transform from an ICC profile for a DeviceN color
>> space and an ICC profile for the alternate color space.
> 
> Could you please describe this in more detail? How does the mechanism
> of "generate a tint" works? And how exactly should a user proceed?

On IRC Andrea pointed out that ICC profiles can contain named colors. 
After reading about named colors in the ICC specification I don't think 
  we don't need any special API for DeviceN colors. Just use the named 
ICC profile as you would for any other color space.

For example if you wanted to use a 6 component DeviceN color space you 
would need a named ICC profile with 6 channels. The profile contains the 
names of each of the 6 colorants and an ICC profile for translating the 
device colors to the profile connection space.

Then you would use the profile to create the color space and create and 
select a colors:

  color_space = cairo_color_space_create_icc_from_file ("profile.icc");
  color = cairo_color_create (color_space, 0.1, 0.2, 0.3, 0.2, 0.4, 0.9);
  cairo_set_source_color (cr, color);

If the surface is PDF or PS Level 3 a DeviceN color space using the 
colorant names will be used. The tint transform will be generated from 
the ICC profile. The profile contains lookup tables and matrix 
multiplications. PDF/PS Type 0 and Type 4 functions can be used to 
generate a PDF/PS function that performs the same 6 input to 3 output 
operations as the profile. The alternate color space could be either the 
blending color space or LAB. LAB is probably the easiest to use when 
generating tint transforms from ICC profiles as it doesn't require 
generating the additional transform from the 3 channel CIE or LAB 
profile connection space to the blending color space.

If the surface is not PDF or PS the ICC profile would be used in the 
same way as any other ICC profile to transform the 6 component input to 
the blending color space.



More information about the cairo mailing list