blob: 0b38b3b3f68ad68115a23634fd48cf48435c4306 [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 Lubick1ba9c4d2019-02-22 10:04:06 -050087 ShapedText: {
88 // public API (from C++ bindings)
89 getBounds: function() {},
90 },
91
Kevin Lubick006a6f32018-10-19 14:34:34 -040092 SkCanvas: {
93 // public API (from C++ bindings)
94 clear: function() {},
Kevin Lubickeb2f6b02018-11-29 15:07:02 -050095 clipPath: function() {},
Kevin Lubick5d5723c2018-12-07 10:09:11 -050096 clipRect: function() {},
97 concat: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -050098 drawArc: function() {},
Kevin Lubick0a1293c2018-12-03 12:31:04 -050099 drawImage: function() {},
100 drawImageRect: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500101 drawLine: function() {},
102 drawOval: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400103 drawPaint: function() {},
104 drawPath: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -0500105 drawRect: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500106 drawRoundRect: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500107 drawShadow: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -0500108 drawText: function() {},
Kevin Lubickec4903d2019-01-14 08:36:08 -0500109 drawTextBlob: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -0500110 drawVertices: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400111 flush: function() {},
Kevin Lubick5d5723c2018-12-07 10:09:11 -0500112 getTotalMatrix: function() {},
Kevin Lubick543f3522019-03-08 10:04:28 -0500113 makeSurface: function() {},
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500114 restore: function() {},
Kevin Lubickb3574c92019-03-06 08:25:36 -0500115 restoreToCount: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400116 rotate: function() {},
117 save: function() {},
Kevin Lubickb3574c92019-03-06 08:25:36 -0500118 saveLayer: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400119 scale: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400120 skew: function() {},
121 translate: function() {},
122
123 // private API
Kevin Lubickec4903d2019-01-14 08:36:08 -0500124 _drawSimpleText: function() {},
Kevin Lubick52b9f372018-12-04 13:57:36 -0500125 _readPixels: function() {},
126 _writePixels: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400127 delete: function() {},
128 },
129
Kevin Lubick35ac0382019-01-02 15:13:57 -0500130 SkFont: {
131 // public API (from C++ bindings)
132 getScaleX: function() {},
133 getSize: function() {},
134 getSkewX: function() {},
135 getTypeface: function() {},
136 measureText: function() {},
137 setScaleX: function() {},
138 setSize: function() {},
139 setSkewX: function() {},
140 setTypeface: function() {},
141 },
142
Kevin Lubickddd0a332018-12-12 10:35:13 -0500143 SkFontMgr: {
144 // public API (from C++ bindings)
145 RefDefault: function() {},
146 countFamilies: function() {},
147
148 // private API
149 _makeTypefaceFromData: function() {},
150 },
151
Kevin Lubick006a6f32018-10-19 14:34:34 -0400152 SkImage: {
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500153 // public API (from C++ bindings)
154 height: function() {},
155 width: function() {},
Alexander Khovansky3e119332018-11-15 02:01:19 +0300156 // private API
157 _encodeToData: function() {},
158 _encodeToDataWithFormat: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400159 },
160
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500161 SkMatrix: {
Kevin Lubickb9db3902018-11-26 11:47:54 -0500162 identity: function() {},
Kevin Lubickf3555182019-03-14 10:55:10 -0400163 invert: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500164 mapPoints: function() {},
165 multiply: function() {},
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500166 rotated: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500167 scaled: function() {},
168 skewed: function() {},
169 translated: function() {},
170 },
171
172 SkPaint: {
173 // public API (from C++ bindings)
174 /** @return {CanvasKit.SkPaint} */
175 copy: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -0500176 getBlendMode: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500177 getColor: function() {},
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500178 getFilterQuality: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500179 getStrokeCap: function() {},
180 getStrokeJoin: function() {},
181 getStrokeMiter: function() {},
182 getStrokeWidth: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500183 setAntiAlias: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -0500184 setBlendMode: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500185 setColor: function() {},
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500186 setFilterQuality: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500187 setMaskFilter: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500188 setPathEffect: function() {},
189 setShader: function() {},
190 setStrokeCap: function() {},
191 setStrokeJoin: function() {},
192 setStrokeMiter: function() {},
193 setStrokeWidth: function() {},
194 setStyle: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500195
196 //private API
197 delete: function() {},
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500198 },
199
Kevin Lubick006a6f32018-10-19 14:34:34 -0400200 SkPath: {
201 // public API (from C++ bindings)
Kevin Lubickb9db3902018-11-26 11:47:54 -0500202 computeTightBounds: function() {},
Kevin Lubick1646e7d2018-12-07 13:03:08 -0500203 contains: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500204 /** @return {CanvasKit.SkPath} */
205 copy: function() {},
206 countPoints: function() {},
207 equals: function() {},
208 getBounds: function() {},
209 getFillType: function() {},
210 getPoint: function() {},
Kevin Lubick1646e7d2018-12-07 13:03:08 -0500211 isEmpty: function() {},
Kevin Lubick2b79d1c2018-12-14 16:10:38 -0500212 isVolatile: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500213 reset: function() {},
214 rewind: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500215 setFillType: function() {},
Kevin Lubick2b79d1c2018-12-14 16:10:38 -0500216 setIsVolatile: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500217 toSVGString: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400218
219 // private API
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500220 _addArc: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400221 _addPath: function() {},
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500222 _addRect: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500223 _addRoundRect: function() {},
Alexander Khovansky3e119332018-11-15 02:01:19 +0300224 _arc: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400225 _arcTo: function() {},
226 _close: function() {},
227 _conicTo: function() {},
228 _cubicTo: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400229 _dash: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400230 _lineTo: function() {},
231 _moveTo: function() {},
232 _op: function() {},
233 _quadTo: function() {},
234 _rect: function() {},
235 _simplify: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400236 _stroke: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400237 _transform: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400238 _trim: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400239 delete: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500240 dump: function() {},
241 dumpHex: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400242 },
243
244 SkRect: {
245 fLeft: {},
246 fTop: {},
247 fRight: {},
248 fBottom: {},
249 },
250
251 SkSurface: {
252 // public API (from C++ bindings)
253 /** @return {CanvasKit.SkCanvas} */
254 getCanvas: function() {},
255 /** @return {CanvasKit.SkImage} */
256 makeImageSnapshot: function() {},
Kevin Lubick543f3522019-03-08 10:04:28 -0500257 makeSurface: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400258
259 // private API
260 _flush: function() {},
261 _getRasterN32PremulSurface: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400262 delete: function() {},
263 },
264
Kevin Lubickec4903d2019-01-14 08:36:08 -0500265 SkTextBlob: {
266 MakeFromText: function() {},
267 _MakeFromText: function() {},
268 },
269
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400270 SkVertices: {
271 // public API (from C++ bindings)
Kevin Lubick12c0e502018-11-28 12:51:56 -0500272 bounds: function() {},
273 mode: function() {},
274 uniqueID: function() {},
275 vertexCount: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400276
277 // private API
278 /** @return {CanvasKit.SkVertices} */
279 _applyBones: function() {},
280 },
281
Kevin Lubick006a6f32018-10-19 14:34:34 -0400282 // Constants and Enums
283 gpu: {},
284 skottie: {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400285
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500286 TRANSPARENT: {},
287 RED: {},
288 BLUE: {},
289 YELLOW: {},
290 CYAN: {},
291 BLACK: {},
Kevin Lubickea905ec2018-11-30 14:05:58 -0500292 WHITE: {},
293
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500294 MOVE_VERB: {},
295 LINE_VERB: {},
296 QUAD_VERB: {},
297 CONIC_VERB: {},
298 CUBIC_VERB: {},
299 CLOSE_VERB: {},
300
Kevin Lubickea905ec2018-11-30 14:05:58 -0500301 AlphaType: {
302 Opaque: {},
303 Premul: {},
304 Unpremul: {},
305 },
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500306
307 BlendMode: {
308 Clear: {},
309 Src: {},
310 Dst: {},
311 SrcOver: {},
312 DstOver: {},
313 SrcIn: {},
314 DstIn: {},
315 SrcOut: {},
316 DstOut: {},
317 SrcATop: {},
318 DstATop: {},
319 Xor: {},
320 Plus: {},
321 Modulate: {},
322 Screen: {},
323 Overlay: {},
324 Darken: {},
325 Lighten: {},
326 ColorDodge: {},
327 ColorBurn: {},
328 HardLight: {},
329 SoftLight: {},
330 Difference: {},
331 Exclusion: {},
332 Multiply: {},
333 Hue: {},
334 Saturation: {},
335 Color: {},
336 Luminosity: {},
337 },
338
339 BlurStyle: {
340 Normal: {},
341 Solid: {},
342 Outer: {},
343 Inner: {},
344 },
345
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500346 ClipOp: {
347 Difference: {},
348 Intersect: {},
349 },
350
Kevin Lubickea905ec2018-11-30 14:05:58 -0500351 ColorType: {
352 Alpha_8: {},
353 RGB_565: {},
354 ARGB_4444: {},
355 RGBA_8888: {},
356 RGB_888x: {},
357 BGRA_8888: {},
358 RGBA_1010102: {},
359 RGB_101010x: {},
360 Gray_8: {},
361 RGBA_F16: {},
362 RGBA_F32: {},
363 },
364
Kevin Lubick006a6f32018-10-19 14:34:34 -0400365 FillType: {
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500366 Winding: {},
367 EvenOdd: {},
368 InverseWinding: {},
369 InverseEvenOdd: {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400370 },
371
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500372 FilterQuality: {
373 None: {},
374 Low: {},
375 Medium: {},
376 High: {},
377 },
378
Alexander Khovansky3e119332018-11-15 02:01:19 +0300379 ImageFormat: {
380 PNG: {},
381 JPEG: {},
382 },
383
Kevin Lubickb9db3902018-11-26 11:47:54 -0500384 PaintStyle: {
385 Fill: {},
386 Stroke: {},
387 StrokeAndFill: {},
388 },
389
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500390 PathOp: {
391 Difference: {},
392 Intersect: {},
393 Union: {},
394 XOR: {},
395 ReverseDifference: {},
396 },
397
Kevin Lubickb9db3902018-11-26 11:47:54 -0500398 StrokeCap: {
399 Butt: {},
400 Round: {},
401 Square: {},
402 },
403
404 StrokeJoin: {
405 Miter: {},
406 Round: {},
407 Bevel: {},
408 },
409
Kevin Lubickec4903d2019-01-14 08:36:08 -0500410 TextEncoding: {
411 UTF8: {},
412 UTF16: {},
413 UTF32: {},
414 GlyphID: {},
415 },
416
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500417 TileMode: {
418 Clamp: {},
419 Repeat: {},
420 Mirror: {},
Kevin Lubickd29edd72018-12-07 08:29:52 -0500421 Decal: {},
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500422 },
423
424 VertexMode: {
425 Triangles: {},
426 TrianglesStrip: {},
427 TriangleFan: {},
428 },
429
Kevin Lubick006a6f32018-10-19 14:34:34 -0400430 // Things Enscriptem adds for us
431
Kevin Lubick53965c92018-10-11 08:51:55 -0400432 /** Represents the heap of the WASM code
433 * @type {ArrayBuffer}
434 */
435 buffer: {},
436 /**
437 * @type {Float32Array}
438 */
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400439 HEAPF32: {},
Kevin Lubick53965c92018-10-11 08:51:55 -0400440 /**
441 * @type {Uint8Array}
442 */
443 HEAPU8: {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400444 /**
445 * @type {Uint16Array}
446 */
447 HEAPU16: {},
448 /**
449 * @type {Int32Array}
450 */
451 HEAP32: {},
Kevin Lubickf5ea37f2019-02-28 10:06:18 -0500452 /**
453 * @type {Uint32Array}
454 */
455 HEAPU32: {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400456 _malloc: function() {},
457 _free: function() {},
458 onRuntimeInitialized: function() {},
459};
Kevin Lubick217056c2018-09-20 17:39:31 -0400460
Kevin Lubick006a6f32018-10-19 14:34:34 -0400461// Public API things that are newly declared in the JS should go here.
462// It's not enough to declare them above, because closure can still erase them
463// unless they go on the prototype.
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500464CanvasKit.SkPath.prototype.addArc = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400465CanvasKit.SkPath.prototype.addPath = function() {};
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500466CanvasKit.SkPath.prototype.addRect = function() {};
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500467CanvasKit.SkPath.prototype.addRoundRect = function() {};
Alexander Khovansky3e119332018-11-15 02:01:19 +0300468CanvasKit.SkPath.prototype.arc = function() {};
Kevin Lubick006a6f32018-10-19 14:34:34 -0400469CanvasKit.SkPath.prototype.arcTo = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400470CanvasKit.SkPath.prototype.close = function() {};
Kevin Lubick006a6f32018-10-19 14:34:34 -0400471CanvasKit.SkPath.prototype.conicTo = function() {};
472CanvasKit.SkPath.prototype.cubicTo = function() {};
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400473CanvasKit.SkPath.prototype.dash = function() {};
Kevin Lubick006a6f32018-10-19 14:34:34 -0400474CanvasKit.SkPath.prototype.lineTo = function() {};
475CanvasKit.SkPath.prototype.moveTo = function() {};
476CanvasKit.SkPath.prototype.op = function() {};
477CanvasKit.SkPath.prototype.quadTo = function() {};
478CanvasKit.SkPath.prototype.rect = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400479CanvasKit.SkPath.prototype.simplify = function() {};
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400480CanvasKit.SkPath.prototype.stroke = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400481CanvasKit.SkPath.prototype.transform = function() {};
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400482CanvasKit.SkPath.prototype.trim = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400483
Kevin Lubick53965c92018-10-11 08:51:55 -0400484CanvasKit.SkSurface.prototype.flush = function() {};
Kevin Lubick5b90b842018-10-17 07:57:18 -0400485CanvasKit.SkSurface.prototype.dispose = function() {};
Kevin Lubick53965c92018-10-11 08:51:55 -0400486
Kevin Lubick12c0e502018-11-28 12:51:56 -0500487/** @return {CanvasKit.SkVertices} */
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400488CanvasKit.SkVertices.prototype.applyBones = function() {};
489
Alexander Khovansky3e119332018-11-15 02:01:19 +0300490CanvasKit.SkImage.prototype.encodeToData = function() {};
491
Kevin Lubickec4903d2019-01-14 08:36:08 -0500492CanvasKit.SkCanvas.prototype.drawText = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500493/** @return {Uint8Array} */
494CanvasKit.SkCanvas.prototype.readPixels = function() {};
495CanvasKit.SkCanvas.prototype.writePixels = function() {};
496
Kevin Lubickddd0a332018-12-12 10:35:13 -0500497CanvasKit.SkFontMgr.prototype.MakeTypefaceFromData = function() {};
498
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400499// Define StrokeOpts object
500var StrokeOpts = {};
501StrokeOpts.prototype.width;
502StrokeOpts.prototype.miter_limit;
503StrokeOpts.prototype.cap;
504StrokeOpts.prototype.join;
Kevin Lubick1646e7d2018-12-07 13:03:08 -0500505StrokeOpts.prototype.precision;
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400506
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500507// Define everything created in the canvas2d spec here
Kevin Lubickb9db3902018-11-26 11:47:54 -0500508var HTMLCanvas = {};
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500509HTMLCanvas.prototype.decodeImage = function() {};
510HTMLCanvas.prototype.dispose = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500511HTMLCanvas.prototype.getContext = function() {};
Kevin Lubick8e4a3312018-12-14 15:03:41 -0500512HTMLCanvas.prototype.loadFont = function() {};
Kevin Lubicka40f8322018-12-17 16:01:36 -0500513HTMLCanvas.prototype.makePath2D = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500514HTMLCanvas.prototype.toDataURL = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500515
516var CanvasRenderingContext2D = {};
517CanvasRenderingContext2D.prototype.addHitRegion = function() {};
518CanvasRenderingContext2D.prototype.arc = function() {};
519CanvasRenderingContext2D.prototype.arcTo = function() {};
520CanvasRenderingContext2D.prototype.beginPath = function() {};
521CanvasRenderingContext2D.prototype.bezierCurveTo = function() {};
522CanvasRenderingContext2D.prototype.clearHitRegions = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500523CanvasRenderingContext2D.prototype.clearRect = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500524CanvasRenderingContext2D.prototype.clip = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500525CanvasRenderingContext2D.prototype.closePath = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500526CanvasRenderingContext2D.prototype.createImageData = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500527CanvasRenderingContext2D.prototype.createLinearGradient = function() {};
Kevin Lubickd29edd72018-12-07 08:29:52 -0500528CanvasRenderingContext2D.prototype.createPattern = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500529CanvasRenderingContext2D.prototype.createRadialGradient = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500530CanvasRenderingContext2D.prototype.drawFocusIfNeeded = function() {};
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500531CanvasRenderingContext2D.prototype.drawImage = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500532CanvasRenderingContext2D.prototype.ellipse = function() {};
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500533CanvasRenderingContext2D.prototype.fill = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500534CanvasRenderingContext2D.prototype.fillRect = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500535CanvasRenderingContext2D.prototype.fillText = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500536CanvasRenderingContext2D.prototype.getImageData = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500537CanvasRenderingContext2D.prototype.getLineDash = function() {};
Kevin Lubick1646e7d2018-12-07 13:03:08 -0500538CanvasRenderingContext2D.prototype.isPointInPath = function() {};
539CanvasRenderingContext2D.prototype.isPointInStroke = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500540CanvasRenderingContext2D.prototype.lineTo = function() {};
541CanvasRenderingContext2D.prototype.measureText = function() {};
542CanvasRenderingContext2D.prototype.moveTo = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500543CanvasRenderingContext2D.prototype.putImageData = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500544CanvasRenderingContext2D.prototype.quadraticCurveTo = function() {};
545CanvasRenderingContext2D.prototype.rect = function() {};
546CanvasRenderingContext2D.prototype.removeHitRegion = function() {};
547CanvasRenderingContext2D.prototype.resetTransform = function() {};
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500548CanvasRenderingContext2D.prototype.restore = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500549CanvasRenderingContext2D.prototype.rotate = function() {};
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500550CanvasRenderingContext2D.prototype.save = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500551CanvasRenderingContext2D.prototype.scale = function() {};
552CanvasRenderingContext2D.prototype.scrollPathIntoView = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500553CanvasRenderingContext2D.prototype.setLineDash = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500554CanvasRenderingContext2D.prototype.setTransform = function() {};
555CanvasRenderingContext2D.prototype.stroke = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500556CanvasRenderingContext2D.prototype.strokeRect = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500557CanvasRenderingContext2D.prototype.strokeText = function() {};
558CanvasRenderingContext2D.prototype.transform = function() {};
559CanvasRenderingContext2D.prototype.translate = function() {};
560
Kevin Lubicka40f8322018-12-17 16:01:36 -0500561var Path2D = {};
562Path2D.prototype.addPath = function() {};
563Path2D.prototype.arc = function() {};
564Path2D.prototype.arcTo = function() {};
565Path2D.prototype.bezierCurveTo = function() {};
566Path2D.prototype.closePath = function() {};
567Path2D.prototype.ellipse = function() {};
568Path2D.prototype.lineTo = function() {};
569Path2D.prototype.moveTo = function() {};
570Path2D.prototype.quadraticCurveTo = function() {};
571Path2D.prototype.rect = function() {};
572
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500573var LinearCanvasGradient = {};
574LinearCanvasGradient.prototype.addColorStop = function() {};
575var RadialCanvasGradient = {};
576RadialCanvasGradient.prototype.addColorStop = function() {};
Kevin Lubickd29edd72018-12-07 08:29:52 -0500577var CanvasPattern = {};
578CanvasPattern.prototype.setTransform = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500579
Kevin Lubick52b9f372018-12-04 13:57:36 -0500580var ImageData = {
581 /**
582 * @type {Uint8ClampedArray}
583 */
584 data: {},
585 height: {},
586 width: {},
587};
588
Kevin Lubickd29edd72018-12-07 08:29:52 -0500589var DOMMatrix = {
590 a: {},
591 b: {},
592 c: {},
593 d: {},
594 e: {},
595 f: {},
596};
597
Kevin Lubick217056c2018-09-20 17:39:31 -0400598// 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 -0500599function loadWebAssemblyModule() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500600
601var DOMMatrix = {};