bcb显示16位raw图
我要显示16 位的raw图,怎么结果是空白
int iFile;
Graphics::TBitmap *buffer;
byte *rawBuf;
rawBuf= new BYTE[size*2];
buffer = new Graphics::TBitmap();
OpenDialog1->Filter="rawÎļþ(*.raw)|*.raw||";
if(OpenDialog1->Execute())
{
iFile=FileOpen(OpenDialog1->FileName,fmOpenReadWrite|fmShareExclusive);
}
FileSeek(iFile,0,0);
FileRead(iFile,rawBuf,size*2);
//rawBuf->Assign(Image1->Picture->Bitmap);
long maxValue=65535;
long minValue=0;
buffer->PixelFormat=pf16bit; //定义16位位图
int grayvalue = 0;
buffer->Height=rawHeight;
buffer->Width=rawWidth;
byte *gray,*Buf;
gray = new BYTE[size*2];
Buf= new BYTE[size*2];
for(int i=0; i<rawHeight;i++)
{
//grayBuf= (Byte*)(rawBuf->ScanLine[i]);
for(int j=0;j<rawWidth;j++)
{
gray[grayvalue++]= (rawBuf[ rawWidth*i+j] - minValue) * 255.0 / (double)(maxValue - minValue);这句赋值赋不进去
}
}
int value = 0;
for(int i=0; i<rawHeight;i++)
{
Buf= (Byte*)(buffer->ScanLine[i]);
for(int j=0;j<rawWidth;j++)
{
Buf[value++]=gray[value++];
}
}
Image1->Picture->Assign(buffer);
delete buffer;