blob: d71c43529839ca6d6d9cd27103a129e714ea11c5 [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 Lubickcd544662019-03-22 15:41:36 -040087 GrContext: {
88 // public API (from C++ bindings)
89 getResourceCacheLimitBytes: function() {},
90 getResourceCacheUsageBytes: function() {},
91 setResourceCacheLimitBytes: function() {},
92 },
93
Kevin Lubickd3cfbca2019-03-15 15:36:29 -040094 RSXFormBuilder: function() {},
Kevin Lubickee91c072019-03-29 10:39:52 -040095 SkColorBuilder: function() {},
96 SkRectBuilder: function() {},
Kevin Lubickd3cfbca2019-03-15 15:36:29 -040097
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -050098 ShapedText: {
99 // public API (from C++ bindings)
100 getBounds: function() {},
101 },
102
Kevin Lubick006a6f32018-10-19 14:34:34 -0400103 SkCanvas: {
104 // public API (from C++ bindings)
105 clear: function() {},
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500106 clipPath: function() {},
Kevin Lubick5d5723c2018-12-07 10:09:11 -0500107 clipRect: function() {},
108 concat: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500109 drawArc: function() {},
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500110 drawImage: function() {},
111 drawImageRect: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500112 drawLine: function() {},
113 drawOval: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400114 drawPaint: function() {},
115 drawPath: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -0500116 drawRect: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500117 drawRoundRect: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500118 drawShadow: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -0500119 drawText: function() {},
Kevin Lubickec4903d2019-01-14 08:36:08 -0500120 drawTextBlob: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -0500121 drawVertices: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400122 flush: function() {},
Kevin Lubick5d5723c2018-12-07 10:09:11 -0500123 getTotalMatrix: function() {},
Kevin Lubick543f3522019-03-08 10:04:28 -0500124 makeSurface: function() {},
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500125 restore: function() {},
Kevin Lubickb3574c92019-03-06 08:25:36 -0500126 restoreToCount: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400127 rotate: function() {},
128 save: function() {},
Kevin Lubickb3574c92019-03-06 08:25:36 -0500129 saveLayer: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400130 scale: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400131 skew: function() {},
132 translate: function() {},
133
134 // private API
Kevin Lubickee91c072019-03-29 10:39:52 -0400135 _drawAtlas: function() {},
Kevin Lubickec4903d2019-01-14 08:36:08 -0500136 _drawSimpleText: function() {},
Kevin Lubick52b9f372018-12-04 13:57:36 -0500137 _readPixels: function() {},
138 _writePixels: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400139 delete: function() {},
140 },
141
Kevin Lubick35ac0382019-01-02 15:13:57 -0500142 SkFont: {
143 // public API (from C++ bindings)
144 getScaleX: function() {},
145 getSize: function() {},
146 getSkewX: function() {},
147 getTypeface: function() {},
148 measureText: function() {},
149 setScaleX: function() {},
150 setSize: function() {},
151 setSkewX: function() {},
152 setTypeface: function() {},
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400153 // private API (from C++ bindings)
154 _getWidths: function() {},
Kevin Lubick35ac0382019-01-02 15:13:57 -0500155 },
156
Kevin Lubickddd0a332018-12-12 10:35:13 -0500157 SkFontMgr: {
158 // public API (from C++ bindings)
159 RefDefault: function() {},
160 countFamilies: function() {},
161
162 // private API
163 _makeTypefaceFromData: function() {},
164 },
165
Kevin Lubick006a6f32018-10-19 14:34:34 -0400166 SkImage: {
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500167 // public API (from C++ bindings)
168 height: function() {},
169 width: function() {},
Alexander Khovansky3e119332018-11-15 02:01:19 +0300170 // private API
171 _encodeToData: function() {},
172 _encodeToDataWithFormat: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400173 },
174
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500175 SkMatrix: {
Kevin Lubickb9db3902018-11-26 11:47:54 -0500176 identity: function() {},
Kevin Lubickf3555182019-03-14 10:55:10 -0400177 invert: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500178 mapPoints: function() {},
179 multiply: function() {},
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500180 rotated: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500181 scaled: function() {},
182 skewed: function() {},
183 translated: function() {},
184 },
185
186 SkPaint: {
187 // public API (from C++ bindings)
188 /** @return {CanvasKit.SkPaint} */
189 copy: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -0500190 getBlendMode: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500191 getColor: function() {},
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500192 getFilterQuality: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500193 getStrokeCap: function() {},
194 getStrokeJoin: function() {},
195 getStrokeMiter: function() {},
196 getStrokeWidth: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500197 setAntiAlias: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -0500198 setBlendMode: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500199 setColor: function() {},
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500200 setFilterQuality: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500201 setMaskFilter: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500202 setPathEffect: function() {},
203 setShader: function() {},
204 setStrokeCap: function() {},
205 setStrokeJoin: function() {},
206 setStrokeMiter: function() {},
207 setStrokeWidth: function() {},
208 setStyle: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500209
210 //private API
211 delete: function() {},
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500212 },
213
Kevin Lubick006a6f32018-10-19 14:34:34 -0400214 SkPath: {
215 // public API (from C++ bindings)
Kevin Lubickb9db3902018-11-26 11:47:54 -0500216 computeTightBounds: function() {},
Kevin Lubick1646e7d2018-12-07 13:03:08 -0500217 contains: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500218 /** @return {CanvasKit.SkPath} */
219 copy: function() {},
220 countPoints: function() {},
221 equals: function() {},
222 getBounds: function() {},
223 getFillType: function() {},
224 getPoint: function() {},
Kevin Lubick1646e7d2018-12-07 13:03:08 -0500225 isEmpty: function() {},
Kevin Lubick2b79d1c2018-12-14 16:10:38 -0500226 isVolatile: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500227 reset: function() {},
228 rewind: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500229 setFillType: function() {},
Kevin Lubick2b79d1c2018-12-14 16:10:38 -0500230 setIsVolatile: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500231 toSVGString: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400232
233 // private API
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500234 _addArc: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400235 _addPath: function() {},
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500236 _addRect: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500237 _addRoundRect: function() {},
Alexander Khovansky3e119332018-11-15 02:01:19 +0300238 _arc: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400239 _arcTo: function() {},
240 _close: function() {},
241 _conicTo: function() {},
242 _cubicTo: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400243 _dash: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400244 _lineTo: function() {},
245 _moveTo: function() {},
246 _op: function() {},
247 _quadTo: function() {},
248 _rect: function() {},
249 _simplify: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400250 _stroke: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400251 _transform: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400252 _trim: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400253 delete: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500254 dump: function() {},
255 dumpHex: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400256 },
257
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400258 SkPathMeasure: {
259 getLength: function() {},
260 getPosTan: function() {},
261 isClosed: function() {},
262 nextContour: function() {},
263 },
264
Kevin Lubick006a6f32018-10-19 14:34:34 -0400265 SkRect: {
266 fLeft: {},
267 fTop: {},
268 fRight: {},
269 fBottom: {},
270 },
271
272 SkSurface: {
273 // public API (from C++ bindings)
274 /** @return {CanvasKit.SkCanvas} */
275 getCanvas: function() {},
276 /** @return {CanvasKit.SkImage} */
277 makeImageSnapshot: function() {},
Kevin Lubick543f3522019-03-08 10:04:28 -0500278 makeSurface: function() {},
Kevin Lubickcd544662019-03-22 15:41:36 -0400279 grContext: {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400280
281 // private API
282 _flush: function() {},
283 _getRasterN32PremulSurface: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400284 delete: function() {},
285 },
286
Kevin Lubickec4903d2019-01-14 08:36:08 -0500287 SkTextBlob: {
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400288 // public API (both C++ and JS bindings)
289 MakeFromRSXform: function() {},
Kevin Lubickec4903d2019-01-14 08:36:08 -0500290 MakeFromText: function() {},
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400291 MakeOnPath: function() {},
292 // private API (from C++ bindings)
293 _MakeFromRSXform: function() {},
Kevin Lubickec4903d2019-01-14 08:36:08 -0500294 _MakeFromText: function() {},
295 },
296
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400297 SkVertices: {
298 // public API (from C++ bindings)
Kevin Lubick12c0e502018-11-28 12:51:56 -0500299 bounds: function() {},
300 mode: function() {},
301 uniqueID: function() {},
302 vertexCount: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400303
304 // private API
305 /** @return {CanvasKit.SkVertices} */
306 _applyBones: function() {},
307 },
308
Kevin Lubick006a6f32018-10-19 14:34:34 -0400309 // Constants and Enums
310 gpu: {},
311 skottie: {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400312
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500313 TRANSPARENT: {},
314 RED: {},
315 BLUE: {},
316 YELLOW: {},
317 CYAN: {},
318 BLACK: {},
Kevin Lubickea905ec2018-11-30 14:05:58 -0500319 WHITE: {},
320
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500321 MOVE_VERB: {},
322 LINE_VERB: {},
323 QUAD_VERB: {},
324 CONIC_VERB: {},
325 CUBIC_VERB: {},
326 CLOSE_VERB: {},
327
Kevin Lubickea905ec2018-11-30 14:05:58 -0500328 AlphaType: {
329 Opaque: {},
330 Premul: {},
331 Unpremul: {},
332 },
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500333
334 BlendMode: {
335 Clear: {},
336 Src: {},
337 Dst: {},
338 SrcOver: {},
339 DstOver: {},
340 SrcIn: {},
341 DstIn: {},
342 SrcOut: {},
343 DstOut: {},
344 SrcATop: {},
345 DstATop: {},
346 Xor: {},
347 Plus: {},
348 Modulate: {},
349 Screen: {},
350 Overlay: {},
351 Darken: {},
352 Lighten: {},
353 ColorDodge: {},
354 ColorBurn: {},
355 HardLight: {},
356 SoftLight: {},
357 Difference: {},
358 Exclusion: {},
359 Multiply: {},
360 Hue: {},
361 Saturation: {},
362 Color: {},
363 Luminosity: {},
364 },
365
366 BlurStyle: {
367 Normal: {},
368 Solid: {},
369 Outer: {},
370 Inner: {},
371 },
372
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500373 ClipOp: {
374 Difference: {},
375 Intersect: {},
376 },
377
Kevin Lubickea905ec2018-11-30 14:05:58 -0500378 ColorType: {
379 Alpha_8: {},
380 RGB_565: {},
381 ARGB_4444: {},
382 RGBA_8888: {},
383 RGB_888x: {},
384 BGRA_8888: {},
385 RGBA_1010102: {},
386 RGB_101010x: {},
387 Gray_8: {},
388 RGBA_F16: {},
389 RGBA_F32: {},
390 },
391
Kevin Lubick006a6f32018-10-19 14:34:34 -0400392 FillType: {
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500393 Winding: {},
394 EvenOdd: {},
395 InverseWinding: {},
396 InverseEvenOdd: {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400397 },
398
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500399 FilterQuality: {
400 None: {},
401 Low: {},
402 Medium: {},
403 High: {},
404 },
405
Alexander Khovansky3e119332018-11-15 02:01:19 +0300406 ImageFormat: {
407 PNG: {},
408 JPEG: {},
409 },
410
Kevin Lubickb9db3902018-11-26 11:47:54 -0500411 PaintStyle: {
412 Fill: {},
413 Stroke: {},
414 StrokeAndFill: {},
415 },
416
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500417 PathOp: {
418 Difference: {},
419 Intersect: {},
420 Union: {},
421 XOR: {},
422 ReverseDifference: {},
423 },
424
Kevin Lubickb9db3902018-11-26 11:47:54 -0500425 StrokeCap: {
426 Butt: {},
427 Round: {},
428 Square: {},
429 },
430
431 StrokeJoin: {
432 Miter: {},
433 Round: {},
434 Bevel: {},
435 },
436
Kevin Lubickec4903d2019-01-14 08:36:08 -0500437 TextEncoding: {
438 UTF8: {},
439 UTF16: {},
440 UTF32: {},
441 GlyphID: {},
442 },
443
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500444 TileMode: {
445 Clamp: {},
446 Repeat: {},
447 Mirror: {},
Kevin Lubickd29edd72018-12-07 08:29:52 -0500448 Decal: {},
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500449 },
450
451 VertexMode: {
452 Triangles: {},
453 TrianglesStrip: {},
454 TriangleFan: {},
455 },
456
Kevin Lubick006a6f32018-10-19 14:34:34 -0400457 // Things Enscriptem adds for us
458
Kevin Lubick53965c92018-10-11 08:51:55 -0400459 /** Represents the heap of the WASM code
460 * @type {ArrayBuffer}
461 */
462 buffer: {},
463 /**
464 * @type {Float32Array}
465 */
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400466 HEAPF32: {},
Kevin Lubick53965c92018-10-11 08:51:55 -0400467 /**
468 * @type {Uint8Array}
469 */
470 HEAPU8: {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400471 /**
472 * @type {Uint16Array}
473 */
474 HEAPU16: {},
475 /**
476 * @type {Int32Array}
477 */
478 HEAP32: {},
Kevin Lubickf5ea37f2019-02-28 10:06:18 -0500479 /**
480 * @type {Uint32Array}
481 */
482 HEAPU32: {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400483 _malloc: function() {},
484 _free: function() {},
485 onRuntimeInitialized: function() {},
486};
Kevin Lubick217056c2018-09-20 17:39:31 -0400487
Kevin Lubick006a6f32018-10-19 14:34:34 -0400488// Public API things that are newly declared in the JS should go here.
489// It's not enough to declare them above, because closure can still erase them
490// unless they go on the prototype.
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500491CanvasKit.SkPath.prototype.addArc = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400492CanvasKit.SkPath.prototype.addPath = function() {};
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500493CanvasKit.SkPath.prototype.addRect = function() {};
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500494CanvasKit.SkPath.prototype.addRoundRect = function() {};
Alexander Khovansky3e119332018-11-15 02:01:19 +0300495CanvasKit.SkPath.prototype.arc = function() {};
Kevin Lubick006a6f32018-10-19 14:34:34 -0400496CanvasKit.SkPath.prototype.arcTo = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400497CanvasKit.SkPath.prototype.close = function() {};
Kevin Lubick006a6f32018-10-19 14:34:34 -0400498CanvasKit.SkPath.prototype.conicTo = function() {};
499CanvasKit.SkPath.prototype.cubicTo = function() {};
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400500CanvasKit.SkPath.prototype.dash = function() {};
Kevin Lubick006a6f32018-10-19 14:34:34 -0400501CanvasKit.SkPath.prototype.lineTo = function() {};
502CanvasKit.SkPath.prototype.moveTo = function() {};
503CanvasKit.SkPath.prototype.op = function() {};
504CanvasKit.SkPath.prototype.quadTo = function() {};
505CanvasKit.SkPath.prototype.rect = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400506CanvasKit.SkPath.prototype.simplify = function() {};
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400507CanvasKit.SkPath.prototype.stroke = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400508CanvasKit.SkPath.prototype.transform = function() {};
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400509CanvasKit.SkPath.prototype.trim = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400510
Kevin Lubick5b90b842018-10-17 07:57:18 -0400511CanvasKit.SkSurface.prototype.dispose = function() {};
Kevin Lubick359a7e32019-03-19 09:34:37 -0400512CanvasKit.SkSurface.prototype.flush = function() {};
513CanvasKit.SkSurface.prototype.requestAnimationFrame = function() {};
Kevin Lubick53965c92018-10-11 08:51:55 -0400514
Kevin Lubick12c0e502018-11-28 12:51:56 -0500515/** @return {CanvasKit.SkVertices} */
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400516CanvasKit.SkVertices.prototype.applyBones = function() {};
517
Alexander Khovansky3e119332018-11-15 02:01:19 +0300518CanvasKit.SkImage.prototype.encodeToData = function() {};
519
Kevin Lubickee91c072019-03-29 10:39:52 -0400520CanvasKit.SkCanvas.prototype.drawAtlas = function() {};
Kevin Lubickec4903d2019-01-14 08:36:08 -0500521CanvasKit.SkCanvas.prototype.drawText = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500522/** @return {Uint8Array} */
523CanvasKit.SkCanvas.prototype.readPixels = function() {};
524CanvasKit.SkCanvas.prototype.writePixels = function() {};
525
Kevin Lubickddd0a332018-12-12 10:35:13 -0500526CanvasKit.SkFontMgr.prototype.MakeTypefaceFromData = function() {};
527
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400528CanvasKit.SkFont.prototype.getWidths = function() {};
529
530CanvasKit.RSXFormBuilder.prototype.build = function() {};
531CanvasKit.RSXFormBuilder.prototype.delete = function() {};
532CanvasKit.RSXFormBuilder.prototype.push = function() {};
Kevin Lubickee91c072019-03-29 10:39:52 -0400533CanvasKit.RSXFormBuilder.prototype.set = function() {};
534
535CanvasKit.SkColorBuilder.prototype.build = function() {};
536CanvasKit.SkColorBuilder.prototype.delete = function() {};
537CanvasKit.SkColorBuilder.prototype.push = function() {};
538CanvasKit.SkColorBuilder.prototype.set = function() {};
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400539
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400540// Define StrokeOpts object
541var StrokeOpts = {};
542StrokeOpts.prototype.width;
543StrokeOpts.prototype.miter_limit;
544StrokeOpts.prototype.cap;
545StrokeOpts.prototype.join;
Kevin Lubick1646e7d2018-12-07 13:03:08 -0500546StrokeOpts.prototype.precision;
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400547
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500548// Define everything created in the canvas2d spec here
Kevin Lubickb9db3902018-11-26 11:47:54 -0500549var HTMLCanvas = {};
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500550HTMLCanvas.prototype.decodeImage = function() {};
551HTMLCanvas.prototype.dispose = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500552HTMLCanvas.prototype.getContext = function() {};
Kevin Lubick8e4a3312018-12-14 15:03:41 -0500553HTMLCanvas.prototype.loadFont = function() {};
Kevin Lubicka40f8322018-12-17 16:01:36 -0500554HTMLCanvas.prototype.makePath2D = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500555HTMLCanvas.prototype.toDataURL = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500556
557var CanvasRenderingContext2D = {};
558CanvasRenderingContext2D.prototype.addHitRegion = function() {};
559CanvasRenderingContext2D.prototype.arc = function() {};
560CanvasRenderingContext2D.prototype.arcTo = function() {};
561CanvasRenderingContext2D.prototype.beginPath = function() {};
562CanvasRenderingContext2D.prototype.bezierCurveTo = function() {};
563CanvasRenderingContext2D.prototype.clearHitRegions = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500564CanvasRenderingContext2D.prototype.clearRect = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500565CanvasRenderingContext2D.prototype.clip = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500566CanvasRenderingContext2D.prototype.closePath = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500567CanvasRenderingContext2D.prototype.createImageData = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500568CanvasRenderingContext2D.prototype.createLinearGradient = function() {};
Kevin Lubickd29edd72018-12-07 08:29:52 -0500569CanvasRenderingContext2D.prototype.createPattern = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500570CanvasRenderingContext2D.prototype.createRadialGradient = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500571CanvasRenderingContext2D.prototype.drawFocusIfNeeded = function() {};
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500572CanvasRenderingContext2D.prototype.drawImage = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500573CanvasRenderingContext2D.prototype.ellipse = function() {};
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500574CanvasRenderingContext2D.prototype.fill = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500575CanvasRenderingContext2D.prototype.fillRect = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500576CanvasRenderingContext2D.prototype.fillText = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500577CanvasRenderingContext2D.prototype.getImageData = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500578CanvasRenderingContext2D.prototype.getLineDash = function() {};
Kevin Lubick1646e7d2018-12-07 13:03:08 -0500579CanvasRenderingContext2D.prototype.isPointInPath = function() {};
580CanvasRenderingContext2D.prototype.isPointInStroke = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500581CanvasRenderingContext2D.prototype.lineTo = function() {};
582CanvasRenderingContext2D.prototype.measureText = function() {};
583CanvasRenderingContext2D.prototype.moveTo = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500584CanvasRenderingContext2D.prototype.putImageData = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500585CanvasRenderingContext2D.prototype.quadraticCurveTo = function() {};
586CanvasRenderingContext2D.prototype.rect = function() {};
587CanvasRenderingContext2D.prototype.removeHitRegion = function() {};
588CanvasRenderingContext2D.prototype.resetTransform = function() {};
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500589CanvasRenderingContext2D.prototype.restore = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500590CanvasRenderingContext2D.prototype.rotate = function() {};
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500591CanvasRenderingContext2D.prototype.save = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500592CanvasRenderingContext2D.prototype.scale = function() {};
593CanvasRenderingContext2D.prototype.scrollPathIntoView = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500594CanvasRenderingContext2D.prototype.setLineDash = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500595CanvasRenderingContext2D.prototype.setTransform = function() {};
596CanvasRenderingContext2D.prototype.stroke = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500597CanvasRenderingContext2D.prototype.strokeRect = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500598CanvasRenderingContext2D.prototype.strokeText = function() {};
599CanvasRenderingContext2D.prototype.transform = function() {};
600CanvasRenderingContext2D.prototype.translate = function() {};
601
Kevin Lubicka40f8322018-12-17 16:01:36 -0500602var Path2D = {};
603Path2D.prototype.addPath = function() {};
604Path2D.prototype.arc = function() {};
605Path2D.prototype.arcTo = function() {};
606Path2D.prototype.bezierCurveTo = function() {};
607Path2D.prototype.closePath = function() {};
608Path2D.prototype.ellipse = function() {};
609Path2D.prototype.lineTo = function() {};
610Path2D.prototype.moveTo = function() {};
611Path2D.prototype.quadraticCurveTo = function() {};
612Path2D.prototype.rect = function() {};
613
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500614var LinearCanvasGradient = {};
615LinearCanvasGradient.prototype.addColorStop = function() {};
616var RadialCanvasGradient = {};
617RadialCanvasGradient.prototype.addColorStop = function() {};
Kevin Lubickd29edd72018-12-07 08:29:52 -0500618var CanvasPattern = {};
619CanvasPattern.prototype.setTransform = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500620
Kevin Lubick52b9f372018-12-04 13:57:36 -0500621var ImageData = {
622 /**
623 * @type {Uint8ClampedArray}
624 */
625 data: {},
626 height: {},
627 width: {},
628};
629
Kevin Lubickd29edd72018-12-07 08:29:52 -0500630var DOMMatrix = {
631 a: {},
632 b: {},
633 c: {},
634 d: {},
635 e: {},
636 f: {},
637};
638
Kevin Lubick217056c2018-09-20 17:39:31 -0400639// 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 -0500640function loadWebAssemblyModule() {};