#include<stdio.h>
#include<conio.h>
#include<graphics.h>
#include<dos.h>
void boundary_fill(int x,int y,int fill_color,int boun_color)
{
int color;
color=getpixel(x,y);
if(color!=fill_color && color!=boun_color)
{
boundary_fill(x-1,y,fill_color,boun_color);
boundary_fill(x+1,y,fill_color,boun_color);
boundary_fill(x,y-1,fill_color,boun_color);
boundary_fill(x,y+1,fill_color,boun_color);
}
delay(30);
}
void main()
{
int gd=0,gm,fill=9,boun=15,x1,y1;
initgraph(&gd,&gm,"");
x1=5;
y1=5;
line(0,240,640,240);
line(320,0,320,480);
rectangle(320,225,325,240);
boundary_fill(x1,y1,fill,boun);
getch();
closegraph();
}
No comments:
Post a Comment