我想要背景图像模糊效果的贴纸(图像)应该能够缩放,并且可以在整个背景图像上移动。贴纸上的反射应该按照它在背景图像上的位置。
我使用OnTouchListener实现了贴纸的缩放,旋转和运动。
我已经厌倦了以下代码来模糊贴纸
private Bitmap makeBlurBitmap(float x, float y) {
Canvas canvas = new Canvas(bitmapBackImage);
canvas.drawBitmap(bitBackImage, (int)x, (int)y, null);
if (x > 0 && y > 0) {
blurBitmap = Bitmap.createBitmap(bitBackImage,(int)x , (int)y,
bitmapSticker.getWidth(), bitmapSticker.getHeight());
canvas.drawBitmap(blurBitmapWithRenderscript(rs, blurBitmap),(int)x , (int)y , null);
canvas.drawBitmap(bitSticker,(int)x , (int)y, null);
}
return bitSticker;
}
private static Bitmap blurBitmapWithRenderscript(RenderScript rs, Bitmap bitmap2) {
//this will blur the bitmapOriginal with a radius of 25 and save it in bitmapOriginal
final Allocation input = Allocation.createFromBitmap(rs, bitmap2); //use this constructor for best performance, because it uses USAGE_SHARED mode which reuses memory
final Allocation output = Allocation.createTyped(rs, input.getType());
final ScriptIntrinsicBlur script = ScriptIntrinsicBlur.create(rs, Element.U8_4(rs));
// must be >0 and <= 25
script.setRadius(25f);
script.setInput(input);
script.forEach(output);
output.copyTo(bitmap2);
return bitmap2;
}
但是这段代码并不能归还我所需要的东西。
等待回答 感谢。