Path: utzoo!utgpu!utstat!jarvis.csri.toronto.edu!mailrus!uwm.edu!gem.mps.ohio-state.edu!apple!usc!ucsd!helios.ee.lbl.gov!epb2.lbl.gov!envbvs From: envbvs@epb2.lbl.gov (Brian V. Smith) Newsgroups: comp.windows.x Subject: XCopyPlane() on color Vaxstation 2000 Keywords: Is it broken? Message-ID: <4089@helios.ee.lbl.gov> Date: 31 Oct 89 18:55:11 GMT Sender: usenet@helios.ee.lbl.gov Reply-To: envbvs@epb2.lbl.gov (Brian V. Smith) Organization: Lawrence Berkeley Laboratory Lines: 85 I have a simple application that just displays a bitmap file on a window. After calling XReadBitmapFile to get the data in a Pixmap, I use XCopyPlane to copy it into the window. I call XCopyPlane AFTER RECEIVING AN EXPOSE EVENT ON THE WINDOW. This works fine on monochrome Vaxstation II and 2000's, but not on our color (4-plane) machines. I made sure that the foreground/background pixel values were good but to no avail. Help!? _____________________________________ Brian V. Smith (bvsmith@lbl.gov) Lawrence Berkeley Laboratory I don't speak for LBL, these non-opinions are all mine. Here is the relevant part of the program: ------------------------------ cut here ------------------------------ #include #include #include Display *disp; int width, height; Pixmap picture; Window win = (Window) 0; GC gc; XGCValues gcval; main(ac, av) int ac; char *av[]; { char *file; XExposeEvent ev; if (ac < 2) file="-"; /* standard input */ else file = av[1]; if ((disp=XOpenDisplay("")) == NULL) { fprintf(stderr, "Couldn't open DISPLAY\n"); exit(1); } if (XReadBitmapFile(disp,RootWindow(disp,0),file, &width,&height,&picture,NULL, NULL) != BitmapSuccess) { fprintf(stderr, "Bad bitmap file: %s\n", file); exit(1); } gcval.foreground=BlackPixel(disp,0); gcval.background=WhitePixel(disp,0); gcval.line_width = 1; gcval.function = GXcopy; if ((gc = XCreateGC(disp,RootWindow(disp,0), GCFunction|GCLineWidth| GCForeground|GCBackground,&gcval)) ==False) { fprintf(stderr,"Error in creating GC\n"); exit(1); } win = XCreateSimpleWindow(disp,RootWindow(disp,0), 0, 0, width, height, 0, BlackPixel(disp,0), WhitePixel(disp,0)); XStoreName(disp, win, "Xbitmap"); XMapRaised(disp,win); XSelectInput(disp, win, ExposureMask|ButtonPressMask|KeyPressMask); for (;;) { XNextEvent(disp, &ev); if (ev.type == Expose || ev.type== GraphicsExpose) drawPicture(0, ev.y, width, ev.height); } } drawPicture(x, y, w, h) { XCopyPlane(disp, picture, win, gc, 0, y, w, h, 0, y, (unsigned long) 1); XFlush(disp); }