This is a basic code simulation made out of basic javascript to simulate how an area in a pixel grid is filled using Boundary Fill algorithm.
Reference : https://www.tutorialspoint.com/computer_graphics/polygon_filling_algorithm.htm The boundary fill algorithm works as its name. This algorithm picks a point inside an object and starts to fill until it hits the boundary of the object. The color of the boundary and the color that we fill should be different for this algorithm to work.
In this algorithm, we assume that color of the boundary is same for the entire object. The boundary fill algorithm can be implemented by 4-connected pixels or 8-connected pixels.