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

All,

I work with SurfaceTexture in Android, but I can’t understand its API: getTransformMatrix (float [] mtx), the API document looks like this:

/**
 * Retrieve the 4x4 texture coordinate transform matrix associated with the texture image set by
 * the most recent call to updateTexImage.
 *
 * This transform matrix maps 2D homogeneous texture coordinates of the form (s, t, 0, 1) with s
 * and t in the inclusive range [0, 1] to the texture coordinate that should be used to sample
 * that location from the texture.  Sampling the texture outside of the range of this transform
 * is undefined.
 *
 * The matrix is stored in column-major order so that it may be passed directly to OpenGL ES via
 * the glLoadMatrixf or glUniformMatrix4fv functions.
 *
 * @param mtx the array into which the 4x4 matrix will be stored.  The array must have exactly
 *     16 elements.
 */

After reading this, I really don't know how to use it. I want to crop a texture image in a SurfaceTexture and provide a SurfaceTexture obj to an EGLSurface object.

For example, the original image is 320 * 720 (w * h), and I expect the new image to be 320 * 240 (w * h)

What should I do to achieve this function? Can the 4 * 4 matrix help me? What should I do with a 4 * 4 matrix?

+3
source share
1 answer

GLES- , . , , , GLES SurfaceTexture.

Grafika; ContinuousCaptureActivity.java, CameraCaptureActivity.java TextureMovieEncoder.java.

, , , .

API, , "" . , CPU GPU , . , . , ​​ .

+2

All Articles