blob: 72e44fe2e791a7c789cf9bcfeac9d20e7c4720aa [file] [log] [blame]
Kevin Lubick217056c2018-09-20 17:39:31 -04001/*
2 * This externs file prevents the Closure JS compiler from minifying away
3 * names of objects created by Emscripten.
4 * Basically, by defining empty objects and functions here, Closure will
5 * know not to rename them. This is needed because of our pre-js files,
6 * that is, the JS we hand-write to bundle into the output. That JS will be
7 * hit by the closure compiler and thus needs to know about what functions
8 * have special names and should not be minified.
9 *
10 * Emscripten does not support automatically generating an externs file, so we
11 * do it by hand. The general process is to write some JS code, and then put any
12 * calls to CanvasKit or related things in here. Running ./compile.sh and then
13 * looking at the minified results or running the Release trybot should
14 * verify nothing was missed. Optionally, looking directly at the minified
15 * pathkit.js can be useful when developing locally.
16 *
17 * Docs:
18 * https://github.com/cljsjs/packages/wiki/Creating-Externs
19 * https://github.com/google/closure-compiler/wiki/Types-in-the-Closure-Type-System
20 *
21 * Example externs:
22 * https://github.com/google/closure-compiler/tree/master/externs
23 */
24
25var CanvasKit = {
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -050026 // public API (i.e. things we declare in the pre-js file or in the cpp bindings)
27 Color: function() {},
28 /** @return {CanvasKit.SkRect} */
29 LTRBRect: function() {},
30 /** @return {CanvasKit.SkRect} */
31 XYWHRect: function() {},
32 /** @return {CanvasKit.SkRRect} */
33 RRectXY: function() {},
34 /** @return {ImageData} */
35 ImageData: function() {},
Kevin Lubick543f3522019-03-08 10:04:28 -050036
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -050037 GetWebGLContext: function() {},
38 MakeBlurMaskFilter: function() {},
39 MakeCanvas: function() {},
40 MakeCanvasSurface: function() {},
41 MakeGrContext: function() {},
42 /** @return {CanvasKit.SkAnimatedImage} */
43 MakeAnimatedImageFromEncoded: function() {},
44 /** @return {CanvasKit.SkImage} */
45 MakeImage: function() {},
46 /** @return {CanvasKit.SkImage} */
47 MakeImageFromEncoded: function() {},
48 /** @return {LinearCanvasGradient} */
49 MakeLinearGradientShader: function() {},
50 MakeOnScreenGLSurface: function() {},
51 MakePathFromCmds: function() {},
52 MakePathFromOp: function() {},
53 MakePathFromSVGString: function() {},
54 MakeRadialGradientShader: function() {},
55 MakeRenderTarget: function() {},
56 MakeSkPicture: function() {},
57 MakeSWCanvasSurface: function() {},
58 MakeManagedAnimation: function() {},
59 MakeParticles: function() {},
60 MakeSkDashPathEffect: function() {},
61 MakeSkVertices: function() {},
62 MakeSurface: function() {},
63 /** @return {RadialCanvasGradient} */
64 MakeTwoPointConicalGradientShader: function() {},
65 MakeWebGLCanvasSurface: function() {},
66 /** @return {TypedArray} */
67 Malloc: function() {},
68 /** @return {TonalColors} */
69 computeTonalColors: function() {},
70 currentContext: function() {},
71 getColorComponents: function() {},
72 getDecodeCacheLimitBytes: function() {},
73 getDecodeCacheUsageBytes: function() {},
74 getSkDataBytes: function() {},
75 multiplyByAlpha: function() {},
76 parseColorString: function() {},
77 setCurrentContext: function() {},
78 setDecodeCacheLimitBytes: function() {},
Kevin Lubick217056c2018-09-20 17:39:31 -040079
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -050080 // private API (i.e. things declared in the bindings that we use
81 // in the pre-js file)
82 _MakeImage: function() {},
83 _MakeLinearGradientShader: function() {},
84 _MakePathFromCmds: function() {},
85 _MakeRadialGradientShader: function() {},
86 _MakeManagedAnimation: function() {},
87 _MakeParticles: function() {},
88 _MakeSkDashPathEffect: function() {},
89 _MakeSkPicture: function() {},
90 _MakeSkVertices: function() {},
91 _MakeTwoPointConicalGradientShader: function() {},
92 _decodeAnimatedImage: function() {},
93 _decodeImage: function() {},
94 _drawShapedText: function() {},
95 _getRasterDirectSurface: function() {},
96 _getRasterN32PremulSurface: function() {},
Kevin Lubick217056c2018-09-20 17:39:31 -040097
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -050098 // The testing object is meant to expose internal functions
99 // for more fine-grained testing, e.g. parseColor
100 _testing: {},
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500101
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500102 // Objects and properties on CanvasKit
Kevin Lubick217056c2018-09-20 17:39:31 -0400103
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500104 GrContext: {
105 // public API (from C++ bindings)
106 getResourceCacheLimitBytes: function() {},
107 getResourceCacheUsageBytes: function() {},
108 releaseResourcesAndAbandonContext: function() {},
109 setResourceCacheLimitBytes: function() {},
110 },
Kevin Lubickcd544662019-03-22 15:41:36 -0400111
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500112 Paragraph: {
113 // public API (from C++ bindings)
114 didExceedMaxLines: function() {},
115 getAlphabeticBaseline: function() {},
116 getGlyphPositionAtCoordinate: function() {},
117 getHeight: function() {},
118 getIdeographicBaseline: function() {},
119 getLongestLine: function() {},
120 getMaxIntrinsicWidth: function() {},
121 getMaxWidth: function() {},
122 getMinIntrinsicWidth: function() {},
123 getWordBoundary: function() {},
124 layout: function() {},
Kevin Lubick369f6a52019-10-03 11:22:08 -0400125
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500126 // private API
127 /** @return {Float32Array} */
128 _getRectsForRange: function() {},
129 },
Kevin Lubick369f6a52019-10-03 11:22:08 -0400130
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500131 SkRuntimeEffect: {
132 // public API (from C++ bindings)
133 Make: function() {},
Kevin Lubick4b5b6452019-12-06 13:55:58 -0500134
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500135 // private API
136 _makeShader: function() {},
137 _makeShaderWithChildren: function() {},
138 },
Kevin Lubick4b5b6452019-12-06 13:55:58 -0500139
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500140 ParagraphStyle: function() {},
141 RSXFormBuilder: function() {},
142 SkColorBuilder: function() {},
143 SkRectBuilder: function() {},
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400144
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500145 ShapedText: {
146 // public API (from C++ bindings)
147 getBounds: function() {},
148 },
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -0500149
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500150 SkAnimatedImage: {
151 // public API (from C++ bindings)
152 decodeNextFrame: function() {},
153 getFrameCount: function() {},
154 getRepetitionCount: function() {},
155 height: function() {},
156 reset: function() {},
157 width: function() {},
158 },
Kevin Lubick6b921b72019-09-18 16:18:17 -0400159
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500160 SkCanvas: {
161 // public API (from C++ bindings)
162 clear: function() {},
163 clipPath: function() {},
164 clipRRect: function() {},
165 clipRect: function() {},
166 concat: function() {},
167 drawAnimatedImage: function() {},
168 drawArc: function() {},
169 drawCircle: function() {},
170 drawColor: function() {},
171 drawDRRect: function() {},
172 drawImage: function() {},
173 drawImageNine: function() {},
174 drawImageRect: function() {},
175 drawLine: function() {},
176 drawOval: function() {},
177 drawPaint: function() {},
178 drawParagraph: function() {},
179 drawPath: function() {},
180 drawPicture: function() {},
181 drawRRect: function() {},
182 drawRect: function() {},
183 drawRoundRect: function() {},
184 drawShadow: function() {},
185 drawText: function() {},
186 drawTextBlob: function() {},
187 drawVertices: function() {},
188 flush: function() {},
189 getSaveCount: function() {},
190 getTotalMatrix: function() {},
191 makeSurface: function() {},
192 restore: function() {},
193 restoreToCount: function() {},
194 rotate: function() {},
195 save: function() {},
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500196 scale: function() {},
197 skew: function() {},
198 translate: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400199
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500200 // private API
201 _drawAtlas: function() {},
202 _drawPoints: function() {},
203 _drawSimpleText: function() {},
204 _readPixels: function() {},
Dan Fieldf2e97092020-03-16 08:38:07 -0700205 _saveLayer: function() {},
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500206 _writePixels: function() {},
207 delete: function() {},
208 },
Kevin Lubick006a6f32018-10-19 14:34:34 -0400209
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500210 SkColorFilter: {
211 // public API (from C++ bindings and JS interface)
212 MakeBlend: function() {},
213 MakeCompose: function() {},
214 MakeLerp: function() {},
215 MakeLinearToSRGBGamma: function() {},
216 MakeMatrix: function() {},
217 MakeSRGBToLinearGamma: function() {},
218 // private API (from C++ bindings)
219 _makeMatrix: function() {},
220 },
Kevin Lubickd3729342019-09-12 11:11:25 -0400221
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500222 SkColorMatrix: {
223 concat: function() {},
224 identity: function() {},
225 postTranslate: function() {},
226 rotated: function() {},
227 scaled: function() {},
228 },
Kevin Lubickd3729342019-09-12 11:11:25 -0400229
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500230 SkContourMeasureIter: {
231 next: function() {},
232 },
Kevin Lubicke59c1672019-11-20 14:17:53 -0500233
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500234 SkContourMeasure: {
235 getPosTan: function() {},
236 getSegment: function() {},
237 isClosed: function() {},
238 length: function() {},
239 },
Kevin Lubicke59c1672019-11-20 14:17:53 -0500240
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500241 SkFont: {
242 // public API (from C++ bindings)
243 getScaleX: function() {},
244 getSize: function() {},
245 getSkewX: function() {},
246 getTypeface: function() {},
247 measureText: function() {},
248 setHinting: function() {},
249 setLinearMetrics: function() {},
250 setScaleX: function() {},
251 setSize: function() {},
252 setSkewX: function() {},
253 setSubpixel: function() {},
254 setTypeface: function() {},
255 // private API (from C++ bindings)
256 _getWidths: function() {},
257 },
Kevin Lubick35ac0382019-01-02 15:13:57 -0500258
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500259 SkFontMgr: {
260 // public API (from C++ and JS bindings)
261 FromData: function() {},
262 RefDefault: function() {},
263 countFamilies: function() {},
264 getFamilyName: function() {},
Kevin Lubickddd0a332018-12-12 10:35:13 -0500265
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500266 // private API
267 _makeTypefaceFromData: function() {},
268 _fromData: function() {},
269 },
Kevin Lubickddd0a332018-12-12 10:35:13 -0500270
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500271 SkImage: {
272 // public API (from C++ bindings)
273 height: function() {},
274 width: function() {},
275 // private API
276 _encodeToData: function() {},
277 _encodeToDataWithFormat: function() {},
278 _makeShader: function() {},
279 },
Kevin Lubick006a6f32018-10-19 14:34:34 -0400280
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500281 SkImageFilter: {
282 MakeBlur: function() {},
283 MakeColorFilter: function() {},
284 MakeCompose: function() {},
285 MakeMatrixTransform: function() {},
286 },
Kevin Lubick15b40232019-10-29 09:55:39 -0400287
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500288 // These are defined in interface.js
289 SkM44: {
290 identity: function() {},
291 invert: function() {},
292 multiply: function() {},
293 rotatedUnitSinCos: function() {},
294 rotated: function() {},
295 scaled: function() {},
296 translated: function() {},
297 lookat: function() {},
298 perspective: function() {},
299 rc: function() {},
300 transpose: function() {},
301 },
Nathaniel Nifong77798b42020-02-21 17:15:22 -0500302
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500303 SkMatrix: {
304 identity: function() {},
305 invert: function() {},
306 mapPoints: function() {},
307 multiply: function() {},
308 rotated: function() {},
309 scaled: function() {},
310 skewed: function() {},
311 translated: function() {},
312 },
Kevin Lubickb9db3902018-11-26 11:47:54 -0500313
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500314 SkMaskFilter: {
315 MakeBlur: function() {},
316 },
Kevin Lubick15b40232019-10-29 09:55:39 -0400317
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500318 SkPaint: {
319 // public API (from C++ bindings)
320 /** @return {CanvasKit.SkPaint} */
321 copy: function() {},
322 getBlendMode: function() {},
323 getColor: function() {},
324 getFilterQuality: function() {},
325 getStrokeCap: function() {},
326 getStrokeJoin: function() {},
327 getStrokeMiter: function() {},
328 getStrokeWidth: function() {},
329 setAntiAlias: function() {},
330 setBlendMode: function() {},
331 setColor: function() {},
332 setFilterQuality: function() {},
333 setImageFilter: function() {},
334 setMaskFilter: function() {},
335 setPathEffect: function() {},
336 setShader: function() {},
337 setStrokeCap: function() {},
338 setStrokeJoin: function() {},
339 setStrokeMiter: function() {},
340 setStrokeWidth: function() {},
341 setStyle: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500342
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500343 // Private API
344 delete: function() {},
345 },
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500346
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500347 SkPathEffect: {
348 MakeDash: function() {},
349 },
Nathaniel Nifong23b0ed92020-03-04 15:43:50 -0500350
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500351 SkParticleEffect: {
352 // public API (from C++ bindings)
353 draw: function() {},
354 getEffectUniform: function() {},
355 getEffectUniformCount: function() {},
356 getEffectUniformFloatCount: function() {},
357 getEffectUniformName: function() {},
358 getParticleUniformCount: function() {},
359 getParticleUniformFloatCount: function() {},
360 getParticleUniformName: function() {},
361 getParticleUniform: function() {},
362 setPosition: function() {},
363 setRate: function() {},
364 start: function() {},
365 update: function() {},
Kevin Lubickf8f9cd82020-02-21 08:26:59 -0500366
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500367 // private API (from C++ bindings)
368 _effectUniformPtr: function() {},
369 _particleUniformPtr: function() {},
370 },
Kevin Lubickf8f9cd82020-02-21 08:26:59 -0500371
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500372 SkPath: {
373 // public API (from C++ bindings)
374 computeTightBounds: function() {},
375 contains: function() {},
376 /** @return {CanvasKit.SkPath} */
377 copy: function() {},
378 countPoints: function() {},
379 equals: function() {},
380 getBounds: function() {},
381 getFillType: function() {},
382 getPoint: function() {},
383 isEmpty: function() {},
384 isVolatile: function() {},
385 reset: function() {},
386 rewind: function() {},
387 setFillType: function() {},
388 setIsVolatile: function() {},
389 toSVGString: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400390
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500391 // private API
392 _addArc: function() {},
393 _addOval: function() {},
394 _addPath: function() {},
395 _addRect: function() {},
396 _addPoly: function() {},
397 _addRoundRect: function() {},
398 _arc: function() {},
399 _arcTo: function() {},
400 _close: function() {},
401 _conicTo: function() {},
402 _cubicTo: function() {},
403 _dash: function() {},
404 _lineTo: function() {},
405 _moveTo: function() {},
406 _op: function() {},
407 _quadTo: function() {},
408 _rArcTo: function() {},
409 _rConicTo: function() {},
410 _rCubicTo: function() {},
411 _rLineTo: function() {},
412 _rMoveTo: function() {},
413 _rQuadTo: function() {},
414 _rect: function() {},
415 _simplify: function() {},
416 _stroke: function() {},
417 _transform: function() {},
418 _trim: function() {},
419 delete: function() {},
420 dump: function() {},
421 dumpHex: function() {},
422 },
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400423
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500424 SkPathMeasure: {
425 getLength: function() {},
426 getSegment: function() {},
427 getPosTan: function() {},
428 isClosed: function() {},
429 nextContour: function() {},
430 },
Kevin Lubickcc13fd32019-04-05 13:00:01 -0400431
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500432 SkPicture: {
433 serialize: function() {},
434 },
Kevin Lubickcc13fd32019-04-05 13:00:01 -0400435
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500436 SkPictureRecorder: {
437 beginRecording: function() {},
438 finishRecordingAsPicture: function() {},
439 },
Kevin Lubick006a6f32018-10-19 14:34:34 -0400440
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500441 SkRect: {
442 fLeft: {},
443 fTop: {},
444 fRight: {},
445 fBottom: {},
446 },
Kevin Lubick2e5fe352019-09-03 12:59:06 -0400447
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500448 SkRRect: {
449 rect: {},
450 rx1: {},
451 ry1: {},
452 rx2: {},
453 ry2: {},
454 rx3: {},
455 ry3: {},
456 rx4: {},
457 ry4: {},
458 },
Kevin Lubick62836902019-12-09 09:04:26 -0500459
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500460 SkShader: {
461 Blend: function() {},
462 Color: function() {},
463 Empty: function() {},
464 Lerp: function() {},
Nathaniel Nifongd96c3c72020-03-09 10:50:43 -0400465 MakeLinearGradient: function() {},
466 MakeRadialGradient: function() {},
467 MakeTwoPointConicalGradient: function() {},
Kevin Lubick62836902019-12-09 09:04:26 -0500468
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500469 _Blend: function() {},
470 _Lerp: function() {},
471 },
Kevin Lubick006a6f32018-10-19 14:34:34 -0400472
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500473 SkSurface: {
474 // public API (from C++ bindings)
475 /** @return {CanvasKit.SkCanvas} */
476 getCanvas: function() {},
477 /** @return {CanvasKit.SkImage} */
478 makeImageSnapshot: function() {},
479 makeSurface: function() {},
480 grContext: {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400481
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500482 // private API
483 _flush: function() {},
484 _getRasterN32PremulSurface: function() {},
485 delete: function() {},
486 },
Kevin Lubickec4903d2019-01-14 08:36:08 -0500487
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500488 SkTextBlob: {
489 // public API (both C++ and JS bindings)
490 MakeFromRSXform: function() {},
491 MakeFromText: function() {},
492 MakeOnPath: function() {},
493 // private API (from C++ bindings)
494 _MakeFromRSXform: function() {},
495 _MakeFromText: function() {},
496 },
Nathaniel Nifong77798b42020-02-21 17:15:22 -0500497
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500498 // These are defined in interface.js
499 SkVector: {
500 add: function() {},
501 sub: function() {},
502 dot: function() {},
503 cross: function() {},
504 normalize: function() {},
505 mulScalar: function() {},
506 length: function() {},
507 lengthSquared: function() {},
508 dist: function() {},
509 },
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400510
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500511 SkVertices: {
512 // public API (from C++ bindings)
513 bounds: function() {},
514 mode: function() {},
515 uniqueID: function() {},
516 vertexCount: function() {},
517 },
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400518
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500519 _SkVerticesBuilder: {
520 colors: function() {},
521 detach: function() {},
522 indices: function() {},
523 positions: function() {},
524 texCoords: function() {},
525 },
Kevin Lubickd6ba7252019-06-03 14:38:05 -0400526
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500527 TextStyle: function() {},
Kevin Lubick369f6a52019-10-03 11:22:08 -0400528
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500529 // Constants and Enums
530 gpu: {},
531 skottie: {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400532
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500533 TRANSPARENT: {},
534 RED: {},
535 BLUE: {},
536 YELLOW: {},
537 CYAN: {},
538 BLACK: {},
539 WHITE: {},
Kevin Lubickea905ec2018-11-30 14:05:58 -0500540
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500541 MOVE_VERB: {},
542 LINE_VERB: {},
543 QUAD_VERB: {},
544 CONIC_VERB: {},
545 CUBIC_VERB: {},
546 CLOSE_VERB: {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500547
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500548 NoDecoration: {},
549 UnderlineDecoration: {},
550 OverlineDecoration: {},
551 LineThroughDecoration: {},
Kevin Lubick369f6a52019-10-03 11:22:08 -0400552
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500553 SaveLayerInitWithPrevious: {},
554 SaveLayerF16ColorType: {},
Kevin Lubick77d9b5c2019-10-29 10:48:26 -0400555
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500556 Affinity: {
557 Upstream: {},
558 Downstream: {},
559 },
Kevin Lubick369f6a52019-10-03 11:22:08 -0400560
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500561 AlphaType: {
562 Opaque: {},
563 Premul: {},
564 Unpremul: {},
565 },
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500566
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500567 BlendMode: {
568 Clear: {},
569 Src: {},
570 Dst: {},
571 SrcOver: {},
572 DstOver: {},
573 SrcIn: {},
574 DstIn: {},
575 SrcOut: {},
576 DstOut: {},
577 SrcATop: {},
578 DstATop: {},
579 Xor: {},
580 Plus: {},
581 Modulate: {},
582 Screen: {},
583 Overlay: {},
584 Darken: {},
585 Lighten: {},
586 ColorDodge: {},
587 ColorBurn: {},
588 HardLight: {},
589 SoftLight: {},
590 Difference: {},
591 Exclusion: {},
592 Multiply: {},
593 Hue: {},
594 Saturation: {},
595 Color: {},
596 Luminosity: {},
597 },
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500598
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500599 BlurStyle: {
600 Normal: {},
601 Solid: {},
602 Outer: {},
603 Inner: {},
604 },
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500605
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500606 ClipOp: {
607 Difference: {},
608 Intersect: {},
609 },
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500610
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500611 ColorType: {
612 Alpha_8: {},
613 RGB_565: {},
614 ARGB_4444: {},
615 RGBA_8888: {},
616 RGB_888x: {},
617 BGRA_8888: {},
618 RGBA_1010102: {},
619 RGB_101010x: {},
620 Gray_8: {},
621 RGBA_F16: {},
622 RGBA_F32: {},
623 },
Kevin Lubickea905ec2018-11-30 14:05:58 -0500624
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500625 FillType: {
626 Winding: {},
627 EvenOdd: {},
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500628 },
Kevin Lubick006a6f32018-10-19 14:34:34 -0400629
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500630 FilterQuality: {
631 None: {},
632 Low: {},
633 Medium: {},
634 High: {},
635 },
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500636
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500637 FontSlant: {
638 Upright: {},
639 Italic: {},
640 Oblique: {},
641 },
Kevin Lubickd3b1fe62019-10-21 10:50:26 -0400642
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500643 FontHinting: {
644 None: {},
645 Slight: {},
646 Normal: {},
647 Full: {},
648 },
Kevin Lubickbde9fcc2020-02-28 08:09:08 -0500649
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500650 FontWeight: {
651 Invisible: {},
652 Thin: {},
653 ExtraLight: {},
654 Light: {},
655 Normal: {},
656 Medium: {},
657 SemiBold: {},
658 Bold: {},
659 ExtraBold: {},
660 Black: {},
661 ExtraBlack: {},
662 },
Kevin Lubickd3b1fe62019-10-21 10:50:26 -0400663
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500664 FontWidth: {
665 UltraCondensed: {},
666 ExtraCondensed: {},
667 Condensed: {},
668 SemiCondensed: {},
669 Normal: {},
670 SemiExpanded: {},
671 Expanded: {},
672 ExtraExpanded: {},
673 UltraExpanded: {},
674 },
Kevin Lubickd3b1fe62019-10-21 10:50:26 -0400675
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500676 ImageFormat: {
677 PNG: {},
678 JPEG: {},
679 },
Alexander Khovansky3e119332018-11-15 02:01:19 +0300680
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500681 PaintStyle: {
682 Fill: {},
683 Stroke: {},
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500684 },
Kevin Lubickb9db3902018-11-26 11:47:54 -0500685
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500686 PathOp: {
687 Difference: {},
688 Intersect: {},
689 Union: {},
690 XOR: {},
691 ReverseDifference: {},
692 },
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500693
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500694 PointMode: {
695 Points: {},
696 Lines: {},
697 Polygon: {},
698 },
Kevin Lubick37ab53e2019-11-11 10:06:08 -0500699
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500700 RectHeightStyle: {
701 Tight: {},
702 Max: {},
703 IncludeLineSpacingMiddle: {},
704 IncludeLineSpacingTop: {},
705 IncludeLineSpacingBottom: {},
706 },
Kevin Lubick369f6a52019-10-03 11:22:08 -0400707
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500708 RectWidthStyle: {
709 Tight: {},
710 Max: {},
711 },
Kevin Lubick369f6a52019-10-03 11:22:08 -0400712
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500713 StrokeCap: {
714 Butt: {},
715 Round: {},
716 Square: {},
717 },
Kevin Lubickb9db3902018-11-26 11:47:54 -0500718
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500719 StrokeJoin: {
720 Miter: {},
721 Round: {},
722 Bevel: {},
723 },
Kevin Lubickb9db3902018-11-26 11:47:54 -0500724
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500725 TextAlign: {
726 Left: {},
727 Right: {},
728 Center: {},
729 Justify: {},
730 Start: {},
731 End: {},
732 },
Kevin Lubick369f6a52019-10-03 11:22:08 -0400733
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500734 TextDirection: {
735 LTR: {},
736 RTL: {},
737 },
Kevin Lubickd3b1fe62019-10-21 10:50:26 -0400738
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500739 TileMode: {
740 Clamp: {},
741 Repeat: {},
742 Mirror: {},
743 Decal: {},
744 },
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500745
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500746 VertexMode: {
747 Triangles: {},
748 TrianglesStrip: {},
749 TriangleFan: {},
750 },
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500751
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500752 // Things Enscriptem adds for us
Kevin Lubick006a6f32018-10-19 14:34:34 -0400753
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500754 /**
755 * @type {Float32Array}
756 */
757 HEAPF32: {},
758 /**
759 * @type {Float64Array}
760 */
761 HEAPF64: {},
762 /**
763 * @type {Uint8Array}
764 */
765 HEAPU8: {},
766 /**
767 * @type {Uint16Array}
768 */
769 HEAPU16: {},
770 /**
771 * @type {Uint32Array}
772 */
773 HEAPU32: {},
774 /**
775 * @type {Int8Array}
776 */
777 HEAP8: {},
778 /**
779 * @type {Int16Array}
780 */
781 HEAP16: {},
782 /**
783 * @type {Int32Array}
784 */
785 HEAP32: {},
Kevin Lubickfa5a1382019-10-09 10:46:14 -0400786
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500787 _malloc: function() {},
788 _free: function() {},
789 onRuntimeInitialized: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400790};
Kevin Lubick217056c2018-09-20 17:39:31 -0400791
Kevin Lubick006a6f32018-10-19 14:34:34 -0400792// Public API things that are newly declared in the JS should go here.
793// It's not enough to declare them above, because closure can still erase them
794// unless they go on the prototype.
Kevin Lubick369f6a52019-10-03 11:22:08 -0400795CanvasKit.Paragraph.prototype.getRectsForRange = function() {};
796
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500797CanvasKit.SkPath.prototype.addArc = function() {};
Kevin Lubicke384df42019-08-26 15:48:09 -0400798CanvasKit.SkPath.prototype.addOval = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400799CanvasKit.SkPath.prototype.addPath = function() {};
Kevin Lubick37ab53e2019-11-11 10:06:08 -0500800CanvasKit.SkPath.prototype.addPoly = function() {};
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500801CanvasKit.SkPath.prototype.addRect = function() {};
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500802CanvasKit.SkPath.prototype.addRoundRect = function() {};
Alexander Khovansky3e119332018-11-15 02:01:19 +0300803CanvasKit.SkPath.prototype.arc = function() {};
Kevin Lubick006a6f32018-10-19 14:34:34 -0400804CanvasKit.SkPath.prototype.arcTo = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400805CanvasKit.SkPath.prototype.close = function() {};
Kevin Lubick006a6f32018-10-19 14:34:34 -0400806CanvasKit.SkPath.prototype.conicTo = function() {};
807CanvasKit.SkPath.prototype.cubicTo = function() {};
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400808CanvasKit.SkPath.prototype.dash = function() {};
Kevin Lubick006a6f32018-10-19 14:34:34 -0400809CanvasKit.SkPath.prototype.lineTo = function() {};
810CanvasKit.SkPath.prototype.moveTo = function() {};
Kevin Lubicke384df42019-08-26 15:48:09 -0400811CanvasKit.SkPath.prototype.offset = function() {};
Kevin Lubick006a6f32018-10-19 14:34:34 -0400812CanvasKit.SkPath.prototype.op = function() {};
813CanvasKit.SkPath.prototype.quadTo = function() {};
Kevin Lubick79b71342019-11-01 14:36:52 -0400814CanvasKit.SkPath.prototype.rArcTo = function() {};
815CanvasKit.SkPath.prototype.rConicTo = function() {};
816CanvasKit.SkPath.prototype.rCubicTo = function() {};
817CanvasKit.SkPath.prototype.rLineTo = function() {};
818CanvasKit.SkPath.prototype.rMoveTo = function() {};
819CanvasKit.SkPath.prototype.rQuadTo = function() {};
Kevin Lubick006a6f32018-10-19 14:34:34 -0400820CanvasKit.SkPath.prototype.rect = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400821CanvasKit.SkPath.prototype.simplify = function() {};
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400822CanvasKit.SkPath.prototype.stroke = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400823CanvasKit.SkPath.prototype.transform = function() {};
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400824CanvasKit.SkPath.prototype.trim = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400825
Kevin Lubicka4f218d2020-01-14 08:39:09 -0500826CanvasKit.SkPicture.prototype.saveAsFile = function() {};
Kevin Lubickcc13fd32019-04-05 13:00:01 -0400827
Kevin Lubick5b90b842018-10-17 07:57:18 -0400828CanvasKit.SkSurface.prototype.dispose = function() {};
Kevin Lubick359a7e32019-03-19 09:34:37 -0400829CanvasKit.SkSurface.prototype.flush = function() {};
830CanvasKit.SkSurface.prototype.requestAnimationFrame = function() {};
Bryce Thomas2c5b8562020-01-22 13:49:41 -0800831CanvasKit.SkSurface.prototype.drawOnce = function() {};
Kevin Lubickcc13fd32019-04-05 13:00:01 -0400832CanvasKit.SkSurface.prototype.captureFrameAsSkPicture = function() {};
Kevin Lubick53965c92018-10-11 08:51:55 -0400833
Alexander Khovansky3e119332018-11-15 02:01:19 +0300834CanvasKit.SkImage.prototype.encodeToData = function() {};
Kevin Lubicka064c282019-04-04 09:28:53 -0400835CanvasKit.SkImage.prototype.makeShader = function() {};
Alexander Khovansky3e119332018-11-15 02:01:19 +0300836
Kevin Lubickee91c072019-03-29 10:39:52 -0400837CanvasKit.SkCanvas.prototype.drawAtlas = function() {};
Kevin Lubick37ab53e2019-11-11 10:06:08 -0500838CanvasKit.SkCanvas.prototype.drawPoints = function() {};
Kevin Lubickec4903d2019-01-14 08:36:08 -0500839CanvasKit.SkCanvas.prototype.drawText = function() {};
Dan Fieldf2e97092020-03-16 08:38:07 -0700840CanvasKit.SkCanvas.prototype.saveLayer = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500841/** @return {Uint8Array} */
842CanvasKit.SkCanvas.prototype.readPixels = function() {};
843CanvasKit.SkCanvas.prototype.writePixels = function() {};
844
Kevin Lubickddd0a332018-12-12 10:35:13 -0500845CanvasKit.SkFontMgr.prototype.MakeTypefaceFromData = function() {};
846
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400847CanvasKit.SkFont.prototype.getWidths = function() {};
848
849CanvasKit.RSXFormBuilder.prototype.build = function() {};
850CanvasKit.RSXFormBuilder.prototype.delete = function() {};
851CanvasKit.RSXFormBuilder.prototype.push = function() {};
Kevin Lubickee91c072019-03-29 10:39:52 -0400852CanvasKit.RSXFormBuilder.prototype.set = function() {};
853
854CanvasKit.SkColorBuilder.prototype.build = function() {};
855CanvasKit.SkColorBuilder.prototype.delete = function() {};
856CanvasKit.SkColorBuilder.prototype.push = function() {};
857CanvasKit.SkColorBuilder.prototype.set = function() {};
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400858
Kevin Lubickf3d6c362020-01-06 08:11:52 -0500859CanvasKit.SkRuntimeEffect.prototype.makeShader = function() {};
Kevin Lubickecd87622020-02-22 07:37:33 -0500860CanvasKit.SkRuntimeEffect.prototype.makeShaderWithChildren = function() {};
Kevin Lubick4b5b6452019-12-06 13:55:58 -0500861
Kevin Lubickf8f9cd82020-02-21 08:26:59 -0500862CanvasKit.SkParticleEffect.prototype.effectUniforms = function() {};
863CanvasKit.SkParticleEffect.prototype.particleUniforms = function() {};
864
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400865// Define StrokeOpts object
866var StrokeOpts = {};
867StrokeOpts.prototype.width;
868StrokeOpts.prototype.miter_limit;
869StrokeOpts.prototype.cap;
870StrokeOpts.prototype.join;
Kevin Lubick1646e7d2018-12-07 13:03:08 -0500871StrokeOpts.prototype.precision;
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400872
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500873// Define everything created in the canvas2d spec here
Kevin Lubickb9db3902018-11-26 11:47:54 -0500874var HTMLCanvas = {};
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500875HTMLCanvas.prototype.decodeImage = function() {};
876HTMLCanvas.prototype.dispose = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500877HTMLCanvas.prototype.getContext = function() {};
Kevin Lubick8e4a3312018-12-14 15:03:41 -0500878HTMLCanvas.prototype.loadFont = function() {};
Kevin Lubicka40f8322018-12-17 16:01:36 -0500879HTMLCanvas.prototype.makePath2D = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500880HTMLCanvas.prototype.toDataURL = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500881
882var CanvasRenderingContext2D = {};
883CanvasRenderingContext2D.prototype.addHitRegion = function() {};
884CanvasRenderingContext2D.prototype.arc = function() {};
885CanvasRenderingContext2D.prototype.arcTo = function() {};
886CanvasRenderingContext2D.prototype.beginPath = function() {};
887CanvasRenderingContext2D.prototype.bezierCurveTo = function() {};
888CanvasRenderingContext2D.prototype.clearHitRegions = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500889CanvasRenderingContext2D.prototype.clearRect = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500890CanvasRenderingContext2D.prototype.clip = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500891CanvasRenderingContext2D.prototype.closePath = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500892CanvasRenderingContext2D.prototype.createImageData = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500893CanvasRenderingContext2D.prototype.createLinearGradient = function() {};
Kevin Lubickd29edd72018-12-07 08:29:52 -0500894CanvasRenderingContext2D.prototype.createPattern = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500895CanvasRenderingContext2D.prototype.createRadialGradient = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500896CanvasRenderingContext2D.prototype.drawFocusIfNeeded = function() {};
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500897CanvasRenderingContext2D.prototype.drawImage = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500898CanvasRenderingContext2D.prototype.ellipse = function() {};
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500899CanvasRenderingContext2D.prototype.fill = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500900CanvasRenderingContext2D.prototype.fillRect = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500901CanvasRenderingContext2D.prototype.fillText = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500902CanvasRenderingContext2D.prototype.getImageData = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500903CanvasRenderingContext2D.prototype.getLineDash = function() {};
Kevin Lubick1646e7d2018-12-07 13:03:08 -0500904CanvasRenderingContext2D.prototype.isPointInPath = function() {};
905CanvasRenderingContext2D.prototype.isPointInStroke = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500906CanvasRenderingContext2D.prototype.lineTo = function() {};
907CanvasRenderingContext2D.prototype.measureText = function() {};
908CanvasRenderingContext2D.prototype.moveTo = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500909CanvasRenderingContext2D.prototype.putImageData = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500910CanvasRenderingContext2D.prototype.quadraticCurveTo = function() {};
911CanvasRenderingContext2D.prototype.rect = function() {};
912CanvasRenderingContext2D.prototype.removeHitRegion = function() {};
913CanvasRenderingContext2D.prototype.resetTransform = function() {};
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500914CanvasRenderingContext2D.prototype.restore = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500915CanvasRenderingContext2D.prototype.rotate = function() {};
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500916CanvasRenderingContext2D.prototype.save = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500917CanvasRenderingContext2D.prototype.scale = function() {};
918CanvasRenderingContext2D.prototype.scrollPathIntoView = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500919CanvasRenderingContext2D.prototype.setLineDash = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500920CanvasRenderingContext2D.prototype.setTransform = function() {};
921CanvasRenderingContext2D.prototype.stroke = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500922CanvasRenderingContext2D.prototype.strokeRect = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500923CanvasRenderingContext2D.prototype.strokeText = function() {};
924CanvasRenderingContext2D.prototype.transform = function() {};
925CanvasRenderingContext2D.prototype.translate = function() {};
926
Kevin Lubicka40f8322018-12-17 16:01:36 -0500927var Path2D = {};
928Path2D.prototype.addPath = function() {};
929Path2D.prototype.arc = function() {};
930Path2D.prototype.arcTo = function() {};
931Path2D.prototype.bezierCurveTo = function() {};
932Path2D.prototype.closePath = function() {};
933Path2D.prototype.ellipse = function() {};
934Path2D.prototype.lineTo = function() {};
935Path2D.prototype.moveTo = function() {};
936Path2D.prototype.quadraticCurveTo = function() {};
937Path2D.prototype.rect = function() {};
938
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500939var LinearCanvasGradient = {};
940LinearCanvasGradient.prototype.addColorStop = function() {};
941var RadialCanvasGradient = {};
942RadialCanvasGradient.prototype.addColorStop = function() {};
Kevin Lubickd29edd72018-12-07 08:29:52 -0500943var CanvasPattern = {};
944CanvasPattern.prototype.setTransform = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500945
Kevin Lubick52b9f372018-12-04 13:57:36 -0500946var ImageData = {
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500947 /**
948 * @type {Uint8ClampedArray}
949 */
950 data: {},
951 height: {},
952 width: {},
Kevin Lubick52b9f372018-12-04 13:57:36 -0500953};
954
Kevin Lubickd29edd72018-12-07 08:29:52 -0500955var DOMMatrix = {
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500956 a: {},
957 b: {},
958 c: {},
959 d: {},
960 e: {},
961 f: {},
Kevin Lubickd29edd72018-12-07 08:29:52 -0500962};
963
Kevin Lubick217056c2018-09-20 17:39:31 -0400964// Not sure why this is needed - might be a bug in emsdk that this isn't properly declared.
Kevin Lubick6fccc9d2018-11-20 15:55:10 -0500965function loadWebAssemblyModule() {};