final int len = pointsX.length, far = 50;
for (int i = 0; i < len; i++)
{
if (i % 2 == 0) //If even, draw
{
//Draw code
}
else if (Math.abs(pointsX[i] - pointsX[i-1]) > far || Math.abs(pointsY[i] - pointsY[i-1]) > far)
{ //If the index is odd, check if the distance from the current to the last point is far.
//If it is far, draw. If not far, skip the draw, so it doesn't appear as jagged.
//Draw code
}
}
1 回答
正如我从Adobe Photoshop和Illustrator中了解到的那样,添加的点数越多,图像的锯齿越多 . 绘图时,您可以跳过其他所有点 . 如果用户快速移动,这可能会提供不准确的图纸,因此您可以检查跳过的点是近还是远 .