[cairo] pycairo xlib surface

Steve stevech1097 at yahoo.com.au
Fri Nov 13 01:05:43 PST 2009


On Tue, 2009-11-10 at 12:00 -0800, cairo-request at cairographics.org
wrote:
> It looks like there is no way to make a pycairo xlib surface,
> is this right ?

No, when using pygtk you can call gtk.gdk.Drawable.cairo_create() to
create a gtk.gdk.CairoContext, and get_target() to return the surface
for the gtk.gdk.CairoContext.

> At the moment, I have some truly bizarre numpy code for pumping cairo
> image
> data via X protocol PutImage (using python-xlib).. It would be much
> nicer
> to use pycairo with xlib surface !
> 
> I would be able to write/test something if we can agree on a way to
> do this.

A pycairo interface to
cairo_surface_t *   cairo_xlib_surface_create           (Display *dpy,
                                                         Drawable drawable,
                                                         Visual *visual,
                                                         int width,
                                                         int height);
requires a python xlib library which implements Python objects Display,
Drawable and Visual, and provides a way to access the underlying C data
types. So writing such a library (which is not part of pycairo) is one way
to do this.

Steve

> Simon.




More information about the cairo mailing list