Android draw with blur

十年热恋 提交于 2019-11-30 07:39:14
user2903200

(For those who are coming back, though this is an old question)

On the Paint object which you are using to draw the Color, set

paint.setMaskFilter(new BlurMaskFilter(8, BlurMaskFilter.Blur.NORMAL))

Then, in Android Manifest.xml, set

android:hardwareAccelerated="false"

for your activity (Blur doesn't work when hardware acceleration is true)

For more explanation refer Android BlurMaskFilter has no effect in canvas.drawOval while text is blurred

If you're not gonna need to manipulate it afterwards you could just draw to a buffer and blur it yourself pixel by pixel, then blit that buffer to screen when you need to paint it.

Or this: http://developer.android.com/reference/android/graphics/BlurMaskFilter.Blur.html

Tobias Ritzau

Take a look at this: Android, Blur Bitmap instantly?

Again I would recommend you first to draw into a bitmap. Scale it down (try different sizes), and the scale it back up to the original size (either as a new bitmap or if you use hw acceleration do it while you draw).

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