The floodfill tool

Our Running Kid project features a character drawn on an animation layer. We will now fill in the background with the Floodfill tool (also called Paint Bucket, shortcut [F]).

Once the Floodfill tool has been selected, various options are proposed in the Paint bucket panel shown opposite:
- The color modes were discussed in lesson 2 and 10,
- The Smooth, Opacity, Gradient and Opacity mapping options were discussed in lesson 2.

We will therefore only take a closer look at the second section of the Paint bucket panel.

When using the traditional Fill option you choose a pixel in the current project window and then click on it. We refer to this pixel as the origin pixel.
The Fill option changes the color of neighboring pixels until it is prevented from progressing by the «border» pixels.

Opposite, the "border" pixels in black and the color dispersion from the origin pixel in blue.

The options indicated above allow you to choose the type of pixels to be used as a "barrier" for the Floodfill function (i.e. pixels which will not be modified after choosing this option).
Depending on your choice made in the Fill popup menu, the pixels considered to be "barrier" pixels will be those with:
* a different color from the original pixel color
* a different density
* a different color and density
* a different luminosity
* a color identical to the B color.

Depending on your choice in the Source popup menu, the pixels considered to be barrier pixels are located:
* on the current layer (by default)
* on all layers behind the current layer
* on all layers in front of the current layer
* on all layers displayed on the screen
It is therefore possible to color our running kid on a layer independent of its contours.
Let's take a look at the timeline below:
(in this case, the white pixels are transparent following a clean up of the animated footage)

Select the "Colors" layers, and choose "Above" as the source.
This will let you color the "Running kid" layer by using its outlines.
It is then possible to obtain the following result :

* The Range option enables you to numerically adjust the tolerance threshold for the aforementioned criteria (Fill shape menu).

For example, opposite, a green shape is drawn with an airbrush on a transparent surface with a checker background. The Floodfill option applied in the center of the circle with the color blue provides the image results shown below. (in all cases below, fill = color and opacity, expand = 0)

Range = 0 Range = 50 Range = 100 Range = 200 Range = 255

Progressively, it is noted that the tolerance to "border" pixels becomes less and less.

* The Expand option increases the size of the floodfill area to the number of pixels of your choice.
This enables you to limit the number of border pixels.

For example: you draw a green line with the airbrush. A left click with the Floodfill tool and the color blue and you will obtain the following results:

Expand = 0 Expand = 5 Expand = 10 Expand = 15 Expand = 20

Combine the two options Expand and Range to avoid the result indicated below left and to obtain the result below right.

* The Gap option allows you to avoid "overspills" when you try to fill a surface which is not completely closed.

Low values are used in the case of "small gaps", whereas high values are used for larger gaps (it is worth noting that higher values sometimes result in a lower floodfill quality).

Image with «a gap»
Floodfill the character without Gap closer
Floodfill the character with Gap closer