info-mac@uw-beaver (info-mac) (08/29/84)
From: winkler@harvard.ARPA (Dan Winkler) I'm doing some animation of irregularly shaped objects myself. I rely mainly on the QuickDraw CopyBits routine which can do its copying clipped to a region. In other words, it can copy an arbitrary region from one place to another. So when moving an irregularly shaped object, I keep a copy of the object in an offscreen bitmap. To draw the object, I first save the bits it will cover in another offscreen bitmap. Then I use CopyBits to transfer the offscreen image of the object to the screen, clipping to the boundary of the object. To move the object, I replace the saved bits, save the soon-to-be-covered bits, and CopyBits it to its new position. This method gives reasonably fast and smooth animation of small objects using very little offscreen memory (less than 100 bytes for my application). Now, as a matter of fact, my animation is not as fast or smooth as Bill Atkinson's (small wonder). Part of that is explained by my writing in C and his writing in assembly. But he might be (and knowing him, probably is) using a smarter algorithm. He did say he keeps several copies of the entire screen around to let him do undo, which may allow methods not possible with very little offscreen memory.