Re: Possible Win32Lib bug
- Posted by Derek Parnell <ddparnell at bigpond.com> Aug 27, 2004
- 424 views
Brian Broker wrote: > > I'm using setPenBrushColor() on a Pixmap so that I can draw black > objects that are filled with white. The problem with this approach is > that clearWindow() is now using that white brush to clear the window. > If I use setWindowBackColor() on my Pixmap, I can see that it's using > that background color for the pen but not the fill brush. Is this > expected behavior? Any suggestions on how to achieve what I want? > (black objects with white fill and default-color background) I'm trying > to avoid a lot of pen changing if I can. > > Would it be difficult to change the lib so that WindowBackColor and > PenBrushColor are two different things? They already are different. However, I'd forgotten that DrawRectangle uses the brush color rather than the pen color to fill the rectangle. Thus when using clearWindow() for Pixmaps, which uses a filled rectangle to clear it, I had a mistake that caused it to use pen rather than brush. The patch is to replace clearWindow() with ...
global procedure clearWindow( integer id) sequence lRect sequence lSavedBrushColor if not equal(window_bcolor, w32NoColor) then lRect = call_func(r_getRect,{id}) lSavedBrushColor = window_pen[id][PenBrushColor] -- Use Back color as temporary brush color. window_pen[id][PenBrushColor] = {window_bcolor[id]} call_proc(r_drawRectangle,{id, w32True, 0, 0, lRect[3], lRect[4]}) window_pen[id][PenBrushColor] = lSavedBrushColor end if return end procedure
-- Derek Parnell Melbourne, Australia