blob: 1beb2e8e87a96ad8a712f3090a0eb20633a913cb [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() {},
196 saveLayer: function() {},
197 scale: function() {},
198 skew: function() {},
199 translate: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400200
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500201 // private API
202 _drawAtlas: function() {},
203 _drawPoints: function() {},
204 _drawSimpleText: function() {},
205 _readPixels: function() {},
206 _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: {},
628 InverseWinding: {},
629 InverseEvenOdd: {},
630 },
Kevin Lubick006a6f32018-10-19 14:34:34 -0400631
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500632 FilterQuality: {
633 None: {},
634 Low: {},
635 Medium: {},
636 High: {},
637 },
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500638
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500639 FontSlant: {
640 Upright: {},
641 Italic: {},
642 Oblique: {},
643 },
Kevin Lubickd3b1fe62019-10-21 10:50:26 -0400644
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500645 FontHinting: {
646 None: {},
647 Slight: {},
648 Normal: {},
649 Full: {},
650 },
Kevin Lubickbde9fcc2020-02-28 08:09:08 -0500651
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500652 FontWeight: {
653 Invisible: {},
654 Thin: {},
655 ExtraLight: {},
656 Light: {},
657 Normal: {},
658 Medium: {},
659 SemiBold: {},
660 Bold: {},
661 ExtraBold: {},
662 Black: {},
663 ExtraBlack: {},
664 },
Kevin Lubickd3b1fe62019-10-21 10:50:26 -0400665
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500666 FontWidth: {
667 UltraCondensed: {},
668 ExtraCondensed: {},
669 Condensed: {},
670 SemiCondensed: {},
671 Normal: {},
672 SemiExpanded: {},
673 Expanded: {},
674 ExtraExpanded: {},
675 UltraExpanded: {},
676 },
Kevin Lubickd3b1fe62019-10-21 10:50:26 -0400677
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500678 ImageFormat: {
679 PNG: {},
680 JPEG: {},
681 },
Alexander Khovansky3e119332018-11-15 02:01:19 +0300682
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500683 PaintStyle: {
684 Fill: {},
685 Stroke: {},
686 StrokeAndFill: {},
687 },
Kevin Lubickb9db3902018-11-26 11:47:54 -0500688
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500689 PathOp: {
690 Difference: {},
691 Intersect: {},
692 Union: {},
693 XOR: {},
694 ReverseDifference: {},
695 },
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500696
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500697 PointMode: {
698 Points: {},
699 Lines: {},
700 Polygon: {},
701 },
Kevin Lubick37ab53e2019-11-11 10:06:08 -0500702
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500703 RectHeightStyle: {
704 Tight: {},
705 Max: {},
706 IncludeLineSpacingMiddle: {},
707 IncludeLineSpacingTop: {},
708 IncludeLineSpacingBottom: {},
709 },
Kevin Lubick369f6a52019-10-03 11:22:08 -0400710
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500711 RectWidthStyle: {
712 Tight: {},
713 Max: {},
714 },
Kevin Lubick369f6a52019-10-03 11:22:08 -0400715
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500716 StrokeCap: {
717 Butt: {},
718 Round: {},
719 Square: {},
720 },
Kevin Lubickb9db3902018-11-26 11:47:54 -0500721
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500722 StrokeJoin: {
723 Miter: {},
724 Round: {},
725 Bevel: {},
726 },
Kevin Lubickb9db3902018-11-26 11:47:54 -0500727
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500728 TextAlign: {
729 Left: {},
730 Right: {},
731 Center: {},
732 Justify: {},
733 Start: {},
734 End: {},
735 },
Kevin Lubick369f6a52019-10-03 11:22:08 -0400736
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500737 TextDirection: {
738 LTR: {},
739 RTL: {},
740 },
Kevin Lubickd3b1fe62019-10-21 10:50:26 -0400741
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500742 TextEncoding: {
743 UTF8: {},
744 UTF16: {},
745 UTF32: {},
746 GlyphID: {},
747 },
Kevin Lubickec4903d2019-01-14 08:36:08 -0500748
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500749 TileMode: {
750 Clamp: {},
751 Repeat: {},
752 Mirror: {},
753 Decal: {},
754 },
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500755
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500756 VertexMode: {
757 Triangles: {},
758 TrianglesStrip: {},
759 TriangleFan: {},
760 },
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500761
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500762 // Things Enscriptem adds for us
Kevin Lubick006a6f32018-10-19 14:34:34 -0400763
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500764 /**
765 * @type {Float32Array}
766 */
767 HEAPF32: {},
768 /**
769 * @type {Float64Array}
770 */
771 HEAPF64: {},
772 /**
773 * @type {Uint8Array}
774 */
775 HEAPU8: {},
776 /**
777 * @type {Uint16Array}
778 */
779 HEAPU16: {},
780 /**
781 * @type {Uint32Array}
782 */
783 HEAPU32: {},
784 /**
785 * @type {Int8Array}
786 */
787 HEAP8: {},
788 /**
789 * @type {Int16Array}
790 */
791 HEAP16: {},
792 /**
793 * @type {Int32Array}
794 */
795 HEAP32: {},
Kevin Lubickfa5a1382019-10-09 10:46:14 -0400796
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500797 _malloc: function() {},
798 _free: function() {},
799 onRuntimeInitialized: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400800};
Kevin Lubick217056c2018-09-20 17:39:31 -0400801
Kevin Lubick006a6f32018-10-19 14:34:34 -0400802// Public API things that are newly declared in the JS should go here.
803// It's not enough to declare them above, because closure can still erase them
804// unless they go on the prototype.
Kevin Lubick369f6a52019-10-03 11:22:08 -0400805CanvasKit.Paragraph.prototype.getRectsForRange = function() {};
806
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500807CanvasKit.SkPath.prototype.addArc = function() {};
Kevin Lubicke384df42019-08-26 15:48:09 -0400808CanvasKit.SkPath.prototype.addOval = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400809CanvasKit.SkPath.prototype.addPath = function() {};
Kevin Lubick37ab53e2019-11-11 10:06:08 -0500810CanvasKit.SkPath.prototype.addPoly = function() {};
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500811CanvasKit.SkPath.prototype.addRect = function() {};
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500812CanvasKit.SkPath.prototype.addRoundRect = function() {};
Alexander Khovansky3e119332018-11-15 02:01:19 +0300813CanvasKit.SkPath.prototype.arc = function() {};
Kevin Lubick006a6f32018-10-19 14:34:34 -0400814CanvasKit.SkPath.prototype.arcTo = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400815CanvasKit.SkPath.prototype.close = function() {};
Kevin Lubick006a6f32018-10-19 14:34:34 -0400816CanvasKit.SkPath.prototype.conicTo = function() {};
817CanvasKit.SkPath.prototype.cubicTo = function() {};
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400818CanvasKit.SkPath.prototype.dash = function() {};
Kevin Lubick006a6f32018-10-19 14:34:34 -0400819CanvasKit.SkPath.prototype.lineTo = function() {};
820CanvasKit.SkPath.prototype.moveTo = function() {};
Kevin Lubicke384df42019-08-26 15:48:09 -0400821CanvasKit.SkPath.prototype.offset = function() {};
Kevin Lubick006a6f32018-10-19 14:34:34 -0400822CanvasKit.SkPath.prototype.op = function() {};
823CanvasKit.SkPath.prototype.quadTo = function() {};
Kevin Lubick79b71342019-11-01 14:36:52 -0400824CanvasKit.SkPath.prototype.rArcTo = function() {};
825CanvasKit.SkPath.prototype.rConicTo = function() {};
826CanvasKit.SkPath.prototype.rCubicTo = function() {};
827CanvasKit.SkPath.prototype.rLineTo = function() {};
828CanvasKit.SkPath.prototype.rMoveTo = function() {};
829CanvasKit.SkPath.prototype.rQuadTo = function() {};
Kevin Lubick006a6f32018-10-19 14:34:34 -0400830CanvasKit.SkPath.prototype.rect = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400831CanvasKit.SkPath.prototype.simplify = function() {};
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400832CanvasKit.SkPath.prototype.stroke = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400833CanvasKit.SkPath.prototype.transform = function() {};
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400834CanvasKit.SkPath.prototype.trim = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400835
Kevin Lubicka4f218d2020-01-14 08:39:09 -0500836CanvasKit.SkPicture.prototype.saveAsFile = function() {};
Kevin Lubickcc13fd32019-04-05 13:00:01 -0400837
Kevin Lubick5b90b842018-10-17 07:57:18 -0400838CanvasKit.SkSurface.prototype.dispose = function() {};
Kevin Lubick359a7e32019-03-19 09:34:37 -0400839CanvasKit.SkSurface.prototype.flush = function() {};
840CanvasKit.SkSurface.prototype.requestAnimationFrame = function() {};
Bryce Thomas2c5b8562020-01-22 13:49:41 -0800841CanvasKit.SkSurface.prototype.drawOnce = function() {};
Kevin Lubickcc13fd32019-04-05 13:00:01 -0400842CanvasKit.SkSurface.prototype.captureFrameAsSkPicture = function() {};
Kevin Lubick53965c92018-10-11 08:51:55 -0400843
Alexander Khovansky3e119332018-11-15 02:01:19 +0300844CanvasKit.SkImage.prototype.encodeToData = function() {};
Kevin Lubicka064c282019-04-04 09:28:53 -0400845CanvasKit.SkImage.prototype.makeShader = function() {};
Alexander Khovansky3e119332018-11-15 02:01:19 +0300846
Kevin Lubickee91c072019-03-29 10:39:52 -0400847CanvasKit.SkCanvas.prototype.drawAtlas = function() {};
Kevin Lubick37ab53e2019-11-11 10:06:08 -0500848CanvasKit.SkCanvas.prototype.drawPoints = function() {};
Kevin Lubickec4903d2019-01-14 08:36:08 -0500849CanvasKit.SkCanvas.prototype.drawText = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500850/** @return {Uint8Array} */
851CanvasKit.SkCanvas.prototype.readPixels = function() {};
852CanvasKit.SkCanvas.prototype.writePixels = function() {};
853
Kevin Lubickddd0a332018-12-12 10:35:13 -0500854CanvasKit.SkFontMgr.prototype.MakeTypefaceFromData = function() {};
855
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400856CanvasKit.SkFont.prototype.getWidths = function() {};
857
858CanvasKit.RSXFormBuilder.prototype.build = function() {};
859CanvasKit.RSXFormBuilder.prototype.delete = function() {};
860CanvasKit.RSXFormBuilder.prototype.push = function() {};
Kevin Lubickee91c072019-03-29 10:39:52 -0400861CanvasKit.RSXFormBuilder.prototype.set = function() {};
862
863CanvasKit.SkColorBuilder.prototype.build = function() {};
864CanvasKit.SkColorBuilder.prototype.delete = function() {};
865CanvasKit.SkColorBuilder.prototype.push = function() {};
866CanvasKit.SkColorBuilder.prototype.set = function() {};
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400867
Kevin Lubickf3d6c362020-01-06 08:11:52 -0500868CanvasKit.SkRuntimeEffect.prototype.makeShader = function() {};
Kevin Lubickecd87622020-02-22 07:37:33 -0500869CanvasKit.SkRuntimeEffect.prototype.makeShaderWithChildren = function() {};
Kevin Lubick4b5b6452019-12-06 13:55:58 -0500870
Kevin Lubickf8f9cd82020-02-21 08:26:59 -0500871CanvasKit.SkParticleEffect.prototype.effectUniforms = function() {};
872CanvasKit.SkParticleEffect.prototype.particleUniforms = function() {};
873
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400874// Define StrokeOpts object
875var StrokeOpts = {};
876StrokeOpts.prototype.width;
877StrokeOpts.prototype.miter_limit;
878StrokeOpts.prototype.cap;
879StrokeOpts.prototype.join;
Kevin Lubick1646e7d2018-12-07 13:03:08 -0500880StrokeOpts.prototype.precision;
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400881
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500882// Define everything created in the canvas2d spec here
Kevin Lubickb9db3902018-11-26 11:47:54 -0500883var HTMLCanvas = {};
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500884HTMLCanvas.prototype.decodeImage = function() {};
885HTMLCanvas.prototype.dispose = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500886HTMLCanvas.prototype.getContext = function() {};
Kevin Lubick8e4a3312018-12-14 15:03:41 -0500887HTMLCanvas.prototype.loadFont = function() {};
Kevin Lubicka40f8322018-12-17 16:01:36 -0500888HTMLCanvas.prototype.makePath2D = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500889HTMLCanvas.prototype.toDataURL = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500890
891var CanvasRenderingContext2D = {};
892CanvasRenderingContext2D.prototype.addHitRegion = function() {};
893CanvasRenderingContext2D.prototype.arc = function() {};
894CanvasRenderingContext2D.prototype.arcTo = function() {};
895CanvasRenderingContext2D.prototype.beginPath = function() {};
896CanvasRenderingContext2D.prototype.bezierCurveTo = function() {};
897CanvasRenderingContext2D.prototype.clearHitRegions = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500898CanvasRenderingContext2D.prototype.clearRect = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500899CanvasRenderingContext2D.prototype.clip = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500900CanvasRenderingContext2D.prototype.closePath = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500901CanvasRenderingContext2D.prototype.createImageData = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500902CanvasRenderingContext2D.prototype.createLinearGradient = function() {};
Kevin Lubickd29edd72018-12-07 08:29:52 -0500903CanvasRenderingContext2D.prototype.createPattern = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500904CanvasRenderingContext2D.prototype.createRadialGradient = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500905CanvasRenderingContext2D.prototype.drawFocusIfNeeded = function() {};
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500906CanvasRenderingContext2D.prototype.drawImage = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500907CanvasRenderingContext2D.prototype.ellipse = function() {};
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500908CanvasRenderingContext2D.prototype.fill = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500909CanvasRenderingContext2D.prototype.fillRect = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500910CanvasRenderingContext2D.prototype.fillText = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500911CanvasRenderingContext2D.prototype.getImageData = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500912CanvasRenderingContext2D.prototype.getLineDash = function() {};
Kevin Lubick1646e7d2018-12-07 13:03:08 -0500913CanvasRenderingContext2D.prototype.isPointInPath = function() {};
914CanvasRenderingContext2D.prototype.isPointInStroke = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500915CanvasRenderingContext2D.prototype.lineTo = function() {};
916CanvasRenderingContext2D.prototype.measureText = function() {};
917CanvasRenderingContext2D.prototype.moveTo = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500918CanvasRenderingContext2D.prototype.putImageData = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500919CanvasRenderingContext2D.prototype.quadraticCurveTo = function() {};
920CanvasRenderingContext2D.prototype.rect = function() {};
921CanvasRenderingContext2D.prototype.removeHitRegion = function() {};
922CanvasRenderingContext2D.prototype.resetTransform = function() {};
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500923CanvasRenderingContext2D.prototype.restore = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500924CanvasRenderingContext2D.prototype.rotate = function() {};
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500925CanvasRenderingContext2D.prototype.save = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500926CanvasRenderingContext2D.prototype.scale = function() {};
927CanvasRenderingContext2D.prototype.scrollPathIntoView = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500928CanvasRenderingContext2D.prototype.setLineDash = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500929CanvasRenderingContext2D.prototype.setTransform = function() {};
930CanvasRenderingContext2D.prototype.stroke = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500931CanvasRenderingContext2D.prototype.strokeRect = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500932CanvasRenderingContext2D.prototype.strokeText = function() {};
933CanvasRenderingContext2D.prototype.transform = function() {};
934CanvasRenderingContext2D.prototype.translate = function() {};
935
Kevin Lubicka40f8322018-12-17 16:01:36 -0500936var Path2D = {};
937Path2D.prototype.addPath = function() {};
938Path2D.prototype.arc = function() {};
939Path2D.prototype.arcTo = function() {};
940Path2D.prototype.bezierCurveTo = function() {};
941Path2D.prototype.closePath = function() {};
942Path2D.prototype.ellipse = function() {};
943Path2D.prototype.lineTo = function() {};
944Path2D.prototype.moveTo = function() {};
945Path2D.prototype.quadraticCurveTo = function() {};
946Path2D.prototype.rect = function() {};
947
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500948var LinearCanvasGradient = {};
949LinearCanvasGradient.prototype.addColorStop = function() {};
950var RadialCanvasGradient = {};
951RadialCanvasGradient.prototype.addColorStop = function() {};
Kevin Lubickd29edd72018-12-07 08:29:52 -0500952var CanvasPattern = {};
953CanvasPattern.prototype.setTransform = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500954
Kevin Lubick52b9f372018-12-04 13:57:36 -0500955var ImageData = {
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500956 /**
957 * @type {Uint8ClampedArray}
958 */
959 data: {},
960 height: {},
961 width: {},
Kevin Lubick52b9f372018-12-04 13:57:36 -0500962};
963
Kevin Lubickd29edd72018-12-07 08:29:52 -0500964var DOMMatrix = {
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500965 a: {},
966 b: {},
967 c: {},
968 d: {},
969 e: {},
970 f: {},
Kevin Lubickd29edd72018-12-07 08:29:52 -0500971};
972
Kevin Lubick217056c2018-09-20 17:39:31 -0400973// 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 -0500974function loadWebAssemblyModule() {};