Class CameraWrapper

java.lang.Object
com.digimarc.capture.camera.CameraWrapperBase
com.digimarc.capture.camera.CameraWrapper
All Implemented Interfaces:
android.hardware.Camera.AutoFocusCallback

public class CameraWrapper extends CameraWrapperBase implements android.hardware.Camera.AutoFocusCallback
  • Method Details

    • get

      @Nullable public static CameraWrapper get()
      Gets the static CameraWrapper instance.
      Returns:
      CameraWrapper object or null if it has not yet been created.
    • create

      @NonNull public static CameraWrapper create()
      Create a CameraWrapper instance if one does not already exist.
    • getOrientation

      public int getOrientation()
      Overrides:
      getOrientation in class CameraWrapperBase
    • getSensorToDeviceRotation

      public int getSensorToDeviceRotation(int deviceRotation)
      Overrides:
      getSensorToDeviceRotation in class CameraWrapperBase
    • getPreviewFormat

      public int getPreviewFormat()
      Overrides:
      getPreviewFormat in class CameraWrapperBase
    • isTorchSupported

      public boolean isTorchSupported()
      Queries whether the handset has a flash (torch). The value returned will not be valid if this is called before the camera has been initialized and opened. If you use the CameraNotifyListener interface, wait for CameraNotifyListener.onCameraAvailable() to be signalled before calling this method.
      Overrides:
      isTorchSupported in class CameraWrapperBase
      Returns:
      True if the device has an accessible torch.
    • startPreview

      @RequiresPermission("android.permission.CAMERA") public boolean startPreview()
    • stopPreview

      @RequiresPermission("android.permission.CAMERA") public void stopPreview()
    • configureCameraBuffers

      @RequiresPermission("android.permission.CAMERA") public void configureCameraBuffers()
    • close

      @RequiresPermission("android.permission.CAMERA") public void close()
    • open

      @RequiresPermission("android.permission.CAMERA") public void open(@NonNull android.graphics.SurfaceTexture surfaceTexture, @NonNull android.view.ViewGroup surface, @NonNull android.os.Handler handler)
      Opens the camera and re-sizes the camera surfaceview.
      Parameters:
      surfaceTexture - The surface texture for live camera preview
      surface - The parent element that contains the camera view
      handler - Handler that will be used for any errors that occur while opening the camera.
    • triggerAutoFocus

      @RequiresPermission("android.permission.CAMERA") public void triggerAutoFocus()
      Overrides:
      triggerAutoFocus in class CameraWrapperBase
    • triggerCenterFocus

      @RequiresPermission("android.permission.CAMERA") public void triggerCenterFocus()
      Overrides:
      triggerCenterFocus in class CameraWrapperBase
    • setTorch

      @RequiresPermission("android.permission.CAMERA") public void setTorch(boolean state)
      Enables/Disables the torch as long as the hardware supports torch mode
      Overrides:
      setTorch in class CameraWrapperBase
      Parameters:
      state - Whether to enable or disable the torch
    • isTorchOn

      @RequiresPermission("android.permission.CAMERA") public boolean isTorchOn()
      Overrides:
      isTorchOn in class CameraWrapperBase
    • getCachedParameters

      @RequiresPermission("android.permission.CAMERA") @Nullable public android.hardware.Camera.Parameters getCachedParameters()
    • getPreviewSizeAsPoint

      @Nullable public android.graphics.Point getPreviewSizeAsPoint()
      Overrides:
      getPreviewSizeAsPoint in class CameraWrapperBase
    • getMetadata

      @Nullable public Metadata getMetadata()
      Overrides:
      getMetadata in class CameraWrapperBase
    • onAutoFocus

      @WorkerThread public void onAutoFocus(boolean arg0, @NonNull android.hardware.Camera arg1)
      Specified by:
      onAutoFocus in interface android.hardware.Camera.AutoFocusCallback
    • triggerRegionFocus

      public void triggerRegionFocus(@NonNull android.graphics.RectF region, int regionMask)
      Overrides:
      triggerRegionFocus in class CameraWrapperBase