Examples

We are just starting to see people playing with cairo. The following list shows some of the libraries and programs that are already available. Additions to this list are quite welcome.

Snippets with screenshots

Øyvind Kolås has put together a great little page of samples showing how to draw useful things with small snippets of code.

Small demos

There are a few small programs that may be useful for learning how to use cairo. We are collecting these in the cairo-demo module in CVS:

cvs -d :pserver:anoncvs@cvs.cairographics.org:/cvs/cairo co cairo-demo

A simple pygtk clock and a pygtk shogiban using svg to pixbuf rendering providing a GUI for gnushogi. Xiangqiboard uses cairo via the Gtk2Hs Library for the Haskell programming language.

Mirco (MacSlow) Müller wrote a Cairo Clock that is a good example of how to use Cairo and librsvg in a real application.

Mike Hearn wrote a very simple demo of how to make partly transparent windows with GTK+ and Cairo, and MacSlow has written a more complete example that uses the new XShape extensions to make the transparent areas click-through.

MacSlow also provided a little demonstration of using cairo-drawn graphics as dynamic textures for OpenGL. You can check out that particular example with:

git clone git://people.freedesktop.org/~macslow/gl-cairo-cube

Further examples regarding cairo, glitz and OpenGL are described on the cairo and OpenGL page.

A multi-threaded animation tutorial with cairo and GTK+: threaded animation with cairo

A pycairo example showing how to use librsvg on windows: cairo rsvg and python in windows

A small physics / blob simulator using Cairo and SDL for rendering: blobsallad

A quick demo showing how to use Cairo and XCB together.

git clone git://git.thisnukes4u.net/cairo-xcb-demo.git

Toolkits based on cairo

Charting

SVG

Other projects and programs

GTK Cairo canvas: plans, experiments, interest