Classic Computer Magazine Archive ANTIC VOL. 3, NO. 6 / OCTOBER 1984


Graphics power in a 10-line program

Antic Technical Editor

The "spray-paint can" is one of the most popular features in the MacPaint program of Apple's Macintosh computer.  But your Atari can spray-paint just as well-and in colors too.
   I've never seen a drawing program for the Atari that includes a spray-paint feature, so I wrote this 10-line routine.  You can incorporate it into your own Graphics 8 drawing program to create finely shaded airbrush-type effects.  The spray works best on a black background.  It only works in GR.8 because of the lower resolution in the other graphics modes.
   The program spray-paints by randomly plotting four points within a range of plus-or-minus five pixels.  Continuous movement is fairly slow because eight points must be coordinated every time you move the joystick.  Antic Disk subscribers RUN "D:SPRAY.BAS".
   The size of the spray is controlled by the variable in line 5. To make the brush smaller, increase the value of DIV and decrease OFS.  Do the opposite to make the brush larger.

5 DIV=25:OFS=5
11 SETCOLOR 2,0,0
15 COLOR 1:PLOT 100,100:X=100:Y=100
16 S=STICK(0):IF S=15 THEN 16
20 X=X+(S<8)*(X<313)-(S>8 AND S<13)*(X>6)
30 Y=Y+(INT(S/4)*4=S-1)*(Y<153)-(INT(S/2)=S/2)*(Y>6)
45 FOR I=1 TO 4:PLOT X+(INT(PEEK(53770)/DIV)-OFS),Y+(INT(PEEK(53770)/DIV)-OFS)
50 GOTO 16

Listing: SPRAY.BAS Download