Hello,<br><br> I am trying to read the content of a portion of a window with the <br>function XGetImage:<br><br><pre><a href="http://tronche.com/gui/x/xlib/graphics/images.html#XImage">XImage</a> *XGetImage(<b>display</b>, <b>d</b>, <b>x</b>, <b>y</b>, <b>width</b>, <b>height</b>, <b>plane_mask</b>, <b>format</b>)<br>
<a href="http://tronche.com/gui/x/xlib/display/opening.html#Display">Display</a> *<b>display</b>;<br> Drawable <b>d</b>;<br> int <b>x</b>, <b>y</b>;<br> unsigned int <b>width</b>, <b>height</b>;<br>
unsigned long <b>plane_mask</b>;<br> int <b>format</b>;<br></pre>so from an already mapped window called desktopWin I successfully <br>obtain an image with the code:<br><br>anImage = XGetImage(dpy, desktopWin, 0, 0, 200, 200, AllPlanes, ZPixmap);<br>
<br>but when I read the pixels in anImage->Data, if there is a window that overlaps the<br>region that I read (0, 0, 200, 200), the content of that window is returned in <br>"anImage" instead of the original content of the window.<br>
I have tried to set the backing store attribute of the window desktopWin to "Always"<br>in order to see if that could help, in fact:<br>----------------------------------------<br><h1 align="center">3.2.4 Backing Store Attribute</h1>
Some implementations of the X server may choose to maintain the contents of
<b><a href="http://tronche.com/gui/x/xlib/window/create.html#InputClass">InputOutput</a></b>
windows.
If the X server maintains the contents of a window,
the off-screen saved pixels
are known as backing store.
The backing store advises the X server on what to do
with the contents of a window.
The backing-store attribute can be set to
<b>NotUseful</b>
(default),
<b>WhenMapped</b>,
or
<b>Always</b>.
<p>
A backing-store attribute of
<b>NotUseful</b>
advises the X server that
maintaining contents is unnecessary,
although some X implementations may
still choose to maintain contents and, therefore, not generate
<b><a href="http://tronche.com/gui/x/xlib/events/exposure/expose.html">Expose</a></b>
events.
A backing-store attribute of
<b>WhenMapped</b>
advises the X server that maintaining contents of
obscured regions when the window is mapped would be beneficial.
In this case,
the server may generate an
<b><a href="http://tronche.com/gui/x/xlib/events/exposure/expose.html">Expose</a></b>
event when the window is created.
A backing-store attribute of
<b>Always</b>
advises the X server that maintaining contents even when
the window is unmapped would be beneficial.
Even if the window is larger than its parent,
this is a request to the X server to maintain complete contents,
not just the region within the parent window boundaries.
While the X server maintains the window's contents,
<b><a href="http://tronche.com/gui/x/xlib/events/exposure/expose.html">Expose</a></b>
events normally are not generated,
but the X server may stop maintaining
contents at any time.
</p><p>
When the contents of obscured regions of a window are being maintained,
regions obscured by noninferior windows are included in the destination
of graphics requests (and source, when the window is the source).
However, regions obscured by inferior windows are not included.
</p>----------------------------------------<br><br>So I have used the code:<br><br>attr.backing_store = Always;<br>valuemask |= CWBackingStore;<br>XChangeWindowAttributes(dpy, desktopWin, valuemask, &attr);<br><br><br>
Unfortunately it has not helped, since overlapping portions of<br>other windows are still returned in anImage instead of the original<br>content of the window that I want to grab. What could I do to solve<br>this matter?<br>
<br>Thanks in advance,<br clear="all"><br><br>-- <br>Amos Tibaldi<br>