List of utility methods to do Bitmap Blur
Bitmap | blur(Bitmap bitmap) blur int iterations = 1; int radius = 8; int width = bitmap.getWidth(); int height = bitmap.getHeight(); int[] inPixels = new int[width * height]; int[] outPixels = new int[width * height]; Bitmap blured = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); ... |
void | blur(int[] in, int[] out, int width, int height, int radius) blur int widthMinus1 = width - 1; int tableSize = 2 * radius + 1; int divide[] = new int[256 * tableSize]; for (int index = 0; index < 256 * tableSize; index++) { divide[index] = index / tableSize; int inIndex = 0; for (int y = 0; y < height; y++) { ... |
Bitmap | createBlurredBitmap(final Bitmap sentBitmap) Takes a bitmap and creates a new slightly blurry version of it. if (sentBitmap == null) { return null; final Bitmap mBitmap = sentBitmap .copy(sentBitmap.getConfig(), true); final int w = mBitmap.getWidth(); final int h = mBitmap.getHeight(); final int[] pix = new int[w * h]; ... |
Bitmap | fastblur(Bitmap sentBitmap) Fastblur. int[] radius = new int[] { 1, 2, 3, 6 }; int[] ellipseWidth = new int[] { 6, 4, 3, 2 }; Bitmap bitmap = sentBitmap.copy(sentBitmap.getConfig(), true); int w = bitmap.getWidth(); int h = bitmap.getHeight(); int[] pix = new int[w * h]; final int width = sentBitmap.getWidth(); final int height = sentBitmap.getHeight(); ... |
Bitmap | fastblur(Bitmap sentBitmap, int radius) Fastblur in bitmap. Bitmap bitmap = sentBitmap.copy(sentBitmap.getConfig(), true); Bitmap origBitmap = sentBitmap.copy(sentBitmap.getConfig(), true); if (radius < 1) { return (null); int w = bitmap.getWidth(); int h = bitmap.getHeight(); int[] pix = new int[w * h]; ... |
Bitmap | blur(Context context, Bitmap sentBitmap) blur return blur(context, sentBitmap, BLUR_RADIUS);
|
Bitmap | blur(Context context, Bitmap sentBitmap, int radius) blur Bitmap bitmap = Bitmap.createScaledBitmap(sentBitmap, sentBitmap.getWidth() / 2, sentBitmap.getHeight() / 2, false); if (VERSION.SDK_INT > 16) { final RenderScript rs = RenderScript.create(context); final Allocation input = Allocation.createFromBitmap(rs, bitmap, Allocation.MipmapControl.MIPMAP_NONE, Allocation.USAGE_SCRIPT); ... |
Bitmap | fastBlurFromView(Context context, View v, int radius) fast Blur From View return fastBlur(context, loadBitmapFromView(v), radius);
|
Bitmap | fastBlur(Context context, Bitmap renderedBmp, int radius) fast Blur if (VERSION.SDK_INT > 16) { Bitmap bitmap = renderedBmp.copy(renderedBmp.getConfig(), true); final RenderScript rs = RenderScript.create(context); final Allocation input = Allocation.createFromBitmap(rs, renderedBmp, Allocation.MipmapControl.MIPMAP_NONE, Allocation.USAGE_SCRIPT); final Allocation output = Allocation.createTyped(rs, input.getType()); ... |
void | blurFractional(int[] in, int[] out, int width, int height, float radius) blur Fractional radius -= (int) radius; float f = 1.0f / (1 + 2 * radius); int inIndex = 0; for (int y = 0; y < height; y++) { int outIndex = y; out[outIndex] = in[0]; outIndex += height; for (int x = 1; x < width - 1; x++) { ... |