@capgo/camera-preview 7.4.0-beta.1 → 7.4.0-beta.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/README.md +195 -31
  2. package/android/.gradle/8.14.2/checksums/checksums.lock +0 -0
  3. package/android/.gradle/8.14.2/checksums/md5-checksums.bin +0 -0
  4. package/android/.gradle/8.14.2/checksums/sha1-checksums.bin +0 -0
  5. package/android/.gradle/8.14.2/executionHistory/executionHistory.bin +0 -0
  6. package/android/.gradle/8.14.2/executionHistory/executionHistory.lock +0 -0
  7. package/android/.gradle/8.14.2/fileHashes/fileHashes.bin +0 -0
  8. package/android/.gradle/8.14.2/fileHashes/fileHashes.lock +0 -0
  9. package/android/.gradle/8.14.2/fileHashes/resourceHashesCache.bin +0 -0
  10. package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  11. package/android/.gradle/file-system.probe +0 -0
  12. package/android/build.gradle +3 -1
  13. package/android/src/main/AndroidManifest.xml +5 -3
  14. package/android/src/main/java/com/ahm/capacitor/camera/preview/CameraPreview.java +282 -45
  15. package/android/src/main/java/com/ahm/capacitor/camera/preview/CameraXView.java +902 -102
  16. package/android/src/main/java/com/ahm/capacitor/camera/preview/GridOverlayView.java +82 -0
  17. package/android/src/main/java/com/ahm/capacitor/camera/preview/model/CameraSessionConfiguration.java +19 -5
  18. package/dist/docs.json +235 -6
  19. package/dist/esm/definitions.d.ts +119 -3
  20. package/dist/esm/definitions.js.map +1 -1
  21. package/dist/esm/web.d.ts +47 -3
  22. package/dist/esm/web.js +262 -78
  23. package/dist/esm/web.js.map +1 -1
  24. package/dist/plugin.cjs.js +258 -78
  25. package/dist/plugin.cjs.js.map +1 -1
  26. package/dist/plugin.js +258 -78
  27. package/dist/plugin.js.map +1 -1
  28. package/ios/Sources/CapgoCameraPreview/CameraController.swift +245 -28
  29. package/ios/Sources/CapgoCameraPreview/GridOverlayView.swift +65 -0
  30. package/ios/Sources/CapgoCameraPreview/Plugin.swift +657 -90
  31. package/package.json +1 -1
