You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: programming/flutter/api-reference/camera-enhancer.md
+67-49Lines changed: 67 additions & 49 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,7 +17,19 @@ The `CameraEnhancer` class provides camera-specific functionality including came
17
17
*Assembly:* dynamsoft_capture_vision_flutter
18
18
19
19
```dart
20
-
class CameraEnhancer
20
+
class CameraEnhancer extends ImageSourceAdapter
21
+
```
22
+
23
+
## Static Properties
24
+
25
+
| Property | Description |
26
+
| -------- | ----------- |
27
+
|[`instance`](#instance)| Returns the singleton instance of `CameraEnhancer`. |
28
+
29
+
### instance
30
+
31
+
```dart
32
+
static CameraEnhancer get instance;
21
33
```
22
34
23
35
## Methods
@@ -29,53 +41,71 @@ class CameraEnhancer
29
41
|[`disableEnhancedFeatures`](#disableenhancedfeatures)| Disables the selected and activated enhanced features of the Camera Enhancer. |
30
42
|[`enableEnhancedFeatures`](#enableenhancedfeatures)| Activates the selected enhanced features provided by the Camera Enhancer library, including the auto-zoom and smart torch features. |
31
43
|[`getCameraPosition`](#getcameraposition)| Returns the current camera being used. |
32
-
|[`getColourChannelUsageType`](#getcolourchannelusagetype)| Retrieves the current colour channel that is being used by the camera enhancer. |
33
44
|[`getFocusMode`](#getfocusmode)| Returns the current focus mode of the camera. |
34
45
|[`getScanRegion`](#getscanregion)| Returns the current scan region. |
46
+
|[`getZoomFactor`](#getzoomfactor)| Returns the current zoom factor of the camera. |
35
47
|[`open`](#open)| Opens the selected camera to begin the capture process. |
36
48
|[`selectCamera`](#selectcamera)| Selects the camera based on the specified camera position. |
37
-
|[`setColourChannelUsageType`](#setcolourchannelusagetype)| Defines the colour channel used by the camera enhancer. |
38
49
|[`setFocus`](#setfocus)| Sets the focus point as well as the mode for the camera. |
50
+
|[`setResolution`](#setresolution)| Sets the resolution of the camera. |
39
51
|[`setScanRegion`](#setscanregion)| Sets the scan region of the camera and displays a bordered area on the UI. |
40
52
|[`setZoomFactor`](#setzoomfactor)| Sets the zoom factor of the camera. |
41
53
|[`turnOffTorch`](#turnofftorch)| Turns off the camera's flashlight (if available). |
42
54
|[`turnOnTorch`](#turnontorch)| Turns on the camera's flashlight (if available). |
43
55
56
+
The following methods are inherited from superclass [`ImageSourceAdapter`]({{ site.dcv_flutter_api }}core/image-source-adapter.html)
57
+
58
+
| Method | Description |
59
+
| ------ | ----------- |
60
+
|[`addImageToBuffer`]({{ site.dcv_flutter_api }}core/image-source-adapter.html#addimagetobuffer) | Adds an image to the internal buffer. |
61
+
|[`clearBuffer`]({{ site.dcv_flutter_api }}core/image-source-adapter.html#clearbuffer) | Clears all images from the buffer, resetting the state for new image fetching. |
62
+
|[`getBufferOverflowProtectionMode`]({{ site.dcv_flutter_api }}core/image-source-adapter.html#getbufferoverflowprotectionmode) | Get the current mode for handling buffer overflow. |
63
+
|[`getColourChannelUsageType`]({{ site.dcv_flutter_api }}core/image-source-adapter.html#getcolourchannelusagetype) | Get the current usage type for color channels in images. |
64
+
|[`getImage`]({{ site.dcv_flutter_api }}core/image-source-adapter.html#getimage) | Get a buffered image. Implementing classes should return a Promise that resolves with an instance of `ImageData`. |
65
+
|[`getMaximumImageCount`]({{ site.dcv_flutter_api }}core/image-source-adapter.html#getmaximumimagecount) | Get the maximum number of images that can be buffered. |
66
+
|[`hasImage`]({{ site.dcv_flutter_api }}core/image-source-adapter.html#hasimage) | Checks if an image with the specified ID is present in the buffer. |
67
+
|[`setBufferOverflowProtectionMode`]({{ site.dcv_flutter_api }}core/image-source-adapter.html#setbufferoverflowprotectionmode) | Sets the behavior for handling new incoming images when the buffer is full. |
68
+
|[`setColourChannelUsageType`]({{ site.dcv_flutter_api }}core/image-source-adapter.html#setcolourchannelusagetype) | Sets the usage type for color channels in images. |
69
+
|[`setMaximumImageCount`]({{ site.dcv_flutter_api }}core/image-source-adapter.html#setmaximumimagecount) | Sets the maximum number of images that can be buffered at any time. |
70
+
|[`setNextImageToReturn`]({{ site.dcv_flutter_api }}core/image-source-adapter.html#setnextimagetoreturn) | Sets the processing priority of a specific image. This can affect the order in which images are returned by getImage. |
71
+
|[`startFetching`]({{ site.dcv_flutter_api }}core/image-source-adapter.html#startfetching) | Start fetching images from the source to the Video Buffer of `ImageSourceAdapter`. |
72
+
|[`stopFetching`]({{ site.dcv_flutter_api }}core/image-source-adapter.html#stopfetching) | Stop fetching images from the source to the Video Buffer of `ImageSourceAdapter`. |
73
+
44
74
### close
45
75
46
76
Closes the camera and releases the related resources. When the `CaptureVisionRouter` instance calls `stopCapturing`, please make sure to call this method as well to ensure that the resources are released properly.
47
77
48
78
```dart
49
-
Future<void> close()
79
+
Future<void> close();
50
80
```
51
81
52
82
### destroy
53
83
54
84
Destroys the camera enhancer instance and releases the related resources on the host side.
55
85
56
86
```dart
57
-
Future<void> destroy()
87
+
Future<void> destroy();
58
88
```
59
89
60
90
### disableEnhancedFeatures
61
91
62
-
Disables the selected and activated enhanced features (represented by [`EnumEnhancedFeatures`](./enum/enhanced-features-camera.md)) of the Camera Enhancer.
92
+
Disables the selected and activated enhanced features (represented by [`EnumEnhancedFeatures`]({{ site.dcv_flutter_api }}core/enum/enhanced-features-camera.md)) of the Camera Enhancer.
Activates the selected enhanced features (represented by [`EnumEnhancedFeatures`](./enum/enhanced-features-camera.md)) provided by the Camera Enhancer library, including the auto-zoom and smart torch features.
100
+
Activates the selected enhanced features (represented by [`EnumEnhancedFeatures`]({{ site.dcv_flutter_api }}core/enum/enhanced-features-camera.md)) provided by the Camera Enhancer library, including the auto-zoom and smart torch features.
This method must be used **after [`setInput`]({{ site.dcv_flutter_api }}capture-vision-router/capture-vision-router.html#setinput) and before the [`open`](#open) method**. If you would like to activate multiple enhanced features, then they must be combined using the OR (`|`) operator.
108
+
If you would like to activate multiple enhanced features, then they must be combined using the OR (`|`) operator.
79
109
80
110
```dart
81
111
await _cvr.setInput(_camera);
@@ -85,116 +115,104 @@ _camera.open();
85
115
86
116
### getCameraPosition
87
117
88
-
Returns the current camera being used, represented as a [`EnumCameraPosition`](./enum/camera-position.md).
118
+
Returns the current camera being used, represented as a [`EnumCameraPosition`]({{ site.dcv_flutter_api }}core/enum/enhanced-features-camera.md).
This method should be used to verify which colour channel the camera is using, and in turn verify what pixel type any images retrieved during the capture process will come out in.
105
-
106
-
### getFocusMode
132
+
### getScanRegion
107
133
108
-
Returns the current focus mode of the camera, represented as a [`EnumFocusMode`](./enum/focus-mode.md).
134
+
Returns the current scan region as a [`DSRect`]({{ site.dcv_flutter_api }}core/dsrect.html) object.
109
135
110
136
```dart
111
-
Future<EnumFocusMode> getFocusMode() async
137
+
Future<DSRect?> getScanRegion() async;
112
138
```
113
139
114
-
### getScanRegion
140
+
### getZoomFactor
115
141
116
-
Returns the current scan region as a [`DSRect`]({{ site.dcv_flutter_api }}core/dsrect.html) object.
142
+
Returns the current zoom factor of the camera.
117
143
118
144
```dart
119
-
Future<DSRect?> getScanRegion() async
145
+
Future<double> getZoomFactor();
120
146
```
121
147
122
148
### open
123
149
124
150
Opens the selected camera to begin the capture process.
125
151
126
152
```dart
127
-
Future<void> open()
153
+
Future<void> open();
128
154
```
129
155
130
156
### selectCamera
131
157
132
-
Selects the camera based on the specified [`EnumCameraPosition`](./enum/camera-position.md).
158
+
Selects the camera based on the specified [`EnumCameraPosition`]({{ site.dcv_flutter_api }}core/enum/camera-position.md).
If you attempt to select the **backDualWideAuto** or the **backUltraWide** cameras on an Android phone, an exception will be thrown as those cameras are only available on iPhones. Supported devices include: iPhone 13 Pro, iPhone 13 Pro Max, iPhone 14 Pro, iPhone 14 Pro Max, iPhone 15 Pro, iPhone 15 Pro Max. This method must be called **after [`setInput`]({{ site.dcv_flutter_api }}capture-vision-router/capture-vision-router.html#setinput) and before the [`open`](#open) method**.
141
-
142
-
> *Exception* - "This camera position is only supported on iOS"
Defines the colour channel (as a [`EnumColourChannelUsageType`](./enum/colour-channel.md)) used by the camera enhancer - therefore determining whether the captured images or frames will come out in grayscale or colour (or one of the individual colours).
170
+
Sets the focus point as well as the mode (as a [`EnumFocusMode`]({{ site.dcv_flutter_api }}core/enum/focus-mode.md)) for the camera.
Future<void> setFocus(Point<double> point, EnumFocusMode focusMode);
150
174
```
151
175
152
-
**Remarks**
153
-
154
-
This method should be used to change the pixel type of the original image or captured frame should you choose to retrieve it after the capture process. In order to retrieve the original image after the barcode is decoded or the captured result is received, please refer to [this article].
155
-
156
-
### setFocus
176
+
### setResolution
157
177
158
-
Sets the focus point as well as the mode (as a [`EnumFocusMode`](./enum/focus-mode.md)) for the camera.
178
+
Sets the resolution of the camera.
159
179
160
180
```dart
161
-
Future<void> setFocus(Point<double> point, EnumFocusMode focusMode)
Sets the scan region of the camera and displays a bordered area on the UI to represent the scan region. To learn how to specify the scan region when using the Barcode Reader, please visit this [section of the foundational user guide]({{ site.dbr_flutter }}explore-features/ui-customization.html#specifying-a-scan-region).
167
187
168
188
```dart
169
-
Future<void> setScanRegion(DSRect region) async
189
+
Future<void> setScanRegion(DSRect region) async;
170
190
```
171
191
172
-
**Remarks**
173
-
174
-
This method must be called **after [`setInput`]({{ site.dcv_flutter_api }}capture-vision-router/capture-vision-router.html#setinput) and before the [`open`](#open) method**. The region is represented as a [`DSRect`]({{ site.dcv_flutter_api }}core/dsrect.html).
Copy file name to clipboardExpand all lines: programming/flutter/api-reference/camera-toggle-button.md
+16-10Lines changed: 16 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,19 +20,33 @@ noTitleIndex: true
20
20
class CameraToggleButton
21
21
```
22
22
23
+
## Constructors
24
+
25
+
```dart
26
+
CameraToggleButton({
27
+
required this.location,
28
+
this.imageBase64,
29
+
});
30
+
```
31
+
23
32
## Properties
24
33
34
+
| Properties | Type | Description |
35
+
| ---------- | ---- | ----------- |
36
+
|[`location`](#location)|*Rect*| Defines the location of the camera button. This rectangle specifies the button's position and size on the screen. Coordinates are in logical pixels. |
37
+
|[`imageBase64`](#imagebase64)|*String*| A base 64 string that specifies the camera toggle image. |
38
+
25
39
### location
26
40
27
-
Defines the location of the camera toggle button (as a [Rect](https://api.flutter.dev/flutter/dart-ui/Rect-class.html)). This rectangle specifies the button's position and size on the screen. Coordinates are in pixels.
41
+
Defines the location of the camera button. This rectangle specifies the button's position and size on the screen. Coordinates are in logical pixels.
28
42
29
43
```dart
30
44
Rect location;
31
45
```
32
46
33
47
### imageBase64
34
48
35
-
Sets the image (as a base64 string) to be used for the camera toggle button.
49
+
A base 64 string that specifies the camera toggle image.
36
50
37
51
```dart
38
52
String? imageBase64;
@@ -42,11 +56,3 @@ String? imageBase64;
42
56
43
57
When setting the imageBase64 string, please note that the string should not include the `data:image/png;base64,` portion of the base64 string.
44
58
45
-
## Code Snippet
46
-
47
-
```dart
48
-
final CameraToggleButton _cameraToggleBtn = CameraToggle(
Copy file name to clipboardExpand all lines: programming/flutter/api-reference/camera-view.md
+20-22Lines changed: 20 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,7 +17,23 @@ noTitleIndex: true
17
17
*Assembly:* dynamsoft_capture_vision_flutter
18
18
19
19
```dart
20
-
class CameraView
20
+
class CameraView extends StatefulWidget
21
+
```
22
+
23
+
## Constructors
24
+
25
+
```dart
26
+
const CameraView({
27
+
super.key,
28
+
required this.cameraEnhancer,
29
+
this.torchButtonVisible,
30
+
this.scanRegionMaskVisible,
31
+
this.scanLaserVisible,
32
+
this.torchButton,
33
+
this.visibleLayerIds,
34
+
this.cameraToggleButtonVisible,
35
+
this.cameraToggleButton,
36
+
});
21
37
```
22
38
23
39
## Properties
@@ -28,7 +44,7 @@ class CameraView
28
44
|[`cameraToggleButton`](#cameratogglebutton)| Defines a custom widget to replace the default camera toggle button. |
29
45
|[`cameraToggleButtonVisible`](#cameratogglebuttonvisible)| Determines whether the camera toggle button is visible. |
30
46
|[`scanLaserVisible`](#scanlaservisible)| Determines whether the scan laser will be visible in the scan region. |
31
-
|[`scanRegionMaskVisible`](#scanregionmaskvisible)|Establishes whether the scan region will be represented visually using a mask.|
47
+
|[`scanRegionMaskVisible`](#scanregionmaskvisible)|Determines whether the scan region mask will be visible. (Scan region mask is a mask covered outside the scan region.)|
32
48
|[`torchButtonVisible`](#torchbuttonvisible)| Controls the visibility of the torch/flash button. |
33
49
|[`torchButton`](#torchbutton)| Defines a custom `TorchButton` instead of the default torch icon. |
34
50
|[`visibleLayerIds`](#visiblelayerids)| Defines which drawing layer(s) to display on the camera view. |
@@ -79,7 +95,7 @@ Defaults to `true` if not specified.
79
95
80
96
### scanRegionMaskVisible
81
97
82
-
Establishes whether the scan region (if defined via the `CameraEnhancer`) will be represented visually using a mask. The mask highlights the area where the barcode scanning occurs, and it defaults to `true` if not specified.
98
+
Determines whether the scan region mask will be visible. Scan region mask is a mask covered outside the scan region.
83
99
84
100
```dart
85
101
final bool? scanRegionMaskVisible;
@@ -111,7 +127,7 @@ final TorchButton? torchButton;
111
127
112
128
### visibleLayerIds
113
129
114
-
Defines which drawing layer(s) (see [`EnumDrawingLayerId`](../enum/drawing-layer-id.md)) to display on the camera view. The drawing layer is responsible for highlighting the captured result, so in the case of the Barcode Reader, the drawing layer would highlight any recognized barcodes.
130
+
Defines which drawing layer(s) (see [`EnumDrawingLayerId`]({{site.dcv_flutter_api}}core/enum/drawing-layer-id.html)) to display on the camera view. The drawing layer is responsible for highlighting the captured result, so in the case of the Barcode Reader, the drawing layer would highlight any recognized barcodes.
115
131
116
132
```dart
117
133
final List<EnumDrawingLayerId>? visibleLayerIds;
@@ -120,21 +136,3 @@ final List<EnumDrawingLayerId>? visibleLayerIds;
120
136
**Remarks**
121
137
122
138
The Capture Vision library can work with multiple functional products, including the Barcode Reader, Label Recognizer, and the Document Normalizer. If you would like to disable the feature to highlight any found barcodes, then the `visibleLayerIds` must not include `EnumDrawingLayerId.dbr`.
0 commit comments