readBmp和saveBmp函数来源:http://www.qijan.com/bbs/thread-9935-1-1.html // Test.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include "stdio.h" #include "Windows.h" unsigned char *pBmpBuf;//读入图像数据的指针 int bmpWidth;//图像的宽 int bmpHeight;//图像的高 RGBQUAD *pColorTable;//颜色表指针 int biBitCount;//图像类型,每像素位数 /*********************************************************************** * 函数名称: * readBmp() * *函数参数: * char *bmpName -文件名字及路径 * *返回值: * 0为失败,1为成功 * *说明:给定一个图像文件名及其路径,读图像的位图数据、宽、高、颜色表及每像素 * 位数等数据进内存,存放在相应的全局变量中 ***********************************************************************/ bool readBmp(char *bmpName) { //二进制读方式打开指定的图像文件 FILE *fp=fopen(bmpName,"rb"); if(fp==0) return 0; //跳过位图文件头结构BITMAPFILEHEADER fseek(fp, sizeo