Corrupted XImage retrieved from a Window area

Thomas Lübking thomas.luebking at gmx.de
Sat Jul 30 14:03:14 UTC 2016


On Sat, Jul 30, 2016 at 08:34:20AM +0000, Fabien Lelaquais wrote:
>Hi all,
>I'm trying to create an XImage that represents a rectangular portion of a Window (because I need to be able to access the actual pixel values).
>My experimentations show that if the source window has an hidden region (overlapping window) and if the origin of the rectangle I query is not (0, 0), then the data is corrupted, resulting in pixels set to 0 in the image data (and a black area in the XImage).
>
>I use a raw XGetImage.

You want to use XCompositeRedirectWindow. This redirects the window into
a pixmap. (What compositors like xcompmgr do)


>From man XGetImage:
-------------------
If the drawable is a window, the window must be viewable, and it must be
the case that if there were no inferiors or overlapping windows, the specified
rectangle of the window would be fully visible on the screen and wholly
contained within the outside edges of the window, or a BadMatch error results.

Cheers,
Thomas


More information about the xorg mailing list