我正在尝试对图像视图中显示的图像创建模糊效果。我遇到了一个例子,说明缩小位图中的图像然后再次放大它(我认为是双线性过滤),到目前为止图像质量真的很差。我试图实现一个很好的平滑模糊。我目前使用的代码是:
originalImage = BitmapFactory.decodeResource(getResources(),
mImageIds[coverFlow.getSelectedItemPosition()]);
xPos = originalImage.getWidth() / 2;
zoomedImage = Bitmap.createBitmap(originalImage, xPos / 2, yPos, width,
height);
int upWidth = (int) (width * 3.5); //width is 450 >> upWidth is 1575
int upHeight = (int) (height * 3.5); //height is 700 >> upHeight is 2450
int downWidth = (int) ((width * 1.75)*0.06); //width is 450 >> downWidth is 787.5
int downHeight = (int) ((height * 1.75)*0.06); //height is 700 >> downHeight is 1225
Bitmap ScaledUp = Bitmap.createScaledBitmap(zoomedImage, upWidth,
upHeight, true);
Bitmap BlurredImage = Bitmap.createScaledBitmap(ScaledUp, downWidth,
downHeight, true);
background.startAnimation(myFadeInAnimation);
background.setImageBitmap(BlurredImage);
background.setFocusable(true);
有人可以解释出了什么问题吗?我似乎无法获得平滑的模糊,它总是像素化。