線上訂房服務-台灣趴趴狗聯合訂房中心
發文 回覆 瀏覽次數:2150
推到 Plurk!
推到 Facebook!

請問如何使用ScanLine讀取圖檔之RGB

尚未結案
shing.net
中階會員


發表:207
回覆:124
積分:66
註冊:2002-03-16

發送簡訊給我
#1 引用回覆 回覆 發表時間:2002-11-07 11:35:14 IP:140.122.xxx.xxx 未訂閱
請問如何使用ScanLine讀取圖檔之RGB
RaynorPao
版主


發表:139
回覆:3622
積分:7025
註冊:2002-08-12

發送簡訊給我
#2 引用回覆 回覆 發表時間:2002-11-07 12:23:44 IP:203.73.xxx.xxx 未訂閱
引言: 請問如何使用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

發送簡訊給我
#3 引用回覆 回覆 發表時間:2002-11-07 12:50:15 IP:140.122.xxx.xxx 未訂閱
引言:
引言: 請問如何使用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 --
謝謝你的回覆,不過我是使用delphi請問其如何對應
RaynorPao
版主


發表:139
回覆:3622
積分:7025
註冊:2002-08-12

發送簡訊給我
#4 引用回覆 回覆 發表時間:2002-11-07 13:05:07 IP:203.73.xxx.xxx 未訂閱
引言: 謝謝你的回覆,不過我是使用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 --
------
-- 若您已經得到滿意的答覆,請適時結案!! --
-- 欲知前世因,今生受者是;欲知來世果,今生做者是 --
-- 一切有為法,如夢幻泡影,如露亦如電,應作如是觀 --
系統時間:2024-04-19 7:46:52
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!