bcb显示16位raw图

coremember 2011-05-07 08:06:11
我要显示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;
...全文
84 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

13,825

社区成员

发帖
与我相关
我的任务
社区描述
C++ Builder相关内容讨论区
社区管理员
  • 基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