@@ -0,0 +1,82 @@
1
+ package com.ahm.capacitor.camera.preview;
2
+
3
+ import android.content.Context;
4
+ import android.graphics.Canvas;
5
+ import android.graphics.Paint;
6
+ import android.util.AttributeSet;
7
+ import android.view.View;
8
+
9
+ public class GridOverlayView extends View {
10
+ private Paint gridPaint;
11
+ private String gridMode = "none";
12
+
13
+ public GridOverlayView(Context context) {
14
+ super(context);
15
+ init();
16
+ }
17
+
18
+ public GridOverlayView(Context context, AttributeSet attrs) {
19
+ super(context, attrs);
20
+ init();
21
+ }
22
+
23
+ public GridOverlayView(Context context, AttributeSet attrs, int defStyleAttr) {
24
+ super(context, attrs, defStyleAttr);
25
+ init();
26
+ }
27
+
28
+ private void init() {
29
+ gridPaint = new Paint();
30
+ gridPaint.setColor(0x80FFFFFF); // Semi-transparent white
31
+ gridPaint.setStrokeWidth(2f);
32
+ gridPaint.setStyle(Paint.Style.STROKE);
33
+ gridPaint.setAntiAlias(true);
34
+ }
35
+
36
+ public void setGridMode(String mode) {
37
+ String previousMode = this.gridMode;
38
+ this.gridMode = mode != null ? mode : "none";
39
+ setVisibility("none".equals(this.gridMode) ? View.GONE : View.VISIBLE);
40
+ android.util.Log.d("GridOverlayView", "setGridMode: Changed from '" + previousMode + "' to '" + this.gridMode + "', visibility: " + ("none".equals(this.gridMode) ? "GONE" : "VISIBLE"));
41
+ invalidate();
42
+ }
43
+
44
+ @Override
45
+ protected void onDraw(Canvas canvas) {
46
+ super.onDraw(canvas);
47
+
48
+ if ("none".equals(gridMode)) {
49
+ return;
50
+ }
51
+
52
+ int width = getWidth();
53
+ int height = getHeight();
54
+
55
+ if (width <= 0 || height <= 0) {
56
+ return;
57
+ }
58
+
59
+ if ("3x3".equals(gridMode)) {
60
+ drawGrid(canvas, width, height, 3);
61
+ } else if ("4x4".equals(gridMode)) {
62
+ drawGrid(canvas, width, height, 4);
63
+ }
64
+ }
65
+
66
+ private void drawGrid(Canvas canvas, int width, int height, int divisions) {
67
+ float stepX = (float) width / divisions;
68
+ float stepY = (float) height / divisions;
69
+
70
+ // Draw vertical lines
71
+ for (int i = 1; i < divisions; i++) {
72
+ float x = i * stepX;
73
+ canvas.drawLine(x, 0, x, height, gridPaint);
74
+ }
75
+
76
+ // Draw horizontal lines
77
+ for (int i = 1; i < divisions; i++) {
78
+ float y = i * stepY;
79
+ canvas.drawLine(0, y, width, y, gridPaint);
80
+ }
81
+ }
82
+ }
@@ -18,12 +18,14 @@ public class CameraSessionConfiguration {
18
18
  private final boolean disableExifHeaderStripping;
19
19
  private final boolean disableAudio;
20
20
  private final float zoomFactor;
21
+ private final String aspectRatio;
22
+ private final String gridMode;
21
23
  private float targetZoom = 1.0f;
22
24
 
23
- public CameraSessionConfiguration(String deviceId, String position, int x, int y, int width, int height,
24
- int paddingBottom, boolean toBack, boolean storeToFile, boolean enableOpacity,
25
- boolean enableZoom, boolean disableExifHeaderStripping, boolean disableAudio,
26
- float zoomFactor) {
25
+ public CameraSessionConfiguration(String deviceId, String position, int x, int y, int width, int height,
26
+ int paddingBottom, boolean toBack, boolean storeToFile, boolean enableOpacity,
27
+ boolean enableZoom, boolean disableExifHeaderStripping, boolean disableAudio,
28
+ float zoomFactor, String aspectRatio, String gridMode) {
27
29
  this.deviceId = deviceId;
28
30
  this.position = position;
29
31
  this.x = x;
@@ -38,6 +40,8 @@ public class CameraSessionConfiguration {
38
40
  this.disableExifHeaderStripping = disableExifHeaderStripping;
39
41
  this.disableAudio = disableAudio;
40
42
  this.zoomFactor = zoomFactor;
43
+ this.aspectRatio = aspectRatio;
44
+ this.gridMode = gridMode != null ? gridMode : "none";
41
45
  }
42
46
 
43
47
  public void setTargetZoom(float zoom) {
@@ -62,4 +66,14 @@ public class CameraSessionConfiguration {
62
66
  public boolean isDisableExifHeaderStripping() { return disableExifHeaderStripping; }
63
67
  public boolean isDisableAudio() { return disableAudio; }
64
68
  public float getZoomFactor() { return zoomFactor; }
65
- }
69
+ public String getAspectRatio() { return aspectRatio; }
70
+ public String getGridMode() { return gridMode; }
71
+
72
+ // Additional getters with "get" prefix for compatibility
73
+ public boolean getToBack() { return toBack; }
74
+ public boolean getStoreToFile() { return storeToFile; }
75
+ public boolean getEnableOpacity() { return enableOpacity; }
76
+ public boolean getEnableZoom() { return enableZoom; }
77
+ public boolean getDisableExifHeaderStripping() { return disableExifHeaderStripping; }
78
+ public boolean getDisableAudio() { return disableAudio; }
79
+ }
package/dist/docs.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "methods": [
8
8
  {
9
9
  "name": "start",
10
- "signature": "(options: CameraPreviewOptions) => Promise<void>",
10
+ "signature": "(options: CameraPreviewOptions) => Promise<{ width: number; height: number; x: number; y: number; }>",
11
11
  "parameters": [
12
12
  {
13
13
  "name": "options",
@@ -15,7 +15,7 @@
15
15
  "type": "CameraPreviewOptions"
16
16
  }
17
17
  ],
18
- "returns": "Promise<void>",
18
+ "returns": "Promise<{ width: number; height: number; x: number; y: number; }>",
19
19
  "tags": [
20
20
  {
21
21
  "name": "param",
@@ -23,7 +23,7 @@
23
23
  },
24
24
  {
25
25
  "name": "returns",
26
- "text": "A promise that resolves when the camera preview is started."
26
+ "text": "A promise that resolves with the preview dimensions."
27
27
  },
28
28
  {
29
29
  "name": "since",
@@ -57,7 +57,7 @@
57
57
  },
58
58
  {
59
59
  "name": "capture",
60
- "signature": "(options: CameraPreviewPictureOptions) => Promise<{ value: string; }>",
60
+ "signature": "(options: CameraPreviewPictureOptions) => Promise<{ value: string; exif: ExifData; }>",
61
61
  "parameters": [
62
62
  {
63
63
  "name": "options",
@@ -65,7 +65,7 @@
65
65
  "type": "CameraPreviewPictureOptions"
66
66
  }
67
67
  ],
68
- "returns": "Promise<{ value: string; }>",
68
+ "returns": "Promise<{ value: string; exif: ExifData; }>",
69
69
  "tags": [
70
70
  {
71
71
  "name": "param",
@@ -82,6 +82,7 @@
82
82
  ],
83
83
  "docs": "Captures a picture from the camera.",
84
84
  "complexTypes": [
85
+ "ExifData",
85
86
  "CameraPreviewPictureOptions"
86
87
  ],
87
88
  "slug": "capture"
@@ -138,6 +139,106 @@
138
139
  ],
139
140
  "slug": "getsupportedflashmodes"
140
141
  },
142
+ {
143
+ "name": "setAspectRatio",
144
+ "signature": "(options: { aspectRatio: '4:3' | '16:9'; x?: number; y?: number; }) => Promise<{ width: number; height: number; x: number; y: number; }>",
145
+ "parameters": [
146
+ {
147
+ "name": "options",
148
+ "docs": "- The desired aspect ratio and optional position.\n- aspectRatio: The desired aspect ratio ('4:3' or '16:9')\n- x: Optional x coordinate for positioning. If not provided, view will be auto-centered horizontally.\n- y: Optional y coordinate for positioning. If not provided, view will be auto-centered vertically.",
149
+ "type": "{ aspectRatio: '4:3' | '16:9'; x?: number | undefined; y?: number | undefined; }"
150
+ }
151
+ ],
152
+ "returns": "Promise<{ width: number; height: number; x: number; y: number; }>",
153
+ "tags": [
154
+ {
155
+ "name": "param",
156
+ "text": "options - The desired aspect ratio and optional position.\n- aspectRatio: The desired aspect ratio ('4:3' or '16:9')\n- x: Optional x coordinate for positioning. If not provided, view will be auto-centered horizontally.\n- y: Optional y coordinate for positioning. If not provided, view will be auto-centered vertically."
157
+ },
158
+ {
159
+ "name": "returns",
160
+ "text": "A promise that resolves with the actual preview dimensions and position."
161
+ },
162
+ {
163
+ "name": "since",
164
+ "text": "7.4.0"
165
+ }
166
+ ],
167
+ "docs": "Set the aspect ratio of the camera preview.",
168
+ "complexTypes": [],
169
+ "slug": "setaspectratio"
170
+ },
171
+ {
172
+ "name": "getAspectRatio",
173
+ "signature": "() => Promise<{ aspectRatio: '4:3' | '16:9'; }>",
174
+ "parameters": [],
175
+ "returns": "Promise<{ aspectRatio: '4:3' | '16:9'; }>",
176
+ "tags": [
177
+ {
178
+ "name": "returns",
179
+ "text": "A promise that resolves with the current aspect ratio."
180
+ },
181
+ {
182
+ "name": "since",
183
+ "text": "7.4.0"
184
+ }
185
+ ],
186
+ "docs": "Gets the current aspect ratio of the camera preview.",
187
+ "complexTypes": [],
188
+ "slug": "getaspectratio"
189
+ },
190
+ {
191
+ "name": "setGridMode",
192
+ "signature": "(options: { gridMode: GridMode; }) => Promise<void>",
193
+ "parameters": [
194
+ {
195
+ "name": "options",
196
+ "docs": "- The desired grid mode ('none', '3x3', or '4x4').",
197
+ "type": "{ gridMode: GridMode; }"
198
+ }
199
+ ],
200
+ "returns": "Promise<void>",
201
+ "tags": [
202
+ {
203
+ "name": "param",
204
+ "text": "options - The desired grid mode ('none', '3x3', or '4x4')."
205
+ },
206
+ {
207
+ "name": "returns",
208
+ "text": "A promise that resolves when the grid mode is set."
209
+ },
210
+ {
211
+ "name": "since",
212
+ "text": "8.0.0"
213
+ }
214
+ ],
215
+ "docs": "Sets the grid mode of the camera preview overlay.",
216
+ "complexTypes": [
217
+ "GridMode"
218
+ ],
219
+ "slug": "setgridmode"
220
+ },
221
+ {
222
+ "name": "getGridMode",
223
+ "signature": "() => Promise<{ gridMode: GridMode; }>",
224
+ "parameters": [],
225
+ "returns": "Promise<{ gridMode: GridMode; }>",
226
+ "tags": [
227
+ {
228
+ "name": "returns",
229
+ "text": "A promise that resolves with the current grid mode."
230
+ },
231
+ {
232
+ "name": "since",
233
+ "text": "8.0.0"
234
+ }
235
+ ],
236
+ "docs": "Gets the current grid mode of the camera preview overlay.",
237
+ "complexTypes": [
238
+ "GridMode"
239
+ ],
240
+ "slug": "getgridmode"
241
+ },
141
242
  {
142
243
  "name": "getHorizontalFov",
143
244
  "signature": "() => Promise<{ result: number; }>",
@@ -482,6 +583,45 @@
482
583
  "docs": "Gets the ID of the currently active camera device.",
483
584
  "complexTypes": [],
484
585
  "slug": "getdeviceid"
586
+ },
587
+ {
588
+ "name": "getPreviewSize",
589
+ "signature": "() => Promise<{ x: number; y: number; width: number; height: number; }>",
590
+ "parameters": [],
591
+ "returns": "Promise<{ x: number; y: number; width: number; height: number; }>",
592
+ "tags": [
593
+ {
594
+ "name": "returns"
595
+ }
596
+ ],
597
+ "docs": "Gets the current preview size and position.",
598
+ "complexTypes": [],
599
+ "slug": "getpreviewsize"
600
+ },
601
+ {
602
+ "name": "setPreviewSize",
603
+ "signature": "(options: { x: number; y: number; width: number; height: number; }) => Promise<{ width: number; height: number; x: number; y: number; }>",
604
+ "parameters": [
605
+ {
606
+ "name": "options",
607
+ "docs": "The new position and dimensions.",
608
+ "type": "{ x: number; y: number; width: number; height: number; }"
609
+ }
610
+ ],
611
+ "returns": "Promise<{ width: number; height: number; x: number; y: number; }>",
612
+ "tags": [
613
+ {
614
+ "name": "param",
615
+ "text": "options The new position and dimensions."
616
+ },
617
+ {
618
+ "name": "returns",
619
+ "text": "A promise that resolves with the actual preview dimensions and position."
620
+ }
621
+ ],
622
+ "docs": "Sets the preview size and position.",
623
+ "complexTypes": [],
624
+ "slug": "setpreviewsize"
485
625
  }
486
626
  ],
487
627
  "properties": []
@@ -566,6 +706,36 @@
566
706
  "complexTypes": [],
567
707
  "type": "number | undefined"
568
708
  },
709
+ {
710
+ "name": "aspectRatio",
711
+ "tags": [
712
+ {
713
+ "text": "2.0.0",
714
+ "name": "since"
715
+ }
716
+ ],
717
+ "docs": "The aspect ratio of the camera preview, '4:3' or '16:9' or 'fill'.\nCannot be set if width or height is provided, otherwise the call will be rejected.\nUse setPreviewSize to adjust size after starting.",
718
+ "complexTypes": [],
719
+ "type": "'4:3' | '16:9' | 'fill' | undefined"
720
+ },
721
+ {
722
+ "name": "gridMode",
723
+ "tags": [
724
+ {
725
+ "text": "\"none\"",
726
+ "name": "default"
727
+ },
728
+ {
729
+ "text": "2.1.0",
730
+ "name": "since"
731
+ }
732
+ ],
733
+ "docs": "The grid overlay to display on the camera preview.",
734
+ "complexTypes": [
735
+ "GridMode"
736
+ ],
737
+ "type": "GridMode"
738
+ },
569
739
  {
570
740
  "name": "includeSafeAreaInsets",
571
741
  "tags": [
@@ -688,7 +858,7 @@
688
858
  "name": "disableAudio",
689
859
  "tags": [
690
860
  {
691
- "text": "false",
861
+ "text": "true",
692
862
  "name": "default"
693
863
  }
694
864
  ],
@@ -774,6 +944,14 @@
774
944
  }
775
945
  ]
776
946
  },
947
+ {
948
+ "name": "ExifData",
949
+ "slug": "exifdata",
950
+ "docs": "Represents EXIF data extracted from an image.",
951
+ "tags": [],
952
+ "methods": [],
953
+ "properties": []
954
+ },
777
955
  {
778
956
  "name": "CameraPreviewPictureOptions",
779
957
  "slug": "camerapreviewpictureoptions",
@@ -820,6 +998,38 @@
820
998
  "PictureFormat"
821
999
  ],
822
1000
  "type": "PictureFormat"
1001
+ },
1002
+ {
1003
+ "name": "saveToGallery",
1004
+ "tags": [
1005
+ {
1006
+ "text": "false",
1007
+ "name": "default"
1008
+ },
1009
+ {
1010
+ "text": "7.5.0",
1011
+ "name": "since"
1012
+ }
1013
+ ],
1014
+ "docs": "If true, the captured image will be saved to the user's gallery.",
1015
+ "complexTypes": [],
1016
+ "type": "boolean | undefined"
1017
+ },
1018
+ {
1019
+ "name": "withExifLocation",
1020
+ "tags": [
1021
+ {
1022
+ "text": "false",
1023
+ "name": "default"
1024
+ },
1025
+ {
1026
+ "text": "7.6.0",
1027
+ "name": "since"
1028
+ }
1029
+ ],
1030
+ "docs": "If true, the plugin will attempt to add GPS location data to the image's EXIF metadata.\nThis may prompt the user for location permissions.",
1031
+ "complexTypes": [],
1032
+ "type": "boolean | undefined"
823
1033
  }
824
1034
  ]
825
1035
  },
