@UnstableApi
class RgbFilter : RgbMatrix


Provides common color filters.

Summary

Public functions

java-static RgbFilter!

Creates a new grayscale RgbFilter instance.

java-static RgbFilter!

Creates a new inverted RgbFilter instance.

FloatArray<Float>!
getMatrix(presentationTimeUs: Long, useHdr: Boolean)

Returns the 4x4 RGB transformation matrix to apply to the color values of each pixel in the frame with the given timestamp.

BaseGlShaderProgram!
toGlShaderProgram(context: Context!, useHdr: Boolean)

Returns a GlShaderProgram that applies the effect.

Inherited functions

From androidx.media3.effect.GlEffect
Boolean
isNoOp(inputWidth: Int, inputHeight: Int)

Returns whether a GlEffect applies no change at every timestamp.

abstract GlShaderProgram!
toGlShaderProgram(context: Context!, useHdr: Boolean)

Returns a GlShaderProgram that applies the effect.

Public functions

createGrayscaleFilter

java-static fun createGrayscaleFilter(): RgbFilter!

Creates a new grayscale RgbFilter instance.

createInvertedFilter

java-static fun createInvertedFilter(): RgbFilter!

Creates a new inverted RgbFilter instance.

getMatrix

fun getMatrix(presentationTimeUs: Long, useHdr: Boolean): FloatArray<Float>!

Returns the 4x4 RGB transformation matrix to apply to the color values of each pixel in the frame with the given timestamp.

Parameters
presentationTimeUs: Long

The timestamp of the frame to apply the matrix on.

useHdr: Boolean

If true, colors will be in linear RGB BT.2020. If false, colors will be in linear RGB BT.709. Must be consistent with useHdr in toGlShaderProgram.

Returns
FloatArray<Float>!

The RgbMatrix to apply to the frame.

toGlShaderProgram

fun toGlShaderProgram(context: Context!, useHdr: Boolean): BaseGlShaderProgram!

Returns a GlShaderProgram that applies the effect.

Parameters
context: Context!

A Context.

useHdr: Boolean

Whether input textures come from an HDR source. If true, colors will be in linear RGB BT.2020. If false, colors will be in linear RGB BT.709.

Throws
androidx.media3.common.VideoFrameProcessingException

If an error occurs while creating the .