Examples

The following list shows some of the libraries and programs that are using cairo. 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.

Bezier gradients

Bezier gradients, also known as type 6/7 gradients in PS/PDF parlance, are incredibly power tools. Using a patchwise 2D cubic Bezier surface allows them to construct any of the lesser gradients such as linear, conical and radial, and the flexibility to do so much more. One example, Adrian Johnson gives is the ability to create realistic shading of a complex object:

Small demos

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

Juan Manuel Mouriz provided another simplest example of using cairo-drawn graphics as dynamic textures for OpenGL. You can check out with:

svn checkout http://gtk-gl-slider.googlecode.com/svn/ gtk-gl-slider-read-only

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