@Test @Override public void checkTransform() throws Exception { Transformation t = getTransformation(); Bitmap copy = getCopyOfBitmap(); Bitmap bm = t.transform(copy); assertThat(bm).isNotNull(); }
@Override public Bitmap transform(Bitmap source) { if (Build.VERSION.SDK_INT < 17) { return source; } RenderScript rs = RenderScript.create(mContext); Allocation input = Allocation.createFromBitmap(rs, source, Allocation.MipmapControl.MIPMAP_NONE, Allocation.USAGE_SCRIPT); Allocation output = Allocation.createTyped(rs, input.getType()); ScriptIntrinsicBlur script = ScriptIntrinsicBlur.create(rs, Element.U8_4(rs)); script.setRadius(mRadius); script.setInput(input); script.forEach(output); output.copyTo(source); return source; }
RSGaussianBlurTransformation implements Transformation { @Override public Bitmap transform(Bitmap source) { if (Build.VERSION.SDK_INT < 17) { return source; } RenderScript rs = RenderScript.create(mContext); Allocation input = Allocation.createFromBitmap(rs, source, Allocation.MipmapControl.MIPMAP_NONE, Allocation.USAGE_SCRIPT); Allocation output = Allocation.createTyped(rs, input.getType()); ScriptIntrinsicBlur script = ScriptIntrinsicBlur.create(rs, Element.U8_4(rs)); script.setRadius(mRadius); script.setInput(input); script.forEach(output); output.copyTo(source); return source; } }
RSGaussianBlurTransformation implements Transformation { @Override public Bitmap transform(Bitmap source) { if (Build.VERSION.SDK_INT < 17) { return source; } RenderScript rs = RenderScript.create(mContext); Allocation input = Allocation.createFromBitmap(rs, source, Allocation.MipmapControl.MIPMAP_NONE, Allocation.USAGE_SCRIPT); Allocation output = Allocation.createTyped(rs, input.getType()); ScriptIntrinsicBlur script = ScriptIntrinsicBlur.create(rs, Element.U8_4(rs)); script.setRadius(mRadius); script.setInput(input); script.forEach(output); output.copyTo(source); return source; } RSGaussianBlurTransformation(Context context, int radius); }
RSGaussianBlurTransformation implements Transformation { @Override public Bitmap transform(Bitmap source) { if (Build.VERSION.SDK_INT < 17) { return source; } RenderScript rs = RenderScript.create(mContext); Allocation input = Allocation.createFromBitmap(rs, source, Allocation.MipmapControl.MIPMAP_NONE, Allocation.USAGE_SCRIPT); Allocation output = Allocation.createTyped(rs, input.getType()); ScriptIntrinsicBlur script = ScriptIntrinsicBlur.create(rs, Element.U8_4(rs)); script.setRadius(mRadius); script.setInput(input); script.forEach(output); output.copyTo(source); return source; } RSGaussianBlurTransformation(Context context, int radius); @Override Bitmap transform(Bitmap source); @Override String key(); }
RSGaussianBlurTransformation implements Transformation { @Override public Bitmap transform(Bitmap source) { if (Build.VERSION.SDK_INT < 17) { return source; } RenderScript rs = RenderScript.create(mContext); Allocation input = Allocation.createFromBitmap(rs, source, Allocation.MipmapControl.MIPMAP_NONE, Allocation.USAGE_SCRIPT); Allocation output = Allocation.createTyped(rs, input.getType()); ScriptIntrinsicBlur script = ScriptIntrinsicBlur.create(rs, Element.U8_4(rs)); script.setRadius(mRadius); script.setInput(input); script.forEach(output); output.copyTo(source); return source; } RSGaussianBlurTransformation(Context context, int radius); @Override Bitmap transform(Bitmap source); @Override String key();  }