FIX: FLOODFILL Fails to Fill to the Boundary Color

Last reviewed: September 11, 1997
Article ID: Q71184
5.00 5.10 MS-DOS kbprg kbfixlist kbbuglist kbcode

The information in this article applies to:

  • Microsoft FORTRAN for MS-DOS, versions 5.0 and 5.1

SYMPTOMS

Programs compiled with Microsoft FORTRAN version 5.0 or 5.1 for MS-DOS that use the FLOODFILL graphics function may fail to fill an area to the boundary color.

The FLOODFILL function may stop filling an area when it encounters the fill color, instead of the boundary color.

RESOLUTION

To avoid this problem, remap the index of the fill color to a different color index using the REMAPPALETTE function. This method allows the FLOODFILL function to successfully fill over the existing fill color, right to the edge of the boundary color.

STATUS

Microsoft has confirmed this to be a problem in Microsoft FORTRAN versions 5.0 and 5.1 for MS-DOS. This problem was corrected in FORTRAN PowerStation.

MORE INFORMATION

The following example program illustrates the problem:

      INCLUDE 'FGRAPH.FI'
      INCLUDE 'FGRAPH.FD'

      INTEGER*2 dummy

      dummy = setvideomode($MAXRESMODE)
      dummy = setcolor(7)             ! White for rectangle border
      dummy = rectangle($GBORDER, 100, 100, 200, 200)
      dummy = setcolor(2)             ! Green to fill rectangle
      read (*,*)
      dummy = floodfill(120, 120, 7)  ! Fill to White border
      read (*,*)
      dummy = setcolor(4)             ! Red for 2nd rectangle border
      dummy = rectangle($GBORDER, 125, 80, 175, 250)

      dummy = setcolor(2)             ! Green to fill 2nd rectangle

      read (*,*)
      dummy = floodfill(150, 90, 4)   ! Fill to Red border
      read (*,*)
      dummy = setvideomode($DEFAULTMODE)
      END

Remapping a different color index to the fill color before calling FLOODFILL the second time will prevent the problem from occurring. The following program illustrates this solution:

      INCLUDE 'FGRAPH.FI'
      INCLUDE 'FGRAPH.FD'

      INTEGER*2 dummy

      dummy = setvideomode($MAXRESMODE)
      dummy = setcolor(7)             ! White for rectangle border
      dummy = rectangle($GBORDER, 100, 100, 200, 200)
      dummy = setcolor(2)             ! Green to fill rectangle
      read (*,*)
      dummy = floodfill(120, 120, 7)  ! Fill to White border
      read (*,*)
      dummy = setcolor(4)             ! Red for 2nd rectangle border
      dummy = rectangle($GBORDER, 125, 80, 175, 250)

      dummy = remappalette(3,$green)  ! Remap color index 3 to green

      dummy = setcolor(3)             ! Green to fill 2nd rectangle

      read (*,*)
      dummy = floodfill(150, 90, 4)   ! Fill to Red border
      read (*,*)
      dummy = setvideomode($DEFAULTMODE)
      END


Additional reference words: 5.00 5.10
KBCategory: kbprg kbfixlist kbbuglist kbcode
KBSubcategory: FORTLngIss
Solution Type : kbfix


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: September 11, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.