我正在寻找一种优美高效的C语言实现方式,用于Xiaolin Wu反走样线绘制算法。是否有人能够分享此代码?
谢谢!
我正在寻找一种优美高效的C语言实现方式,用于Xiaolin Wu反走样线绘制算法。是否有人能够分享此代码?
谢谢!
想知道实现这里是否正确,因为在
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));
}
条件 if (ErrorAcc <= ErrorAccTemp)
总是为假。