@rescript/webapi 0.1.0-experimental-cd67e9b → 0.1.0-experimental-d3d4b5f

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rescript/webapi",
3
- "version": "0.1.0-experimental-cd67e9b",
3
+ "version": "0.1.0-experimental-d3d4b5f",
4
4
  "description": "Experimental successor to [rescript-webapi](https://github.com/TheSpyder/rescript-webapi)",
5
5
  "homepage": "https://rescript-lang.github.io/experimental-rescript-webapi/",
6
6
  "bugs": "https://github.com/rescript-lang/experimental-rescript-webapi/issues",
@@ -0,0 +1,12 @@
1
+ open CanvasAPI
2
+
3
+ /**
4
+ Adds a color stop with the given color to the gradient at the given offset. 0.0 is the offset at one end of the gradient, 1.0 is the offset at the other end.
5
+
6
+ Throws an "IndexSizeError" DOMException if the offset is out of range. Throws a "SyntaxError" DOMException if the color cannot be parsed.
7
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/CanvasGradient/addColorStop)
8
+ */
9
+ @send
10
+ external addColorStop: (canvasGradient, ~offset: float, ~color: string) => unit = "addColorStop"
11
+
12
+ let isInstanceOf = (_: 't): bool => %raw(`param instanceof CanvasGradient`)
@@ -0,0 +1,11 @@
1
+ open DOMAPI
2
+ open CanvasAPI
3
+
4
+ /**
5
+ Sets the transformation matrix that will be used when rendering the pattern during a fill or stroke painting operation.
6
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/CanvasPattern/setTransform)
7
+ */
8
+ @send
9
+ external setTransform: (canvasPattern, ~transform: domMatrix2DInit=?) => unit = "setTransform"
10
+
11
+ let isInstanceOf = (_: 't): bool => %raw(`param instanceof CanvasPattern`)
@@ -0,0 +1,9 @@
1
+ open CanvasAPI
2
+
3
+ /**
4
+ Transfers the underlying bitmap data from imageBitmap to context, and the bitmap becomes the contents of the canvas element to which context is bound.
5
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/ImageBitmapRenderingContext/transferFromImageBitmap)
6
+ */
7
+ @send
8
+ external transferFromImageBitmap: (imageBitmapRenderingContext, imageBitmap) => unit =
9
+ "transferFromImageBitmap"
@@ -1,6 +1,5 @@
1
1
  open EventAPI
2
2
  open CanvasAPI
3
- open DOMAPI
4
3
  open Prelude
5
4
  open FileAPI
6
5
 
@@ -99,11 +98,56 @@ Returns null if the canvas has already been initialized with another context typ
99
98
  [Read more on MDN](https://developer.mozilla.org/docs/Web/API/OffscreenCanvas/getContext)
100
99
  */
101
100
  @send
102
- external getContext: (
101
+ external getContext_2D: (
103
102
  offscreenCanvas,
104
- ~contextId: offscreenRenderingContextId,
103
+ @as("2d") _,
105
104
  ~options: JSON.t=?,
106
- ) => offscreenRenderingContext = "getContext"
105
+ ) => offscreenCanvasRenderingContext2D = "getContext"
106
+
107
+ /**
108
+ Returns an object that exposes an API for drawing on the OffscreenCanvas object. contextId specifies the desired API: "2d", "bitmaprenderer", "webgl", or "webgl2". options is handled by that API.
109
+
110
+ This specification defines the "2d" context below, which is similar but distinct from the "2d" context that is created from a canvas element. The WebGL specifications define the "webgl" and "webgl2" contexts. [WEBGL]
111
+
112
+ Returns null if the canvas has already been initialized with another context type (e.g., trying to get a "2d" context after getting a "webgl" context).
113
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/OffscreenCanvas/getContext)
114
+ */
115
+ @send
116
+ external getContext_WebGL: (
117
+ offscreenCanvas,
118
+ @as("webgl") _,
119
+ ~options: webGLContextAttributes=?,
120
+ ) => webGLRenderingContext = "getContext"
121
+
122
+ /**
123
+ Returns an object that exposes an API for drawing on the OffscreenCanvas object. contextId specifies the desired API: "2d", "bitmaprenderer", "webgl", or "webgl2". options is handled by that API.
124
+
125
+ This specification defines the "2d" context below, which is similar but distinct from the "2d" context that is created from a canvas element. The WebGL specifications define the "webgl" and "webgl2" contexts. [WEBGL]
126
+
127
+ Returns null if the canvas has already been initialized with another context type (e.g., trying to get a "2d" context after getting a "webgl" context).
128
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/OffscreenCanvas/getContext)
129
+ */
130
+ @send
131
+ external getContext_WebGL2: (
132
+ offscreenCanvas,
133
+ @as("webgl2") _,
134
+ ~options: webGLContextAttributes=?,
135
+ ) => webGL2RenderingContext = "getContext"
136
+
137
+ /**
138
+ Returns an object that exposes an API for drawing on the OffscreenCanvas object. contextId specifies the desired API: "2d", "bitmaprenderer", "webgl", or "webgl2". options is handled by that API.
139
+
140
+ This specification defines the "2d" context below, which is similar but distinct from the "2d" context that is created from a canvas element. The WebGL specifications define the "webgl" and "webgl2" contexts. [WEBGL]
141
+
142
+ Returns null if the canvas has already been initialized with another context type (e.g., trying to get a "2d" context after getting a "webgl" context).
143
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/OffscreenCanvas/getContext)
144
+ */
145
+ @send
146
+ external getContext_BitmapRenderer: (
147
+ offscreenCanvas,
148
+ @as("bitmaprenderer") _,
149
+ ~options: imageBitmapRenderingContextSettings=?,
150
+ ) => imageBitmapRenderingContext = "getContext"
107
151
 
108
152
  /**
109
153
  Returns a newly created ImageBitmap object with the image in the OffscreenCanvas object. The image in the OffscreenCanvas object is replaced with a new blank image.
@@ -0,0 +1,142 @@
1
+ open CanvasAPI
2
+ open DOMAPI
3
+
4
+ /**
5
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Path2D)
6
+ */
7
+ @new
8
+ external make: (~path: path2D=?) => path2D = "Path2D"
9
+
10
+ /**
11
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Path2D)
12
+ */
13
+ @new
14
+ external make2: (~path: string=?) => path2D = "Path2D"
15
+
16
+ /**
17
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/closePath)
18
+ */
19
+ @send
20
+ external closePath: path2D => unit = "closePath"
21
+
22
+ /**
23
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/moveTo)
24
+ */
25
+ @send
26
+ external moveTo: (path2D, ~x: float, ~y: float) => unit = "moveTo"
27
+
28
+ /**
29
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/lineTo)
30
+ */
31
+ @send
32
+ external lineTo: (path2D, ~x: float, ~y: float) => unit = "lineTo"
33
+
34
+ /**
35
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/quadraticCurveTo)
36
+ */
37
+ @send
38
+ external quadraticCurveTo: (path2D, ~cpx: float, ~cpy: float, ~x: float, ~y: float) => unit =
39
+ "quadraticCurveTo"
40
+
41
+ /**
42
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/bezierCurveTo)
43
+ */
44
+ @send
45
+ external bezierCurveTo: (
46
+ path2D,
47
+ ~cp1x: float,
48
+ ~cp1y: float,
49
+ ~cp2x: float,
50
+ ~cp2y: float,
51
+ ~x: float,
52
+ ~y: float,
53
+ ) => unit = "bezierCurveTo"
54
+
55
+ /**
56
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/arcTo)
57
+ */
58
+ @send
59
+ external arcTo: (path2D, ~x1: float, ~y1: float, ~x2: float, ~y2: float, ~radius: float) => unit =
60
+ "arcTo"
61
+
62
+ /**
63
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/rect)
64
+ */
65
+ @send
66
+ external rect: (path2D, ~x: float, ~y: float, ~w: float, ~h: float) => unit = "rect"
67
+
68
+ /**
69
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/roundRect)
70
+ */
71
+ @send
72
+ external roundRect: (
73
+ path2D,
74
+ ~x: float,
75
+ ~y: float,
76
+ ~w: float,
77
+ ~h: float,
78
+ ~radii_: array<float>=?,
79
+ ) => unit = "roundRect"
80
+
81
+ /**
82
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/roundRect)
83
+ */
84
+ @send
85
+ external roundRect2: (
86
+ path2D,
87
+ ~x: float,
88
+ ~y: float,
89
+ ~w: float,
90
+ ~h: float,
91
+ ~radii_: array<float>=?,
92
+ ) => unit = "roundRect"
93
+
94
+ /**
95
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/roundRect)
96
+ */
97
+ @send
98
+ external roundRect3: (
99
+ path2D,
100
+ ~x: float,
101
+ ~y: float,
102
+ ~w: float,
103
+ ~h: float,
104
+ ~radii_: array<float>=?,
105
+ ) => unit = "roundRect"
106
+
107
+ /**
108
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/arc)
109
+ */
110
+ @send
111
+ external arc: (
112
+ path2D,
113
+ ~x: float,
114
+ ~y: float,
115
+ ~radius: float,
116
+ ~startAngle: float,
117
+ ~endAngle: float,
118
+ ~counterclockwise: bool=?,
119
+ ) => unit = "arc"
120
+
121
+ /**
122
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/ellipse)
123
+ */
124
+ @send
125
+ external ellipse: (
126
+ path2D,
127
+ ~x: float,
128
+ ~y: float,
129
+ ~radiusX: float,
130
+ ~radiusY: float,
131
+ ~rotation: float,
132
+ ~startAngle: float,
133
+ ~endAngle: float,
134
+ ~counterclockwise: bool=?,
135
+ ) => unit = "ellipse"
136
+
137
+ /**
138
+ Adds to the path the path given by the argument.
139
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Path2D/addPath)
140
+ */
141
+ @send
142
+ external addPath: (path2D, ~path: path2D, ~transform: domMatrix2DInit=?) => unit = "addPath"
package/src/CanvasAPI.res CHANGED
@@ -10,6 +10,113 @@ type offscreenRenderingContextId =
10
10
  | @as("webgl2") Webgl2
11
11
  | @as("webgpu") Webgpu
12
12
 
13
+ type globalCompositeOperation =
14
+ | @as("color") Color
15
+ | @as("color-burn") ColorBurn
16
+ | @as("color-dodge") ColorDodge
17
+ | @as("copy") Copy
18
+ | @as("darken") Darken
19
+ | @as("destination-atop") DestinationAtop
20
+ | @as("destination-in") DestinationIn
21
+ | @as("destination-out") DestinationOut
22
+ | @as("destination-over") DestinationOver
23
+ | @as("difference") Difference
24
+ | @as("exclusion") Exclusion
25
+ | @as("hard-light") HardLight
26
+ | @as("hue") Hue
27
+ | @as("lighten") Lighten
28
+ | @as("lighter") Lighter
29
+ | @as("luminosity") Luminosity
30
+ | @as("multiply") Multiply
31
+ | @as("overlay") Overlay
32
+ | @as("saturation") Saturation
33
+ | @as("screen") Screen
34
+ | @as("soft-light") SoftLight
35
+ | @as("source-atop") SourceAtop
36
+ | @as("source-in") SourceIn
37
+ | @as("source-out") SourceOut
38
+ | @as("source-over") SourceOver
39
+ | @as("xor") Xor
40
+
41
+ type imageSmoothingQuality =
42
+ | @as("high") High
43
+ | @as("low") Low
44
+ | @as("medium") Medium
45
+
46
+ type canvasLineCap =
47
+ | @as("butt") Butt
48
+ | @as("round") Round
49
+ | @as("square") Square
50
+
51
+ type canvasLineJoin =
52
+ | @as("bevel") Bevel
53
+ | @as("miter") Miter
54
+ | @as("round") Round
55
+
56
+ type canvasTextAlign =
57
+ | @as("center") Center
58
+ | @as("end") End
59
+ | @as("left") Left
60
+ | @as("right") Right
61
+ | @as("start") Start
62
+
63
+ type canvasTextBaseline =
64
+ | @as("alphabetic") Alphabetic
65
+ | @as("bottom") Bottom
66
+ | @as("hanging") Hanging
67
+ | @as("ideographic") Ideographic
68
+ | @as("middle") Middle
69
+ | @as("top") Top
70
+
71
+ type canvasDirection =
72
+ | @as("inherit") Inherit
73
+ | @as("ltr") Ltr
74
+ | @as("rtl") Rtl
75
+
76
+ type canvasFontKerning =
77
+ | @as("auto") Auto
78
+ | @as("none") None
79
+ | @as("normal") Normal
80
+
81
+ type canvasFontStretch =
82
+ | @as("condensed") Condensed
83
+ | @as("expanded") Expanded
84
+ | @as("extra-condensed") ExtraCondensed
85
+ | @as("extra-expanded") ExtraExpanded
86
+ | @as("normal") Normal
87
+ | @as("semi-condensed") SemiCondensed
88
+ | @as("semi-expanded") SemiExpanded
89
+ | @as("ultra-condensed") UltraCondensed
90
+ | @as("ultra-expanded") UltraExpanded
91
+
92
+ type canvasFontVariantCaps =
93
+ | @as("all-petite-caps") AllPetiteCaps
94
+ | @as("all-small-caps") AllSmallCaps
95
+ | @as("normal") Normal
96
+ | @as("petite-caps") PetiteCaps
97
+ | @as("small-caps") SmallCaps
98
+ | @as("titling-caps") TitlingCaps
99
+ | @as("unicase") Unicase
100
+
101
+ type canvasTextRendering =
102
+ | @as("auto") Auto
103
+ | @as("geometricPrecision") GeometricPrecision
104
+ | @as("optimizeLegibility") OptimizeLegibility
105
+ | @as("optimizeSpeed") OptimizeSpeed
106
+
107
+ type predefinedColorSpace =
108
+ | @as("display-p3") DisplayP3
109
+ | @as("srgb") Srgb
110
+
111
+ type canvasFillRule =
112
+ | @as("evenodd") Evenodd
113
+ | @as("nonzero") Nonzero
114
+
115
+ type webGLPowerPreference =
116
+ | @as("default") Default
117
+ | @as("high-performance") HighPerformance
118
+ | @as("low-power") LowPower
119
+
13
120
  /**
14
121
  [See OffscreenCanvas on MDN](https://developer.mozilla.org/docs/Web/API/OffscreenCanvas)
15
122
  */
@@ -47,9 +154,293 @@ type imageBitmap = {
47
154
  height: int,
48
155
  }
49
156
 
157
+ /**
158
+ [See OffscreenCanvasRenderingContext2D on MDN](https://developer.mozilla.org/docs/Web/API/OffscreenCanvasRenderingContext2D)
159
+ */
160
+ type offscreenCanvasRenderingContext2D = {
161
+ /**
162
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/canvas)
163
+ */
164
+ canvas: offscreenCanvas,
165
+ /**
166
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/globalAlpha)
167
+ */
168
+ mutable globalAlpha: float,
169
+ /**
170
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/globalCompositeOperation)
171
+ */
172
+ mutable globalCompositeOperation: globalCompositeOperation,
173
+ /**
174
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/imageSmoothingEnabled)
175
+ */
176
+ mutable imageSmoothingEnabled: bool,
177
+ /**
178
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/imageSmoothingQuality)
179
+ */
180
+ mutable imageSmoothingQuality: imageSmoothingQuality,
181
+ /**
182
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/strokeStyle)
183
+ */
184
+ mutable strokeStyle: unknown,
185
+ /**
186
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/fillStyle)
187
+ */
188
+ mutable fillStyle: unknown,
189
+ /**
190
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/shadowOffsetX)
191
+ */
192
+ mutable shadowOffsetX: float,
193
+ /**
194
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/shadowOffsetY)
195
+ */
196
+ mutable shadowOffsetY: float,
197
+ /**
198
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/shadowBlur)
199
+ */
200
+ mutable shadowBlur: float,
201
+ /**
202
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/shadowColor)
203
+ */
204
+ mutable shadowColor: string,
205
+ /**
206
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/filter)
207
+ */
208
+ mutable filter: string,
209
+ /**
210
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/lineWidth)
211
+ */
212
+ mutable lineWidth: float,
213
+ /**
214
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/lineCap)
215
+ */
216
+ mutable lineCap: canvasLineCap,
217
+ /**
218
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/lineJoin)
219
+ */
220
+ mutable lineJoin: canvasLineJoin,
221
+ /**
222
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/miterLimit)
223
+ */
224
+ mutable miterLimit: float,
225
+ /**
226
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/lineDashOffset)
227
+ */
228
+ mutable lineDashOffset: float,
229
+ /**
230
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/font)
231
+ */
232
+ mutable font: string,
233
+ /**
234
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/textAlign)
235
+ */
236
+ mutable textAlign: canvasTextAlign,
237
+ /**
238
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/textBaseline)
239
+ */
240
+ mutable textBaseline: canvasTextBaseline,
241
+ /**
242
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/direction)
243
+ */
244
+ mutable direction: canvasDirection,
245
+ /**
246
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/letterSpacing)
247
+ */
248
+ mutable letterSpacing: string,
249
+ /**
250
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/fontKerning)
251
+ */
252
+ mutable fontKerning: canvasFontKerning,
253
+ /**
254
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/fontStretch)
255
+ */
256
+ mutable fontStretch: canvasFontStretch,
257
+ /**
258
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/fontVariantCaps)
259
+ */
260
+ mutable fontVariantCaps: canvasFontVariantCaps,
261
+ /**
262
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/textRendering)
263
+ */
264
+ mutable textRendering: canvasTextRendering,
265
+ /**
266
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/wordSpacing)
267
+ */
268
+ mutable wordSpacing: string,
269
+ }
270
+
271
+ /**
272
+ [See ImageBitmapRenderingContext on MDN](https://developer.mozilla.org/docs/Web/API/ImageBitmapRenderingContext)
273
+ */
274
+ type imageBitmapRenderingContext = {
275
+ /**
276
+ Returns the canvas element that the context is bound to.
277
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/ImageBitmapRenderingContext/canvas)
278
+ */
279
+ canvas: unknown,
280
+ }
281
+
282
+ /**
283
+ Provides an interface to the OpenGL ES 2.0 graphics rendering context for the drawing surface of an HTML <canvas> element.
284
+ [See WebGLRenderingContext on MDN](https://developer.mozilla.org/docs/Web/API/WebGLRenderingContext)
285
+ */
286
+ type webGLRenderingContext = {
287
+ /**
288
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/WebGLRenderingContext/canvas)
289
+ */
290
+ canvas: unknown,
291
+ /**
292
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/WebGLRenderingContext/drawingBufferWidth)
293
+ */
294
+ drawingBufferWidth: float,
295
+ /**
296
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/WebGLRenderingContext/drawingBufferHeight)
297
+ */
298
+ drawingBufferHeight: float,
299
+ /**
300
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/WebGLRenderingContext/drawingBufferColorSpace)
301
+ */
302
+ mutable drawingBufferColorSpace: predefinedColorSpace,
303
+ /**
304
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/WebGL2RenderingContext/unpackColorSpace)
305
+ */
306
+ mutable unpackColorSpace: predefinedColorSpace,
307
+ }
308
+
309
+ /**
310
+ [See WebGL2RenderingContext on MDN](https://developer.mozilla.org/docs/Web/API/WebGL2RenderingContext)
311
+ */
312
+ type webGL2RenderingContext = {
313
+ /**
314
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/WebGLRenderingContext/canvas)
315
+ */
316
+ canvas: unknown,
317
+ /**
318
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/WebGLRenderingContext/drawingBufferWidth)
319
+ */
320
+ drawingBufferWidth: float,
321
+ /**
322
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/WebGLRenderingContext/drawingBufferHeight)
323
+ */
324
+ drawingBufferHeight: float,
325
+ /**
326
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/WebGLRenderingContext/drawingBufferColorSpace)
327
+ */
328
+ mutable drawingBufferColorSpace: predefinedColorSpace,
329
+ /**
330
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/WebGL2RenderingContext/unpackColorSpace)
331
+ */
332
+ mutable unpackColorSpace: predefinedColorSpace,
333
+ }
334
+
335
+ /**
336
+ An opaque object describing a gradient. It is returned by the methods CanvasRenderingContext2D.createLinearGradient() or CanvasRenderingContext2D.createRadialGradient().
337
+ [See CanvasGradient on MDN](https://developer.mozilla.org/docs/Web/API/CanvasGradient)
338
+ */
339
+ type canvasGradient = {}
340
+
341
+ /**
342
+ An opaque object describing a pattern, based on an image, a canvas, or a video, created by the CanvasRenderingContext2D.createPattern() method.
343
+ [See CanvasPattern on MDN](https://developer.mozilla.org/docs/Web/API/CanvasPattern)
344
+ */
345
+ type canvasPattern = {}
346
+
347
+ /**
348
+ This Canvas 2D API interface is used to declare a path that can then be used on a CanvasRenderingContext2D object. The path methods of the CanvasRenderingContext2D interface are also present on this interface, which gives you the convenience of being able to retain and replay your path whenever desired.
349
+ [See Path2D on MDN](https://developer.mozilla.org/docs/Web/API/Path2D)
350
+ */
351
+ type path2D = {}
352
+
353
+ /**
354
+ The dimensions of a piece of text in the canvas, as created by the CanvasRenderingContext2D.measureText() method.
355
+ [See TextMetrics on MDN](https://developer.mozilla.org/docs/Web/API/TextMetrics)
356
+ */
357
+ type textMetrics = {
358
+ /**
359
+ Returns the measurement described below.
360
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/TextMetrics/width)
361
+ */
362
+ width: float,
363
+ /**
364
+ Returns the measurement described below.
365
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/TextMetrics/actualBoundingBoxLeft)
366
+ */
367
+ actualBoundingBoxLeft: float,
368
+ /**
369
+ Returns the measurement described below.
370
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/TextMetrics/actualBoundingBoxRight)
371
+ */
372
+ actualBoundingBoxRight: float,
373
+ /**
374
+ Returns the measurement described below.
375
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/TextMetrics/fontBoundingBoxAscent)
376
+ */
377
+ fontBoundingBoxAscent: float,
378
+ /**
379
+ Returns the measurement described below.
380
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/TextMetrics/fontBoundingBoxDescent)
381
+ */
382
+ fontBoundingBoxDescent: float,
383
+ /**
384
+ Returns the measurement described below.
385
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/TextMetrics/actualBoundingBoxAscent)
386
+ */
387
+ actualBoundingBoxAscent: float,
388
+ /**
389
+ Returns the measurement described below.
390
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/TextMetrics/actualBoundingBoxDescent)
391
+ */
392
+ actualBoundingBoxDescent: float,
393
+ /**
394
+ Returns the measurement described below.
395
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/TextMetrics/emHeightAscent)
396
+ */
397
+ emHeightAscent: float,
398
+ /**
399
+ Returns the measurement described below.
400
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/TextMetrics/emHeightDescent)
401
+ */
402
+ emHeightDescent: float,
403
+ /**
404
+ Returns the measurement described below.
405
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/TextMetrics/hangingBaseline)
406
+ */
407
+ hangingBaseline: float,
408
+ /**
409
+ Returns the measurement described below.
410
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/TextMetrics/alphabeticBaseline)
411
+ */
412
+ alphabeticBaseline: float,
413
+ /**
414
+ Returns the measurement described below.
415
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/TextMetrics/ideographicBaseline)
416
+ */
417
+ ideographicBaseline: float,
418
+ }
419
+
50
420
  type offscreenRenderingContext = any
51
421
 
52
422
  type imageEncodeOptions = {
53
423
  @as("type") mutable type_?: string,
54
424
  mutable quality?: float,
55
425
  }
426
+
427
+ type canvasRenderingContext2DSettings = {
428
+ mutable alpha?: bool,
429
+ mutable desynchronized?: bool,
430
+ mutable colorSpace?: predefinedColorSpace,
431
+ mutable willReadFrequently?: bool,
432
+ }
433
+
434
+ type webGLContextAttributes = {
435
+ mutable alpha?: bool,
436
+ mutable depth?: bool,
437
+ mutable stencil?: bool,
438
+ mutable antialias?: bool,
439
+ mutable premultipliedAlpha?: bool,
440
+ mutable preserveDrawingBuffer?: bool,
441
+ mutable powerPreference?: webGLPowerPreference,
442
+ mutable failIfMajorPerformanceCaveat?: bool,
443
+ mutable desynchronized?: bool,
444
+ }
445
+
446
+ type imageBitmapRenderingContextSettings = {mutable alpha?: bool}