【问题标题】:how to have smooth and quick drawing in a fingerPaing如何在fingerPaint中进行流畅快速的绘图
【发布时间】:2012-11-30 09:01:54
【问题描述】:

在使用画布的手指绘画应用程序中,当我调用invalidate() 时,绘图质量很好,但绘图速度很慢 而当我打电话给invalidate(mRect) 时,我有类似手部振动的感觉。

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;
    }

我使用了antiAlias(true),但没有帮助我。有什么解决办法?

【问题讨论】:

    标签: android draw android-canvas


    【解决方案1】:

    您可以查看我前段时间给出的答案:Android How to draw a smooth line following your finger

    或者Square工程师的这篇文章,很不错:http://corner.squareup.com/2010/07/smooth-signatures.html

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-03-07
    • 1970-01-01
    • 1970-01-01
    • 2010-10-16
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多