void CMy1400801119View::OnDraw(CDC* pDC)
{
CMy1400801119Doc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
CPen NewPen,*pOldPen;
NewPen.CreatePen(PS_SOLID,2,RGB(20,180,29));
pOldPen=pDC->SelectObject(&NewPen);
int x0=65,y0=12,x1=400,y1=450;
int x,y,dx,dy,e,i;
dx=x1-x0;
dy=y1-y0;
e=dx-2*dy;
x=x0;
y=y0;
for(i=0;i<=dx;i+=10){
pDC->MoveTo(x,y);
x=x+10;
if(e<=0){
y=y+10;
e=e+2*dx-2*dy;
}
else
e=e-2*dy;
pDC->LineTo(x,y);
}
}
直线的扫描转换
最新推荐文章于 2022-09-29 19:40:17 发布