CameraView
The CameraView
class is used to display the camera preview and provides UI controlling APIs. Users can add interactable UI elements on the view.
Definition
Assembly: package com.dynamsoft.dce
class CameraView
Methods
Method | Description |
---|---|
CameraView |
Create an instance of CameraView . |
getDrawingLayer |
Get the specified DrawingLayer . |
createDrawingLayer |
Create a new DrawingLayer . |
getVisibleRegionOfVideo |
Get the visible region of the video streaming. |
setTorchButton |
Add a torch button on your view. |
deleteUserDefinedDrawingLayer |
Delete the specified drawing layer. |
clearUserDefinedDrawingLayers |
Clear all the user-defined drawing layers. |
getAllDrawingLayers |
Get all the drawing layers on the view. |
setScanRegionMaskStyle |
Set the style of the scan region mask. |
setTorchButtonVisible |
Set/get the visibility of the torch button. |
getTorchButtonVisible |
Set/get the visibility of the torch button. |
setScanRegionMaskVisible |
Set/get the visibility of the scan region mask. |
isScanRegionMaskVisible |
Set/get the visibility of the scan region mask. |
setScanLaserVisible |
Set the visibility of the scan laser. |
isScanLaserVisible |
Get the visibility of the scan laser. |
setTipConfig |
Set/get the tip configurations. |
getTipConfig |
Set/get the tip configurations. |
setTipVisible |
Set the visibility of tip. |
isTipVisible |
Get the visibility of tip. |
updateTipMessage |
Update the tip message. |
setDrawingItemClickListener |
Set a DrawingItemClickListener to receive callback when DrawingItems on the view are clicked. |
CameraView
The constructor. Create an instance of CameraView
.
CameraView(android.content.Context context);
Parameters
frame
: A CGRect value that defines the position of the view.
Return Value
An instance of CameraView
.
getDrawingLayer
Get the specified DrawingLayer
.
DrawingLayer getDrawingLayer(int id);
Parameters
layerId
: The ID of the layer that you want to get.
Return Value
The object of the targeting layer.
createDrawingLayer
Create a new DrawingLayer
.
DrawingLayer createDrawingLayer();
Return Value
The object of the layer you created.
getVisibleRegionOfVideo
Get the visible region of the video streaming.
DSRect getVisibileRegionOfVideo();
Return Value
A DSRect
object (measuredInPercentage = 1) that defines the visible region of the video.
setTorchButton
Add a torch button on your view. If you are using enhanced feature - smart torch, the style of this torch button will be applied to the smart torch as well.
void setTorchButton(Point torchButtonPosition, int width, int height, Drawable torchOnImage, Drawable torchOffImage);
Parameters
torchButtonPosition
: Set the top-left point of the torch button.
width
: Set the width of the torch button.
height
: Set the height of the torch button.
torchOnImage
: The torch button image that you want to display when the torch is on.
torchOffImage
: The torch button image that you want to display when the torch is off.
setTorchButtonVisible
Set the visibility of the torch button.
void setTorchButtonVisible(boolean isTorchButtonVisible);
Parameters
isTorchButtonVisible
: A boolean value that indicate the torch button is visible.
getTorchButtonVisible
Get the visibility of the torch button.
boolean getTorchButtonVisible();
Return Value
A boolean value that indicate the torch button is visible.
deleteUserDefinedDrawingLayer
Delete the specified drawing layer.
Parameters
frame
: The ID of the layer that you want to delete.
void deleteUserDefinedDrawingLayer(int id);
clearUserDefinedDrawingLayers
Clear all the user-defined drawing layers.
void clearUserDefinedDrawingLayers();
getAllDrawingLayers
Get all the drawing layers on the view.
Return Value
All the drawing layers. The return value includes both system drawing layers and user defined drawing layers.
DrawingLayer[] getAllDrawingLayers();
setScanRegionMaskVisible
Set the visibility of the scan region mask.
void setScanRegionMaskVisible(boolean isScanRegionVisible);
Parameters
isScanRegionVisible
: A boolean value that indicates whether the scan region mask is visible.
isScanRegionMaskVisible
Get the visibility of the scan laser.
boolean isScanRegionMaskVisible();
Return Value
A boolean value that indicates whether the scan region mask is visible.
setScanRegionMaskStyle
Set the style of the scan region mask.
void setScanRegionMaskStyle(int strokeColor, int surroundingColour, float strokeWidth);
Parameters
strokeColour
: The stroke colour of the scan region box.
surroundingColour
: The colour of the mask around the scan region.
strokeWidth
: The width of the stroke.
setScanLaserVisible
Set the visibility of the scan laser.
void setScanLaserVisible(boolean isScanRegionVisible);
Parameters
isScanRegionVisible
: A boolean value that indicates whether the scan laser is visible.
isScanLaserVisible
Get the visibility of the scan laser.
boolean isScanLaserVisible();
Return Value
A boolean value that indicates whether the scan laser is visible.
setTipConfig
Set/get the tip configurations.
void setTipConfig(TipConfig tipConfig);
Parameters
tipConfig
: A TipConfig
object that stores the tip configuration.
getTipConfig
Set/get the tip configurations.
TipConfig getTipConfig();
Return Value
Get a TipConfig
object that stores the tip configuration.
setTipVisible
Set the visibility of tip.
void setTipVisible(boolean isVisible);
Parameters
isVisible
: A boolean value that indicate the tip is visible.
isTipVisible
Get the visibility of tip.
boolean isTipVisible();
Return Value
A boolean value that indicate the tip is visible.
updateTipMessage
Update the tip message. The new tip message will be immediately displayed on the view. Generally, tip messages are uploaded internally.
void updateTipMessage(String tipMessage);
Parameters
tipMessage
The new message that you want to display.
setDrawingItemClickListener
Set a DrawingItemClickListener
to receive callback when DrawingItems
on the view are clicked.
void setDrawingItemClickListener(DrawingItemClickListener clickListener)
Parameters
clickListener
: An interface instance of DrawingItemClickListener
.