Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[問題]如何在BCB中利用ScanLine讀到第(x,y)的Pixel

0 views
Skip to first unread message

200% 的 行 動 力

unread,
May 9, 2002, 7:45:41 AM5/9/02
to
有一個BCB範例程式如下:

void __fastcall TForm1::Button1Click(TObject *Sender)

{
Graphics::TBitmap *pBitmap = new Graphics::TBitmap();
Byte *ptr;
try
{
pBitmap->LoadFromFile("C:Test.bmp ");
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;
}

我想請問一下,如果我要讀第(x,y)個Pixel,該如何做??

如果開一個二維的陣列並將所有的值先讀入此陣列中,
程式碼要加在哪??(請Post部分程式讓小弟參考一下)


[1;36m
求上天賦予我沉穩,讓我接受無法改變的事實;
賜給我勇氣,讓我改變可以改變的事物;
賜給我智慧,讓我分辨哪些是可以改變的,哪些是無法改變的。
[m
--
[1;32m※ Origin: [33m元智大學 風之塔 [37m<bbs.yzu.edu.tw> [m
[1;32m※ From : [36mintctrl-5.mech.yzu.edu.tw [m

0 new messages