StaticOverlaySettings


@UnstableApi
public final class StaticOverlaySettings implements OverlaySettings


A statically valued OverlaySettings.

Summary

Nested types

A builder for StaticOverlaySettings instances.

Public fields

final float
final Pair<FloatFloat>
final float
final Pair<FloatFloat>
final float
final Pair<FloatFloat>

Public methods

float

Returns the alpha scale value of the overlay, altering its translucency.

Pair<FloatFloat>

Returns the coordinates for the anchor point of the overlay within the background frame.

float

Returns the luminance multiplier of an SDR overlay when overlaid on a HDR frame.

Pair<FloatFloat>

Returns the coordinates for the anchor point within the overlay.

float

Returns the rotation of the overlay, counter-clockwise.

Pair<FloatFloat>

Returns the scaling of the overlay.

Inherited Constants

From androidx.media3.common.OverlaySettings
static final float

The default alpha scale value of the overlay.

static final Pair<FloatFloat>

The default coordinates for the anchor point of the overlay within the background frame.

static final float

The default luminance multiplier of an SDR overlay when overlaid on a HDR frame.

static final Pair<FloatFloat>

The default coordinates for the anchor point of the overlay frame.

static final float

The default rotation of the overlay, counter-clockwise.

static final Pair<FloatFloat>

The default scaling of the overlay.

Public fields

alphaScale

public final float alphaScale

backgroundFrameAnchor

public final Pair<FloatFloatbackgroundFrameAnchor

hdrLuminanceMultiplier

public final float hdrLuminanceMultiplier

overlayFrameAnchor

public final Pair<FloatFloatoverlayFrameAnchor

rotationDegrees

public final float rotationDegrees

scale

public final Pair<FloatFloatscale

Public methods

getAlphaScale

public float getAlphaScale()

Returns the alpha scale value of the overlay, altering its translucency.

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

The default value is DEFAULT_ALPHA_SCALE.

getBackgroundFrameAnchor

public Pair<FloatFloatgetBackgroundFrameAnchor()

Returns the coordinates for the anchor point of the overlay within the background frame.

The coordinates are specified in Normalised Device Coordinates (NDCs) relative to the background frame. The ranges for x and y are from -1 to 1. The default value is (0,0), the center of the background frame.

The overlay's anchor point will be positioned at the anchor point returned from this method. For example, a value of (1,1) will move the overlay's anchor to the top right corner. That is, if the overlay's anchor is at (1,1) (the top right corner), the overlay's top right corner will be aligned with that of the background frame; whereas if the overlay's anchor is at (0,0) (the center), the overlay's center will be positioned at the top right corner of the background frame.

The default value is DEFAULT_BACKGROUND_FRAME_ANCHOR.

getHdrLuminanceMultiplier

public float getHdrLuminanceMultiplier()

Returns the luminance multiplier of an SDR overlay when overlaid on a HDR frame.

Scales the luminance of the overlay to adjust the output brightness of the overlay on the frame. The default value is 1, which scales the overlay colors into the standard HDR luminance within the processing pipeline. Use 0.5 to scale the luminance of the overlay to SDR range, so that no extra luminance is added.

Currently only supported on text overlays

The default value is DEFAULT_HDR_LUMINANCE_MULTIPLIER.

getOverlayFrameAnchor

public Pair<FloatFloatgetOverlayFrameAnchor()

Returns the coordinates for the anchor point within the overlay.

The anchor point is the point inside the overlay that is placed on the background frame anchor

The coordinates are specified in Normalised Device Coordinates (NDCs) relative to the overlay. The ranges for x and y are from -1 to 1. The default value is (0,0), the center of the overlay.

See getBackgroundFrameAnchor for examples of how to position an overlay.

The default value is DEFAULT_OVERLAY_FRAME_ANCHOR.

getRotationDegrees

public float getRotationDegrees()

Returns the rotation of the overlay, counter-clockwise.

The overlay is rotated at the center of its frame.

The default value is DEFAULT_ROTATION_DEGREES.

getScale

public Pair<FloatFloatgetScale()

Returns the scaling of the overlay.

The default value is DEFAULT_SCALE.