r/android_devs • u/[deleted] • Jul 18 '20
Discussion Realtime blurring in Android
I am currently in a project where some design elements should have blurred background that updates as the user scrolls on a background with multiple images. I know Android generally doesn't play well with blurring and that its OK for static content but I expected it do be in a better state today as the phones itself are more than capable to handle it.
The implementation was done with some random library I found on GitHub, and it uses the classic Renderscript to make it work. The effect even worked very well on my OnePlus and the designer was very happy that we could be as close to the design as the iOS counterpart.
However, I took another phone one day to test stuff (Samsung Galaxy S8+) and the performance was horrible. Scrolling was laggy and choppy and we had to use fallback graphics because the user experience was really bad. I was really surprised that a device that was the flagship 2-3 years ago can't handle realtime blur.
I'm guessing the issue lies within Android since the device itself should be able to handle it. The developer of the lib did benchmarks on Nexus 5 and it could maintain 60 fps without issues.
My question is, is there a specific reason why Android still doesn't have native blur support (like imageView.blur(radius, sampling)? I guess it should be done in C or C++ since its a lot of calculations, but I can't imagine Google not having the capacity to find a way... Can anyone share their experiences with blurring? Maybe some hacks/libs that worked really well?
1
u/[deleted] Jul 18 '20
Renderscript uses the best the hardware has to offer. If you can't maintain 60 fps (are you forgetting that Android supports 144Hz and more?) with your realtime animations, maybe your design needs to rethought.
Moving to NDK or adding yet another API will not magically improve performance, at best you could reduce latency.