請問如何正確的轉移數值到image裡面?? |
尚未結案
|
k99
一般會員 發表:8 回覆:16 積分:4 註冊:2005-07-27 發送簡訊給我 |
|
k99
一般會員 發表:8 回覆:16 積分:4 註冊:2005-07-27 發送簡訊給我 |
|
richtop
資深會員 發表:122 回覆:646 積分:468 註冊:2003-06-10 發送簡訊給我 |
k00 您好: 底下程式碼示範以兩種通常使用的方式填滿矩形方塊,
您只要在適當地方放入您的顏色資料即可實現您的需求! 您參考一下!
void __fastcall TForm1::Button3Click(TObject *Sender) { int h=10, w=5; // pixel assignment style: (easy but slow) Byte gray = 255; for (int row=10; row<10 h; row) for (int col=10; col<10 w; col) Image1->Picture->Bitmap->Canvas->Pixels[col][row] = RGB(gray, gray, gray); // scanline assignment style: (fast but complex) Byte *ptr, red=0, green=0, blue=255; int index, fromX=20; Image1->Picture->Bitmap->PixelFormat = pf24bit; // for filling color properly. for (int row=10; row<10 h; row) { ptr = (Byte*) Image1->Picture->Bitmap->ScanLine[row]; index = fromX*3; for (int col=fromX; colRichTop 敬上 =====***** 把數學當工具,可以解決問題;將數學變能力,能夠發現並解決問題! =====##### |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |