blob: 88c42766f0cdb48b936b3cdb1c964f1686a07c02 [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 Lubick7d644e12019-09-11 14:22:22 -040032 /** @return {CanvasKit.SkRRect} */
33 RRectXY: function() {},
Kevin Lubick52b9f372018-12-04 13:57:36 -050034 /** @return {ImageData} */
35 ImageData: function() {},
Kevin Lubick543f3522019-03-08 10:04:28 -050036
37 GetWebGLContext: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -050038 MakeBlurMaskFilter: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -040039 MakeCanvas: function() {},
40 MakeCanvasSurface: function() {},
Kevin Lubick543f3522019-03-08 10:04:28 -050041 MakeGrContext: function() {},
Kevin Lubick6b921b72019-09-18 16:18:17 -040042 /** @return {CanvasKit.SkAnimatedImage} */
43 MakeAnimatedImageFromEncoded: function() {},
Kevin Lubick0a1293c2018-12-03 12:31:04 -050044 /** @return {CanvasKit.SkImage} */
45 MakeImageFromEncoded: function() {},
Kevin Lubickeb2f6b02018-11-29 15:07:02 -050046 /** @return {LinearCanvasGradient} */
Kevin Lubickb5ae3b52018-11-03 07:51:19 -040047 MakeLinearGradientShader: function() {},
Kevin Lubick543f3522019-03-08 10:04:28 -050048 MakeOnScreenGLSurface: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -050049 MakePathFromCmds: function() {},
Kevin Lubicka40f8322018-12-17 16:01:36 -050050 MakePathFromOp: function() {},
51 MakePathFromSVGString: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -050052 MakeRadialGradientShader: function() {},
Kevin Lubick543f3522019-03-08 10:04:28 -050053 MakeRenderTarget: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -050054 MakeSWCanvasSurface: function() {},
Kevin Lubickf5ea37f2019-02-28 10:06:18 -050055 MakeManagedAnimation: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -040056 MakeSkDashPathEffect: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -040057 MakeSkVertices: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -040058 MakeSurface: function() {},
Kevin Lubickeb2f6b02018-11-29 15:07:02 -050059 /** @return {RadialCanvasGradient} */
60 MakeTwoPointConicalGradientShader: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -050061 MakeWebGLCanvasSurface: function() {},
Kevin Lubick50f377e2019-09-11 15:23:00 -040062 /** @return {TonalColors} */
63 computeTonalColors: function() {},
Kevin Lubick217056c2018-09-20 17:39:31 -040064 currentContext: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -050065 getColorComponents: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -050066 getSkDataBytes: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -050067 multiplyByAlpha: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -040068 setCurrentContext: function() {},
Kevin Lubick217056c2018-09-20 17:39:31 -040069
70 // private API (i.e. things declared in the bindings that we use
71 // in the pre-js file)
Kevin Lubick52b9f372018-12-04 13:57:36 -050072 _MakeImage: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -040073 _MakeLinearGradientShader: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -050074 _MakePathFromCmds: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -040075 _MakeRadialGradientShader: function() {},
Kevin Lubickf5ea37f2019-02-28 10:06:18 -050076 _MakeManagedAnimation: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -040077 _MakeSkDashPathEffect: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -040078 _MakeSkVertices: function() {},
Kevin Lubickeb2f6b02018-11-29 15:07:02 -050079 _MakeTwoPointConicalGradientShader: function() {},
Kevin Lubick6b921b72019-09-18 16:18:17 -040080 _decodeAnimatedImage: function() {},
Kevin Lubick0a1293c2018-12-03 12:31:04 -050081 _decodeImage: function() {},
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -050082 _drawShapedText: function() {},
Kevin Lubickea905ec2018-11-30 14:05:58 -050083 _getRasterDirectSurface: function() {},
Kevin Lubick134be1d2018-10-30 15:05:04 -040084 _getRasterN32PremulSurface: function() {},
Kevin Lubick217056c2018-09-20 17:39:31 -040085
Kevin Lubick1a05fce2018-11-20 12:51:16 -050086 // The testing object is meant to expose internal functions
87 // for more fine-grained testing, e.g. parseColor
88 _testing: {},
89
Kevin Lubick217056c2018-09-20 17:39:31 -040090 // Objects and properties on CanvasKit
91
Kevin Lubickcd544662019-03-22 15:41:36 -040092 GrContext: {
93 // public API (from C++ bindings)
94 getResourceCacheLimitBytes: function() {},
95 getResourceCacheUsageBytes: function() {},
96 setResourceCacheLimitBytes: function() {},
97 },
98
Kevin Lubick369f6a52019-10-03 11:22:08 -040099 Paragraph: {
100 // public API (from C++ bindings)
101 getGlyphPositionAtCoordinate: function() {},
102 layout: function() {},
103
104 // private API
105 /** @return {Float32Array} */
106 _getRectsForRange: function() {},
107 },
108
109 ParagraphStyle: function() {},
110
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400111 RSXFormBuilder: function() {},
Kevin Lubickee91c072019-03-29 10:39:52 -0400112 SkColorBuilder: function() {},
113 SkRectBuilder: function() {},
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400114
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -0500115 ShapedText: {
116 // public API (from C++ bindings)
117 getBounds: function() {},
118 },
119
Kevin Lubick6b921b72019-09-18 16:18:17 -0400120 SkAnimatedImage: {
121 // public API (from C++ bindings)
122 getRepetitionCount: function() {},
123 decodeNextFrame: function() {},
124 },
125
Kevin Lubick006a6f32018-10-19 14:34:34 -0400126 SkCanvas: {
127 // public API (from C++ bindings)
128 clear: function() {},
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500129 clipPath: function() {},
Kevin Lubick5d5723c2018-12-07 10:09:11 -0500130 clipRect: function() {},
131 concat: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500132 drawArc: function() {},
Kevin Lubicke384df42019-08-26 15:48:09 -0400133 drawCircle: function() {},
Kevin Lubick2e5fe352019-09-03 12:59:06 -0400134 drawDRRect: function() {},
Kevin Lubick6b921b72019-09-18 16:18:17 -0400135 drawAnimatedImage: function() {},
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500136 drawImage: function() {},
137 drawImageRect: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500138 drawLine: function() {},
139 drawOval: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400140 drawPaint: function() {},
Kevin Lubick369f6a52019-10-03 11:22:08 -0400141 drawParagraph: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400142 drawPath: function() {},
Kevin Lubickcc13fd32019-04-05 13:00:01 -0400143 drawPicture: function() {},
Kevin Lubick2e5fe352019-09-03 12:59:06 -0400144 drawRRect: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -0500145 drawRect: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500146 drawRoundRect: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500147 drawShadow: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -0500148 drawText: function() {},
Kevin Lubickec4903d2019-01-14 08:36:08 -0500149 drawTextBlob: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -0500150 drawVertices: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400151 flush: function() {},
Kevin Lubick2e5fe352019-09-03 12:59:06 -0400152 getSaveCount: function() {},
Kevin Lubick5d5723c2018-12-07 10:09:11 -0500153 getTotalMatrix: function() {},
Kevin Lubick543f3522019-03-08 10:04:28 -0500154 makeSurface: function() {},
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500155 restore: function() {},
Kevin Lubickb3574c92019-03-06 08:25:36 -0500156 restoreToCount: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400157 rotate: function() {},
158 save: function() {},
Kevin Lubickb3574c92019-03-06 08:25:36 -0500159 saveLayer: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400160 scale: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400161 skew: function() {},
162 translate: function() {},
163
164 // private API
Kevin Lubickee91c072019-03-29 10:39:52 -0400165 _drawAtlas: function() {},
Kevin Lubickec4903d2019-01-14 08:36:08 -0500166 _drawSimpleText: function() {},
Kevin Lubick52b9f372018-12-04 13:57:36 -0500167 _readPixels: function() {},
168 _writePixels: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400169 delete: function() {},
170 },
171
Kevin Lubickd3729342019-09-12 11:11:25 -0400172 SkColorFilter: {
173 // public API (from C++ bindings and JS interface)
174 MakeBlend: function() {},
175 MakeCompose: function() {},
176 MakeLerp: function() {},
177 MakeLinearToSRGBGamma: function() {},
178 MakeMatrix: function() {},
179 MakeSRGBToLinearGamma: function() {},
180 // private API (from C++ bindings)
181 _makeMatrix: function() {},
182 },
183
184 SkColorMatrix: {
185 concat: function() {},
186 identity: function() {},
187 postTranslate: function() {},
188 rotated: function() {},
189 scaled: function() {},
190 },
191
Kevin Lubick35ac0382019-01-02 15:13:57 -0500192 SkFont: {
193 // public API (from C++ bindings)
194 getScaleX: function() {},
195 getSize: function() {},
196 getSkewX: function() {},
197 getTypeface: function() {},
198 measureText: function() {},
199 setScaleX: function() {},
200 setSize: function() {},
201 setSkewX: function() {},
202 setTypeface: function() {},
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400203 // private API (from C++ bindings)
204 _getWidths: function() {},
Kevin Lubick35ac0382019-01-02 15:13:57 -0500205 },
206
Kevin Lubickddd0a332018-12-12 10:35:13 -0500207 SkFontMgr: {
Kevin Lubick61887c72019-09-26 13:20:50 -0400208 // public API (from C++ and JS bindings)
209 FromData: function() {},
Kevin Lubickddd0a332018-12-12 10:35:13 -0500210 RefDefault: function() {},
211 countFamilies: function() {},
212
213 // private API
214 _makeTypefaceFromData: function() {},
Kevin Lubick61887c72019-09-26 13:20:50 -0400215 _fromData: function() {},
Kevin Lubickddd0a332018-12-12 10:35:13 -0500216 },
217
Kevin Lubick006a6f32018-10-19 14:34:34 -0400218 SkImage: {
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500219 // public API (from C++ bindings)
220 height: function() {},
221 width: function() {},
Alexander Khovansky3e119332018-11-15 02:01:19 +0300222 // private API
223 _encodeToData: function() {},
224 _encodeToDataWithFormat: function() {},
Kevin Lubicka064c282019-04-04 09:28:53 -0400225 _makeShader: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400226 },
227
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500228 SkMatrix: {
Kevin Lubickb9db3902018-11-26 11:47:54 -0500229 identity: function() {},
Kevin Lubickf3555182019-03-14 10:55:10 -0400230 invert: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500231 mapPoints: function() {},
232 multiply: function() {},
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500233 rotated: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500234 scaled: function() {},
235 skewed: function() {},
236 translated: function() {},
237 },
238
239 SkPaint: {
240 // public API (from C++ bindings)
241 /** @return {CanvasKit.SkPaint} */
242 copy: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -0500243 getBlendMode: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500244 getColor: function() {},
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500245 getFilterQuality: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500246 getStrokeCap: function() {},
247 getStrokeJoin: function() {},
248 getStrokeMiter: function() {},
249 getStrokeWidth: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500250 setAntiAlias: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -0500251 setBlendMode: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500252 setColor: function() {},
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500253 setFilterQuality: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500254 setMaskFilter: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500255 setPathEffect: function() {},
256 setShader: function() {},
257 setStrokeCap: function() {},
258 setStrokeJoin: function() {},
259 setStrokeMiter: function() {},
260 setStrokeWidth: function() {},
261 setStyle: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500262
263 //private API
264 delete: function() {},
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500265 },
266
Kevin Lubick006a6f32018-10-19 14:34:34 -0400267 SkPath: {
268 // public API (from C++ bindings)
Kevin Lubickb9db3902018-11-26 11:47:54 -0500269 computeTightBounds: function() {},
Kevin Lubick1646e7d2018-12-07 13:03:08 -0500270 contains: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500271 /** @return {CanvasKit.SkPath} */
272 copy: function() {},
273 countPoints: function() {},
274 equals: function() {},
275 getBounds: function() {},
276 getFillType: function() {},
277 getPoint: function() {},
Kevin Lubick1646e7d2018-12-07 13:03:08 -0500278 isEmpty: function() {},
Kevin Lubick2b79d1c2018-12-14 16:10:38 -0500279 isVolatile: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500280 reset: function() {},
281 rewind: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500282 setFillType: function() {},
Kevin Lubick2b79d1c2018-12-14 16:10:38 -0500283 setIsVolatile: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500284 toSVGString: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400285
286 // private API
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500287 _addArc: function() {},
Kevin Lubicke384df42019-08-26 15:48:09 -0400288 _addOval: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400289 _addPath: function() {},
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500290 _addRect: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500291 _addRoundRect: function() {},
Alexander Khovansky3e119332018-11-15 02:01:19 +0300292 _arc: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400293 _arcTo: function() {},
294 _close: function() {},
295 _conicTo: function() {},
296 _cubicTo: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400297 _dash: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400298 _lineTo: function() {},
299 _moveTo: function() {},
300 _op: function() {},
301 _quadTo: function() {},
302 _rect: function() {},
303 _simplify: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400304 _stroke: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400305 _transform: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400306 _trim: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400307 delete: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500308 dump: function() {},
309 dumpHex: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400310 },
311
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400312 SkPathMeasure: {
313 getLength: function() {},
314 getPosTan: function() {},
315 isClosed: function() {},
316 nextContour: function() {},
317 },
318
Kevin Lubickcc13fd32019-04-05 13:00:01 -0400319 SkPicture: {
320 DEBUGONLY_serialize: function() {},
321 },
322
323 SkPictureRecorder: {
324 beginRecording: function() {},
325 finishRecordingAsPicture: function() {},
326 },
327
Kevin Lubick006a6f32018-10-19 14:34:34 -0400328 SkRect: {
329 fLeft: {},
330 fTop: {},
331 fRight: {},
332 fBottom: {},
333 },
334
Kevin Lubick2e5fe352019-09-03 12:59:06 -0400335 SkRRect: {
336 rect: {},
Kevin Lubick7d644e12019-09-11 14:22:22 -0400337 rx1: {},
338 ry1: {},
339 rx2: {},
340 ry2: {},
341 rx3: {},
342 ry3: {},
343 rx4: {},
344 ry4: {},
Kevin Lubick2e5fe352019-09-03 12:59:06 -0400345 },
346
Kevin Lubick006a6f32018-10-19 14:34:34 -0400347 SkSurface: {
348 // public API (from C++ bindings)
349 /** @return {CanvasKit.SkCanvas} */
350 getCanvas: function() {},
351 /** @return {CanvasKit.SkImage} */
352 makeImageSnapshot: function() {},
Kevin Lubick543f3522019-03-08 10:04:28 -0500353 makeSurface: function() {},
Kevin Lubickcd544662019-03-22 15:41:36 -0400354 grContext: {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400355
356 // private API
357 _flush: function() {},
358 _getRasterN32PremulSurface: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400359 delete: function() {},
360 },
361
Kevin Lubickec4903d2019-01-14 08:36:08 -0500362 SkTextBlob: {
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400363 // public API (both C++ and JS bindings)
364 MakeFromRSXform: function() {},
Kevin Lubickec4903d2019-01-14 08:36:08 -0500365 MakeFromText: function() {},
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400366 MakeOnPath: function() {},
367 // private API (from C++ bindings)
368 _MakeFromRSXform: function() {},
Kevin Lubickec4903d2019-01-14 08:36:08 -0500369 _MakeFromText: function() {},
370 },
371
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400372 SkVertices: {
373 // public API (from C++ bindings)
Kevin Lubick12c0e502018-11-28 12:51:56 -0500374 bounds: function() {},
375 mode: function() {},
376 uniqueID: function() {},
377 vertexCount: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400378
379 // private API
380 /** @return {CanvasKit.SkVertices} */
381 _applyBones: function() {},
382 },
383
Kevin Lubickd6ba7252019-06-03 14:38:05 -0400384 _SkVerticesBuilder: {
385 // public API (from C++ bindings)
386 boneIndices: function() {},
387 boneWeights: function() {},
388 colors: function() {},
389 detach: function() {},
390 indices: function() {},
391 positions: function() {},
392 texCoords: function() {},
393 },
394
Kevin Lubick369f6a52019-10-03 11:22:08 -0400395 TextStyle: function() {},
396
Kevin Lubick006a6f32018-10-19 14:34:34 -0400397 // Constants and Enums
398 gpu: {},
399 skottie: {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400400
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500401 TRANSPARENT: {},
402 RED: {},
403 BLUE: {},
404 YELLOW: {},
405 CYAN: {},
406 BLACK: {},
Kevin Lubickea905ec2018-11-30 14:05:58 -0500407 WHITE: {},
408
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500409 MOVE_VERB: {},
410 LINE_VERB: {},
411 QUAD_VERB: {},
412 CONIC_VERB: {},
413 CUBIC_VERB: {},
414 CLOSE_VERB: {},
415
Kevin Lubick369f6a52019-10-03 11:22:08 -0400416 NoDecoration: {},
417 UnderlineDecoration: {},
418 OverlineDecoration: {},
419 LineThroughDecoration: {},
420
421 Affinity: {
422 Upstream: {},
423 Downstream: {},
424 },
425
Kevin Lubickea905ec2018-11-30 14:05:58 -0500426 AlphaType: {
427 Opaque: {},
428 Premul: {},
429 Unpremul: {},
430 },
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500431
432 BlendMode: {
433 Clear: {},
434 Src: {},
435 Dst: {},
436 SrcOver: {},
437 DstOver: {},
438 SrcIn: {},
439 DstIn: {},
440 SrcOut: {},
441 DstOut: {},
442 SrcATop: {},
443 DstATop: {},
444 Xor: {},
445 Plus: {},
446 Modulate: {},
447 Screen: {},
448 Overlay: {},
449 Darken: {},
450 Lighten: {},
451 ColorDodge: {},
452 ColorBurn: {},
453 HardLight: {},
454 SoftLight: {},
455 Difference: {},
456 Exclusion: {},
457 Multiply: {},
458 Hue: {},
459 Saturation: {},
460 Color: {},
461 Luminosity: {},
462 },
463
464 BlurStyle: {
465 Normal: {},
466 Solid: {},
467 Outer: {},
468 Inner: {},
469 },
470
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500471 ClipOp: {
472 Difference: {},
473 Intersect: {},
474 },
475
Kevin Lubickea905ec2018-11-30 14:05:58 -0500476 ColorType: {
477 Alpha_8: {},
478 RGB_565: {},
479 ARGB_4444: {},
480 RGBA_8888: {},
481 RGB_888x: {},
482 BGRA_8888: {},
483 RGBA_1010102: {},
484 RGB_101010x: {},
485 Gray_8: {},
486 RGBA_F16: {},
487 RGBA_F32: {},
488 },
489
Kevin Lubick006a6f32018-10-19 14:34:34 -0400490 FillType: {
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500491 Winding: {},
492 EvenOdd: {},
493 InverseWinding: {},
494 InverseEvenOdd: {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400495 },
496
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500497 FilterQuality: {
498 None: {},
499 Low: {},
500 Medium: {},
501 High: {},
502 },
503
Alexander Khovansky3e119332018-11-15 02:01:19 +0300504 ImageFormat: {
505 PNG: {},
506 JPEG: {},
507 },
508
Kevin Lubickb9db3902018-11-26 11:47:54 -0500509 PaintStyle: {
510 Fill: {},
511 Stroke: {},
512 StrokeAndFill: {},
513 },
514
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500515 PathOp: {
516 Difference: {},
517 Intersect: {},
518 Union: {},
519 XOR: {},
520 ReverseDifference: {},
521 },
522
Kevin Lubick369f6a52019-10-03 11:22:08 -0400523 RectHeightStyle: {
524 Tight: {},
525 Max: {},
526 },
527
528 RectWidthStyle: {
529 Tight: {},
530 Max: {},
531 },
532
Kevin Lubickb9db3902018-11-26 11:47:54 -0500533 StrokeCap: {
534 Butt: {},
535 Round: {},
536 Square: {},
537 },
538
539 StrokeJoin: {
540 Miter: {},
541 Round: {},
542 Bevel: {},
543 },
544
Kevin Lubick369f6a52019-10-03 11:22:08 -0400545 TextAlign: {
546 Left: {},
547 Right: {},
548 Center: {},
549 Justify: {},
550 Start: {},
551 End: {},
552 },
553
Kevin Lubickec4903d2019-01-14 08:36:08 -0500554 TextEncoding: {
555 UTF8: {},
556 UTF16: {},
557 UTF32: {},
558 GlyphID: {},
559 },
560
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500561 TileMode: {
562 Clamp: {},
563 Repeat: {},
564 Mirror: {},
Kevin Lubickd29edd72018-12-07 08:29:52 -0500565 Decal: {},
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500566 },
567
568 VertexMode: {
569 Triangles: {},
570 TrianglesStrip: {},
571 TriangleFan: {},
572 },
573
Kevin Lubick006a6f32018-10-19 14:34:34 -0400574 // Things Enscriptem adds for us
575
Kevin Lubick53965c92018-10-11 08:51:55 -0400576 /**
577 * @type {Float32Array}
578 */
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400579 HEAPF32: {},
Kevin Lubick53965c92018-10-11 08:51:55 -0400580 /**
Kevin Lubickfa5a1382019-10-09 10:46:14 -0400581 * @type {Float64Array}
582 */
583 HEAPF64: {},
584 /**
Kevin Lubick53965c92018-10-11 08:51:55 -0400585 * @type {Uint8Array}
586 */
587 HEAPU8: {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400588 /**
589 * @type {Uint16Array}
590 */
591 HEAPU16: {},
592 /**
Kevin Lubickf5ea37f2019-02-28 10:06:18 -0500593 * @type {Uint32Array}
594 */
595 HEAPU32: {},
Kevin Lubickfa5a1382019-10-09 10:46:14 -0400596 /**
597 * @type {Int8Array}
598 */
599 HEAP8: {},
600 /**
601 * @type {Int16Array}
602 */
603 HEAP16: {},
604 /**
605 * @type {Int32Array}
606 */
607 HEAP32: {},
608
Kevin Lubick006a6f32018-10-19 14:34:34 -0400609 _malloc: function() {},
610 _free: function() {},
611 onRuntimeInitialized: function() {},
612};
Kevin Lubick217056c2018-09-20 17:39:31 -0400613
Kevin Lubick006a6f32018-10-19 14:34:34 -0400614// Public API things that are newly declared in the JS should go here.
615// It's not enough to declare them above, because closure can still erase them
616// unless they go on the prototype.
Kevin Lubick369f6a52019-10-03 11:22:08 -0400617CanvasKit.Paragraph.prototype.getRectsForRange = function() {};
618
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500619CanvasKit.SkPath.prototype.addArc = function() {};
Kevin Lubicke384df42019-08-26 15:48:09 -0400620CanvasKit.SkPath.prototype.addOval = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400621CanvasKit.SkPath.prototype.addPath = function() {};
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500622CanvasKit.SkPath.prototype.addRect = function() {};
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500623CanvasKit.SkPath.prototype.addRoundRect = function() {};
Alexander Khovansky3e119332018-11-15 02:01:19 +0300624CanvasKit.SkPath.prototype.arc = function() {};
Kevin Lubick006a6f32018-10-19 14:34:34 -0400625CanvasKit.SkPath.prototype.arcTo = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400626CanvasKit.SkPath.prototype.close = function() {};
Kevin Lubick006a6f32018-10-19 14:34:34 -0400627CanvasKit.SkPath.prototype.conicTo = function() {};
628CanvasKit.SkPath.prototype.cubicTo = function() {};
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400629CanvasKit.SkPath.prototype.dash = function() {};
Kevin Lubick006a6f32018-10-19 14:34:34 -0400630CanvasKit.SkPath.prototype.lineTo = function() {};
631CanvasKit.SkPath.prototype.moveTo = function() {};
Kevin Lubicke384df42019-08-26 15:48:09 -0400632CanvasKit.SkPath.prototype.offset = function() {};
Kevin Lubick006a6f32018-10-19 14:34:34 -0400633CanvasKit.SkPath.prototype.op = function() {};
634CanvasKit.SkPath.prototype.quadTo = function() {};
635CanvasKit.SkPath.prototype.rect = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400636CanvasKit.SkPath.prototype.simplify = function() {};
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400637CanvasKit.SkPath.prototype.stroke = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400638CanvasKit.SkPath.prototype.transform = function() {};
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400639CanvasKit.SkPath.prototype.trim = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400640
Kevin Lubickcc13fd32019-04-05 13:00:01 -0400641CanvasKit.SkPicture.prototype.DEBUGONLY_saveAsFile = function() {};
642
Kevin Lubick5b90b842018-10-17 07:57:18 -0400643CanvasKit.SkSurface.prototype.dispose = function() {};
Kevin Lubick359a7e32019-03-19 09:34:37 -0400644CanvasKit.SkSurface.prototype.flush = function() {};
645CanvasKit.SkSurface.prototype.requestAnimationFrame = function() {};
Kevin Lubickcc13fd32019-04-05 13:00:01 -0400646CanvasKit.SkSurface.prototype.captureFrameAsSkPicture = function() {};
Kevin Lubick53965c92018-10-11 08:51:55 -0400647
Kevin Lubick12c0e502018-11-28 12:51:56 -0500648/** @return {CanvasKit.SkVertices} */
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400649CanvasKit.SkVertices.prototype.applyBones = function() {};
650
Alexander Khovansky3e119332018-11-15 02:01:19 +0300651CanvasKit.SkImage.prototype.encodeToData = function() {};
Kevin Lubicka064c282019-04-04 09:28:53 -0400652CanvasKit.SkImage.prototype.makeShader = function() {};
Alexander Khovansky3e119332018-11-15 02:01:19 +0300653
Kevin Lubickee91c072019-03-29 10:39:52 -0400654CanvasKit.SkCanvas.prototype.drawAtlas = function() {};
Kevin Lubickec4903d2019-01-14 08:36:08 -0500655CanvasKit.SkCanvas.prototype.drawText = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500656/** @return {Uint8Array} */
657CanvasKit.SkCanvas.prototype.readPixels = function() {};
658CanvasKit.SkCanvas.prototype.writePixels = function() {};
659
Kevin Lubickddd0a332018-12-12 10:35:13 -0500660CanvasKit.SkFontMgr.prototype.MakeTypefaceFromData = function() {};
661
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400662CanvasKit.SkFont.prototype.getWidths = function() {};
663
664CanvasKit.RSXFormBuilder.prototype.build = function() {};
665CanvasKit.RSXFormBuilder.prototype.delete = function() {};
666CanvasKit.RSXFormBuilder.prototype.push = function() {};
Kevin Lubickee91c072019-03-29 10:39:52 -0400667CanvasKit.RSXFormBuilder.prototype.set = function() {};
668
669CanvasKit.SkColorBuilder.prototype.build = function() {};
670CanvasKit.SkColorBuilder.prototype.delete = function() {};
671CanvasKit.SkColorBuilder.prototype.push = function() {};
672CanvasKit.SkColorBuilder.prototype.set = function() {};
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400673
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400674// Define StrokeOpts object
675var StrokeOpts = {};
676StrokeOpts.prototype.width;
677StrokeOpts.prototype.miter_limit;
678StrokeOpts.prototype.cap;
679StrokeOpts.prototype.join;
Kevin Lubick1646e7d2018-12-07 13:03:08 -0500680StrokeOpts.prototype.precision;
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400681
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500682// Define everything created in the canvas2d spec here
Kevin Lubickb9db3902018-11-26 11:47:54 -0500683var HTMLCanvas = {};
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500684HTMLCanvas.prototype.decodeImage = function() {};
685HTMLCanvas.prototype.dispose = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500686HTMLCanvas.prototype.getContext = function() {};
Kevin Lubick8e4a3312018-12-14 15:03:41 -0500687HTMLCanvas.prototype.loadFont = function() {};
Kevin Lubicka40f8322018-12-17 16:01:36 -0500688HTMLCanvas.prototype.makePath2D = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500689HTMLCanvas.prototype.toDataURL = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500690
691var CanvasRenderingContext2D = {};
692CanvasRenderingContext2D.prototype.addHitRegion = function() {};
693CanvasRenderingContext2D.prototype.arc = function() {};
694CanvasRenderingContext2D.prototype.arcTo = function() {};
695CanvasRenderingContext2D.prototype.beginPath = function() {};
696CanvasRenderingContext2D.prototype.bezierCurveTo = function() {};
697CanvasRenderingContext2D.prototype.clearHitRegions = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500698CanvasRenderingContext2D.prototype.clearRect = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500699CanvasRenderingContext2D.prototype.clip = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500700CanvasRenderingContext2D.prototype.closePath = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500701CanvasRenderingContext2D.prototype.createImageData = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500702CanvasRenderingContext2D.prototype.createLinearGradient = function() {};
Kevin Lubickd29edd72018-12-07 08:29:52 -0500703CanvasRenderingContext2D.prototype.createPattern = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500704CanvasRenderingContext2D.prototype.createRadialGradient = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500705CanvasRenderingContext2D.prototype.drawFocusIfNeeded = function() {};
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500706CanvasRenderingContext2D.prototype.drawImage = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500707CanvasRenderingContext2D.prototype.ellipse = function() {};
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500708CanvasRenderingContext2D.prototype.fill = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500709CanvasRenderingContext2D.prototype.fillRect = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500710CanvasRenderingContext2D.prototype.fillText = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500711CanvasRenderingContext2D.prototype.getImageData = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500712CanvasRenderingContext2D.prototype.getLineDash = function() {};
Kevin Lubick1646e7d2018-12-07 13:03:08 -0500713CanvasRenderingContext2D.prototype.isPointInPath = function() {};
714CanvasRenderingContext2D.prototype.isPointInStroke = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500715CanvasRenderingContext2D.prototype.lineTo = function() {};
716CanvasRenderingContext2D.prototype.measureText = function() {};
717CanvasRenderingContext2D.prototype.moveTo = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500718CanvasRenderingContext2D.prototype.putImageData = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500719CanvasRenderingContext2D.prototype.quadraticCurveTo = function() {};
720CanvasRenderingContext2D.prototype.rect = function() {};
721CanvasRenderingContext2D.prototype.removeHitRegion = function() {};
722CanvasRenderingContext2D.prototype.resetTransform = function() {};
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500723CanvasRenderingContext2D.prototype.restore = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500724CanvasRenderingContext2D.prototype.rotate = function() {};
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500725CanvasRenderingContext2D.prototype.save = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500726CanvasRenderingContext2D.prototype.scale = function() {};
727CanvasRenderingContext2D.prototype.scrollPathIntoView = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500728CanvasRenderingContext2D.prototype.setLineDash = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500729CanvasRenderingContext2D.prototype.setTransform = function() {};
730CanvasRenderingContext2D.prototype.stroke = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500731CanvasRenderingContext2D.prototype.strokeRect = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500732CanvasRenderingContext2D.prototype.strokeText = function() {};
733CanvasRenderingContext2D.prototype.transform = function() {};
734CanvasRenderingContext2D.prototype.translate = function() {};
735
Kevin Lubicka40f8322018-12-17 16:01:36 -0500736var Path2D = {};
737Path2D.prototype.addPath = function() {};
738Path2D.prototype.arc = function() {};
739Path2D.prototype.arcTo = function() {};
740Path2D.prototype.bezierCurveTo = function() {};
741Path2D.prototype.closePath = function() {};
742Path2D.prototype.ellipse = function() {};
743Path2D.prototype.lineTo = function() {};
744Path2D.prototype.moveTo = function() {};
745Path2D.prototype.quadraticCurveTo = function() {};
746Path2D.prototype.rect = function() {};
747
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500748var LinearCanvasGradient = {};
749LinearCanvasGradient.prototype.addColorStop = function() {};
750var RadialCanvasGradient = {};
751RadialCanvasGradient.prototype.addColorStop = function() {};
Kevin Lubickd29edd72018-12-07 08:29:52 -0500752var CanvasPattern = {};
753CanvasPattern.prototype.setTransform = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500754
Kevin Lubick52b9f372018-12-04 13:57:36 -0500755var ImageData = {
756 /**
757 * @type {Uint8ClampedArray}
758 */
759 data: {},
760 height: {},
761 width: {},
762};
763
Kevin Lubickd29edd72018-12-07 08:29:52 -0500764var DOMMatrix = {
765 a: {},
766 b: {},
767 c: {},
768 d: {},
769 e: {},
770 f: {},
771};
772
Kevin Lubick217056c2018-09-20 17:39:31 -0400773// 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 -0500774function loadWebAssemblyModule() {};