Developer Guide and Reference

ID 767251
Date 10/31/2024
Public
Document Table of Contents

FLOODFILL, FLOODFILL_W

Graphics Functions: Fill an area using the current color index and fill mask. These routines are only available for Windows.

Module

USE IFQWIN

result = FLOODFILL (x,y,bcolor)

result = FLOODFILL_W (wx,wy,bcolor)

x, y

(Input) INTEGER(2). Viewport coordinates for fill starting point.

bcolor

(Input) INTEGER(2). Color index of the boundary color.

wx, wy

(Input) REAL(8). Window coordinates for fill starting point.

Results

The result type is INTEGER(2). The result is a nonzero value if successful; otherwise, 0 (occurs if the fill could not be completed, or if the starting point lies on a pixel with the boundary color bcolor, or if the starting point lies outside the clipping region).

FLOODFILL begins filling at the viewport-coordinate point ( x, y). FLOODFILL_W begins filling at the window-coordinate point ( wx, wy). The fill color used by FLOODFILL and FLOODFILL_W is set by SETCOLOR. You can obtain the current fill color index by calling GETCOLOR. These functions allow access only to the colors in the palette (256 or less). To access all available colors on a VGA (262,144 colors) or a true color system, use the RGB functions FLOODFILLRGB and FLOODFILLRGB_W.

If the starting point lies inside a figure, the interior is filled; if it lies outside a figure, the background is filled. In both cases, the fill color is the current graphics color index set by SETCOLOR. The starting point must be inside or outside the figure, not on the figure boundary itself. Filling occurs in all directions, stopping at pixels of the boundary color bcolor.

NOTE:

The FLOODFILL routine described here is a QuickWin routine. If you are trying to use the Microsoft* Platform SDK version of the FloodFill routine by including the IFWIN module, you need to specify the routine name as MSFWIN$FloodFill.

Example

USE IFQWIN
INTEGER(2) status, bcolor, red, blue
INTEGER(2) x1, y1, x2, y2, xinterior, yinterior
x1 = 80; y1 = 50
x2 = 240; y2 = 150
red = 4
blue = 1
status = SETCOLOR(red)
status = RECTANGLE( $GBORDER, x1, y1, x2, y2 )
bcolor = GETCOLOR()
status = SETCOLOR (blue)
xinterior = 160; yinterior = 100
status = FLOODFILL (xinterior, yinterior, bcolor)
END