@@ -1119,6 +1329,25 @@
1119
1329
  }
1120
1330
  ],
1121
1331
  "typeAliases": [
1332
+ {
1333
+ "name": "GridMode",
1334
+ "slug": "gridmode",
1335
+ "docs": "",
1336
+ "types": [
1337
+ {
1338
+ "text": "\"none\"",
1339
+ "complexTypes": []
1340
+ },
1341
+ {
1342
+ "text": "\"3x3\"",
1343
+ "complexTypes": []
1344
+ },
1345
+ {
1346
+ "text": "\"4x4\"",
1347
+ "complexTypes": []
1348
+ }
1349
+ ]
1350
+ },
1122
1351
  {
1123
1352
  "name": "CameraPosition",
1124
1353
  "slug": "cameraposition",
@@ -1,5 +1,6 @@
1
1
  export type CameraPosition = "rear" | "front";
2
2
  export type FlashMode = CameraPreviewFlashMode;
3
+ export type GridMode = "none" | "3x3" | "4x4";
3
4
  export declare enum DeviceType {
4
5
  ULTRA_WIDE = "ultraWide",
5
6
  WIDE_ANGLE = "wideAngle",
@@ -92,6 +93,20 @@ export interface CameraPreviewOptions {
92
93
  * @platform android, ios
93
94
  */
94
95
  y?: number;
96
+ /**
97
+ * The aspect ratio of the camera preview, '4:3' or '16:9' or 'fill'.
98
+ * Cannot be set if width or height is provided, otherwise the call will be rejected.
99
+ * Use setPreviewSize to adjust size after starting.
100
+ *
101
+ * @since 2.0.0
102
+ */
103
+ aspectRatio?: '4:3' | '16:9' | 'fill';
104
+ /**
105
+ * The grid overlay to display on the camera preview.
106
+ * @default "none"
107
+ * @since 2.1.0
108
+ */
109
+ gridMode?: GridMode;
95
110
  /**
96
111
  * Adjusts the y-position to account for safe areas (e.g., notches).
97
112
  * @platform ios
@@ -140,7 +155,7 @@ export interface CameraPreviewOptions {
140
155
  enableHighResolution?: boolean;
141
156
  /**
142
157
  * If true, disables the audio stream, preventing audio permission requests.
143
- * @default false
158
+ * @default true
144
159
  */
145
160
  disableAudio?: boolean;
146
161
  /**
@@ -192,6 +207,23 @@ export interface CameraPreviewPictureOptions {
192
207
  * @default "jpeg"
193
208
  */
194
209
  format?: PictureFormat;
210
+ /**
211
+ * If true, the captured image will be saved to the user's gallery.
212
+ * @default false
213
+ * @since 7.5.0
214
+ */
215
+ saveToGallery?: boolean;
216
+ /**
217
+ * If true, the plugin will attempt to add GPS location data to the image's EXIF metadata.
218
+ * This may prompt the user for location permissions.
219
+ * @default false
220
+ * @since 7.6.0
221
+ */
222
+ withExifLocation?: boolean;
223
+ }
224
+ /** Represents EXIF data extracted from an image. */
225
+ export interface ExifData {
226
+ [key: string]: any;
195
227
  }
196
228
  export type PictureFormat = "jpeg" | "png";
197
229
  /** Defines a standard picture size with width and height. */
@@ -241,10 +273,19 @@ export interface CameraPreviewPlugin {
241
273
  * Starts the camera preview.
242
274
  *
243
275
  * @param {CameraPreviewOptions} options - The configuration for the camera preview.
244
- * @returns {Promise<void>} A promise that resolves when the camera preview is started.
276
+ * @returns {Promise<{ width: number; height: number; x: number; y: number }>} A promise that resolves with the preview dimensions.
245
277
  * @since 0.0.1
246
278
  */
247
- start(options: CameraPreviewOptions): Promise<void>;
279
+ start(options: CameraPreviewOptions): Promise<{
280
+ /** The width of the preview in pixels. */
281
+ width: number;
282
+ /** The height of the preview in pixels. */
283
+ height: number;
284
+ /** The horizontal origin of the preview, in pixels. */
285
+ x: number;
286
+ /** The vertical origin of the preview, in pixels. */
287
+ y: number;
288
+ }>;
248
289
  /**
249
290
  * Stops the camera preview.
250
291
  *
@@ -262,6 +303,7 @@ export interface CameraPreviewPlugin {
262
303
  */
263
304
  capture(options: CameraPreviewPictureOptions): Promise<{
264
305
  value: string;
306
+ exif: ExifData;
265
307
  }>;
266
308
  /**
267
309
  * Captures a single frame from the camera preview stream.
@@ -282,6 +324,54 @@ export interface CameraPreviewPlugin {
282
324
  getSupportedFlashModes(): Promise<{
283
325
  result: CameraPreviewFlashMode[];
284
326
  }>;
327
+ /**
328
+ * Set the aspect ratio of the camera preview.
329
+ *
330
+ * @param {{ aspectRatio: '4:3' | '16:9'; x?: number; y?: number }} options - The desired aspect ratio and optional position.
331
+ * - aspectRatio: The desired aspect ratio ('4:3' or '16:9')
332
+ * - x: Optional x coordinate for positioning. If not provided, view will be auto-centered horizontally.
333
+ * - y: Optional y coordinate for positioning. If not provided, view will be auto-centered vertically.
334
+ * @returns {Promise<{ width: number; height: number; x: number; y: number }>} A promise that resolves with the actual preview dimensions and position.
335
+ * @since 7.4.0
336
+ */
337
+ setAspectRatio(options: {
338
+ aspectRatio: '4:3' | '16:9';
339
+ x?: number;
340
+ y?: number;
341
+ }): Promise<{
342
+ width: number;
343
+ height: number;
344
+ x: number;
345
+ y: number;
346
+ }>;
347
+ /**
348
+ * Gets the current aspect ratio of the camera preview.
349
+ *
350
+ * @returns {Promise<{ aspectRatio: '4:3' | '16:9' }>} A promise that resolves with the current aspect ratio.
351
+ * @since 7.4.0
352
+ */
353
+ getAspectRatio(): Promise<{
354
+ aspectRatio: '4:3' | '16:9';
355
+ }>;
356
+ /**
357
+ * Sets the grid mode of the camera preview overlay.
358
+ *
359
+ * @param {{ gridMode: GridMode }} options - The desired grid mode ('none', '3x3', or '4x4').
360
+ * @returns {Promise<void>} A promise that resolves when the grid mode is set.
361
+ * @since 8.0.0
362
+ */
363
+ setGridMode(options: {
364
+ gridMode: GridMode;
365
+ }): Promise<void>;
366
+ /**
367
+ * Gets the current grid mode of the camera preview overlay.
368
+ *
369
+ * @returns {Promise<{ gridMode: GridMode }>} A promise that resolves with the current grid mode.
370
+ * @since 8.0.0
371
+ */
372
+ getGridMode(): Promise<{
373
+ gridMode: GridMode;
374
+ }>;
285
375
  /**
286
376
  * Gets the horizontal field of view (FoV) for the active camera.
287
377
  * Note: This can be an estimate on some devices.
@@ -418,4 +508,30 @@ export interface CameraPreviewPlugin {
418
508
  getDeviceId(): Promise<{
419
509
  deviceId: string;
420
510
  }>;
511
+ /**
512
+ * Gets the current preview size and position.
513
+ * @returns {Promise<{x: number, y: number, width: number, height: number}>}
514
+ */
515
+ getPreviewSize(): Promise<{
516
+ x: number;
517
+ y: number;
518
+ width: number;
519
+ height: number;
520
+ }>;
521
+ /**
522
+ * Sets the preview size and position.
523
+ * @param options The new position and dimensions.
524
+ * @returns {Promise<{ width: number; height: number; x: number; y: number }>} A promise that resolves with the actual preview dimensions and position.
525
+ */
526
+ setPreviewSize(options: {
527
+ x: number;
528
+ y: number;
529
+ width: number;
530
+ height: number;
531
+ }): Promise<{
532
+ width: number;
533
+ height: number;
534
+ x: number;
535
+ y: number;
536
+ }>;
421
537
  }