如何检索Android的一个SurfaceView的可见部分 [英] How to retrieve the visible part of a SurfaceView in Android

查看:108
本文介绍了如何检索Android的一个SurfaceView的可见部分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在那里的顶部是用来显示一些数据(如简单的UI组件)和底部有一个 SurfaceView 我的显示<$布局C $ C>相机preVIEW 。

为了这个 SurfaceView 延长屏幕的整个宽度,并在同一时间保持正确的纵横比,则 SurfaceView 其实去屏幕外的这是很好的,因为其实我是想应用程序是平分秋色的顶部和底部之间。

现在的问题是,我现在要检索的唯一可见部分的 SurfaceView (理想情况下为位图),但如果我试图通过设置<$做到这一点C $ C> PictureCallBack ,返回的图像数据的纵横比只是不太一样,在SurfaceView所示(我试过了所有可用的那些 getSupportedPictureSizes )。

任何想法如何解决这个问题?我已经把它贴哪个好说明了这个问题的图像。

解决方案

HTTPS ://$c$c.google.com/p/zxing/downloads/list

它包含在该酒吧code扫描器项目他们使用一个矩形,并从surfaceview捕获特定区域这将是有用ü。希望使他们使用viewFinderView类从表面

I have a layout where the top part is used to display some data (eg. simple UI widgets) and the bottom part has a SurfaceView where I display a CameraPreview.

In order for this SurfaceView to extend the whole width of the screen and at the same time maintain a correct aspect ratio, the SurfaceView actually goes offscreen which is fine since I actually want the app to be divided evenly between the top part and the bottom part.

The problem is that I now want to retrieve only the visible part of the SurfaceView (ideally as a bitmap) but if I try to do it by setting a PictureCallBack, the aspect ratios of the picture data returned are just not quite the same as the ones shown in the SurfaceView (I've tried with all of the available getSupportedPictureSizes).

Any ideas how to tackle this problem? I've attached an image which better illustrates this problem.

解决方案

https://code.google.com/p/zxing/downloads/list

it contains a barcode scanner project in that they have used a rectangle and capture particular area from the surfaceview it will be useful for u .. Hope so they use viewFinderView class to capture the area from the surface

这篇关于如何检索Android的一个SurfaceView的可见部分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