[Xcb] Get image/color data

Rémi Denis-Courmont remi at remlab.net
Sun Nov 22 05:04:13 PST 2009


Le dimanche 22 novembre 2009 07:45:40 Nadeem Syed, vous avez écrit :
> How would I get the image of the provided handle device context (window)? I
>  need to get the image (screen shot basically) and then save it to as an
>  image to the hard disk. How would I got about doing this?

xcb_get_image_reply_t *img =
    xcb_get_image_reply (conn,
        xcb_get_image (conn, XCB_IMAGE_FORMAT_Z_PIXMAP, window,
                       x, y, width, height, ~0), NULL);
if (img == NULL)
    OOPS();

uint8_t *data = xcb_get_image_data (img);
size_t length = xcb_get_image_data_length (img);

/* ... */

free (img);

-- 
Rémi Denis-Courmont
http://www.remlab.net/


More information about the Xcb mailing list