[cairo] cairo_surface_write_to_png and 32-bit visuals in 1.10.0
Ross Alexander
Ross.Alexander at EU.NEC.COM
Tue Sep 28 04:10:42 PDT 2010
> This just means that the visual you are using does not match target_win.
I didn't include the full code since most of it is XCB related rather than cairo but the visual is correct as far as I can tell (checked with xwininfo). Below is the code for getting the visual of the window required to cairo.
xcb_get_window_attributes_cookie_t attributesCookie = xcb_get_window_attributes(conn, target_win);
xcb_get_window_attributes_reply_t *attributes = xcb_get_window_attributes_reply(conn, attributesCookie, NULL);
xcb_visualtype_t* v = xcb_aux_find_visual_by_id(screen, attributes->visual);
I added the XLIB code to double check I was getting the correct visual ID value from XCB. As I said this works fine for 24-bit visual windows so I don't think it is my parameters that are the issue.
-----Original Message-----
From: cairo-bounces+ross.alexander=eu.nec.com at cairographics.org [mailto:cairo-bounces+ross.alexander=eu.nec.com at cairographics.org] On Behalf Of Chris Wilson
Sent: 28 September 2010 11:55
To: Ross Alexander; cairo at cairographics.org
Subject: Re: [cairo] cairo_surface_write_to_png and 32-bit visuals in 1.10.0
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.
--
Chris Wilson, Intel Open Source Technology Centre
Click https://www.mailcontrol.com/sr/yrARTltOOmfTndxI!oX7UhdcvSFje8hNh1+ulZdIXKwchpRVtzoOTbmj5KHvHT3EGLELryxzq6ni5jK2rp2Ftw== to report this email as spam.
More information about the cairo
mailing list