Builder
class Builder
kotlin.Any | |
↳ | android.media.ImageReader.Builder |
Builder class for ImageReader
objects.
Summary
Public constructors | |
---|---|
Constructs a new builder for |
Public methods | |
---|---|
ImageReader |
build() Builds a new ImageReader object. |
ImageReader.Builder |
setDefaultDataSpace(dataSpace: Int) Set the default dataspace passed by the producer. |
ImageReader.Builder |
setDefaultHardwareBufferFormat(hardwareBufferFormat: Int) Set the default hardwareBuffer format passed by the producer. |
ImageReader.Builder |
setImageFormat(imageFormat: Int) Set the default image format passed by the producer. |
ImageReader.Builder |
setMaxImages(maxImages: Int) Set the maximal number of images. |
ImageReader.Builder |
Set the consumer usage flag. |
Public constructors
Builder
Builder(
width: Int,
height: Int)
Constructs a new builder for ImageReader
.
Parameters | |
---|---|
width |
Int: The default width in pixels that will be passed to the producer. May be overridden by the producer. Value is 1 or greater |
height |
Int: The default height in pixels that will be passed to the producer. May be overridden by the producer. Value is 1 or greater |
See Also
Public methods
build
fun build(): ImageReader
Builds a new ImageReader object.
Return | |
---|---|
ImageReader |
The new ImageReader object. This value cannot be null . |
setDefaultDataSpace
fun setDefaultDataSpace(dataSpace: Int): ImageReader.Builder
Set the default dataspace passed by the producer. May be overridden by the producer.
This function works together with setDefaultHardwareBufferFormat
for an ImageReader
instance. Setting at least one of these two replaces setImageFormat
function.
Return | |
---|---|
ImageReader.Builder |
the builder instance with customized dataspace value. This value cannot be null . |
See Also
setDefaultHardwareBufferFormat
fun setDefaultHardwareBufferFormat(hardwareBufferFormat: Int): ImageReader.Builder
Set the default hardwareBuffer format passed by the producer. May be overridden by the producer.
This function works together with setDefaultDataSpace
for an ImageReader
instance. Setting at least one of these two replaces setImageFormat
function.
The format of the Image can be overridden after setImageFormat
by calling this function and then setDefaultDataSpace
functions. Warning: Missing one of callings for initializing or overriding the format may involve undefined behaviors.
Return | |
---|---|
ImageReader.Builder |
the builder instance with customized hardwareBuffer value. This value cannot be null . |
See Also
setImageFormat
fun setImageFormat(imageFormat: Int): ImageReader.Builder
Set the default image format passed by the producer. May be overridden by the producer.
setImageFormat
function replaces the combination of setDefaultHardwareBufferFormat
and setDefaultDataSpace
functions. Either this or these two functions must be called to initialize an ImageReader
instance.
Return | |
---|---|
ImageReader.Builder |
the builder instance with customized image format value. This value cannot be null . |
setMaxImages
fun setMaxImages(maxImages: Int): ImageReader.Builder
Set the maximal number of images.
Parameters | |
---|---|
maxImages |
Int: The maximum number of images the user will want to access simultaneously. This should be as small as possible to limit memory use. Default value is 1. |
Return | |
---|---|
ImageReader.Builder |
the Builder instance with customized usage value. This value cannot be null . |
setUsage
fun setUsage(usage: Long): ImageReader.Builder
Set the consumer usage flag.
Return | |
---|---|
ImageReader.Builder |
the Builder instance with customized usage value. This value cannot be null . |
See Also