PROGRAM LineFillPats

? Program demonstrates Line and Fill Patterns in F-Basic
? Notice the DELAY statements to allow viewing time
? Adapted from Amazing Computing, Vol.2 #9, p.78
? Original Author: Bryan D. Catley

INTEGER S1,W1,Black,Red,Yellow,Green,Cyan,Magenta,Blue,White
WORD Pat(8)

S1=SCREEN#2 (0,200,3,1,0)  ; ? full lo-res screen w/o title
W1=WINDOW#2 (0,0,320,200,0,0,0,0,-1,-1,0,0,2)

COLOR_DEFINE #0(0,0,0)    ; Black=0
COLOR_DEFINE #1(15,0,0)   ; Red=1
COLOR_DEFINE #2(15,15,0)  ; Yellow=2
COLOR_DEFINE #3(0,15,0)   ; Green=3
COLOR_DEFINE #4(0,15,15)  ; Cyan=4
COLOR_DEFINE #5(15,0,15)  ; Magenta=5
COLOR_DEFINE #6(0,0,15)   ; Blue=6
COLOR_DEFINE #7(15,15,15) ; White=7

CURS_INV
COLOR_PENS (White,Black)
SCR_CLER

? draw circle
COLOR_PENS (Blue,White)
COLOR_PATTERN (f0f0'16,-1,-1,-1)
COLOR_ELLIPSE (60,120,40,40)
DELAY(20)

? draw and fill triangle
Pat(1)=3c0'16 ; Pat(2)=3c0'16 ; Pat(3)=ffff'16 ; Pat(4)=ffff'16
COLOR_PATTERN (f0f0'16,@Pat,2,-1)
COLOR_PENS (Yellow,Magenta)
COLOR_AREA (160,112) ; COLOR_RAREA (-56,56) ; COLOR_RAREA (112,0)
COLOR_AREAFILL
DELAY(20)

? draw patterned line
COLOR_PENS (Green,Blue)
COLOR_PATTERN (aaaa'16,-1,-1,-1)
COLOR_LINE (0,160,72,256,178)
DELAY(20)

? draw and fill circle
Pat(1)=f000'16 ; Pat(2)=f00'16 ; Pat(3)=f0'16 ; Pat(4)=f'16
Pat(5)=f'16    ; Pat(6)=f0'16  ; Pat(7)=f00'16; Pat(8)=f000'16
COLOR_PATTERN (aaaa'16,@Pat,3,-1)
COLOR_PENS (Blue,Yellow)
COLOR_ELLIPSE (272,104,32,32)
COLOR_FLOOD (272,104,-1)
DELAY(20)

? fill rectangle with random pattern
RANDOMIZE(23)  ; ? randomize based on time of day & 23
FOR N=1 TO 8
   Pat(N)=RANDOM()\32000
NEXT N
COLOR_PATTERN (fff0'16,@Pat,3,-1)
COLOR_PENS (Yellow,Red)
COLOR_BOXFILL (0,16,16,296,56)
DELAY(20)

CURS_LOC(24,14)
PRINT "And So It Goes"
DELAY(20)

WINDOW_CLOSE #2
SCREEN_CLOSE #2
END
