ImageCaptureConfig.Builder
public
static
final
class
ImageCaptureConfig.Builder
extends Object
implements
Config.ExtendableBuilder,
Builder<ImageCaptureConfig.Builder>
| java.lang.Object | |
| ↳ | androidx.camera.core.ImageCaptureConfig.Builder |
Builder for a ImageCaptureConfig.
Summary
Public constructors | |
|---|---|
ImageCaptureConfig.Builder()
Creates a new Builder object. |
|
Public methods | |
|---|---|
ImageCaptureConfig
|
build()
Builds an immutable |
static
ImageCaptureConfig.Builder
|
fromConfig(ImageCaptureConfig configuration)
Generates a Builder from another Config object |
ImageCaptureConfig.Builder
|
setCallbackHandler(Handler handler)
Sets the default handler that will be used for callbacks. |
ImageCaptureConfig.Builder
|
setCaptureMode(ImageCapture.CaptureMode captureMode)
Sets the image capture mode. |
ImageCaptureConfig.Builder
|
setFlashMode(FlashMode flashMode)
Sets the |
ImageCaptureConfig.Builder
|
setLensFacing(CameraX.LensFacing lensFacing)
Sets the primary camera to be configured based on the direction the lens is facing. |
ImageCaptureConfig.Builder
|
setTargetAspectRatio(Rational aspectRatio)
Sets the aspect ratio of the intended target for images from this configuration. |
ImageCaptureConfig.Builder
|
setTargetName(String targetName)
Sets the name of the target object being configured. |
ImageCaptureConfig.Builder
|
setTargetResolution(Size resolution)
Sets the intended output target resolution. |
ImageCaptureConfig.Builder
|
setTargetRotation(int rotation)
Sets the rotation of the intended target for images from this configuration. |
Inherited methods | |
|---|---|
Public constructors
ImageCaptureConfig.Builder
public ImageCaptureConfig.Builder ()
Creates a new Builder object.
Public methods
build
public ImageCaptureConfig build ()
Builds an immutable ImageCaptureConfig from the current state.
| Returns | |
|---|---|
ImageCaptureConfig |
A ImageCaptureConfig populated with the current state.
|
fromConfig
public static ImageCaptureConfig.Builder fromConfig (ImageCaptureConfig configuration)
Generates a Builder from another Config object
| Parameters | |
|---|---|
configuration |
ImageCaptureConfig: An immutable configuration to pre-populate this builder. |
| Returns | |
|---|---|
ImageCaptureConfig.Builder |
The new Builder. |
setCallbackHandler
public ImageCaptureConfig.Builder setCallbackHandler (Handler handler)
Sets the default handler that will be used for callbacks.
| Parameters | |
|---|---|
handler |
Handler: The handler which will be used to post callbacks. |
| Returns | |
|---|---|
ImageCaptureConfig.Builder |
the current Builder. |
setCaptureMode
public ImageCaptureConfig.Builder setCaptureMode (ImageCapture.CaptureMode captureMode)
Sets the image capture mode.
Valid capture modes are ImageCapture.CaptureMode.MIN_LATENCY, which prioritizes latency
over image quality, or ImageCapture.CaptureMode.MAX_QUALITY, which prioritizes image quality
over latency.
| Parameters | |
|---|---|
captureMode |
ImageCapture.CaptureMode: The requested image capture mode. |
| Returns | |
|---|---|
ImageCaptureConfig.Builder |
The current Builder. |
setFlashMode
public ImageCaptureConfig.Builder setFlashMode (FlashMode flashMode)
Sets the FlashMode.
| Parameters | |
|---|---|
flashMode |
FlashMode: The requested flash mode. |
| Returns | |
|---|---|
ImageCaptureConfig.Builder |
The current Builder. |
setLensFacing
public ImageCaptureConfig.Builder setLensFacing (CameraX.LensFacing lensFacing)
Sets the primary camera to be configured based on the direction the lens is facing.
If multiple cameras exist with equivalent lens facing direction, the first ("primary") camera for that direction will be chosen.
| Parameters | |
|---|---|
lensFacing |
CameraX.LensFacing: The direction of the camera's lens. |
| Returns | |
|---|---|
ImageCaptureConfig.Builder |
the current Builder. |
setTargetAspectRatio
public ImageCaptureConfig.Builder setTargetAspectRatio (Rational aspectRatio)
Sets the aspect ratio of the intended target for images from this configuration.
This is the ratio of the target's width to the image's height, where the numerator of
the provided Rational corresponds to the width, and the denominator corresponds
to the height.
The target aspect ratio is used as a hint when determining the resulting output aspect ratio which may differ from the request, possibly due to device constraints. Application code should check the resulting output's resolution.
For ImageCapture, the outputs are the ImageProxy or the File passed to image
capture listeners.
| Parameters | |
|---|---|
aspectRatio |
Rational: A Rational representing the ratio of the target's width and
height. |
| Returns | |
|---|---|
ImageCaptureConfig.Builder |
The current Builder. |
setTargetName
public ImageCaptureConfig.Builder setTargetName (String targetName)
Sets the name of the target object being configured.
The name should be a value that can uniquely identify an instance of the object being configured.
| Parameters | |
|---|---|
targetName |
String: A unique string identifier for the instance of the class being
configured. |
| Returns | |
|---|---|
ImageCaptureConfig.Builder |
the current Builder. |
setTargetResolution
public ImageCaptureConfig.Builder setTargetResolution (Size resolution)
Sets the intended output target resolution.
The target resolution attempts to establish a minimum bound for the image resolution. The actual image resolution will be the closest available resolution in size that is not smaller than the target resolution, as determined by the Camera implementation. However, if no resolution exists that is equal to or larger than the target resolution, the nearest available resolution smaller than the target resolution will be chosen.
| Parameters | |
|---|---|
resolution |
Size: The target resolution to choose from supported output sizes list. |
| Returns | |
|---|---|
ImageCaptureConfig.Builder |
The current Builder. |
setTargetRotation
public ImageCaptureConfig.Builder setTargetRotation (int rotation)
Sets the rotation of the intended target for images from this configuration.
This is one of four valid values: Surface.ROTATION_0, Surface.ROTATION_90, Surface.ROTATION_180, Surface.ROTATION_270.
Rotation values are relative to the "natural" rotation, Surface.ROTATION_0.
| Parameters | |
|---|---|
rotation |
int: The rotation of the intended target. |
| Returns | |
|---|---|
ImageCaptureConfig.Builder |
The current Builder. |
Interfaces
Classes
Enums
Exceptions