OverlaySettings.Builder


public final class OverlaySettings.Builder


A builder for OverlaySettings instances.

Summary

Public constructors

Creates a new Builder.

Public methods

OverlaySettings

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

OverlaySettings.Builder
@CanIgnoreReturnValue
setAlphaScale(@FloatRange(from = 0) float alphaScale)

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

OverlaySettings.Builder
@CanIgnoreReturnValue
setBackgroundFrameAnchor(
    @FloatRange(from = "-1", to = 1) float x,
    @FloatRange(from = "-1", to = 1) float y
)

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

OverlaySettings.Builder
@CanIgnoreReturnValue
setHdrLuminanceMultiplier(float hdrLuminanceMultiplier)

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

OverlaySettings.Builder
@CanIgnoreReturnValue
setOverlayFrameAnchor(
    @FloatRange(from = "-1", to = 1) float x,
    @FloatRange(from = "-1", to = 1) float y
)

Sets the coordinates for the anchor point within the overlay.

OverlaySettings.Builder

Sets the rotation of the overlay, counter-clockwise.

OverlaySettings.Builder
@CanIgnoreReturnValue
setScale(float x, float y)

Sets the scaling of the overlay.

Public constructors

Builder

public Builder()

Creates a new Builder.

Public methods

build

public OverlaySettings build()

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

setAlphaScale

@CanIgnoreReturnValue
public OverlaySettings.Builder setAlphaScale(@FloatRange(from = 0) 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.

setBackgroundFrameAnchor

@CanIgnoreReturnValue
public OverlaySettings.Builder setBackgroundFrameAnchor(
    @FloatRange(from = "-1", to = 1) float x,
    @FloatRange(from = "-1", to = 1) 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. The default value is (0,0), the center of the background frame.

The overlay's anchor point will be positioned at the anchor point set in this method. For example, setting 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.

Parameters
@FloatRange(from = "-1", to = 1) float x

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

@FloatRange(from = "-1", to = 1) float y

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

setHdrLuminanceMultiplier

@CanIgnoreReturnValue
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

setOverlayFrameAnchor

@CanIgnoreReturnValue
public OverlaySettings.Builder setOverlayFrameAnchor(
    @FloatRange(from = "-1", to = 1) float x,
    @FloatRange(from = "-1", to = 1) float y
)

Sets 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 default value is (0,0), the center of the overlay.

See setBackgroundFrameAnchor for examples of how to position an overlay.

Parameters
@FloatRange(from = "-1", to = 1) float x

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

@FloatRange(from = "-1", to = 1) float y

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

setRotationDegrees

@CanIgnoreReturnValue
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
float rotationDegree

The desired degrees of rotation, counter-clockwise.

setScale

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

Sets the scaling of the overlay.

Parameters
float x

The desired scaling in the x axis of the overlay.

float y

The desired scaling in the y axis of the overlay.