[cairo] Using an X11 Pixmap in a GtkImage

adlo adloconwy at gmail.com
Wed Aug 12 11:24:01 PDT 2015


I have managed to resolve these issues using cairo_xlib_surface_create_with_xrender_format. It would seem that the bit depth of the widget doesn't matter. The only thing that matters is that the Cairo surface has the same bit depth as the window's X11 Pixmap.

So, the code would be something like this:

XWindowAttributes attr;
XRenderPictFormat *format;
cairo_surface_t *surface;

XGetWindowAttributes (dpy, xid, &attr);

format = XRenderFindVisualFormat (dpy, attr.visual);

surface = cairo_xlib_surface_create_with_xrender_format
			(dpy, pixmap, attr.screen, format, attr.width, attr.height);


Regards

adlo




More information about the cairo mailing list