【发布时间】:2017-02-26 17:43:09
【问题描述】:
您好,我有模糊图像的问题..
我想在一个 Imageview 中设置模糊背景和原始图像..
我尝试将所有一个图像视图.. 现在我测试两个图像视图但它是相同的..
我的代码
// Then later, when you want to display image
ImageLoader.getInstance().displayImage(listKone.get(i).getCestaObrazok(), imgHorse); // Default options will be used
// ↑ thise method have link where are my image and download image and show it in imgHorse ImageView
imgHorseB=imgHorse;
ImageLoader.getInstance().displayImage(listKone.get(i).getCestaObrazok(), imgHorseB); // Default options will be used
BitmapDrawable drawable = (BitmapDrawable) imgHorseB.getDrawable();
Bitmap bitmap = drawable.getBitmap();
Bitmap blurredBitmap = blur(bitmap);
imgHorseB.setImageBitmap(blurredBitmap);
public Bitmap blur(final Bitmap image) {
if (null == image) return null;
Bitmap outputBitmap = Bitmap.createBitmap(image);
final RenderScript renderScript = RenderScript.create(activity);
Allocation tmpIn = Allocation.createFromBitmap(renderScript, outputBitmap);
Allocation tmpOut = Allocation.createFromBitmap(renderScript, outputBitmap);
//Intrinsic Gausian blur filter
ScriptIntrinsicBlur theIntrinsic = ScriptIntrinsicBlur.create(renderScript, Element.U8_4(renderScript));
theIntrinsic.setRadius(BLUR_RADIUS);
theIntrinsic.setInput(tmpIn);
theIntrinsic.forEach(tmpOut);
tmpOut.copyTo(outputBitmap);
return outputBitmap;
}
在方法模糊后,所有位图中的图像都模糊了。如果调试代码模糊效果除了在这条线上theIntrinsic.forEach(tmpOut);是位图中的模糊图像image和enter code here我不知道为什么..
完成此方法后,模糊图像在bluredBitmap 和bitmap 中,但它是错误的..
请帮帮我
【问题讨论】:
标签: android image bitmap android-imageview