Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!purdue!ames!xanth!nic.MR.NET!umn-d-ub!gandreas From: gandreas@umn-d-ub.D.UMN.EDU (Glenn Andreas) Newsgroups: comp.sys.mac.programmer Subject: Re: Smoothly dragging small pictures Keywords: drag smooth copybits offscreen Message-ID: <1065@umn-d-ub.D.UMN.EDU> Date: 10 May 89 23:35:03 GMT References: <12492910881010@osu-20.ircc.ohio-state.edu> Reply-To: gandreas@ub.d.umn.edu.UUCP (Glenn Andreas) Organization: University of Minnesota, Duluth Lines: 30 In article <12492910881010@osu-20.ircc.ohio-state.edu> TALLEY-J@osu-20.ircc.ohio-state.edu (James T. Talley) writes: >Can anyone point me to information on dragging small pictures >(not grey outlines) on the screen? The pictures that need to be >dragged are slightly larger than icons. I wrote a routine that >uses an offscreen bitmap and copybits to save and restore the >existing screen image while I copybits the picture from place to >place. The problem is that there is a terrible flicker. Is >there a trick to getting rid of the flicker? Is there a better >way that I haven't thought of yet? Any help is appreciated. > >James Talley >talley-j@osu-20.ircc.ohio-state.edu One trick is to use TWO offscreen buffers. Keep the background screen image in one, and use the other as a temporary. What you do is when you want to move the image, union the rectangles of the old object position and the new object position, copying that rectangle from the background bitmap to the temporary. Draw your object onto the temporary, and then copybits that same rectangle onto the screen. The reason that your image flickers is that there are times that the screen is refreshed between the time you erase and the time you redraw, but with the two offscreen bitmaps, this is never a problem. I've tried it, and it is fast enough (it will be part of Theldrow version 3). =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= = "Whether you like it, or don't like it, sit | - gandreas@ub.d.umn.edu - = = back and take a look at it, because it's the | Glenn Andreas = = best going today! WOOOOoooo!" - Ric Flair | = =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=