|
static void writebmp(int data_fd){
int i,j,size;
int ret;
unsigned short buf[WIDTH*HEIGHT];
memcpy(buf, &preview_buf, 640*480*2);
unsigned short bmp[WIDTH*HEIGHT];
struct tagBITMAPFILEHEADER bfhead;
struct tagBITMAPINFOHEADER binfohead;
size=HEIGHT*WIDTH;
bfhead.bfSize=0x36+size*2;
bfhead.bfLeft=0;
bfhead.bfOffBits=0x36;
binfohead.biSize=0x28;
binfohead.bmpWidth=WIDTH;
binfohead.bmpHeight=HEIGHT;
binfohead.biPlanes=1;
binfohead.bicolors=0x10;
binfohead.isCompressed=0;
binfohead.biMapSize=size*2;
binfohead.biHorizontal=0x0b13;
binfohead.biVertical=0x0b13;
binfohead.biusedcolors=0;
binfohead.biimportcolors=0;
for(i=0;i<HEIGHT;i++)
for(j=0;j<WIDTH;j++)
{
*(bmp+i*WIDTH+j)=((buf[i*WIDTH+j]&0xf800)>>1)|((buf[i*WIDTH+j]&0x07c0)>>1)|((buf[i*WIDTH+j]&0x1f));
//printf("%x\t",*(bmp+i*WIDTH+j));
}
write(data_fd,"BM",2);
i=write(data_fd,&bfhead,sizeof(struct tagBITMAPFILEHEADER));
printf("Write filehead %dbytes\n",i);
i=write(data_fd,&binfohead,sizeof(struct tagBITMAPINFOHEADER));
printf("Write infohead %dbytes\n",i);
i=write(data_fd,bmp,size*2);
printf("Write bitmap %dbytes\n",i);
lseek(data_fd,SEEK_SET,4);
}
怎么把位图显示大小调大。。。。 |
|