public final class

AvifWriter.Builder

extends java.lang.Object

 java.lang.Object

↳androidx.heifwriter.AvifWriter.Builder

Overview

Builder class for constructing a AvifWriter object from specified parameters.

Summary

Constructors
publicBuilder(java.io.FileDescriptor fd, int width, int height, int inputMode)

Construct a Builder with output specified by its file descriptor.

publicBuilder(java.lang.String path, int width, int height, int inputMode)

Construct a Builder with output specified by its path.

Methods
public AvifWriterbuild()

Build a AvifWriter object.

public AvifWriter.BuildersetGridEnabled(boolean gridEnabled)

Set whether to enable grid option.

public AvifWriter.BuildersetHandler(Handler handler)

Provide a handler for the AvifWriter to use.

public AvifWriter.BuildersetHighBitDepthEnabled(boolean highBitDepthEnabled)

Provide a setting for the AvifWriter to use high bit-depth or not.

public AvifWriter.BuildersetMaxImages(int maxImages)

Set the maximum number of images to write.

public AvifWriter.BuildersetPrimaryIndex(int primaryIndex)

Set the primary image index.

public AvifWriter.BuildersetQuality(int quality)

Set the quality for encoding images.

public AvifWriter.BuildersetRotation(int rotation)

Set the image rotation in degrees.

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

Constructors

public Builder(java.lang.String path, int width, int height, int inputMode)

Construct a Builder with output specified by its path.

Parameters:

path: Path of the file to be written.
width: Width of the image in number of pixels.
height: Height of the image in number of pixels.
inputMode: Input mode for this writer, must be one of AvifWriter.INPUT_MODE_BUFFER, AvifWriter.INPUT_MODE_SURFACE, or AvifWriter.INPUT_MODE_BITMAP.

public Builder(java.io.FileDescriptor fd, int width, int height, int inputMode)

Construct a Builder with output specified by its file descriptor.

Parameters:

fd: File descriptor of the file to be written.
width: Width of the image in number of pixels.
height: Height of the image in number of pixels.
inputMode: Input mode for this writer, must be one of AvifWriter.INPUT_MODE_BUFFER, AvifWriter.INPUT_MODE_SURFACE, or AvifWriter.INPUT_MODE_BITMAP.

Methods

public AvifWriter.Builder setRotation(int rotation)

Set the image rotation in degrees.

Parameters:

rotation: Rotation angle in degrees (clockwise) of the image, must be 0, 90, 180 or 270. Default is 0.

Returns:

this Builder object.

public AvifWriter.Builder setGridEnabled(boolean gridEnabled)

Set whether to enable grid option.

Parameters:

gridEnabled: Whether to enable grid option. If enabled, the tile size will be automatically chosen. Default is to enable.

Returns:

this Builder object.

public AvifWriter.Builder setQuality(int quality)

Set the quality for encoding images.

Parameters:

quality: A number between 0 and 100 (inclusive), with 100 indicating the best quality supported by this implementation. Default is 100.

Returns:

this Builder object.

public AvifWriter.Builder setMaxImages(int maxImages)

Set the maximum number of images to write.

Parameters:

maxImages: Max number of images to write. Frames exceeding this number will not be written to file. The writing can be stopped earlier before this number of images are written by WriterBase.stop(long), except for the input mode of AvifWriter.INPUT_MODE_SURFACE, where the EOS timestamp must be specified (via WriterBase.setInputEndOfStreamTimestamp(long) and reached. Default is 1.

Returns:

this Builder object.

public AvifWriter.Builder setPrimaryIndex(int primaryIndex)

Set the primary image index.

Parameters:

primaryIndex: Index of the image that should be marked as primary, must be within range [0, maxImages - 1] inclusive. Default is 0.

Returns:

this Builder object.

public AvifWriter.Builder setHandler(Handler handler)

Provide a handler for the AvifWriter to use.

Parameters:

handler: If not null, client will receive all callbacks on the handler's looper. Otherwise, client will receive callbacks on a looper created by the writer. Default is null.

Returns:

this Builder object.

public AvifWriter.Builder setHighBitDepthEnabled(boolean highBitDepthEnabled)

Provide a setting for the AvifWriter to use high bit-depth or not.

Parameters:

highBitDepthEnabled: Whether to enable high bit-depth mode. Default is false, if true, AvifWriter will encode with high bit-depth.

Returns:

this Builder object.

public AvifWriter build()

Build a AvifWriter object.

Returns:

a AvifWriter object built according to the specifications.