[Xcb] Get image/color data

Peter Harris git at peter.is-a-geek.org
Sun Nov 22 05:05:22 PST 2009


On Sun, Nov 22, 2009 at 12:45 AM, Nadeem Syed wrote:
> How would I get the image of the provided handle device context (window)?

Please don't. GetImage is a very slow operation, and depending on
security settings the server may not let you. (Since you mention Win32
below, this is just as true on Windows, too. Vista, in particular, has
security bits that can be set by any app, but don't reset until you
log out and back in again).

> I
> need to get the image (screen shot basically) and then save it to as an
> image to the hard disk.

Are you sure? What are you really trying to do?

> How would I got about doing this?

You don't. It's a bad idea. See above. But if you really, really need
to (and you probably don't), you can use:

xwd -id <window id>

http://cgit.freedesktop.org/xorg/app/xwd/

> Also what is the
> alternative to Win32's HDC in XCB?

Loosely, a GC is pretty similar. But most people don't need to know
that since they use a toolkit (such as Qt, GTK, or wxWidgets) to
handle all the low-level stuff for them.

Peter Harris


More information about the Xcb mailing list