Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!caip!elbereth!rutgers!princeton!chiu From: chiu@princeton.UUCP (Kenneth Chiu) Newsgroups: net.micro.amiga Subject: clearing a window Message-ID: <1964@princeton.UUCP> Date: Sun, 12-Oct-86 00:39:56 EDT Article-I.D.: princeto.1964 Posted: Sun Oct 12 00:39:56 1986 Date-Received: Sun, 12-Oct-86 13:27:18 EDT Reply-To: chiu@princeton.UUCP (Kenneth Chiu) Distribution: net Organization: Princeton University Computer Science Department Lines: 54 Is there a simple, efficient, reliable way to clear a window? What I did was something like this: pen = window->RPort->FgPen; mode = window->RPort->DrawMode; SetAPen(window->RPort, 0L); SetDrMd(window->RPort, JAM1); xmin = window->BorderLeft; ymin = window->BorderTop; xmax = window->Width - window->BorderRight - 1; ymax = window->Height - window->BorderBottom - 1; RectFill(window->RPort, xmin, ymin, xmax, ymax); window->RPort->FgPen = pen; window->RPort->DrawMode = mode; Now, as I understand the manual, the RectFill function doesn't use any of the fancy area fill data structures (like AreaInfo, or TmpRas), so I don't have to worry about these. The only thing wrong with this fragment is that the AreaPtrn is NOT guaranteed to be all 1's, am I correct? So if I save the AreaPtrn information, do SetAfPt, then the Rectfill, and restore the AreaPtrn information, then will this be robust? But do I need to save and restore any of the old information at all? In other words, does Intuition expect that nobody will change this data, or does it reset it everytime it does something? (Will it possibly "lose" the AreaPtrn array somewhere in my measly 512K?) Lastly, I don't quite understand the intention of the Designers with regard to some of these functions. More specifically, is it necessary, or even desireable to use SetAPen(rp, color) instead of rp->FgPen = color. Some of the "functions" are implemented as macros (e.g. SetAfPt). SetAPen seems to be a function, however, since I can't find it in any of the graphics include files. Perhaps they want us to use these functions/macros to maintain compatibility, but they haven't provided a complementary set of functions/macros to extract the information. What I really want to do is to refresh a window's gadgets. RefreshGadgets redraws them, and RemoveGadget takes them out of the list, but no function seems to >erase< the ones that are no longer. So I am resorting to clearing the window and then calling RefreshGadgets. Alternativeely, if I could find some way to redraw a window's borders and system gadgets, then I could use SetRast, which is probably fast as lightning. Perhaps I can't see the forest for the trees, and there is some really easy way to do this. Surely other people have wanted to do this same thing. Hope I have not been too verbose. -- Kenneth Chiu UUCP: princeton!chiu Princeton University Computer Science Department BITNET: 6031801@PUCC