In this video, we will see Flood Fill Algorithm in computer graphics. Firstly it starts from a specified interior point (x, y) and reassigns all pixel values that are currently set to a given interior color with the desired fill color. Suppose the area we want to paint has more than one interior color, then we can first reassign pixel values. So that all interior points have the same color.
Apart from that we can use a connected or 8-connected method to fill the object. This algorithm is also known as the “Seed Fill algorithm”.
This is an algorithm that determines the area that are connected to a given node in a multi-dimensional array.
Examples for Flood Fill Algorithms are as follows:
1) Puzzle games
2) Paint programs
The flood fill algorithm takes three parameters:
1. Start node
2.Target color
3. Replacement color
Working principle of Flood Fill Algorithm:
Step 1: Take the position of the starting point.
Step 2: Decide whether you want to go in 4 directions (N, S, W, E) or 8 directions (N, S, W, E, NW, NE, SW, SE).
Step 3: Choose a replacement color and a target color.
Step 4: Travel in those directions.
Step 5: If the tile you land on is a target, replace it with the chosen color.
Step 6: Repeat 4 and 5 until you’ve been everywhere within the boundaries.
Flood fill algorithm:
https://www.geeksforgeeks.org/flood-fill-algorithm-implement-fill-paint/
https://www.geeksforgeeks.org/flood-fill-algorithm/