Microsoft KB Archive/71184

= FIX: FLOODFILL Fails to Fill to the Boundary Color =

Article ID: 71184

Article Last Modified on 9/30/2003

-

APPLIES TO


 * Microsoft FORTRAN Compiler 5.0
 * Microsoft FORTRAN Compiler 5.1

-



This article was previously published under Q71184



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 query words: 5.00 5.10

Keywords: kbfix KB71184

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.