Re: GdkPixbuf vs. Cairo, new image library needed?



2007/10/8, BJörn Lindqvist <bjourne gmail com>:
> Hello all, I'd like to ask some questions and maybe also start some
> discussion about GDK and Cairo.
>
> GTK+ is built on top of GDK and those libraries were built together so
> they fit well with each other. But now, parts (or all?) of GDK is
> about to be replaced with the much more powerful Cairo library. That
> is good and it is bad, and I'll only concentrate on the bad things
> because they can be fixed.
>
> It feels like Cairo doesn't fit in. For example, GDK uses GdkColor to
> represent colors but Cairo has no equivalent.

There is gdk_cairo_set_source_color() though, which bridges the gap.

> Same thing with
> GdkRectangle, GdkPoint and a whole host of other types that becomes
> much less useful in a cairo-world.

There's also gdk_cairo_rectangle() and _region(), and I'm sure the
rest (what they ever may be) could have similar bridging API if deemed
necessary. Like forming a path from an array of GdkPoints etc.

I guess the lack of convenience API could be partly explained with the
fact that Gdk primitives are purely pixel/integer based while the
cairo API is not, so using too much Gdk primitives will potentially
cause rounding trouble...

> But most problematic is probably GdkPixbuf. While gdk-pixbuf is not a
> perfect library, it is the de facto standard way to represent
> in-memory images in the GTK. Unfortunately, Cairo doesn't support
> pixbufs at all. Or rather, it is that Cairo doesn't support any of the
> two formats that GdkPixbuf supports; packed RGB24 and
> RGBA32. GdkPixbufs also use non-premultiplied alpha while Cairo uses
> premultiplied.
[snip]
> So how about replacing gdk-pixbuf with something cairo compatible that
> is also modern? 16 bits per sample is common these days. Support for
> digital camera RAW images would also be nice. Is a completely new
> image library worth pursuing? Are there maybe better ways to solve the
> problems Cairo and GdkPixbuf have?

Even having an additional API for things like
gdk_pixbuf_cairo_load_from_file() would be a step forward I guess. I'd
personally like to see all the useful pixbuf API (file loading/saving,
possibly others) migrated to allow cairo usage and then deprecate
PixBufs over cairo image surfaces, but YMMV.

-- 
Kalle Vahlman, zuh iki fi
Powered by http://movial.fi
Interesting stuff at http://syslog.movial.fi


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]