Can I paint with smoothing on canvas?

Can I paint using anti-aliasing on canvas?

I need my circles, and the line has smooth edges.

+44
android graphics android-canvas antialiasing
May 05 '12 at 19:20
source share
2 answers

Paint operations want Paint . In this Paint you set Paint.setFlags(Paint.ANTI_ALIAS_FLAG)

+77
May 05 '12 at 20:41
source share

Check this. It fairly uses smooth edges. http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/graphics/FingerPaint.html

Properties of the paint necessary to obtain smoothing:

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

To use the picture:

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

The onDraw method must contain:

  canvas.drawPath(mPath, mPaint); 

Declare mPath and mPaint global.

+22
May 05 '12 at 19:25
source share



All Articles