在材料demo中有如下改动
1.通过hedit可以看到示例程序生成的图片的长宽参数都是00 00 00 80也就是8*16=128
在文件头的地方将长宽修改为128
2.因为要输入三个参数 且顺序为程序 点阵文件txt 新建bmp文件 因而将argc<2改为argc<3
那么对应的点阵文件路径就是在arvc[1]中
3.将点阵文件读入二维数组中(一行一行读入)顺便可以统计有多少行
4.将二维数组处理成01的形式并打印(处理一行打印一行)
5.计算二维数组的点与图片数组bmpdata的位置关系 因为印章要居中 因此在放入之前要计算行列数
6.oj提交代码可能会提示编译错误 但编译软件是正常运行的 猜测可能oj没有定义一些函数
如果将oj提示有问题的函数删去的话 会导致无法生成图片
有大佬可以教一下如何做3-2的字符匹配吗
写的代码有些乱 只是提供3-1的思路 仅供参考
#include <CONIO.H>
#include <STDLIB.H>
#include <STDIO.H>
#include <MATH.H>
#include <MALLOC.H>
#include <string.h>
typedef unsigned char BYTE;
typedef unsigned short WORD;
typedef unsigned long DWORD;
/**** The file header of bmp file 位图文件头*****/
#include <pshpack2.h> //This file turns 2 byte packing of structures on, then sizeof(BITMAPFILEHEADER)=14, otherwise sizeof(BITMAPFILEHEADER)=16
typedef struct tagBITMAPFILEHEADER {
WORD bfType;
DWORD bfSize;
WORD bfReserved1;
WORD bfReserved2;
DWORD bfoffBits;
} BITMAPFILEHEADER;
#include <poppack.h> //This file turns packing of structures off
/**** The information header of bmp file 位图信息头*****/
typedef struct tagBITMAPINFOHEADER {
DWORD biSize;
DWORD biWidth;
DWORD biHeight;
WORD biPlanes;
WORD biBitCount;
DWORD biCompress;
DWORD biSizeImage;
DWORD biXPeIsPerMeter;
DWORD biYPeIsPerMeter;
DWORD biCIrUsed;
DWORD biClrImprotant;
} BITMAPINFOHEADER;
/**** The RGB data of bmp file 图像RGB数据*****/
typedef struct tagRGBDATA{
BYTE rgbBlue;
BYTE rgbGreen;
BYTE rgbRed;
} RGBDATA;
int main(int argc, char *argv[])
{
RGBDATA *bmpData=NULL;