Skip to content

Commit 43c9b9d

Browse files
Merge pull request #67 from dynamsoft-docs/preview
Preview
2 parents b8c7587 + 05ccdea commit 43c9b9d

File tree

12 files changed

+708
-11
lines changed

12 files changed

+708
-11
lines changed

_config.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ 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_react_native_api: /capture-vision/docs/mobile/programming/react-native/api-reference/
70+
6971
dcv_flutter: /capture-vision/docs/mobile/programming/flutter/
7072
dcv_flutter_api: /capture-vision/docs/mobile/programming/flutter/api-reference/
7173
dcp_flutter: /code-parser/docs/mobile/programming/flutter/

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -89,15 +89,15 @@ Future<void> destroy();
8989

9090
### disableEnhancedFeatures
9191

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.
92+
Disables the selected and activated enhanced features (represented by [`EnumEnhancedFeatures`]({{ site.dcv_flutter_api }}core/enum/enhanced-features-camera.html)) of the Camera Enhancer.
9393

9494
```dart
9595
Future<void> disableEnhancedFeatures(int features);
9696
```
9797

9898
### enableEnhancedFeatures
9999

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.
100+
Activates the selected enhanced features (represented by [`EnumEnhancedFeatures`]({{ site.dcv_flutter_api }}core/enum/enhanced-features-camera.html)) provided by the Camera Enhancer library, including the auto-zoom and smart torch features.
101101

102102
```dart
103103
Future<void> enableEnhancedFeatures(int features);
@@ -115,15 +115,15 @@ _camera.open();
115115

116116
### getCameraPosition
117117

118-
Returns the current camera being used, represented as a [`EnumCameraPosition`]({{ site.dcv_flutter_api }}core/enum/enhanced-features-camera.md).
118+
Returns the current camera being used, represented as a [`EnumCameraPosition`]({{ site.dcv_flutter_api }}core/enum/camera-position.html).
119119

120120
```dart
121121
Future<EnumCameraPosition> getCameraPosition() async;
122122
```
123123

124124
### getFocusMode
125125

126-
Returns the current focus mode of the camera, represented as a [`EnumFocusMode`]({{ site.dcv_flutter_api }}core/enum/focus-mode.md).
126+
Returns the current focus mode of the camera, represented as a [`EnumFocusMode`]({{ site.dcv_flutter_api }}core/enum/camera-position.html).
127127

128128
```dart
129129
Future<EnumFocusMode> getFocusMode() async;
@@ -155,7 +155,7 @@ Future<void> open();
155155

156156
### selectCamera
157157

158-
Selects the camera based on the specified [`EnumCameraPosition`]({{ site.dcv_flutter_api }}core/enum/camera-position.md).
158+
Selects the camera based on the specified [`EnumCameraPosition`]({{ site.dcv_flutter_api }}core/enum/camera-position.html).
159159

160160
```dart
161161
Future<void> selectCamera(EnumCameraPosition position);
@@ -167,7 +167,7 @@ Future<void> selectCamera(EnumCameraPosition position);
167167

168168
### setFocus
169169

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.
170+
Sets the focus point as well as the mode (as a [`EnumFocusMode`]({{ site.dcv_flutter_api }}core/enum/focus-mode.html)) for the camera.
171171

172172
```dart
173173
Future<void> setFocus(Point<double> point, EnumFocusMode focusMode);
@@ -183,7 +183,7 @@ Future<void> setResolution(EnumResolution resolution);
183183

184184
### setScanRegion
185185

186-
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).
186+
Sets the scan region of the camera and displays a bordered area on the UI to represent the scan region.
187187

188188
```dart
189189
Future<void> setScanRegion(DSRect region) async;

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,6 @@ Defines a custom widget (as a [`CameraToggleButton`](camera-toggle-button.md) ob
6565
final CameraToggleButton? cameraToggleButton;
6666
```
6767

68-
**Remarks**
69-
70-
If provided, this widget will be used instead of the default camera toggle button. You must ensure that the custom widget handles the camera switch operation appropriately.
71-
7268
### cameraToggleButtonVisible
7369

