Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <graphics.h>
- void bfill(int x,int y,int fclr,int bclr){
- delay(1);
- int cur=getpixel(x,y);
- if(cur != fclr && cur!=bclr){
- putpixel(x,y,fclr);
- bfill(x,y+1,fclr,bclr);
- bfill(x-1,y,fclr,bclr);
- bfill(x,y-1,fclr,bclr);
- bfill(x+1,y,fclr,bclr);
- }
- }
- void main(){
- int gd=DETECT,gm=VGAMAX;
- int bdrcolor,fillcolor,x,y;
- int rectxa,rectya,rectxb,rectyb;
- printf("Enter the fillcolor & boundarycolor\nRED:%d\nBLUE:%d\nGREEN:%d\nYELLOW:%d\nWHITE:%d\nBLACK:%d",RED,BLUE,GREEN,YELLOW,WHITE,BLACK);
- scanf("%d %d",&fillcolor,&bdrcolor);
- printf("Enter rectangle:");
- scanf("%d %d %d %d",&rectxa,&rectya,&rectxb,&rectyb);
- printf("Enter points:");
- scanf("%d %d",&x,&y);
- initgraph(&gd,&gm,NULL);
- rectangle(rectxa,rectya,rectxb,rectyb);
- //polyfill((rectxa+rectxb)/2,(rectya+rectyb)/2);
- bfill(x,y,fillcolor,bdrcolor);
- getch();
- closegraph();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement