[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

That shimmering affect



   From: lynch@aristotle.ils.nwu.edu (Richard Lynch)
   Message-Id: <9106141710.AA12232@aristotle.ils.nwu.edu>
   To: info-macl@cambridge.apple.com
 
   Anybody know how to acheive that shimmering effect on the region being
   built by (open-region ) or any region for that matter.
   I'm talking about the way something looks in MacPaint et al when the lasso
   is being used to highlight it.
 
   PS  I'm NOT trying to garner the non-white space pict information within
   the region, I just want a region...
 
   "TANSTAAFL" Rich lynch@aristotle.ils.nwu.edu
 
Here's a guess at how HyperCard's lasso tool does it's work.  I've never
written code that does this, so I may have it partly wrong.
 
First calculate the "Mask Region" by doing an OpenRgn, FrameRgn of the
user's outline (as drawn with the lasso tool), then draw the picture
(want the lines and framed figures to get added to the region definition),
and CloseRgn.
 
Now, you need four patterns:
 
11101110
11011101
10111011
01110111
 
01110111
11101110
11011101
10111011
 
10111011
01110111
11101110
11011101
 
11011101
10111011
01110111
11101110
 
 
Note that as you go from one to the next, a loop back to the top, the bits
move to the right and down.
 
You need two off-screen temporary buffers.
Name them last-buf and this-buf
 
At each time step (you'll have to experiment with delays):
 
Clear this-buf
Select the next of the four patterns.
FrameRgn the "Mask Region" into the scratch buffer using the pattern.
XOR last-buf into this-buf.
XOR this-buf onto the screen.
Swap the assignments of this-buf and last-buf.