Look at the code, and see that there are. RS end of the file, not very clear, there are Renderscript class, look at a blind, unintelligible, and then Baidu a bit, receive a lot of goods, this thing in the graphics processing this piece of useful very big.
Today, to say Scriptintrinsicblur, this class does not need to define the RS file, from this intrinsic word can be seen, it is API17 after the built-in classes, specifically for processing images, so that the picture becomes blurred.
public static Bitmap Blurbitmap (Bitmap Bitmap, float radius, contextual context) {//Create Render script contexts Renderscript rs = R
Enderscript.create (context);
Allocating memory for bitmaps allocation allocation = Allocation.createfrombitmap (rs, bitmap);
Type t = Allocation.gettype (); Create memory with the same type, typically creating <span style= "font-family:arial, Helvetica, Sans-serif" in both ways.
>Allocation</span> Allocation blurredallocation = allocation.createtyped (rs, T);
Create a Gaussian rendering script Scriptintrinsicblur Blurscript = scriptintrinsicblur.create (RS, Element.u8_4 (RS));
Set the fuzzy radius (maximum 25.0) Blurscript.setradius (RADIUS);
Set input parameters for the script blurscript.setinput (allocation); Call script results are deposited in <span style= "font-family:arial, Helvetica, Sans-serif;"
>blurredallocation </span> Blurscript.foreach (blurredallocation);
The script results are stored in the bitmap because the native layer is rendered, the result needs to be copied to the upper Blurredallocation.copyto (bitmap);
Destroy everything to free memory Allocation.destroy (); Blurredallocation.destroy ();
Blurscript.destroy ();
T.destroy ();
return bitmap;
}
The above is the entire content of this article, I hope to help you learn, but also hope that we support the cloud habitat community.