what's the difference between Path.quadTo and Path.lineTo in the case of finger paint?

android, drawing, graphics

Solution

QUad to curves using a quadratic line (basically an ellipse of some sort). LineTo is a straight line. QuadTo will smooth out jaggedies where they turn.

Problem

There is a FingerPaint demo in APIDemos of Android. Below is the code when finger moving on the screen. ``` private void touch_move(float x, float y) { float dx = Math.abs(x - mX); float dy = Math.abs(y - mY); if (dx >= TOUCH_TOLERANCE || dy >= TOUCH_TOLERANCE) { mPath.quadTo(mX, mY, (x + mX) / 2, (y + mY) / 2); mX = x; mY = y; } } ``` I notice this the demo use mPath.quadTo which I thought should be mPath.lineTo, and I tried. Below is my code: ``` private void touch_move(float x, float y) { float dx = Math.abs(x - mX); float dy = Math.abs(y - mY); if (dx >= TOUCH_TOLERANCE || dy >= TOUCH_TOLERANCE) { mPath.lineTo(x, y); mX = x; mY = y; } } ``` Then I tried again, seems no difference, why Google use quadTo? I heard in Game Program, they use quadTo to draw finger paint, but why? Plz help...thx

Original source