Label Capture Advanced Overlay
Defined in library scandit_datacapture_label_ui
- LabelCaptureAdvancedOverlay
class LabelCaptureAdvancedOverlay : DataCaptureOverlay
Added in version 7.2.0
An overlay for DataCaptureView that allows anchoring a single user-provided View to each captured label.
The provided view is visible on top of the camera preview as long as its captured label is, and during time it retains its relative position to it. This is useful when additional information should be provided to the captured label in real time. For instance, a user may overlay the price of an item or its expiration date for each corresponding label.
To display the views, this overlay must be attached to a DataCaptureView. This may be done either by creating it with LabelCaptureAdvancedOverlay.withLabelCapture() with a non-null view parameter or by passing this overlay to DataCaptureView.addOverlay().
A user of this class may configure what view is displayed for the given label and the relative position between the two by implementing LabelCaptureAdvancedOverlayListener.
- LabelCaptureAdvancedOverlay.withLabelCapture(labelCapture, view)
factory LabelCaptureAdvancedOverlay.withLabelCapture( LabelCapture labelCapture, {DataCaptureView? view})
Added in version 7.2.0
Constructs a new overlay to visualize the process of label capture. When view is non-null, the overlay is automatically added to the view. Otherwise, the overlay needs to be added through a call to DataCaptureView.addOverlay().
- view
DataCaptureView? view
Added in version 7.2.0
The view this data capture overlay is attached to. When the data capture overlay is currently not attached to a view, null is returned.
- listener
LabelCaptureAdvancedOverlayListener? listener
Added in version 7.2.0
The listener which is called whenever a view, an anchor point and an offset must be defined for a tracked CapturedLabel.
- shouldShowScanAreaGuides
bool shouldShowScanAreaGuides
Added in version 7.2.0
Whether to show scan area guides on top of the preview. This property is useful during development to visualize the current scan areas on screen. It is not meant to be used for production. By default this property is false.
- setWidgetForCapturedLabel(capturedLabel, widget)
Future<
void
> setWidgetForCapturedLabel(CapturedLabel capturedLabel, LabelCaptureAdvancedOverlayWidget? widget)Added in version 7.2.0
The method can be called to change the view drawn for the given tracked label. Setting the view to null will unset the view from the tracked label and will effectively remove it from the overlay. This method is thread-safe, it can be called from any thread. The view set via this method will take precedence over the one set via LabelCaptureAdvancedOverlayListener.widgetForCapturedLabel(): in case a view is set before LabelCaptureAdvancedOverlayListener.widgetForCapturedLabel() got called, no call to LabelCaptureAdvancedOverlayListener.widgetForCapturedLabel() will happen.
- setAnchorForCapturedLabel(capturedLabel, anchor)
Future<
void
> setAnchorForCapturedLabel(CapturedLabel capturedLabel, Anchor anchor)Added in version 7.2.0
The method can be called to change the anchor point for the view associated with the given tracked label. This method is thread-safe, it can be called from any thread. The anchor set via this method will take precedence over the one set via LabelCaptureAdvancedOverlayListener.anchorForCapturedLabel(): in case a view is set before LabelCaptureAdvancedOverlayListener.anchorForCapturedLabel() got called, no call to LabelCaptureAdvancedOverlayListener.anchorForCapturedLabel() will happen.
- setOffsetForCapturedLabel(capturedLabel, offset)
Future<
void
> setOffsetForCapturedLabel(CapturedLabel capturedLabel, PointWithUnit offset)Added in version 7.2.0
The method can be called to change the offset for the view associated with the given tracked label. This method is thread-safe, it can be called from any thread. The offset set via this method will take precedence over the one set via LabelCaptureAdvancedOverlayListener.offsetForCapturedLabel(): in case a view is set before LabelCaptureAdvancedOverlayListener.offsetForCapturedLabel() got called, no call to LabelCaptureAdvancedOverlayListener.offsetForCapturedLabel() will happen. If the MeasureUnit of the offset is MeasureUnit.fraction, the offset is calculated relative to view’s dimensions.
- setWidgetForCapturedLabelField(labelField, capturedLabel, widget)
Future<
void
> setWidgetForCapturedLabelField( LabelField labelField, CapturedLabel capturedLabel, LabelCaptureAdvancedOverlayWidget? widget)Added in version 7.2.0
The method can be called to change the view drawn for the given tracked field of the captured label. Setting the view to null will unset the view from the tracked field of the captured label and will effectively remove it from the overlay. This method is thread-safe, it can be called from any thread. The view set via this method will take precedence over the one set via LabelCaptureAdvancedOverlayListener.widgetForCapturedLabelField(): in case a view is set before LabelCaptureAdvancedOverlayListener.widgetForCapturedLabelField() got called, no call to LabelCaptureAdvancedOverlayListener.widgetForCapturedLabelField() will happen.
- setAnchorForCapturedLabelField(labelField, capturedLabel, anchor)
Future<
void
> setAnchorForCapturedLabelField( LabelField labelField, CapturedLabel capturedLabel, Anchor anchor)Added in version 7.2.0
The method can be called to change the anchor point for the view associated with the given tracked field of the captured label. This method is thread-safe, it can be called from any thread. The anchor set via this method will take precedence over the one set via LabelCaptureAdvancedOverlayListener.anchorForCapturedLabelField(): in case a view is set before LabelCaptureAdvancedOverlayListener.anchorForCapturedLabelField() got called, no call to LabelCaptureAdvancedOverlayListener.anchorForCapturedLabelField() will happen.
- setOffsetForCapturedLabelField(labelField, capturedLabel, offset)
Future<
void
> setOffsetForCapturedLabelField( LabelField labelField, CapturedLabel capturedLabel, PointWithUnit offset)Added in version 7.2.0
The method can be called to change the offset for the view associated with the given tracked field of the captured label. This method is thread-safe, it can be called from any thread. The offset set via this method will take precedence over the one set via LabelCaptureAdvancedOverlayListener.offsetForCapturedLabelField(): in case a view is set before LabelCaptureAdvancedOverlayListener.offsetForCapturedLabelField() got called, no call to LabelCaptureAdvancedOverlayListener.offsetForCapturedLabelField() will happen. If the MeasureUnit of the offset is MeasureUnit.fraction, the offset is calculated relative to view’s dimensions.