forlang.hlp (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
COLORS.FOR
                                             Up Contents Index Back
────────────────────────────────────────────────────────────────────────────
 
      INCLUDE 'FGRAPH.FI'
 
      PROGRAM Colors
 
      INCLUDE 'FGRAPH.FD'
 
      INTEGER*2 loop, status
      REAL rnd1, rnd2
 
      status = setvideomode($MRES16COLOR)
      status = rectangle($GFILLINTERIOR, 80, 50, 240, 150)
      DO loop = 1, 8000
         status = setcolor(MOD(getcolor()+1, 16))  ! Set next color
C
C        Set a random pixel, but only if it is already on.
C
         CALL RANDOM(rnd1)
         CALL RANDOM(rnd2)
         IF (getpixel(INT2(rnd1*320), INT2(rnd2*200))
     +  .NE. 0) THEN
            status = setcolor(MOD(loop, 16))
            status = setpixel(INT2(rnd1*320), INT2(rnd2*200))
         END IF
      END DO
 
      status = setvideomode($DEFAULTMODE)
      END