Using pure Java and renderscript two ways to do Gaussian algorithm.
can also use the NDK to do, want to try to see:
http://stackoverflow.com/questions/2067955/fast-bitmap-blur-for-android-sdk/23119957#23119957
Pure Java code is a bit long, you can directly refer to the source code
Put on Renderscript's core algorithm:
/*** Extension of the second method * *@paramBM *@paramView *@returnvoid *@authorDoraemon * @time July 7, 2014 PM 4:56:53*/ Private voidRSBLUR2 (Bitmap BM, ImageView view) {Bitmap Outputbitmap= Bitmap.createbitmap ((int) (View.getmeasuredwidth ()/1), (int) (View.getmeasuredheight ()/1), Bitmap.Config.ARGB_8888); Renderscript RS=renderscript.create (Getapplicationcontext ()); Scriptintrinsicblur Theintrinsic=scriptintrinsicblur.create (RS, Element.u8_4 (RS)); Allocation Tmpin=Allocation.createfrombitmap (RS, BM); Allocation Tmpout=Allocation.createfrombitmap (RS, outputbitmap); Theintrinsic.setradius (25. f); Theintrinsic.setinput (Tmpin); Theintrinsic.foreach (tmpout); Tmpout.copyto (OUTPUTBITMAP); Bm.recycle (); View.setimagedrawable (Newbitmapdrawable (Getresources (), outputbitmap)); Rs.destroy (); }
Source: Please poke here--------->