[cairo] Adding a color management interface to GTK

Richard Hughes hughsient at gmail.com
Thu Jan 21 02:13:09 PST 2010

In https://bugzilla.gnome.org/show_bug.cgi?id=606885#c20 I've proposed
a new set of GtkColor api calls that allows us to color manage
GdkPixbufs and cairo surfaces. The modules have deliberately been kept
small and simple at this stage, as we can easily add properties and
methods at a later time.

The reason I'm hoping to add API to GTK is so that most applications
can actually use it to do 90% of what they need. It's not designed for
something like GIMP that needs to deal with full CMYK spaces and spot
colors (although there's nothing stopping us adding this kind of
support in the future) but it is designed to get 90% of applications
color managed. By making GtkImage optionally color managed you've
fixed 90% of all the applications (photo viewers, pdf readers etc) and
a lot of the end-user "my photo looks too bluish" type problems melt

Of course, I'm no expert in cairo, so the cairo surface API is
probably horribly inefficient (given we currently have to
pre-unmultiply and re-premultiply in C) but probably sufficient for
most of the end-user cases out there.

When designing the API, I was very keen to not to try to support
everything, as this way nothing would ever be done. Color management
is such a large area, with multiple orthogonal concepts, that it's
usually very hard to agree on anything, much less shared API we can
use. I'm also keen on pushing it into GTK core library rather than
just requiring applications use something like lcms. They can, and do,
frequently get this wrong and the vast majority of authors just don't
care. Making color management 'just work' is the biggest hurdle for a
color managed desktop.

There are some things we probably want to address in the first
version. For instance, it would probably be quite useful to tag the
GdkImage or cairo surface with the GtkProfile, either the binary data,
or just a refcounted instance of the profile object. Maybe it's no big

So, I ask you to review that patch, make suggestions and criticisms --
feedback is welcome. Please bear in mind it'll be the first of quite a
few patches, and that I can't possibly add every color management
concept and feature in an initial patch.



More information about the cairo mailing list