blob: 636823e4886cc5f066aded48d3396aebdac6e46c [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 Lubicke384df42019-08-26 15:48:09 -0400108 drawCircle: function() {},
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500109 drawImage: function() {},
110 drawImageRect: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500111 drawLine: function() {},
112 drawOval: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400113 drawPaint: function() {},
114 drawPath: function() {},
Kevin Lubickcc13fd32019-04-05 13:00:01 -0400115 drawPicture: 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 Lubicke384df42019-08-26 15:48:09 -0400120 getSaveCount: function() {},
Kevin Lubickec4903d2019-01-14 08:36:08 -0500121 drawTextBlob: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -0500122 drawVertices: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400123 flush: function() {},
Kevin Lubick5d5723c2018-12-07 10:09:11 -0500124 getTotalMatrix: function() {},
Kevin Lubick543f3522019-03-08 10:04:28 -0500125 makeSurface: function() {},
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500126 restore: function() {},
Kevin Lubickb3574c92019-03-06 08:25:36 -0500127 restoreToCount: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400128 rotate: function() {},
129 save: function() {},
Kevin Lubickb3574c92019-03-06 08:25:36 -0500130 saveLayer: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400131 scale: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400132 skew: function() {},
133 translate: function() {},
134
135 // private API
Kevin Lubickee91c072019-03-29 10:39:52 -0400136 _drawAtlas: function() {},
Kevin Lubickec4903d2019-01-14 08:36:08 -0500137 _drawSimpleText: function() {},
Kevin Lubick52b9f372018-12-04 13:57:36 -0500138 _readPixels: function() {},
139 _writePixels: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400140 delete: function() {},
141 },
142
Kevin Lubick35ac0382019-01-02 15:13:57 -0500143 SkFont: {
144 // public API (from C++ bindings)
145 getScaleX: function() {},
146 getSize: function() {},
147 getSkewX: function() {},
148 getTypeface: function() {},
149 measureText: function() {},
150 setScaleX: function() {},
151 setSize: function() {},
152 setSkewX: function() {},
153 setTypeface: function() {},
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400154 // private API (from C++ bindings)
155 _getWidths: function() {},
Kevin Lubick35ac0382019-01-02 15:13:57 -0500156 },
157
Kevin Lubickddd0a332018-12-12 10:35:13 -0500158 SkFontMgr: {
159 // public API (from C++ bindings)
160 RefDefault: function() {},
161 countFamilies: function() {},
162
163 // private API
164 _makeTypefaceFromData: function() {},
165 },
166
Kevin Lubick006a6f32018-10-19 14:34:34 -0400167 SkImage: {
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500168 // public API (from C++ bindings)
169 height: function() {},
170 width: function() {},
Alexander Khovansky3e119332018-11-15 02:01:19 +0300171 // private API
172 _encodeToData: function() {},
173 _encodeToDataWithFormat: function() {},
Kevin Lubicka064c282019-04-04 09:28:53 -0400174 _makeShader: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400175 },
176
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500177 SkMatrix: {
Kevin Lubickb9db3902018-11-26 11:47:54 -0500178 identity: function() {},
Kevin Lubickf3555182019-03-14 10:55:10 -0400179 invert: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500180 mapPoints: function() {},
181 multiply: function() {},
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500182 rotated: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500183 scaled: function() {},
184 skewed: function() {},
185 translated: function() {},
186 },
187
188 SkPaint: {
189 // public API (from C++ bindings)
190 /** @return {CanvasKit.SkPaint} */
191 copy: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -0500192 getBlendMode: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500193 getColor: function() {},
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500194 getFilterQuality: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500195 getStrokeCap: function() {},
196 getStrokeJoin: function() {},
197 getStrokeMiter: function() {},
198 getStrokeWidth: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500199 setAntiAlias: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -0500200 setBlendMode: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500201 setColor: function() {},
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500202 setFilterQuality: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500203 setMaskFilter: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500204 setPathEffect: function() {},
205 setShader: function() {},
206 setStrokeCap: function() {},
207 setStrokeJoin: function() {},
208 setStrokeMiter: function() {},
209 setStrokeWidth: function() {},
210 setStyle: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500211
212 //private API
213 delete: function() {},
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500214 },
215
Kevin Lubick006a6f32018-10-19 14:34:34 -0400216 SkPath: {
217 // public API (from C++ bindings)
Kevin Lubickb9db3902018-11-26 11:47:54 -0500218 computeTightBounds: function() {},
Kevin Lubick1646e7d2018-12-07 13:03:08 -0500219 contains: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500220 /** @return {CanvasKit.SkPath} */
221 copy: function() {},
222 countPoints: function() {},
223 equals: function() {},
224 getBounds: function() {},
225 getFillType: function() {},
226 getPoint: function() {},
Kevin Lubick1646e7d2018-12-07 13:03:08 -0500227 isEmpty: function() {},
Kevin Lubick2b79d1c2018-12-14 16:10:38 -0500228 isVolatile: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500229 reset: function() {},
230 rewind: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500231 setFillType: function() {},
Kevin Lubick2b79d1c2018-12-14 16:10:38 -0500232 setIsVolatile: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500233 toSVGString: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400234
235 // private API
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500236 _addArc: function() {},
Kevin Lubicke384df42019-08-26 15:48:09 -0400237 _addOval: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400238 _addPath: function() {},
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500239 _addRect: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500240 _addRoundRect: function() {},
Alexander Khovansky3e119332018-11-15 02:01:19 +0300241 _arc: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400242 _arcTo: function() {},
243 _close: function() {},
244 _conicTo: function() {},
245 _cubicTo: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400246 _dash: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400247 _lineTo: function() {},
248 _moveTo: function() {},
249 _op: function() {},
250 _quadTo: function() {},
251 _rect: function() {},
252 _simplify: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400253 _stroke: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400254 _transform: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400255 _trim: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400256 delete: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500257 dump: function() {},
258 dumpHex: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400259 },
260
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400261 SkPathMeasure: {
262 getLength: function() {},
263 getPosTan: function() {},
264 isClosed: function() {},
265 nextContour: function() {},
266 },
267
Kevin Lubickcc13fd32019-04-05 13:00:01 -0400268 SkPicture: {
269 DEBUGONLY_serialize: function() {},
270 },
271
272 SkPictureRecorder: {
273 beginRecording: function() {},
274 finishRecordingAsPicture: function() {},
275 },
276
Kevin Lubick006a6f32018-10-19 14:34:34 -0400277 SkRect: {
278 fLeft: {},
279 fTop: {},
280 fRight: {},
281 fBottom: {},
282 },
283
284 SkSurface: {
285 // public API (from C++ bindings)
286 /** @return {CanvasKit.SkCanvas} */
287 getCanvas: function() {},
288 /** @return {CanvasKit.SkImage} */
289 makeImageSnapshot: function() {},
Kevin Lubick543f3522019-03-08 10:04:28 -0500290 makeSurface: function() {},
Kevin Lubickcd544662019-03-22 15:41:36 -0400291 grContext: {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400292
293 // private API
294 _flush: function() {},
295 _getRasterN32PremulSurface: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400296 delete: function() {},
297 },
298
Kevin Lubickec4903d2019-01-14 08:36:08 -0500299 SkTextBlob: {
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400300 // public API (both C++ and JS bindings)
301 MakeFromRSXform: function() {},
Kevin Lubickec4903d2019-01-14 08:36:08 -0500302 MakeFromText: function() {},
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400303 MakeOnPath: function() {},
304 // private API (from C++ bindings)
305 _MakeFromRSXform: function() {},
Kevin Lubickec4903d2019-01-14 08:36:08 -0500306 _MakeFromText: function() {},
307 },
308
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400309 SkVertices: {
310 // public API (from C++ bindings)
Kevin Lubick12c0e502018-11-28 12:51:56 -0500311 bounds: function() {},
312 mode: function() {},
313 uniqueID: function() {},
314 vertexCount: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400315
316 // private API
317 /** @return {CanvasKit.SkVertices} */
318 _applyBones: function() {},
319 },
320
Kevin Lubickd6ba7252019-06-03 14:38:05 -0400321 _SkVerticesBuilder: {
322 // public API (from C++ bindings)
323 boneIndices: function() {},
324 boneWeights: function() {},
325 colors: function() {},
326 detach: function() {},
327 indices: function() {},
328 positions: function() {},
329 texCoords: function() {},
330 },
331
Kevin Lubick006a6f32018-10-19 14:34:34 -0400332 // Constants and Enums
333 gpu: {},
334 skottie: {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400335
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500336 TRANSPARENT: {},
337 RED: {},
338 BLUE: {},
339 YELLOW: {},
340 CYAN: {},
341 BLACK: {},
Kevin Lubickea905ec2018-11-30 14:05:58 -0500342 WHITE: {},
343
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500344 MOVE_VERB: {},
345 LINE_VERB: {},
346 QUAD_VERB: {},
347 CONIC_VERB: {},
348 CUBIC_VERB: {},
349 CLOSE_VERB: {},
350
Kevin Lubickea905ec2018-11-30 14:05:58 -0500351 AlphaType: {
352 Opaque: {},
353 Premul: {},
354 Unpremul: {},
355 },
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500356
357 BlendMode: {
358 Clear: {},
359 Src: {},
360 Dst: {},
361 SrcOver: {},
362 DstOver: {},
363 SrcIn: {},
364 DstIn: {},
365 SrcOut: {},
366 DstOut: {},
367 SrcATop: {},
368 DstATop: {},
369 Xor: {},
370 Plus: {},
371 Modulate: {},
372 Screen: {},
373 Overlay: {},
374 Darken: {},
375 Lighten: {},
376 ColorDodge: {},
377 ColorBurn: {},
378 HardLight: {},
379 SoftLight: {},
380 Difference: {},
381 Exclusion: {},
382 Multiply: {},
383 Hue: {},
384 Saturation: {},
385 Color: {},
386 Luminosity: {},
387 },
388
389 BlurStyle: {
390 Normal: {},
391 Solid: {},
392 Outer: {},
393 Inner: {},
394 },
395
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500396 ClipOp: {
397 Difference: {},
398 Intersect: {},
399 },
400
Kevin Lubickea905ec2018-11-30 14:05:58 -0500401 ColorType: {
402 Alpha_8: {},
403 RGB_565: {},
404 ARGB_4444: {},
405 RGBA_8888: {},
406 RGB_888x: {},
407 BGRA_8888: {},
408 RGBA_1010102: {},
409 RGB_101010x: {},
410 Gray_8: {},
411 RGBA_F16: {},
412 RGBA_F32: {},
413 },
414
Kevin Lubick006a6f32018-10-19 14:34:34 -0400415 FillType: {
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500416 Winding: {},
417 EvenOdd: {},
418 InverseWinding: {},
419 InverseEvenOdd: {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400420 },
421
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500422 FilterQuality: {
423 None: {},
424 Low: {},
425 Medium: {},
426 High: {},
427 },
428
Alexander Khovansky3e119332018-11-15 02:01:19 +0300429 ImageFormat: {
430 PNG: {},
431 JPEG: {},
432 },
433
Kevin Lubickb9db3902018-11-26 11:47:54 -0500434 PaintStyle: {
435 Fill: {},
436 Stroke: {},
437 StrokeAndFill: {},
438 },
439
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500440 PathOp: {
441 Difference: {},
442 Intersect: {},
443 Union: {},
444 XOR: {},
445 ReverseDifference: {},
446 },
447
Kevin Lubickb9db3902018-11-26 11:47:54 -0500448 StrokeCap: {
449 Butt: {},
450 Round: {},
451 Square: {},
452 },
453
454 StrokeJoin: {
455 Miter: {},
456 Round: {},
457 Bevel: {},
458 },
459
Kevin Lubickec4903d2019-01-14 08:36:08 -0500460 TextEncoding: {
461 UTF8: {},
462 UTF16: {},
463 UTF32: {},
464 GlyphID: {},
465 },
466
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500467 TileMode: {
468 Clamp: {},
469 Repeat: {},
470 Mirror: {},
Kevin Lubickd29edd72018-12-07 08:29:52 -0500471 Decal: {},
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500472 },
473
474 VertexMode: {
475 Triangles: {},
476 TrianglesStrip: {},
477 TriangleFan: {},
478 },
479
Kevin Lubick006a6f32018-10-19 14:34:34 -0400480 // Things Enscriptem adds for us
481
Kevin Lubick53965c92018-10-11 08:51:55 -0400482 /** Represents the heap of the WASM code
483 * @type {ArrayBuffer}
484 */
485 buffer: {},
486 /**
487 * @type {Float32Array}
488 */
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400489 HEAPF32: {},
Kevin Lubick53965c92018-10-11 08:51:55 -0400490 /**
491 * @type {Uint8Array}
492 */
493 HEAPU8: {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400494 /**
495 * @type {Uint16Array}
496 */
497 HEAPU16: {},
498 /**
499 * @type {Int32Array}
500 */
501 HEAP32: {},
Kevin Lubickf5ea37f2019-02-28 10:06:18 -0500502 /**
503 * @type {Uint32Array}
504 */
505 HEAPU32: {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400506 _malloc: function() {},
507 _free: function() {},
508 onRuntimeInitialized: function() {},
509};
Kevin Lubick217056c2018-09-20 17:39:31 -0400510
Kevin Lubick006a6f32018-10-19 14:34:34 -0400511// Public API things that are newly declared in the JS should go here.
512// It's not enough to declare them above, because closure can still erase them
513// unless they go on the prototype.
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500514CanvasKit.SkPath.prototype.addArc = function() {};
Kevin Lubicke384df42019-08-26 15:48:09 -0400515CanvasKit.SkPath.prototype.addOval = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400516CanvasKit.SkPath.prototype.addPath = function() {};
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500517CanvasKit.SkPath.prototype.addRect = function() {};
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500518CanvasKit.SkPath.prototype.addRoundRect = function() {};
Alexander Khovansky3e119332018-11-15 02:01:19 +0300519CanvasKit.SkPath.prototype.arc = function() {};
Kevin Lubick006a6f32018-10-19 14:34:34 -0400520CanvasKit.SkPath.prototype.arcTo = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400521CanvasKit.SkPath.prototype.close = function() {};
Kevin Lubick006a6f32018-10-19 14:34:34 -0400522CanvasKit.SkPath.prototype.conicTo = function() {};
523CanvasKit.SkPath.prototype.cubicTo = function() {};
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400524CanvasKit.SkPath.prototype.dash = function() {};
Kevin Lubick006a6f32018-10-19 14:34:34 -0400525CanvasKit.SkPath.prototype.lineTo = function() {};
526CanvasKit.SkPath.prototype.moveTo = function() {};
Kevin Lubicke384df42019-08-26 15:48:09 -0400527CanvasKit.SkPath.prototype.offset = function() {};
Kevin Lubick006a6f32018-10-19 14:34:34 -0400528CanvasKit.SkPath.prototype.op = function() {};
529CanvasKit.SkPath.prototype.quadTo = function() {};
530CanvasKit.SkPath.prototype.rect = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400531CanvasKit.SkPath.prototype.simplify = function() {};
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400532CanvasKit.SkPath.prototype.stroke = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400533CanvasKit.SkPath.prototype.transform = function() {};
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400534CanvasKit.SkPath.prototype.trim = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400535
Kevin Lubickcc13fd32019-04-05 13:00:01 -0400536CanvasKit.SkPicture.prototype.DEBUGONLY_saveAsFile = function() {};
537
Kevin Lubick5b90b842018-10-17 07:57:18 -0400538CanvasKit.SkSurface.prototype.dispose = function() {};
Kevin Lubick359a7e32019-03-19 09:34:37 -0400539CanvasKit.SkSurface.prototype.flush = function() {};
540CanvasKit.SkSurface.prototype.requestAnimationFrame = function() {};
Kevin Lubickcc13fd32019-04-05 13:00:01 -0400541CanvasKit.SkSurface.prototype.captureFrameAsSkPicture = function() {};
Kevin Lubick53965c92018-10-11 08:51:55 -0400542
Kevin Lubick12c0e502018-11-28 12:51:56 -0500543/** @return {CanvasKit.SkVertices} */
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400544CanvasKit.SkVertices.prototype.applyBones = function() {};
545
Alexander Khovansky3e119332018-11-15 02:01:19 +0300546CanvasKit.SkImage.prototype.encodeToData = function() {};
Kevin Lubicka064c282019-04-04 09:28:53 -0400547CanvasKit.SkImage.prototype.makeShader = function() {};
Alexander Khovansky3e119332018-11-15 02:01:19 +0300548
Kevin Lubickee91c072019-03-29 10:39:52 -0400549CanvasKit.SkCanvas.prototype.drawAtlas = function() {};
Kevin Lubickec4903d2019-01-14 08:36:08 -0500550CanvasKit.SkCanvas.prototype.drawText = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500551/** @return {Uint8Array} */
552CanvasKit.SkCanvas.prototype.readPixels = function() {};
553CanvasKit.SkCanvas.prototype.writePixels = function() {};
554
Kevin Lubickddd0a332018-12-12 10:35:13 -0500555CanvasKit.SkFontMgr.prototype.MakeTypefaceFromData = function() {};
556
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400557CanvasKit.SkFont.prototype.getWidths = function() {};
558
559CanvasKit.RSXFormBuilder.prototype.build = function() {};
560CanvasKit.RSXFormBuilder.prototype.delete = function() {};
561CanvasKit.RSXFormBuilder.prototype.push = function() {};
Kevin Lubickee91c072019-03-29 10:39:52 -0400562CanvasKit.RSXFormBuilder.prototype.set = function() {};
563
564CanvasKit.SkColorBuilder.prototype.build = function() {};
565CanvasKit.SkColorBuilder.prototype.delete = function() {};
566CanvasKit.SkColorBuilder.prototype.push = function() {};
567CanvasKit.SkColorBuilder.prototype.set = function() {};
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400568
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400569// Define StrokeOpts object
570var StrokeOpts = {};
571StrokeOpts.prototype.width;
572StrokeOpts.prototype.miter_limit;
573StrokeOpts.prototype.cap;
574StrokeOpts.prototype.join;
Kevin Lubick1646e7d2018-12-07 13:03:08 -0500575StrokeOpts.prototype.precision;
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400576
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500577// Define everything created in the canvas2d spec here
Kevin Lubickb9db3902018-11-26 11:47:54 -0500578var HTMLCanvas = {};
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500579HTMLCanvas.prototype.decodeImage = function() {};
580HTMLCanvas.prototype.dispose = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500581HTMLCanvas.prototype.getContext = function() {};
Kevin Lubick8e4a3312018-12-14 15:03:41 -0500582HTMLCanvas.prototype.loadFont = function() {};
Kevin Lubicka40f8322018-12-17 16:01:36 -0500583HTMLCanvas.prototype.makePath2D = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500584HTMLCanvas.prototype.toDataURL = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500585
586var CanvasRenderingContext2D = {};
587CanvasRenderingContext2D.prototype.addHitRegion = function() {};
588CanvasRenderingContext2D.prototype.arc = function() {};
589CanvasRenderingContext2D.prototype.arcTo = function() {};
590CanvasRenderingContext2D.prototype.beginPath = function() {};
591CanvasRenderingContext2D.prototype.bezierCurveTo = function() {};
592CanvasRenderingContext2D.prototype.clearHitRegions = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500593CanvasRenderingContext2D.prototype.clearRect = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500594CanvasRenderingContext2D.prototype.clip = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500595CanvasRenderingContext2D.prototype.closePath = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500596CanvasRenderingContext2D.prototype.createImageData = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500597CanvasRenderingContext2D.prototype.createLinearGradient = function() {};
Kevin Lubickd29edd72018-12-07 08:29:52 -0500598CanvasRenderingContext2D.prototype.createPattern = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500599CanvasRenderingContext2D.prototype.createRadialGradient = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500600CanvasRenderingContext2D.prototype.drawFocusIfNeeded = function() {};
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500601CanvasRenderingContext2D.prototype.drawImage = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500602CanvasRenderingContext2D.prototype.ellipse = function() {};
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500603CanvasRenderingContext2D.prototype.fill = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500604CanvasRenderingContext2D.prototype.fillRect = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500605CanvasRenderingContext2D.prototype.fillText = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500606CanvasRenderingContext2D.prototype.getImageData = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500607CanvasRenderingContext2D.prototype.getLineDash = function() {};
Kevin Lubick1646e7d2018-12-07 13:03:08 -0500608CanvasRenderingContext2D.prototype.isPointInPath = function() {};
609CanvasRenderingContext2D.prototype.isPointInStroke = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500610CanvasRenderingContext2D.prototype.lineTo = function() {};
611CanvasRenderingContext2D.prototype.measureText = function() {};
612CanvasRenderingContext2D.prototype.moveTo = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500613CanvasRenderingContext2D.prototype.putImageData = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500614CanvasRenderingContext2D.prototype.quadraticCurveTo = function() {};
615CanvasRenderingContext2D.prototype.rect = function() {};
616CanvasRenderingContext2D.prototype.removeHitRegion = function() {};
617CanvasRenderingContext2D.prototype.resetTransform = function() {};
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500618CanvasRenderingContext2D.prototype.restore = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500619CanvasRenderingContext2D.prototype.rotate = function() {};
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500620CanvasRenderingContext2D.prototype.save = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500621CanvasRenderingContext2D.prototype.scale = function() {};
622CanvasRenderingContext2D.prototype.scrollPathIntoView = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500623CanvasRenderingContext2D.prototype.setLineDash = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500624CanvasRenderingContext2D.prototype.setTransform = function() {};
625CanvasRenderingContext2D.prototype.stroke = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500626CanvasRenderingContext2D.prototype.strokeRect = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500627CanvasRenderingContext2D.prototype.strokeText = function() {};
628CanvasRenderingContext2D.prototype.transform = function() {};
629CanvasRenderingContext2D.prototype.translate = function() {};
630
Kevin Lubicka40f8322018-12-17 16:01:36 -0500631var Path2D = {};
632Path2D.prototype.addPath = function() {};
633Path2D.prototype.arc = function() {};
634Path2D.prototype.arcTo = function() {};
635Path2D.prototype.bezierCurveTo = function() {};
636Path2D.prototype.closePath = function() {};
637Path2D.prototype.ellipse = function() {};
638Path2D.prototype.lineTo = function() {};
639Path2D.prototype.moveTo = function() {};
640Path2D.prototype.quadraticCurveTo = function() {};
641Path2D.prototype.rect = function() {};
642
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500643var LinearCanvasGradient = {};
644LinearCanvasGradient.prototype.addColorStop = function() {};
645var RadialCanvasGradient = {};
646RadialCanvasGradient.prototype.addColorStop = function() {};
Kevin Lubickd29edd72018-12-07 08:29:52 -0500647var CanvasPattern = {};
648CanvasPattern.prototype.setTransform = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500649
Kevin Lubick52b9f372018-12-04 13:57:36 -0500650var ImageData = {
651 /**
652 * @type {Uint8ClampedArray}
653 */
654 data: {},
655 height: {},
656 width: {},
657};
658
Kevin Lubickd29edd72018-12-07 08:29:52 -0500659var DOMMatrix = {
660 a: {},
661 b: {},
662 c: {},
663 d: {},
664 e: {},
665 f: {},
666};
667
Kevin Lubick217056c2018-09-20 17:39:31 -0400668// 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 -0500669function loadWebAssemblyModule() {};