Example #1
0
 @Override
 protected void dispatchDraw(Canvas canvas) {
   // If this is off-screen pass apply blur only
   if (mBlurRenderer.isOffscreenCanvas(canvas)) {
     mBlurRenderer.applyBlur();
   }
   // Otherwise draw blurred background image and continue to child views
   else {
     mBlurRenderer.drawToCanvas(canvas);
     super.dispatchDraw(canvas);
   }
 }
 public MuzeiView(Context context, String mPictureName) {
   super(context);
   mRenderer = new BlurRenderer(getContext(), RendererFragment.this);
   setEGLContextClientVersion(2);
   setEGLConfigChooser(8, 8, 8, 8, 0, 0);
   setRenderer(mRenderer);
   setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY);
   mRenderController =
       new DemoRenderController(
           getContext(), mRenderer, RendererFragment.this, mDemoFocus, mPictureName);
   mRenderer.setDemoMode(mDemoMode);
   mRenderController.setVisible(true);
 }
Example #3
0
  /** Default constructor */
  public BlurLinearLayout(Context context, AttributeSet attrs) {
    super(context, attrs);

    mBlurRenderer = new BlurRenderer(this);

    // Read blur radius from the layout parameters
    TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.BlurView);
    for (int i = 0; i < a.getIndexCount(); ++i) {
      int attr = a.getIndex(i);
      if (attr == R.styleable.BlurView_radius) {
        int radius = a.getDimensionPixelSize(attr, 1);
        mBlurRenderer.setBlurRadius(radius);
      }
    }
    a.recycle();
  }
 @Override
 protected void onSizeChanged(int w, int h, int oldw, int oldh) {
   super.onSizeChanged(w, h, oldw, oldh);
   mRenderer.hintViewportSize(w, h);
   mRenderController.reloadCurrentArtwork(true);
 }
Example #5
0
 /** Set blur radius in pixels */
 public void setBlurRadius(int radius) {
   mBlurRenderer.setBlurRadius(radius);
   invalidate();
 }
Example #6
0
 @Override
 protected void onDetachedFromWindow() {
   super.onDetachedFromWindow();
   mBlurRenderer.onDetachedFromWindow();
 }
Example #7
0
 @Override
 protected void onAttachedToWindow() {
   super.onAttachedToWindow();
   mBlurRenderer.onAttachedToWindow();
 }