Skip to content

Commit bc96e78

Browse files
authored
Create Boundary Fill Algorithm
1 parent e960b29 commit bc96e78

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

Diff for: Boundary Fill Algorithm

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
2+
5. Boundary Fill Algorithm
3+
4+
//Boundary fill algorithm
5+
6+
#include<iostream.h>
7+
#include<graphics.h>
8+
#include<conio.h>
9+
voidbfill(intx,inty,intbcol,intfcol)
10+
{
11+
intccol = getpixel(x,y);
12+
if(ccol!=fcol&&ccol!=bcol)
13+
{
14+
putpixel(x,y,fcol);
15+
bfill(x+1,y,bcol,fcol);
16+
bfill(x,y+1,bcol,fcol);
17+
bfill(x-1,y,bcol,fcol);
18+
bfill(x,y-1,bcol,fcol);
19+
}}
20+
void main()
21+
{
22+
clrscr();
23+
intgd = DETECT,gm;
24+
initgraph(&gd,&gm,"C://TurboC3//BGI");
25+
cout<<"\t\tBoundary Fill Algorithm\t\t"<<endl;
26+
intl,t,r,b;
27+
cout<<"Enter the length of side of rectangle : "<<endl;
28+
cin>>l>>t>>r>>b;
29+
rectangle(l,t,r,b);
30+
intx,y;
31+
cout<<"Enter coordinate of any interior point : ";
32+
cin>>x>>y;
33+
bfill(x,y,15,10);
34+
getch();
35+
}

0 commit comments

Comments
 (0)