• Courses
  • Tutorials
  • DSA
  • Data Science
  • Web Tech
July 31, 2024 |8.4K Views

Boundary Fill Algorithm in Computer Graphics

  Share  1 Like
Description
Discussion

In this video, we will see Boundary fill algorithm and its type in detail. The boundary fill algorithm starts from a pixel inside the polygon to be filled and paints the interior working outward towards the boundary. Basically, this algorithm works simplest if the colour with which the region must be filled and the colour of the boundary of the region are different. If the boundary is of 1 single colour, this method proceeds outwards pixel through pixel till it hits the boundary of the region. Boundary Fill Algorithm is recursive in nature. It takes an interior factor(x, y), a fill colour, and a boundary colour because of the input. The set of rules starts by checking the colour of (x, y). If its colour isn't always identical to the fill colour and the boundary colour, then it is painted with the fill colour and the character is known as all of the neighbours of (x, y). If a factor is observed to be of fill colour or of boundary colour, the characteristic does now no longer name its neighbour and returns. This technique keeps till all factors as much as the boundary colour for the region were tested. The boundary fill algorithm can be implemented by 4-connected pixels or 8-connected pixels. 1. 4-connected pixels algorithm: After painting a pixel, the function is called for four neighbouring points. These are the pixel positions that are right, left, above, and below the current pixel. Areas filled by this method are called 4-connected. 2. 8-connected pixels algorithm: For more complex diagrams we use this approach.The pixels to be tested are the 8 neighbouring pixels, the pixel on the right, left, above, below and the 4 diagonal pixels. Areas filled by this method are called 8-connected. Boundary fill algorithm: https://www.geeksforgeeks.org/boundary-fill-algorithm/