[cairo] cairo_surface_write_to_png and 32-bit visuals in 1.10.0
Chris Wilson
chris at chris-wilson.co.uk
Tue Sep 28 03:55:06 PDT 2010
On Tue, 28 Sep 2010 10:36:09 +0100, Ross Alexander <Ross.Alexander at EU.NEC.COM> wrote:
> Background: I was tired of using xwd, especially as it does not support RGBA 32 bit visuals. I hacked together a program from the latest xwininfo (based on XCB) to get the Window ID using a pointer selection and then created a surface based on that ID.
>
> #ifdef XLIB
> cairo_surface_t *surface = cairo_xlib_surface_create(dpy, target_win, vinfos[0].visual, geom->width, geom->height);
> #else
> cairo_surface_t *surface = cairo_xcb_surface_create(conn, target_win, v, geom->width, geom->height);
> #endif
> free(geom);
> cairo_surface_write_to_png(surface, file);
>
> This works fine for 24-bit visual windows but with 32-bit visuals (eg gnome-terminal) I get the following error.
>
> xwd: cairo-xcb-surface.c:504: _get_image: Assertion `reply->depth == surface->depth' failed.
>
> Using xlib on 32-bit visuals doesnât fail but instead produces a zero sized PNG file.
This just means that the visual you are using does not match target_win.
--
Chris Wilson, Intel Open Source Technology Centre
More information about the cairo
mailing list