blob: 3659bc876c8b8aab56c002dcc136a68efaf3ae94 [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 Lubickb5ae3b52018-11-03 07:51:19 -040040 MakeImageShader: function() {},
Kevin Lubick0a1293c2018-12-03 12:31:04 -050041 /** @return {CanvasKit.SkImage} */
42 MakeImageFromEncoded: function() {},
Kevin Lubickeb2f6b02018-11-29 15:07:02 -050043 /** @return {LinearCanvasGradient} */
Kevin Lubickb5ae3b52018-11-03 07:51:19 -040044 MakeLinearGradientShader: function() {},
Kevin Lubick543f3522019-03-08 10:04:28 -050045 MakeOnScreenGLSurface: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -050046 MakePathFromCmds: function() {},
Kevin Lubicka40f8322018-12-17 16:01:36 -050047 MakePathFromOp: function() {},
48 MakePathFromSVGString: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -050049 MakeRadialGradientShader: function() {},
Kevin Lubick543f3522019-03-08 10:04:28 -050050 MakeRenderTarget: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -050051 MakeSWCanvasSurface: function() {},
Kevin Lubickf5ea37f2019-02-28 10:06:18 -050052 MakeManagedAnimation: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -040053 MakeSkDashPathEffect: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -040054 MakeSkVertices: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -040055 MakeSurface: function() {},
Kevin Lubickeb2f6b02018-11-29 15:07:02 -050056 /** @return {RadialCanvasGradient} */
57 MakeTwoPointConicalGradientShader: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -050058 MakeWebGLCanvasSurface: function() {},
Kevin Lubick217056c2018-09-20 17:39:31 -040059 currentContext: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -050060 getColorComponents: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -050061 getSkDataBytes: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -050062 multiplyByAlpha: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -040063 setCurrentContext: function() {},
Kevin Lubick217056c2018-09-20 17:39:31 -040064
65 // private API (i.e. things declared in the bindings that we use
66 // in the pre-js file)
Kevin Lubick52b9f372018-12-04 13:57:36 -050067 _MakeImage: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -040068 _MakeImageShader: function() {},
69 _MakeLinearGradientShader: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -050070 _MakePathFromCmds: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -040071 _MakeRadialGradientShader: function() {},
Kevin Lubickf5ea37f2019-02-28 10:06:18 -050072 _MakeManagedAnimation: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -040073 _MakeSkDashPathEffect: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -040074 _MakeSkVertices: function() {},
Kevin Lubickeb2f6b02018-11-29 15:07:02 -050075 _MakeTwoPointConicalGradientShader: function() {},
Kevin Lubick0a1293c2018-12-03 12:31:04 -050076 _decodeImage: function() {},
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -050077 _drawShapedText: function() {},
Kevin Lubickea905ec2018-11-30 14:05:58 -050078 _getRasterDirectSurface: function() {},
Kevin Lubick134be1d2018-10-30 15:05:04 -040079 _getRasterN32PremulSurface: function() {},
Kevin Lubick217056c2018-09-20 17:39:31 -040080
Kevin Lubick1a05fce2018-11-20 12:51:16 -050081 // The testing object is meant to expose internal functions
82 // for more fine-grained testing, e.g. parseColor
83 _testing: {},
84
Kevin Lubick217056c2018-09-20 17:39:31 -040085 // Objects and properties on CanvasKit
86
Kevin Lubickd3cfbca2019-03-15 15:36:29 -040087 RSXFormBuilder: function() {},
88
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -050089 ShapedText: {
90 // public API (from C++ bindings)
91 getBounds: function() {},
92 },
93
Kevin Lubick006a6f32018-10-19 14:34:34 -040094 SkCanvas: {
95 // public API (from C++ bindings)
96 clear: function() {},
Kevin Lubickeb2f6b02018-11-29 15:07:02 -050097 clipPath: function() {},
Kevin Lubick5d5723c2018-12-07 10:09:11 -050098 clipRect: function() {},
99 concat: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500100 drawArc: function() {},
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500101 drawImage: function() {},
102 drawImageRect: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500103 drawLine: function() {},
104 drawOval: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400105 drawPaint: function() {},
106 drawPath: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -0500107 drawRect: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500108 drawRoundRect: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500109 drawShadow: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -0500110 drawText: function() {},
Kevin Lubickec4903d2019-01-14 08:36:08 -0500111 drawTextBlob: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -0500112 drawVertices: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400113 flush: function() {},
Kevin Lubick5d5723c2018-12-07 10:09:11 -0500114 getTotalMatrix: function() {},
Kevin Lubick543f3522019-03-08 10:04:28 -0500115 makeSurface: function() {},
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500116 restore: function() {},
Kevin Lubickb3574c92019-03-06 08:25:36 -0500117 restoreToCount: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400118 rotate: function() {},
119 save: function() {},
Kevin Lubickb3574c92019-03-06 08:25:36 -0500120 saveLayer: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400121 scale: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400122 skew: function() {},
123 translate: function() {},
124
125 // private API
Kevin Lubickec4903d2019-01-14 08:36:08 -0500126 _drawSimpleText: function() {},
Kevin Lubick52b9f372018-12-04 13:57:36 -0500127 _readPixels: function() {},
128 _writePixels: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400129 delete: function() {},
130 },
131
Kevin Lubick35ac0382019-01-02 15:13:57 -0500132 SkFont: {
133 // public API (from C++ bindings)
134 getScaleX: function() {},
135 getSize: function() {},
136 getSkewX: function() {},
137 getTypeface: function() {},
138 measureText: function() {},
139 setScaleX: function() {},
140 setSize: function() {},
141 setSkewX: function() {},
142 setTypeface: function() {},
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400143 // private API (from C++ bindings)
144 _getWidths: function() {},
Kevin Lubick35ac0382019-01-02 15:13:57 -0500145 },
146
Kevin Lubickddd0a332018-12-12 10:35:13 -0500147 SkFontMgr: {
148 // public API (from C++ bindings)
149 RefDefault: function() {},
150 countFamilies: function() {},
151
152 // private API
153 _makeTypefaceFromData: function() {},
154 },
155
Kevin Lubick006a6f32018-10-19 14:34:34 -0400156 SkImage: {
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500157 // public API (from C++ bindings)
158 height: function() {},
159 width: function() {},
Alexander Khovansky3e119332018-11-15 02:01:19 +0300160 // private API
161 _encodeToData: function() {},
162 _encodeToDataWithFormat: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400163 },
164
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500165 SkMatrix: {
Kevin Lubickb9db3902018-11-26 11:47:54 -0500166 identity: function() {},
Kevin Lubickf3555182019-03-14 10:55:10 -0400167 invert: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500168 mapPoints: function() {},
169 multiply: function() {},
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500170 rotated: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500171 scaled: function() {},
172 skewed: function() {},
173 translated: function() {},
174 },
175
176 SkPaint: {
177 // public API (from C++ bindings)
178 /** @return {CanvasKit.SkPaint} */
179 copy: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -0500180 getBlendMode: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500181 getColor: function() {},
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500182 getFilterQuality: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500183 getStrokeCap: function() {},
184 getStrokeJoin: function() {},
185 getStrokeMiter: function() {},
186 getStrokeWidth: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500187 setAntiAlias: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -0500188 setBlendMode: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500189 setColor: function() {},
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500190 setFilterQuality: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500191 setMaskFilter: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500192 setPathEffect: function() {},
193 setShader: function() {},
194 setStrokeCap: function() {},
195 setStrokeJoin: function() {},
196 setStrokeMiter: function() {},
197 setStrokeWidth: function() {},
198 setStyle: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500199
200 //private API
201 delete: function() {},
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500202 },
203
Kevin Lubick006a6f32018-10-19 14:34:34 -0400204 SkPath: {
205 // public API (from C++ bindings)
Kevin Lubickb9db3902018-11-26 11:47:54 -0500206 computeTightBounds: function() {},
Kevin Lubick1646e7d2018-12-07 13:03:08 -0500207 contains: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500208 /** @return {CanvasKit.SkPath} */
209 copy: function() {},
210 countPoints: function() {},
211 equals: function() {},
212 getBounds: function() {},
213 getFillType: function() {},
214 getPoint: function() {},
Kevin Lubick1646e7d2018-12-07 13:03:08 -0500215 isEmpty: function() {},
Kevin Lubick2b79d1c2018-12-14 16:10:38 -0500216 isVolatile: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500217 reset: function() {},
218 rewind: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500219 setFillType: function() {},
Kevin Lubick2b79d1c2018-12-14 16:10:38 -0500220 setIsVolatile: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500221 toSVGString: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400222
223 // private API
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500224 _addArc: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400225 _addPath: function() {},
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500226 _addRect: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500227 _addRoundRect: function() {},
Alexander Khovansky3e119332018-11-15 02:01:19 +0300228 _arc: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400229 _arcTo: function() {},
230 _close: function() {},
231 _conicTo: function() {},
232 _cubicTo: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400233 _dash: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400234 _lineTo: function() {},
235 _moveTo: function() {},
236 _op: function() {},
237 _quadTo: function() {},
238 _rect: function() {},
239 _simplify: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400240 _stroke: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400241 _transform: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400242 _trim: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400243 delete: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500244 dump: function() {},
245 dumpHex: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400246 },
247
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400248 SkPathMeasure: {
249 getLength: function() {},
250 getPosTan: function() {},
251 isClosed: function() {},
252 nextContour: function() {},
253 },
254
Kevin Lubick006a6f32018-10-19 14:34:34 -0400255 SkRect: {
256 fLeft: {},
257 fTop: {},
258 fRight: {},
259 fBottom: {},
260 },
261
262 SkSurface: {
263 // public API (from C++ bindings)
264 /** @return {CanvasKit.SkCanvas} */
265 getCanvas: function() {},
266 /** @return {CanvasKit.SkImage} */
267 makeImageSnapshot: function() {},
Kevin Lubick543f3522019-03-08 10:04:28 -0500268 makeSurface: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400269
270 // private API
271 _flush: function() {},
272 _getRasterN32PremulSurface: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400273 delete: function() {},
274 },
275
Kevin Lubickec4903d2019-01-14 08:36:08 -0500276 SkTextBlob: {
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400277 // public API (both C++ and JS bindings)
278 MakeFromRSXform: function() {},
Kevin Lubickec4903d2019-01-14 08:36:08 -0500279 MakeFromText: function() {},
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400280 MakeOnPath: function() {},
281 // private API (from C++ bindings)
282 _MakeFromRSXform: function() {},
Kevin Lubickec4903d2019-01-14 08:36:08 -0500283 _MakeFromText: function() {},
284 },
285
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400286 SkVertices: {
287 // public API (from C++ bindings)
Kevin Lubick12c0e502018-11-28 12:51:56 -0500288 bounds: function() {},
289 mode: function() {},
290 uniqueID: function() {},
291 vertexCount: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400292
293 // private API
294 /** @return {CanvasKit.SkVertices} */
295 _applyBones: function() {},
296 },
297
Kevin Lubick006a6f32018-10-19 14:34:34 -0400298 // Constants and Enums
299 gpu: {},
300 skottie: {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400301
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500302 TRANSPARENT: {},
303 RED: {},
304 BLUE: {},
305 YELLOW: {},
306 CYAN: {},
307 BLACK: {},
Kevin Lubickea905ec2018-11-30 14:05:58 -0500308 WHITE: {},
309
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500310 MOVE_VERB: {},
311 LINE_VERB: {},
312 QUAD_VERB: {},
313 CONIC_VERB: {},
314 CUBIC_VERB: {},
315 CLOSE_VERB: {},
316
Kevin Lubickea905ec2018-11-30 14:05:58 -0500317 AlphaType: {
318 Opaque: {},
319 Premul: {},
320 Unpremul: {},
321 },
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500322
323 BlendMode: {
324 Clear: {},
325 Src: {},
326 Dst: {},
327 SrcOver: {},
328 DstOver: {},
329 SrcIn: {},
330 DstIn: {},
331 SrcOut: {},
332 DstOut: {},
333 SrcATop: {},
334 DstATop: {},
335 Xor: {},
336 Plus: {},
337 Modulate: {},
338 Screen: {},
339 Overlay: {},
340 Darken: {},
341 Lighten: {},
342 ColorDodge: {},
343 ColorBurn: {},
344 HardLight: {},
345 SoftLight: {},
346 Difference: {},
347 Exclusion: {},
348 Multiply: {},
349 Hue: {},
350 Saturation: {},
351 Color: {},
352 Luminosity: {},
353 },
354
355 BlurStyle: {
356 Normal: {},
357 Solid: {},
358 Outer: {},
359 Inner: {},
360 },
361
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500362 ClipOp: {
363 Difference: {},
364 Intersect: {},
365 },
366
Kevin Lubickea905ec2018-11-30 14:05:58 -0500367 ColorType: {
368 Alpha_8: {},
369 RGB_565: {},
370 ARGB_4444: {},
371 RGBA_8888: {},
372 RGB_888x: {},
373 BGRA_8888: {},
374 RGBA_1010102: {},
375 RGB_101010x: {},
376 Gray_8: {},
377 RGBA_F16: {},
378 RGBA_F32: {},
379 },
380
Kevin Lubick006a6f32018-10-19 14:34:34 -0400381 FillType: {
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500382 Winding: {},
383 EvenOdd: {},
384 InverseWinding: {},
385 InverseEvenOdd: {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400386 },
387
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500388 FilterQuality: {
389 None: {},
390 Low: {},
391 Medium: {},
392 High: {},
393 },
394
Alexander Khovansky3e119332018-11-15 02:01:19 +0300395 ImageFormat: {
396 PNG: {},
397 JPEG: {},
398 },
399
Kevin Lubickb9db3902018-11-26 11:47:54 -0500400 PaintStyle: {
401 Fill: {},
402 Stroke: {},
403 StrokeAndFill: {},
404 },
405
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500406 PathOp: {
407 Difference: {},
408 Intersect: {},
409 Union: {},
410 XOR: {},
411 ReverseDifference: {},
412 },
413
Kevin Lubickb9db3902018-11-26 11:47:54 -0500414 StrokeCap: {
415 Butt: {},
416 Round: {},
417 Square: {},
418 },
419
420 StrokeJoin: {
421 Miter: {},
422 Round: {},
423 Bevel: {},
424 },
425
Kevin Lubickec4903d2019-01-14 08:36:08 -0500426 TextEncoding: {
427 UTF8: {},
428 UTF16: {},
429 UTF32: {},
430 GlyphID: {},
431 },
432
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500433 TileMode: {
434 Clamp: {},
435 Repeat: {},
436 Mirror: {},
Kevin Lubickd29edd72018-12-07 08:29:52 -0500437 Decal: {},
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500438 },
439
440 VertexMode: {
441 Triangles: {},
442 TrianglesStrip: {},
443 TriangleFan: {},
444 },
445
Kevin Lubick006a6f32018-10-19 14:34:34 -0400446 // Things Enscriptem adds for us
447
Kevin Lubick53965c92018-10-11 08:51:55 -0400448 /** Represents the heap of the WASM code
449 * @type {ArrayBuffer}
450 */
451 buffer: {},
452 /**
453 * @type {Float32Array}
454 */
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400455 HEAPF32: {},
Kevin Lubick53965c92018-10-11 08:51:55 -0400456 /**
457 * @type {Uint8Array}
458 */
459 HEAPU8: {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400460 /**
461 * @type {Uint16Array}
462 */
463 HEAPU16: {},
464 /**
465 * @type {Int32Array}
466 */
467 HEAP32: {},
Kevin Lubickf5ea37f2019-02-28 10:06:18 -0500468 /**
469 * @type {Uint32Array}
470 */
471 HEAPU32: {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400472 _malloc: function() {},
473 _free: function() {},
474 onRuntimeInitialized: function() {},
475};
Kevin Lubick217056c2018-09-20 17:39:31 -0400476
Kevin Lubick006a6f32018-10-19 14:34:34 -0400477// Public API things that are newly declared in the JS should go here.
478// It's not enough to declare them above, because closure can still erase them
479// unless they go on the prototype.
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500480CanvasKit.SkPath.prototype.addArc = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400481CanvasKit.SkPath.prototype.addPath = function() {};
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500482CanvasKit.SkPath.prototype.addRect = function() {};
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500483CanvasKit.SkPath.prototype.addRoundRect = function() {};
Alexander Khovansky3e119332018-11-15 02:01:19 +0300484CanvasKit.SkPath.prototype.arc = function() {};
Kevin Lubick006a6f32018-10-19 14:34:34 -0400485CanvasKit.SkPath.prototype.arcTo = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400486CanvasKit.SkPath.prototype.close = function() {};
Kevin Lubick006a6f32018-10-19 14:34:34 -0400487CanvasKit.SkPath.prototype.conicTo = function() {};
488CanvasKit.SkPath.prototype.cubicTo = function() {};
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400489CanvasKit.SkPath.prototype.dash = function() {};
Kevin Lubick006a6f32018-10-19 14:34:34 -0400490CanvasKit.SkPath.prototype.lineTo = function() {};
491CanvasKit.SkPath.prototype.moveTo = function() {};
492CanvasKit.SkPath.prototype.op = function() {};
493CanvasKit.SkPath.prototype.quadTo = function() {};
494CanvasKit.SkPath.prototype.rect = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400495CanvasKit.SkPath.prototype.simplify = function() {};
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400496CanvasKit.SkPath.prototype.stroke = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400497CanvasKit.SkPath.prototype.transform = function() {};
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400498CanvasKit.SkPath.prototype.trim = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400499
Kevin Lubick5b90b842018-10-17 07:57:18 -0400500CanvasKit.SkSurface.prototype.dispose = function() {};
Kevin Lubick359a7e32019-03-19 09:34:37 -0400501CanvasKit.SkSurface.prototype.flush = function() {};
502CanvasKit.SkSurface.prototype.requestAnimationFrame = function() {};
Kevin Lubick53965c92018-10-11 08:51:55 -0400503
Kevin Lubick12c0e502018-11-28 12:51:56 -0500504/** @return {CanvasKit.SkVertices} */
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400505CanvasKit.SkVertices.prototype.applyBones = function() {};
506
Alexander Khovansky3e119332018-11-15 02:01:19 +0300507CanvasKit.SkImage.prototype.encodeToData = function() {};
508
Kevin Lubickec4903d2019-01-14 08:36:08 -0500509CanvasKit.SkCanvas.prototype.drawText = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500510/** @return {Uint8Array} */
511CanvasKit.SkCanvas.prototype.readPixels = function() {};
512CanvasKit.SkCanvas.prototype.writePixels = function() {};
513
Kevin Lubickddd0a332018-12-12 10:35:13 -0500514CanvasKit.SkFontMgr.prototype.MakeTypefaceFromData = function() {};
515
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400516CanvasKit.SkFont.prototype.getWidths = function() {};
517
518CanvasKit.RSXFormBuilder.prototype.build = function() {};
519CanvasKit.RSXFormBuilder.prototype.delete = function() {};
520CanvasKit.RSXFormBuilder.prototype.push = function() {};
521
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400522// Define StrokeOpts object
523var StrokeOpts = {};
524StrokeOpts.prototype.width;
525StrokeOpts.prototype.miter_limit;
526StrokeOpts.prototype.cap;
527StrokeOpts.prototype.join;
Kevin Lubick1646e7d2018-12-07 13:03:08 -0500528StrokeOpts.prototype.precision;
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400529
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500530// Define everything created in the canvas2d spec here
Kevin Lubickb9db3902018-11-26 11:47:54 -0500531var HTMLCanvas = {};
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500532HTMLCanvas.prototype.decodeImage = function() {};
533HTMLCanvas.prototype.dispose = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500534HTMLCanvas.prototype.getContext = function() {};
Kevin Lubick8e4a3312018-12-14 15:03:41 -0500535HTMLCanvas.prototype.loadFont = function() {};
Kevin Lubicka40f8322018-12-17 16:01:36 -0500536HTMLCanvas.prototype.makePath2D = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500537HTMLCanvas.prototype.toDataURL = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500538
539var CanvasRenderingContext2D = {};
540CanvasRenderingContext2D.prototype.addHitRegion = function() {};
541CanvasRenderingContext2D.prototype.arc = function() {};
542CanvasRenderingContext2D.prototype.arcTo = function() {};
543CanvasRenderingContext2D.prototype.beginPath = function() {};
544CanvasRenderingContext2D.prototype.bezierCurveTo = function() {};
545CanvasRenderingContext2D.prototype.clearHitRegions = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500546CanvasRenderingContext2D.prototype.clearRect = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500547CanvasRenderingContext2D.prototype.clip = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500548CanvasRenderingContext2D.prototype.closePath = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500549CanvasRenderingContext2D.prototype.createImageData = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500550CanvasRenderingContext2D.prototype.createLinearGradient = function() {};
Kevin Lubickd29edd72018-12-07 08:29:52 -0500551CanvasRenderingContext2D.prototype.createPattern = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500552CanvasRenderingContext2D.prototype.createRadialGradient = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500553CanvasRenderingContext2D.prototype.drawFocusIfNeeded = function() {};
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500554CanvasRenderingContext2D.prototype.drawImage = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500555CanvasRenderingContext2D.prototype.ellipse = function() {};
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500556CanvasRenderingContext2D.prototype.fill = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500557CanvasRenderingContext2D.prototype.fillRect = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500558CanvasRenderingContext2D.prototype.fillText = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500559CanvasRenderingContext2D.prototype.getImageData = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500560CanvasRenderingContext2D.prototype.getLineDash = function() {};
Kevin Lubick1646e7d2018-12-07 13:03:08 -0500561CanvasRenderingContext2D.prototype.isPointInPath = function() {};
562CanvasRenderingContext2D.prototype.isPointInStroke = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500563CanvasRenderingContext2D.prototype.lineTo = function() {};
564CanvasRenderingContext2D.prototype.measureText = function() {};
565CanvasRenderingContext2D.prototype.moveTo = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500566CanvasRenderingContext2D.prototype.putImageData = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500567CanvasRenderingContext2D.prototype.quadraticCurveTo = function() {};
568CanvasRenderingContext2D.prototype.rect = function() {};
569CanvasRenderingContext2D.prototype.removeHitRegion = function() {};
570CanvasRenderingContext2D.prototype.resetTransform = function() {};
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500571CanvasRenderingContext2D.prototype.restore = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500572CanvasRenderingContext2D.prototype.rotate = function() {};
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500573CanvasRenderingContext2D.prototype.save = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500574CanvasRenderingContext2D.prototype.scale = function() {};
575CanvasRenderingContext2D.prototype.scrollPathIntoView = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500576CanvasRenderingContext2D.prototype.setLineDash = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500577CanvasRenderingContext2D.prototype.setTransform = function() {};
578CanvasRenderingContext2D.prototype.stroke = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500579CanvasRenderingContext2D.prototype.strokeRect = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500580CanvasRenderingContext2D.prototype.strokeText = function() {};
581CanvasRenderingContext2D.prototype.transform = function() {};
582CanvasRenderingContext2D.prototype.translate = function() {};
583
Kevin Lubicka40f8322018-12-17 16:01:36 -0500584var Path2D = {};
585Path2D.prototype.addPath = function() {};
586Path2D.prototype.arc = function() {};
587Path2D.prototype.arcTo = function() {};
588Path2D.prototype.bezierCurveTo = function() {};
589Path2D.prototype.closePath = function() {};
590Path2D.prototype.ellipse = function() {};
591Path2D.prototype.lineTo = function() {};
592Path2D.prototype.moveTo = function() {};
593Path2D.prototype.quadraticCurveTo = function() {};
594Path2D.prototype.rect = function() {};
595
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500596var LinearCanvasGradient = {};
597LinearCanvasGradient.prototype.addColorStop = function() {};
598var RadialCanvasGradient = {};
599RadialCanvasGradient.prototype.addColorStop = function() {};
Kevin Lubickd29edd72018-12-07 08:29:52 -0500600var CanvasPattern = {};
601CanvasPattern.prototype.setTransform = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500602
Kevin Lubick52b9f372018-12-04 13:57:36 -0500603var ImageData = {
604 /**
605 * @type {Uint8ClampedArray}
606 */
607 data: {},
608 height: {},
609 width: {},
610};
611
Kevin Lubickd29edd72018-12-07 08:29:52 -0500612var DOMMatrix = {
613 a: {},
614 b: {},
615 c: {},
616 d: {},
617 e: {},
618 f: {},
619};
620
Kevin Lubick217056c2018-09-20 17:39:31 -0400621// 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 -0500622function loadWebAssemblyModule() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500623
624var DOMMatrix = {};