dowdy@apple.UUCP (06/11/87)
Seems I left off a piece of the code. Mustnt have copied it into the clipboard right...Here is the complete program. Sorry all. 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); SetRect(r2, 120, 50, 170, 100); REPEAT FOR i := 0 TO 7 DO BEGIN PenPat(p[i]); PenMode(notPatBic); PaintRect(r); PenMode(patCopy); FrameOval(r); FrameRect(r2); END; UNTIL 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." ===========================================================================
leeke@glacier.UUCP (06/15/87)
In article <164500038@uiucdcsb> liberte@uiucdcsb.cs.uiuc.edu writes: > >> /* Written 4:21 pm Jun 10, 1987 by dowdy@apple.UUCP in uiucdcsb:comp.sys.mac */ >> 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} > >Does this version solve the problem of the disappearing marquee? >I have a version that uses just one pattern and shifts it each time >through the loop. Works just fine except that depending on how large >the marquee is, part of it might be invisible for part of the time >resulting in an annoying flicker. The MacPaint marquee is very smooth. >I played with trying to synchronize it with the verticle retrace >but did not succeed. > > >Dan LaLiberte >liberte@a.cs.uiuc.edu >uiucdcs!liberte I had the problem of a flickering marquee and while this isn't the most elegant fix it seems to work. First, this idea is not mine, it is from Scott Knaster's book on Writing Macintosh Software. Scott call this "poor man's animation", simply stated, the first change after a vertical scan is to increment TickCount and since you don't want to draw during the trace the best time to draw the rectangle is during the vertical return time. Hence, just do something like the following: ticks := TickCount; while (ticks = TickCount) do ; (* Vertical return NOW *) drawMarquee; ... MacPaint probably does it in ASM, but this gives a relatively flicker-free rectangle in a hll. Hope this helps in some way, Steve Leeke -- Steven D. Leeke, Center for Integrated Systems, Stanford University {ucbvax,decvax}!decwrl!glacier!leeke, leeke@glacier.stanford.edu "I suppose they don't use money in the 23rd century?"