blob: 86458d4400d5c7b2abb715ce6904b52a0e9ea6f1 [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
Kevin Lubickd3b1fe62019-10-21 10:50:26 -0400504 FontSlant: {
505 Upright: {},
506 Italic: {},
507 Oblique: {},
508 },
509
510 FontWeight: {
511 Invisible: {},
512 Thin: {},
513 ExtraLight: {},
514 Light: {},
515 Normal: {},
516 Medium: {},
517 SemiBold: {},
518 Bold: {},
519 ExtraBold: {},
520 Black: {},
521 ExtraBlack: {},
522 },
523
524 FontWidth: {
525 UltraCondensed: {},
526 ExtraCondensed: {},
527 Condensed: {},
528 SemiCondensed: {},
529 Normal: {},
530 SemiExpanded: {},
531 Expanded: {},
532 ExtraExpanded: {},
533 UltraExpanded: {},
534 },
535
Alexander Khovansky3e119332018-11-15 02:01:19 +0300536 ImageFormat: {
537 PNG: {},
538 JPEG: {},
539 },
540
Kevin Lubickb9db3902018-11-26 11:47:54 -0500541 PaintStyle: {
542 Fill: {},
543 Stroke: {},
544 StrokeAndFill: {},
545 },
546
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500547 PathOp: {
548 Difference: {},
549 Intersect: {},
550 Union: {},
551 XOR: {},
552 ReverseDifference: {},
553 },
554
Kevin Lubick369f6a52019-10-03 11:22:08 -0400555 RectHeightStyle: {
556 Tight: {},
557 Max: {},
558 },
559
560 RectWidthStyle: {
561 Tight: {},
562 Max: {},
563 },
564
Kevin Lubickb9db3902018-11-26 11:47:54 -0500565 StrokeCap: {
566 Butt: {},
567 Round: {},
568 Square: {},
569 },
570
571 StrokeJoin: {
572 Miter: {},
573 Round: {},
574 Bevel: {},
575 },
576
Kevin Lubick369f6a52019-10-03 11:22:08 -0400577 TextAlign: {
578 Left: {},
579 Right: {},
580 Center: {},
581 Justify: {},
582 Start: {},
583 End: {},
584 },
585
Kevin Lubickd3b1fe62019-10-21 10:50:26 -0400586 TextDirection: {
587 LTR: {},
588 RTL: {},
589 },
590
Kevin Lubickec4903d2019-01-14 08:36:08 -0500591 TextEncoding: {
592 UTF8: {},
593 UTF16: {},
594 UTF32: {},
595 GlyphID: {},
596 },
597
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500598 TileMode: {
599 Clamp: {},
600 Repeat: {},
601 Mirror: {},
Kevin Lubickd29edd72018-12-07 08:29:52 -0500602 Decal: {},
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500603 },
604
605 VertexMode: {
606 Triangles: {},
607 TrianglesStrip: {},
608 TriangleFan: {},
609 },
610
Kevin Lubick006a6f32018-10-19 14:34:34 -0400611 // Things Enscriptem adds for us
612
Kevin Lubick53965c92018-10-11 08:51:55 -0400613 /**
614 * @type {Float32Array}
615 */
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400616 HEAPF32: {},
Kevin Lubick53965c92018-10-11 08:51:55 -0400617 /**
Kevin Lubickfa5a1382019-10-09 10:46:14 -0400618 * @type {Float64Array}
619 */
620 HEAPF64: {},
621 /**
Kevin Lubick53965c92018-10-11 08:51:55 -0400622 * @type {Uint8Array}
623 */
624 HEAPU8: {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400625 /**
626 * @type {Uint16Array}
627 */
628 HEAPU16: {},
629 /**
Kevin Lubickf5ea37f2019-02-28 10:06:18 -0500630 * @type {Uint32Array}
631 */
632 HEAPU32: {},
Kevin Lubickfa5a1382019-10-09 10:46:14 -0400633 /**
634 * @type {Int8Array}
635 */
636 HEAP8: {},
637 /**
638 * @type {Int16Array}
639 */
640 HEAP16: {},
641 /**
642 * @type {Int32Array}
643 */
644 HEAP32: {},
645
Kevin Lubick006a6f32018-10-19 14:34:34 -0400646 _malloc: function() {},
647 _free: function() {},
648 onRuntimeInitialized: function() {},
649};
Kevin Lubick217056c2018-09-20 17:39:31 -0400650
Kevin Lubick006a6f32018-10-19 14:34:34 -0400651// Public API things that are newly declared in the JS should go here.
652// It's not enough to declare them above, because closure can still erase them
653// unless they go on the prototype.
Kevin Lubick369f6a52019-10-03 11:22:08 -0400654CanvasKit.Paragraph.prototype.getRectsForRange = function() {};
655
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500656CanvasKit.SkPath.prototype.addArc = function() {};
Kevin Lubicke384df42019-08-26 15:48:09 -0400657CanvasKit.SkPath.prototype.addOval = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400658CanvasKit.SkPath.prototype.addPath = function() {};
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500659CanvasKit.SkPath.prototype.addRect = function() {};
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500660CanvasKit.SkPath.prototype.addRoundRect = function() {};
Alexander Khovansky3e119332018-11-15 02:01:19 +0300661CanvasKit.SkPath.prototype.arc = function() {};
Kevin Lubick006a6f32018-10-19 14:34:34 -0400662CanvasKit.SkPath.prototype.arcTo = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400663CanvasKit.SkPath.prototype.close = function() {};
Kevin Lubick006a6f32018-10-19 14:34:34 -0400664CanvasKit.SkPath.prototype.conicTo = function() {};
665CanvasKit.SkPath.prototype.cubicTo = function() {};
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400666CanvasKit.SkPath.prototype.dash = function() {};
Kevin Lubick006a6f32018-10-19 14:34:34 -0400667CanvasKit.SkPath.prototype.lineTo = function() {};
668CanvasKit.SkPath.prototype.moveTo = function() {};
Kevin Lubicke384df42019-08-26 15:48:09 -0400669CanvasKit.SkPath.prototype.offset = function() {};
Kevin Lubick006a6f32018-10-19 14:34:34 -0400670CanvasKit.SkPath.prototype.op = function() {};
671CanvasKit.SkPath.prototype.quadTo = function() {};
672CanvasKit.SkPath.prototype.rect = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400673CanvasKit.SkPath.prototype.simplify = function() {};
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400674CanvasKit.SkPath.prototype.stroke = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400675CanvasKit.SkPath.prototype.transform = function() {};
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400676CanvasKit.SkPath.prototype.trim = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400677
Kevin Lubickcc13fd32019-04-05 13:00:01 -0400678CanvasKit.SkPicture.prototype.DEBUGONLY_saveAsFile = function() {};
679
Kevin Lubick5b90b842018-10-17 07:57:18 -0400680CanvasKit.SkSurface.prototype.dispose = function() {};
Kevin Lubick359a7e32019-03-19 09:34:37 -0400681CanvasKit.SkSurface.prototype.flush = function() {};
682CanvasKit.SkSurface.prototype.requestAnimationFrame = function() {};
Kevin Lubickcc13fd32019-04-05 13:00:01 -0400683CanvasKit.SkSurface.prototype.captureFrameAsSkPicture = function() {};
Kevin Lubick53965c92018-10-11 08:51:55 -0400684
Kevin Lubick12c0e502018-11-28 12:51:56 -0500685/** @return {CanvasKit.SkVertices} */
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400686CanvasKit.SkVertices.prototype.applyBones = function() {};
687
Alexander Khovansky3e119332018-11-15 02:01:19 +0300688CanvasKit.SkImage.prototype.encodeToData = function() {};
Kevin Lubicka064c282019-04-04 09:28:53 -0400689CanvasKit.SkImage.prototype.makeShader = function() {};
Alexander Khovansky3e119332018-11-15 02:01:19 +0300690
Kevin Lubickee91c072019-03-29 10:39:52 -0400691CanvasKit.SkCanvas.prototype.drawAtlas = function() {};
Kevin Lubickec4903d2019-01-14 08:36:08 -0500692CanvasKit.SkCanvas.prototype.drawText = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500693/** @return {Uint8Array} */
694CanvasKit.SkCanvas.prototype.readPixels = function() {};
695CanvasKit.SkCanvas.prototype.writePixels = function() {};
696
Kevin Lubickddd0a332018-12-12 10:35:13 -0500697CanvasKit.SkFontMgr.prototype.MakeTypefaceFromData = function() {};
698
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400699CanvasKit.SkFont.prototype.getWidths = function() {};
700
701CanvasKit.RSXFormBuilder.prototype.build = function() {};
702CanvasKit.RSXFormBuilder.prototype.delete = function() {};
703CanvasKit.RSXFormBuilder.prototype.push = function() {};
Kevin Lubickee91c072019-03-29 10:39:52 -0400704CanvasKit.RSXFormBuilder.prototype.set = function() {};
705
706CanvasKit.SkColorBuilder.prototype.build = function() {};
707CanvasKit.SkColorBuilder.prototype.delete = function() {};
708CanvasKit.SkColorBuilder.prototype.push = function() {};
709CanvasKit.SkColorBuilder.prototype.set = function() {};
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400710
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400711// Define StrokeOpts object
712var StrokeOpts = {};
713StrokeOpts.prototype.width;
714StrokeOpts.prototype.miter_limit;
715StrokeOpts.prototype.cap;
716StrokeOpts.prototype.join;
Kevin Lubick1646e7d2018-12-07 13:03:08 -0500717StrokeOpts.prototype.precision;
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400718
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500719// Define everything created in the canvas2d spec here
Kevin Lubickb9db3902018-11-26 11:47:54 -0500720var HTMLCanvas = {};
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500721HTMLCanvas.prototype.decodeImage = function() {};
722HTMLCanvas.prototype.dispose = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500723HTMLCanvas.prototype.getContext = function() {};
Kevin Lubick8e4a3312018-12-14 15:03:41 -0500724HTMLCanvas.prototype.loadFont = function() {};
Kevin Lubicka40f8322018-12-17 16:01:36 -0500725HTMLCanvas.prototype.makePath2D = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500726HTMLCanvas.prototype.toDataURL = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500727
728var CanvasRenderingContext2D = {};
729CanvasRenderingContext2D.prototype.addHitRegion = function() {};
730CanvasRenderingContext2D.prototype.arc = function() {};
731CanvasRenderingContext2D.prototype.arcTo = function() {};
732CanvasRenderingContext2D.prototype.beginPath = function() {};
733CanvasRenderingContext2D.prototype.bezierCurveTo = function() {};
734CanvasRenderingContext2D.prototype.clearHitRegions = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500735CanvasRenderingContext2D.prototype.clearRect = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500736CanvasRenderingContext2D.prototype.clip = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500737CanvasRenderingContext2D.prototype.closePath = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500738CanvasRenderingContext2D.prototype.createImageData = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500739CanvasRenderingContext2D.prototype.createLinearGradient = function() {};
Kevin Lubickd29edd72018-12-07 08:29:52 -0500740CanvasRenderingContext2D.prototype.createPattern = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500741CanvasRenderingContext2D.prototype.createRadialGradient = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500742CanvasRenderingContext2D.prototype.drawFocusIfNeeded = function() {};
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500743CanvasRenderingContext2D.prototype.drawImage = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500744CanvasRenderingContext2D.prototype.ellipse = function() {};
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500745CanvasRenderingContext2D.prototype.fill = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500746CanvasRenderingContext2D.prototype.fillRect = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500747CanvasRenderingContext2D.prototype.fillText = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500748CanvasRenderingContext2D.prototype.getImageData = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500749CanvasRenderingContext2D.prototype.getLineDash = function() {};
Kevin Lubick1646e7d2018-12-07 13:03:08 -0500750CanvasRenderingContext2D.prototype.isPointInPath = function() {};
751CanvasRenderingContext2D.prototype.isPointInStroke = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500752CanvasRenderingContext2D.prototype.lineTo = function() {};
753CanvasRenderingContext2D.prototype.measureText = function() {};
754CanvasRenderingContext2D.prototype.moveTo = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500755CanvasRenderingContext2D.prototype.putImageData = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500756CanvasRenderingContext2D.prototype.quadraticCurveTo = function() {};
757CanvasRenderingContext2D.prototype.rect = function() {};
758CanvasRenderingContext2D.prototype.removeHitRegion = function() {};
759CanvasRenderingContext2D.prototype.resetTransform = function() {};
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500760CanvasRenderingContext2D.prototype.restore = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500761CanvasRenderingContext2D.prototype.rotate = function() {};
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500762CanvasRenderingContext2D.prototype.save = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500763CanvasRenderingContext2D.prototype.scale = function() {};
764CanvasRenderingContext2D.prototype.scrollPathIntoView = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500765CanvasRenderingContext2D.prototype.setLineDash = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500766CanvasRenderingContext2D.prototype.setTransform = function() {};
767CanvasRenderingContext2D.prototype.stroke = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500768CanvasRenderingContext2D.prototype.strokeRect = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500769CanvasRenderingContext2D.prototype.strokeText = function() {};
770CanvasRenderingContext2D.prototype.transform = function() {};
771CanvasRenderingContext2D.prototype.translate = function() {};
772
Kevin Lubicka40f8322018-12-17 16:01:36 -0500773var Path2D = {};
774Path2D.prototype.addPath = function() {};
775Path2D.prototype.arc = function() {};
776Path2D.prototype.arcTo = function() {};
777Path2D.prototype.bezierCurveTo = function() {};
778Path2D.prototype.closePath = function() {};
779Path2D.prototype.ellipse = function() {};
780Path2D.prototype.lineTo = function() {};
781Path2D.prototype.moveTo = function() {};
782Path2D.prototype.quadraticCurveTo = function() {};
783Path2D.prototype.rect = function() {};
784
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500785var LinearCanvasGradient = {};
786LinearCanvasGradient.prototype.addColorStop = function() {};
787var RadialCanvasGradient = {};
788RadialCanvasGradient.prototype.addColorStop = function() {};
Kevin Lubickd29edd72018-12-07 08:29:52 -0500789var CanvasPattern = {};
790CanvasPattern.prototype.setTransform = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500791
Kevin Lubick52b9f372018-12-04 13:57:36 -0500792var ImageData = {
793 /**
794 * @type {Uint8ClampedArray}
795 */
796 data: {},
797 height: {},
798 width: {},
799};
800
Kevin Lubickd29edd72018-12-07 08:29:52 -0500801var DOMMatrix = {
802 a: {},
803 b: {},
804 c: {},
805 d: {},
806 e: {},
807 f: {},
808};
809
Kevin Lubick217056c2018-09-20 17:39:31 -0400810// 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 -0500811function loadWebAssemblyModule() {};