blob: af2dc3ace893facad2058ebf9a9f94816f0f4632 [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() {},
163 mapPoints: function() {},
164 multiply: function() {},
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500165 rotated: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500166 scaled: function() {},
167 skewed: function() {},
168 translated: function() {},
169 },
170
171 SkPaint: {
172 // public API (from C++ bindings)
173 /** @return {CanvasKit.SkPaint} */
174 copy: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -0500175 getBlendMode: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500176 getColor: function() {},
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500177 getFilterQuality: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500178 getStrokeCap: function() {},
179 getStrokeJoin: function() {},
180 getStrokeMiter: function() {},
181 getStrokeWidth: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500182 setAntiAlias: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -0500183 setBlendMode: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500184 setColor: function() {},
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500185 setFilterQuality: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500186 setMaskFilter: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500187 setPathEffect: function() {},
188 setShader: function() {},
189 setStrokeCap: function() {},
190 setStrokeJoin: function() {},
191 setStrokeMiter: function() {},
192 setStrokeWidth: function() {},
193 setStyle: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500194
195 //private API
196 delete: function() {},
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500197 },
198
Kevin Lubick006a6f32018-10-19 14:34:34 -0400199 SkPath: {
200 // public API (from C++ bindings)
Kevin Lubickb9db3902018-11-26 11:47:54 -0500201 computeTightBounds: function() {},
Kevin Lubick1646e7d2018-12-07 13:03:08 -0500202 contains: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500203 /** @return {CanvasKit.SkPath} */
204 copy: function() {},
205 countPoints: function() {},
206 equals: function() {},
207 getBounds: function() {},
208 getFillType: function() {},
209 getPoint: function() {},
Kevin Lubick1646e7d2018-12-07 13:03:08 -0500210 isEmpty: function() {},
Kevin Lubick2b79d1c2018-12-14 16:10:38 -0500211 isVolatile: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500212 reset: function() {},
213 rewind: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500214 setFillType: function() {},
Kevin Lubick2b79d1c2018-12-14 16:10:38 -0500215 setIsVolatile: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500216 toSVGString: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400217
218 // private API
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500219 _addArc: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400220 _addPath: function() {},
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500221 _addRect: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500222 _addRoundRect: function() {},
Alexander Khovansky3e119332018-11-15 02:01:19 +0300223 _arc: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400224 _arcTo: function() {},
225 _close: function() {},
226 _conicTo: function() {},
227 _cubicTo: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400228 _dash: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400229 _lineTo: function() {},
230 _moveTo: function() {},
231 _op: function() {},
232 _quadTo: function() {},
233 _rect: function() {},
234 _simplify: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400235 _stroke: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400236 _transform: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400237 _trim: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400238 delete: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500239 dump: function() {},
240 dumpHex: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400241 },
242
243 SkRect: {
244 fLeft: {},
245 fTop: {},
246 fRight: {},
247 fBottom: {},
248 },
249
250 SkSurface: {
251 // public API (from C++ bindings)
252 /** @return {CanvasKit.SkCanvas} */
253 getCanvas: function() {},
254 /** @return {CanvasKit.SkImage} */
255 makeImageSnapshot: function() {},
Kevin Lubick543f3522019-03-08 10:04:28 -0500256 makeSurface: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400257
258 // private API
259 _flush: function() {},
260 _getRasterN32PremulSurface: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400261 delete: function() {},
262 },
263
Kevin Lubickec4903d2019-01-14 08:36:08 -0500264 SkTextBlob: {
265 MakeFromText: function() {},
266 _MakeFromText: function() {},
267 },
268
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400269 SkVertices: {
270 // public API (from C++ bindings)
Kevin Lubick12c0e502018-11-28 12:51:56 -0500271 bounds: function() {},
272 mode: function() {},
273 uniqueID: function() {},
274 vertexCount: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400275
276 // private API
277 /** @return {CanvasKit.SkVertices} */
278 _applyBones: function() {},
279 },
280
Kevin Lubick006a6f32018-10-19 14:34:34 -0400281 // Constants and Enums
282 gpu: {},
283 skottie: {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400284
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500285 TRANSPARENT: {},
286 RED: {},
287 BLUE: {},
288 YELLOW: {},
289 CYAN: {},
290 BLACK: {},
Kevin Lubickea905ec2018-11-30 14:05:58 -0500291 WHITE: {},
292
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500293 MOVE_VERB: {},
294 LINE_VERB: {},
295 QUAD_VERB: {},
296 CONIC_VERB: {},
297 CUBIC_VERB: {},
298 CLOSE_VERB: {},
299
Kevin Lubickea905ec2018-11-30 14:05:58 -0500300 AlphaType: {
301 Opaque: {},
302 Premul: {},
303 Unpremul: {},
304 },
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500305
306 BlendMode: {
307 Clear: {},
308 Src: {},
309 Dst: {},
310 SrcOver: {},
311 DstOver: {},
312 SrcIn: {},
313 DstIn: {},
314 SrcOut: {},
315 DstOut: {},
316 SrcATop: {},
317 DstATop: {},
318 Xor: {},
319 Plus: {},
320 Modulate: {},
321 Screen: {},
322 Overlay: {},
323 Darken: {},
324 Lighten: {},
325 ColorDodge: {},
326 ColorBurn: {},
327 HardLight: {},
328 SoftLight: {},
329 Difference: {},
330 Exclusion: {},
331 Multiply: {},
332 Hue: {},
333 Saturation: {},
334 Color: {},
335 Luminosity: {},
336 },
337
338 BlurStyle: {
339 Normal: {},
340 Solid: {},
341 Outer: {},
342 Inner: {},
343 },
344
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500345 ClipOp: {
346 Difference: {},
347 Intersect: {},
348 },
349
Kevin Lubickea905ec2018-11-30 14:05:58 -0500350 ColorType: {
351 Alpha_8: {},
352 RGB_565: {},
353 ARGB_4444: {},
354 RGBA_8888: {},
355 RGB_888x: {},
356 BGRA_8888: {},
357 RGBA_1010102: {},
358 RGB_101010x: {},
359 Gray_8: {},
360 RGBA_F16: {},
361 RGBA_F32: {},
362 },
363
Kevin Lubick006a6f32018-10-19 14:34:34 -0400364 FillType: {
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500365 Winding: {},
366 EvenOdd: {},
367 InverseWinding: {},
368 InverseEvenOdd: {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400369 },
370
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500371 FilterQuality: {
372 None: {},
373 Low: {},
374 Medium: {},
375 High: {},
376 },
377
Alexander Khovansky3e119332018-11-15 02:01:19 +0300378 ImageFormat: {
379 PNG: {},
380 JPEG: {},
381 },
382
Kevin Lubickb9db3902018-11-26 11:47:54 -0500383 PaintStyle: {
384 Fill: {},
385 Stroke: {},
386 StrokeAndFill: {},
387 },
388
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500389 PathOp: {
390 Difference: {},
391 Intersect: {},
392 Union: {},
393 XOR: {},
394 ReverseDifference: {},
395 },
396
Kevin Lubickb9db3902018-11-26 11:47:54 -0500397 StrokeCap: {
398 Butt: {},
399 Round: {},
400 Square: {},
401 },
402
403 StrokeJoin: {
404 Miter: {},
405 Round: {},
406 Bevel: {},
407 },
408
Kevin Lubickec4903d2019-01-14 08:36:08 -0500409 TextEncoding: {
410 UTF8: {},
411 UTF16: {},
412 UTF32: {},
413 GlyphID: {},
414 },
415
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500416 TileMode: {
417 Clamp: {},
418 Repeat: {},
419 Mirror: {},
Kevin Lubickd29edd72018-12-07 08:29:52 -0500420 Decal: {},
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500421 },
422
423 VertexMode: {
424 Triangles: {},
425 TrianglesStrip: {},
426 TriangleFan: {},
427 },
428
Kevin Lubick006a6f32018-10-19 14:34:34 -0400429 // Things Enscriptem adds for us
430
Kevin Lubick53965c92018-10-11 08:51:55 -0400431 /** Represents the heap of the WASM code
432 * @type {ArrayBuffer}
433 */
434 buffer: {},
435 /**
436 * @type {Float32Array}
437 */
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400438 HEAPF32: {},
Kevin Lubick53965c92018-10-11 08:51:55 -0400439 /**
440 * @type {Uint8Array}
441 */
442 HEAPU8: {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400443 /**
444 * @type {Uint16Array}
445 */
446 HEAPU16: {},
447 /**
448 * @type {Int32Array}
449 */
450 HEAP32: {},
Kevin Lubickf5ea37f2019-02-28 10:06:18 -0500451 /**
452 * @type {Uint32Array}
453 */
454 HEAPU32: {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400455 _malloc: function() {},
456 _free: function() {},
457 onRuntimeInitialized: function() {},
458};
Kevin Lubick217056c2018-09-20 17:39:31 -0400459
Kevin Lubick006a6f32018-10-19 14:34:34 -0400460// Public API things that are newly declared in the JS should go here.
461// It's not enough to declare them above, because closure can still erase them
462// unless they go on the prototype.
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500463CanvasKit.SkPath.prototype.addArc = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400464CanvasKit.SkPath.prototype.addPath = function() {};
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500465CanvasKit.SkPath.prototype.addRect = function() {};
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500466CanvasKit.SkPath.prototype.addRoundRect = function() {};
Alexander Khovansky3e119332018-11-15 02:01:19 +0300467CanvasKit.SkPath.prototype.arc = function() {};
Kevin Lubick006a6f32018-10-19 14:34:34 -0400468CanvasKit.SkPath.prototype.arcTo = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400469CanvasKit.SkPath.prototype.close = function() {};
Kevin Lubick006a6f32018-10-19 14:34:34 -0400470CanvasKit.SkPath.prototype.conicTo = function() {};
471CanvasKit.SkPath.prototype.cubicTo = function() {};
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400472CanvasKit.SkPath.prototype.dash = function() {};
Kevin Lubick006a6f32018-10-19 14:34:34 -0400473CanvasKit.SkPath.prototype.lineTo = function() {};
474CanvasKit.SkPath.prototype.moveTo = function() {};
475CanvasKit.SkPath.prototype.op = function() {};
476CanvasKit.SkPath.prototype.quadTo = function() {};
477CanvasKit.SkPath.prototype.rect = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400478CanvasKit.SkPath.prototype.simplify = function() {};
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400479CanvasKit.SkPath.prototype.stroke = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400480CanvasKit.SkPath.prototype.transform = function() {};
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400481CanvasKit.SkPath.prototype.trim = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400482
Kevin Lubick53965c92018-10-11 08:51:55 -0400483CanvasKit.SkSurface.prototype.flush = function() {};
Kevin Lubick5b90b842018-10-17 07:57:18 -0400484CanvasKit.SkSurface.prototype.dispose = function() {};
Kevin Lubick53965c92018-10-11 08:51:55 -0400485
Kevin Lubick12c0e502018-11-28 12:51:56 -0500486/** @return {CanvasKit.SkVertices} */
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400487CanvasKit.SkVertices.prototype.applyBones = function() {};
488
Alexander Khovansky3e119332018-11-15 02:01:19 +0300489CanvasKit.SkImage.prototype.encodeToData = function() {};
490
Kevin Lubickec4903d2019-01-14 08:36:08 -0500491CanvasKit.SkCanvas.prototype.drawText = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500492/** @return {Uint8Array} */
493CanvasKit.SkCanvas.prototype.readPixels = function() {};
494CanvasKit.SkCanvas.prototype.writePixels = function() {};
495
Kevin Lubickddd0a332018-12-12 10:35:13 -0500496CanvasKit.SkFontMgr.prototype.MakeTypefaceFromData = function() {};
497
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400498// Define StrokeOpts object
499var StrokeOpts = {};
500StrokeOpts.prototype.width;
501StrokeOpts.prototype.miter_limit;
502StrokeOpts.prototype.cap;
503StrokeOpts.prototype.join;
Kevin Lubick1646e7d2018-12-07 13:03:08 -0500504StrokeOpts.prototype.precision;
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400505
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500506// Define everything created in the canvas2d spec here
Kevin Lubickb9db3902018-11-26 11:47:54 -0500507var HTMLCanvas = {};
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500508HTMLCanvas.prototype.decodeImage = function() {};
509HTMLCanvas.prototype.dispose = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500510HTMLCanvas.prototype.getContext = function() {};
Kevin Lubick8e4a3312018-12-14 15:03:41 -0500511HTMLCanvas.prototype.loadFont = function() {};
Kevin Lubicka40f8322018-12-17 16:01:36 -0500512HTMLCanvas.prototype.makePath2D = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500513HTMLCanvas.prototype.toDataURL = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500514
515var CanvasRenderingContext2D = {};
516CanvasRenderingContext2D.prototype.addHitRegion = function() {};
517CanvasRenderingContext2D.prototype.arc = function() {};
518CanvasRenderingContext2D.prototype.arcTo = function() {};
519CanvasRenderingContext2D.prototype.beginPath = function() {};
520CanvasRenderingContext2D.prototype.bezierCurveTo = function() {};
521CanvasRenderingContext2D.prototype.clearHitRegions = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500522CanvasRenderingContext2D.prototype.clearRect = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500523CanvasRenderingContext2D.prototype.clip = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500524CanvasRenderingContext2D.prototype.closePath = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500525CanvasRenderingContext2D.prototype.createImageData = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500526CanvasRenderingContext2D.prototype.createLinearGradient = function() {};
Kevin Lubickd29edd72018-12-07 08:29:52 -0500527CanvasRenderingContext2D.prototype.createPattern = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500528CanvasRenderingContext2D.prototype.createRadialGradient = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500529CanvasRenderingContext2D.prototype.drawFocusIfNeeded = function() {};
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500530CanvasRenderingContext2D.prototype.drawImage = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500531CanvasRenderingContext2D.prototype.ellipse = function() {};
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500532CanvasRenderingContext2D.prototype.fill = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500533CanvasRenderingContext2D.prototype.fillRect = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500534CanvasRenderingContext2D.prototype.fillText = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500535CanvasRenderingContext2D.prototype.getImageData = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500536CanvasRenderingContext2D.prototype.getLineDash = function() {};
Kevin Lubick1646e7d2018-12-07 13:03:08 -0500537CanvasRenderingContext2D.prototype.isPointInPath = function() {};
538CanvasRenderingContext2D.prototype.isPointInStroke = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500539CanvasRenderingContext2D.prototype.lineTo = function() {};
540CanvasRenderingContext2D.prototype.measureText = function() {};
541CanvasRenderingContext2D.prototype.moveTo = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500542CanvasRenderingContext2D.prototype.putImageData = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500543CanvasRenderingContext2D.prototype.quadraticCurveTo = function() {};
544CanvasRenderingContext2D.prototype.rect = function() {};
545CanvasRenderingContext2D.prototype.removeHitRegion = function() {};
546CanvasRenderingContext2D.prototype.resetTransform = function() {};
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500547CanvasRenderingContext2D.prototype.restore = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500548CanvasRenderingContext2D.prototype.rotate = function() {};
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500549CanvasRenderingContext2D.prototype.save = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500550CanvasRenderingContext2D.prototype.scale = function() {};
551CanvasRenderingContext2D.prototype.scrollPathIntoView = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500552CanvasRenderingContext2D.prototype.setLineDash = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500553CanvasRenderingContext2D.prototype.setTransform = function() {};
554CanvasRenderingContext2D.prototype.stroke = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500555CanvasRenderingContext2D.prototype.strokeRect = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500556CanvasRenderingContext2D.prototype.strokeText = function() {};
557CanvasRenderingContext2D.prototype.transform = function() {};
558CanvasRenderingContext2D.prototype.translate = function() {};
559
Kevin Lubicka40f8322018-12-17 16:01:36 -0500560var Path2D = {};
561Path2D.prototype.addPath = function() {};
562Path2D.prototype.arc = function() {};
563Path2D.prototype.arcTo = function() {};
564Path2D.prototype.bezierCurveTo = function() {};
565Path2D.prototype.closePath = function() {};
566Path2D.prototype.ellipse = function() {};
567Path2D.prototype.lineTo = function() {};
568Path2D.prototype.moveTo = function() {};
569Path2D.prototype.quadraticCurveTo = function() {};
570Path2D.prototype.rect = function() {};
571
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500572var LinearCanvasGradient = {};
573LinearCanvasGradient.prototype.addColorStop = function() {};
574var RadialCanvasGradient = {};
575RadialCanvasGradient.prototype.addColorStop = function() {};
Kevin Lubickd29edd72018-12-07 08:29:52 -0500576var CanvasPattern = {};
577CanvasPattern.prototype.setTransform = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500578
Kevin Lubick52b9f372018-12-04 13:57:36 -0500579var ImageData = {
580 /**
581 * @type {Uint8ClampedArray}
582 */
583 data: {},
584 height: {},
585 width: {},
586};
587
Kevin Lubickd29edd72018-12-07 08:29:52 -0500588var DOMMatrix = {
589 a: {},
590 b: {},
591 c: {},
592 d: {},
593 e: {},
594 f: {},
595};
596
Kevin Lubick217056c2018-09-20 17:39:31 -0400597// 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 -0500598function loadWebAssemblyModule() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500599
600var DOMMatrix = {};