关于LineDDA函数(主要是关于其是否有绘图操作)
来源:互联网 发布:网络新四大天王 编辑:程序博客网 时间:2024/05/30 05:00
关于该函数的原型及参数可以参考msdn:
The LineDDA function determines which pixels should be highlighted for a line defined by the specified starting and ending points.(指定由给定的起点和终点定义的线段上应该被“高亮”的像素)这个“高亮(highlighted)”用的很奇怪,让人不知道是什么意思,是不是要画线的意思?
BOOL LineDDA( int nXStart, // x-coordinate of starting point int nYStart, // y-coordinate of starting point int nXEnd, // x-coordinate of ending point int nYEnd, // y-coordinate of ending point LINEDDAPROC lpLineFunc, // callback function LPARAM lpData // application-defined data);
Parameters
- nXStart
- [in] Specifies the x-coordinate, in logical units, of the line's starting point.
- nYStart
- [in] Specifies the y-coordinate, in logical units, of the line's starting point.
- nXEnd
- [in] Specifies the x-coordinate, in logical units, of the line's ending point.
- nYEnd
- [in] Specifies the y-coordinate, in logical units, of the line's ending point.
- lpLineFunc
- [in] Pointer to an application-defined callback function. For more information, see the LineDDAProc callback function.
- lpData
- [in] Pointer to the application-defined data.
LineDDA函数不会绘制直线,仅仅是调用回调函数。这个是我一直不能确定的问题,经过查阅资料和实例操作才得出这样的结论的。该函数使用Bre画直线算法求出直线上的点坐标,每计算出一个坐标,就将其和程序定义的数据lpData传送给回调函数lpLineFunc,由回调函数完成相应的操作。
下面给出一个示例程序:
- 建立一个MFC应用程序;
- 在函数OnDraw中添加如下代码:void CSimpleView::OnDraw(CDC* pDC){ //Implementation Note: it is safe to pass our local reference //of the pDC object because all of the callbacks will complete //before the pDC goes out of scope. CSimpleDoc* pDoc = GetDocument(); ASSERT_VALID(pDoc); //Draw a Line pDC->MoveTo(10,10); pDC->LineTo(300,300); //Use LineDDA to Draw 0's at intervals along the line. ::LineDDA(10,10,300,300,(LINEDDAPROC)DrawZero,(long)pDC); }
- 添加回调函数代码如下:VOID CALLBACK DrawZero(int X,int Y,LPARAM lpData){ //This Callback routine will be called for every calculated //point in the line. //Implementation Note: Use lpData to pass a reference to a //CDC object for drawing. CDC* pDC; pDC = (CDC*)lpData; if( X % 20 ==0) { pDC->TextOut(X,Y,_T("0")); } }
- 运行结果:
- 关于LineDDA函数(主要是关于其是否有绘图操作)
- 关于VC中LineDDA函数的调用
- 关于VC中LineDDA函数的调用问题
- LineDDA函数
- 写一个函数,检查字符里面是否是有整数,如果是,返回其整数值
- 关于windows绘图函数StretchDIBits
- 关于输入一个字符,判断其是否是数字的汇编程序
- 【html】主要是关于标签等基础
- 绘图;BeginPaint;PAINTSTRUCT(&ps);SetArcDirection函数改变弧线的方向;LineDDA函数
- 关于MFC绘图基本操作【转载】
- 关于iOS多线程的使用(主要是关于GCD的)
- 关于Ad的操作--主要类
- 关于求两条线段是否有交点
- 关于 static 块是否是同步的
- 请问关于在JAVASCRIPT中判断是否是对象的函数?
- 关于内联函数的几点总结以及构造析构是否可以是inline的
- 关于内联函数的几点总结以及构造析构是否可以是inline的
- 转一篇memcached的,主要是关于软链接
- DNS协议详解
- jq放大镜
- ubuntu 自动启动和服务管理
- 右左法则----复杂指针解析
- 用OpenInventor实现的NeHe OpenGL教程-第五课
- 关于LineDDA函数(主要是关于其是否有绘图操作)
- Linux输入子系统input_dev概述
- C#操作数据库存储过程 用户登录验证
- C51 单片机的中断号以及中断向量
- vi 语法高亮
- 用于文件下载的Servlet
- 中文排序--net.sourceforge.pinyin4j.PinyinHelper
- 数据库里面造数据
- 内核module 参数