cairo surface from GdkPixmap



Hi everybody,

I am looking for a way to obtain a Cairo surface from a GdkPixmap.
Just for reference, a few years ago one user was looking for the same functionality:

http://mail.gnome.org/archives/gtk-devel-list/2005-September/msg00138.html

The function _gdk_drawable_ref_cairo_surface does exactly what I want, however this is a private function. So right now I am using

surface = GDK_DRAWABLE_GET_CLASS (pixmap)->ref_cairo_surface (pixmap);

instead, but I doubt that this is recommended practice.

Basically what I am trying to accomplish is to create a class derived from cairo.Context from a pixmap in pygtk. To do so, I need to go through the cairo.Context constructor directly rather than using pixmap.cairo_create. But the cairo.Context constructor takes a Cairo surface rather than a pixmap, so I need to obtain a Cairo surface from the pixmap first. While this can be done with _gdk_drawable_ref_cairo_surface, this function is not available through PyGTK since it's a private function in gtk.

Or is there an alternative way to accomplish this?

Many thanks in advance,

--Michiel



      


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]