[cairo] Color space API

Adrian Johnson ajohnson at redneon.com
Tue Oct 16 05:26:27 PDT 2012


I no longer have to time to work on this. But I'll try and answer your
questions.

On 16/10/12 03:44, Kai-Uwe Behrmann wrote:
>>  cairo_color_space_type_t
>>  cairo_color_space_get_type (cairo_color_space_t *color_space);
> 
> Looks like this API allows to detect if a ICC profile is internaly
> generated.
> You will have to extent this enum, in case future internal spaces shall
> be added. That would not be so nice from a API POV.

Enums can be extended such as when we add new surfaces or pattern types.

>> ICC color spaces may contain different types of color spaces. It is
>> useful be able to find the type of an ICC color space.
>>
>>  typedef enum _cairo_color_space_class {
>>    CAIRO_COLOR_SPACE_CLASS_RGB,
>>    CAIRO_COLOR_SPACE_CLASS_CMYK,
>>    CAIRO_COLOR_SPACE_CLASS_GRAY,
>>  } cairo_color_space_class_t;
>>
>>  cairo_color_space_class_t
>>  cairo_color_space_get_class (cairo_color_space_t *color_space);
> 
> It is more handy to obtain the ICC profile memory. That allows to
> further analyse ICC profiles including the above colour space class query.

The API needs a number of the getters added.

>>  cairo_bool_t
>>  cairo_color_space_equal (const cairo_color_space_t *cs_a,
>>                           const cairo_color_space_t *cs_b);
> 
> Out of curiosity, is comparing cairo_color_space_t pointers not enough?

Not if the application creates two color spaces from the same profile.

>>  void
>>  cairo_push_group_with_color_space (cairo_t *cr,
>>                                     cairo_content_t content,
>>                                     cairo_color_space_t *color_space);
>>
>>  cairo_surface_t *
>>  cairo_surface_create_similar_with_color_space (cairo_surface_t *other,
>>                                      cairo_content_t content,
>>                                      cairo_color_space_t *color_space,
>>                                      int width, int height);
> 
> Is that the prefered mechanism for colour space conversion of surfaces?

Similar surfaces are for compositing in a different color space to the
source or destination surfaces. They are not required when the
compositing can be done in the destination surface color space.

> What is the difference of the compositing_color_space to a surface
> colour space?

The compositing color space is not part of the PDF color space model. It
is something I suggested to accommodate the case where the source and
destination colors are converted to a different color space (usually a
linear color space) for compositing without the use of a separate surface.




More information about the cairo mailing list