Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!purdue!tut.cis.ohio-state.edu!bloom-beacon!athena.mit.edu!jstravis From: jstravis@athena.mit.edu (John S. Travis) Newsgroups: comp.windows.x Subject: Bitmap inverted somehow? Message-ID: <15592@bloom-beacon.MIT.EDU> Date: 2 Nov 89 23:09:27 GMT Sender: daemon@bloom-beacon.MIT.EDU Reply-To: jstravis@athena.mit.edu (John S. Travis) Distribution: usa Organization: Massachusetts Institute of Technology Lines: 43 I have a graphics program where lines, circles, boxes are draw on widget. I can also save these objects to a Pixmap/Bitmap by looping though the graphics buffer and drawing onto the Pixmap instead of the widget. However, everything ends up inverted in the bitmap. A white-filled rectangle is black, black lines don't show up b/c they are white, yet the background is not all black. To restate the image on my widget compared to the one shown by using bitmap "saved-file" & are opposite. Any ideas? I set foreground and background in the gc early in my program. Here's my save_bitmap function. jstravis@athena.mit.edu void save_bitmap(w, data,call_data) Widget w; graphics_data *data; caddr_t call_data; { Dimension canvas_width, canvas_height; Arg wargs[2]; Pixmap draw_map; XtSetArg(wargs[0],XtNwidth, &canvas_width); XtSetArg(wargs[1],XtNheight, &canvas_height); XtGetValues(data->canvas,wargs,2); /* depth = 1 means bitmap */ draw_map = XCreatePixmap(data->dpy,data->win,canvas_width,canvas_height,1); /* make Window = to pixmap*/ data->win = draw_map; refresh(w,data,NULL); /* draws all data in graphics buffer to the Pixmap */ 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"); /* return win to normal */ data->win = XtWindow(data->canvas); }