blob: f17ab6981ee585d478e0e59cab0aa85f74cd0514 [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 = {
26 // public API (i.e. things we declare in the pre-js file)
Kevin Lubick006a6f32018-10-19 14:34:34 -040027 Color: function() {},
28 /** @return {CanvasKit.SkRect} */
29 LTRBRect: function() {},
Kevin Lubick0a1293c2018-12-03 12:31:04 -050030 /** @return {CanvasKit.SkRect} */
31 XYWHRect: function() {},
Kevin Lubick52b9f372018-12-04 13:57:36 -050032 /** @return {ImageData} */
33 ImageData: function() {},
Kevin Lubick543f3522019-03-08 10:04:28 -050034
35 GetWebGLContext: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -050036 MakeBlurMaskFilter: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -040037 MakeCanvas: function() {},
38 MakeCanvasSurface: function() {},
Kevin Lubick543f3522019-03-08 10:04:28 -050039 MakeGrContext: function() {},
Kevin Lubick0a1293c2018-12-03 12:31:04 -050040 /** @return {CanvasKit.SkImage} */
41 MakeImageFromEncoded: function() {},
Kevin Lubickeb2f6b02018-11-29 15:07:02 -050042 /** @return {LinearCanvasGradient} */
Kevin Lubickb5ae3b52018-11-03 07:51:19 -040043 MakeLinearGradientShader: function() {},
Kevin Lubick543f3522019-03-08 10:04:28 -050044 MakeOnScreenGLSurface: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -050045 MakePathFromCmds: function() {},
Kevin Lubicka40f8322018-12-17 16:01:36 -050046 MakePathFromOp: function() {},
47 MakePathFromSVGString: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -050048 MakeRadialGradientShader: function() {},
Kevin Lubick543f3522019-03-08 10:04:28 -050049 MakeRenderTarget: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -050050 MakeSWCanvasSurface: function() {},
Kevin Lubickf5ea37f2019-02-28 10:06:18 -050051 MakeManagedAnimation: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -040052 MakeSkDashPathEffect: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -040053 MakeSkVertices: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -040054 MakeSurface: function() {},
Kevin Lubickeb2f6b02018-11-29 15:07:02 -050055 /** @return {RadialCanvasGradient} */
56 MakeTwoPointConicalGradientShader: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -050057 MakeWebGLCanvasSurface: function() {},
Kevin Lubick217056c2018-09-20 17:39:31 -040058 currentContext: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -050059 getColorComponents: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -050060 getSkDataBytes: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -050061 multiplyByAlpha: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -040062 setCurrentContext: function() {},
Kevin Lubick217056c2018-09-20 17:39:31 -040063
64 // private API (i.e. things declared in the bindings that we use
65 // in the pre-js file)
Kevin Lubick52b9f372018-12-04 13:57:36 -050066 _MakeImage: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -040067 _MakeLinearGradientShader: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -050068 _MakePathFromCmds: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -040069 _MakeRadialGradientShader: function() {},
Kevin Lubickf5ea37f2019-02-28 10:06:18 -050070 _MakeManagedAnimation: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -040071 _MakeSkDashPathEffect: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -040072 _MakeSkVertices: function() {},
Kevin Lubickeb2f6b02018-11-29 15:07:02 -050073 _MakeTwoPointConicalGradientShader: function() {},
Kevin Lubick0a1293c2018-12-03 12:31:04 -050074 _decodeImage: function() {},
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -050075 _drawShapedText: function() {},
Kevin Lubickea905ec2018-11-30 14:05:58 -050076 _getRasterDirectSurface: function() {},
Kevin Lubick134be1d2018-10-30 15:05:04 -040077 _getRasterN32PremulSurface: function() {},
Kevin Lubick217056c2018-09-20 17:39:31 -040078
Kevin Lubick1a05fce2018-11-20 12:51:16 -050079 // The testing object is meant to expose internal functions
80 // for more fine-grained testing, e.g. parseColor
81 _testing: {},
82
Kevin Lubick217056c2018-09-20 17:39:31 -040083 // Objects and properties on CanvasKit
84
Kevin Lubickcd544662019-03-22 15:41:36 -040085 GrContext: {
86 // public API (from C++ bindings)
87 getResourceCacheLimitBytes: function() {},
88 getResourceCacheUsageBytes: function() {},
89 setResourceCacheLimitBytes: function() {},
90 },
91
Kevin Lubickd3cfbca2019-03-15 15:36:29 -040092 RSXFormBuilder: function() {},
Kevin Lubickee91c072019-03-29 10:39:52 -040093 SkColorBuilder: function() {},
94 SkRectBuilder: function() {},
Kevin Lubickd3cfbca2019-03-15 15:36:29 -040095
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -050096 ShapedText: {
97 // public API (from C++ bindings)
98 getBounds: function() {},
99 },
100
Kevin Lubick006a6f32018-10-19 14:34:34 -0400101 SkCanvas: {
102 // public API (from C++ bindings)
103 clear: function() {},
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500104 clipPath: function() {},
Kevin Lubick5d5723c2018-12-07 10:09:11 -0500105 clipRect: function() {},
106 concat: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500107 drawArc: function() {},
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500108 drawImage: function() {},
109 drawImageRect: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500110 drawLine: function() {},
111 drawOval: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400112 drawPaint: function() {},
113 drawPath: function() {},
Kevin Lubickcc13fd32019-04-05 13:00:01 -0400114 drawPicture: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -0500115 drawRect: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500116 drawRoundRect: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500117 drawShadow: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -0500118 drawText: function() {},
Kevin Lubickec4903d2019-01-14 08:36:08 -0500119 drawTextBlob: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -0500120 drawVertices: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400121 flush: function() {},
Kevin Lubick5d5723c2018-12-07 10:09:11 -0500122 getTotalMatrix: function() {},
Kevin Lubick543f3522019-03-08 10:04:28 -0500123 makeSurface: function() {},
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500124 restore: function() {},
Kevin Lubickb3574c92019-03-06 08:25:36 -0500125 restoreToCount: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400126 rotate: function() {},
127 save: function() {},
Kevin Lubickb3574c92019-03-06 08:25:36 -0500128 saveLayer: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400129 scale: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400130 skew: function() {},
131 translate: function() {},
132
133 // private API
Kevin Lubickee91c072019-03-29 10:39:52 -0400134 _drawAtlas: function() {},
Kevin Lubickec4903d2019-01-14 08:36:08 -0500135 _drawSimpleText: function() {},
Kevin Lubick52b9f372018-12-04 13:57:36 -0500136 _readPixels: function() {},
137 _writePixels: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400138 delete: function() {},
139 },
140
Kevin Lubick35ac0382019-01-02 15:13:57 -0500141 SkFont: {
142 // public API (from C++ bindings)
143 getScaleX: function() {},
144 getSize: function() {},
145 getSkewX: function() {},
146 getTypeface: function() {},
147 measureText: function() {},
148 setScaleX: function() {},
149 setSize: function() {},
150 setSkewX: function() {},
151 setTypeface: function() {},
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400152 // private API (from C++ bindings)
153 _getWidths: function() {},
Kevin Lubick35ac0382019-01-02 15:13:57 -0500154 },
155
Kevin Lubickddd0a332018-12-12 10:35:13 -0500156 SkFontMgr: {
157 // public API (from C++ bindings)
158 RefDefault: function() {},
159 countFamilies: function() {},
160
161 // private API
162 _makeTypefaceFromData: function() {},
163 },
164
Kevin Lubick006a6f32018-10-19 14:34:34 -0400165 SkImage: {
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500166 // public API (from C++ bindings)
167 height: function() {},
168 width: function() {},
Alexander Khovansky3e119332018-11-15 02:01:19 +0300169 // private API
170 _encodeToData: function() {},
171 _encodeToDataWithFormat: function() {},
Kevin Lubicka064c282019-04-04 09:28:53 -0400172 _makeShader: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400173 },
174
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500175 SkMatrix: {
Kevin Lubickb9db3902018-11-26 11:47:54 -0500176 identity: function() {},
Kevin Lubickf3555182019-03-14 10:55:10 -0400177 invert: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500178 mapPoints: function() {},
179 multiply: function() {},
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500180 rotated: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500181 scaled: function() {},
182 skewed: function() {},
183 translated: function() {},
184 },
185
186 SkPaint: {
187 // public API (from C++ bindings)
188 /** @return {CanvasKit.SkPaint} */
189 copy: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -0500190 getBlendMode: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500191 getColor: function() {},
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500192 getFilterQuality: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500193 getStrokeCap: function() {},
194 getStrokeJoin: function() {},
195 getStrokeMiter: function() {},
196 getStrokeWidth: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500197 setAntiAlias: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -0500198 setBlendMode: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500199 setColor: function() {},
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500200 setFilterQuality: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500201 setMaskFilter: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500202 setPathEffect: function() {},
203 setShader: function() {},
204 setStrokeCap: function() {},
205 setStrokeJoin: function() {},
206 setStrokeMiter: function() {},
207 setStrokeWidth: function() {},
208 setStyle: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500209
210 //private API
211 delete: function() {},
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500212 },
213
Kevin Lubick006a6f32018-10-19 14:34:34 -0400214 SkPath: {
215 // public API (from C++ bindings)
Kevin Lubickb9db3902018-11-26 11:47:54 -0500216 computeTightBounds: function() {},
Kevin Lubick1646e7d2018-12-07 13:03:08 -0500217 contains: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500218 /** @return {CanvasKit.SkPath} */
219 copy: function() {},
220 countPoints: function() {},
221 equals: function() {},
222 getBounds: function() {},
223 getFillType: function() {},
224 getPoint: function() {},
Kevin Lubick1646e7d2018-12-07 13:03:08 -0500225 isEmpty: function() {},
Kevin Lubick2b79d1c2018-12-14 16:10:38 -0500226 isVolatile: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500227 reset: function() {},
228 rewind: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500229 setFillType: function() {},
Kevin Lubick2b79d1c2018-12-14 16:10:38 -0500230 setIsVolatile: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500231 toSVGString: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400232
233 // private API
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500234 _addArc: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400235 _addPath: function() {},
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500236 _addRect: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500237 _addRoundRect: function() {},
Alexander Khovansky3e119332018-11-15 02:01:19 +0300238 _arc: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400239 _arcTo: function() {},
240 _close: function() {},
241 _conicTo: function() {},
242 _cubicTo: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400243 _dash: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400244 _lineTo: function() {},
245 _moveTo: function() {},
246 _op: function() {},
247 _quadTo: function() {},
248 _rect: function() {},
249 _simplify: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400250 _stroke: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400251 _transform: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400252 _trim: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400253 delete: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500254 dump: function() {},
255 dumpHex: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400256 },
257
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400258 SkPathMeasure: {
259 getLength: function() {},
260 getPosTan: function() {},
261 isClosed: function() {},
262 nextContour: function() {},
263 },
264
Kevin Lubickcc13fd32019-04-05 13:00:01 -0400265 SkPicture: {
266 DEBUGONLY_serialize: function() {},
267 },
268
269 SkPictureRecorder: {
270 beginRecording: function() {},
271 finishRecordingAsPicture: function() {},
272 },
273
Kevin Lubick006a6f32018-10-19 14:34:34 -0400274 SkRect: {
275 fLeft: {},
276 fTop: {},
277 fRight: {},
278 fBottom: {},
279 },
280
281 SkSurface: {
282 // public API (from C++ bindings)
283 /** @return {CanvasKit.SkCanvas} */
284 getCanvas: function() {},
285 /** @return {CanvasKit.SkImage} */
286 makeImageSnapshot: function() {},
Kevin Lubick543f3522019-03-08 10:04:28 -0500287 makeSurface: function() {},
Kevin Lubickcd544662019-03-22 15:41:36 -0400288 grContext: {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400289
290 // private API
291 _flush: function() {},
292 _getRasterN32PremulSurface: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400293 delete: function() {},
294 },
295
Kevin Lubickec4903d2019-01-14 08:36:08 -0500296 SkTextBlob: {
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400297 // public API (both C++ and JS bindings)
298 MakeFromRSXform: function() {},
Kevin Lubickec4903d2019-01-14 08:36:08 -0500299 MakeFromText: function() {},
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400300 MakeOnPath: function() {},
301 // private API (from C++ bindings)
302 _MakeFromRSXform: function() {},
Kevin Lubickec4903d2019-01-14 08:36:08 -0500303 _MakeFromText: function() {},
304 },
305
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400306 SkVertices: {
307 // public API (from C++ bindings)
Kevin Lubick12c0e502018-11-28 12:51:56 -0500308 bounds: function() {},
309 mode: function() {},
310 uniqueID: function() {},
311 vertexCount: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400312
313 // private API
314 /** @return {CanvasKit.SkVertices} */
315 _applyBones: function() {},
316 },
317
Kevin Lubickd6ba7252019-06-03 14:38:05 -0400318 _SkVerticesBuilder: {
319 // public API (from C++ bindings)
320 boneIndices: function() {},
321 boneWeights: function() {},
322 colors: function() {},
323 detach: function() {},
324 indices: function() {},
325 positions: function() {},
326 texCoords: function() {},
327 },
328
Kevin Lubick006a6f32018-10-19 14:34:34 -0400329 // Constants and Enums
330 gpu: {},
331 skottie: {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400332
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500333 TRANSPARENT: {},
334 RED: {},
335 BLUE: {},
336 YELLOW: {},
337 CYAN: {},
338 BLACK: {},
Kevin Lubickea905ec2018-11-30 14:05:58 -0500339 WHITE: {},
340
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500341 MOVE_VERB: {},
342 LINE_VERB: {},
343 QUAD_VERB: {},
344 CONIC_VERB: {},
345 CUBIC_VERB: {},
346 CLOSE_VERB: {},
347
Kevin Lubickea905ec2018-11-30 14:05:58 -0500348 AlphaType: {
349 Opaque: {},
350 Premul: {},
351 Unpremul: {},
352 },
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500353
354 BlendMode: {
355 Clear: {},
356 Src: {},
357 Dst: {},
358 SrcOver: {},
359 DstOver: {},
360 SrcIn: {},
361 DstIn: {},
362 SrcOut: {},
363 DstOut: {},
364 SrcATop: {},
365 DstATop: {},
366 Xor: {},
367 Plus: {},
368 Modulate: {},
369 Screen: {},
370 Overlay: {},
371 Darken: {},
372 Lighten: {},
373 ColorDodge: {},
374 ColorBurn: {},
375 HardLight: {},
376 SoftLight: {},
377 Difference: {},
378 Exclusion: {},
379 Multiply: {},
380 Hue: {},
381 Saturation: {},
382 Color: {},
383 Luminosity: {},
384 },
385
386 BlurStyle: {
387 Normal: {},
388 Solid: {},
389 Outer: {},
390 Inner: {},
391 },
392
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500393 ClipOp: {
394 Difference: {},
395 Intersect: {},
396 },
397
Kevin Lubickea905ec2018-11-30 14:05:58 -0500398 ColorType: {
399 Alpha_8: {},
400 RGB_565: {},
401 ARGB_4444: {},
402 RGBA_8888: {},
403 RGB_888x: {},
404 BGRA_8888: {},
405 RGBA_1010102: {},
406 RGB_101010x: {},
407 Gray_8: {},
408 RGBA_F16: {},
409 RGBA_F32: {},
410 },
411
Kevin Lubick006a6f32018-10-19 14:34:34 -0400412 FillType: {
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500413 Winding: {},
414 EvenOdd: {},
415 InverseWinding: {},
416 InverseEvenOdd: {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400417 },
418
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500419 FilterQuality: {
420 None: {},
421 Low: {},
422 Medium: {},
423 High: {},
424 },
425
Alexander Khovansky3e119332018-11-15 02:01:19 +0300426 ImageFormat: {
427 PNG: {},
428 JPEG: {},
429 },
430
Kevin Lubickb9db3902018-11-26 11:47:54 -0500431 PaintStyle: {
432 Fill: {},
433 Stroke: {},
434 StrokeAndFill: {},
435 },
436
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500437 PathOp: {
438 Difference: {},
439 Intersect: {},
440 Union: {},
441 XOR: {},
442 ReverseDifference: {},
443 },
444
Kevin Lubickb9db3902018-11-26 11:47:54 -0500445 StrokeCap: {
446 Butt: {},
447 Round: {},
448 Square: {},
449 },
450
451 StrokeJoin: {
452 Miter: {},
453 Round: {},
454 Bevel: {},
455 },
456
Kevin Lubickec4903d2019-01-14 08:36:08 -0500457 TextEncoding: {
458 UTF8: {},
459 UTF16: {},
460 UTF32: {},
461 GlyphID: {},
462 },
463
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500464 TileMode: {
465 Clamp: {},
466 Repeat: {},
467 Mirror: {},
Kevin Lubickd29edd72018-12-07 08:29:52 -0500468 Decal: {},
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500469 },
470
471 VertexMode: {
472 Triangles: {},
473 TrianglesStrip: {},
474 TriangleFan: {},
475 },
476
Kevin Lubick006a6f32018-10-19 14:34:34 -0400477 // Things Enscriptem adds for us
478
Kevin Lubick53965c92018-10-11 08:51:55 -0400479 /** Represents the heap of the WASM code
480 * @type {ArrayBuffer}
481 */
482 buffer: {},
483 /**
484 * @type {Float32Array}
485 */
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400486 HEAPF32: {},
Kevin Lubick53965c92018-10-11 08:51:55 -0400487 /**
488 * @type {Uint8Array}
489 */
490 HEAPU8: {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400491 /**
492 * @type {Uint16Array}
493 */
494 HEAPU16: {},
495 /**
496 * @type {Int32Array}
497 */
498 HEAP32: {},
Kevin Lubickf5ea37f2019-02-28 10:06:18 -0500499 /**
500 * @type {Uint32Array}
501 */
502 HEAPU32: {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400503 _malloc: function() {},
504 _free: function() {},
505 onRuntimeInitialized: function() {},
506};
Kevin Lubick217056c2018-09-20 17:39:31 -0400507
Kevin Lubick006a6f32018-10-19 14:34:34 -0400508// Public API things that are newly declared in the JS should go here.
509// It's not enough to declare them above, because closure can still erase them
510// unless they go on the prototype.
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500511CanvasKit.SkPath.prototype.addArc = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400512CanvasKit.SkPath.prototype.addPath = function() {};
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500513CanvasKit.SkPath.prototype.addRect = function() {};
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500514CanvasKit.SkPath.prototype.addRoundRect = function() {};
Alexander Khovansky3e119332018-11-15 02:01:19 +0300515CanvasKit.SkPath.prototype.arc = function() {};
Kevin Lubick006a6f32018-10-19 14:34:34 -0400516CanvasKit.SkPath.prototype.arcTo = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400517CanvasKit.SkPath.prototype.close = function() {};
Kevin Lubick006a6f32018-10-19 14:34:34 -0400518CanvasKit.SkPath.prototype.conicTo = function() {};
519CanvasKit.SkPath.prototype.cubicTo = function() {};
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400520CanvasKit.SkPath.prototype.dash = function() {};
Kevin Lubick006a6f32018-10-19 14:34:34 -0400521CanvasKit.SkPath.prototype.lineTo = function() {};
522CanvasKit.SkPath.prototype.moveTo = function() {};
523CanvasKit.SkPath.prototype.op = function() {};
524CanvasKit.SkPath.prototype.quadTo = function() {};
525CanvasKit.SkPath.prototype.rect = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400526CanvasKit.SkPath.prototype.simplify = function() {};
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400527CanvasKit.SkPath.prototype.stroke = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400528CanvasKit.SkPath.prototype.transform = function() {};
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400529CanvasKit.SkPath.prototype.trim = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400530
Kevin Lubickcc13fd32019-04-05 13:00:01 -0400531CanvasKit.SkPicture.prototype.DEBUGONLY_saveAsFile = function() {};
532
Kevin Lubick5b90b842018-10-17 07:57:18 -0400533CanvasKit.SkSurface.prototype.dispose = function() {};
Kevin Lubick359a7e32019-03-19 09:34:37 -0400534CanvasKit.SkSurface.prototype.flush = function() {};
535CanvasKit.SkSurface.prototype.requestAnimationFrame = function() {};
Kevin Lubickcc13fd32019-04-05 13:00:01 -0400536CanvasKit.SkSurface.prototype.captureFrameAsSkPicture = function() {};
Kevin Lubick53965c92018-10-11 08:51:55 -0400537
Kevin Lubick12c0e502018-11-28 12:51:56 -0500538/** @return {CanvasKit.SkVertices} */
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400539CanvasKit.SkVertices.prototype.applyBones = function() {};
540
Alexander Khovansky3e119332018-11-15 02:01:19 +0300541CanvasKit.SkImage.prototype.encodeToData = function() {};
Kevin Lubicka064c282019-04-04 09:28:53 -0400542CanvasKit.SkImage.prototype.makeShader = function() {};
Alexander Khovansky3e119332018-11-15 02:01:19 +0300543
Kevin Lubickee91c072019-03-29 10:39:52 -0400544CanvasKit.SkCanvas.prototype.drawAtlas = function() {};
Kevin Lubickec4903d2019-01-14 08:36:08 -0500545CanvasKit.SkCanvas.prototype.drawText = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500546/** @return {Uint8Array} */
547CanvasKit.SkCanvas.prototype.readPixels = function() {};
548CanvasKit.SkCanvas.prototype.writePixels = function() {};
549
Kevin Lubickddd0a332018-12-12 10:35:13 -0500550CanvasKit.SkFontMgr.prototype.MakeTypefaceFromData = function() {};
551
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400552CanvasKit.SkFont.prototype.getWidths = function() {};
553
554CanvasKit.RSXFormBuilder.prototype.build = function() {};
555CanvasKit.RSXFormBuilder.prototype.delete = function() {};
556CanvasKit.RSXFormBuilder.prototype.push = function() {};
Kevin Lubickee91c072019-03-29 10:39:52 -0400557CanvasKit.RSXFormBuilder.prototype.set = function() {};
558
559CanvasKit.SkColorBuilder.prototype.build = function() {};
560CanvasKit.SkColorBuilder.prototype.delete = function() {};
561CanvasKit.SkColorBuilder.prototype.push = function() {};
562CanvasKit.SkColorBuilder.prototype.set = function() {};
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400563
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400564// Define StrokeOpts object
565var StrokeOpts = {};
566StrokeOpts.prototype.width;
567StrokeOpts.prototype.miter_limit;
568StrokeOpts.prototype.cap;
569StrokeOpts.prototype.join;
Kevin Lubick1646e7d2018-12-07 13:03:08 -0500570StrokeOpts.prototype.precision;
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400571
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500572// Define everything created in the canvas2d spec here
Kevin Lubickb9db3902018-11-26 11:47:54 -0500573var HTMLCanvas = {};
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500574HTMLCanvas.prototype.decodeImage = function() {};
575HTMLCanvas.prototype.dispose = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500576HTMLCanvas.prototype.getContext = function() {};
Kevin Lubick8e4a3312018-12-14 15:03:41 -0500577HTMLCanvas.prototype.loadFont = function() {};
Kevin Lubicka40f8322018-12-17 16:01:36 -0500578HTMLCanvas.prototype.makePath2D = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500579HTMLCanvas.prototype.toDataURL = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500580
581var CanvasRenderingContext2D = {};
582CanvasRenderingContext2D.prototype.addHitRegion = function() {};
583CanvasRenderingContext2D.prototype.arc = function() {};
584CanvasRenderingContext2D.prototype.arcTo = function() {};
585CanvasRenderingContext2D.prototype.beginPath = function() {};
586CanvasRenderingContext2D.prototype.bezierCurveTo = function() {};
587CanvasRenderingContext2D.prototype.clearHitRegions = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500588CanvasRenderingContext2D.prototype.clearRect = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500589CanvasRenderingContext2D.prototype.clip = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500590CanvasRenderingContext2D.prototype.closePath = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500591CanvasRenderingContext2D.prototype.createImageData = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500592CanvasRenderingContext2D.prototype.createLinearGradient = function() {};
Kevin Lubickd29edd72018-12-07 08:29:52 -0500593CanvasRenderingContext2D.prototype.createPattern = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500594CanvasRenderingContext2D.prototype.createRadialGradient = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500595CanvasRenderingContext2D.prototype.drawFocusIfNeeded = function() {};
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500596CanvasRenderingContext2D.prototype.drawImage = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500597CanvasRenderingContext2D.prototype.ellipse = function() {};
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500598CanvasRenderingContext2D.prototype.fill = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500599CanvasRenderingContext2D.prototype.fillRect = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500600CanvasRenderingContext2D.prototype.fillText = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500601CanvasRenderingContext2D.prototype.getImageData = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500602CanvasRenderingContext2D.prototype.getLineDash = function() {};
Kevin Lubick1646e7d2018-12-07 13:03:08 -0500603CanvasRenderingContext2D.prototype.isPointInPath = function() {};
604CanvasRenderingContext2D.prototype.isPointInStroke = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500605CanvasRenderingContext2D.prototype.lineTo = function() {};
606CanvasRenderingContext2D.prototype.measureText = function() {};
607CanvasRenderingContext2D.prototype.moveTo = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500608CanvasRenderingContext2D.prototype.putImageData = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500609CanvasRenderingContext2D.prototype.quadraticCurveTo = function() {};
610CanvasRenderingContext2D.prototype.rect = function() {};
611CanvasRenderingContext2D.prototype.removeHitRegion = function() {};
612CanvasRenderingContext2D.prototype.resetTransform = function() {};
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500613CanvasRenderingContext2D.prototype.restore = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500614CanvasRenderingContext2D.prototype.rotate = function() {};
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500615CanvasRenderingContext2D.prototype.save = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500616CanvasRenderingContext2D.prototype.scale = function() {};
617CanvasRenderingContext2D.prototype.scrollPathIntoView = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500618CanvasRenderingContext2D.prototype.setLineDash = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500619CanvasRenderingContext2D.prototype.setTransform = function() {};
620CanvasRenderingContext2D.prototype.stroke = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500621CanvasRenderingContext2D.prototype.strokeRect = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500622CanvasRenderingContext2D.prototype.strokeText = function() {};
623CanvasRenderingContext2D.prototype.transform = function() {};
624CanvasRenderingContext2D.prototype.translate = function() {};
625
Kevin Lubicka40f8322018-12-17 16:01:36 -0500626var Path2D = {};
627Path2D.prototype.addPath = function() {};
628Path2D.prototype.arc = function() {};
629Path2D.prototype.arcTo = function() {};
630Path2D.prototype.bezierCurveTo = function() {};
631Path2D.prototype.closePath = function() {};
632Path2D.prototype.ellipse = function() {};
633Path2D.prototype.lineTo = function() {};
634Path2D.prototype.moveTo = function() {};
635Path2D.prototype.quadraticCurveTo = function() {};
636Path2D.prototype.rect = function() {};
637
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500638var LinearCanvasGradient = {};
639LinearCanvasGradient.prototype.addColorStop = function() {};
640var RadialCanvasGradient = {};
641RadialCanvasGradient.prototype.addColorStop = function() {};
Kevin Lubickd29edd72018-12-07 08:29:52 -0500642var CanvasPattern = {};
643CanvasPattern.prototype.setTransform = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500644
Kevin Lubick52b9f372018-12-04 13:57:36 -0500645var ImageData = {
646 /**
647 * @type {Uint8ClampedArray}
648 */
649 data: {},
650 height: {},
651 width: {},
652};
653
Kevin Lubickd29edd72018-12-07 08:29:52 -0500654var DOMMatrix = {
655 a: {},
656 b: {},
657 c: {},
658 d: {},
659 e: {},
660 f: {},
661};
662
Kevin Lubick217056c2018-09-20 17:39:31 -0400663// 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 -0500664function loadWebAssemblyModule() {};