3

Boundary Fill Algorithm in Computer Graphics

 1 year ago
source link: https://www.geeksforgeeks.org/videos/boundary-fill-algorithm/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Boundary Fill Algorithm in Computer Graphics

Boundary Fill Algorithm in Computer Graphics
  • 17/06/2022

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/


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK