コード例 #1
0
ファイル: BoundaryFill4.c プロジェクト: moon2222/my_programs
void boundaryfill4(int x , int y,int IC)
{
    if(getpixel(x,y)!=IC && getpixel(x,y)!=2)
    {
        putpixel(x,y,IC);
        boundaryfill4( x+1,  y, IC);
        boundaryfill4( x-1,  y, IC);
        boundaryfill4( x,  y+1, IC);
        boundaryfill4( x, y-1, IC);
    }
}
コード例 #2
0
ファイル: main.cpp プロジェクト: viren-nadkarni/codu
void boundaryfill4(int x, int y, int fill, int boundary)
{
int current;delay(50);
current = getpixel(x,y);
if(current!=boundary && current!=fill)
{
putpixel(x,y,fill);
boundaryfill4(x+1,y,fill,boundary);
boundaryfill4(x-1,y,fill,boundary);
boundaryfill4(x,y+1,fill,boundary);
boundaryfill4(x,y-1,fill,boundary);
//delay(50);
}
}
コード例 #3
0
ファイル: BoundaryFill4.c プロジェクト: moon2222/my_programs
int main()
{
    int gd=DETECT,gm,min=0,maximum=0,c, location,loc, pp,  o,m,counter=0,ix,iy,BC,IC,FC;
    int p[100];
	int color=2;
    double t,m1;
    DWORD dwWidth = GetSystemMetrics(SM_CXSCREEN);
    DWORD dwHeight = GetSystemMetrics(SM_CYSCREEN);
    initwindow(dwWidth,dwHeight);
    int x0=dwWidth/2;
    int y0=dwHeight/2;
    int i,j,x[50],y[50];
    double xc[50],yc[50];

    for(i=0; i<dwHeight; i++)
        putpixel(x0,i,RED);

    for(j=0; j<dwWidth; j++)
        putpixel(j,y0,RED);

    int n;
    printf("Enter the number of coordinates or vertices \n");
    scanf("%d",&n);
    for(i=0;i<n;i++)
    {
        printf("Enter the %dth coordinate\n",i+1);
        scanf("%d",&x[i]);
        scanf("%d",&y[i]);
    }
    for(i=0;i<n;i++)
        printf("%d\t%d\n",x[i],y[i]);
    while(z!=(n-1))
    {
        line_draw(x[z],y[z],x[z+1],y[z+1],x0,y0,color);
        z++;
    }



    //Here
    printf("Enter interior cordinates ix and iy and fill colour \n");
    scanf("%d%d%d",&ix,&iy,&IC);
    boundaryfill4(x0+ix,y0-iy,IC);

    delay(40000);


    cleardevice();
    closegraph();

}
コード例 #4
0
ファイル: main.cpp プロジェクト: viren-nadkarni/codu
int main()
{
initwindow(400,400,"window");
//setbkcolor(WHITE);
//setcolor(BLACK);
//FLOOD FILL 4
rectangle(10,10,50,50);
floodfill4(30,30,BLUE,BLACK);
//FLOOD FILL 8
rectangle(110,10,150,50);
floodfill8(130,30,GREEN,BLACK);
//BOUNDARY FILL 4
circle(50,200,30);
boundaryfill4(50,200,RED,WHITE);
//BOUNDARY FILL 8
rectangle(200,20,250,50);
boundaryfill8(230,30,YELLOW,WHITE);
while(!kbhit())
delay(50);
return EXIT_SUCCESS;
}