项目背景
本次的水墨屏幕项目需要显示一些图片和文字,所以需要对图片和文字进行取模。
取模步骤
1.打开取模软件
2.选择图形模式
3.设置字模选项
注意:本次项目采用的是水墨屏,并且是局部刷新的代码,所以设置字模选项可能有点不同
选择列行式,C51格式,行前缀去掉,行后缀保留,
3.打开图片,生存字模
在选择图片的时候,要修改图片模式为bmp,并且像素点一定要和生成的图片大小一样,比如生成一个4040大小的图片,像素可以保存为4040,这个可以用电脑自带的画图软件生成。
选择文件,另存为bmp格式的图片
最后用软件打开图片,点生成字模就可以
比如40*40的太阳
//40*40
//晴天
const unsigned char sun[]={
0x00,0x00,0x00,0x00,0x00,0xC0,0xE0,0xE0,0xE0,0xC0,0x80,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0xFE,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xC0,0xC0,
0xE0,0xE0,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x03,0x07,
0x0F,0x1F,0x3F,0x3F,0x3E,0xBC,0xC0,0xC0,0xE0,0xE0,0xF7,0xF7,0xF7,0xF7,0xE0,0xE0,
0xE0,0xC0,0xB8,0x3C,0x3F,0x3F,0x1F,0x0F,0x07,0x03,0x01,0x00,0x00,0x00,0x00,0x00,
0x38,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x00,0x7E,0xFF,0xFF,0xFF,
0xFF,0xC3,0x81,0x00,0x00,0x81,0x83,0xE7,0xFF,0xFF,0xFF,0x7E,0x00,0x3C,0x3C,0x3C,
0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xC0,
0xE0,0xF0,0xF8,0xFC,0x7C,0x3C,0x03,0x03,0x07,0x07,0xEF,0xEF,0xEF,0xEF,0x07,0x07,
0x07,0x03,0x3D,0x7C,0xFC,0xFC,0xF8,0xF0,0xE0,0xC0,0x80,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x03,0x07,0x07,0x07,0x03,0x01,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x03,0x07,
0x07,0x07,0x07,0x00,0x00,0x00,0x00,0x00,
};
4.生成文字
文字的话就是选择字符模式
选择逐行式,C51格式,行前缀去掉,行后缀保留,生成的字符要加汉字在前面,还有就是字体的大小修改字宽和字高。
比如24大小的中
const typFNT_GB24 tfont24[]={
"中",0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x08,0x00,0x00,0x08,0x00,0x00,
0x08,0x00,0x08,0x08,0x18,0xF8,0xFF,0x1F,0x18,0x08,0x18,0x18,0x08,0x18,0x18,0x08,
0x18,0x18,0x08,0x18,0x18,0x08,0x18,0x18,0x08,0x18,0xF8,0xFF,0x1F,0x08,0x08,0x08,
0x00,0x08,0x00,0x00,0x08,0x00,0x00,0x08,0x00,0x00,0x08,0x00,0x00,0x18,0x00,0x00,
0x18,0x00,0x00,0x18,0x00,0x00,0x00,0x00,/*"中",0*/
};