[cairo] Selecting cairo backends

Carl Worth cworth at cworth.org
Mon Mar 14 09:48:10 PST 2005


On Mon, 14 Mar 2005 00:47:49 +0100, "Michael Monreal" wrote:

> I was just wondering if a cairo application needs to be
> written/compiled to use a specific backend or if it is possible to
> use whatever backend I like at runtime?

As far as cairo is concerned, the application needs to be written to
support some specific set of backends. Automatic backend selection
doesn't make much sense at the level of cairo, because almost every
backend requires its own library-specific data structure for
initialization. So the backends really aren't transparently
interchangeable, (as far as surface construction is concerned ---
naturally, all drawing operations in cairo work interchangeably with
any backend).

>                                         I didn't find any
> information about this, are there environment variable or a config
> file controlling this or is it just not possible to, for example,
> chose between the xlib and glitz backend?

The xlib and glitz backends are really the only two backends that are
somewhat interchangeable, (as they can both be constructed for an Xlib
Drawable), but even then, the capabilities and requirements for these
constructing these two surface types still differ quite a bit.

I can understand the desire to have automatic switching between these
two backends, and I think that layers above cairo should pursue
that. For example, the gtkcairo module provides the following (from
gtkcairo/README):

	GtkCairo should choose a reasonable cairo backend by default, at the
	moment this means the xlib backend since it provides AA at all times,
	setting the backend can be done through the enviroment variable

	export GTKCAIRO_BACKEND = gl
	export GTKCAIRO_BACKEND = xlib
	export GTKCAIRO_BACKEND = image (not implemented yet)

	before starting an application.

-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/20050314/1a3e20da/attachment.pgp


More information about the cairo mailing list