Android Utililty Methods Bitmap Blur

List of utility methods to do Bitmap Blur

Description

The list of methods to do Bitmap Blur are organized into topic(s).

Method

BitmapblurFilter(Bitmap bmp)
blur Filter
int width = bmp.getWidth();
int height = bmp.getHeight();
int[] inPixels = new int[width * height];
int[] outPixels = new int[width * height];
Bitmap bitmap = Bitmap.createBitmap(width, height,
        Bitmap.Config.ARGB_8888);
bmp.getPixels(inPixels, 0, width, 0, 0, width, height);
for (int i = 0; i < iterations; i++) {
...
voidblur(int[] in, int[] out, int width, int height, float radius)
blur
int widthMinus1 = width - 1;
int r = (int) radius;
int tableSize = 2 * r + 1;
int divide[] = new int[256 * tableSize];
for (int i = 0; i < 256 * tableSize; i++)
    divide[i] = i / tableSize;
int inIndex = 0;
for (int y = 0; y < height; y++) {
...
Bitmapblurred(Bitmap source)
blurred
int i = 0;
for (i = 0; i < scales.length && source.getWidth() > MIN_SIZE
        && source.getHeight() > MIN_SIZE; i++)
    source = Bitmap.createScaledBitmap(source, source.getWidth()
            / scales[i], source.getHeight() / scales[i], true);
for (i--; i >= 0; i--)
    source = Bitmap.createScaledBitmap(source, source.getWidth()
            * scales[i], source.getHeight() * scales[i], true);
...
Bitmapfastblur(Context context, Bitmap sentBitmap, int radius)
fastblur
if (Build.VERSION.SDK_INT > 17) {
    Bitmap bitmap = sentBitmap.copy(sentBitmap.getConfig(), true);
    final RenderScript rs = RenderScript.create(context);
    final Allocation input = Allocation.createFromBitmap(rs,
            sentBitmap, Allocation.MipmapControl.MIPMAP_NONE,
            Allocation.USAGE_SCRIPT);
    final Allocation output = Allocation.createTyped(rs,
            input.getType());
...
DrawableBoxBlurFilter(Bitmap bmp)
Box Blur Filter
long start = System.currentTimeMillis();
int width = bmp.getWidth();
int height = bmp.getHeight();
int[] inPixels = new int[width * height];
int[] outPixels = new int[width * height];
Bitmap bitmap = Bitmap.createBitmap(width, height,
        Bitmap.Config.ARGB_8888);
bmp.getPixels(inPixels, 0, width, 0, 0, width, height);
...
voidblur(int[] in, int[] out, int width, int height, float radius)
blur
int widthMinus1 = width - 1;
int r = (int) radius;
int tableSize = 2 * r + 1;
int divide[] = new int[256 * tableSize];
for (int i = 0; i < 256 * tableSize; i++)
    divide[i] = i / tableSize;
int inIndex = 0;
for (int y = 0; y < height; y++) {
...
voidblurFractional(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++) {
...