測試 |
缺席
|
god12dog
一般會員 發表:14 回覆:3 積分:3 註冊:2007-12-14 發送簡訊給我 |
〔Code〕 int f=0,g=0,h=0,i,j,x,y,p=0,q=0,r=0,s=0,x0,y0,have=0; int flag=1; Byte *ptr1, *ptr2, *ptr3, *ptr_1, *ptr_2, *ptr_3, *ptr_4, *ptr_5; Bitmap4->Assign(Bitmap2); Bitmap4->Height=Image1->Height; Bitmap4->Width=Image1->Width; for(y=0;y<=Bitmap4->Height-1;y ) { ptr1=(Byte *)Bitmap4->ScanLine[y]; for(x=0;x<=Bitmap4->Width-1;x ) { if(ptr1[x*3]!=0) { ptr1[x*3]=255; ptr1[x*3 1]=255; ptr1[x*3 2]=255; } else { ptr1[x*3]=0; ptr1[x*3 1]=0; ptr1[x*3 2]=0; } } } while(1) { x=1; y=1; ptr1=(Byte *)Bitmap4->ScanLine[y]; while(ptr1[x*3]!=255) { if(x==Bitmap4->Width-2 && y==Bitmap4->Height-2) { have=1; break; } if(x==Bitmap4->Width-1) { x=0; y ; } x ; ptr1=(Byte *)Bitmap4->ScanLine[y]; } if(have==1) { break; } y0=y; ptr1[x*3]=flag; ptr1[x*3 1]=flag; ptr1[x*3 2]=flag; for(y=y0;y<=Image1->Height-2;y ) { ptr2=(Byte *)Bitmap4->ScanLine[y]; for(x=1;x<=Image1->Width-2;x ) { if(ptr2[x*3]==flag) { for(j=y-1;j ptr_1=(Byte *)Bitmap4->ScanLine[j]; for(i=x-1;i if(ptr_1[i*3]==255) { ptr_1[i*3]=flag; ptr_1[i*3 1]=flag; ptr_1[i*3 2]=flag; } } } } } ptr2=(Byte *)Bitmap4->ScanLine[y]; for(x=Image1->Width-2;x>=1;x--) { if(ptr2[x*3]==flag) { for(j=y-1;j ptr_2=(Byte *)Bitmap4->ScanLine[j]; for(i=x-1;i if(ptr_2[i*3]==255) { ptr_2[i*3]=flag; ptr_2[i*3 1]=flag; ptr_2[i*3 2]=flag; } } } } } } flag ; } for(j=1;j for(y=0;y<=Bitmap4->Height-1;y ) { ptr_4=(Byte *)Bitmap4->ScanLine[y]; for(x=0;x<=Bitmap4->Width-1;x ) { if(ptr_4[x*3]==j) { ptr_4[x*3]=50; ptr_4[x*3 1]=255; ptr_4[x*3 2]=255; p =x; q ; r =y; s ; } } } int xx=p/q; int yy=r/s; for(int b=yy-1;b<=yy 1;b ) { ptr_5=(Byte *)Bitmap4->ScanLine[b]; if(b==yy-1) { ptr_5[xx*3]=0; ptr_5[xx*3 1]=0; ptr_5[xx*3 2]=255; } if(b==yy) { for(int a=xx-1;a<=xx 1;a ) { ptr_5[a*3]=0; ptr_5[a*3 1]=0; ptr_5[a*3 2]=255; } } if(b==yy 1) { ptr_5[xx*3]=0; ptr_5[xx*3 1]=0; ptr_5[xx*3 2]=255; } } p=q=r=s=0; } Image1->Picture->Assign(Bitmap4);
〔/Code〕 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |