Android Dev Summit, October 23-24: two days of technical content, directly from the Android team. Sign-up for livestream updates.

ImageCaptureConfig

public final class ImageCaptureConfig
extends Object implements Config, UseCaseEventConfig

java.lang.Object
   ↳ androidx.camera.core.ImageCaptureConfig


Configuration for an image capture use case.

Summary

Nested classes

class ImageCaptureConfig.Builder

Builder for a ImageCaptureConfig

Public methods

Executor getBackgroundExecutor()

Returns the executor that will be used for background tasks.

Executor getBackgroundExecutor(Executor valueIfMissing)

Returns the executor that will be used for background tasks.

ImageCapture.CaptureMode getCaptureMode(ImageCapture.CaptureMode valueIfMissing)

Returns the ImageCapture.CaptureMode.

ImageCapture.CaptureMode getCaptureMode()

Returns the ImageCapture.CaptureMode.

FlashMode getFlashMode()

Returns the FlashMode.

FlashMode getFlashMode(FlashMode valueIfMissing)

Returns the FlashMode.

CameraX.LensFacing getLensFacing()

Retrieves the lens facing direction for the primary camera to be configured.

CameraX.LensFacing getLensFacing(CameraX.LensFacing valueIfMissing)

Returns the lens-facing direction of the camera being configured.

AspectRatio getTargetAspectRatio(AspectRatio valueIfMissing)

Retrieves the aspect ratio of the target intending to use images from this configuration.

AspectRatio getTargetAspectRatio()

Retrieves the aspect ratio of the target intending to use images from this configuration.

String getTargetName()

Retrieves the name of the target object being configured.

String getTargetName(String valueIfMissing)

Retrieves the name of the target object being configured.

Size getTargetResolution(Size valueIfMissing)

Retrieves the resolution of the target intending to use from this configuration.

Size getTargetResolution()

Retrieves the resolution of the target intending to use from this configuration.

int getTargetRotation()

Retrieves the rotation of the target intending to use images from this configuration.

int getTargetRotation(int valueIfMissing)

Retrieves the rotation of the target intending to use images from this configuration.

Inherited methods

Public methods

getBackgroundExecutor

public Executor getBackgroundExecutor ()

Returns the executor that will be used for background tasks.

Returns
Executor The stored value, if it exists in this configuration.

Throws
IllegalArgumentException if the option does not exist in this configuration.

getBackgroundExecutor

public Executor getBackgroundExecutor (Executor valueIfMissing)

Returns the executor that will be used for background tasks.

Parameters
valueIfMissing Executor: The value to return if this configuration option has not been set.

Returns
Executor The stored value or valueIfMissing if the value does not exist in this configuration.

getCaptureMode

public ImageCapture.CaptureMode getCaptureMode (ImageCapture.CaptureMode valueIfMissing)

Returns the ImageCapture.CaptureMode.

Parameters
valueIfMissing ImageCapture.CaptureMode: The value to return if this configuration option has not been set.

Returns
ImageCapture.CaptureMode The stored value or valueIfMissing if the value does not exist in this configuration.

getCaptureMode

public ImageCapture.CaptureMode getCaptureMode ()

Returns the ImageCapture.CaptureMode.

Returns
ImageCapture.CaptureMode The stored value, if it exists in this configuration.

Throws
IllegalArgumentException if the option does not exist in this configuration.

getFlashMode

public FlashMode getFlashMode ()

Returns the FlashMode.

Returns
FlashMode The stored value, if it exists in this configuration.

Throws
IllegalArgumentException if the option does not exist in this configuration.

getFlashMode

public FlashMode getFlashMode (FlashMode valueIfMissing)

Returns the FlashMode.

Parameters
valueIfMissing FlashMode: The value to return if this configuration option has not been set.

Returns
FlashMode The stored value or valueIfMissing if the value does not exist in this configuration.

getLensFacing

public CameraX.LensFacing getLensFacing ()

Retrieves the lens facing direction for the primary camera to be configured.

Returns
CameraX.LensFacing The stored value, if it exists in this configuration.

Throws
IllegalArgumentException if the option does not exist in this configuration.

getLensFacing

public CameraX.LensFacing getLensFacing (CameraX.LensFacing valueIfMissing)

Returns the lens-facing direction of the camera being configured.

Parameters
valueIfMissing CameraX.LensFacing: The value to return if this configuration option has not been set.

Returns
CameraX.LensFacing The stored value or valueIfMissing if the value does not exist in this configuration.

getTargetAspectRatio

public AspectRatio getTargetAspectRatio (AspectRatio valueIfMissing)

Retrieves the aspect ratio of the target intending to use images from this configuration.

Parameters
valueIfMissing AspectRatio: The value to return if this configuration option has not been set.

Returns
AspectRatio The stored value or valueIfMissing if the value does not exist in this configuration.

getTargetAspectRatio

public AspectRatio getTargetAspectRatio ()

Retrieves the aspect ratio of the target intending to use images from this configuration.

Returns
AspectRatio The stored value, if it exists in this configuration.

Throws
IllegalArgumentException if the option does not exist in this configuration.

getTargetName

public String getTargetName ()

Retrieves 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.

Returns
String The stored value, if it exists in this configuration.

Throws
IllegalArgumentException if the option does not exist in this configuration.

getTargetName

public String getTargetName (String valueIfMissing)

Retrieves 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
valueIfMissing String: The value to return if this configuration option has not been set.

Returns
String The stored value or valueIfMissing if the value does not exist in this configuration.

getTargetResolution

public Size getTargetResolution (Size valueIfMissing)

Retrieves the resolution of the target intending to use from this configuration.

Parameters
valueIfMissing Size: The value to return if this configuration option has not been set.

Returns
Size The stored value or valueIfMissing if the value does not exist in this configuration.

getTargetResolution

public Size getTargetResolution ()

Retrieves the resolution of the target intending to use from this configuration.

Returns
Size The stored value, if it exists in this configuration.

Throws
IllegalArgumentException if the option does not exist in this configuration.

getTargetRotation

public int getTargetRotation ()

Retrieves the rotation of the target intending to use 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 device's "natural" rotation, Surface.ROTATION_0.

Returns
int The stored value, if it exists in this configuration.

Throws
IllegalArgumentException if the option does not exist in this configuration.

getTargetRotation

public int getTargetRotation (int valueIfMissing)

Retrieves the rotation of the target intending to use 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 device's "natural" rotation, Surface.ROTATION_0.

Parameters
valueIfMissing int: The value to return if this configuration option has not been set.

Returns
int The stored value or valueIfMissing if the value does not exist in this configuration.