Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/algorithm/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
吴晓林的源代码';C语言中的s线算法?_C_Algorithm_Graphics_Line_Antialiasing - Fatal编程技术网

吴晓林的源代码';C语言中的s线算法?

吴晓林的源代码';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 (

我正在寻找一个很好的,高效的实现吴晓林的反走样画线算法的C语言,有人有这个代码可以和我分享吗

谢谢维基百科

谷歌有很多类似或的例子。你的问题让我想起了这篇关于


编辑:是时候发现您是否还不知道它了。

想知道实现是否正确,因为

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)