[cairo] Using Cairo with SDL library

Carl Worth cworth at east.isi.edu
Fri Dec 12 06:44:24 PST 2003


On Dec 12, Enzo wrote:
 > I'm looking for a library to render SVG images to
 > SDL surfaces (http://www.libsdl.org).

Great.

We already have a library for rendering SVG images using cairo. It's
called libsvg-cairo and is hosted at:

	http://www.xsvg.org

It depends on libsvg from the same place, as well as libxml2. The
libsvg code was written by ripping out all of the libart dependencies
from librsvg and replacing it with a callback interface for any
rendering system.

 > - Can I make cairo to render image on the SDL surface pixel buffer
 >   in memory? (it's a simple linear framebuffer).

Quite likely. Cairo can draw directly to a chunk of memory that you
hand it. See:

	cairo_set_target_image

Cairo supports only a small number of image formats, but it shouldn't
bee *too* hard to extend those if needed.

 > - Can cairo be build on other platforms than linux? (win32, mac
 > - osX)

It has been built successfully on linux and mac OS X, (and several
little bugs exposed by OS X were recently fixed). In the past, a few
people have gotten it to work on Windows, but it was necessary to
manually rip out of some of the X11-related code. With the recent
ability to "configure --without-x" I would imagine that building on
Windows is now easier than before.

 > - What are the minimal dependencies of cairo library?

Cairo is implemented as two libraries: libcairo and libpixman. It also
depends on a "native" font system, (which in the current
implementation means it depends on fontconfig/freetype). But we will
probably want to substitute in support for other font systems on some
platforms.

The only other minimal dependencies are quite standard: libc, libm,
and libz.

Finally, the optional backends come with their own dependencies. For
example, the X Render backend depends on Xrender, X11, etc. And other
in-progress backends (OpenGL, PNG) will also have their own
dependencies.

 > Thank you very much for any response.

You're quite welcome.

-Carl




More information about the cairo mailing list