我是Android的新手,正在开发相机应用程序。在这个应用程序中,我在资源文件夹中有一个透明图像(图像帧),我想将此文件显示为我的相机视图,与本机相机视图不同。我使用图像框架使用图像视图获取相机视图屏幕,但无法将它们合并为SD卡上的输出图像文件。请帮忙
提前感谢...
答案 0 :(得分:3)
Drawable drbl=null;
Bitmap topImage = null ;
Bitmap b=Bitmap.createBitmap(ref_capturedBitmap.getWidth(), ref_capturedBitmap.getHeight(), ref_capturedBitmap.getConfig());
Canvas comboImage = new Canvas(b);
int width = ref_capturedBitmap.getWidth();
int height = ref_capturedBitmap.getHeight();
Log.v("CameraCaptureActivity","Width : "+width+" Height : "+height );
if (frameStatus == 0)
drbl = getResources().getDrawable(R.drawable.maske1r);
else if (frameStatus == 1)
drbl = getResources().getDrawable(R.drawable.maske2r);
else if (frameStatus == 2)
drbl = getResources().getDrawable(R.drawable.maske3r);
drbl.setBounds(0, 0, height, width);
Bitmap tpImg=((BitmapDrawable)drbl).getBitmap();
topImage=Bitmap.createScaledBitmap(tpImg, width, height, true);
comboImage.drawBitmap(ref_capturedBitmap,0f,0f,null);
comboImage.drawBitmap(topImage, 0f, 0f, null);
return b;