0

in a finger paint app with using canvas, when i call invalidate(),the drawing quality is good but speed of drawing comes slow and when i call invalidate(mRect) instead, i have something like hand vibration.
enter image description here

private boolean touch_move(int x, int y)
    {

        float dx = Math.abs(x - mX);
        float dy = Math.abs(y - mY);            
        int rr = 10;
        Rect mRect = new Rect();
        if (dx >= TOUCH_TOLERANCE || dy >= TOUCH_TOLERANCE)
        {
            mPath.quadTo(mX, mY, (x +mX) / 2, (y + mY) / 2);
            TabiCal.myPoints.add(new MyPoint(x, y, mX, mY, TabiCal.color_flag,
                    TabiCal.thick_flag, 2));                
            mRect.set(x - rr, y - rr, x + rr, y + rr);
            invalidate(mRect);
            mX = x;
            mY = y;         
        }
        return true;
    }

i used antiAlias(true), but didn't help me. what is a the solution?

Loktar
  • 34,764
  • 7
  • 90
  • 104
Mehdi
  • 31
  • 6

1 Answers1

0

You may check out an answer I gave a while ago: Android How to draw a smooth line following your finger

Or this article from the Square engineers, which is very good: http://corner.squareup.com/2010/07/smooth-signatures.html

Community
  • 1
  • 1
John Ericksen
  • 10,995
  • 4
  • 45
  • 75
  • thanks for attention,but i saw both of them.[this is the result of signature tutorial](http://imageupper.com/s02/1/1/H13542579132257431_1.jpg) – Mehdi Nov 30 '12 at 06:47
  • Which tutorial? The one I posed or square's? – John Ericksen Nov 30 '12 at 16:05
  • the image is for square tutorial. the problem depends on invalidate.don't you header any thing about median filter – Mehdi Nov 30 '12 at 18:54
  • @johncarl Can u help me to solve this question related to drawing on canvas http://stackoverflow.com/questions/20560322/how-to-draw-path-with-variable-width-in-canvas – AndroidDev Dec 16 '13 at 07:38