public final class

HeifWriter.Builder

extends java.lang.Object

 java.lang.Object

↳androidx.heifwriter.HeifWriter.Builder

Overview

Builder class for constructing a HeifWriter 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 HeifWriterbuild()

Build a HeifWriter object.

public HeifWriter.BuildersetGridEnabled(boolean gridEnabled)

Set whether to enable grid option.

public HeifWriter.BuildersetHandler(Handler handler)

Provide a handler for the HeifWriter to use.

public HeifWriter.BuildersetMaxImages(int maxImages)

Set the maximum number of images to write.

public HeifWriter.BuildersetPrimaryIndex(int primaryIndex)

Set the primary image index.

public HeifWriter.BuildersetQuality(int quality)

Set the quality for encoding images.

public HeifWriter.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 HeifWriter.INPUT_MODE_BUFFER, HeifWriter.INPUT_MODE_SURFACE, or HeifWriter.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 HeifWriter.INPUT_MODE_BUFFER, HeifWriter.INPUT_MODE_SURFACE, or HeifWriter.INPUT_MODE_BITMAP.

Methods

public HeifWriter.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 HeifWriter.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 HeifWriter.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 HeifWriter.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 HeifWriter.INPUT_MODE_SURFACE, where the EOS timestamp must be specified (via WriterBase.setInputEndOfStreamTimestamp(long) and reached. Default is 1.

Returns:

this Builder object.

public HeifWriter.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 HeifWriter.Builder setHandler(Handler handler)

Provide a handler for the HeifWriter 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 HeifWriter build()

Build a HeifWriter object.

Returns:

a HeifWriter object built according to the specifications.