Package com.digimarc.capture.camera
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 Summary
Modifier and TypeMethodDescriptionvoid
close()
void
static CameraWrapper
create()
Create a CameraWrapper instance if one does not already exist.static CameraWrapper
get()
Gets the static CameraWrapper instance.android.hardware.Camera.Parameters
int
int
android.graphics.Point
int
getSensorToDeviceRotation
(int deviceRotation) boolean
boolean
Queries whether the handset has a flash (torch).void
onAutoFocus
(boolean arg0, android.hardware.Camera arg1) void
open
(android.graphics.SurfaceTexture surfaceTexture, android.view.ViewGroup surface, android.os.Handler handler) Opens the camera and re-sizes the camera surfaceview.void
setTorch
(boolean state) Enables/Disables the torch as long as the hardware supports torch modeboolean
void
void
void
void
triggerRegionFocus
(android.graphics.RectF region, int regionMask) Methods inherited from class com.digimarc.capture.camera.CameraWrapperBase
addCameraListener, getAdjustedRotation, getCameraObject, getCameraOrientation, isFocusing, isRegionAESupported, isRegionAFSupported, isRegionAWBSupported, isUsingCamera2, removeCameraListener, setUIHandler
-
Method Details
-
get
Gets the static CameraWrapper instance.- Returns:
- CameraWrapper object or null if it has not yet been created.
-
create
Create a CameraWrapper instance if one does not already exist. -
getOrientation
public int getOrientation()- Overrides:
getOrientation
in classCameraWrapperBase
-
getSensorToDeviceRotation
public int getSensorToDeviceRotation(int deviceRotation) - Overrides:
getSensorToDeviceRotation
in classCameraWrapperBase
-
getPreviewFormat
public int getPreviewFormat()- Overrides:
getPreviewFormat
in classCameraWrapperBase
-
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 theCameraNotifyListener
interface, wait forCameraNotifyListener.onCameraAvailable()
to be signalled before calling this method.- Overrides:
isTorchSupported
in classCameraWrapperBase
- 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 previewsurface
- The parent element that contains the camera viewhandler
- 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 classCameraWrapperBase
-
triggerCenterFocus
@RequiresPermission("android.permission.CAMERA") public void triggerCenterFocus()- Overrides:
triggerCenterFocus
in classCameraWrapperBase
-
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 classCameraWrapperBase
- Parameters:
state
- Whether to enable or disable the torch
-
isTorchOn
@RequiresPermission("android.permission.CAMERA") public boolean isTorchOn()- Overrides:
isTorchOn
in classCameraWrapperBase
-
getCachedParameters
@RequiresPermission("android.permission.CAMERA") @Nullable public android.hardware.Camera.Parameters getCachedParameters() -
getPreviewSizeAsPoint
@Nullable public android.graphics.Point getPreviewSizeAsPoint()- Overrides:
getPreviewSizeAsPoint
in classCameraWrapperBase
-
getMetadata
- Overrides:
getMetadata
in classCameraWrapperBase
-
onAutoFocus
@WorkerThread public void onAutoFocus(boolean arg0, @NonNull android.hardware.Camera arg1) - Specified by:
onAutoFocus
in interfaceandroid.hardware.Camera.AutoFocusCallback
-
triggerRegionFocus
public void triggerRegionFocus(@NonNull android.graphics.RectF region, int regionMask) - Overrides:
triggerRegionFocus
in classCameraWrapperBase
-