gpt4 book ai didi

android - 如何为相机 View 绘制图像框并将图像框重叠在捕获的图像上

转载 作者:行者123 更新时间:2023-11-29 18:18:19 26 4
gpt4 key购买 nike

我是 android 的新手,正在开发相机应用程序。在这个应用程序中,我在 Assets 文件夹中有一个透明图像(Image Frame),我想将此文件显示为我的相机 View ,这与 native 相机 View 不同。我在表面上使用 imageview 获取带有 Image Frame 的相机 View 屏幕,但无法将它们合并为 sdcard 上的输出图像文件。请帮忙

提前致谢...

最佳答案

            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;

关于android - 如何为相机 View 绘制图像框并将图像框重叠在捕获的图像上,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6925756/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com