wendy@sunquest.UUCP (Wendy Debray) (09/19/90)
I have a question about drawing text over a filled rectangle that was drawn with a stipple pattern. The text appears to have pixels missing when compared to the same text just written in the window. Is this an illusion due to the stipple in the background or some other problem? The sample code below just uses Xlib routines. I create a gc that has a stipple pattern set & the FillStype set to FillStippled. This gc is used to fill a rectangle. A gc with the same background & foreground, and a font set is used to draw text over the filled rectangle. #define gray_width 2 #define gray_height 2 static char gray_bits[] = { 0x01, 0x02}; bground = WhitePixel (disp, DefaultScreen (disp)); fground = BlackPixel (disp, DefaultScreen (disp)); /*drawing gc */ drawgc = XCreateGC (disp, wind, 0, 0); XSetBackground (disp, drawgc, bground); XSetForeground (disp, drawgc, fground); stipple = XCreatePixmapFromBitmapData (disp,wind, gray_bits, gray_width, gray_height, fground, bground,1); XSetStipple (disp, drawgc, stipple); XSetFillStyle(disp, drawgc,FillStippled); /* text gc */ textgc = XCreateGC (disp, wind, 0, 0); XSetBackground (disp, textgc, bground); XSetForeground (disp, textgc, fground); fstruct = XLoadQueryFont(disp,"-adobe-times-bold-r-normal--24-240-75-75-p\ -132-\ iso8859-1"); XSetFont(disp,textgc,fstruct->fid); XFillRectangle(disp,wind,drawgc,0,0,300,100); XDrawString(disp,wind,textgc,10,30,"WRITE THIS",11); environment: Sun4, X11R3, R4 server, Xlib Any help or suggestions are appreciated. Wendy Debray wendy@sunquest.com