|
쥬신 님이 쓰신 글 :
: 이 예제는 ScanLine을 사용하여 픽셀을 한 번에 한 줄씩 가져오는 방법입니다.
: 포럼에서 받은 예제를 보고 하고 있습니다.
: 예제가 에러가 나서 그대로 올립니다
:
: Graphics::TBitmap *pBitmap = new Graphics::TBitmap;
: Byte *ptr;
: try
: {
: pBitmap->LoadFromFile("C:\\Windows\\바람부는 들판.bmp");
: for(int i = 0; i<pBitmap->Height; i++)
: {
: ptr = pBitmap->ScanLine[i]; //<------------이분분에서 에러메세지가 뜹니다.
: for(int j = 0; j <pBitmap->Width; j++) //Cannot convert 'void *' to 'unsigned char *'에러 메세지 입니
: ptr[j] = (byte)i;
: }
: Canvas->Draw(0, 0, pBitmap);
: }
: catch(...)
: {
:
: }
: delete pBitmap;
간단히 (Byte*)로 type casting하면 됩니다.
ptr = (Byte*)pBitmap->ScanLine[i];
이렇게요.
C++은 명시적인 type casting을 해야 합니다.
수고하세요.
<끝>
|