/*- Flood fill algo. using user defined function -*/ /******************************************************/ #include #include #include void fill_right(x,y) int x , y ; { if((getpixel(x,y) != WHITE)&&(getpixel(x,y) != RED)) { putpixel(x,y,RED); fill_right(++x,y); x = x - 1 ; fill_right(x,y-1); fill_right(x,y+1); } } void fill_left(x,y) int x , y ; { if((getpixel(x,y) != WHITE)&&(getpixel(x,y) != RED)) { putpixel(x,y,RED); fill_left(--x,y); x = x + 1 ; fill_left(x,y-1); fill_left(x,y+1); } } /*------------------------------------------------------*/ void main() { int x , y ,a[10][10]; int gd, gm ,n,i; detectgraph(&gd,&gm); initgraph(&gd,&gm," "); printf("\n\n\tEnter the no. of edges of polygon : "); scanf("%d",&n); printf("\n\n\tEnter the cordinates of polygon :\n\n\n "); for(i=0;i