下面是引用cmovies于2006-05-3 16:46发表的 :
ptr2 = (Byte*) Image2->Picture->Bitmap->ScanLine[row];
-> Image2 从哪里来?
在 Button4Click 中 Image1 的 PixelFormat 没有设定, 但程式内好像当成 pf8bit 来用?
呵~今天下午在学校时~
也刚好在重新整理时有发现...
可是却也出了令一个问题= =
其他的都跟前者一样~@@
低通时~却无法完整扫完= =
不知道是不是他扫图时...
连rgb值也考虑近去了???
所以无法正常???还是...
目前写的程式复制程式
void __fastcall TForm1::Button4Click(TObject *Sender)
{
int low,up,down,left,right,col,row;
Byte *ptr2, *tptr, *uptr, *dptr;
if(Image2->Picture->Bitmap->Empty)
Image2->Picture->Bitmap=Image1->Picture->Bitmap;
for (row=0; row<Image2->Picture->Height; row++)
{
up =row-1;
if(up<0)
up=Image2->Picture->Height -1; //发现小于min(Height),则取max(Height)来使用
down =row+1;
if(down==Image2->Picture->Height)
down=0; //发现大于max(Height),则取min(Height)来使用
uptr = (Byte*) Image2->Picture->Bitmap->ScanLine[up];
tptr = (Byte*) Image2->Picture->Bitmap->ScanLine[row];
dptr = (Byte*) Image2->Picture->Bitmap->ScanLine[down];
for (col=0; col<Image2->Picture->Width; col++)
{
left =col-1;
if(left<0)
left=Image2->Picture->Width -1;//发现小于min(width),则取max(width)来使用
right =col+1;
if(right==Image2->Picture->Width)
right=0; //发现大于max(width),则取min(width)来使用
low = (int)(uptr[left] +uptr[col] +uptr[right]+
tptr[left] +tptr[col] +tptr[right]+
dptr[left] +dptr[col] +dptr[right] );
low=low/9;
tptr[col]= (Byte)(low);
}
}
//ShowMessage(col);
Repaint();
}