public class CameraControllerApi2 extends CameraController
refreshROI, sDecodingSubType, sDecodingType
Constructor and Description |
---|
CameraControllerApi2(android.content.Context context)
Instantiate the CameraControllerApi2 object.
|
Modifier and Type | Method and Description |
---|---|
void |
closeCamera()
Closes the current
CameraDevice . |
void |
configureTransform(int viewWidth,
int viewHeight)
Configures the necessary
Matrix transformation to `mTextureView`. |
void |
createCameraPreviewSession()
Creates a new
CameraCaptureSession for camera preview. |
android.graphics.Point |
getCameraResolution()
Get the actual resolution given from the camera
|
int |
getPreviewOrientation()
Finds the angle to apply to the preview frames to get an image with natural orientation.
|
boolean |
isFlashSupported()
Detect is the flash is supported on the device.
|
boolean |
isZoomAvailable()
Get the information about the availability of the zoom .
|
void |
manualFocus(float motionX,
float motionY,
android.view.View view,
boolean isFocusRectangleVisible)
On double tap we switch to manual focus.
|
void |
openCamera(android.graphics.SurfaceTexture surfaceTexture,
int width,
int height)
Open the camera and if the permission is not granted a message will be displayde to the end user
|
void |
requestPreviewFrame(android.os.Handler handler,
int message)
A single preview frame will be returned to the handler supplied.
|
void |
setAutoFocusEnabled(boolean isAutoFocusEnabled)
If not already activated we turn on the auto focus.
|
void |
setCameraDevice(android.hardware.camera2.CameraDevice cameraDevice)
Set the camera device with the new camera API
|
void |
setCameraId(int cameraId)
Set the camera id
|
void |
setFlashEnabled(boolean flashEnabled)
Enable/Disable the flash on the device.
|
void |
setReadyToDecodeListener(OnImageReadyToBeSent listener)
Listener to inform that we are ready to decode
|
void |
setZoomCamera(int zoom)
Set the zoom of the camera.
|
drawDebugPreview, getContext, getDecodingSubType, getDecodingType, getDeviceOrientation, getRectangleFocusWidth, getRefreshROI, getRegionOfInterest, getRegionOfInterestInPreview, getRequestedROI, getSizeAutoFit, getSurfaceListener, getTextureView, getTickTimer, getVisualDebug, isInitialized, isOpen, setCameraIsOpen, setDebugPreview, setDecodingType, setDeviceOrientation, setInitialized, setOnTextureReadyListener, setRectangleFocusWidth, setRefreshROI, setRegionOfInterest, setRequestedROI, setROI, setROIPreview, setTextureView, setVisualDebug, textureViewReady
public CameraControllerApi2(android.content.Context context)
context
- Context.public void setCameraDevice(android.hardware.camera2.CameraDevice cameraDevice)
cameraDevice
- CameraDevice.public void setCameraId(int cameraId)
setCameraId
in class CameraController
cameraId
- The camera id, integer.public void setReadyToDecodeListener(OnImageReadyToBeSent listener)
listener
- OnImageReadyToBeSent.public android.graphics.Point getCameraResolution()
getCameraResolution
in class CameraController
public void configureTransform(int viewWidth, int viewHeight)
Matrix
transformation to `mTextureView`.
This method should be called after the camera preview size is determined in
setUpCameraOutputs and also the size of `mTextureView` is fixed.viewWidth
- The width of `mTextureView`viewHeight
- The height of `mTextureView`public void createCameraPreviewSession()
CameraCaptureSession
for camera preview.public int getPreviewOrientation()
getPreviewOrientation
in class CameraController
public void openCamera(android.graphics.SurfaceTexture surfaceTexture, int width, int height)
openCamera
in class CameraController
surfaceTexture
- Surface where the preview will be displayed.width
- height
- public void closeCamera()
CameraDevice
.closeCamera
in class CameraController
public boolean isFlashSupported()
public void setFlashEnabled(boolean flashEnabled)
flashEnabled
- public void requestPreviewFrame(android.os.Handler handler, int message)
requestPreviewFrame
in class CameraController
handler
- The handler to send the message to.message
- The what field of the message to be sent.public boolean isZoomAvailable()
isZoomAvailable
in class CameraController
public void setZoomCamera(int zoom)
setZoomCamera
in class CameraController
zoom
- Level of the zoom to set for the camera.public void manualFocus(float motionX, float motionY, android.view.View view, boolean isFocusRectangleVisible)
manualFocus
in class CameraController
motionX
- Position on x axis on the screenmotionY
- Position on y axis on the screenview
- View where we will draw the focus rectangleisFocusRectangleVisible
- Option to draw the focus rectangle or notpublic void setAutoFocusEnabled(boolean isAutoFocusEnabled)
setAutoFocusEnabled
in class CameraController
isAutoFocusEnabled
- Boolean to activate/deactivate the autofocus.