⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bmp.c

📁 black-fin DSP处理器单帧图像获取程序
💻 C
字号:
#include"bmp.h"
#include"file_system.h"
int save_bmp_file(unsigned char * address,int size,M_FILE * fp)
{
    BITMAPFILEHEADER bmp_hd;
	BITMAPINFOHEADER info_hd;
	unsigned int i;
	unsigned int map_t;
	unsigned int map_table[256];
	
	bmp_hd.bfType=0x4d42;
	bmp_hd.bfSize=0x54a38;
	bmp_hd.bfReserved1=0;
	bmp_hd.bfReserved2=0;
	bmp_hd.bfOffBits=0x436;
	
  info_hd.biSize=40; //表示本结构的大小
  info_hd.biWidth=720; //位图的宽度
  info_hd.biHeight=480; //位图的高度
info_hd.biPlanes=1; //永远为1 ,由于没有用过所以 没做研究 附msdn解释
//Specifies the number of planes for the target device. This value must be set to 1. 
  info_hd.biBitCount=8;//位图的位数  分为1 4 8 16 24 32 本文没对1 4 进行研究
  info_hd.biCompression=0; //本以为压缩类型,但是却另外有作用,稍候解释
  info_hd.biSizeImage=0x54600; //表示位图数据区域的大小以字节为单位
  info_hd.biXPelsPerMeter=0; 
  info_hd.biYPelsPerMeter=0; 
  info_hd.biClrUsed=0; 
  info_hd.biClrImportant=0; 
  
  mm_fwrite(fp,&bmp_hd.bfType,2);
  mm_fwrite(fp,&bmp_hd.bfSize,4);
  mm_fwrite(fp,&bmp_hd.bfReserved1,2);
  mm_fwrite(fp,&bmp_hd.bfReserved2,2);
  mm_fwrite(fp,&bmp_hd.bfOffBits,4);
  
  mm_fwrite(fp,&info_hd,40);
  
  	for(i=0;i<256;i++)
	{
		map_t=i;
		map_t=map_t<<8;
		map_t|=i;
		map_t=map_t<<8;
		map_t|=i;
		map_table[i]=map_t;
	}
	mm_fwrite(fp,map_table,256*4);
	
	mm_fwrite(fp,address,size);
	return 0;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -