Corrupted XImage retrieved from a Window area
Fabien.Lelaquais at roguewave.com
Sun Jul 31 07:51:08 UTC 2016
Thanks a lot for your answer.
Unfortunately I may not be able to rely of the Composite extension (app would be deployed in environments I don't control).
Regarding the XGetImage documentation, that I've read ten times:
My drawable (mainWindow) is indeed a viewable window.
It has no inferior, and an overlapping window on its center. The specified rectangle that I provide, which is the center part of the source window, is both fully visible on the screen and wholly contained in mainWindow.
I have no X error.
And that's why I'm calling for help.
From: Thomas Lübking [mailto:thomas.luebking at gmx.de]
Sent: samedi 30 juillet 2016 16:03
To: Fabien Lelaquais <Fabien.Lelaquais at roguewave.com>
Cc: xorg at freedesktop.org
Subject: Re: Corrupted XImage retrieved from a Window area
On Sat, Jul 30, 2016 at 08:34:20AM +0000, Fabien Lelaquais wrote:
>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.
More information about the xorg