chiu@princeton.UUCP (Kenneth Chiu) (10/12/86)
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
carolyn@cbmvax.cbm.UUCP (Carolyn Scheppner) (10/15/86)
In article <1964@princeton.UUCP> chiu@princeton.UUCP (Kenneth Chiu) writes: > >Is there a simple, efficient, reliable way to clear a window? If you are in a CON: window or in an Intuition window with a console device attached, just output a CTRL-L. If you have an Intuition GIMMEZEROZERO window with no console device, SetRast() should do it. If it's not a GIMMEZEROZERO I believe SetRast() will also wipe out your borders. -- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Carolyn Scheppner -- CBM >>Amiga Technical Support<< UUCP ...{allegra,caip,ihnp4,seismo}!cbmvax!carolyn PHONE 215-431-9180 =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
dale@amiga.UUCP (Dale Luck) (10/16/86)
In article <1964@princeton.UUCP> chiu@princeton.UUCP (Kenneth Chiu) writes: > > <lot of code here that I cut out> > >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? Don't forget about the writemask rp->Mask = -1; > >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. Intuition does not touch your rastport, that is yours to play with. > >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. You got it, if there is a specific function to do something your should use it. You don't know what other things are done besides just poking the new pen number into the rastport. In the case of SetAPen(rp,c) a new set of Minterms is generated for that RastPort. Most drawing functions use the Minterms >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. jimm really needs to handle some of these problems, he may have better answers as to what you 'should' do. Check out the 1.2 docs, maybe you'll find some goodie there. Dale Luck