Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android draw with blur

I need do draw on Android's Canvas using Blur effect, it is a very simple feature, I need to draw a circular area, which is blurred (the foreground) and the background transparent, I can do everything with manipulating the colour alpha to do it with custom transparency but I need it to be blurred instead of transparent.. any ideas?

like image 782
Tancho Avatar asked Dec 30 '09 12:12

Tancho


People also ask

How do you blur out part of a picture?

Apply radial blur around a fixed focal point in an image. Select one area to keep in focus and control the amount and gradient of the blur. In Photoshop, go to Filter > Blur Gallery and select Iris Blur. Click the pin at the centre of the ring and place it on your focal point.


1 Answers

(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

like image 93
user2903200 Avatar answered Sep 22 '22 21:09

user2903200