has anybody an idea, why this works without XGetImage(..)
but crashes when it is included ??
(.....)
/* Building an image
*/
ximage=XCreateImage(dpy,visual,8,ZPixmap,0,(char*)data,width,height,8,0);
/* send Ximage to win
*/
XPutImage(dpy, win , mygc,ximage, 0, 0, 0, 0,width,height);
/* get Image from win
*/
myimage=XGetImage(dpy,win,0,0, width,heigth,8,ZPixmap);
XMapRaised(dpy,win );
X Error of failed request: BadMatch (invalid parameter attributes)
Major opcode of failed request: 73 (X_GetImage)
Serial number of failed request: 964
Current serial number in output stream: 964
???? I mean all the important values remain the same.
Goetz
> Hello,
>
> has anybody an idea, why this works without XGetImage(..)
> but crashes when it is included ??
> [...]
> myimage=XGetImage(dpy,win,0,0, width,heigth,8,ZPixmap);
> XMapRaised(dpy,win );
> [...]
Well, you're trying to get an image from a window that has not yet been
mapped, which is certainly an unwise thing to do since the window is not
visible on the display. I don't know if that's all the problem, but you
must certainly map the window before you do you XGetImage and XPutImage
calls.
It's a little odd that the XPutImage call works, but perhaps you mean it
just didn't crash? I certainly wouldn't expect you to see anything. If
you're not flushing the buffer, of course, you won't see anything anyway
(and XGetImage will flush the buffer for you, so this is quite likely the
problem).
Nicholas.
--
Nicholas Young. Opinions expressed above are mine, not Logica's.
I am often away; mail me if you wish to be sure I see articles.
If you have problems mailing to the return address, try also
you...@logica.com and/or nich...@jessica.logica.co.uk.
Seems like your window is not mapped when you do XGetImage, thus the
error. From the manual:
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.
--
Ken Lee, X/Motif Consultant, ken...@rahul.net, http://www.rahul.net/kenton/