Android BlurView issues with SKCanvasView

Jared Allen 1 Reputation point
2022-07-18T01:10:24.76+00:00

I am attempting to create a view for Android whose background appears to blur the view's content for which it is on top. This is nothing new and has been done before. I based my implementation on what was done here: Dimezis/BlurView.

The approach uses the pre-draw event from the view tree observed to draw a view to an internal canvas. The canvas is backed by a bitmap. A blur is applied to the bitmap before it is drawn to the canvas passed to BlurView's draw method. This approach works well for all standard views/controls and is a common method used to achieve the blur view effect. However, it does not handle Skia-based drawings that may be on the view that is blurred.

Skia, via SKCanvasView, is used heavily for controls within the App so this is kind of a deal breaker if I cannot find a solution. The issue is very odd. Anything that is drawn on the canvas view appears to be scaled and translated when drawn to the internal canvas.

Screen-Shot - blur label v. blur SKCanvasView

The screen-shot show the difference in results from blurring a label with text v. blurring a red circle drawn on an SKCanvasView.

For reference, I've posted a sample project on GitHub. It can be found here: jaredballen/BlurView

I'd really appreciate any input that can be shared.

Developer technologies | .NET | Xamarin
{count} votes

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.