GlMatrixTransformation
@UnstableApi
public interface GlMatrixTransformation extends GlEffect
MatrixTransformation |
Specifies a 3x3 transformation |
Crop |
Specifies a crop to apply in the vertex shader. |
Presentation |
Controls how a frame is presented with options to set the output resolution and choose how to map the input pixels onto the output frame geometry (for example, by stretching the input frame to match the specified output frame, or fitting the input frame using letterboxing). |
ScaleAndRotateTransformation |
Specifies a simple rotation and/or scale to apply in the vertex shader. |
Specifies a 4x4 transformation Matrix to apply in the vertex shader for each input frame.
The matrix is applied to points given in normalized device coordinates (-1 to 1 on x, y, and z axes). Transformed pixels that are moved outside of the normal device coordinate range are clipped.
Output frame pixels outside of the transformed input frame will be black, with alpha = 0 if applicable.
Summary
Public methods |
|
|---|---|
default Size |
configure(int inputWidth, int inputHeight)Configures the input and output dimensions. |
abstract float[] |
getGlMatrixArray(long presentationTimeUs)Returns the 4x4 transformation |
default int |
Returns the |
default BaseGlShaderProgram |
toGlShaderProgram(Context context, boolean useHdr)Returns a |
Inherited methods |
||
|---|---|---|
|
||
Public methods
configure
default Size configure(int inputWidth, int inputHeight)
Configures the input and output dimensions.
Must be called before getGlMatrixArray.
| Parameters | |
|---|---|
int inputWidth |
The input frame width, in pixels. |
int inputHeight |
The input frame height, in pixels. |
| Returns | |
|---|---|
Size |
The output frame width and height, in pixels. |
getGlMatrixArray
abstract float[] getGlMatrixArray(long presentationTimeUs)
Returns the 4x4 transformation Matrix to apply to the frame with the given timestamp.
getGlTextureMinFilter
@C.TextureMinFilter
default int getGlTextureMinFilter()
Returns the texture minification filter to use for sampling the input texture when applying this matrix transformation.
toGlShaderProgram
default BaseGlShaderProgram toGlShaderProgram(Context context, boolean useHdr)
Returns a GlShaderProgram that applies the effect.
| Parameters | |
|---|---|
Context context |
A |
boolean useHdr |
Whether input textures come from an HDR source. If |
| Throws | |
|---|---|
androidx.media3.common.VideoFrameProcessingException |
If an error occurs while creating the |