Personal Computer News


Recolouring Tips For The QL

 
Published in Personal Computer News #094

Recolouring Tips For The QL

I have used the SQUARE and CIRC procs explained by Alan Turnbull (issue 88) as a basis for a demonstration of the power of the RECOL command. Once the filled picture has been drawn RECOL is first used (line 490) in the obvious way to cycle around all the colours.

A less obvious use (line 510) is to shift the colours down so that the picture gradually disappears, leaving behind intricate shapes, where the original build-up had eaten into previous colours.

100 REMmark Dec '84/recol_demo
110 REMark Adapted by Peter Edwards
120 REMark Square,Circ by A. Turnbull
130 :
140 MODE 8:PAPER 0:CLS
150 REPeat main
160  FOR order=4 TO 6
170   SQUARE 74,50,48,order
180   recolour order
190   circ 80,50,32,order
200   recolour order
210  END FOR order
220 END REPeat main
230 :
240 DEFine PROCedure SQUARE(x,y,l,o)
250  IF o>0 THEN 
260   INK o:FILL 1:LINE x-l/2,y-l/2 THEN x+l/2,y-l/2 TO x+l/2,y+l/2 TO x-l/2,y+l/2 
TO x-l/2,y-l/2:FILL 0
270   SQUARE x-l/2,y-l/2,l DIV 2,0-1
280   SQUARE x+l/2,y-l/2,l DIV 2,0-1
290   SQUARE x+l/2,y+l/2,l DIV 2,0-1
300   SQUARE x-l/2,y+l/2,l DIV 2,0-1
310  END IF
320 END DEFine
330 :
340 :
350 DEFine PROCedure circ(x,y,r,o)
360  IF o>0 THEN
370   INK o:FILL 1:CIRCLE x,y,r:FILL 0
380   circ x+r/SQRT(2),y+r/SQRT(2),r DIV 2,0-1
390   circ x-r/SQRT(2),y+r/SQRT(2),r DIV 2,0-1
400   circ x-r/SQRT(2),y-r/SQRT(2),r DIV 2,0-1
410   circ x+r/SQRT(2),y-r/SQRT(2),r DIV 2,0-1
420  END IF
430 END DEFine
440 :
450 :
460 DEFine PROCedure recolour(limit)
470  FOR j=1 TO limit
480   FOR k=1 TO 7
490    RECOL 0,2,3,4,5,6,7,1
500   END FOR k
510   RECOL 0,0,1,2,3,4,5,6
520  END FOR j
530 END DEFine

Peter Edwards
Headington Quarry, Oxford

Peter Edwards