Register now for Android Dev Summit 2019!

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

Handler getCallbackHandler(Handler valueIfMissing)

Returns the default handler that will be used for callbacks.

Handler getCallbackHandler()

Returns the default handler that will be used for callbacks.

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.

Rational getTargetAspectRatio(Rational valueIfMissing)

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

Rational 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

getCallbackHandler

public Handler getCallbackHandler (Handler valueIfMissing)

Returns the default handler that will be used for callbacks.

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

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

getCallbackHandler

public Handler getCallbackHandler ()

Returns the default handler that will be used for callbacks.

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

Throws
IllegalArgumentException if the option 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 Rational getTargetAspectRatio (Rational valueIfMissing)

Retrieves the aspect ratio of the target intending to use 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.

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

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

getTargetAspectRatio

public Rational getTargetAspectRatio ()

Retrieves the aspect ratio of the target intending to use 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.

Returns
Rational 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.