title: Android blur surfaceview used in camera
body: <p>I have a camera preview in my android app. As you all probably know it is implemented by a <code>surfaceview</code> in android.</p>
  
  <p>In my photo app, which allows users to take pictures, I want to blur the camera preview (the surface view) if the user has not logged in yet if the user is logged in, I will display the normal preview (without blur)</p>
  
  <p>Blur as something like</p>
  
  <p><img src="https://i.stack.imgur.com/TEk3K.jpg" alt="enter image description here"></p>
  
  <p>But there seems to be no way to do it</p>
  
  <p>Couple things come to mind but I am not sure how to achieve it</p>
  
  <ol>
  <li>use a blur overlay and place it on top of the surface view, but how do u create such blur overlay? </li>
  <li><p>another approach is to change the attribute of the window, but I can't do it to <code>surfaceview</code>, </p>
  
  <pre><code> getWindow().addFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
  </code></pre></li>
  </ol>
  
  <p>So can we create a window overlay the surfaceview and set the flag like that? I don't think so</p>
  
  <p>can someone tell me how to blur a camera preview, which is a surface view</p>
  
  <p>note: I am trying to blur an area which is the output from camera preview, so it is not like I am blurring a static image, the blur area will change depending on where you point your phone camera</p>