Name
FloodFill -- flood fill a brush area with a color (V2.0)
Synopsis
FloodFill(id, x, y, bordercolor, color[, t])
Function
This function can be used to flood fill a bordered area in the brush specified by id with a color. You need to pass a starting position in the x and y arguments. FloodFill() will then start out in all directions replacing all pixels with the specified color until it reaches the border color which you also have to specify. The starting position is usually an arbitrary point within the bounded area.

If the brush is a palette brush, FloodFill() will operate in pen mode instead of color mode. This means that both the bordercolor and the color arguments must be set to a pen index instead of an RGB color. In pen mode, FloodFill() will behave exactly as in RGB mode except that it will use pens instead of RGB colors.

Starting with Hollywood 9.0, you can also pass #NOCOLOR in the bordercolor argument. In that case, borderless flood filling will be used, which means that all neighbouring pixels matching the color (or pen) of the starting pixel will be filled.

Furthermore, Hollywood 9.0 introduces an optional table argument that allows you to specify the following options:

AlphaChannel:
If you set this tag to True, FloodFill() will operate on the brush's alpha channel instead of on its color channels. This means that you have to pass values in the range of 0 to 255 instead of RGB colors to FloodFill().

ColorSource:
If this and the AlphaChannel tag is set to True, the area to be filled will be determined by the color channels whereas all output will be written to the alpha channel. This means that the border color passed to FloodFill() must be an RGB color (or #NOCOLOR) and the fill color must be an alpha value between 0 and 255. (V9.1)

Inputs
id
brush to use for flood fill
x
start x-position for the fill operation
y
start y-position for the fill operation
bordercolor
color (or pen) of the border or #NOCOLOR for borderless flood filling
color
color (or pen) to use for filling
t
optional: table argument containing further options (V9.0)
Example
CreateBrush(1, 241, 201)
SelectBrush(1)
SetFillStyle(#FILLNONE)
Ellipse(0, 0, 120, 100, #RED)
EndSelect
FloodFill(1, 120, 100, #RED, #WHITE)
DisplayBrush(1, 0, 0)
Creates a red ellipse outline and then fills it with the color white using the FloodFill() command starting from the center of the ellipse in all directions.

Show TOC