What does the return value of SurfaceTexture.getTransformMatrix mean, who can explain?

允我心安 提交于 2019-12-05 20:58:38

It's a GLES-compatible transformation matrix that may be used to rotate or flip an image. Generally speaking you just pass it through to whatever is going to render the GLES texture that SurfaceTexture creates.

You can see examples of it used in Grafika; search for it in ContinuousCaptureActivity.java, CameraCaptureActivity.java, and TextureMovieEncoder.java.

The matrix can be used to perform various affine transformations, such as rotation and scaling, but cannot be used to clip an image.

The matrix is included in the API because there are times when the input source is in the "wrong" orientation. Rather than spending CPU or GPU cycles to rearrange the pixels, the system just sends a matrix along with each frame. If the frame contents are correct as-is, the matrix will be identity. If it's upside-down, a matrix with an appropriate correction will be provided.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!