Package com.microblink.blinkid.uisettings

# Class CameraSettings.Builder

java.lang.Object
com.microblink.blinkid.uisettings.CameraSettings.Builder

Enclosing class:
  CameraSettings

public static class CameraSettings.Builder extends Object

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Builder()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `CameraSettings`
  `build()`
  `CameraSettings.Builder`
  `setAspectMode(CameraAspectMode cameraAspectMode)`
  Defines which camera aspect mode will be used.
  `CameraSettings.Builder`
  `setForceLegacyApi(boolean forceLegacyCameraApi)`
  Sets whether legacy camera API should be used even on Lollipop devices that support newer Camera2 API.
  `CameraSettings.Builder`
  `setIsOptimizedForNearScan(boolean isOptimizedForNearScan)`
  Defines whether camera parameters should be optimized for near object scanning.
  `CameraSettings.Builder`
  `setIsPinchToZoomAllowed(boolean isPinchToZoomAllowed)`
  `CameraSettings.Builder`
  `setPreviewZoomScale(float previewZoomScale)`
  Sets the preview zoom scale that will be used to draw the camera preview.
  `CameraSettings.Builder`
  `setSurface(com.microblink.blinkid.view.surface.CameraSurface cameraSurface)`
  Defines which view will be used for displaying camera preview.
  `CameraSettings.Builder`
  `setType(CameraType cameraType)`
  Sets type of camera that will be used.
  `CameraSettings.Builder`
  `setVideoResolutionPreset(VideoResolutionPreset videoResolutionPreset)`
  Sets the video resolution preset that will be used when choosing camera resolution for scanning.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### Builder

    public Builder()

- ## Method Details

  - ### setType

    @NonNull public CameraSettings.Builder setType(@NonNull CameraType cameraType)
    Sets type of camera that will be used.
    Parameters:
      `cameraType` - type of camera that will be used.

  - ### setIsOptimizedForNearScan

    @NonNull public CameraSettings.Builder setIsOptimizedForNearScan(boolean isOptimizedForNearScan)
    Defines whether camera parameters should be optimized for near object scanning. When camera parameters are optimized for near object scanning, macro focus mode will be preferred over autofocus mode. Thus, camera will have easier time focusing on to near objects, but might have harder time focusing on far objects. If you expect that most of your scans will be performed by holding the device very near the object, turn on that parameter. By default, this parameter is set to `false`, except in cases when from other settings it can be safely concluded that it is better to turn it on.
    Parameters:
      `isOptimizedForNearScan` - whether camera parameters should be optimized for near object scanning.

  - ### setAspectMode

    @NonNull public CameraSettings.Builder setAspectMode(@NonNull CameraAspectMode cameraAspectMode)
    Defines which camera aspect mode will be used. If set to `CameraAspectMode.ASPECT_FIT` (default), then camera preview will be letterboxed inside available view space. If set to `CameraAspectMode.ASPECT_FILL`, camera preview will be zoomed and cropped to use the entire view space.
    Parameters:
      `cameraAspectMode` - camera aspect mode that will be used.

  - ### setPreviewZoomScale

    public CameraSettings.Builder setPreviewZoomScale(@FloatRange(from=1.0,to=2.0) float previewZoomScale)
    Sets the preview zoom scale that will be used to draw the camera preview. If the preview is upscaled, the visible part will be centered, and marginal parts of the camera preview will be invisible.
    Parameters:
      `previewZoomScale` - zoom scale in range [1, 2]

  - ### setSurface

    @NonNull public CameraSettings.Builder setSurface(@NonNull com.microblink.blinkid.view.surface.CameraSurface cameraSurface)
    Defines which view will be used for displaying camera preview.
    Parameters:
      `cameraSurface` - camera surface which view will be used for displaying camera preview.
    See Also:
      - `BaseCameraView.setRequestedSurfaceViewForCameraDisplay(CameraSurface)`

  - ### setForceLegacyApi

    @NonNull public CameraSettings.Builder setForceLegacyApi(boolean forceLegacyCameraApi)
    Sets whether legacy camera API should be used even on Lollipop devices that support newer Camera2 API. Default is `false`;
    Parameters:
      `forceLegacyCameraApi` - `true` to use legacy camera API, `false` otherwise.

  - ### setIsPinchToZoomAllowed

    @NonNull public CameraSettings.Builder setIsPinchToZoomAllowed(boolean isPinchToZoomAllowed)

  - ### setVideoResolutionPreset

    @NonNull public CameraSettings.Builder setVideoResolutionPreset(@NonNull VideoResolutionPreset videoResolutionPreset)
    Sets the video resolution preset that will be used when choosing camera resolution for scanning.
    Parameters:
      `videoResolutionPreset` - video resolution preset that will be used when choosing camera resolution for scanning.

  - ### build

    @NonNull public CameraSettings build()