问题
I am new in android and working on the camera application. In this app I have one transparent image (Image Frame) in assets folder and I want to show this file as my camera view unlike the native camera view. I am getting the camera view screen with the Image Frame using imageview over surface but unable to merge them as output image file on sdcard. Please help
thanks in advance...
回答1:
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;
来源:https://stackoverflow.com/questions/6925756/how-to-draw-image-frame-for-camera-view-and-overlapping-the-image-frame-on-captu