吴晓林的源代码';C语言中的s线算法?
我正在寻找一个很好的,高效的实现吴晓林的反走样画线算法的C语言,有人有这个代码可以和我分享吗 谢谢维基百科 谷歌有很多类似或的例子。你的问题让我想起了这篇关于吴晓林的源代码';C语言中的s线算法?,c,algorithm,graphics,line,antialiasing,C,Algorithm,Graphics,Line,Antialiasing,我正在寻找一个很好的,高效的实现吴晓林的反走样画线算法的C语言,有人有这个代码可以和我分享吗 谢谢维基百科 谷歌有很多类似或的例子。你的问题让我想起了这篇关于 编辑:是时候发现您是否还不知道它了。想知道实现是否正确,因为 ErrorAdj = ((unsigned long) DeltaX << 16) / (unsigned long) DeltaY; /* Draw all pixels other than the first and last */ while (
编辑:是时候发现您是否还不知道它了。想知道实现是否正确,因为
ErrorAdj = ((unsigned long) DeltaX << 16) / (unsigned long) DeltaY;
/* Draw all pixels other than the first and last */
while (--DeltaY) {
ErrorAccTemp = ErrorAcc; /* remember current accumulated error */
ErrorAcc += ErrorAdj; /* calculate error for next pixel */
if (ErrorAcc <= ErrorAccTemp) {
/* The error accumulator turned over, so advance the X coord */
X0 += XDir;
}
Y0++; /* Y-major, so always advance Y */
/* The IntensityBits most significant bits of ErrorAcc give us the
intensity weighting for this pixel, and the complement of the
weighting for the paired pixel */
Weighting = ErrorAcc >> IntensityShift;
DrawPixel(pDC,X0, Y0, BaseColor + Weighting);
DrawPixel(pDC,X0 + XDir, Y0,
BaseColor + (Weighting ^ WeightingComplementMask));
}
ErrorAdj=((无符号长)DeltaX-IntensityShift;
DrawPixel(pDC、X0、Y0、基色+加权);
DrawPixel(pDC,X0+XDir,Y0,
BaseColor+(加权^加权互补掩码));
}
条件
if(ErrorAcc感谢第二个链接正是我想要的。我自己在谷歌上搜索过,但由于某种原因无法获得这些链接,谢谢!:)如果行尾在行尾的左侧或上方,维基百科伪代码就不起作用(依我看,它只会增加X,Y)