|
ScanLine 메소드가 먹히질 않는것이 아니라 PixelFormat이 틀려서 그럴거예요.
(Byte *)로 캐스팅 하는건 pf8bit인 파일을 읽을때 주로 사용하는 걸로 알아요.
저또한 초보라서 잘은 모르지만 이 게시판을 검색하면 좀더 자세한 자료가 있을거예요.
그럼 즐거운 하루되시고 즐프하세요.
빌더매니아 님이 쓰신 글 :
: 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 메소드가 먹히질 않아요.
: 혹시 이유를 아시면 좀 가르쳐주실 수 있을까요?
:
|