GST  >> Vol. 3 No. 4 (October 2015)

    GDI绘图函数机制对应用程序的影响和解决方法
    Effect on Application by Mechanism of GDI Rendering Functions and Solutions

  • 全文下载: PDF(478KB) HTML   XML   PP.67-85   DOI: 10.12677/GST.2015.34010  
  • 下载量: 1,252  浏览量: 4,228   国家自然科学基金支持

作者:  

陈春梅:中国矿业大学(北京),北京;
李青元:中国测绘科学研究院,北京

关键词:
图形设备接口绘图函数图元输出几何特征Graphics Device Interface Drawing-Function Primitive Output Geometric Features

摘要:

对Windows API中的GDI绘图函数进行分析研究,发现了GDI绘图函数将世界坐标系(笛卡尔坐标系)原点(0,0)映射到设备坐标系(屏幕坐标系)的原点(0,0)到(1,1)之间的像素中心处。指出了为了保持图形的几何特征不变和避免叠印,GDI绘图函数会对端点和边界像素进行折衷处理,从而出现一些很多程序员没有发现的难以理解的奇怪现象。针对这些现象给出了解释,指出了其对应用程序的影响,并提出了解决方法。

GDI drawing-functions in Windows API were analyzed and we found that GDI drawing-function mapped the world coordinate system (Cartesian coordinate system) origin (0,0) to the pixel center between (0,0) and (1,1) of the device coordinate system (screen coordinates). It pointed out that in order to maintain the same graphic geometric features and avoiding overprinting, GDI drawing functions compromised with the endpoints and the boundary pixels, which caused some strange phenomenon many programmers have not found and it was difficult to understand. In response to these phenomena, explanations are given. In addition, the effect on some applications is pointed out and solutions are proposed.

文章引用:
陈春梅, 李青元. GDI绘图函数机制对应用程序的影响和解决方法[J]. 测绘科学技术, 2015, 3(4): 67-85. http://dx.doi.org/10.12677/GST.2015.34010

参考文献

[1] 朱磊, 周彬 (2002) Windows下的C/C++高级编程. 人民邮电出版社, 北京, 79-141.
[2] 李青元, 谭海, 王涛 (2011) GDI/GDI+绘图函数缺陷与避免方法研究. 计算机工程与设计, 12, 4256-4259.
[3] Donald Hearn, M. Pauline Baker (2010) 计算机图形学. 第三版, 电子工业出版社, 北京, 26-185. (Computer Graphics with OpenGL, 3rd Edition).
[4] 陈建春 (2004) 矢量图形系统开发与编程. 电子工业出版社, 北京, 74-76.
[5] Microsoft (2015) Microsoft developer network [EB/OB]. 2015-4-29. https://msdn.microsoft.com/en-us/library/windows/desktop/dd145029(v=vs.85)
[6] 倪明田, 吴良芝 (1999) 计算机图形学. 北京大学出版社, 北京, 43-91.
[7] D.F. 罗杰斯 (1987) 计算机图形学的算法基础. 科学出版社, 北京, 30-101.
[8] 项志钢 (2008) 计算机图形学Computer graphics with OpenGL. 清华大学出版社, 北京, 34-51.
[9] Microsoft 公司 (1993) Microsoft Windows 3.1 程序员参考大全(二)——函数. 91-641.
[10] Microsoft (2015) Microsoft developer network [EB/OB]. 2015-4-29. https://msdn.microsoft.com/en-us/library/windows/desktop/dd162815(v=vs.85)
[11] Microsoft (2015) Microsoft developer network [EB/OB]. 2015-4-29. https://msdn.microsoft.com/en-us/library/windows/desktop/dd162814(v=vs.85)
[12] Microsoft (2015) Microsoft developer network [EB/OB]. 2015-4-29. https://msdn.microsoft.com/en-us/library/windows/desktop/dd162510(v=vs.85)
[13] Microsoft (2015) Microsoft developer network [EB/OB]. 2015-4-29. https://msdn.microsoft.com/en-us/library/windows/desktop/dd162897(v=vs.85)
[14] Microsoft (2015) Microsoft developer network [EB/OB]. 2015-4-29. https://msdn.microsoft.com/en-us/library/windows/desktop/dd162898(v=vs.85)
[15] Microsoft (2015) Microsoft developer network [EB/OB]. 2015-4-29. https://msdn.microsoft.com/en-us/library/windows/desktop/dd183511(v=vs.85)