envbvs@epb2.lbl.gov (Brian V. Smith) (04/15/89)
I am trying use a stipple on a window in X11R3. On our monochrome vs2000 this works fine. But on our 4-plane color vs2000 the color that is used (and the pattern) is seemingly random! Here is the section of code that creates the gc: init_fill_gc() { XGCValues gcv; int i; gcv.fill_style = FillStippled; for (i=0; i<NUMFILLPATS; i++) { fill_pm[i] = XCreateBitmapFromData(tool_d, XtWindow(canvas_sw), fill_images[i],8,8); fill_gc[i] = makegc(PAINT, x_fg_color.pixel, x_bg_color.pixel); gcv.stipple = fill_pm[i]; XChangeGC(tool_d, fill_gc[i], GCStipple|GCFillStyle|GCArcMode, &gcv); } } GC makegc(op, fg, bg) int op; Pixel fg; Pixel bg; { register GC ngc; XGCValues gcv; int gcmask; gcv.font = roman_font->fid; gcv.join_style = JoinMiter; gcmask = GCJoinStyle|GCFunction|GCForeground|GCBackground|GCFont; switch (op) { case PAINT: gcv.foreground = fg; gcv.background = bg; gcv.function = GXcopy; break; case ERASE: gcv.foreground = bg; gcv.background = bg; gcv.function = GXcopy; break; case INV_PAINT: gcv.foreground = fg ^ bg; gcv.background = bg; gcv.function = GXxor; break; case MERGE: gcv.foreground = fg; gcv.background = bg; gcv.function = GXor; break; } ngc = XCreateGC(tool_d, XtWindow(canvas_sw), gcmask, &gcv); XCopyGC(tool_d, gc, ~(gcmask), ngc); /* add main gc's values not specified here to the new one */ return (ngc); } Here is the code that does the fill: gc = fill_gc[i]; /* where i is the fill pattern index */ XFillPolygon(tool_d,canvas_pixwin,gc,points, npts, Complex, CoordModeOrigin); Again, this works in monochrome, but not in color. Note that I have explicitely set the color for foreground (and background) in the gc, but the colors on the screen are random. I have checked the actual values in the gc with dbx and they are ok. Is this a bug in the server implementation for the color vs2000? _____________________________________ Brian V. Smith (bvsmith@lbl.gov) Lawrence Berkeley Laboratory We don't need no stinking signatures!