[comp.sys.mac.programmer] help needed dragging a non-rectangular PICT

phil@mva.cs.liv.ac.uk (12/07/88)

Attention Mac Programming experts!

I'm writing a program in which I'd like to drag a PICT across a background,
and have it update the background as I move the item across it.  Just like
the way that MacPaint et al do.  Any hints or pointers to how to do it
would be most appreciated.  My thoughts were to draw the items in the
background to an offscreen bitmap and use copybits when an update is required
(faster than re-drawing individual items?), but how do I draw the non-
rectangular "dragged" item without it erasing all sorts of stuff - if you
know what I mean.

To would be mailers - the ukc gateway refuses to mail stuff on to me, all
I get is a tantalising message containing the subject line.  If the mail
comes through Earn then it's usually OK.

Phil Jimmieson,           ***************************************************
Computer Science Dept.,   *                                                 *
Liverpool University,     * JANET : PHIL@UK.AC.LIV.CS.MVA                   *
Merseyside, England,      * ARPA  : PHIL%mva.cs.liv.ac.uk@cunyvm.cuny.edu   *
L69  3BX                  *                                                 *
                          * old address SQPHIL@UK.AC.LIV.CSVAX may work     *
(UK) 051-794-3689         ***************************************************

DN5@PSUVM.BITNET (12/07/88)

Hi,

   To drag something across another pattern I use two off-screen bitmaps.
One is the background (I copy the background into this once, and then use
it as a constant), and the other is the work bitmap.  I copy the background
into the work bitmap, then put the irregular region where it should be on
this bitmap, then I CopyBits the work bitmap to the screen.

   This technique worked fast enough for me to rotate a simple polygon on
a MacPlus in real-time (as a student dragged it around) or as animation
(smooth, in 3 degree increments, which was the best comprimise of smoothness
and speed).  You will have to experiment to see how you want this to look,
but I suggest testing it on the slowest machine you have (something that
looks fast enought on a Mac II can look like a dog on a Plus).

                                      Jay, etc...