创建于Android的surfaceview

创建于Android的surfaceview

本文介绍了创建于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.

对于后者,你可以使用 setZOrderMediaOverlay() 的表面位置相机表面层查看UI层以上,但下方。您可以使用帆布或GLES画就可以了。您可以在的多面测试活动的例子。

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

08-31 10:27