Can I draw with antialiasing on canvas?

半城伤御伤魂 提交于 2019-12-18 11:38:30

问题


Can I draw with anti-aliasing on canvas?

I need my circles and line have smooth edges.


回答1:


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




回答2:


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

The paint properties needed to get anti-aliasing is :

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

For drawing use:

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

onDraw method should contain:

     canvas.drawPath(mPath, mPaint);

Declare the mPath and mPaint as global.



来源:https://stackoverflow.com/questions/10465191/can-i-draw-with-antialiasing-on-canvas

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!