SurfaceTexture源码分析

本文详细分析了SurfaceTexture的源码,包括其作为OpenGL ES纹理捕获图像流的功能,重点介绍了updateTexImage()和getTransformMatrix()两个关键方法的作用。SurfaceTexture用于处理图像流的二次处理,如Camera滤镜和特效。它使用GL_TEXTURE_EXTERNAL_OES纹理类型,并提供了OnFrameAvailableListener接口用于监听新帧数据。
摘要由CSDN通过智能技术生成
概述

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对象,而不是显示在设备上。
两个重要的方法
  • 1
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值