|
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("C:\\Program Files\\Common Files\\Borland Shared\\Images\\Splash\\256color\\factory.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;
}
그런데요..
위의 코드 "ScanLine"에 대한 example code인데요,
(Byte *)pBitmap->ScanLine[y]; 에서 (Byte *)로 캐스팅을 하쟎아요?
그러면 ScanLine 메소드가 먹히질 않아요.
혹시 이유를 아시면 좀 가르쳐주실 수 있을까요?
|