获得位图之点阵
2013-04-08 16:36
267 查看
点阵是由8x16数组构成,字符的点阵是由字符的asci码X16来索引其对应的点阵,所以大于0x80就不是asiic
#include <config.h> #include <fonts_manager.h> #define FONTDATAMAX 4096 static int ASCIIFontInit(char *pcFontFile, unsigned int dwFontSize); static int ASCIIGetFontBitmap(unsigned int dwCode, PT_FontBitMap ptFontBitMap); static T_FontOpr g_tASCIIFontOpr = { .name = "ascii", .FontInit = ASCIIFontInit, .GetFontBitmap = ASCIIGetFontBitmap, }; static int ASCIIFontInit(char *pcFontFile, unsigned int dwFontSize) { if (dwFontSize != 16) { //DBG_PRINTF("ASCII can't support %d font size\n", dwFontSize); return -1; } return 0; } static int ASCIIGetFontBitmap(unsigned int dwCode, PT_FontBitMap ptFontBitMap) { int iPenX = ptFontBitMap->iCurOriginX; int iPenY = ptFontBitMap->iCurOriginY; if (dwCode > (unsigned int)0x80) { //DBG_PRINTF("don't support this code : 0x%x\n", dwCode); return -1; } //由卡尔坐标转换为lcd坐标,笛卡尔原点在左下角,lcd原点在左上角 ptFontBitMap->iXLeft = iPenX; ptFontBitMap->iYTop = iPenY - 16; ptFontBitMap->iXMax = iPenX + 8; ptFontBitMap->iYMax = iPenY; ptFontBitMap->iBpp = 1; ptFontBitMap->iPitch = 1;
//有索引找到对应的点阵 ptFontBitMap->pucBuffer = (unsigned char *)&fontdata_8x16[dwCode * 16];; //Y不变,x增加 ptFontBitMap->iNextOriginX = iPenX + 8; ptFontBitMap->iNextOriginY = iPenY; return 0; } int ASCIIInit(void) { return RegisterFontOpr(&g_tASCIIFontOpr);//添加到链表 }
相关文章推荐
- 【c++】点阵字库提取汉字转位图
- 如何获得Image控件中的位图数组?
- 获得位图之GBK
- WINCE下点阵转化为位图
- 获得位图之freetype
- 已知位图的点阵数据,如何将其生成位图
- 加载位图,获得bitmapData
- 获得位图非屏蔽色/屏蔽色区域的算法
- 把24位bmp位图按水平扫描和垂直扫描转为点阵数组
- Gprinter热敏打印机光栅位图点阵数据解析工具
- 获得位图的信息
- 使用不安全代码将 Bitmap 位图转为 WPF 的 ImageSource 以获得高性能和持续小的内存占用
- DC/画线/获得窗口指针/画刷/位图
- MFC下获得位图句柄的方法
- C语言调用存储过程并且获得返回值
- 真彩位图工具栏的实现
- WindowsAPI详解——GetDriveType 获得逻辑驱动器的类型
- Android中使用JNI获得APK签名的哈希值
- JavaScript让登录或搜索文本框自动获得焦点
- linux下如何添加一个用户并且让用户获得root权限