[comp.windows.x] XWriteBitmapFile

jstravis@athena.mit.edu (John S. Travis) (10/27/89)

I have a Pixmap called draw_map that i copy my graphics images to
when i call a function save_bitmap. The images are lines, rectangles,
circles. I then wish to write that Pixmap to file, yet i crash somewhere.
A file "draw.bitmap" is created but it is empty and the program does
not go on. Here is the line I use to write the file

 if (XWriteBitmapFile(data->dpy,"draw.bitmap",draw_map,canvas_width,
			canvas_height,-1,-1)!=BitmapSuccess)
    printf("cannot write bitmap\n");

 printf("done writing to bitmap\n");


"cannot write bitmap" is NOT written out!
Here is  the error messages. Where does X_ClearArea come into it?

X Protocol error:  not a valid window ID
  Major opcode of failed request:  61 (X_ClearArea)
  Minor opcode of failed request:  0
  Resource id in failed request:  0x1400a2
  Serial number of failed request:  626
  Current serial number in output stream:  631

execution completed (exit code 1)

(dbx) where 
exit.exit(0x1) at 0x335a1
_XDefaultError(0x49000, 0x7fff0eb0) at 0x2ae94
_XError(0x49000, 0x7fff0f3c) at 0x2ac83
_XReply(0x49000, 0x7fff0f3c, 0x0, 0x0) at 0x2a674
XGetImage.XGetImage(0x49000, 0x1400a2, 0x0, 
0x0, 0x11b, 0x122, 0x1, 0x1) at 0x24176
XWriteBitmapFile(0x49000, 0x28a8, 0x1400a2, 0x11b, 
0x122, 0xffffffff, 0xffffffff) at 0x29f62
save_bitmap(0x60600, 0x7fff177c, 0x0) at 0x2959
_XtCallCallbacks(0x606a0, 0x0) at 0x1790d
XtCallCallbacks(0x60600, 0x3527d, 0x0) at 0x179a2
MenuBtn.Select(0x60600, 0x7fff1704, 0x0, 0x61acc) at 0x6a64
_XtTranslateEvent(PopupMgr.TraverseHome = 3, 0x6064c, 0x7fff1704) at 0x201b2
DispatchEvent(0x7fff1704, 0x60600, 0x8) at 0x1929c
XtDispatchEvent(0x7fff1704) at 0x1951c
XtMainLoop() at 0x198ef
main(0x1, 0x7fffe350, 0x7fffe358) at 0x31d

Thnaks for any help!

john travis
jstravis@athena.mit.edu

rws@EXPO.LCS.MIT.EDU (Bob Scheifler) (10/28/89)

    "cannot write bitmap" is NOT written out!
    Here is  the error messages. Where does X_ClearArea come into it?

From somewhere earlier in your program.  Remember, operations in X
are mostly asynchronous, you normally don't see errors until long
after the operation has been issued.  To track this down, run your
program synchronously (see XSynchronize).