1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 | declare module 'image-capture';
|
8 |
|
9 | declare class ImageCapture {
|
10 | constructor(videoTrack: MediaStreamTrack);
|
11 |
|
12 | takePhoto(photoSettings?: PhotoSettings): Promise<Blob>;
|
13 |
|
14 | getPhotoCapabilities(): Promise<PhotoCapabilities>;
|
15 |
|
16 | getPhotoSettings(): Promise<PhotoSettings>;
|
17 |
|
18 | grabFrame(): Promise<ImageBitmap>;
|
19 |
|
20 | readonly track: MediaStreamTrack;
|
21 | }
|
22 |
|
23 | interface PhotoCapabilities {
|
24 | readonly redEyeReduction: RedEyeReduction;
|
25 | readonly imageHeight: MediaSettingsRange;
|
26 | readonly imageWidth: MediaSettingsRange;
|
27 | readonly fillLightMode: FillLightMode[];
|
28 | }
|
29 |
|
30 | interface PhotoSettings {
|
31 | fillLightMode?: FillLightMode;
|
32 | imageHeight?: number;
|
33 | imageWidth?: number;
|
34 | redEyeReduction?: boolean;
|
35 | }
|
36 |
|
37 | interface MediaSettingsRange {
|
38 | readonly max: number;
|
39 | readonly min: number;
|
40 | readonly step: number;
|
41 | }
|
42 |
|
43 | type RedEyeReduction = 'never' | 'always' | 'controllable';
|
44 | type FillLightMode = 'auto' | 'off' | 'flash';
|
45 |
|
46 | interface MediaTrackCapabilities {
|
47 | whiteBalanceMode: MeteringMode[];
|
48 | exposureMode: MeteringMode[];
|
49 | focusMode: MeteringMode[];
|
50 |
|
51 | exposureCompensation: MediaSettingsRange;
|
52 | colorTemperature: MediaSettingsRange;
|
53 | iso: MediaSettingsRange;
|
54 | brightness: MediaSettingsRange;
|
55 | contrast: MediaSettingsRange;
|
56 | saturation: MediaSettingsRange;
|
57 | sharpness: MediaSettingsRange;
|
58 |
|
59 | focusDistance: MediaSettingsRange;
|
60 | zoom: MediaSettingsRange;
|
61 | torch: boolean;
|
62 | }
|
63 |
|
64 | declare namespace W3C {
|
65 | type ConstrainPoint2D = Point2D[] | ConstrainPoint2DParameters;
|
66 | }
|
67 |
|
68 | interface MediaTrackConstraintSet {
|
69 | whiteBalanceMode?: W3C.ConstrainString;
|
70 | exposureMode?: W3C.ConstrainString;
|
71 | focusMode?: W3C.ConstrainString;
|
72 | pointsOfInterest?: W3C.ConstrainPoint2D;
|
73 |
|
74 | exposureCompensation?: W3C.ConstrainDouble;
|
75 | colorTemperature?: W3C.ConstrainDouble;
|
76 | iso?: W3C.ConstrainDouble;
|
77 |
|
78 | brightness?: W3C.ConstrainDouble;
|
79 | contrast?: W3C.ConstrainDouble;
|
80 | saturation?: W3C.ConstrainDouble;
|
81 | sharpness?: W3C.ConstrainDouble;
|
82 |
|
83 | focusDistance?: W3C.ConstrainDouble;
|
84 | zoom?: W3C.ConstrainDouble;
|
85 |
|
86 | torch?: W3C.ConstrainBoolean;
|
87 | }
|
88 |
|
89 | interface MediaTrackSettings {
|
90 | whiteBalanceMode: MeteringMode;
|
91 | exposureMode: MeteringMode;
|
92 | focusMode: MeteringMode;
|
93 | pointsOfInterest: Point2D[];
|
94 |
|
95 | exposureCompensation: number;
|
96 | colorTemperature: number;
|
97 | iso: number;
|
98 |
|
99 | brightness: number;
|
100 | contrast: number;
|
101 | saturation: number;
|
102 | sharpness: number;
|
103 |
|
104 | focusDistance: number;
|
105 | zoom: number;
|
106 |
|
107 | torch: boolean;
|
108 | }
|
109 |
|
110 | interface MediaTrackSupportedConstraints {
|
111 | whiteBalanceMode: boolean;
|
112 | exposureMode: boolean;
|
113 | focusMode: boolean;
|
114 | pointsOfInterest: boolean;
|
115 |
|
116 | exposureCompensation: boolean;
|
117 | colorTemperature: boolean;
|
118 | iso: boolean;
|
119 |
|
120 | brightness: boolean;
|
121 | contrast: boolean;
|
122 | saturation: boolean;
|
123 | sharpness: boolean;
|
124 | focusDistance: boolean;
|
125 | zoom: boolean;
|
126 | torch: boolean;
|
127 | }
|
128 |
|
129 | interface ConstrainPoint2DParameters {
|
130 | exact: Point2D[];
|
131 | ideal: Point2D[];
|
132 | }
|
133 |
|
134 | type MeteringMode = 'none' | 'manual' | 'single-shot' | 'continuous';
|
135 |
|
136 | interface Point2D {
|
137 | x: number;
|
138 | y: number;
|
139 | }
|