Skip to content

Commit b8c7587

Browse files
Merge pull request #66 from dynamsoft-docs/preview
update to internal commit 68b9b4f8
2 parents 83952a0 + 884a129 commit b8c7587

13 files changed

+282
-277
lines changed

programming/flutter/api-reference/camera-enhancer.md

Lines changed: 67 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,19 @@ The `CameraEnhancer` class provides camera-specific functionality including came
1717
*Assembly:* dynamsoft_capture_vision_flutter
1818

1919
```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;
2133
```
2234

2335
## Methods
@@ -29,53 +41,71 @@ class CameraEnhancer
2941
| [`disableEnhancedFeatures`](#disableenhancedfeatures) | Disables the selected and activated enhanced features of the Camera Enhancer. |
3042
| [`enableEnhancedFeatures`](#enableenhancedfeatures) | Activates the selected enhanced features provided by the Camera Enhancer library, including the auto-zoom and smart torch features. |
3143
| [`getCameraPosition`](#getcameraposition) | Returns the current camera being used. |
32-
| [`getColourChannelUsageType`](#getcolourchannelusagetype) | Retrieves the current colour channel that is being used by the camera enhancer. |
3344
| [`getFocusMode`](#getfocusmode) | Returns the current focus mode of the camera. |
3445
| [`getScanRegion`](#getscanregion) | Returns the current scan region. |
46+
| [`getZoomFactor`](#getzoomfactor) | Returns the current zoom factor of the camera. |
3547
| [`open`](#open) | Opens the selected camera to begin the capture process. |
3648
| [`selectCamera`](#selectcamera) | Selects the camera based on the specified camera position. |
37-
| [`setColourChannelUsageType`](#setcolourchannelusagetype) | Defines the colour channel used by the camera enhancer. |
3849
| [`setFocus`](#setfocus) | Sets the focus point as well as the mode for the camera. |
50+
| [`setResolution`](#setresolution) | Sets the resolution of the camera. |
3951
| [`setScanRegion`](#setscanregion) | Sets the scan region of the camera and displays a bordered area on the UI. |
4052
| [`setZoomFactor`](#setzoomfactor) | Sets the zoom factor of the camera. |
4153
| [`turnOffTorch`](#turnofftorch) | Turns off the camera's flashlight (if available). |
4254
| [`turnOnTorch`](#turnontorch) | Turns on the camera's flashlight (if available). |
4355

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+
4474
### close
4575

4676
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.
4777

4878
```dart
49-
Future<void> close()
79+
Future<void> close();
5080
```
5181

5282
### destroy
5383

5484
Destroys the camera enhancer instance and releases the related resources on the host side.
5585

5686
```dart
57-
Future<void> destroy()
87+
Future<void> destroy();
5888
```
5989

6090
### disableEnhancedFeatures
6191

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.
6393

6494
```dart
65-
Future<void> disableEnhancedFeatures(int features)
95+
Future<void> disableEnhancedFeatures(int features);
6696
```
6797

6898
### enableEnhancedFeatures
6999

70-
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.
71101

72102
```dart
73-
Future<void> enableEnhancedFeatures(int features)
103+
Future<void> enableEnhancedFeatures(int features);
74104
```
75105

76106
**Remarks**
77107

78-
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.
79109

80110
```dart
81111
await _cvr.setInput(_camera);
@@ -85,116 +115,104 @@ _camera.open();
85115

86116
### getCameraPosition
87117

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).
89119

90120
```dart
91-
Future<EnumCameraPosition> getCameraPosition() async
121+
Future<EnumCameraPosition> getCameraPosition() async;
92122
```
93123

94-
### getColourChannelUsageType
124+
### getFocusMode
95125

96-
Retrieves the current colour channel (as a [`EnumColourChannelUsageType`](./enum/colour-channel.md)) that is being used by the camera enhancer.
126+
Returns the current focus mode of the camera, represented as a [`EnumFocusMode`]({{ site.dcv_flutter_api }}core/enum/focus-mode.md).
97127

98128
```dart
99-
Future<EnumColourChannelUsageType> getColourChannelUsageType()
129+
Future<EnumFocusMode> getFocusMode() async;
100130
```
101131

102-
**Remarks**
103-
104-
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
107133

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.
109135

110136
```dart
111-
Future<EnumFocusMode> getFocusMode() async
137+
Future<DSRect?> getScanRegion() async;
112138
```
113139

114-
### getScanRegion
140+
### getZoomFactor
115141

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.
117143

118144
```dart
119-
Future<DSRect?> getScanRegion() async
145+
Future<double> getZoomFactor();
120146
```
121147

122148
### open
123149

124150
Opens the selected camera to begin the capture process.
125151

126152
```dart
127-
Future<void> open()
153+
Future<void> open();
128154
```
129155

130156
### selectCamera
131157

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).
133159

134160
```dart
135-
Future<void> selectCamera(EnumCameraPosition position)
161+
Future<void> selectCamera(EnumCameraPosition position);
136162
```
137163

138164
**Remarks**
139165

140-
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"
166+
- **backUltraWide** & **backDualWideAuto**: iPhone only.
143167

144-
### setColourChannelUsageType
168+
### setFocus
145169

146-
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.
147171

148172
```dart
149-
Future<void> setColourChannelUsageType(EnumColourChannelUsageType type)
173+
Future<void> setFocus(Point<double> point, EnumFocusMode focusMode);
150174
```
151175

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
157177

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.
159179

160180
```dart
161-
Future<void> setFocus(Point<double> point, EnumFocusMode focusMode)
181+
Future<void> setResolution(EnumResolution resolution);
162182
```
163183

164184
### setScanRegion
165185

166186
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).
167187

168188
```dart
169-
Future<void> setScanRegion(DSRect region) async
189+
Future<void> setScanRegion(DSRect region) async;
170190
```
171191

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).
192+
**See also**
175193

176-
> *Exception* - "Failed to set the scan region"
194+
- [`DSRect`]({{ site.dcv_flutter_api }}core/dsrect.html).
177195

178196
### setZoomFactor
179197

180198
Sets the zoom factor of the camera.
181199

182200
```dart
183-
Future<void> setZoomFactor(double zoom)
201+
Future<void> setZoomFactor(double zoom);
184202
```
185203

186204
### turnOffTorch
187205

188206
Turns off the camera's flashlight (if available).
189207

190208
```dart
191-
Future<void> turnOffTorch()
209+
Future<void> turnOffTorch();
192210
```
193211

194212
### turnOnTorch
195213

196214
Turns on the camera's flashlight (if available).
197215

198216
```dart
199-
Future<void> turnOnTorch()
217+
Future<void> turnOnTorch();
200218
```

programming/flutter/api-reference/camera-toggle-button.md

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,33 @@ noTitleIndex: true
2020
class CameraToggleButton
2121
```
2222

23+
## Constructors
24+
25+
```dart
26+
CameraToggleButton({
27+
required this.location,
28+
this.imageBase64,
29+
});
30+
```
31+
2332
## Properties
2433

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+
2539
### location
2640

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.
2842

2943
```dart
3044
Rect location;
3145
```
3246

3347
### imageBase64
3448

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.
3650

3751
```dart
3852
String? imageBase64;
@@ -42,11 +56,3 @@ String? imageBase64;
4256

4357
When setting the imageBase64 string, please note that the string should not include the `data:image/png;base64,` portion of the base64 string.
4458

45-
## Code Snippet
46-
47-
```dart
48-
final CameraToggleButton _cameraToggleBtn = CameraToggle(
49-
location: Rect.fromLTWH(300, 30, 50, 50),
50-
imageBase64: "<insert base64 string>"
51-
)
52-
```

programming/flutter/api-reference/camera-view.md

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,23 @@ noTitleIndex: true
1717
*Assembly:* dynamsoft_capture_vision_flutter
1818

1919
```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+
});
2137
```
2238

2339
## Properties
@@ -28,7 +44,7 @@ class CameraView
2844
| [`cameraToggleButton`](#cameratogglebutton) | Defines a custom widget to replace the default camera toggle button. |
2945
| [`cameraToggleButtonVisible`](#cameratogglebuttonvisible) | Determines whether the camera toggle button is visible. |
3046
| [`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.) |
3248
| [`torchButtonVisible`](#torchbuttonvisible) | Controls the visibility of the torch/flash button. |
3349
| [`torchButton`](#torchbutton) | Defines a custom `TorchButton` instead of the default torch icon. |
3450
| [`visibleLayerIds`](#visiblelayerids) | Defines which drawing layer(s) to display on the camera view. |
@@ -79,7 +95,7 @@ Defaults to `true` if not specified.
7995

8096
### scanRegionMaskVisible
8197

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.
8399

84100
```dart
85101
final bool? scanRegionMaskVisible;
@@ -111,7 +127,7 @@ final TorchButton? torchButton;
111127

112128
### visibleLayerIds
113129

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.
115131

116132
```dart
117133
final List<EnumDrawingLayerId>? visibleLayerIds;
@@ -120,21 +136,3 @@ final List<EnumDrawingLayerId>? visibleLayerIds;
120136
**Remarks**
121137

122138
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`.
123-
124-
## Code Snippet
125-
126-
```dart
127-
@override
128-
Widget build(BuildContext context) {
129-
return Scaffold(
130-
appBar: AppBar(backgroundColor: Theme.of(context).colorScheme.inversePrimary, title: Text(widget.title)),
131-
body: Center(child: CameraView(
132-
cameraEnhancer: _camera,
133-
torchButtonVisible: true,
134-
scanRegionMaskVisible: false,
135-
scanLaserVisible: true,
136-
torchButton: _torch,
137-
visibleLayerIds: [EnumDrawingLayerId.dbr])
138-
),
139-
);
140-
```

0 commit comments

Comments
 (0)