概述
SurfaceTexture,是Android3.0以后引入的,它对图像流的处理并不直接显示,而是转换为GL外部纹理,因此可用于图像流数据的二次处理,比如Camera滤镜、特效等。
分析源码
SurfaceTexture
java.lang.Object
↳ android.graphics.SurfaceTexture
public class SurfaceTexture {
}
API 注释
- Captures frames from an image stream as an OpenGL ES texture. 从图像流中捕获帧数据用作OpenGL ES的纹理。The image stream may come from either camera preview or video decode 其中这个图像流数据也可以是相机预览数据也可以是视频解码数据。
- A SurfaceTexture may be used in place of a SurfaceHolder when specifying the output destination of a Camera or MediaPlayer object. 当输出目标指定为Camera或者MediaPlayer对象时候,可以使用SurfaceTexture来代替SurfaceHolder
- Doing so will cause all the frames from the image stream to be sent to the SurfaceTexture object rather than to the device’s display. 如果这样做的话,image stream将把所有帧对象都传给了SurfaceTexture对象,而不是显示在设备上。