Blur Module - Genius-Android Helper Site

Genius-Android

Android Material Design Theme UI and Tool Library.

Blur Module

Img

First you need:

// import

import net.qiujuer.genius.graphics.Blur;
// source

Bitmap overlay = mBitmap.copy(mBitmap.getConfig(), true);

You have three ways to process the picture

  • 1.Java
overlay = Blur.onStackBlurJava(overlay, (int) radius);
  • 2.Pixels JNI Native
int w = overlay.getWidth();
int h = overlay.getHeight();
int[] pix = new int[w * h];
overlay.getPixels(pix, 0, w, 0, 0, w, h);
  • 3.Jni Blur (Strongly recommend)
pix = Blur.onStackBlurPixels(pix, w, h, (int) radius);
overlay.setPixels(pix, 0, w, 0, 0, w, h);
// Bitmap JNI Native

overlay = Blur.onStackBlur(overlay, (int) radius);

Big Picture

If you want to blur a big picture, I suggest you use this:

// used:

Blur.onStackBlurClip(mSrc, 50);
// code:

Bitmap onStackBlurClip(Bitmap original, int radius);

This method will split up a big picture and blur it one by one.

Note:

  • Big Picture: Blur.onStackBlurClip(Bitmap original, int radius);
  • Radius must be between 1 and 255

Sample:

View Source