Skip to content

Instantly share code, notes, and snippets.

@BlaShadow
Created February 28, 2014 16:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BlaShadow/9274237 to your computer and use it in GitHub Desktop.
Save BlaShadow/9274237 to your computer and use it in GitHub Desktop.
Blur
Bitmap BlurImage (Bitmap input)
{
var rsScript = RenderScript.Create (Context);
var alloc = Allocation.CreateFromBitmap (rsScript, input);
var blur = ScriptIntrinsicBlur.Create (rsScript, alloc.Element);
blur.SetRadius (12);
blur.SetInput (alloc);
var result = Bitmap.CreateBitmap (input.Width, input.Height, input.GetConfig ());
var outAlloc = Allocation.CreateFromBitmap (rsScript, result);
blur.ForEach (outAlloc);
outAlloc.CopyTo (result);
rsScript.Destroy ();
return result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment