[cairo] How do I use an X11 Pixmap in a GtkImage?

adlo adloconwy at gmail.com
Wed Aug 12 11:54:27 PDT 2015


I posted this message under the wrong thread title, so I am duplicating it here for clarity.

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