2012-05-05 5 views

Répondre

78

Les opérations de dessin nécessitent Paint. Dans ce Paint vous définissez Paint.setFlags(Paint.ANTI_ALIAS_FLAG)

+1

fait le tour, mais c'est setFlags, pas setFlag. – xtr

+0

vous pouvez utiliser 'mPaint.setAntiAlias ​​(true);' à la place, comme suggéré par Arun Chettoor –

22

Vérifiez cela. Il utilise assez des bords lisses .. http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/graphics/FingerPaint.html

Les propriétés de peinture nécessaires pour obtenir l'anti-aliasing est:

 mPaint = new Paint(); 
    mPaint.setAntiAlias(true); 

En dessin:

 mPath = new Path(); 
    mPath.reset(); 
    mPath.moveTo(x, y);//can be used where to trigger the path 

méthode onDraw doit contenir:

 canvas.drawPath(mPath, mPaint); 

Déclarez le mPath et mPaint comme global.