請問如何使用ScanLine讀取圖檔之RGB |
尚未結案
|
shing.net
中階會員 發表:207 回覆:124 積分:66 註冊:2002-03-16 發送簡訊給我 |
|
RaynorPao
版主 發表:139 回覆:3622 積分:7025 註冊:2002-08-12 發送簡訊給我 |
引言: 請問如何使用ScanLine讀取圖檔之RGB資料來源:C Builder 6 Help void __fastcall TForm1::Button1Click(TObject *Sender) { Graphics::TBitmap *pBitmap = new Graphics::TBitmap(); // This example shows drawing directly to the Bitmap Byte *ptr; try { pBitmap->LoadFromFile("MyBitmap.png"); for (int y = 0; y < pBitmap->Height; y ) { ptr = (Byte *)pBitmap->ScanLine[y]; for (int x = 0; x < pBitmap->Width; x ) ptr[x] = (Byte)y; } Canvas->Draw(0,0,pBitmap); } catch (...) { ShowMessage("Could not load or alter bitmap"); } delete pBitmap; }-- Enjoy Researching & Developing --
------
-- 若您已經得到滿意的答覆,請適時結案!! -- -- 欲知前世因,今生受者是;欲知來世果,今生做者是 -- -- 一切有為法,如夢幻泡影,如露亦如電,應作如是觀 -- |
shing.net
中階會員 發表:207 回覆:124 積分:66 註冊:2002-03-16 發送簡訊給我 |
引言:謝謝你的回覆,不過我是使用delphi請問其如何對應引言: 請問如何使用ScanLine讀取圖檔之RGB資料來源:C Builder 6 Helpvoid __fastcall TForm1::Button1Click(TObject *Sender) { Graphics::TBitmap *pBitmap = new Graphics::TBitmap(); // This example shows drawing directly to the Bitmap Byte *ptr; try { pBitmap->LoadFromFile("MyBitmap.png"); for (int y = 0; y < pBitmap->Height; y ) { ptr = (Byte *)pBitmap->ScanLine[y]; for (int x = 0; x < pBitmap->Width; x ) ptr[x] = (Byte)y; } Canvas->Draw(0,0,pBitmap); } catch (...) { ShowMessage("Could not load or alter bitmap"); } delete pBitmap; }-- Enjoy Researching & Developing -- |
RaynorPao
版主 發表:139 回覆:3622 積分:7025 註冊:2002-08-12 發送簡訊給我 |
引言: 謝謝你的回覆,不過我是使用delphi請問其如何對應procedure TForm1.Button1Click(Sender: TObject); // This example shows drawing directly to the BitMap var x,y : Integer; BitMap : TBitMap; P : PByteArray; begin BitMap := TBitMap.create; try BitMap.LoadFromFile('..\Images\Splash\256color\factory.bmp'); for y := 0 to BitMap.height -1 do begin P := BitMap.ScanLine[y]; for x := 0 to BitMap.width -1 do P[x] := y; end; Canvas.draw(0,0,BitMap); finally BitMap.free; end; end; -- Enjoy Researching & Developing --
------
-- 若您已經得到滿意的答覆,請適時結案!! -- -- 欲知前世因,今生受者是;欲知來世果,今生做者是 -- -- 一切有為法,如夢幻泡影,如露亦如電,應作如是觀 -- |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |