[comp.sys.mac] An interesting tidbit

dowdy@apple.UUCP (06/11/87)

The other day we were discussing how the MacPaint marquee was done,
and everyone kept coming up with strange and wonderful ideas involving
3 or 4 regions and VBL tasks and offscreen bitmaps.  Well, I didn't
think it was THAT hard, and without so much as a Macsbug peek at MacPaint
I came up with this little segment that sort of approximates what MacPaint
does.  (notice that mine goes up instead of down, but that's left as an
exercise for the reader, I wasnt about to redo the pattern again)

Written in LSP, run it with trace on to slow it down.  
No guarantees, but it might come in handy someplace.

PROGRAM Marquee;
{ An example of a MacPaint-like Marquee using 8 patterns}
{ Note: in reality, this pattern is backwards from the}
{ real MacPaint one, but that is simple to fix}
{ Tom Dowdy, Apple Computer}
VAR
r, r2 : rect; { Rectangles for fill and frame }
p : ARRAY[0..7] OF pattern; { Array of the 8 patterns }
i, j : integer; { Loop counters }
BEGIN
{ Initial pattern is a simple diagonal line, upper right to lower left}
{ 11100001 : 0}
{ 11110000 : 1}
{ 01111000 : 2}
{ 00111100 : 3}
{ 00011110 : 4}
{ 00001111 : 5}
{ 10000111 : 6}
{ 11000011 : 7}
p[0][0] := 128 + 64 + 32 + 1;
p[0][1] := 128 + 64 + 32 + 16;
p[0][2] := 64 + 32 + 16 + 8;
p[0][3] := 32 + 16 + 8 + 4;
p[0][4] := 16 + 8 + 4 + 2;
p[0][5] := 8 + 4 + 2 + 1;
p[0][6] := 128 + 4 + 2 + 1;
p[0][7] := 128 + 64 + 2 + 1;

{We shift each pattern off by one pixel from the previous pattern}
FOR i := 1 TO 7 DO
BEGIN
FOR j := 0 TO 6 DO
p[i][j] := p[i - 1][j + 1];
p[i][7] := p[i - 1][0];
END;
SetRect(r, 50, 50, 100, 100); { Define it here to slow down }
SetRect(r2, 120, TIL 0 = 1; {do forever}
END.

===========================================================================
  Tom Dowdy                 CSNET:    dowdy@apple.CSNET
  Apple Computer            Internet: dowdy@apple.COM
  20525 Mariani Ave         MoneyNet: (408) 973-6689
  Cupertino, CA 95014       AppleLink:DOWDY1
  MS: 27Y                   UUCP:     {sun,voder,amdahl,decwrl}!apple!dowdy
  "Plus ca change, Plus c'est la meme chose."
===========================================================================