[cairo] Cairo vs GnomeCanvas

Carl Worth cworth at cworth.org
Thu Oct 12 09:47:16 PDT 2006


On Wed, 11 Oct 2006 21:36:15 -0700 (PDT), Manu wrote:
> 1) so I am wondering what is the main differences
> between Cairo and GnomeCanvas?

Cairo is an immediate-mode rendering system---you ask it to draw
something, it draws it and forgets about it.

Most "canvas" things, (like GnomeCanvas), provide a retained-mode
interface where you set up a "scene" of various objects and the canvas
might allow individual objects to be manipulated, efficiently
re-drawing only changed portions, perhaps handle intersections between
objects, provide for adding interactive facilities to objects, etc.

> 2 ) or is GnomeCanvas using Cairo under the scene? ( I
> read that evolution and Gnome are using more and more
> Cairo...)

GnomeCanvas was written before cairo, and there have been no plans for
rewriting GnomeCanvas to use cairo. Instead, there are various plans
for making a cairo-using replacement for GnomeCanvas. It is expected
that GTK+ will adopt a cairo-using canvas at some point.

You might look at the gtk-devel-list archives for discussions about
various canvas alternatives being considered. There is a list of
various canvas projects here:

	http://cairographics.org/examples

I've seen good things from goocanvas and I would recommend trying it
out if you want a canvas in C. If you want a canvas in C++ I've also
heard some good noises about the papyrus stuff. I don't have personal
experience writing code with any of the canvas projects, (though I'd
like to have the chance to try at some point).

> 3) what are the advantages of using Cairo rather than
> Gnome Canvas?

Do you prefer apples or oranges?

The rendering system used by GnomeCanvas is libart, and there are
various niceties about using cairo rather than libart. A well-designed
canvas would mostly make that irrelevant. But it might also pass some
of that nicety along to the canvas user, (for example, by letting the
user use cairo to render custom canvas items).

> 4) Any working ruby example? I tried the one from
> Rcairo and they all failed.

There should be an rcairo person on the list that can hopefully help
you out here. And an interesting follow-on question would be if any of
the exiting canvas projects, (for example, goocanvas), have ruby
bindings.

I suppose that when a canvas does get adopted by GTK+ then bindings
will follow along for the many languages that already have GTK+
bindings.

I hope that helps,

-Carl
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20061012/c5e4e121/attachment.pgp


More information about the cairo mailing list