@UnstableApi
class AlphaScale : GlEffect


Scales the alpha value (i.e. the translucency) of a frame.

Summary

Public constructors

AlphaScale(alphaScale: @FloatRange(from = 0) Float)

Creates a new instance to scale the entire frame's alpha values by alphaScale, to modify translucency.

Public functions

Boolean
isNoOp(inputWidth: Int, inputHeight: Int)

Returns whether a GlEffect applies no change at every timestamp.

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

Returns a GlShaderProgram that applies the effect.

Inherited functions

From androidx.media3.common.Effect
Long

Returns the expected duration of the output stream when the effect is applied given a input durationUs.

Public constructors

AlphaScale

AlphaScale(alphaScale: @FloatRange(from = 0) Float)

Creates a new instance to scale the entire frame's alpha values by alphaScale, to modify translucency.

An alphaScale value of 1 means no change is applied. A value below 1 increases translucency, and a value above 1 reduces translucency.

Public functions

isNoOp

fun isNoOp(inputWidth: Int, inputHeight: Int): Boolean

Returns whether a GlEffect applies no change at every timestamp.

This can be used as a hint to skip this instance.

Parameters
inputWidth: Int

The input frame width, in pixels.

inputHeight: Int

The input frame height, in pixels.

toGlShaderProgram

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

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 .