我想实现这种功能。
我的初始相机预览:
现在我想分两部分打破这个相机预览:
我尝试过:
创建一个表面视图以保存相机的预览。[完成]
将表面视图的一半移出屏幕[完成],现在表面视图的一半从屏幕外移出,只有一半可见。
问题是相机仅在表面视图的可见部分上进行完整预览,因此预览会在屏幕的一半处缩小。
任何人都可以帮助我如何实现这一目标?
答案 0 :(得分:1)
Send the camera preview to a SurfaceTexture, then draw two rects with GLES, one with the left part of the preview, one with the right. Use a single SurfaceView for display.
You can find sample code in Grafika's "texture from Camera" Activity, which manipulates the camera output in various ways. Note in particular the "zoom" feature works by displaying a progressively smaller area of the preview while keeping the output rect the same size.