全國最多中醫師線上諮詢網站-台灣中醫網
發文 回覆 瀏覽次數:892
推到 Plurk!
推到 Facebook!

dither metrix的問題

缺席
bvd
一般會員


發表:9
回覆:12
積分:4
註冊:2006-10-31

發送簡訊給我
#1 引用回覆 回覆 發表時間:2006-11-06 22:01:32 IP:124.8.xxx.xxx 訂閱
我寫的一個dither metrix如下::
void __fastcall TForm1::N2x21Click(TObject *Sender)
{
Graphics::TBitmap *Tempimage;
int i,j;
int a[512][512];
int x,y;
float r,g,b;
float gray;
Byte *ptr;
Tempimage=Image1->Picture->Bitmap;
for (i=0;i<512;i =2)
{
for (j=0;j<512;j =2)
{
a[i][j]=1;
a[i][j 1]=3;
}
}
for (i=1;i<512;i =2)
{
for (j=0;j<512;j =2)
{
a[i][j]=4;
a[i][j 1]=2;
}
}
for (i=0;i<512;i )
{
for (j=0;j<512;j )
{
for (y=0;y<512;y )
{
ptr=(Byte*)Tempimage->ScanLine[y];
for (x=0;x<512;x )
{
b=ptr[x*3];
g=ptr[x*3 1];
r=ptr[x*3 2];
gray=0.299*r 0.587*g 0.114*b;
if (gray {
ptr[x*3]=ptr[x*3 1]=ptr[x*3 2]=0;
}
else
{
ptr[x*3]=ptr[x*3 1]=ptr[x*3 2]=255;
}
}
}
}
}
Image1->Picture->Assign(Tempimage);

}
compile的時候是沒出現error,可是在執行時,又出現有stack overflow的錯誤視窗,每次碰到這種情況
我就不會解,所以想請各位幫忙看一下是哪出了問題....???
多謝多謝了!!
------
加強磨鍊
系統時間:2024-05-03 20:58:29
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!