blob: ae3f6cff43b1087794e3e559d87cbead1311393c [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 Lubick12c0e502018-11-28 12:51:56 -0500114 drawRect: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500115 drawRoundRect: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500116 drawShadow: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -0500117 drawText: function() {},
Kevin Lubickec4903d2019-01-14 08:36:08 -0500118 drawTextBlob: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -0500119 drawVertices: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400120 flush: function() {},
Kevin Lubick5d5723c2018-12-07 10:09:11 -0500121 getTotalMatrix: function() {},
Kevin Lubick543f3522019-03-08 10:04:28 -0500122 makeSurface: function() {},
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500123 restore: function() {},
Kevin Lubickb3574c92019-03-06 08:25:36 -0500124 restoreToCount: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400125 rotate: function() {},
126 save: function() {},
Kevin Lubickb3574c92019-03-06 08:25:36 -0500127 saveLayer: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400128 scale: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400129 skew: function() {},
130 translate: function() {},
131
132 // private API
Kevin Lubickee91c072019-03-29 10:39:52 -0400133 _drawAtlas: function() {},
Kevin Lubickec4903d2019-01-14 08:36:08 -0500134 _drawSimpleText: function() {},
Kevin Lubick52b9f372018-12-04 13:57:36 -0500135 _readPixels: function() {},
136 _writePixels: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400137 delete: function() {},
138 },
139
Kevin Lubick35ac0382019-01-02 15:13:57 -0500140 SkFont: {
141 // public API (from C++ bindings)
142 getScaleX: function() {},
143 getSize: function() {},
144 getSkewX: function() {},
145 getTypeface: function() {},
146 measureText: function() {},
147 setScaleX: function() {},
148 setSize: function() {},
149 setSkewX: function() {},
150 setTypeface: function() {},
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400151 // private API (from C++ bindings)
152 _getWidths: function() {},
Kevin Lubick35ac0382019-01-02 15:13:57 -0500153 },
154
Kevin Lubickddd0a332018-12-12 10:35:13 -0500155 SkFontMgr: {
156 // public API (from C++ bindings)
157 RefDefault: function() {},
158 countFamilies: function() {},
159
160 // private API
161 _makeTypefaceFromData: function() {},
162 },
163
Kevin Lubick006a6f32018-10-19 14:34:34 -0400164 SkImage: {
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500165 // public API (from C++ bindings)
166 height: function() {},
167 width: function() {},
Alexander Khovansky3e119332018-11-15 02:01:19 +0300168 // private API
169 _encodeToData: function() {},
170 _encodeToDataWithFormat: function() {},
Kevin Lubicka064c282019-04-04 09:28:53 -0400171 _makeShader: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400172 },
173
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500174 SkMatrix: {
Kevin Lubickb9db3902018-11-26 11:47:54 -0500175 identity: function() {},
Kevin Lubickf3555182019-03-14 10:55:10 -0400176 invert: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500177 mapPoints: function() {},
178 multiply: function() {},
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500179 rotated: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500180 scaled: function() {},
181 skewed: function() {},
182 translated: function() {},
183 },
184
185 SkPaint: {
186 // public API (from C++ bindings)
187 /** @return {CanvasKit.SkPaint} */
188 copy: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -0500189 getBlendMode: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500190 getColor: function() {},
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500191 getFilterQuality: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500192 getStrokeCap: function() {},
193 getStrokeJoin: function() {},
194 getStrokeMiter: function() {},
195 getStrokeWidth: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500196 setAntiAlias: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -0500197 setBlendMode: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500198 setColor: function() {},
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500199 setFilterQuality: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500200 setMaskFilter: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500201 setPathEffect: function() {},
202 setShader: function() {},
203 setStrokeCap: function() {},
204 setStrokeJoin: function() {},
205 setStrokeMiter: function() {},
206 setStrokeWidth: function() {},
207 setStyle: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500208
209 //private API
210 delete: function() {},
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500211 },
212
Kevin Lubick006a6f32018-10-19 14:34:34 -0400213 SkPath: {
214 // public API (from C++ bindings)
Kevin Lubickb9db3902018-11-26 11:47:54 -0500215 computeTightBounds: function() {},
Kevin Lubick1646e7d2018-12-07 13:03:08 -0500216 contains: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500217 /** @return {CanvasKit.SkPath} */
218 copy: function() {},
219 countPoints: function() {},
220 equals: function() {},
221 getBounds: function() {},
222 getFillType: function() {},
223 getPoint: function() {},
Kevin Lubick1646e7d2018-12-07 13:03:08 -0500224 isEmpty: function() {},
Kevin Lubick2b79d1c2018-12-14 16:10:38 -0500225 isVolatile: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500226 reset: function() {},
227 rewind: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500228 setFillType: function() {},
Kevin Lubick2b79d1c2018-12-14 16:10:38 -0500229 setIsVolatile: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500230 toSVGString: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400231
232 // private API
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500233 _addArc: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400234 _addPath: function() {},
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500235 _addRect: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500236 _addRoundRect: function() {},
Alexander Khovansky3e119332018-11-15 02:01:19 +0300237 _arc: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400238 _arcTo: function() {},
239 _close: function() {},
240 _conicTo: function() {},
241 _cubicTo: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400242 _dash: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400243 _lineTo: function() {},
244 _moveTo: function() {},
245 _op: function() {},
246 _quadTo: function() {},
247 _rect: function() {},
248 _simplify: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400249 _stroke: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400250 _transform: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400251 _trim: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400252 delete: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500253 dump: function() {},
254 dumpHex: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400255 },
256
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400257 SkPathMeasure: {
258 getLength: function() {},
259 getPosTan: function() {},
260 isClosed: function() {},
261 nextContour: function() {},
262 },
263
Kevin Lubick006a6f32018-10-19 14:34:34 -0400264 SkRect: {
265 fLeft: {},
266 fTop: {},
267 fRight: {},
268 fBottom: {},
269 },
270
271 SkSurface: {
272 // public API (from C++ bindings)
273 /** @return {CanvasKit.SkCanvas} */
274 getCanvas: function() {},
275 /** @return {CanvasKit.SkImage} */
276 makeImageSnapshot: function() {},
Kevin Lubick543f3522019-03-08 10:04:28 -0500277 makeSurface: function() {},
Kevin Lubickcd544662019-03-22 15:41:36 -0400278 grContext: {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400279
280 // private API
281 _flush: function() {},
282 _getRasterN32PremulSurface: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400283 delete: function() {},
284 },
285
Kevin Lubickec4903d2019-01-14 08:36:08 -0500286 SkTextBlob: {
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400287 // public API (both C++ and JS bindings)
288 MakeFromRSXform: function() {},
Kevin Lubickec4903d2019-01-14 08:36:08 -0500289 MakeFromText: function() {},
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400290 MakeOnPath: function() {},
291 // private API (from C++ bindings)
292 _MakeFromRSXform: function() {},
Kevin Lubickec4903d2019-01-14 08:36:08 -0500293 _MakeFromText: function() {},
294 },
295
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400296 SkVertices: {
297 // public API (from C++ bindings)
Kevin Lubick12c0e502018-11-28 12:51:56 -0500298 bounds: function() {},
299 mode: function() {},
300 uniqueID: function() {},
301 vertexCount: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400302
303 // private API
304 /** @return {CanvasKit.SkVertices} */
305 _applyBones: function() {},
306 },
307
Kevin Lubick006a6f32018-10-19 14:34:34 -0400308 // Constants and Enums
309 gpu: {},
310 skottie: {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400311
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500312 TRANSPARENT: {},
313 RED: {},
314 BLUE: {},
315 YELLOW: {},
316 CYAN: {},
317 BLACK: {},
Kevin Lubickea905ec2018-11-30 14:05:58 -0500318 WHITE: {},
319
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500320 MOVE_VERB: {},
321 LINE_VERB: {},
322 QUAD_VERB: {},
323 CONIC_VERB: {},
324 CUBIC_VERB: {},
325 CLOSE_VERB: {},
326
Kevin Lubickea905ec2018-11-30 14:05:58 -0500327 AlphaType: {
328 Opaque: {},
329 Premul: {},
330 Unpremul: {},
331 },
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500332
333 BlendMode: {
334 Clear: {},
335 Src: {},
336 Dst: {},
337 SrcOver: {},
338 DstOver: {},
339 SrcIn: {},
340 DstIn: {},
341 SrcOut: {},
342 DstOut: {},
343 SrcATop: {},
344 DstATop: {},
345 Xor: {},
346 Plus: {},
347 Modulate: {},
348 Screen: {},
349 Overlay: {},
350 Darken: {},
351 Lighten: {},
352 ColorDodge: {},
353 ColorBurn: {},
354 HardLight: {},
355 SoftLight: {},
356 Difference: {},
357 Exclusion: {},
358 Multiply: {},
359 Hue: {},
360 Saturation: {},
361 Color: {},
362 Luminosity: {},
363 },
364
365 BlurStyle: {
366 Normal: {},
367 Solid: {},
368 Outer: {},
369 Inner: {},
370 },
371
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500372 ClipOp: {
373 Difference: {},
374 Intersect: {},
375 },
376
Kevin Lubickea905ec2018-11-30 14:05:58 -0500377 ColorType: {
378 Alpha_8: {},
379 RGB_565: {},
380 ARGB_4444: {},
381 RGBA_8888: {},
382 RGB_888x: {},
383 BGRA_8888: {},
384 RGBA_1010102: {},
385 RGB_101010x: {},
386 Gray_8: {},
387 RGBA_F16: {},
388 RGBA_F32: {},
389 },
390
Kevin Lubick006a6f32018-10-19 14:34:34 -0400391 FillType: {
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500392 Winding: {},
393 EvenOdd: {},
394 InverseWinding: {},
395 InverseEvenOdd: {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400396 },
397
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500398 FilterQuality: {
399 None: {},
400 Low: {},
401 Medium: {},
402 High: {},
403 },
404
Alexander Khovansky3e119332018-11-15 02:01:19 +0300405 ImageFormat: {
406 PNG: {},
407 JPEG: {},
408 },
409
Kevin Lubickb9db3902018-11-26 11:47:54 -0500410 PaintStyle: {
411 Fill: {},
412 Stroke: {},
413 StrokeAndFill: {},
414 },
415
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500416 PathOp: {
417 Difference: {},
418 Intersect: {},
419 Union: {},
420 XOR: {},
421 ReverseDifference: {},
422 },
423
Kevin Lubickb9db3902018-11-26 11:47:54 -0500424 StrokeCap: {
425 Butt: {},
426 Round: {},
427 Square: {},
428 },
429
430 StrokeJoin: {
431 Miter: {},
432 Round: {},
433 Bevel: {},
434 },
435
Kevin Lubickec4903d2019-01-14 08:36:08 -0500436 TextEncoding: {
437 UTF8: {},
438 UTF16: {},
439 UTF32: {},
440 GlyphID: {},
441 },
442
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500443 TileMode: {
444 Clamp: {},
445 Repeat: {},
446 Mirror: {},
Kevin Lubickd29edd72018-12-07 08:29:52 -0500447 Decal: {},
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500448 },
449
450 VertexMode: {
451 Triangles: {},
452 TrianglesStrip: {},
453 TriangleFan: {},
454 },
455
Kevin Lubick006a6f32018-10-19 14:34:34 -0400456 // Things Enscriptem adds for us
457
Kevin Lubick53965c92018-10-11 08:51:55 -0400458 /** Represents the heap of the WASM code
459 * @type {ArrayBuffer}
460 */
461 buffer: {},
462 /**
463 * @type {Float32Array}
464 */
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400465 HEAPF32: {},
Kevin Lubick53965c92018-10-11 08:51:55 -0400466 /**
467 * @type {Uint8Array}
468 */
469 HEAPU8: {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400470 /**
471 * @type {Uint16Array}
472 */
473 HEAPU16: {},
474 /**
475 * @type {Int32Array}
476 */
477 HEAP32: {},
Kevin Lubickf5ea37f2019-02-28 10:06:18 -0500478 /**
479 * @type {Uint32Array}
480 */
481 HEAPU32: {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400482 _malloc: function() {},
483 _free: function() {},
484 onRuntimeInitialized: function() {},
485};
Kevin Lubick217056c2018-09-20 17:39:31 -0400486
Kevin Lubick006a6f32018-10-19 14:34:34 -0400487// Public API things that are newly declared in the JS should go here.
488// It's not enough to declare them above, because closure can still erase them
489// unless they go on the prototype.
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500490CanvasKit.SkPath.prototype.addArc = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400491CanvasKit.SkPath.prototype.addPath = function() {};
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500492CanvasKit.SkPath.prototype.addRect = function() {};
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500493CanvasKit.SkPath.prototype.addRoundRect = function() {};
Alexander Khovansky3e119332018-11-15 02:01:19 +0300494CanvasKit.SkPath.prototype.arc = function() {};
Kevin Lubick006a6f32018-10-19 14:34:34 -0400495CanvasKit.SkPath.prototype.arcTo = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400496CanvasKit.SkPath.prototype.close = function() {};
Kevin Lubick006a6f32018-10-19 14:34:34 -0400497CanvasKit.SkPath.prototype.conicTo = function() {};
498CanvasKit.SkPath.prototype.cubicTo = function() {};
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400499CanvasKit.SkPath.prototype.dash = function() {};
Kevin Lubick006a6f32018-10-19 14:34:34 -0400500CanvasKit.SkPath.prototype.lineTo = function() {};
501CanvasKit.SkPath.prototype.moveTo = function() {};
502CanvasKit.SkPath.prototype.op = function() {};
503CanvasKit.SkPath.prototype.quadTo = function() {};
504CanvasKit.SkPath.prototype.rect = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400505CanvasKit.SkPath.prototype.simplify = function() {};
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400506CanvasKit.SkPath.prototype.stroke = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400507CanvasKit.SkPath.prototype.transform = function() {};
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400508CanvasKit.SkPath.prototype.trim = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400509
Kevin Lubick5b90b842018-10-17 07:57:18 -0400510CanvasKit.SkSurface.prototype.dispose = function() {};
Kevin Lubick359a7e32019-03-19 09:34:37 -0400511CanvasKit.SkSurface.prototype.flush = function() {};
512CanvasKit.SkSurface.prototype.requestAnimationFrame = function() {};
Kevin Lubick53965c92018-10-11 08:51:55 -0400513
Kevin Lubick12c0e502018-11-28 12:51:56 -0500514/** @return {CanvasKit.SkVertices} */
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400515CanvasKit.SkVertices.prototype.applyBones = function() {};
516
Alexander Khovansky3e119332018-11-15 02:01:19 +0300517CanvasKit.SkImage.prototype.encodeToData = function() {};
Kevin Lubicka064c282019-04-04 09:28:53 -0400518CanvasKit.SkImage.prototype.makeShader = function() {};
Alexander Khovansky3e119332018-11-15 02:01:19 +0300519
Kevin Lubickee91c072019-03-29 10:39:52 -0400520CanvasKit.SkCanvas.prototype.drawAtlas = function() {};
Kevin Lubickec4903d2019-01-14 08:36:08 -0500521CanvasKit.SkCanvas.prototype.drawText = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500522/** @return {Uint8Array} */
523CanvasKit.SkCanvas.prototype.readPixels = function() {};
524CanvasKit.SkCanvas.prototype.writePixels = function() {};
525
Kevin Lubickddd0a332018-12-12 10:35:13 -0500526CanvasKit.SkFontMgr.prototype.MakeTypefaceFromData = function() {};
527
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400528CanvasKit.SkFont.prototype.getWidths = function() {};
529
530CanvasKit.RSXFormBuilder.prototype.build = function() {};
531CanvasKit.RSXFormBuilder.prototype.delete = function() {};
532CanvasKit.RSXFormBuilder.prototype.push = function() {};
Kevin Lubickee91c072019-03-29 10:39:52 -0400533CanvasKit.RSXFormBuilder.prototype.set = function() {};
534
535CanvasKit.SkColorBuilder.prototype.build = function() {};
536CanvasKit.SkColorBuilder.prototype.delete = function() {};
537CanvasKit.SkColorBuilder.prototype.push = function() {};
538CanvasKit.SkColorBuilder.prototype.set = function() {};
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400539
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400540// Define StrokeOpts object
541var StrokeOpts = {};
542StrokeOpts.prototype.width;
543StrokeOpts.prototype.miter_limit;
544StrokeOpts.prototype.cap;
545StrokeOpts.prototype.join;
Kevin Lubick1646e7d2018-12-07 13:03:08 -0500546StrokeOpts.prototype.precision;
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400547
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500548// Define everything created in the canvas2d spec here
Kevin Lubickb9db3902018-11-26 11:47:54 -0500549var HTMLCanvas = {};
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500550HTMLCanvas.prototype.decodeImage = function() {};
551HTMLCanvas.prototype.dispose = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500552HTMLCanvas.prototype.getContext = function() {};
Kevin Lubick8e4a3312018-12-14 15:03:41 -0500553HTMLCanvas.prototype.loadFont = function() {};
Kevin Lubicka40f8322018-12-17 16:01:36 -0500554HTMLCanvas.prototype.makePath2D = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500555HTMLCanvas.prototype.toDataURL = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500556
557var CanvasRenderingContext2D = {};
558CanvasRenderingContext2D.prototype.addHitRegion = function() {};
559CanvasRenderingContext2D.prototype.arc = function() {};
560CanvasRenderingContext2D.prototype.arcTo = function() {};
561CanvasRenderingContext2D.prototype.beginPath = function() {};
562CanvasRenderingContext2D.prototype.bezierCurveTo = function() {};
563CanvasRenderingContext2D.prototype.clearHitRegions = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500564CanvasRenderingContext2D.prototype.clearRect = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500565CanvasRenderingContext2D.prototype.clip = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500566CanvasRenderingContext2D.prototype.closePath = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500567CanvasRenderingContext2D.prototype.createImageData = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500568CanvasRenderingContext2D.prototype.createLinearGradient = function() {};
Kevin Lubickd29edd72018-12-07 08:29:52 -0500569CanvasRenderingContext2D.prototype.createPattern = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500570CanvasRenderingContext2D.prototype.createRadialGradient = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500571CanvasRenderingContext2D.prototype.drawFocusIfNeeded = function() {};
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500572CanvasRenderingContext2D.prototype.drawImage = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500573CanvasRenderingContext2D.prototype.ellipse = function() {};
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500574CanvasRenderingContext2D.prototype.fill = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500575CanvasRenderingContext2D.prototype.fillRect = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500576CanvasRenderingContext2D.prototype.fillText = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500577CanvasRenderingContext2D.prototype.getImageData = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500578CanvasRenderingContext2D.prototype.getLineDash = function() {};
Kevin Lubick1646e7d2018-12-07 13:03:08 -0500579CanvasRenderingContext2D.prototype.isPointInPath = function() {};
580CanvasRenderingContext2D.prototype.isPointInStroke = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500581CanvasRenderingContext2D.prototype.lineTo = function() {};
582CanvasRenderingContext2D.prototype.measureText = function() {};
583CanvasRenderingContext2D.prototype.moveTo = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500584CanvasRenderingContext2D.prototype.putImageData = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500585CanvasRenderingContext2D.prototype.quadraticCurveTo = function() {};
586CanvasRenderingContext2D.prototype.rect = function() {};
587CanvasRenderingContext2D.prototype.removeHitRegion = function() {};
588CanvasRenderingContext2D.prototype.resetTransform = function() {};
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500589CanvasRenderingContext2D.prototype.restore = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500590CanvasRenderingContext2D.prototype.rotate = function() {};
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500591CanvasRenderingContext2D.prototype.save = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500592CanvasRenderingContext2D.prototype.scale = function() {};
593CanvasRenderingContext2D.prototype.scrollPathIntoView = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500594CanvasRenderingContext2D.prototype.setLineDash = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500595CanvasRenderingContext2D.prototype.setTransform = function() {};
596CanvasRenderingContext2D.prototype.stroke = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500597CanvasRenderingContext2D.prototype.strokeRect = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500598CanvasRenderingContext2D.prototype.strokeText = function() {};
599CanvasRenderingContext2D.prototype.transform = function() {};
600CanvasRenderingContext2D.prototype.translate = function() {};
601
Kevin Lubicka40f8322018-12-17 16:01:36 -0500602var Path2D = {};
603Path2D.prototype.addPath = function() {};
604Path2D.prototype.arc = function() {};
605Path2D.prototype.arcTo = function() {};
606Path2D.prototype.bezierCurveTo = function() {};
607Path2D.prototype.closePath = function() {};
608Path2D.prototype.ellipse = function() {};
609Path2D.prototype.lineTo = function() {};
610Path2D.prototype.moveTo = function() {};
611Path2D.prototype.quadraticCurveTo = function() {};
612Path2D.prototype.rect = function() {};
613
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500614var LinearCanvasGradient = {};
615LinearCanvasGradient.prototype.addColorStop = function() {};
616var RadialCanvasGradient = {};
617RadialCanvasGradient.prototype.addColorStop = function() {};
Kevin Lubickd29edd72018-12-07 08:29:52 -0500618var CanvasPattern = {};
619CanvasPattern.prototype.setTransform = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500620
Kevin Lubick52b9f372018-12-04 13:57:36 -0500621var ImageData = {
622 /**
623 * @type {Uint8ClampedArray}
624 */
625 data: {},
626 height: {},
627 width: {},
628};
629
Kevin Lubickd29edd72018-12-07 08:29:52 -0500630var DOMMatrix = {
631 a: {},
632 b: {},
633 c: {},
634 d: {},
635 e: {},
636 f: {},
637};
638
Kevin Lubick217056c2018-09-20 17:39:31 -0400639// 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 -0500640function loadWebAssemblyModule() {};