public final class

OverlaySettings.Builder

extends java.lang.Object

 java.lang.Object

↳androidx.media3.effect.OverlaySettings.Builder

Overview

A builder for OverlaySettings instances.

Summary

Constructors
publicBuilder()

Creates a new OverlaySettings.Builder.

Methods
public OverlaySettingsbuild()

Creates an instance of OverlaySettings, using defaults if values are unset.

public OverlaySettings.BuildersetAlphaScale(float alphaScale)

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

public OverlaySettings.BuildersetBackgroundFrameAnchor(float x, float y)

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

public OverlaySettings.BuildersetHdrLuminanceMultiplier(float hdrLuminanceMultiplier)

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

public OverlaySettings.BuildersetOverlayFrameAnchor(float x, float y)

Sets the coordinates for the anchor point of the overlay frame.

public OverlaySettings.BuildersetRotationDegrees(float rotationDegree)

Sets the rotation of the overlay, counter-clockwise.

public OverlaySettings.BuildersetScale(float x, float y)

Sets the scaling of the overlay.

from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructors

public Builder()

Creates a new OverlaySettings.Builder.

Methods

public OverlaySettings.Builder setAlphaScale(float alphaScale)

Sets 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.

Set to always return 1 by default.

public OverlaySettings.Builder setBackgroundFrameAnchor(float x, float y)

Sets 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. Set to always return (0,0) (the center of the background frame) by default.

For example, a value of (+1,+1) will move the overlay frames's anchor point to the top right corner of the background frame.

Parameters:

x: The NDC x-coordinate in the range [-1, 1].
y: The NDC y-coordinate in the range [-1, 1].

public OverlaySettings.Builder setOverlayFrameAnchor(float x, float y)

Sets the coordinates for the anchor point of the overlay frame.

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

The coordinates are specified in Normalised Device Coordinates (NDCs) relative to the overlay frame. Set to return (0,0) (the center of the overlay frame) by default.

For example, a value of (+1,-1) will result in the overlay frame being positioned with its bottom right corner positioned at the background frame anchor.

Parameters:

x: The NDC x-coordinate in the range [-1, 1].
y: The NDC y-coordinate in the range [-1, 1].

public OverlaySettings.Builder setScale(float x, float y)

Sets the scaling of the overlay.

Parameters:

x: The desired scaling in the x axis of the overlay.
y: The desired scaling in the y axis of the overlay.

public OverlaySettings.Builder setRotationDegrees(float rotationDegree)

Sets the rotation of the overlay, counter-clockwise.

The overlay is rotated at the center of its frame.

Parameters:

rotationDegree: The desired degrees of rotation, counter-clockwise.

public OverlaySettings.Builder setHdrLuminanceMultiplier(float hdrLuminanceMultiplier)

Set 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

public OverlaySettings build()

Creates an instance of OverlaySettings, using defaults if values are unset.