Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!wuarchive!uunet!rosie!trouble2 From: jmartin@trouble2 (Jeff Martin) Newsgroups: comp.sys.next Subject: Re: How do you draw lines into the current view for Rubberbanding Message-ID: <803@rosie.NeXT.COM> Date: 22 May 91 21:07:42 GMT References: <507@heaven.woodside.ca.us> Sender: news@NeXT.COM Lines: 32 Nntp-Posting-Host: trouble2.next.com In article <507@heaven.woodside.ca.us> glenn@heaven.woodside.ca.us (Glenn Reid) writes: > Peter King writes > > > Check out instance drawing. Here's a little snippet of code that does > > temporary line drawing in response to a mouse-down method. > > [ code omitted ] > > > This causes a little bit of flicker (acceptable when rubber-banding). If you > > want to avoid the flicker, then you'd need to do double-buffering with > > off-screen windows and compositing. I'll leave this as an exercise for the > > reader. > > I'm curious; why isn't instance drawing implemented to avoid flickering in > the manner you suggest? It seems that this would be a better > implementation, and just as easy, unless I'm missing something. The answer is memory consumption and compositing overhead. Every window would have to have two buffers, one that holds the real image (secondary) and one that holds that image with some type of overlay (primary) (imagine how much more memory the system would need!). Then at each step you would have to update the primary buffer from the secondary buffer, draw the overlaying graphics, then flush the primary buffer to the screen. Flickering is the trade-off for saving memory and time. Instance drawing should be used sparingly - and just for wireframes and such in response to user actions with the mouse. Memory is the highest commodity on the NeXT. Instance drawing is a good solution for many apps.