Java 安卓系统覆盖了几个图像
我正在尝试覆盖多达200张图像。我正在使用下面的代码,但是在尝试覆盖第三个图像时,前两个图像消失了,我显示的只是第三个图像。实际上,当我合并第50幅图像时,我实际上只处理w/2图像:覆盖49幅图像的图像和要覆盖的新图像。下面是我的hello world项目的一个摘录:Java 安卓系统覆盖了几个图像,java,android,Java,Android,我正在尝试覆盖多达200张图像。我正在使用下面的代码,但是在尝试覆盖第三个图像时,前两个图像消失了,我显示的只是第三个图像。实际上,当我合并第50幅图像时,我实际上只处理w/2图像:覆盖49幅图像的图像和要覆盖的新图像。下面是我的hello world项目的一个摘录: InputStream inputStream = getAssets().open(filename); Bitmap newBitmap = BitmapFactory.decodeStream(inputStream);
InputStream inputStream = getAssets().open(filename);
Bitmap newBitmap = BitmapFactory.decodeStream(inputStream);
Drawable drawable = imageButtonFrameView.getDrawable();
boolean isBitmapDrawable = (drawable instanceof BitmapDrawable);
if (isBitmapDrawable) {
BitmapDrawable bitmapDrawable = (BitmapDrawable) drawable;
Bitmap existingBitmap = bitmapDrawable.getBitmap();
Paint paint = new Paint();
paint.setAlpha(95);
Bitmap bmOverlay = Bitmap.createBitmap(existingBitmap.getWidth(), existingBitmap.getHeight(), existingBitmap.getConfig());
Canvas canvas = new Canvas(bmOverlay);
canvas.drawBitmap(existingBitmap, new Matrix(), paint);
canvas.drawBitmap(newBitmap, 0,0,paint);
newBitmap = bmOverlay;
}
imageButtonFrameView.setImageBitmap(newBitmap);
通过叠加,如果我拍一张显示秒针移动的模拟时钟的照片,我会有60张图像。当我把第二张图片放在第一张图片上时,我会看到第二只手指向一分钟的第一秒和第二秒。第三张图像叠加后,我会看到秒针指向第1、第2和第3秒。等
感谢您在这方面的帮助。是否要使每个覆盖上的现有编译更模糊?如果没有,您应该移动
paint.setAlpha(95)下面的代码>将现有位图绘制到画布上。你说得对。这就成功了。非常感谢。您是否希望使每个覆盖上的现有编译更模糊?如果没有,您应该移动paint.setAlpha(95)下面的代码>将现有位图绘制到画布上。你说得对。这就成功了。非常感谢。