创建于Android的surfaceview cameraview(面罩) [英] Create cameraview (mask) on surfaceview in android

查看:223
本文介绍了创建于Android的surfaceview cameraview(面罩)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建相机表面观口罩。见下图。面膜是可以调整大小。图像将只有不模糊区域被点击。有谁能够给知道如何创建徐面具?先谢谢了。

I want to create a mask on camera surface view. see image below. mask is resizable. image will be clicked only by unblurred area. can anybody give idea how to create suh mask? thanks in advance.

推荐答案

您不能画上正在接收相机preVIEW的SurfaceView的表面。

You can't draw on the Surface of the SurfaceView that is receiving the camera preview.

您有两个基本的选择:借鉴SurfaceView的视图部分,把它当作一个的自定义视图,或者创建第二个SurfaceView和Layer它在相机表面的顶部。

You have two basic options: draw on the View part of the SurfaceView, treating it as a custom view, or create a second SurfaceView and layer it on top of the camera surface.

对于后者,你可以使用<一个href=\"http://developer.android.com/reference/android/view/SurfaceView.html#setZOrderMediaOverlay(boolean)\"相对=nofollow> setZOrderMediaOverlay() 的表面位置相机表面层查看UI层以上,但下方。您可以使用帆布或GLES画就可以了。您可以在 Grafika 的多面测试活动的例子。

For the latter, you would use setZOrderMediaOverlay() to position the Surface above the camera Surface layer but below the View UI layer. You can use Canvas or GLES to draw on it. You can find an example of an activity with three SurfaceViews in Grafika's "multi-surface test".

这篇关于创建于Android的surfaceview cameraview(面罩)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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