blob: eda3fadde8126127c0ffc5d2f6c8fd06ce8b88b0 [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 Lubick006a6f32018-10-19 14:34:34 -040047 MakeSkDashPathEffect: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -040048 MakeSkVertices: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -040049 MakeSurface: function() {},
Kevin Lubickeb2f6b02018-11-29 15:07:02 -050050 /** @return {RadialCanvasGradient} */
51 MakeTwoPointConicalGradientShader: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -050052 MakeWebGLCanvasSurface: function() {},
Kevin Lubick217056c2018-09-20 17:39:31 -040053 currentContext: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -050054 getColorComponents: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -050055 getSkDataBytes: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -050056 multiplyByAlpha: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -040057 setCurrentContext: function() {},
Kevin Lubick217056c2018-09-20 17:39:31 -040058
59 // private API (i.e. things declared in the bindings that we use
60 // in the pre-js file)
Kevin Lubick52b9f372018-12-04 13:57:36 -050061 _MakeImage: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -040062 _MakeImageShader: function() {},
63 _MakeLinearGradientShader: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -050064 _MakePathFromCmds: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -040065 _MakeRadialGradientShader: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -040066 _MakeSkDashPathEffect: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -040067 _MakeSkVertices: function() {},
Kevin Lubickeb2f6b02018-11-29 15:07:02 -050068 _MakeTwoPointConicalGradientShader: function() {},
Kevin Lubick0a1293c2018-12-03 12:31:04 -050069 _decodeImage: function() {},
Kevin Lubickea905ec2018-11-30 14:05:58 -050070 _getRasterDirectSurface: function() {},
Kevin Lubick134be1d2018-10-30 15:05:04 -040071 _getRasterN32PremulSurface: function() {},
72 _getWebGLSurface: function() {},
Kevin Lubick217056c2018-09-20 17:39:31 -040073
Kevin Lubick1a05fce2018-11-20 12:51:16 -050074 // The testing object is meant to expose internal functions
75 // for more fine-grained testing, e.g. parseColor
76 _testing: {},
77
Kevin Lubick217056c2018-09-20 17:39:31 -040078 // Objects and properties on CanvasKit
79
Kevin Lubick006a6f32018-10-19 14:34:34 -040080 SkCanvas: {
81 // public API (from C++ bindings)
82 clear: function() {},
Kevin Lubickeb2f6b02018-11-29 15:07:02 -050083 clipPath: function() {},
Kevin Lubick5d5723c2018-12-07 10:09:11 -050084 clipRect: function() {},
85 concat: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -050086 drawArc: function() {},
Kevin Lubick0a1293c2018-12-03 12:31:04 -050087 drawImage: function() {},
88 drawImageRect: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -050089 drawLine: function() {},
90 drawOval: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -040091 drawPaint: function() {},
92 drawPath: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -050093 drawRect: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -050094 drawRoundRect: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -050095 drawShadow: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -050096 drawText: function() {},
Kevin Lubickec4903d2019-01-14 08:36:08 -050097 drawTextBlob: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -050098 drawVertices: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -040099 flush: function() {},
Kevin Lubick5d5723c2018-12-07 10:09:11 -0500100 getTotalMatrix: function() {},
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500101 restore: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400102 rotate: function() {},
103 save: function() {},
104 scale: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400105 skew: function() {},
106 translate: function() {},
107
108 // private API
Kevin Lubickec4903d2019-01-14 08:36:08 -0500109 _drawSimpleText: function() {},
Kevin Lubick52b9f372018-12-04 13:57:36 -0500110 _readPixels: function() {},
111 _writePixels: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400112 delete: function() {},
113 },
114
Kevin Lubick35ac0382019-01-02 15:13:57 -0500115 SkFont: {
116 // public API (from C++ bindings)
117 getScaleX: function() {},
118 getSize: function() {},
119 getSkewX: function() {},
120 getTypeface: function() {},
121 measureText: function() {},
122 setScaleX: function() {},
123 setSize: function() {},
124 setSkewX: function() {},
125 setTypeface: function() {},
126 },
127
Kevin Lubickddd0a332018-12-12 10:35:13 -0500128 SkFontMgr: {
129 // public API (from C++ bindings)
130 RefDefault: function() {},
131 countFamilies: function() {},
132
133 // private API
134 _makeTypefaceFromData: function() {},
135 },
136
Kevin Lubick006a6f32018-10-19 14:34:34 -0400137 SkImage: {
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500138 // public API (from C++ bindings)
139 height: function() {},
140 width: function() {},
Alexander Khovansky3e119332018-11-15 02:01:19 +0300141 // private API
142 _encodeToData: function() {},
143 _encodeToDataWithFormat: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400144 },
145
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500146 SkMatrix: {
Kevin Lubickb9db3902018-11-26 11:47:54 -0500147 identity: function() {},
148 mapPoints: function() {},
149 multiply: function() {},
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500150 rotated: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500151 scaled: function() {},
152 skewed: function() {},
153 translated: function() {},
154 },
155
156 SkPaint: {
157 // public API (from C++ bindings)
158 /** @return {CanvasKit.SkPaint} */
159 copy: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -0500160 getBlendMode: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500161 getColor: function() {},
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500162 getFilterQuality: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500163 getStrokeCap: function() {},
164 getStrokeJoin: function() {},
165 getStrokeMiter: function() {},
166 getStrokeWidth: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500167 setAntiAlias: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -0500168 setBlendMode: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500169 setColor: function() {},
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500170 setFilterQuality: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500171 setMaskFilter: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500172 setPathEffect: function() {},
173 setShader: function() {},
174 setStrokeCap: function() {},
175 setStrokeJoin: function() {},
176 setStrokeMiter: function() {},
177 setStrokeWidth: function() {},
178 setStyle: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500179
180 //private API
181 delete: function() {},
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500182 },
183
Kevin Lubick006a6f32018-10-19 14:34:34 -0400184 SkPath: {
185 // public API (from C++ bindings)
Kevin Lubickb9db3902018-11-26 11:47:54 -0500186 computeTightBounds: function() {},
Kevin Lubick1646e7d2018-12-07 13:03:08 -0500187 contains: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500188 /** @return {CanvasKit.SkPath} */
189 copy: function() {},
190 countPoints: function() {},
191 equals: function() {},
192 getBounds: function() {},
193 getFillType: function() {},
194 getPoint: function() {},
Kevin Lubick1646e7d2018-12-07 13:03:08 -0500195 isEmpty: function() {},
Kevin Lubick2b79d1c2018-12-14 16:10:38 -0500196 isVolatile: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500197 reset: function() {},
198 rewind: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500199 setFillType: function() {},
Kevin Lubick2b79d1c2018-12-14 16:10:38 -0500200 setIsVolatile: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500201 toSVGString: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400202
203 // private API
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500204 _addArc: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400205 _addPath: function() {},
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500206 _addRect: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500207 _addRoundRect: function() {},
Alexander Khovansky3e119332018-11-15 02:01:19 +0300208 _arc: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400209 _arcTo: function() {},
210 _close: function() {},
211 _conicTo: function() {},
212 _cubicTo: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400213 _dash: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400214 _lineTo: function() {},
215 _moveTo: function() {},
216 _op: function() {},
217 _quadTo: function() {},
218 _rect: function() {},
219 _simplify: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400220 _stroke: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400221 _transform: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400222 _trim: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400223 delete: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500224 dump: function() {},
225 dumpHex: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400226 },
227
228 SkRect: {
229 fLeft: {},
230 fTop: {},
231 fRight: {},
232 fBottom: {},
233 },
234
235 SkSurface: {
236 // public API (from C++ bindings)
237 /** @return {CanvasKit.SkCanvas} */
238 getCanvas: function() {},
239 /** @return {CanvasKit.SkImage} */
240 makeImageSnapshot: function() {},
241
242 // private API
243 _flush: function() {},
244 _getRasterN32PremulSurface: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400245 delete: function() {},
246 },
247
Kevin Lubickec4903d2019-01-14 08:36:08 -0500248 SkTextBlob: {
249 MakeFromText: function() {},
250 _MakeFromText: function() {},
251 },
252
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400253 SkVertices: {
254 // public API (from C++ bindings)
Kevin Lubick12c0e502018-11-28 12:51:56 -0500255 bounds: function() {},
256 mode: function() {},
257 uniqueID: function() {},
258 vertexCount: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400259
260 // private API
261 /** @return {CanvasKit.SkVertices} */
262 _applyBones: function() {},
263 },
264
Kevin Lubick006a6f32018-10-19 14:34:34 -0400265 // Constants and Enums
266 gpu: {},
267 skottie: {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400268
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500269 TRANSPARENT: {},
270 RED: {},
271 BLUE: {},
272 YELLOW: {},
273 CYAN: {},
274 BLACK: {},
Kevin Lubickea905ec2018-11-30 14:05:58 -0500275 WHITE: {},
276
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500277 MOVE_VERB: {},
278 LINE_VERB: {},
279 QUAD_VERB: {},
280 CONIC_VERB: {},
281 CUBIC_VERB: {},
282 CLOSE_VERB: {},
283
Kevin Lubickea905ec2018-11-30 14:05:58 -0500284 AlphaType: {
285 Opaque: {},
286 Premul: {},
287 Unpremul: {},
288 },
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500289
290 BlendMode: {
291 Clear: {},
292 Src: {},
293 Dst: {},
294 SrcOver: {},
295 DstOver: {},
296 SrcIn: {},
297 DstIn: {},
298 SrcOut: {},
299 DstOut: {},
300 SrcATop: {},
301 DstATop: {},
302 Xor: {},
303 Plus: {},
304 Modulate: {},
305 Screen: {},
306 Overlay: {},
307 Darken: {},
308 Lighten: {},
309 ColorDodge: {},
310 ColorBurn: {},
311 HardLight: {},
312 SoftLight: {},
313 Difference: {},
314 Exclusion: {},
315 Multiply: {},
316 Hue: {},
317 Saturation: {},
318 Color: {},
319 Luminosity: {},
320 },
321
322 BlurStyle: {
323 Normal: {},
324 Solid: {},
325 Outer: {},
326 Inner: {},
327 },
328
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500329 ClipOp: {
330 Difference: {},
331 Intersect: {},
332 },
333
Kevin Lubickea905ec2018-11-30 14:05:58 -0500334 ColorType: {
335 Alpha_8: {},
336 RGB_565: {},
337 ARGB_4444: {},
338 RGBA_8888: {},
339 RGB_888x: {},
340 BGRA_8888: {},
341 RGBA_1010102: {},
342 RGB_101010x: {},
343 Gray_8: {},
344 RGBA_F16: {},
345 RGBA_F32: {},
346 },
347
Kevin Lubick006a6f32018-10-19 14:34:34 -0400348 FillType: {
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500349 Winding: {},
350 EvenOdd: {},
351 InverseWinding: {},
352 InverseEvenOdd: {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400353 },
354
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500355 FilterQuality: {
356 None: {},
357 Low: {},
358 Medium: {},
359 High: {},
360 },
361
Alexander Khovansky3e119332018-11-15 02:01:19 +0300362 ImageFormat: {
363 PNG: {},
364 JPEG: {},
365 },
366
Kevin Lubickb9db3902018-11-26 11:47:54 -0500367 PaintStyle: {
368 Fill: {},
369 Stroke: {},
370 StrokeAndFill: {},
371 },
372
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500373 PathOp: {
374 Difference: {},
375 Intersect: {},
376 Union: {},
377 XOR: {},
378 ReverseDifference: {},
379 },
380
Kevin Lubickb9db3902018-11-26 11:47:54 -0500381 StrokeCap: {
382 Butt: {},
383 Round: {},
384 Square: {},
385 },
386
387 StrokeJoin: {
388 Miter: {},
389 Round: {},
390 Bevel: {},
391 },
392
Kevin Lubickec4903d2019-01-14 08:36:08 -0500393 TextEncoding: {
394 UTF8: {},
395 UTF16: {},
396 UTF32: {},
397 GlyphID: {},
398 },
399
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500400 TileMode: {
401 Clamp: {},
402 Repeat: {},
403 Mirror: {},
Kevin Lubickd29edd72018-12-07 08:29:52 -0500404 Decal: {},
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500405 },
406
407 VertexMode: {
408 Triangles: {},
409 TrianglesStrip: {},
410 TriangleFan: {},
411 },
412
Kevin Lubick006a6f32018-10-19 14:34:34 -0400413 // Things Enscriptem adds for us
414
Kevin Lubick53965c92018-10-11 08:51:55 -0400415 /** Represents the heap of the WASM code
416 * @type {ArrayBuffer}
417 */
418 buffer: {},
419 /**
420 * @type {Float32Array}
421 */
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400422 HEAPF32: {},
Kevin Lubick53965c92018-10-11 08:51:55 -0400423 /**
424 * @type {Uint8Array}
425 */
426 HEAPU8: {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400427 /**
428 * @type {Uint16Array}
429 */
430 HEAPU16: {},
431 /**
432 * @type {Int32Array}
433 */
434 HEAP32: {},
Kevin Lubick53965c92018-10-11 08:51:55 -0400435
Kevin Lubick006a6f32018-10-19 14:34:34 -0400436 _malloc: function() {},
437 _free: function() {},
438 onRuntimeInitialized: function() {},
439};
Kevin Lubick217056c2018-09-20 17:39:31 -0400440
Kevin Lubick006a6f32018-10-19 14:34:34 -0400441// Public API things that are newly declared in the JS should go here.
442// It's not enough to declare them above, because closure can still erase them
443// unless they go on the prototype.
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500444CanvasKit.SkPath.prototype.addArc = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400445CanvasKit.SkPath.prototype.addPath = function() {};
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500446CanvasKit.SkPath.prototype.addRect = function() {};
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500447CanvasKit.SkPath.prototype.addRoundRect = function() {};
Alexander Khovansky3e119332018-11-15 02:01:19 +0300448CanvasKit.SkPath.prototype.arc = function() {};
Kevin Lubick006a6f32018-10-19 14:34:34 -0400449CanvasKit.SkPath.prototype.arcTo = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400450CanvasKit.SkPath.prototype.close = function() {};
Kevin Lubick006a6f32018-10-19 14:34:34 -0400451CanvasKit.SkPath.prototype.conicTo = function() {};
452CanvasKit.SkPath.prototype.cubicTo = function() {};
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400453CanvasKit.SkPath.prototype.dash = function() {};
Kevin Lubick006a6f32018-10-19 14:34:34 -0400454CanvasKit.SkPath.prototype.lineTo = function() {};
455CanvasKit.SkPath.prototype.moveTo = function() {};
456CanvasKit.SkPath.prototype.op = function() {};
457CanvasKit.SkPath.prototype.quadTo = function() {};
458CanvasKit.SkPath.prototype.rect = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400459CanvasKit.SkPath.prototype.simplify = function() {};
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400460CanvasKit.SkPath.prototype.stroke = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400461CanvasKit.SkPath.prototype.transform = function() {};
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400462CanvasKit.SkPath.prototype.trim = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400463
Kevin Lubick53965c92018-10-11 08:51:55 -0400464CanvasKit.SkSurface.prototype.flush = function() {};
Kevin Lubick5b90b842018-10-17 07:57:18 -0400465CanvasKit.SkSurface.prototype.dispose = function() {};
Kevin Lubick53965c92018-10-11 08:51:55 -0400466
Kevin Lubick12c0e502018-11-28 12:51:56 -0500467/** @return {CanvasKit.SkVertices} */
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400468CanvasKit.SkVertices.prototype.applyBones = function() {};
469
Alexander Khovansky3e119332018-11-15 02:01:19 +0300470CanvasKit.SkImage.prototype.encodeToData = function() {};
471
Kevin Lubickec4903d2019-01-14 08:36:08 -0500472CanvasKit.SkCanvas.prototype.drawText = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500473/** @return {Uint8Array} */
474CanvasKit.SkCanvas.prototype.readPixels = function() {};
475CanvasKit.SkCanvas.prototype.writePixels = function() {};
476
Kevin Lubickddd0a332018-12-12 10:35:13 -0500477CanvasKit.SkFontMgr.prototype.MakeTypefaceFromData = function() {};
478
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400479// Define StrokeOpts object
480var StrokeOpts = {};
481StrokeOpts.prototype.width;
482StrokeOpts.prototype.miter_limit;
483StrokeOpts.prototype.cap;
484StrokeOpts.prototype.join;
Kevin Lubick1646e7d2018-12-07 13:03:08 -0500485StrokeOpts.prototype.precision;
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400486
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500487// Define everything created in the canvas2d spec here
Kevin Lubickb9db3902018-11-26 11:47:54 -0500488var HTMLCanvas = {};
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500489HTMLCanvas.prototype.decodeImage = function() {};
490HTMLCanvas.prototype.dispose = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500491HTMLCanvas.prototype.getContext = function() {};
Kevin Lubick8e4a3312018-12-14 15:03:41 -0500492HTMLCanvas.prototype.loadFont = function() {};
Kevin Lubicka40f8322018-12-17 16:01:36 -0500493HTMLCanvas.prototype.makePath2D = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500494HTMLCanvas.prototype.toDataURL = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500495
496var CanvasRenderingContext2D = {};
497CanvasRenderingContext2D.prototype.addHitRegion = function() {};
498CanvasRenderingContext2D.prototype.arc = function() {};
499CanvasRenderingContext2D.prototype.arcTo = function() {};
500CanvasRenderingContext2D.prototype.beginPath = function() {};
501CanvasRenderingContext2D.prototype.bezierCurveTo = function() {};
502CanvasRenderingContext2D.prototype.clearHitRegions = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500503CanvasRenderingContext2D.prototype.clearRect = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500504CanvasRenderingContext2D.prototype.clip = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500505CanvasRenderingContext2D.prototype.closePath = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500506CanvasRenderingContext2D.prototype.createImageData = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500507CanvasRenderingContext2D.prototype.createLinearGradient = function() {};
Kevin Lubickd29edd72018-12-07 08:29:52 -0500508CanvasRenderingContext2D.prototype.createPattern = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500509CanvasRenderingContext2D.prototype.createRadialGradient = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500510CanvasRenderingContext2D.prototype.drawFocusIfNeeded = function() {};
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500511CanvasRenderingContext2D.prototype.drawImage = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500512CanvasRenderingContext2D.prototype.ellipse = function() {};
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500513CanvasRenderingContext2D.prototype.fill = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500514CanvasRenderingContext2D.prototype.fillRect = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500515CanvasRenderingContext2D.prototype.fillText = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500516CanvasRenderingContext2D.prototype.getImageData = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500517CanvasRenderingContext2D.prototype.getLineDash = function() {};
Kevin Lubick1646e7d2018-12-07 13:03:08 -0500518CanvasRenderingContext2D.prototype.isPointInPath = function() {};
519CanvasRenderingContext2D.prototype.isPointInStroke = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500520CanvasRenderingContext2D.prototype.lineTo = function() {};
521CanvasRenderingContext2D.prototype.measureText = function() {};
522CanvasRenderingContext2D.prototype.moveTo = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500523CanvasRenderingContext2D.prototype.putImageData = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500524CanvasRenderingContext2D.prototype.quadraticCurveTo = function() {};
525CanvasRenderingContext2D.prototype.rect = function() {};
526CanvasRenderingContext2D.prototype.removeHitRegion = function() {};
527CanvasRenderingContext2D.prototype.resetTransform = function() {};
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500528CanvasRenderingContext2D.prototype.restore = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500529CanvasRenderingContext2D.prototype.rotate = function() {};
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500530CanvasRenderingContext2D.prototype.save = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500531CanvasRenderingContext2D.prototype.scale = function() {};
532CanvasRenderingContext2D.prototype.scrollPathIntoView = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500533CanvasRenderingContext2D.prototype.setLineDash = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500534CanvasRenderingContext2D.prototype.setTransform = function() {};
535CanvasRenderingContext2D.prototype.stroke = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500536CanvasRenderingContext2D.prototype.strokeRect = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500537CanvasRenderingContext2D.prototype.strokeText = function() {};
538CanvasRenderingContext2D.prototype.transform = function() {};
539CanvasRenderingContext2D.prototype.translate = function() {};
540
Kevin Lubicka40f8322018-12-17 16:01:36 -0500541var Path2D = {};
542Path2D.prototype.addPath = function() {};
543Path2D.prototype.arc = function() {};
544Path2D.prototype.arcTo = function() {};
545Path2D.prototype.bezierCurveTo = function() {};
546Path2D.prototype.closePath = function() {};
547Path2D.prototype.ellipse = function() {};
548Path2D.prototype.lineTo = function() {};
549Path2D.prototype.moveTo = function() {};
550Path2D.prototype.quadraticCurveTo = function() {};
551Path2D.prototype.rect = function() {};
552
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500553var LinearCanvasGradient = {};
554LinearCanvasGradient.prototype.addColorStop = function() {};
555var RadialCanvasGradient = {};
556RadialCanvasGradient.prototype.addColorStop = function() {};
Kevin Lubickd29edd72018-12-07 08:29:52 -0500557var CanvasPattern = {};
558CanvasPattern.prototype.setTransform = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500559
Kevin Lubick52b9f372018-12-04 13:57:36 -0500560var ImageData = {
561 /**
562 * @type {Uint8ClampedArray}
563 */
564 data: {},
565 height: {},
566 width: {},
567};
568
Kevin Lubickd29edd72018-12-07 08:29:52 -0500569var DOMMatrix = {
570 a: {},
571 b: {},
572 c: {},
573 d: {},
574 e: {},
575 f: {},
576};
577
Kevin Lubick217056c2018-09-20 17:39:31 -0400578// 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 -0500579function loadWebAssemblyModule() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500580
581var DOMMatrix = {};