在android中的surfaceview上创建cameraview(mask) [英] Create cameraview (mask) on surfaceview in android

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

问题描述

我想在相机表面视图上创建一个遮罩。见下图。掩码是可调整大小。图像将仅被未模糊区域点击。可以任何人给想法如何创建suh面具?

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.

推荐答案

您无法在正在接收相机预览的SurfaceView的Surface上绘制。

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

您有两个基本选项:在SurfaceView的View部分绘制,将其视为自定义视图,或创建第二个SurfaceView并将其层叠在相机表面上。

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() 将Surface定位在摄像机表面层上方,但位于视图UI层下方。你可以使用Canvas或GLES来绘制它。您可以在 Grafika 的多表面测试中找到具有三个SurfaceView的活动示例。

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(mask)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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