下列算法是用中点 Bresenham 绘制一宽度为 3 像素的黑色直线。请选择正确的语句完成算法。正确的语句选项是() void CTestView::BresenhamLine(CDC *pDC) { CPoint p0(-150,-100),p1(200,50),p; int dx,dy; dx=p1.x-p0.x; dy=p1.y-p0.y; double k,d; k=(double)dy/dx; //k 为直线的斜率 d=0.5-k; for(p=p0;p.x
SetPixelV(p,RGB(0,0,0)) (2) pDC->SetPixelV(p.x+1,p.y+1,RGB(0,0,0)) (3) pDC->SetPixelV(p.x+2,p.y+2,RGB(0,0,0)) (4) pDC->SetPixelV(p.x-1,p.y-1,RGB(0,0,0)) (5) pDC->SetPixelV(p.x-2,p.y-2,RGB(0,0,0)) (6) pDC->SetPixelV(p.x,p.y+1,RGB(0,0,0)) (7) pDC->SetPixelV(p.x,p.y+2,RGB(0,0,0)) (8) pDC->SetPixelV(p.x,p.y-1,RGB(0,0,0)) (9) pDC->SetPixelV(p+3,RGB(0,0,0))