
Taken from the book understanding Computer Graphics. The program was written for several computers, not the QL. Do to the QL capabilities, I added the scale command and 3 demos.
To use the program is fairly easy . The main menu gives three option, 1= DRAW, 2=VIEW, 3=DEMO. To use view you must choose 1 or 3 first. Once you choosen and viewed a drawing you can review the drawing by choosing view.
DRAW: Allows you to draw two picture useing 7 lines each. If you want to draw a more complicated drawing change 7 in line 20 to any number you want. When you choose this option a tiny dot will appear. Move it to the position you want the shape to start useing the arrow keys or a joytick,and press the space bar or fire button. Move to the next position and press the space bar or fire button to draw a line. Continue doing this to make your drawing. When finished, you will make your second drawing. Now choose view.
VIEW: Allows two ink colors, scale, and how many in-betweens. You are in mode 4, your colors are 2,4,7,0 . Scale start at 100 and go up. For in between start with 8 or 10. You can go up or down.
5 MODE 4:WINDOW 512,256,0,0:PAPER 0:INK 7:CLS
6 c1=7:c2=7
10 WINDOW 420,200,40,26:PAPER 0:INK 7:CLS:BORDER 2,7,0,3
15 OPEN#5;CON_420X13A40X13:PAPER#5;0:INK#5;4:CLS#5:BORDER#5;1,7
20 l=7
30 wi=132
40 hi=100
50 cx=wi/2
60 cY=hi/2
70 mx=wi/100
80 my=hi/100
90 DIM xx(l,2):DIM yy(l,2):GO TO 140
100 CLS
110 GO SUB 760
140 INPUT#5;"Choice: 1=DRAW 2=VIEW 3=DEMO >";d$
150 CLS
160 LET x=0
170 y=cY
180 POINT x,y:xa=x:ya=y
190 IF d$="1" THEN GO SUB 220
200 IF d$="2" THEN GO SUB 760:GO SUB 480
205 IF d$="3" THEN GO SUB 900
210 GO TO 120
220 SCALE 100,0,0:FOR j=1 TO 2
230 i=1:v=0:w=0:z=1
240 CLS
250 GO SUB 690
260 q=CODE(INKEY$(-1))
270 IF q=208 THEN w=my
280 IF q=216 THEN w=-my
290 IF q=192 THEN v=-mx
300 IF q=200 THEN v=mx
310 INK c1
320 x=x+v
330 y=y+w
340 IF x<0 THEN x=0
350 IF y<0 THEN y=0
360 IF x>wi THEN x=wi
370 IF y>hi THEN y=hi
380 OVER -1:POINT xa,ya:OVER 0:POINT x,y:xa=x:ya=y
390 IF q=32 THEN GO SUB 640:IF z=1 THEN x=xa:z=0
420 POINT x,y
430 v=0
440 w=0
450 IF i<l+1 THEN GO TO 260
460 END FOR j
470 RETurn
480 INPUT#5;"HOW MANY IN-BETWEEN SHAPES? >";f
490 FOR z=0 TO f
500 CLS#5:PRINT#5;"FRAME NO. ";z+1
505 FOR i=2 TO l
510 xa=(xx(i-1,1)*(f-z)+xx(i-1,2)*z)/f
520 ya=(yy(i-1,1)*(f-z)+yy(i-1,2)*z)/f
550 x=(xx(i,1)*(f-z)+xx(i,2)*z)/f
560 y=(yy(i,1)*(f-z)+yy(i,2)*z)/f
570 INK c1
580 IF z<1 OR z>f-1 THEN INK c2
590 LINE xa,ya TO x,y
600 END FOR i
620 END FOR z
630 RETurn
640 xx(i,j)=x
650 IF i=1 THEN POINT x,y:x=x+mx
660 yy(i,j)=y
670 IF i>1 THEN LINE xx(i-1,j),yy(i-1,j) TO xx(i,j),yy(i,j)
680 i=i+1
690 CLS#5:PRINT#5;"SHAPE ";j;" : POINTS LEFT ";l+1-i
700 RETurn
760 INPUT#5,"FIRST INK COLOR >";c1
780 INPUT#5,"SECOND INK COLOR >";c2
800 INPUT#5,"SCALE (MIN. 100) >";sl
805 IF sl<100 THEN GO TO 800
810 SCALE sl,0,0
820 RETurn
900 INPUT#5;"DEMO (1-3) >";dm$
905 IF dm$="1" THEN RESTORE 960
910 IF dm$="2" THEN RESTORE 965
915 IF dm$="3" THEN RESTORE 970
920 BEEP 3000,10
940 FOR k=1 TO 7
945 READ r,s,t,u
950 xx(k,1)=r:xx(k,2)=s:yy(k,1)=t:yy(k,2)=u
955 END FOR k
960 DATA 9.24,96.36,77,33,10.56,108.24,96,48,34.32,117.48,96,32,34.32,130.68,72,24
961 DATA 9.24,117.48,77,11,9.24,100.32,77,1,9.24,96.36,77,33
965 DATA 39.6,93.72,54,28,30.36,120.12,80,39,48.84,120.12,80,16,39.6,93.72,54,28
966 DATA 39.6,68.64,28,28,30.36,68.64,28,34,47.52,68.64,28,23
970 DATA 26.4,91.08,50,9,26.4,91.08,73,32,33,129.36,73,32,33,129.36,50,9
971 DATA 26.4,91.08,50,9,26.4,91.08,50,9,26.4,91.08,50,9
995 BEEP 2000,30
999 RETurn
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.