blob: 4a98c05827eb4a379b3c694d6fc98f4a76125176 [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 Lubick61ef7b22018-11-27 13:26:59 -050034 MakeBlurMaskFilter: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -040035 MakeCanvas: function() {},
36 MakeCanvasSurface: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -040037 MakeImageShader: function() {},
Kevin Lubick0a1293c2018-12-03 12:31:04 -050038 /** @return {CanvasKit.SkImage} */
39 MakeImageFromEncoded: function() {},
Kevin Lubickeb2f6b02018-11-29 15:07:02 -050040 /** @return {LinearCanvasGradient} */
Kevin Lubickb5ae3b52018-11-03 07:51:19 -040041 MakeLinearGradientShader: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -050042 MakePathFromCmds: function() {},
Kevin Lubicka40f8322018-12-17 16:01:36 -050043 MakePathFromOp: function() {},
44 MakePathFromSVGString: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -050045 MakeRadialGradientShader: function() {},
46 MakeSWCanvasSurface: function() {},
Kevin Lubickf5ea37f2019-02-28 10:06:18 -050047 MakeManagedAnimation: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -040048 MakeSkDashPathEffect: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -040049 MakeSkVertices: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -040050 MakeSurface: function() {},
Kevin Lubickeb2f6b02018-11-29 15:07:02 -050051 /** @return {RadialCanvasGradient} */
52 MakeTwoPointConicalGradientShader: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -050053 MakeWebGLCanvasSurface: function() {},
Kevin Lubick217056c2018-09-20 17:39:31 -040054 currentContext: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -050055 getColorComponents: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -050056 getSkDataBytes: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -050057 multiplyByAlpha: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -040058 setCurrentContext: function() {},
Kevin Lubick217056c2018-09-20 17:39:31 -040059
60 // private API (i.e. things declared in the bindings that we use
61 // in the pre-js file)
Kevin Lubick52b9f372018-12-04 13:57:36 -050062 _MakeImage: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -040063 _MakeImageShader: function() {},
64 _MakeLinearGradientShader: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -050065 _MakePathFromCmds: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -040066 _MakeRadialGradientShader: function() {},
Kevin Lubickf5ea37f2019-02-28 10:06:18 -050067 _MakeManagedAnimation: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -040068 _MakeSkDashPathEffect: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -040069 _MakeSkVertices: function() {},
Kevin Lubickeb2f6b02018-11-29 15:07:02 -050070 _MakeTwoPointConicalGradientShader: function() {},
Kevin Lubick0a1293c2018-12-03 12:31:04 -050071 _decodeImage: function() {},
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -050072 _drawShapedText: function() {},
Kevin Lubickea905ec2018-11-30 14:05:58 -050073 _getRasterDirectSurface: function() {},
Kevin Lubick134be1d2018-10-30 15:05:04 -040074 _getRasterN32PremulSurface: function() {},
75 _getWebGLSurface: function() {},
Kevin Lubick217056c2018-09-20 17:39:31 -040076
Kevin Lubick1a05fce2018-11-20 12:51:16 -050077 // The testing object is meant to expose internal functions
78 // for more fine-grained testing, e.g. parseColor
79 _testing: {},
80
Kevin Lubick217056c2018-09-20 17:39:31 -040081 // Objects and properties on CanvasKit
82
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -050083 ShapedText: {
84 // public API (from C++ bindings)
85 getBounds: function() {},
86 },
87
Kevin Lubick006a6f32018-10-19 14:34:34 -040088 SkCanvas: {
89 // public API (from C++ bindings)
90 clear: function() {},
Kevin Lubickeb2f6b02018-11-29 15:07:02 -050091 clipPath: function() {},
Kevin Lubick5d5723c2018-12-07 10:09:11 -050092 clipRect: function() {},
93 concat: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -050094 drawArc: function() {},
Kevin Lubick0a1293c2018-12-03 12:31:04 -050095 drawImage: function() {},
96 drawImageRect: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -050097 drawLine: function() {},
98 drawOval: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -040099 drawPaint: function() {},
100 drawPath: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -0500101 drawRect: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500102 drawRoundRect: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500103 drawShadow: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -0500104 drawText: function() {},
Kevin Lubickec4903d2019-01-14 08:36:08 -0500105 drawTextBlob: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -0500106 drawVertices: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400107 flush: function() {},
Kevin Lubick5d5723c2018-12-07 10:09:11 -0500108 getTotalMatrix: function() {},
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500109 restore: function() {},
Kevin Lubickb3574c92019-03-06 08:25:36 -0500110 restoreToCount: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400111 rotate: function() {},
112 save: function() {},
Kevin Lubickb3574c92019-03-06 08:25:36 -0500113 saveLayer: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400114 scale: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400115 skew: function() {},
116 translate: function() {},
117
118 // private API
Kevin Lubickec4903d2019-01-14 08:36:08 -0500119 _drawSimpleText: function() {},
Kevin Lubick52b9f372018-12-04 13:57:36 -0500120 _readPixels: function() {},
121 _writePixels: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400122 delete: function() {},
123 },
124
Kevin Lubick35ac0382019-01-02 15:13:57 -0500125 SkFont: {
126 // public API (from C++ bindings)
127 getScaleX: function() {},
128 getSize: function() {},
129 getSkewX: function() {},
130 getTypeface: function() {},
131 measureText: function() {},
132 setScaleX: function() {},
133 setSize: function() {},
134 setSkewX: function() {},
135 setTypeface: function() {},
136 },
137
Kevin Lubickddd0a332018-12-12 10:35:13 -0500138 SkFontMgr: {
139 // public API (from C++ bindings)
140 RefDefault: function() {},
141 countFamilies: function() {},
142
143 // private API
144 _makeTypefaceFromData: function() {},
145 },
146
Kevin Lubick006a6f32018-10-19 14:34:34 -0400147 SkImage: {
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500148 // public API (from C++ bindings)
149 height: function() {},
150 width: function() {},
Alexander Khovansky3e119332018-11-15 02:01:19 +0300151 // private API
152 _encodeToData: function() {},
153 _encodeToDataWithFormat: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400154 },
155
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500156 SkMatrix: {
Kevin Lubickb9db3902018-11-26 11:47:54 -0500157 identity: function() {},
158 mapPoints: function() {},
159 multiply: function() {},
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500160 rotated: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500161 scaled: function() {},
162 skewed: function() {},
163 translated: function() {},
164 },
165
166 SkPaint: {
167 // public API (from C++ bindings)
168 /** @return {CanvasKit.SkPaint} */
169 copy: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -0500170 getBlendMode: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500171 getColor: function() {},
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500172 getFilterQuality: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500173 getStrokeCap: function() {},
174 getStrokeJoin: function() {},
175 getStrokeMiter: function() {},
176 getStrokeWidth: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500177 setAntiAlias: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -0500178 setBlendMode: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500179 setColor: function() {},
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500180 setFilterQuality: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500181 setMaskFilter: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500182 setPathEffect: function() {},
183 setShader: function() {},
184 setStrokeCap: function() {},
185 setStrokeJoin: function() {},
186 setStrokeMiter: function() {},
187 setStrokeWidth: function() {},
188 setStyle: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500189
190 //private API
191 delete: function() {},
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500192 },
193
Kevin Lubick006a6f32018-10-19 14:34:34 -0400194 SkPath: {
195 // public API (from C++ bindings)
Kevin Lubickb9db3902018-11-26 11:47:54 -0500196 computeTightBounds: function() {},
Kevin Lubick1646e7d2018-12-07 13:03:08 -0500197 contains: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500198 /** @return {CanvasKit.SkPath} */
199 copy: function() {},
200 countPoints: function() {},
201 equals: function() {},
202 getBounds: function() {},
203 getFillType: function() {},
204 getPoint: function() {},
Kevin Lubick1646e7d2018-12-07 13:03:08 -0500205 isEmpty: function() {},
Kevin Lubick2b79d1c2018-12-14 16:10:38 -0500206 isVolatile: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500207 reset: function() {},
208 rewind: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500209 setFillType: function() {},
Kevin Lubick2b79d1c2018-12-14 16:10:38 -0500210 setIsVolatile: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500211 toSVGString: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400212
213 // private API
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500214 _addArc: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400215 _addPath: function() {},
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500216 _addRect: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500217 _addRoundRect: function() {},
Alexander Khovansky3e119332018-11-15 02:01:19 +0300218 _arc: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400219 _arcTo: function() {},
220 _close: function() {},
221 _conicTo: function() {},
222 _cubicTo: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400223 _dash: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400224 _lineTo: function() {},
225 _moveTo: function() {},
226 _op: function() {},
227 _quadTo: function() {},
228 _rect: function() {},
229 _simplify: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400230 _stroke: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400231 _transform: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400232 _trim: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400233 delete: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500234 dump: function() {},
235 dumpHex: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400236 },
237
238 SkRect: {
239 fLeft: {},
240 fTop: {},
241 fRight: {},
242 fBottom: {},
243 },
244
245 SkSurface: {
246 // public API (from C++ bindings)
247 /** @return {CanvasKit.SkCanvas} */
248 getCanvas: function() {},
249 /** @return {CanvasKit.SkImage} */
250 makeImageSnapshot: function() {},
251
252 // private API
253 _flush: function() {},
254 _getRasterN32PremulSurface: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400255 delete: function() {},
256 },
257
Kevin Lubickec4903d2019-01-14 08:36:08 -0500258 SkTextBlob: {
259 MakeFromText: function() {},
260 _MakeFromText: function() {},
261 },
262
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400263 SkVertices: {
264 // public API (from C++ bindings)
Kevin Lubick12c0e502018-11-28 12:51:56 -0500265 bounds: function() {},
266 mode: function() {},
267 uniqueID: function() {},
268 vertexCount: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400269
270 // private API
271 /** @return {CanvasKit.SkVertices} */
272 _applyBones: function() {},
273 },
274
Kevin Lubick006a6f32018-10-19 14:34:34 -0400275 // Constants and Enums
276 gpu: {},
277 skottie: {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400278
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500279 TRANSPARENT: {},
280 RED: {},
281 BLUE: {},
282 YELLOW: {},
283 CYAN: {},
284 BLACK: {},
Kevin Lubickea905ec2018-11-30 14:05:58 -0500285 WHITE: {},
286
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500287 MOVE_VERB: {},
288 LINE_VERB: {},
289 QUAD_VERB: {},
290 CONIC_VERB: {},
291 CUBIC_VERB: {},
292 CLOSE_VERB: {},
293
Kevin Lubickea905ec2018-11-30 14:05:58 -0500294 AlphaType: {
295 Opaque: {},
296 Premul: {},
297 Unpremul: {},
298 },
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500299
300 BlendMode: {
301 Clear: {},
302 Src: {},
303 Dst: {},
304 SrcOver: {},
305 DstOver: {},
306 SrcIn: {},
307 DstIn: {},
308 SrcOut: {},
309 DstOut: {},
310 SrcATop: {},
311 DstATop: {},
312 Xor: {},
313 Plus: {},
314 Modulate: {},
315 Screen: {},
316 Overlay: {},
317 Darken: {},
318 Lighten: {},
319 ColorDodge: {},
320 ColorBurn: {},
321 HardLight: {},
322 SoftLight: {},
323 Difference: {},
324 Exclusion: {},
325 Multiply: {},
326 Hue: {},
327 Saturation: {},
328 Color: {},
329 Luminosity: {},
330 },
331
332 BlurStyle: {
333 Normal: {},
334 Solid: {},
335 Outer: {},
336 Inner: {},
337 },
338
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500339 ClipOp: {
340 Difference: {},
341 Intersect: {},
342 },
343
Kevin Lubickea905ec2018-11-30 14:05:58 -0500344 ColorType: {
345 Alpha_8: {},
346 RGB_565: {},
347 ARGB_4444: {},
348 RGBA_8888: {},
349 RGB_888x: {},
350 BGRA_8888: {},
351 RGBA_1010102: {},
352 RGB_101010x: {},
353 Gray_8: {},
354 RGBA_F16: {},
355 RGBA_F32: {},
356 },
357
Kevin Lubick006a6f32018-10-19 14:34:34 -0400358 FillType: {
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500359 Winding: {},
360 EvenOdd: {},
361 InverseWinding: {},
362 InverseEvenOdd: {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400363 },
364
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500365 FilterQuality: {
366 None: {},
367 Low: {},
368 Medium: {},
369 High: {},
370 },
371
Alexander Khovansky3e119332018-11-15 02:01:19 +0300372 ImageFormat: {
373 PNG: {},
374 JPEG: {},
375 },
376
Kevin Lubickb9db3902018-11-26 11:47:54 -0500377 PaintStyle: {
378 Fill: {},
379 Stroke: {},
380 StrokeAndFill: {},
381 },
382
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500383 PathOp: {
384 Difference: {},
385 Intersect: {},
386 Union: {},
387 XOR: {},
388 ReverseDifference: {},
389 },
390
Kevin Lubickb9db3902018-11-26 11:47:54 -0500391 StrokeCap: {
392 Butt: {},
393 Round: {},
394 Square: {},
395 },
396
397 StrokeJoin: {
398 Miter: {},
399 Round: {},
400 Bevel: {},
401 },
402
Kevin Lubickec4903d2019-01-14 08:36:08 -0500403 TextEncoding: {
404 UTF8: {},
405 UTF16: {},
406 UTF32: {},
407 GlyphID: {},
408 },
409
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500410 TileMode: {
411 Clamp: {},
412 Repeat: {},
413 Mirror: {},
Kevin Lubickd29edd72018-12-07 08:29:52 -0500414 Decal: {},
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500415 },
416
417 VertexMode: {
418 Triangles: {},
419 TrianglesStrip: {},
420 TriangleFan: {},
421 },
422
Kevin Lubick006a6f32018-10-19 14:34:34 -0400423 // Things Enscriptem adds for us
424
Kevin Lubick53965c92018-10-11 08:51:55 -0400425 /** Represents the heap of the WASM code
426 * @type {ArrayBuffer}
427 */
428 buffer: {},
429 /**
430 * @type {Float32Array}
431 */
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400432 HEAPF32: {},
Kevin Lubick53965c92018-10-11 08:51:55 -0400433 /**
434 * @type {Uint8Array}
435 */
436 HEAPU8: {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400437 /**
438 * @type {Uint16Array}
439 */
440 HEAPU16: {},
441 /**
442 * @type {Int32Array}
443 */
444 HEAP32: {},
Kevin Lubickf5ea37f2019-02-28 10:06:18 -0500445 /**
446 * @type {Uint32Array}
447 */
448 HEAPU32: {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400449 _malloc: function() {},
450 _free: function() {},
451 onRuntimeInitialized: function() {},
452};
Kevin Lubick217056c2018-09-20 17:39:31 -0400453
Kevin Lubick006a6f32018-10-19 14:34:34 -0400454// Public API things that are newly declared in the JS should go here.
455// It's not enough to declare them above, because closure can still erase them
456// unless they go on the prototype.
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500457CanvasKit.SkPath.prototype.addArc = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400458CanvasKit.SkPath.prototype.addPath = function() {};
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500459CanvasKit.SkPath.prototype.addRect = function() {};
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500460CanvasKit.SkPath.prototype.addRoundRect = function() {};
Alexander Khovansky3e119332018-11-15 02:01:19 +0300461CanvasKit.SkPath.prototype.arc = function() {};
Kevin Lubick006a6f32018-10-19 14:34:34 -0400462CanvasKit.SkPath.prototype.arcTo = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400463CanvasKit.SkPath.prototype.close = function() {};
Kevin Lubick006a6f32018-10-19 14:34:34 -0400464CanvasKit.SkPath.prototype.conicTo = function() {};
465CanvasKit.SkPath.prototype.cubicTo = function() {};
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400466CanvasKit.SkPath.prototype.dash = function() {};
Kevin Lubick006a6f32018-10-19 14:34:34 -0400467CanvasKit.SkPath.prototype.lineTo = function() {};
468CanvasKit.SkPath.prototype.moveTo = function() {};
469CanvasKit.SkPath.prototype.op = function() {};
470CanvasKit.SkPath.prototype.quadTo = function() {};
471CanvasKit.SkPath.prototype.rect = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400472CanvasKit.SkPath.prototype.simplify = function() {};
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400473CanvasKit.SkPath.prototype.stroke = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400474CanvasKit.SkPath.prototype.transform = function() {};
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400475CanvasKit.SkPath.prototype.trim = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400476
Kevin Lubick53965c92018-10-11 08:51:55 -0400477CanvasKit.SkSurface.prototype.flush = function() {};
Kevin Lubick5b90b842018-10-17 07:57:18 -0400478CanvasKit.SkSurface.prototype.dispose = function() {};
Kevin Lubick53965c92018-10-11 08:51:55 -0400479
Kevin Lubick12c0e502018-11-28 12:51:56 -0500480/** @return {CanvasKit.SkVertices} */
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400481CanvasKit.SkVertices.prototype.applyBones = function() {};
482
Alexander Khovansky3e119332018-11-15 02:01:19 +0300483CanvasKit.SkImage.prototype.encodeToData = function() {};
484
Kevin Lubickec4903d2019-01-14 08:36:08 -0500485CanvasKit.SkCanvas.prototype.drawText = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500486/** @return {Uint8Array} */
487CanvasKit.SkCanvas.prototype.readPixels = function() {};
488CanvasKit.SkCanvas.prototype.writePixels = function() {};
489
Kevin Lubickddd0a332018-12-12 10:35:13 -0500490CanvasKit.SkFontMgr.prototype.MakeTypefaceFromData = function() {};
491
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400492// Define StrokeOpts object
493var StrokeOpts = {};
494StrokeOpts.prototype.width;
495StrokeOpts.prototype.miter_limit;
496StrokeOpts.prototype.cap;
497StrokeOpts.prototype.join;
Kevin Lubick1646e7d2018-12-07 13:03:08 -0500498StrokeOpts.prototype.precision;
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400499
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500500// Define everything created in the canvas2d spec here
Kevin Lubickb9db3902018-11-26 11:47:54 -0500501var HTMLCanvas = {};
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500502HTMLCanvas.prototype.decodeImage = function() {};
503HTMLCanvas.prototype.dispose = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500504HTMLCanvas.prototype.getContext = function() {};
Kevin Lubick8e4a3312018-12-14 15:03:41 -0500505HTMLCanvas.prototype.loadFont = function() {};
Kevin Lubicka40f8322018-12-17 16:01:36 -0500506HTMLCanvas.prototype.makePath2D = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500507HTMLCanvas.prototype.toDataURL = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500508
509var CanvasRenderingContext2D = {};
510CanvasRenderingContext2D.prototype.addHitRegion = function() {};
511CanvasRenderingContext2D.prototype.arc = function() {};
512CanvasRenderingContext2D.prototype.arcTo = function() {};
513CanvasRenderingContext2D.prototype.beginPath = function() {};
514CanvasRenderingContext2D.prototype.bezierCurveTo = function() {};
515CanvasRenderingContext2D.prototype.clearHitRegions = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500516CanvasRenderingContext2D.prototype.clearRect = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500517CanvasRenderingContext2D.prototype.clip = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500518CanvasRenderingContext2D.prototype.closePath = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500519CanvasRenderingContext2D.prototype.createImageData = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500520CanvasRenderingContext2D.prototype.createLinearGradient = function() {};
Kevin Lubickd29edd72018-12-07 08:29:52 -0500521CanvasRenderingContext2D.prototype.createPattern = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500522CanvasRenderingContext2D.prototype.createRadialGradient = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500523CanvasRenderingContext2D.prototype.drawFocusIfNeeded = function() {};
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500524CanvasRenderingContext2D.prototype.drawImage = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500525CanvasRenderingContext2D.prototype.ellipse = function() {};
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500526CanvasRenderingContext2D.prototype.fill = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500527CanvasRenderingContext2D.prototype.fillRect = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500528CanvasRenderingContext2D.prototype.fillText = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500529CanvasRenderingContext2D.prototype.getImageData = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500530CanvasRenderingContext2D.prototype.getLineDash = function() {};
Kevin Lubick1646e7d2018-12-07 13:03:08 -0500531CanvasRenderingContext2D.prototype.isPointInPath = function() {};
532CanvasRenderingContext2D.prototype.isPointInStroke = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500533CanvasRenderingContext2D.prototype.lineTo = function() {};
534CanvasRenderingContext2D.prototype.measureText = function() {};
535CanvasRenderingContext2D.prototype.moveTo = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500536CanvasRenderingContext2D.prototype.putImageData = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500537CanvasRenderingContext2D.prototype.quadraticCurveTo = function() {};
538CanvasRenderingContext2D.prototype.rect = function() {};
539CanvasRenderingContext2D.prototype.removeHitRegion = function() {};
540CanvasRenderingContext2D.prototype.resetTransform = function() {};
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500541CanvasRenderingContext2D.prototype.restore = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500542CanvasRenderingContext2D.prototype.rotate = function() {};
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500543CanvasRenderingContext2D.prototype.save = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500544CanvasRenderingContext2D.prototype.scale = function() {};
545CanvasRenderingContext2D.prototype.scrollPathIntoView = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500546CanvasRenderingContext2D.prototype.setLineDash = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500547CanvasRenderingContext2D.prototype.setTransform = function() {};
548CanvasRenderingContext2D.prototype.stroke = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500549CanvasRenderingContext2D.prototype.strokeRect = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500550CanvasRenderingContext2D.prototype.strokeText = function() {};
551CanvasRenderingContext2D.prototype.transform = function() {};
552CanvasRenderingContext2D.prototype.translate = function() {};
553
Kevin Lubicka40f8322018-12-17 16:01:36 -0500554var Path2D = {};
555Path2D.prototype.addPath = function() {};
556Path2D.prototype.arc = function() {};
557Path2D.prototype.arcTo = function() {};
558Path2D.prototype.bezierCurveTo = function() {};
559Path2D.prototype.closePath = function() {};
560Path2D.prototype.ellipse = function() {};
561Path2D.prototype.lineTo = function() {};
562Path2D.prototype.moveTo = function() {};
563Path2D.prototype.quadraticCurveTo = function() {};
564Path2D.prototype.rect = function() {};
565
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500566var LinearCanvasGradient = {};
567LinearCanvasGradient.prototype.addColorStop = function() {};
568var RadialCanvasGradient = {};
569RadialCanvasGradient.prototype.addColorStop = function() {};
Kevin Lubickd29edd72018-12-07 08:29:52 -0500570var CanvasPattern = {};
571CanvasPattern.prototype.setTransform = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500572
Kevin Lubick52b9f372018-12-04 13:57:36 -0500573var ImageData = {
574 /**
575 * @type {Uint8ClampedArray}
576 */
577 data: {},
578 height: {},
579 width: {},
580};
581
Kevin Lubickd29edd72018-12-07 08:29:52 -0500582var DOMMatrix = {
583 a: {},
584 b: {},
585 c: {},
586 d: {},
587 e: {},
588 f: {},
589};
590
Kevin Lubick217056c2018-09-20 17:39:31 -0400591// 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 -0500592function loadWebAssemblyModule() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500593
594var DOMMatrix = {};