Path: utzoo!attcan!uunet!mcsun!inria!bull!echbull!cahors.Berkeley.EDU!francois From: Francois.Laagel@ec.bull.fr Newsgroups: comp.windows.x Subject: XDrawRectangle and stipples in GC. Keywords: X11R3, GC Message-ID: <351@echbull.bull.fr> Date: 29 May 90 08:17:50 GMT Sender: news@bull.bull.fr Organization: Bull SA, Echirolles France Lines: 71 I am writing a small widget set which is intended to be used to represent figures like histograms, pies charts and so on. One of my widgets needs a GC to redraw itself. The fill style must be FillStippled. XFillRectangle works with no trouble and uses the pixmap specified by the stipple member of the GC. But although O'Reilly Xlib programming manual states that XDrawRectangle doesn't care about stipples or tiles members of the GC, the fact is that my server (X11R3) uses the stipple even if the line_style member is set to LineSolid. So, what are the members of the GC which are meaningfull to XDrawRectangle as far as the line style is concerned ? Another question by the way, was is the diffrence between a thin line (gc.line_width == 0) and a wide line (gc.line_width == 1) ? Thanks in advance to anyone who could answer these few questions. Francois LAAGEL Here follows, two pieces of code concerning GC creation, and the Redisplay method of my widget. static void RecomputeGC(w) XmValueWidget w; { long valueMask; XGCValues gcValues; if(w->value.gc!=NULL) { XtReleaseGC(w,w->value.gc); w->value.gc=NULL; } valueMask=GCForeground | GCBackground | GCFillStyle | GCStipple | GCLineStyle | GCLineWidth; gcValues.foreground = w->value.foreground; gcValues.background = XtBackground(w); gcValues.fill_style = FillStippled; gcValues.stipple= stippleTable[w->value.stippleType].pixmap; gcValues.line_style=LineSolid; gcValues.line_width=0; w->value.gc=XtGetGC(w, valueMask, &gcValues); } static void Redisplay (w, event, region) XmValueWidget w; XEvent *event; Region region; { Display *display=XtDisplay(w); Window win=XtWindow(w); int width=XtWidth(w), height=XtHeight(w); XRectangle xr; #ifdef DEBUG fprintf(stderr,"Redisplay(%s)\n",XtName(w)); #endif if(w->core.visible) { XSetRegion(display, w->value.gc, region); xr.x=xr.y=(short)0; xr.width=(unsigned short)(width-1); xr.height=(unsigned short)(height-1); XDrawRectangles(display, win, w->value.gc,&xr,1); XFillRectangle(display, win, w->value.gc,1,1,width-2,height-2); XSync(XtDisplay(w), False); } }