﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>C++博客-zyzx的小窝</title><link>http://www.cppblog.com/zyzx/</link><description>C/C++，GUI，个人移动存储，zyzx_lsl@163.com</description><language>zh-cn</language><lastBuildDate>Tue, 07 Apr 2026 18:29:49 GMT</lastBuildDate><pubDate>Tue, 07 Apr 2026 18:29:49 GMT</pubDate><ttl>60</ttl><item><title>五、单窗口结构与绘制</title><link>http://www.cppblog.com/zyzx/archive/2015/03/19/210111.html</link><dc:creator>zyzx</dc:creator><author>zyzx</author><pubDate>Thu, 19 Mar 2015 14:04:00 GMT</pubDate><guid>http://www.cppblog.com/zyzx/archive/2015/03/19/210111.html</guid><wfw:comment>http://www.cppblog.com/zyzx/comments/210111.html</wfw:comment><comments>http://www.cppblog.com/zyzx/archive/2015/03/19/210111.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.cppblog.com/zyzx/comments/commentRss/210111.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/zyzx/services/trackbacks/210111.html</trackback:ping><description><![CDATA[<div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14.399999618530273px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.799999237060547px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div><div><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14.399999618530273px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.799999237060547px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><span style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-style: normal; font-weight: normal; font-size: 12pt;">/*</span><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-style: normal; font-weight: normal;"><span style="font-size: 12pt;">&nbsp;* Create By &nbsp; &nbsp; &nbsp;:&nbsp;</span><span style="background-color: inherit; font-size: 12pt;">李绍良[lsl](zyzx)</span></div><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-style: normal; font-weight: normal;"><span style="font-size: 12pt;">&nbsp;*&nbsp;</span><span style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-style: normal; font-weight: normal; font-size: 12pt;">Email</span><span style="font-size: 12pt;">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;:&nbsp;</span><a href="&#109;&#97;&#105;&#108;&#116;&#111;&#58;&#122;&#121;&#122;&#120;&#95;&#108;&#115;&#108;&#64;&#49;&#54;&#51;&#46;&#99;&#111;&#109;" style="background-color: #ffffff; cursor: pointer; font-family: 微软雅黑; font-style: normal; font-weight: normal;"><span style="font-size: 12pt;">zyzx_lsl@163.com</span></a></div><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-style: normal; font-weight: normal;"><span style="font-size: 12pt;">&nbsp;* Create Time &nbsp;: 2015-03-19</span></div><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-style: normal; font-weight: normal;"><span style="font-size: 12pt;">&nbsp;* 转载请注明来源：</span>http://www.cppblog.com/zyzx/category/21065.html</div><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-style: normal; font-weight: normal;"><span style="font-size: 12pt;">*/</span></div></div></div></div>&nbsp; &nbsp; &nbsp; &nbsp; 前几章已经将UI的基础部分介绍完毕，这章思考了很久，不知道如何下笔。干脆就以入门界面时的考虑作为切入点。</div><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14.399999618530273px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.799999237060547px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">&nbsp; &nbsp; &nbsp; &nbsp; 就以使用windows界面为例，如下入是使用spy++截取的窗口截图。</div><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14.399999618530273px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.799999237060547px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><img src="http://www.cppblog.com/images/cppblog_com/zyzx/LUI资料/vs2005_demo_test截图.png" alt="" border="0" height="637" width="927" /></div><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14.399999618530273px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.799999237060547px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">&nbsp; &nbsp; &nbsp; &nbsp; 当spy++落在某个区域，周围的一个黑框，就表示的是这个窗口所在区域。不停的移动spy++查找窗口，我们可以发现如下图的规律：</div><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14.399999618530273px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.799999237060547px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><img src="http://www.cppblog.com/images/cppblog_com/zyzx/LUI资料/vs2005_窗口结构_示例图.png" alt="" border="0" height="680" width="947" /></div><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14.399999618530273px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.799999237060547px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">&nbsp; &nbsp; &nbsp; &nbsp; 看到什么没有，如果认真学习过数据结构，就知道这是一颗树。所有的UI元素都在这颗树里面，一个对话框，也就可以看成是一个树，窗口结构也可以使用树这种数据结构来表达。</div><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14.399999618530273px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.799999237060547px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">&nbsp; &nbsp; &nbsp; &nbsp; 那么Windows的窗口结构就不难理解了，要么认为是一个以&#8220;系统&#8221;为根的大树，要么也可以认为是去除&#8220;系统&#8221;这个根的一片森林。而在某时刻，永远只有一个处于激活的最顶层窗口，也就是得到鼠标等响应的那颗树。</div><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14.399999618530273px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.799999237060547px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">&nbsp; &nbsp; &nbsp; &nbsp; Windows把窗口搞了很多概念出来，拨开这些迷雾，实际上在我看来只需要&#8220;对话框&#8221;与&#8220;控件&#8221;足以表达纷繁复杂的UI界面。对话框与控件都是衍生自窗口的概念。对话框与控件唯一的区别在于：只有对话框才拥有线程执行权。</div><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14.399999618530273px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.799999237060547px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"></div><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14.399999618530273px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.799999237060547px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">&nbsp; &nbsp; &nbsp; &nbsp; 这里先只讨论如何将这颗树绘制成一副UI图片。其实也很简单，就是遍历整颗树，使得每个节点窗口绘制(OnPaint函数)属于自己管辖的区域。采用画家算法（后面绘制会把前面绘制的覆盖），如此UI界面就绘制出来了。</div><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14.399999618530273px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.799999237060547px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"></div><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14.399999618530273px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.799999237060547px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">如下图，中间的对话框。目前代码只实现了窗口绘制的一小部分，控件啥也没有。</div><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14.399999618530273px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.799999237060547px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><img src="http://www.cppblog.com/images/cppblog_com/zyzx/LUI资料/lui_5_窗口结构与绘制.png" alt="" border="0" height="671" width="819" /></div><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14.399999618530273px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.799999237060547px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"></div><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14.399999618530273px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.799999237060547px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">附录：章节5源代码<br /><a href="/Files/zyzx/LUI代码/my_lui_5_窗口结构与绘制.zip">/Files/zyzx/LUI代码/my_lui_5_窗口结构与绘制.zip</a></div><img src ="http://www.cppblog.com/zyzx/aggbug/210111.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/zyzx/" target="_blank">zyzx</a> 2015-03-19 22:04 <a href="http://www.cppblog.com/zyzx/archive/2015/03/19/210111.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>四、文本与字库</title><link>http://www.cppblog.com/zyzx/archive/2015/03/16/210062.html</link><dc:creator>zyzx</dc:creator><author>zyzx</author><pubDate>Mon, 16 Mar 2015 13:03:00 GMT</pubDate><guid>http://www.cppblog.com/zyzx/archive/2015/03/16/210062.html</guid><wfw:comment>http://www.cppblog.com/zyzx/comments/210062.html</wfw:comment><comments>http://www.cppblog.com/zyzx/archive/2015/03/16/210062.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/zyzx/comments/commentRss/210062.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/zyzx/services/trackbacks/210062.html</trackback:ping><description><![CDATA[<div><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14.399999618530273px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.799999237060547px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14.399999618530273px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.799999237060547px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><span style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-style: normal; font-weight: normal; font-size: 12pt;">/*</span><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-style: normal; font-weight: normal;"><span style="font-size: 12pt;">&nbsp;* Create By &nbsp; &nbsp; &nbsp;:&nbsp;</span><span style="background-color: inherit; font-size: 12pt;">李绍良[lsl](zyzx)</span></div><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-style: normal; font-weight: normal;"><span style="font-size: 12pt;">&nbsp;*&nbsp;</span><span style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-style: normal; font-weight: normal; font-size: 12pt;">Email</span><span style="font-size: 12pt;">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;:&nbsp;</span><a href="&#109;&#97;&#105;&#108;&#116;&#111;&#58;&#122;&#121;&#122;&#120;&#95;&#108;&#115;&#108;&#64;&#49;&#54;&#51;&#46;&#99;&#111;&#109;" style="background-color: #ffffff; cursor: pointer; font-family: 微软雅黑; font-style: normal; font-weight: normal;"><span style="font-size: 12pt;">zyzx_lsl@163.com</span></a></div><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-style: normal; font-weight: normal;"><span style="font-size: 12pt;">&nbsp;* Create Time &nbsp;: 2015-03-16</span></div><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-style: normal; font-weight: normal;"><span style="font-size: 12pt;">&nbsp;* 转载请注明来源：</span>http://www.cppblog.com/zyzx/category/21065.html<span style="font-size: 12pt;"></span><a href="http://www.cppblog.com/zyzx" style="background-color: inherit; cursor: pointer;"><span style="font-size: 12pt;"></span></a><span style="font-size: 12pt;"></span></div><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-style: normal; font-weight: normal;"><span style="font-size: 12pt;">*/</span></div></div></div>&nbsp; &nbsp; &nbsp; &nbsp; 为什么我们可以在屏幕上看到文字呢？</div><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14.399999618530273px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.799999237060547px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">&nbsp; &nbsp; &nbsp; &nbsp; 我们知道<span style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-style: normal; font-weight: normal;">屏幕显示的是RGB三原色，软件就是将一幅位图（RGB8888等格式）交给显卡，再呈现到用户面前。也就是说UI里面划分的控件也好、文字也罢，任何可显化部分都使用BMP位图来表达。所谓的控件也不过是工程师们赋予某个含有特定变化逻辑的位图区域。</span></div><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14.399999618530273px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.799999237060547px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><span style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-style: normal; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; 也就是说文字的表现形式是一幅位图，那么计算机如何辨识哪个是"A"，哪个是"B"呢？伟大的计算机说了：一切都是数，也就是0或1。相应的各种编码标准应运而生，比如ascii、GB2312、GBK等等。也就是说一个数值，表示一个文字，显示的时候却是使用这个数值对应的图片。</span></div><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14.399999618530273px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.799999237060547px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><span style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-style: normal; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; 那么软件所使用文字就有二个部分了：1.所有的字符串；2.字符串中每个字符对应的图片。字符串资源的做法就各领风骚了，有人硬编码；MFC使用exe的资源段；打包做到二进制文件等等。不管如何处理，最终都需要把一个字符串比如"Hello World!"交给绘图模块。绘图模块则需要把这个字符串拆分成单个字符，按照各个语言规则选取对应的图片，一个一个的贴到屏幕上（其实是后台缓存）。后面这个步骤一般由操作系统完成，那么是如何做到的呢？答案就是字库，以及字库的显示规则。</span></div><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14.399999618530273px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.799999237060547px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><span style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-style: normal; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; 字库一般分为栅格字库和矢量字库，它们的目标都是根据一个编码值取到对应图片。栅格字库相对来说简单、高效，网络上有很多关于这个的文章，可以找找相关的资料。</span></div><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14.399999618530273px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.799999237060547px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><span style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-style: normal; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; 这里为方便，就直接取出"linux-3.18.3/lib/fonts/font_10x18.c"这个文件作为我们字库数据。其他类型的字库和这个类似，不过是将字模和规则存放于二进制文件中而已。</span></div><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14.399999618530273px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.799999237060547px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><span style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-style: normal; font-weight: normal;"><br style="background-color: inherit;" /></span></div><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14.399999618530273px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.799999237060547px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><img alt="" src="http://www.cppblog.com/images/cppblog_com/zyzx/font_10x18_1_截图.png" height="410" width="378" /></div><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14.399999618530273px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.799999237060547px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">&nbsp; &nbsp; &nbsp; &nbsp; 如上图，右边的注释框中，有个明显的由"1"组成的图案。其实也就是由一个个比特位组成的二值图片。</div><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14.399999618530273px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.799999237060547px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">&nbsp; &nbsp; &nbsp; &nbsp; fontdata_10x18[FONTDATAMAX]这些数据组成的规则也很简单：</div><blockquote style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14.399999618530273px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.799999237060547px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><div style="background-color: inherit;">1. 二值图片高为18，宽为16(有效宽度为10)，每一行有2个字节，一个字模共36字节</div><div style="background-color: inherit;">2. 某ascii值的字模首地址为：<span style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-style: normal; font-weight: normal;">fontdata_10x18[id * 36]</span></div><div style="background-color: inherit;"><span style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-style: normal; font-weight: normal;">3. 这个是等宽字体</span></div></blockquote><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14.399999618530273px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.799999237060547px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"></div><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14.399999618530273px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.799999237060547px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">&nbsp; &nbsp; &nbsp; &nbsp; 那么要显示"1"其实就是就是需要将比特位1的地方着色绘制屏幕。</div><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14.399999618530273px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.799999237060547px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">&nbsp; &nbsp; &nbsp; &nbsp; 如下函数即是将此二值数据，绘制到缓存中。</div><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14.399999618530273px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.799999237060547px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">int_t CWinGraph::DrawFont(LUI_CANVAS *ptr, int_t zoom, char id, int_t x, int_t y, int_t &amp;cx, int_t &amp;cy,uint32 color, bool border, uint32 color_border)</div><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14.399999618530273px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.799999237060547px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">{</div><blockquote style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14.399999618530273px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.799999237060547px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><div style="background-color: inherit;">//下段代码并不严谨</div><div style="background-color: inherit;">//实际的情况则需要看根据字库的设计情况,按如下的思路即可</div><div style="background-color: inherit;">int_t w = 10, h = 18;</div><div style="background-color: inherit;"></div><div style="background-color: inherit;">unsigned char *pFont = &amp;fontdata_10x18[id * 36];</div><div style="background-color: inherit;">unsigned char *pData = ptr-&gt;pData + y * ptr-&gt;pitch + x * ptr-&gt;bpp;</div><div style="background-color: inherit;"></div><div style="background-color: inherit;">for(int j = 0; j &lt; h; j++)</div><div style="background-color: inherit;">{</div></blockquote><blockquote style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14.399999618530273px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.799999237060547px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><div style="background-color: inherit;">unsigned char *pd = pData;</div></blockquote><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><div style="background-color: inherit;">for(int i = 0; i &lt; w; i++)</div></blockquote><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><div style="background-color: inherit;">{</div></blockquote></blockquote><blockquote style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14.399999618530273px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.799999237060547px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><div style="background-color: inherit;">unsigned char *pf = pFont + j * 2 + (i &gt;&gt; 3);</div></blockquote></blockquote><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><div style="background-color: inherit;">if(*pf &amp; (0x1 &lt;&lt; (7 - i &amp; 0x7)))</div></blockquote></blockquote><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><div style="background-color: inherit;">{</div></blockquote></blockquote><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><div style="background-color: inherit;">memcpy(pd, &amp;color, ptr-&gt;bpp);</div></blockquote></blockquote></blockquote><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><div style="background-color: inherit;">}</div></blockquote></blockquote><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><div style="background-color: inherit;">else if(border)</div></blockquote></blockquote><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><div style="background-color: inherit;">{</div></blockquote></blockquote><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><div style="background-color: inherit;">//简单描边算法</div></blockquote></blockquote></blockquote><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><div style="background-color: inherit;">int xi = 0, yj = 0;</div></blockquote></blockquote></blockquote><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><div style="background-color: inherit;"></div></blockquote></blockquote></blockquote><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><div style="background-color: inherit;">if(0 &lt; j)</div></blockquote></blockquote></blockquote><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><div style="background-color: inherit;">{</div></blockquote></blockquote></blockquote></blockquote><blockquote style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14.399999618530273px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.799999237060547px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><div style="background-color: inherit;">xi = i; yj = j - 1;</div></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14.399999618530273px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.799999237060547px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><div style="background-color: inherit;">}</div></blockquote></blockquote></blockquote><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><div style="background-color: inherit;">else if(j &lt; (h - 1))</div></blockquote></blockquote></blockquote><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><div style="background-color: inherit;">{</div></blockquote></blockquote></blockquote></blockquote><blockquote style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14.399999618530273px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.799999237060547px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><div style="background-color: inherit;">xi = i; yj = j + 1;</div></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14.399999618530273px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.799999237060547px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><div style="background-color: inherit;">}</div></blockquote></blockquote></blockquote><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><div style="background-color: inherit;">else if(0 &lt; i)</div></blockquote></blockquote></blockquote><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><div style="background-color: inherit;">{</div></blockquote></blockquote></blockquote></blockquote><blockquote style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14.399999618530273px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.799999237060547px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><div style="background-color: inherit;">xi = i - 1; yj = j;</div></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14.399999618530273px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.799999237060547px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><div style="background-color: inherit;">}</div></blockquote></blockquote></blockquote><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><div style="background-color: inherit;">else if (i &lt; (cx - 1))</div></blockquote></blockquote></blockquote><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><div style="background-color: inherit;">{</div></blockquote></blockquote></blockquote></blockquote><blockquote style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14.399999618530273px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.799999237060547px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><div style="background-color: inherit;">xi = i + 1; yj = j;</div></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14.399999618530273px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.799999237060547px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><div style="background-color: inherit;">}</div></blockquote></blockquote></blockquote><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><div style="background-color: inherit;"></div></blockquote></blockquote></blockquote><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><div style="background-color: inherit;">pf = pFont + yj * 2 + (xi &gt;&gt; 3);</div></blockquote></blockquote></blockquote><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><div style="background-color: inherit;"></div></blockquote></blockquote></blockquote><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><div style="background-color: inherit;">if(*pf &amp; (0x1 &lt;&lt; (7 - xi &amp; 0x7)))</div></blockquote></blockquote></blockquote><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><div style="background-color: inherit;">{</div></blockquote></blockquote></blockquote></blockquote><blockquote style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14.399999618530273px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.799999237060547px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><div style="background-color: inherit;">memcpy(pd, &amp;color_border, ptr-&gt;bpp);</div></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14.399999618530273px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.799999237060547px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><div style="background-color: inherit;">}</div></blockquote></blockquote></blockquote><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><div style="background-color: inherit;">}</div></blockquote></blockquote><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><div style="background-color: inherit;"></div></blockquote></blockquote></blockquote></blockquote><blockquote style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14.399999618530273px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.799999237060547px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><div style="background-color: inherit;">pd += ptr-&gt;bpp;</div></blockquote></blockquote></blockquote><blockquote style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14.399999618530273px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.799999237060547px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><div style="background-color: inherit;">}</div></blockquote></blockquote><blockquote style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14.399999618530273px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.799999237060547px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><div style="background-color: inherit;"></div></blockquote><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><div style="background-color: inherit;">pData += ptr-&gt;pitch;</div></blockquote></blockquote><blockquote style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14.399999618530273px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.799999237060547px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><div style="background-color: inherit;">}</div><div style="background-color: inherit;"></div><div style="background-color: inherit;">cx = w;</div><div style="background-color: inherit;">cy = h;</div><div style="background-color: inherit;"></div><div style="background-color: inherit;">&nbsp;return 0;</div></blockquote><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14.399999618530273px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.799999237060547px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">}</div><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14.399999618530273px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.799999237060547px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"></div><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14.399999618530273px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.799999237060547px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">&nbsp; &nbsp; &nbsp; &nbsp; 好了至于字符串，那就很简单了，一个一个调用这个函数就可以了。</div><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14.399999618530273px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.799999237060547px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"></div><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14.399999618530273px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.799999237060547px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">如下图即是测试绘制的字符串：</div><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14.399999618530273px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.799999237060547px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><img src="http://www.cppblog.com/images/cppblog_com/zyzx/font_10x18_字符串.png" alt="" border="0" height="676" width="820" /></div><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14.399999618530273px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.799999237060547px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"></div><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14.399999618530273px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.799999237060547px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">附件是章节4的源代码<br /><a href="/Files/zyzx/LUI代码/my_lui_4_文本与字库.zip">/Files/zyzx/LUI代码/my_lui_4_文本与字库.zip</a></div></div><img src ="http://www.cppblog.com/zyzx/aggbug/210062.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/zyzx/" target="_blank">zyzx</a> 2015-03-16 21:03 <a href="http://www.cppblog.com/zyzx/archive/2015/03/16/210062.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>三、基础绘图模块</title><link>http://www.cppblog.com/zyzx/archive/2015/03/15/210040.html</link><dc:creator>zyzx</dc:creator><author>zyzx</author><pubDate>Sun, 15 Mar 2015 06:08:00 GMT</pubDate><guid>http://www.cppblog.com/zyzx/archive/2015/03/15/210040.html</guid><wfw:comment>http://www.cppblog.com/zyzx/comments/210040.html</wfw:comment><comments>http://www.cppblog.com/zyzx/archive/2015/03/15/210040.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/zyzx/comments/commentRss/210040.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/zyzx/services/trackbacks/210040.html</trackback:ping><description><![CDATA[<div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14.399999618530273px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.799999237060547px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><span style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-style: normal; font-weight: normal; font-size: 12pt;">/*</span><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-style: normal; font-weight: normal;"><span style="font-size: 12pt;">&nbsp;* Create By &nbsp; &nbsp; &nbsp;:&nbsp;</span><span style="background-color: inherit; font-size: 12pt;">李绍良[lsl](zyzx)</span></div><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-style: normal; font-weight: normal;"><span style="font-size: 12pt;">&nbsp;*&nbsp;</span><span style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-style: normal; font-weight: normal; font-size: 12pt;">Email</span><span style="font-size: 12pt;">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;:&nbsp;</span><a href="&#109;&#97;&#105;&#108;&#116;&#111;&#58;&#122;&#121;&#122;&#120;&#95;&#108;&#115;&#108;&#64;&#49;&#54;&#51;&#46;&#99;&#111;&#109;" style="background-color: #ffffff; cursor: pointer; font-family: 微软雅黑; font-style: normal; font-weight: normal;"><span style="font-size: 12pt;">zyzx_lsl@163.com</span></a></div><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-style: normal; font-weight: normal;"><span style="font-size: 12pt;">&nbsp;* Create Time &nbsp;: 2015-03-14</span></div><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-style: normal; font-weight: normal;"><span style="font-size: 12pt;">&nbsp;* 转载请注明来源：</span><a href="http://www.cppblog.com/zyzx" style="background-color: inherit; cursor: pointer;"><span style="font-size: 12pt;">http://www.cppblog.com/zyzx</span></a></div><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-style: normal; font-weight: normal;"><span style="font-size: 12pt;">*/</span></div></div><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14.399999618530273px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.799999237060547px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><img src="http://www.cppblog.com/images/cppblog_com/zyzx/绘图模块.png" alt="" border="0" /></div><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14.399999618530273px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.799999237060547px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><span style="font-size: 12pt;">如图，绘图模块基本上是一些图形运算方面的接口。</span></div><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14.399999618530273px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.799999237060547px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"></div><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14.399999618530273px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.799999237060547px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><span style="font-size: 12pt;">&nbsp; &nbsp; &nbsp; &nbsp; 绘图模块围绕的中心的是画布：</span></div><blockquote style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14.399999618530273px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.799999237060547px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><div style="background-color: inherit;"><span style="font-size: 12pt;">typedef struct LUI_CANVAS</span></div><div style="background-color: inherit;"><span style="font-size: 12pt;">{</span></div><div style="background-color: inherit;"><span style="font-size: 12pt;">&nbsp; &nbsp; int_t cx; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//画布宽</span></div><div style="background-color: inherit;"><span style="font-size: 12pt;">&nbsp; &nbsp; int_t cy; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//画布高</span></div><div style="background-color: inherit;"><span style="font-size: 12pt;">&nbsp; &nbsp; int_t bpp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //像素位宽 RGB1555 2字节；RGB8888 4字节</span></div><div style="background-color: inherit;"><span style="font-size: 12pt;">&nbsp; &nbsp; int_t pitch; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //行跨距, = cx * bpp</span></div><div style="background-color: inherit;"><span style="font-size: 12pt;">&nbsp; &nbsp; int_t len; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//*pData数据长度 =&nbsp;</span><span style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-style: normal; font-weight: normal; font-size: 12pt;">pitch * cy</span></div><div style="background-color: inherit;"><span style="font-size: 12pt;">&nbsp; &nbsp; unsigned char *pData; &nbsp; &nbsp; &nbsp;//申请的内存</span></div><div style="background-color: inherit;"><span style="font-size: 12pt;">}LUI_CANVAS;</span></div></blockquote><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14.399999618530273px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.799999237060547px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><span style="font-size: 12pt;">&nbsp; &nbsp; &nbsp; &nbsp; 其实表征的就是一个bmp图片。像素的格式一般采用RGB1555，与RGB8888格式，两这都可以将透明度信息表示出来。采用RGB1555格式即可以剩下不少内存，也可以降低CPU开销，同时UI设计师也可以相对宽松的选择图片色彩。我们做的几代产品都没有逃脱选用RGB1555格式的命运，在需要支持全屏1920*1080P的分辨率甚至4K界面的分辨率、ARM硬件（甚至很低端）这种条件下，想使用RGB8888简直就是一种奢望。</span></div><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14.399999618530273px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.799999237060547px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"></div><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14.399999618530273px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.799999237060547px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><span style="font-size: 12pt;">&nbsp; &nbsp; &nbsp; &nbsp; 至于如何绘制基础图形，这个网络上很多。实际项目中也不是我们写的模拟代码，海斯图形处理芯片中有相关的图形加速模块，比这个模拟代码效率高多了。</span></div><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14.399999618530273px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.799999237060547px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><span style="font-size: 12pt;">&nbsp; &nbsp; &nbsp; &nbsp; 创建和销毁画布在这里负责，主要是防止某些嵌入式设备图形部分需要使用设备专属内存，而不是随意new出来的。</span></div><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14.399999618530273px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.799999237060547px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><span style="font-size: 12pt;">&nbsp; &nbsp; &nbsp; &nbsp; 绘制图片这一块还需要图片打包模块的支持，后面作为一个专题。</span></div><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14.399999618530273px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.799999237060547px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><span style="font-size: 12pt;">&nbsp; &nbsp; &nbsp; &nbsp; 绘制文字，有些难度，我们一直使用的是栅格字库（基于效率、使用便利上考虑），也可以扩展使用矢量字库。国际化的界面估计是整个UI体系的最大难点了，我们也只是尽量兼容更多的语言。这部分也后面作为一个专题。</span></div><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14.399999618530273px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.799999237060547px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"></div><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14.399999618530273px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.799999237060547px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><span style="font-size: 12pt;">&nbsp; &nbsp; &nbsp; &nbsp; 到这里，基础理论差不多了。我们需要在Windows上建立调试环境，则还需要创建一个Win32的demo工程。</span></div><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14.399999618530273px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.799999237060547px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><img src="http://www.cppblog.com/images/cppblog_com/zyzx/Win_GDI.png" alt="" border="0" height="376" width="812" /></div><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14.399999618530273px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.799999237060547px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</div><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14.399999618530273px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.799999237060547px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><span style="font-size: 12pt;">&nbsp; &nbsp; &nbsp; &nbsp; demo程序使用的是vs2005直接生成的WIN32程序，也仅仅添加了一个类CWinGraph，插入到了Win32流程中。主要的使用WIN窗口把我们的界面显示出来</span></div><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14.399999618530273px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.799999237060547px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><span style="font-size: 12pt;">&nbsp; &nbsp; &nbsp; &nbsp; 主要是在窗口消息处理中简单的加入了这些代码</span></div><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14.399999618530273px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.799999237060547px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><div style="background-color: inherit;"><span style="font-size: 12pt;">case WM_PAINT:</span></div></blockquote></div><blockquote style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14.399999618530273px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.799999237060547px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><div style="background-color: inherit;"><span style="font-size: 12pt;">hdc = BeginPaint(hWnd, &amp;ps);</span></div></blockquote><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><div style="background-color: inherit;"><span style="font-size: 12pt;">// TODO: 在此添加任意绘图代码...</span></div></blockquote><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><div style="background-color: inherit;"><span style="font-size: 12pt;">int_t cx, cy;</span></div></blockquote><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><div style="background-color: inherit;"><span style="font-size: 12pt;">g_pGraph-&gt;ScreenSize(&amp;cx, &amp;cy);</span></div></blockquote><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><div style="background-color: inherit;"><span style="font-size: 12pt;">g_pGraph-&gt;Refresh(0, 0, cx, cy);</span></div></blockquote></blockquote><blockquote style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14.399999618530273px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.799999237060547px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><span style="background-color: inherit; line-height: 1.5; font-size: 12pt;">EndPaint(hWnd, &amp;ps);</span></blockquote></blockquote><blockquote style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14.399999618530273px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.799999237060547px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><span style="background-color: inherit; line-height: 1.5; font-size: 12pt;">case WM_CREATE:&nbsp;</span><br style="background-color: inherit;" /></blockquote><blockquote style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14.399999618530273px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.799999237060547px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><span style="background-color: inherit; line-height: 1.5; font-size: 12pt;">g_pGraph-&gt;Initial(hWnd, DLG_WIDTH, DLG_HEIGHT);&nbsp;</span></blockquote></blockquote><blockquote style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14.399999618530273px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.799999237060547px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><span style="background-color: inherit; line-height: 1.5; font-size: 12pt;">break;&nbsp;</span></blockquote></blockquote><blockquote style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14.399999618530273px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.799999237060547px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><span style="background-color: inherit; line-height: 1.5; font-size: 12pt;">case WM_DESTROY:&nbsp;</span><br style="background-color: inherit;" /></blockquote><blockquote style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14.399999618530273px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.799999237060547px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><span style="background-color: inherit; line-height: 1.5; font-size: 12pt;">g_pGraph-&gt;Quit();&nbsp;</span></blockquote><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><span style="background-color: inherit; line-height: 1.5; font-size: 12pt;">PostQuitMessage(0);&nbsp;</span></blockquote><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><div style="background-color: inherit;"><span style="font-size: 12pt;">break;</span></div></blockquote></blockquote><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14.399999618530273px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.799999237060547px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">&nbsp; &nbsp; &nbsp; &nbsp;</div><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14.399999618530273px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.799999237060547px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><span style="font-size: 12pt;">&nbsp; &nbsp; &nbsp; &nbsp; 代码本身没有使用比较严谨的风格，很多参数和做法后面还会响应的调整，仅以此来表达对接模块需要做的事情。</span></div><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14.399999618530273px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.799999237060547px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><span style="font-size: 12pt;">&nbsp; &nbsp; &nbsp; &nbsp; 如下图demo程序跑起来的效果图，虽然简单，但却是基础。</span></div><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14.399999618530273px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.799999237060547px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><img src="http://www.cppblog.com/images/cppblog_com/zyzx/基础绘图模块样例.png" alt="" border="0" height="673" width="820" /></div><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14.399999618530273px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.799999237060547px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"></div><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14.399999618530273px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.799999237060547px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"></div><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14.399999618530273px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.799999237060547px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><span style="background-color: inherit; line-height: 1.5; font-size: 12pt;">附件是源代码<br /><a href="/Files/zyzx/my_lui_三_基础绘图模块.zip"><span style="font-size: 12pt;">/Files/zyzx/my_lui_三_基础绘图模块.zip</span></a><br /></span></div><img src ="http://www.cppblog.com/zyzx/aggbug/210040.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/zyzx/" target="_blank">zyzx</a> 2015-03-15 14:08 <a href="http://www.cppblog.com/zyzx/archive/2015/03/15/210040.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>二、LUI基础框架</title><link>http://www.cppblog.com/zyzx/archive/2015/03/15/210039.html</link><dc:creator>zyzx</dc:creator><author>zyzx</author><pubDate>Sun, 15 Mar 2015 06:02:00 GMT</pubDate><guid>http://www.cppblog.com/zyzx/archive/2015/03/15/210039.html</guid><wfw:comment>http://www.cppblog.com/zyzx/comments/210039.html</wfw:comment><comments>http://www.cppblog.com/zyzx/archive/2015/03/15/210039.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/zyzx/comments/commentRss/210039.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/zyzx/services/trackbacks/210039.html</trackback:ping><description><![CDATA[<div><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14.399999618530273px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.799999237060547px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><span style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-style: normal; font-weight: normal;">/*</span><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-style: normal; font-weight: normal;">&nbsp;* Create By &nbsp; &nbsp; &nbsp;:&nbsp;<span style="background-color: inherit;">李绍良[lsl](zyzx)</span></div><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-style: normal; font-weight: normal;">&nbsp;*&nbsp;<span style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-style: normal; font-weight: normal;">Email</span>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;:&nbsp;<a href="&#109;&#97;&#105;&#108;&#116;&#111;&#58;&#122;&#121;&#122;&#120;&#95;&#108;&#115;&#108;&#64;&#49;&#54;&#51;&#46;&#99;&#111;&#109;" style="background-color: #ffffff; cursor: pointer; font-family: 微软雅黑; font-style: normal; font-weight: normal;">zyzx_lsl@163.com</a></div><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-style: normal; font-weight: normal;">&nbsp;* Create Time &nbsp;: 2015-03-14</div><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-style: normal; font-weight: normal;">&nbsp;* 转载请<span style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-style: normal; font-weight: normal;">注明</span>来源：<a href="http://www.cppblog.com/zyzx" style="background-color: inherit; cursor: pointer;">http://www.cppblog.com/zyzx</a></div><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-style: normal; font-weight: normal;">*/</div></div><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14.399999618530273px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.799999237060547px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div><img src="http://www.cppblog.com/images/cppblog_com/zyzx/LUI.png" alt="" border="0" height="513" width="858" /></div></div><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14.399999618530273px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.799999237060547px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><span style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-style: normal; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; 取名为LUI仅仅为避免其他库名字冲突，</span>如上图GUI框架基本结构无外呼四个基础模块</div><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14.399999618530273px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.799999237060547px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><div style="background-color: inherit;">1. 绘图模块：负责绘制基本图形（线条，矩形，图片，文本等），负责将绘制的UI图片递交给显卡</div><div style="background-color: inherit;">2. 消息机制：负责将用户使用外围设备（鼠标、键盘、触摸屏等）产生的消息有机的传导到UI工程师所写的响应代码处</div><div style="background-color: inherit;">3. 窗口维护：负责后台处理UI的窗口链、窗口关系，协调整个UI体系</div><div style="background-color: inherit;">4. 控件：给UI工程提供的API接口，操纵界面</div><div style="background-color: inherit;"></div></blockquote><span style="background-color: inherit; line-height: 1.5;">&nbsp; &nbsp; &nbsp; &nbsp; 此外还有需要注意的是UI的资源：图片、字符串、字库</span><br style="background-color: inherit;" /><div style="background-color: inherit;"><span style="background-color: #ffffff;">&nbsp; &nbsp; &nbsp; &nbsp; 一般来讲，会将这些资源做打包处理。比如图片，有专门的图片管理模块，那么界面上关注的只有图片的ID。字符串也是如此，界面上也只是关注字符的ID。这样我们动态替换我们软件的皮肤和语言，将变得非常方便。</span></div><div style="background-color: inherit;"><span style="background-color: #ffffff;"><br style="background-color: inherit;" /></span></div>&nbsp; &nbsp; &nbsp; &nbsp; (^-^)，看吧，神秘的GUI其实就这么点道道，其他的特性都是在这个基础上衍生出来的。</div></div><img src ="http://www.cppblog.com/zyzx/aggbug/210039.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/zyzx/" target="_blank">zyzx</a> 2015-03-15 14:02 <a href="http://www.cppblog.com/zyzx/archive/2015/03/15/210039.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>一、寄语：再次被重造的GUI轮子</title><link>http://www.cppblog.com/zyzx/archive/2015/03/15/210038.html</link><dc:creator>zyzx</dc:creator><author>zyzx</author><pubDate>Sun, 15 Mar 2015 05:54:00 GMT</pubDate><guid>http://www.cppblog.com/zyzx/archive/2015/03/15/210038.html</guid><wfw:comment>http://www.cppblog.com/zyzx/comments/210038.html</wfw:comment><comments>http://www.cppblog.com/zyzx/archive/2015/03/15/210038.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.cppblog.com/zyzx/comments/commentRss/210038.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/zyzx/services/trackbacks/210038.html</trackback:ping><description><![CDATA[<div><span style="font-size: 12pt;">/*</span><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.8px; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><span style="font-size: 12pt;">&nbsp;* Create By &nbsp; &nbsp; &nbsp;:&nbsp;</span><span style="background-color: inherit; line-height: 1.5; font-size: 12pt;">李绍良[lsl](zyzx)</span></div><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.8px; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><span style="font-size: 12pt;">&nbsp;*&nbsp;</span><span style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-style: normal; font-weight: normal; font-size: 12pt;">Email</span><span style="font-size: 12pt;">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;:&nbsp;</span><a href="&#109;&#97;&#105;&#108;&#116;&#111;&#58;&#122;&#121;&#122;&#120;&#95;&#108;&#115;&#108;&#64;&#49;&#54;&#51;&#46;&#99;&#111;&#109;" style="background-color: #ffffff; cursor: pointer; font-family: 微软雅黑; font-style: normal; font-weight: normal;"><span style="font-size: 12pt;">zyzx_lsl@163.com</span></a></div><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.8px; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><span style="font-size: 12pt;">&nbsp;* Create Time &nbsp;: 2015-03-14</span></div><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.8px; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><span style="font-size: 12pt;">&nbsp;* 转载请</span><span style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-style: normal; font-weight: normal; font-size: 12pt;">注明</span><span style="font-size: 12pt;">来源：</span><a href="http://www.cppblog.com/zyzx" style="background-color: inherit; cursor: pointer; line-height: 1.5;"><span style="font-size: 12pt;">http://www.cppblog.com/zyzx</span></a></div><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.8px; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><span style="font-size: 12pt;">*/</span></div><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.8px; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><span style="background-color: inherit; line-height: 1.5; font-size: 12pt;">&nbsp; &nbsp; &nbsp; &nbsp; 按照惯例得啰嗦一番^_^。我想写的这个专题就是再次重新创造GUI这个轮子。</span></div><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.8px; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><span style="background-color: inherit; line-height: 1.5; font-size: 12pt;">&nbsp; &nbsp; &nbsp; &nbsp; 从大一下学期（2004年年初）开始接触VB，第一次写出来的&#8220;Hello World!&#8221;就是界面程序。VB给我带来的感觉是写界面如此简单，但随后的学习和工作对界面是即爱又狠。使用MFC等，写个玩具倒是很简单，真正想写成可以使用的软件却是坑爹之极。先且不论英文障碍，找个资料找半天，还得一边尝试一边推想微软在底层到底干了些啥。这也是初学做Windows程序的悲哀吧，整天围这个鸟问题折腾。</span></div><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.8px; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><span style="background-color: inherit; line-height: 1.5; font-size: 12pt;">&nbsp; &nbsp; &nbsp; &nbsp; 在大学，从学习VB，再自学WIN32编程，再到使用MFC。毕业后在武汉一家皮包公司做WinCE，使用的是wxWindows，前些年留下的BLOG就是那个时候的笔记和心得。在武汉待了两年后，2009年在深圳到了目前的这家公司（做安防嵌入式DVR/NVR之类，其他的就不说了，当前也处于即将离职，悲哀啊，也只有离职期间才有时间总结），才深深的被震撼。原来UI也可以自己一针一线（一点，一线条）将其实现，只是当时的实现方案比较原始，但确确实实启发了我的思维，不再认为GUI只有微软、苹果、QT、mimiGUI、wxWindows等才可以将其实现，我们也可以有自己的思维来实现GUI。</span></div><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.8px; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><span style="background-color: inherit; line-height: 1.5; font-size: 12pt;">&nbsp; &nbsp; &nbsp; &nbsp; 在此特别感谢当年的团队在这个方面的思维积累。DVR3.0时代界面设计思路由前人完成，而我做的就是在这个界面思路下实现、完善、优化和扩展。此时的界面也就摆脱了当初简简单单的结构，为公司产品顺利打开国际化市场，树立行业DVR的OME厂商品牌，功劳不小。2012年左右，主管在前一代产品界面使用上的不足，提出来新一代产品界面需求，而我则开始构思GUI体系，规划实现了4.0界面框架体系。4.0使用的是C++实现，并利用了基本C++类特性，为保密起见，我要再造的GUI轮子将按新的思路扩展，重写这个部分的代码。</span></div><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.8px; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><span style="background-color: inherit; line-height: 1.5;">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span></div><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.8px; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><span style="background-color: inherit; line-height: 1.5; font-size: 12pt;">&nbsp; &nbsp; &nbsp; &nbsp; 好吧，看看cppblog上还有一位造GUI轮子的牛人vczh(</span><a href="http://www.cppblog.com/vczh/" style="background-color: inherit; cursor: pointer; line-height: 1.5;"><span style="font-size: 12pt;">http://www.cppblog.com/vczh/</span></a><span style="font-size: 12pt;">)。看来GUI的实现可不只有一两种方案，每个人都可以实现自己GUI。</span></div><blockquote style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.8px; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; margin: 0px 0px 0px 40px; border: medium none; padding: 0px;"><div style="background-color: inherit;"><span style="font-size: 12pt;">这里就是我的GUI的需求：</span></div></blockquote><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.8px; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><span style="font-size: 12pt;">1. 主要目标围绕嵌入式平台的界面，需要跨平台实现</span></blockquote><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><span style="font-size: 12pt;">2. 内存，CPU消耗不得过多</span></blockquote><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><span style="font-size: 12pt;">3. 尽量精简，以满足基本要求为主</span></blockquote><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><span style="font-size: 12pt;">4. 接口使用标准C，以库的方式提供</span></blockquote><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><span style="font-size: 12pt;">5. 只处理UI相关的部分，其他一律不考虑</span></blockquote><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><span style="font-size: 12pt;">6. 能否将UI使用lua脚本语言来实现</span></blockquote><blockquote style="background-color: inherit; margin: 0px 0px 0px 40px; border: none; padding: 0px;"><span style="font-size: 12pt;">7. 只使用基础语言，不使用高级语言特性</span></blockquote></div><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.8px; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"></div><div style="background-color: #ffffff; color: #000000; font-family: 微软雅黑; font-size: 14pt; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.8px; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><span style="font-size: 12pt;">&nbsp; &nbsp; &nbsp; &nbsp; 大概就这些吧，后面想到了再加进来。</span></div></div><img src ="http://www.cppblog.com/zyzx/aggbug/210038.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/zyzx/" target="_blank">zyzx</a> 2015-03-15 13:54 <a href="http://www.cppblog.com/zyzx/archive/2015/03/15/210038.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>（N6）多边形面积计算 </title><link>http://www.cppblog.com/zyzx/archive/2009/04/27/81241.html</link><dc:creator>zyzx</dc:creator><author>zyzx</author><pubDate>Mon, 27 Apr 2009 09:26:00 GMT</pubDate><guid>http://www.cppblog.com/zyzx/archive/2009/04/27/81241.html</guid><wfw:comment>http://www.cppblog.com/zyzx/comments/81241.html</wfw:comment><comments>http://www.cppblog.com/zyzx/archive/2009/04/27/81241.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/zyzx/comments/commentRss/81241.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/zyzx/services/trackbacks/81241.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 多边形面积计算 &nbsp;&nbsp;<a href='http://www.cppblog.com/zyzx/archive/2009/04/27/81241.html'>阅读全文</a><img src ="http://www.cppblog.com/zyzx/aggbug/81241.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/zyzx/" target="_blank">zyzx</a> 2009-04-27 17:26 <a href="http://www.cppblog.com/zyzx/archive/2009/04/27/81241.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>扫雷游戏作弊器：内挂制作基本思路</title><link>http://www.cppblog.com/zyzx/archive/2009/04/27/81239.html</link><dc:creator>zyzx</dc:creator><author>zyzx</author><pubDate>Mon, 27 Apr 2009 09:21:00 GMT</pubDate><guid>http://www.cppblog.com/zyzx/archive/2009/04/27/81239.html</guid><wfw:comment>http://www.cppblog.com/zyzx/comments/81239.html</wfw:comment><comments>http://www.cppblog.com/zyzx/archive/2009/04/27/81239.html#Feedback</comments><slash:comments>4</slash:comments><wfw:commentRss>http://www.cppblog.com/zyzx/comments/commentRss/81239.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/zyzx/services/trackbacks/81239.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: C，扫雷游戏，vc内联汇编，远程线程(RemoteThread.)&nbsp;&nbsp;<a href='http://www.cppblog.com/zyzx/archive/2009/04/27/81239.html'>阅读全文</a><img src ="http://www.cppblog.com/zyzx/aggbug/81239.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/zyzx/" target="_blank">zyzx</a> 2009-04-27 17:21 <a href="http://www.cppblog.com/zyzx/archive/2009/04/27/81239.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>简单mp3播放器：音频播放核心</title><link>http://www.cppblog.com/zyzx/archive/2009/04/27/81237.html</link><dc:creator>zyzx</dc:creator><author>zyzx</author><pubDate>Mon, 27 Apr 2009 09:19:00 GMT</pubDate><guid>http://www.cppblog.com/zyzx/archive/2009/04/27/81237.html</guid><wfw:comment>http://www.cppblog.com/zyzx/comments/81237.html</wfw:comment><comments>http://www.cppblog.com/zyzx/archive/2009/04/27/81237.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/zyzx/comments/commentRss/81237.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/zyzx/services/trackbacks/81237.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: C，mp3解码，libMAD，PortAudio&nbsp;&nbsp;<a href='http://www.cppblog.com/zyzx/archive/2009/04/27/81237.html'>阅读全文</a><img src ="http://www.cppblog.com/zyzx/aggbug/81237.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/zyzx/" target="_blank">zyzx</a> 2009-04-27 17:19 <a href="http://www.cppblog.com/zyzx/archive/2009/04/27/81237.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>简单音频播放：音频播放核心实现</title><link>http://www.cppblog.com/zyzx/archive/2009/04/27/81236.html</link><dc:creator>zyzx</dc:creator><author>zyzx</author><pubDate>Mon, 27 Apr 2009 09:17:00 GMT</pubDate><guid>http://www.cppblog.com/zyzx/archive/2009/04/27/81236.html</guid><wfw:comment>http://www.cppblog.com/zyzx/comments/81236.html</wfw:comment><comments>http://www.cppblog.com/zyzx/archive/2009/04/27/81236.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/zyzx/comments/commentRss/81236.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/zyzx/services/trackbacks/81236.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: C，音频播放，libsndfile，PortAudio&nbsp;&nbsp;<a href='http://www.cppblog.com/zyzx/archive/2009/04/27/81236.html'>阅读全文</a><img src ="http://www.cppblog.com/zyzx/aggbug/81236.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/zyzx/" target="_blank">zyzx</a> 2009-04-27 17:17 <a href="http://www.cppblog.com/zyzx/archive/2009/04/27/81236.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Win32环境PortAudio库编译简介：音频播放</title><link>http://www.cppblog.com/zyzx/archive/2009/04/27/81235.html</link><dc:creator>zyzx</dc:creator><author>zyzx</author><pubDate>Mon, 27 Apr 2009 09:15:00 GMT</pubDate><guid>http://www.cppblog.com/zyzx/archive/2009/04/27/81235.html</guid><wfw:comment>http://www.cppblog.com/zyzx/comments/81235.html</wfw:comment><comments>http://www.cppblog.com/zyzx/archive/2009/04/27/81235.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/zyzx/comments/commentRss/81235.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/zyzx/services/trackbacks/81235.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: C，PortAudio，ASIO，音频播放&nbsp;&nbsp;<a href='http://www.cppblog.com/zyzx/archive/2009/04/27/81235.html'>阅读全文</a><img src ="http://www.cppblog.com/zyzx/aggbug/81235.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/zyzx/" target="_blank">zyzx</a> 2009-04-27 17:15 <a href="http://www.cppblog.com/zyzx/archive/2009/04/27/81235.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>N(5) 桧树分形小枝：学习GD库</title><link>http://www.cppblog.com/zyzx/archive/2009/04/27/81234.html</link><dc:creator>zyzx</dc:creator><author>zyzx</author><pubDate>Mon, 27 Apr 2009 09:12:00 GMT</pubDate><guid>http://www.cppblog.com/zyzx/archive/2009/04/27/81234.html</guid><wfw:comment>http://www.cppblog.com/zyzx/comments/81234.html</wfw:comment><comments>http://www.cppblog.com/zyzx/archive/2009/04/27/81234.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/zyzx/comments/commentRss/81234.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/zyzx/services/trackbacks/81234.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 个人笔记：C，分形，L-System，GD库&nbsp;&nbsp;<a href='http://www.cppblog.com/zyzx/archive/2009/04/27/81234.html'>阅读全文</a><img src ="http://www.cppblog.com/zyzx/aggbug/81234.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/zyzx/" target="_blank">zyzx</a> 2009-04-27 17:12 <a href="http://www.cppblog.com/zyzx/archive/2009/04/27/81234.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>N(4) 双缓存与脏矩形：记偶的贪吃蛇游戏实现</title><link>http://www.cppblog.com/zyzx/archive/2009/04/27/81233.html</link><dc:creator>zyzx</dc:creator><author>zyzx</author><pubDate>Mon, 27 Apr 2009 09:10:00 GMT</pubDate><guid>http://www.cppblog.com/zyzx/archive/2009/04/27/81233.html</guid><wfw:comment>http://www.cppblog.com/zyzx/comments/81233.html</wfw:comment><comments>http://www.cppblog.com/zyzx/archive/2009/04/27/81233.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.cppblog.com/zyzx/comments/commentRss/81233.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/zyzx/services/trackbacks/81233.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要:  个人笔记：C，双缓存，脏矩形，Win32，API&nbsp;&nbsp;<a href='http://www.cppblog.com/zyzx/archive/2009/04/27/81233.html'>阅读全文</a><img src ="http://www.cppblog.com/zyzx/aggbug/81233.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/zyzx/" target="_blank">zyzx</a> 2009-04-27 17:10 <a href="http://www.cppblog.com/zyzx/archive/2009/04/27/81233.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>N(3) 列表框实现多项弹出菜单</title><link>http://www.cppblog.com/zyzx/archive/2009/04/27/81231.html</link><dc:creator>zyzx</dc:creator><author>zyzx</author><pubDate>Mon, 27 Apr 2009 09:06:00 GMT</pubDate><guid>http://www.cppblog.com/zyzx/archive/2009/04/27/81231.html</guid><wfw:comment>http://www.cppblog.com/zyzx/comments/81231.html</wfw:comment><comments>http://www.cppblog.com/zyzx/archive/2009/04/27/81231.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/zyzx/comments/commentRss/81231.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/zyzx/services/trackbacks/81231.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 个人笔记：C++，弹出菜单，列表框，wxWidgets&nbsp;&nbsp;<a href='http://www.cppblog.com/zyzx/archive/2009/04/27/81231.html'>阅读全文</a><img src ="http://www.cppblog.com/zyzx/aggbug/81231.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/zyzx/" target="_blank">zyzx</a> 2009-04-27 17:06 <a href="http://www.cppblog.com/zyzx/archive/2009/04/27/81231.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>N(2) 串口编程过程</title><link>http://www.cppblog.com/zyzx/archive/2009/04/27/81230.html</link><dc:creator>zyzx</dc:creator><author>zyzx</author><pubDate>Mon, 27 Apr 2009 09:03:00 GMT</pubDate><guid>http://www.cppblog.com/zyzx/archive/2009/04/27/81230.html</guid><wfw:comment>http://www.cppblog.com/zyzx/comments/81230.html</wfw:comment><comments>http://www.cppblog.com/zyzx/archive/2009/04/27/81230.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/zyzx/comments/commentRss/81230.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/zyzx/services/trackbacks/81230.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 个人笔记：C++，Observer，串口编程，隐藏窗口&nbsp;&nbsp;<a href='http://www.cppblog.com/zyzx/archive/2009/04/27/81230.html'>阅读全文</a><img src ="http://www.cppblog.com/zyzx/aggbug/81230.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/zyzx/" target="_blank">zyzx</a> 2009-04-27 17:03 <a href="http://www.cppblog.com/zyzx/archive/2009/04/27/81230.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>N(1)Tools方法：用户工具条功能实现</title><link>http://www.cppblog.com/zyzx/archive/2009/04/27/81229.html</link><dc:creator>zyzx</dc:creator><author>zyzx</author><pubDate>Mon, 27 Apr 2009 09:00:00 GMT</pubDate><guid>http://www.cppblog.com/zyzx/archive/2009/04/27/81229.html</guid><wfw:comment>http://www.cppblog.com/zyzx/comments/81229.html</wfw:comment><comments>http://www.cppblog.com/zyzx/archive/2009/04/27/81229.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/zyzx/comments/commentRss/81229.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/zyzx/services/trackbacks/81229.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 个人笔记：C++、接口编程、设计方法 、工具条<br>&nbsp;&nbsp;<a href='http://www.cppblog.com/zyzx/archive/2009/04/27/81229.html'>阅读全文</a><img src ="http://www.cppblog.com/zyzx/aggbug/81229.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/zyzx/" target="_blank">zyzx</a> 2009-04-27 17:00 <a href="http://www.cppblog.com/zyzx/archive/2009/04/27/81229.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>