Skip to content

Commit a5267b6

Browse files
Merge pull request #64 from dynamsoft-docs/preview
Preview
2 parents bb3c6ba + bcca8ce commit a5267b6

File tree

12 files changed

+702
-2
lines changed

12 files changed

+702
-2
lines changed

_config.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,15 @@ cvr-enums: /capture-vision/docs/core/enums/capture-vision-router/
6666
dce_maui_api: /camera-enhancer/docs/mobile/programming/maui/api-reference/
6767
dcv_maui_api: /capture-vision/docs/mobile/programming/maui/api-reference/
6868

69+
dcv_flutter: /capture-vision/docs/mobile/programming/flutter/
70+
dcv_flutter_api: /capture-vision/docs/mobile/programming/flutter/api-reference/
71+
dcp_flutter: /code-parser/docs/mobile/programming/flutter/
72+
dcp_flutter_api: /code-parser/docs/mobile/programming/flutter/api-reference/
73+
dbr_flutter: /barcode-reader/docs/mobile/programming/flutter/
74+
dbr_flutter_api: /barcode-reader/docs/mobile/programming/flutter/api-reference/
75+
dce_flutter: /camera-enhancer/docs/mobile/programming/flutter/
76+
dce_flutter_api: /camera-enhancer/docs/mobile/programming/flutter/api-reference/
77+
6978
assets: /camera-enhancer/docs/mobile/assets/
7079
edit_icon: /camera-enhancer/docs/mobile/assets/img-icon/edit-icon.png
7180
smile_icon: /camera-enhancer/docs/mobile/assets/img-icon/icon-smile.png
Lines changed: 200 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,200 @@
1+
---
2+
layout: default-layout
3+
title: CameraEnhancer Class - Dynamsoft Capture Vision Flutter
4+
description: CameraEnhancer class of DCV Flutter edition manages camera operations and enhancements.
5+
keywords: camera, enhancer, barcode reader, flutter, capture vision
6+
needGenerateH3Content: true
7+
needAutoGenerateSidebar: true
8+
noTitleIndex: true
9+
---
10+
11+
# CameraEnhancer
12+
13+
The `CameraEnhancer` class provides camera-specific functionality including camera selection, focus control, zoom, and other enhanced features. The `CameraEnhancer` is also responsible for the basic UI of the camera view.
14+
15+
## Definition
16+
17+
*Assembly:* dynamsoft_capture_vision_flutter
18+
19+
```dart
20+
class CameraEnhancer
21+
```
22+
23+
## Methods
24+
25+
| Method | Description |
26+
| ------ | ----------- |
27+
| [`close`](#close) | Closes the camera and releases the related resources. |
28+
| [`destroy`](#destroy) | Destroys the camera enhancer instance and releases the related resources on the host side. |
29+
| [`disableEnhancedFeatures`](#disableenhancedfeatures) | Disables the selected and activated enhanced features of the Camera Enhancer. |
30+
| [`enableEnhancedFeatures`](#enableenhancedfeatures) | Activates the selected enhanced features provided by the Camera Enhancer library, including the auto-zoom and smart torch features. |
31+
| [`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+
| [`getFocusMode`](#getfocusmode) | Returns the current focus mode of the camera. |
34+
| [`getScanRegion`](#getscanregion) | Returns the current scan region. |
35+
| [`open`](#open) | Opens the selected camera to begin the capture process. |
36+
| [`selectCamera`](#selectcamera) | Selects the camera based on the specified camera position. |
37+
| [`setColourChannelUsageType`](#setcolourchannelusagetype) | Defines the colour channel used by the camera enhancer. |
38+
| [`setFocus`](#setfocus) | Sets the focus point as well as the mode for the camera. |
39+
| [`setScanRegion`](#setscanregion) | Sets the scan region of the camera and displays a bordered area on the UI. |
40+
| [`setZoomFactor`](#setzoomfactor) | Sets the zoom factor of the camera. |
41+
| [`turnOffTorch`](#turnofftorch) | Turns off the camera's flashlight (if available). |
42+
| [`turnOnTorch`](#turnontorch) | Turns on the camera's flashlight (if available). |
43+
44+
### close
45+
46+
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+
48+
```dart
49+
Future<void> close()
50+
```
51+
52+
### destroy
53+
54+
Destroys the camera enhancer instance and releases the related resources on the host side.
55+
56+
```dart
57+
Future<void> destroy()
58+
```
59+
60+
### disableEnhancedFeatures
61+
62+
Disables the selected and activated enhanced features (represented by [`EnumEnhancedFeatures`](./enum/enhanced-features-camera.md)) of the Camera Enhancer.
63+
64+
```dart
65+
Future<void> disableEnhancedFeatures(int features)
66+
```
67+
68+
### enableEnhancedFeatures
69+
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.
71+
72+
```dart
73+
Future<void> enableEnhancedFeatures(int features)
74+
```
75+
76+
**Remarks**
77+
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.
79+
80+
```dart
81+
await _cvr.setInput(_camera);
82+
_camera.enableEnhancedFeatures(EnumEnhancedFeatures.autoZoom | EnumEnhancedFeatures.smartTorch);
83+
_camera.open();
84+
```
85+
86+
### getCameraPosition
87+
88+
Returns the current camera being used, represented as a [`EnumCameraPosition`](./enum/camera-position.md).
89+
90+
```dart
91+
Future<EnumCameraPosition> getCameraPosition() async
92+
```
93+
94+
### getColourChannelUsageType
95+
96+
Retrieves the current colour channel (as a [`EnumColourChannelUsageType`](./enum/colour-channel.md)) that is being used by the camera enhancer.
97+
98+
```dart
99+
Future<EnumColourChannelUsageType> getColourChannelUsageType()
100+
```
101+
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
107+
108+
Returns the current focus mode of the camera, represented as a [`EnumFocusMode`](./enum/focus-mode.md).
109+
110+
```dart
111+
Future<EnumFocusMode> getFocusMode() async
112+
```
113+
114+
### getScanRegion
115+
116+
Returns the current scan region as a [`DSRect`]({{ site.dcv_flutter_api }}core/dsrect.html) object.
117+
118+
```dart
119+
Future<DSRect?> getScanRegion() async
120+
```
121+
122+
### open
123+
124+
Opens the selected camera to begin the capture process.
125+
126+
```dart
127+
Future<void> open()
128+
```
129+
130+
### selectCamera
131+
132+
Selects the camera based on the specified [`EnumCameraPosition`](./enum/camera-position.md).
133+
134+
```dart
135+
Future<void> selectCamera(EnumCameraPosition position)
136+
```
137+
138+
**Remarks**
139+
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"
143+
144+
### setColourChannelUsageType
145+
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).
147+
148+
```dart
149+
Future<void> setColourChannelUsageType(EnumColourChannelUsageType type)
150+
```
151+
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
157+
158+
Sets the focus point as well as the mode (as a [`EnumFocusMode`](./enum/focus-mode.md)) for the camera.
159+
160+
```dart
161+
Future<void> setFocus(Point<double> point, EnumFocusMode focusMode)
162+
```
163+
164+
### setScanRegion
165+
166+
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+
168+
```dart
169+
Future<void> setScanRegion(DSRect region) async
170+
```
171+
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).
175+
176+
> *Exception* - "Failed to set the scan region"
177+
178+
### setZoomFactor
179+
180+
Sets the zoom factor of the camera.
181+
182+
```dart
183+
Future<void> setZoomFactor(double zoom)
184+
```
185+
186+
### turnOffTorch
187+
188+
Turns off the camera's flashlight (if available).
189+
190+
```dart
191+
Future<void> turnOffTorch()
192+
```
193+
194+
### turnOnTorch
195+
196+
Turns on the camera's flashlight (if available).
197+
198+
```dart
199+
Future<void> turnOnTorch()
200+
```
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
---
2+
layout: default-layout
3+
title: CameraToggleButton Class - Dynamsoft Capture Vision Flutter
4+
description: CameraToggleButton class of DCV Flutter edition displays a camera preview with customizable UI elements.
5+
keywords: camera, enhancer, barcode reader, flutter, capture vision, view
6+
needGenerateH3Content: true
7+
needAutoGenerateSidebar: true
8+
noTitleIndex: true
9+
---
10+
11+
# CameraToggleButton
12+
13+
`CameraToggleButton` is a widget that represents a camera toggle button with customizable appearance and location. The camera toggle button allows the user to switch between the front and back cameras.
14+
15+
## Definition
16+
17+
*Assembly:* dynamsoft_capture_vision_flutter
18+
19+
```dart
20+
class CameraToggleButton
21+
```
22+
23+
## Properties
24+
25+
### location
26+
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.
28+
29+
```dart
30+
Rect location;
31+
```
32+
33+
### imageBase64
34+
35+
Sets the image (as a base64 string) to be used for the camera toggle button.
36+
37+
```dart
38+
String? imageBase64;
39+
```
40+
41+
**Remarks**
42+
43+
When setting the imageBase64 string, please note that the string should not include the `data:image/png;base64,` portion of the base64 string.
44+
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+
```

0 commit comments

Comments
 (0)