ManikanthKummarikunt
17,842 views
31 slides
May 20, 2018
Slide 1 of 31
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
About This Presentation
computer graphics
Size: 1.22 MB
Language: en
Added: May 20, 2018
Slides: 31 pages
Slide Content
For highlighting all the pixels inside the polygon,
2 approaches can be used-
1. Scan Fill
2. Seed Fill (Boundary Fill, Flood Fill )
Boundary Fill Algorithm
This algorithm picks a point inside the
polygon and starts to fill until it hits the
boundary of the object.
Assumption:
In this algorithm, we assume that color of the
boundary is same for the entire object.
Sometimes we want to fill in an area that is
not defined within a single color boundary.
We paint such areas by replacing a specified
interior color instead of searching for a
boundary color value. This approach is
called a flood-fill algorithm.
In brief:
Flood Fill and Boundary Fill are algorithms used for
coloring a given figure with a chosen color
Flood Fill is one in which all connected pixels of a
selected color get replaced by a fill color.
Boundary Fill is very similar with the difference being
the program stopping when a given color boundary is
found.
Boundary Fill Algorithm /Flood Fill
algorithm
The boundary fill algorithm/ flood fill algorithm can be
implemented by 4-connected pixels or 8-connected pixels.
4-connected 8-connected
Start Position
4-connected (Example)
3
2
1
1
2 3
14
2
4
2
1
1
2
2
1
51
5
1
1
1
Some region remains unfilled
Start Position
8-connected (Example)
415
2 3
5
4
3
2
1
6
41
2 3
6
4
3
2
1
78
41
2 3
8
7
4
3
2
1
11912
7 10
41
2 3
12
11
10
9
7
4
3
2
1
119
7 10
41
2 3
11
10
9
7
4
3
2
1
9
7 10
41
2 3
10
9
7
4
3
2
1
9
7
41
2 3
9
7
4
3
2
1
7
41
2 3
7
4
3
2
1
41
2 3
4
3
2
1
1
2 3
3
2
1
1
2
2
1
1
1
Comparison
Flood Fill Algorithm
Flood fill colors an entire area in an
enclosed figure through
interconnected pixels using a single
color
So, Flood Fill is one in which all
connected pixels of a selected color
get replaced by a fill color.
A flood fill may use an
unpredictable amount of memory
to finish because it isn't known how
many sub-fills will be spawned
Time Consuming
Boundary Fill Algorithm
Here area gets colored with pixels
of a chosen color as boundary this
giving the technique its name
Boundary Fill is very similar with
the difference being the program
stopping when a given color
boundary is found.
Boundary fill is usually more
complicated but it is a linear
algorithm and doesn't require
recursion
It is less Time Consuming