blob: 2c36c317c328697c365d5e3667a587d86905bf4c [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 Lubick0a1293c2018-12-03 12:31:04 -050040 /** @return {CanvasKit.SkImage} */
41 MakeImageFromEncoded: function() {},
Kevin Lubickeb2f6b02018-11-29 15:07:02 -050042 /** @return {LinearCanvasGradient} */
Kevin Lubickb5ae3b52018-11-03 07:51:19 -040043 MakeLinearGradientShader: function() {},
Kevin Lubick543f3522019-03-08 10:04:28 -050044 MakeOnScreenGLSurface: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -050045 MakePathFromCmds: function() {},
Kevin Lubicka40f8322018-12-17 16:01:36 -050046 MakePathFromOp: function() {},
47 MakePathFromSVGString: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -050048 MakeRadialGradientShader: function() {},
Kevin Lubick543f3522019-03-08 10:04:28 -050049 MakeRenderTarget: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -050050 MakeSWCanvasSurface: function() {},
Kevin Lubickf5ea37f2019-02-28 10:06:18 -050051 MakeManagedAnimation: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -040052 MakeSkDashPathEffect: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -040053 MakeSkVertices: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -040054 MakeSurface: function() {},
Kevin Lubickeb2f6b02018-11-29 15:07:02 -050055 /** @return {RadialCanvasGradient} */
56 MakeTwoPointConicalGradientShader: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -050057 MakeWebGLCanvasSurface: function() {},
Kevin Lubick217056c2018-09-20 17:39:31 -040058 currentContext: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -050059 getColorComponents: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -050060 getSkDataBytes: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -050061 multiplyByAlpha: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -040062 setCurrentContext: function() {},
Kevin Lubick217056c2018-09-20 17:39:31 -040063
64 // private API (i.e. things declared in the bindings that we use
65 // in the pre-js file)
Kevin Lubick52b9f372018-12-04 13:57:36 -050066 _MakeImage: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -040067 _MakeLinearGradientShader: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -050068 _MakePathFromCmds: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -040069 _MakeRadialGradientShader: function() {},
Kevin Lubickf5ea37f2019-02-28 10:06:18 -050070 _MakeManagedAnimation: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -040071 _MakeSkDashPathEffect: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -040072 _MakeSkVertices: function() {},
Kevin Lubickeb2f6b02018-11-29 15:07:02 -050073 _MakeTwoPointConicalGradientShader: function() {},
Kevin Lubick0a1293c2018-12-03 12:31:04 -050074 _decodeImage: function() {},
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -050075 _drawShapedText: function() {},
Kevin Lubickea905ec2018-11-30 14:05:58 -050076 _getRasterDirectSurface: function() {},
Kevin Lubick134be1d2018-10-30 15:05:04 -040077 _getRasterN32PremulSurface: function() {},
Kevin Lubick217056c2018-09-20 17:39:31 -040078
Kevin Lubick1a05fce2018-11-20 12:51:16 -050079 // The testing object is meant to expose internal functions
80 // for more fine-grained testing, e.g. parseColor
81 _testing: {},
82
Kevin Lubick217056c2018-09-20 17:39:31 -040083 // Objects and properties on CanvasKit
84
Kevin Lubickcd544662019-03-22 15:41:36 -040085 GrContext: {
86 // public API (from C++ bindings)
87 getResourceCacheLimitBytes: function() {},
88 getResourceCacheUsageBytes: function() {},
89 setResourceCacheLimitBytes: function() {},
90 },
91
Kevin Lubickd3cfbca2019-03-15 15:36:29 -040092 RSXFormBuilder: function() {},
Kevin Lubickee91c072019-03-29 10:39:52 -040093 SkColorBuilder: function() {},
94 SkRectBuilder: function() {},
Kevin Lubickd3cfbca2019-03-15 15:36:29 -040095
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -050096 ShapedText: {
97 // public API (from C++ bindings)
98 getBounds: function() {},
99 },
100
Kevin Lubick006a6f32018-10-19 14:34:34 -0400101 SkCanvas: {
102 // public API (from C++ bindings)
103 clear: function() {},
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500104 clipPath: function() {},
Kevin Lubick5d5723c2018-12-07 10:09:11 -0500105 clipRect: function() {},
106 concat: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500107 drawArc: function() {},
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500108 drawImage: function() {},
109 drawImageRect: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500110 drawLine: function() {},
111 drawOval: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400112 drawPaint: function() {},
113 drawPath: function() {},
Kevin Lubickcc13fd32019-04-05 13:00:01 -0400114 drawPicture: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -0500115 drawRect: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500116 drawRoundRect: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500117 drawShadow: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -0500118 drawText: function() {},
Kevin Lubickec4903d2019-01-14 08:36:08 -0500119 drawTextBlob: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -0500120 drawVertices: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400121 flush: function() {},
Kevin Lubick5d5723c2018-12-07 10:09:11 -0500122 getTotalMatrix: function() {},
Kevin Lubick543f3522019-03-08 10:04:28 -0500123 makeSurface: function() {},
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500124 restore: function() {},
Kevin Lubickb3574c92019-03-06 08:25:36 -0500125 restoreToCount: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400126 rotate: function() {},
127 save: function() {},
Kevin Lubickb3574c92019-03-06 08:25:36 -0500128 saveLayer: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400129 scale: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400130 skew: function() {},
131 translate: function() {},
132
133 // private API
Kevin Lubickee91c072019-03-29 10:39:52 -0400134 _drawAtlas: function() {},
Kevin Lubickec4903d2019-01-14 08:36:08 -0500135 _drawSimpleText: function() {},
Kevin Lubick52b9f372018-12-04 13:57:36 -0500136 _readPixels: function() {},
137 _writePixels: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400138 delete: function() {},
139 },
140
Kevin Lubick35ac0382019-01-02 15:13:57 -0500141 SkFont: {
142 // public API (from C++ bindings)
143 getScaleX: function() {},
144 getSize: function() {},
145 getSkewX: function() {},
146 getTypeface: function() {},
147 measureText: function() {},
148 setScaleX: function() {},
149 setSize: function() {},
150 setSkewX: function() {},
151 setTypeface: function() {},
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400152 // private API (from C++ bindings)
153 _getWidths: function() {},
Kevin Lubick35ac0382019-01-02 15:13:57 -0500154 },
155
Kevin Lubickddd0a332018-12-12 10:35:13 -0500156 SkFontMgr: {
157 // public API (from C++ bindings)
158 RefDefault: function() {},
159 countFamilies: function() {},
160
161 // private API
162 _makeTypefaceFromData: function() {},
163 },
164
Kevin Lubick006a6f32018-10-19 14:34:34 -0400165 SkImage: {
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500166 // public API (from C++ bindings)
167 height: function() {},
168 width: function() {},
Alexander Khovansky3e119332018-11-15 02:01:19 +0300169 // private API
170 _encodeToData: function() {},
171 _encodeToDataWithFormat: function() {},
Kevin Lubicka064c282019-04-04 09:28:53 -0400172 _makeShader: 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 Lubickcc13fd32019-04-05 13:00:01 -0400265 SkPicture: {
266 DEBUGONLY_serialize: function() {},
267 },
268
269 SkPictureRecorder: {
270 beginRecording: function() {},
271 finishRecordingAsPicture: function() {},
272 },
273
Kevin Lubick006a6f32018-10-19 14:34:34 -0400274 SkRect: {
275 fLeft: {},
276 fTop: {},
277 fRight: {},
278 fBottom: {},
279 },
280
281 SkSurface: {
282 // public API (from C++ bindings)
283 /** @return {CanvasKit.SkCanvas} */
284 getCanvas: function() {},
285 /** @return {CanvasKit.SkImage} */
286 makeImageSnapshot: function() {},
Kevin Lubick543f3522019-03-08 10:04:28 -0500287 makeSurface: function() {},
Kevin Lubickcd544662019-03-22 15:41:36 -0400288 grContext: {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400289
290 // private API
291 _flush: function() {},
292 _getRasterN32PremulSurface: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400293 delete: function() {},
294 },
295
Kevin Lubickec4903d2019-01-14 08:36:08 -0500296 SkTextBlob: {
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400297 // public API (both C++ and JS bindings)
298 MakeFromRSXform: function() {},
Kevin Lubickec4903d2019-01-14 08:36:08 -0500299 MakeFromText: function() {},
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400300 MakeOnPath: function() {},
301 // private API (from C++ bindings)
302 _MakeFromRSXform: function() {},
Kevin Lubickec4903d2019-01-14 08:36:08 -0500303 _MakeFromText: function() {},
304 },
305
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400306 SkVertices: {
307 // public API (from C++ bindings)
Kevin Lubick12c0e502018-11-28 12:51:56 -0500308 bounds: function() {},
309 mode: function() {},
310 uniqueID: function() {},
311 vertexCount: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400312
313 // private API
314 /** @return {CanvasKit.SkVertices} */
315 _applyBones: function() {},
316 },
317
Kevin Lubick006a6f32018-10-19 14:34:34 -0400318 // Constants and Enums
319 gpu: {},
320 skottie: {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400321
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500322 TRANSPARENT: {},
323 RED: {},
324 BLUE: {},
325 YELLOW: {},
326 CYAN: {},
327 BLACK: {},
Kevin Lubickea905ec2018-11-30 14:05:58 -0500328 WHITE: {},
329
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500330 MOVE_VERB: {},
331 LINE_VERB: {},
332 QUAD_VERB: {},
333 CONIC_VERB: {},
334 CUBIC_VERB: {},
335 CLOSE_VERB: {},
336
Kevin Lubickea905ec2018-11-30 14:05:58 -0500337 AlphaType: {
338 Opaque: {},
339 Premul: {},
340 Unpremul: {},
341 },
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500342
343 BlendMode: {
344 Clear: {},
345 Src: {},
346 Dst: {},
347 SrcOver: {},
348 DstOver: {},
349 SrcIn: {},
350 DstIn: {},
351 SrcOut: {},
352 DstOut: {},
353 SrcATop: {},
354 DstATop: {},
355 Xor: {},
356 Plus: {},
357 Modulate: {},
358 Screen: {},
359 Overlay: {},
360 Darken: {},
361 Lighten: {},
362 ColorDodge: {},
363 ColorBurn: {},
364 HardLight: {},
365 SoftLight: {},
366 Difference: {},
367 Exclusion: {},
368 Multiply: {},
369 Hue: {},
370 Saturation: {},
371 Color: {},
372 Luminosity: {},
373 },
374
375 BlurStyle: {
376 Normal: {},
377 Solid: {},
378 Outer: {},
379 Inner: {},
380 },
381
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500382 ClipOp: {
383 Difference: {},
384 Intersect: {},
385 },
386
Kevin Lubickea905ec2018-11-30 14:05:58 -0500387 ColorType: {
388 Alpha_8: {},
389 RGB_565: {},
390 ARGB_4444: {},
391 RGBA_8888: {},
392 RGB_888x: {},
393 BGRA_8888: {},
394 RGBA_1010102: {},
395 RGB_101010x: {},
396 Gray_8: {},
397 RGBA_F16: {},
398 RGBA_F32: {},
399 },
400
Kevin Lubick006a6f32018-10-19 14:34:34 -0400401 FillType: {
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500402 Winding: {},
403 EvenOdd: {},
404 InverseWinding: {},
405 InverseEvenOdd: {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400406 },
407
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500408 FilterQuality: {
409 None: {},
410 Low: {},
411 Medium: {},
412 High: {},
413 },
414
Alexander Khovansky3e119332018-11-15 02:01:19 +0300415 ImageFormat: {
416 PNG: {},
417 JPEG: {},
418 },
419
Kevin Lubickb9db3902018-11-26 11:47:54 -0500420 PaintStyle: {
421 Fill: {},
422 Stroke: {},
423 StrokeAndFill: {},
424 },
425
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500426 PathOp: {
427 Difference: {},
428 Intersect: {},
429 Union: {},
430 XOR: {},
431 ReverseDifference: {},
432 },
433
Kevin Lubickb9db3902018-11-26 11:47:54 -0500434 StrokeCap: {
435 Butt: {},
436 Round: {},
437 Square: {},
438 },
439
440 StrokeJoin: {
441 Miter: {},
442 Round: {},
443 Bevel: {},
444 },
445
Kevin Lubickec4903d2019-01-14 08:36:08 -0500446 TextEncoding: {
447 UTF8: {},
448 UTF16: {},
449 UTF32: {},
450 GlyphID: {},
451 },
452
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500453 TileMode: {
454 Clamp: {},
455 Repeat: {},
456 Mirror: {},
Kevin Lubickd29edd72018-12-07 08:29:52 -0500457 Decal: {},
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500458 },
459
460 VertexMode: {
461 Triangles: {},
462 TrianglesStrip: {},
463 TriangleFan: {},
464 },
465
Kevin Lubick006a6f32018-10-19 14:34:34 -0400466 // Things Enscriptem adds for us
467
Kevin Lubick53965c92018-10-11 08:51:55 -0400468 /** Represents the heap of the WASM code
469 * @type {ArrayBuffer}
470 */
471 buffer: {},
472 /**
473 * @type {Float32Array}
474 */
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400475 HEAPF32: {},
Kevin Lubick53965c92018-10-11 08:51:55 -0400476 /**
477 * @type {Uint8Array}
478 */
479 HEAPU8: {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400480 /**
481 * @type {Uint16Array}
482 */
483 HEAPU16: {},
484 /**
485 * @type {Int32Array}
486 */
487 HEAP32: {},
Kevin Lubickf5ea37f2019-02-28 10:06:18 -0500488 /**
489 * @type {Uint32Array}
490 */
491 HEAPU32: {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400492 _malloc: function() {},
493 _free: function() {},
494 onRuntimeInitialized: function() {},
495};
Kevin Lubick217056c2018-09-20 17:39:31 -0400496
Kevin Lubick006a6f32018-10-19 14:34:34 -0400497// Public API things that are newly declared in the JS should go here.
498// It's not enough to declare them above, because closure can still erase them
499// unless they go on the prototype.
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500500CanvasKit.SkPath.prototype.addArc = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400501CanvasKit.SkPath.prototype.addPath = function() {};
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500502CanvasKit.SkPath.prototype.addRect = function() {};
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500503CanvasKit.SkPath.prototype.addRoundRect = function() {};
Alexander Khovansky3e119332018-11-15 02:01:19 +0300504CanvasKit.SkPath.prototype.arc = function() {};
Kevin Lubick006a6f32018-10-19 14:34:34 -0400505CanvasKit.SkPath.prototype.arcTo = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400506CanvasKit.SkPath.prototype.close = function() {};
Kevin Lubick006a6f32018-10-19 14:34:34 -0400507CanvasKit.SkPath.prototype.conicTo = function() {};
508CanvasKit.SkPath.prototype.cubicTo = function() {};
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400509CanvasKit.SkPath.prototype.dash = function() {};
Kevin Lubick006a6f32018-10-19 14:34:34 -0400510CanvasKit.SkPath.prototype.lineTo = function() {};
511CanvasKit.SkPath.prototype.moveTo = function() {};
512CanvasKit.SkPath.prototype.op = function() {};
513CanvasKit.SkPath.prototype.quadTo = function() {};
514CanvasKit.SkPath.prototype.rect = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400515CanvasKit.SkPath.prototype.simplify = function() {};
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400516CanvasKit.SkPath.prototype.stroke = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400517CanvasKit.SkPath.prototype.transform = function() {};
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400518CanvasKit.SkPath.prototype.trim = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400519
Kevin Lubickcc13fd32019-04-05 13:00:01 -0400520CanvasKit.SkPicture.prototype.DEBUGONLY_saveAsFile = function() {};
521
Kevin Lubick5b90b842018-10-17 07:57:18 -0400522CanvasKit.SkSurface.prototype.dispose = function() {};
Kevin Lubick359a7e32019-03-19 09:34:37 -0400523CanvasKit.SkSurface.prototype.flush = function() {};
524CanvasKit.SkSurface.prototype.requestAnimationFrame = function() {};
Kevin Lubickcc13fd32019-04-05 13:00:01 -0400525CanvasKit.SkSurface.prototype.captureFrameAsSkPicture = function() {};
Kevin Lubick53965c92018-10-11 08:51:55 -0400526
Kevin Lubick12c0e502018-11-28 12:51:56 -0500527/** @return {CanvasKit.SkVertices} */
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400528CanvasKit.SkVertices.prototype.applyBones = function() {};
529
Alexander Khovansky3e119332018-11-15 02:01:19 +0300530CanvasKit.SkImage.prototype.encodeToData = function() {};
Kevin Lubicka064c282019-04-04 09:28:53 -0400531CanvasKit.SkImage.prototype.makeShader = function() {};
Alexander Khovansky3e119332018-11-15 02:01:19 +0300532
Kevin Lubickee91c072019-03-29 10:39:52 -0400533CanvasKit.SkCanvas.prototype.drawAtlas = function() {};
Kevin Lubickec4903d2019-01-14 08:36:08 -0500534CanvasKit.SkCanvas.prototype.drawText = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500535/** @return {Uint8Array} */
536CanvasKit.SkCanvas.prototype.readPixels = function() {};
537CanvasKit.SkCanvas.prototype.writePixels = function() {};
538
Kevin Lubickddd0a332018-12-12 10:35:13 -0500539CanvasKit.SkFontMgr.prototype.MakeTypefaceFromData = function() {};
540
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400541CanvasKit.SkFont.prototype.getWidths = function() {};
542
543CanvasKit.RSXFormBuilder.prototype.build = function() {};
544CanvasKit.RSXFormBuilder.prototype.delete = function() {};
545CanvasKit.RSXFormBuilder.prototype.push = function() {};
Kevin Lubickee91c072019-03-29 10:39:52 -0400546CanvasKit.RSXFormBuilder.prototype.set = function() {};
547
548CanvasKit.SkColorBuilder.prototype.build = function() {};
549CanvasKit.SkColorBuilder.prototype.delete = function() {};
550CanvasKit.SkColorBuilder.prototype.push = function() {};
551CanvasKit.SkColorBuilder.prototype.set = function() {};
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400552
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400553// Define StrokeOpts object
554var StrokeOpts = {};
555StrokeOpts.prototype.width;
556StrokeOpts.prototype.miter_limit;
557StrokeOpts.prototype.cap;
558StrokeOpts.prototype.join;
Kevin Lubick1646e7d2018-12-07 13:03:08 -0500559StrokeOpts.prototype.precision;
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400560
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500561// Define everything created in the canvas2d spec here
Kevin Lubickb9db3902018-11-26 11:47:54 -0500562var HTMLCanvas = {};
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500563HTMLCanvas.prototype.decodeImage = function() {};
564HTMLCanvas.prototype.dispose = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500565HTMLCanvas.prototype.getContext = function() {};
Kevin Lubick8e4a3312018-12-14 15:03:41 -0500566HTMLCanvas.prototype.loadFont = function() {};
Kevin Lubicka40f8322018-12-17 16:01:36 -0500567HTMLCanvas.prototype.makePath2D = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500568HTMLCanvas.prototype.toDataURL = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500569
570var CanvasRenderingContext2D = {};
571CanvasRenderingContext2D.prototype.addHitRegion = function() {};
572CanvasRenderingContext2D.prototype.arc = function() {};
573CanvasRenderingContext2D.prototype.arcTo = function() {};
574CanvasRenderingContext2D.prototype.beginPath = function() {};
575CanvasRenderingContext2D.prototype.bezierCurveTo = function() {};
576CanvasRenderingContext2D.prototype.clearHitRegions = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500577CanvasRenderingContext2D.prototype.clearRect = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500578CanvasRenderingContext2D.prototype.clip = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500579CanvasRenderingContext2D.prototype.closePath = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500580CanvasRenderingContext2D.prototype.createImageData = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500581CanvasRenderingContext2D.prototype.createLinearGradient = function() {};
Kevin Lubickd29edd72018-12-07 08:29:52 -0500582CanvasRenderingContext2D.prototype.createPattern = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500583CanvasRenderingContext2D.prototype.createRadialGradient = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500584CanvasRenderingContext2D.prototype.drawFocusIfNeeded = function() {};
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500585CanvasRenderingContext2D.prototype.drawImage = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500586CanvasRenderingContext2D.prototype.ellipse = function() {};
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500587CanvasRenderingContext2D.prototype.fill = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500588CanvasRenderingContext2D.prototype.fillRect = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500589CanvasRenderingContext2D.prototype.fillText = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500590CanvasRenderingContext2D.prototype.getImageData = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500591CanvasRenderingContext2D.prototype.getLineDash = function() {};
Kevin Lubick1646e7d2018-12-07 13:03:08 -0500592CanvasRenderingContext2D.prototype.isPointInPath = function() {};
593CanvasRenderingContext2D.prototype.isPointInStroke = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500594CanvasRenderingContext2D.prototype.lineTo = function() {};
595CanvasRenderingContext2D.prototype.measureText = function() {};
596CanvasRenderingContext2D.prototype.moveTo = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500597CanvasRenderingContext2D.prototype.putImageData = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500598CanvasRenderingContext2D.prototype.quadraticCurveTo = function() {};
599CanvasRenderingContext2D.prototype.rect = function() {};
600CanvasRenderingContext2D.prototype.removeHitRegion = function() {};
601CanvasRenderingContext2D.prototype.resetTransform = function() {};
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500602CanvasRenderingContext2D.prototype.restore = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500603CanvasRenderingContext2D.prototype.rotate = function() {};
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500604CanvasRenderingContext2D.prototype.save = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500605CanvasRenderingContext2D.prototype.scale = function() {};
606CanvasRenderingContext2D.prototype.scrollPathIntoView = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500607CanvasRenderingContext2D.prototype.setLineDash = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500608CanvasRenderingContext2D.prototype.setTransform = function() {};
609CanvasRenderingContext2D.prototype.stroke = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500610CanvasRenderingContext2D.prototype.strokeRect = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500611CanvasRenderingContext2D.prototype.strokeText = function() {};
612CanvasRenderingContext2D.prototype.transform = function() {};
613CanvasRenderingContext2D.prototype.translate = function() {};
614
Kevin Lubicka40f8322018-12-17 16:01:36 -0500615var Path2D = {};
616Path2D.prototype.addPath = function() {};
617Path2D.prototype.arc = function() {};
618Path2D.prototype.arcTo = function() {};
619Path2D.prototype.bezierCurveTo = function() {};
620Path2D.prototype.closePath = function() {};
621Path2D.prototype.ellipse = function() {};
622Path2D.prototype.lineTo = function() {};
623Path2D.prototype.moveTo = function() {};
624Path2D.prototype.quadraticCurveTo = function() {};
625Path2D.prototype.rect = function() {};
626
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500627var LinearCanvasGradient = {};
628LinearCanvasGradient.prototype.addColorStop = function() {};
629var RadialCanvasGradient = {};
630RadialCanvasGradient.prototype.addColorStop = function() {};
Kevin Lubickd29edd72018-12-07 08:29:52 -0500631var CanvasPattern = {};
632CanvasPattern.prototype.setTransform = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500633
Kevin Lubick52b9f372018-12-04 13:57:36 -0500634var ImageData = {
635 /**
636 * @type {Uint8ClampedArray}
637 */
638 data: {},
639 height: {},
640 width: {},
641};
642
Kevin Lubickd29edd72018-12-07 08:29:52 -0500643var DOMMatrix = {
644 a: {},
645 b: {},
646 c: {},
647 d: {},
648 e: {},
649 f: {},
650};
651
Kevin Lubick217056c2018-09-20 17:39:31 -0400652// 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 -0500653function loadWebAssemblyModule() {};