7470
Determines whether the camera toggle button (to switch between the front and back cameras) is visible.
Lines changed: 286 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,286 @@
1+
---
2+
layout: default-layout
3+
title: CameraEnhancer Class - Dynamsoft Capture Vision React Native
4+
description: CameraEnhancer class of Dynamsoft Capture Vision React Native 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-react-native
18+
19+
```js
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+
```js
32+
static CameraEnhancer get instance;
33+
```
34+
35+
## Methods
36+
37+
| Method | Description |
38+
| ------ | ----------- |
39+
| [`close`](#close) | Closes the camera and releases the related resources. |
40+
| [`destroy`](#destroy) | Destroys the camera enhancer instance and releases the related resources on the host side. |
41+
| [`disableEnhancedFeatures`](#disableenhancedfeatures) | Disables the selected and activated enhanced features of the Camera Enhancer. |
42+
| [`enableEnhancedFeatures`](#enableenhancedfeatures) | Activates the selected enhanced features provided by the Camera Enhancer library, including the auto-zoom and smart torch features. |
43+
| [`getCameraPosition`](#getcameraposition) | Returns the current camera being used. |
44+
| [`getFocusMode`](#getfocusmode) | Returns the current focus mode of the camera. |
45+
| [`getScanRegion`](#getscanregion) | Returns the current scan region. |
46+
| [`getZoomFactor`](#getzoomfactor) | Returns the current zoom factor of the camera. |
47+
| [`open`](#open) | Opens the selected camera to begin the capture process. |
48+
| [`selectCamera`](#selectcamera) | Selects the camera based on the specified camera position. |
49+
| [`setFocus`](#setfocus) | Sets the focus point as well as the mode for the camera. |
50+
| [`setResolution`](#setresolution) | Sets the resolution of the camera. |
51+
| [`setScanRegion`](#setscanregion) | Sets the scan region of the camera and displays a bordered area on the UI. |
52+
| [`setZoomFactor`](#setzoomfactor) | Sets the zoom factor of the camera. |
53+
| [`turnOffTorch`](#turnofftorch) | Turns off the camera's flashlight (if available). |
54+
| [`turnOnTorch`](#turnontorch) | Turns on the camera's flashlight (if available). |
55+
| [`getInstance`](#getinstance) | Gets the singleton instance of `CameraEnhancer`. |
56+
| [`requestCameraPermission`](#requestcamerapermission) | Request the camera permission. |
57+
58+
The following methods are inherited from superclass [`ImageSourceAdapter`]({{ site.dcv_react_native_api }}core/image-source-adapter.html)
59+
60+
| Method | Description |
61+
| ------ | ----------- |
62+
| [`addImageToBuffer`]({{ site.dcv_react_native_api }}core/image-source-adapter.html#addimagetobuffer) | Adds an image to the internal buffer. |
63+
| [`clearBuffer`]({{ site.dcv_react_native_api }}core/image-source-adapter.html#clearbuffer) | Clears all images from the buffer, resetting the state for new image fetching. |
64+
| [`getBufferOverflowProtectionMode`]({{ site.dcv_react_native_api }}core/image-source-adapter.html#getbufferoverflowprotectionmode) | Get the current mode for handling buffer overflow. |
65+
| [`getColourChannelUsageType`]({{ site.dcv_react_native_api }}core/image-source-adapter.html#getcolourchannelusagetype) | Get the current usage type for color channels in images. |
66+
| [`getImage`]({{ site.dcv_react_native_api }}core/image-source-adapter.html#getimage) | Get a buffered image. Implementing classes should return a Promise that resolves with an instance of `ImageData`. |
67+
| [`getMaximumImageCount`]({{ site.dcv_react_native_api }}core/image-source-adapter.html#getmaximumimagecount) | Get the maximum number of images that can be buffered. |
68+
| [`hasImage`]({{ site.dcv_react_native_api }}core/image-source-adapter.html#hasimage) | Checks if an image with the specified ID is present in the buffer. |
69+
| [`setBufferOverflowProtectionMode`]({{ site.dcv_react_native_api }}core/image-source-adapter.html#setbufferoverflowprotectionmode) | Sets the behavior for handling new incoming images when the buffer is full. |
70+
| [`setColourChannelUsageType`]({{ site.dcv_react_native_api }}core/image-source-adapter.html#setcolourchannelusagetype) | Sets the usage type for color channels in images. |
71+
| [`setMaximumImageCount`]({{ site.dcv_react_native_api }}core/image-source-adapter.html#setmaximumimagecount) | Sets the maximum number of images that can be buffered at any time. |
72+
| [`setNextImageToReturn`]({{ site.dcv_react_native_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. |
73+
| [`startFetching`]({{ site.dcv_react_native_api }}core/image-source-adapter.html#startfetching) | Start fetching images from the source to the Video Buffer of `ImageSourceAdapter`. |
74+
| [`stopFetching`]({{ site.dcv_react_native_api }}core/image-source-adapter.html#stopfetching) | Stop fetching images from the source to the Video Buffer of `ImageSourceAdapter`. |
75+
76+
### close
77+
78+
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.
79+
80+
```js
81+
close()
82+
```
83+
84+
### destroy
85+
86+
Destroys the camera enhancer instance and releases the related resources on the host side.
87+
88+
```js
89+
destroy()
90+
```
91+
92+
### disableEnhancedFeatures
93+
94+
Disables the selected and activated enhanced features of the Camera Enhancer.
95+
96+
```js
97+
disableEnhancedFeatures(features: EnumEnhancedFeatures | number)
98+
```
99+
100+
**Parameters**
101+
102+
`features`: An enum value or a combination of [`EnumEnhancedFeatures`](enum/enhanced-features-camera.md) indicating the features to be disabled.
103+
104+
### enableEnhancedFeatures
105+
106+
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.
107+
108+
```js
109+
enableEnhancedFeatures(features: EnumEnhancedFeatures | number)
110+
```
111+
112+
**Parameters**
113+
114+
`features`: An enum value or a combination of [`EnumEnhancedFeatures`](enum/enhanced-features-camera.md) indicating the features to be disabled.
115+
116+
### getCameraPosition
117+
118+
Returns the current camera being used, represented as a [`EnumCameraPosition`](enum/camera-position.md).
119+
120+
```js
121+
getCameraPosition(): Promise<number>
122+
```
123+
124+
**Returns**
125+
126+
A promise that resolves the current camera position, of type [`EnumCameraPosition`](enum/camera-position.md).
127+
128+
### getFocusMode
129+
130+
Returns the current focus mode of the camera, represented as a [`EnumFocusMode`](enum/focus-mode.md).
131+
132+
```js
133+
getFocusMode(): Promise<number>
134+
```
135+
136+
**Returns**
137+
138+
A promise that resolves the current focus mode, of type [`EnumFocusMode`](enum/focus-mode.md).
139+
140+
### getScanRegion
141+
142+
Returns the current scan region as a [`DSRect`]({{ site.dcv_react_native_api }}core/dsrect.html) object.
143+
144+
```js
145+
getScanRegion(): Promise<undefined | null | DSRect>
146+
```
147+
148+
**Returns**
149+
150+
A promise that resolves current scan region.
151+
152+
### getZoomFactor
153+
154+
Returns the current zoom factor of the camera.
155+
156+
```js
157+
getZoomFactor(): Promise<number>
158+
```
159+
160+
**Returns**
161+
162+
A promise that resolves current zoom factor.
163+
164+
### open
165+
166+
Opens the selected camera to begin the capture process.
167+
168+
```js
169+
open()
170+
```
171+
172+
### selectCamera
173+
174+
Selects the camera based on the specified [`EnumCameraPosition`](enum/camera-position.md).
175+
176+
```js
177+
selectCamera(position: number)
178+
```
179+
180+
**Parameters**
181+
182+
`position`: One of the [`EnumCameraPosition`](enum/camera-position.md).
183+
184+
**Remarks**
185+
186+
- **backUltraWide** & **backDualWideAuto**: iPhone only.
187+
188+
### setCameraView
189+
190+
Bind a CameraView instance with this CameraEnhancer instance.
191+
192+
```js
193+
setCameraView(view: CameraView)
194+
```
195+
196+
**Parameters**
197+
198+
`view`: A [`CameraView`](camera-view.md) element.
199+
200+
### setFocus
201+
202+
Sets the focus point as well as the mode (as a [`EnumFocusMode`](enum/focus-mode.md)) for the camera.
203+
204+
```js
205+
setFocus(floatX: number, floatY: number, focusMode: number)
206+
```
207+
208+
**Parameters**
209+
210+
`floatX`: The x of focus point of interest. The coordinate base of the point is "image".
211+
212+
`floatY`: The y of focus point of interest. The coordinate base of the point is "image".
213+
214+
`focusMode`: The subsequent focus mode.
215+
216+
### setResolution
217+
218+
Sets the resolution of the camera.
219+
220+
```js
221+
setResolution(resolution: EnumResolution)
222+
```
223+
224+
**Parameters**
225+
226+
`resolution`: One of the [`EnumResolution`](enum/resolution.md).
227+
228+
### setScanRegion
229+
230+
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_react_native }}explore-features/ui-customization.html#specifying-a-scan-region).
231+
232+
```js
233+
setScanRegion(region: undefined | null | DSRect)
234+
```
235+
236+
**Parameters**
237+
238+
`region`: Specifies the scan region. If null or undefined, cancel the scan region.
239+
240+
**See also**
241+
242+
- [`DSRect`]({{ site.dcv_react_native_api }}core/dsrect.html).
243+
244+
### setZoomFactor
245+
246+
Sets the zoom factor of the camera.
247+
248+
```js
249+
setZoomFactor(factor: number)
250+
```
251+
252+
**Parameters**
253+
254+
`factor`: The zoom factor.
255+
256+
### turnOffTorch
257+
258+
Turns off the camera's flashlight (if available).
259+
260+
```js
261+
turnOffTorch()
262+
```
263+
264+
### turnOnTorch
265+
266+
Turns on the camera's flashlight (if available).
267+
268+
```js
269+
turnOnTorch()
270+
```
271+
272+
### getInstance
273+
274+
Get the singleton instance of `CameraEnhancer`.
275+
276+
```js
277+
static getInstance(): CameraEnhancer
278+
```
279+
280+
### requestCameraPermission
281+
282+
Request the camera permission.
283+
284+
```js
285+
static async requestCameraPermission()
286+
```

0 commit comments

Comments
 (0)