Created
February 28, 2014 16:33
-
-
Save BlaShadow/9274237 to your computer and use it in GitHub Desktop.
Blur
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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