blob: a878635c2cd0985453923f61c5b5a4a8dc62bc9d [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 Lubicke25df6c2019-10-22 09:04:32 -040062 /** @return {TypedArray} */
63 Malloc: function() {},
Kevin Lubick50f377e2019-09-11 15:23:00 -040064 /** @return {TonalColors} */
65 computeTonalColors: function() {},
Kevin Lubick217056c2018-09-20 17:39:31 -040066 currentContext: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -050067 getColorComponents: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -050068 getSkDataBytes: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -050069 multiplyByAlpha: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -040070 setCurrentContext: function() {},
Kevin Lubick217056c2018-09-20 17:39:31 -040071
72 // private API (i.e. things declared in the bindings that we use
73 // in the pre-js file)
Kevin Lubick52b9f372018-12-04 13:57:36 -050074 _MakeImage: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -040075 _MakeLinearGradientShader: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -050076 _MakePathFromCmds: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -040077 _MakeRadialGradientShader: function() {},
Kevin Lubickf5ea37f2019-02-28 10:06:18 -050078 _MakeManagedAnimation: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -040079 _MakeSkDashPathEffect: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -040080 _MakeSkVertices: function() {},
Kevin Lubickeb2f6b02018-11-29 15:07:02 -050081 _MakeTwoPointConicalGradientShader: function() {},
Kevin Lubick6b921b72019-09-18 16:18:17 -040082 _decodeAnimatedImage: function() {},
Kevin Lubick0a1293c2018-12-03 12:31:04 -050083 _decodeImage: function() {},
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -050084 _drawShapedText: function() {},
Kevin Lubickea905ec2018-11-30 14:05:58 -050085 _getRasterDirectSurface: function() {},
Kevin Lubick134be1d2018-10-30 15:05:04 -040086 _getRasterN32PremulSurface: function() {},
Kevin Lubick217056c2018-09-20 17:39:31 -040087
Kevin Lubick1a05fce2018-11-20 12:51:16 -050088 // The testing object is meant to expose internal functions
89 // for more fine-grained testing, e.g. parseColor
90 _testing: {},
91
Kevin Lubick217056c2018-09-20 17:39:31 -040092 // Objects and properties on CanvasKit
93
Kevin Lubickcd544662019-03-22 15:41:36 -040094 GrContext: {
95 // public API (from C++ bindings)
96 getResourceCacheLimitBytes: function() {},
97 getResourceCacheUsageBytes: function() {},
98 setResourceCacheLimitBytes: function() {},
99 },
100
Kevin Lubick369f6a52019-10-03 11:22:08 -0400101 Paragraph: {
102 // public API (from C++ bindings)
103 getGlyphPositionAtCoordinate: function() {},
104 layout: function() {},
105
106 // private API
107 /** @return {Float32Array} */
108 _getRectsForRange: function() {},
109 },
110
111 ParagraphStyle: function() {},
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400112 RSXFormBuilder: function() {},
Kevin Lubickee91c072019-03-29 10:39:52 -0400113 SkColorBuilder: function() {},
114 SkRectBuilder: function() {},
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400115
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -0500116 ShapedText: {
117 // public API (from C++ bindings)
118 getBounds: function() {},
119 },
120
Kevin Lubick6b921b72019-09-18 16:18:17 -0400121 SkAnimatedImage: {
122 // public API (from C++ bindings)
123 getRepetitionCount: function() {},
124 decodeNextFrame: function() {},
125 },
126
Kevin Lubick006a6f32018-10-19 14:34:34 -0400127 SkCanvas: {
128 // public API (from C++ bindings)
129 clear: function() {},
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500130 clipPath: function() {},
Kevin Lubick6dbc4ed2019-10-22 09:43:34 -0400131 clipRRect: function() {},
Kevin Lubick5d5723c2018-12-07 10:09:11 -0500132 clipRect: function() {},
133 concat: function() {},
Kevin Lubick6dbc4ed2019-10-22 09:43:34 -0400134 drawAnimatedImage: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500135 drawArc: function() {},
Kevin Lubicke384df42019-08-26 15:48:09 -0400136 drawCircle: function() {},
Kevin Lubick6dbc4ed2019-10-22 09:43:34 -0400137 drawColor: function() {},
Kevin Lubick2e5fe352019-09-03 12:59:06 -0400138 drawDRRect: function() {},
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500139 drawImage: function() {},
140 drawImageRect: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500141 drawLine: function() {},
142 drawOval: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400143 drawPaint: function() {},
Kevin Lubick369f6a52019-10-03 11:22:08 -0400144 drawParagraph: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400145 drawPath: function() {},
Kevin Lubickcc13fd32019-04-05 13:00:01 -0400146 drawPicture: function() {},
Kevin Lubick2e5fe352019-09-03 12:59:06 -0400147 drawRRect: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -0500148 drawRect: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500149 drawRoundRect: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500150 drawShadow: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -0500151 drawText: function() {},
Kevin Lubickec4903d2019-01-14 08:36:08 -0500152 drawTextBlob: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -0500153 drawVertices: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400154 flush: function() {},
Kevin Lubick2e5fe352019-09-03 12:59:06 -0400155 getSaveCount: function() {},
Kevin Lubick5d5723c2018-12-07 10:09:11 -0500156 getTotalMatrix: function() {},
Kevin Lubick543f3522019-03-08 10:04:28 -0500157 makeSurface: function() {},
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500158 restore: function() {},
Kevin Lubickb3574c92019-03-06 08:25:36 -0500159 restoreToCount: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400160 rotate: function() {},
161 save: function() {},
Kevin Lubickb3574c92019-03-06 08:25:36 -0500162 saveLayer: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400163 scale: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400164 skew: function() {},
165 translate: function() {},
166
167 // private API
Kevin Lubickee91c072019-03-29 10:39:52 -0400168 _drawAtlas: function() {},
Kevin Lubickec4903d2019-01-14 08:36:08 -0500169 _drawSimpleText: function() {},
Kevin Lubick52b9f372018-12-04 13:57:36 -0500170 _readPixels: function() {},
171 _writePixels: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400172 delete: function() {},
173 },
174
Kevin Lubickd3729342019-09-12 11:11:25 -0400175 SkColorFilter: {
176 // public API (from C++ bindings and JS interface)
177 MakeBlend: function() {},
178 MakeCompose: function() {},
179 MakeLerp: function() {},
180 MakeLinearToSRGBGamma: function() {},
181 MakeMatrix: function() {},
182 MakeSRGBToLinearGamma: function() {},
183 // private API (from C++ bindings)
184 _makeMatrix: function() {},
185 },
186
187 SkColorMatrix: {
188 concat: function() {},
189 identity: function() {},
190 postTranslate: function() {},
191 rotated: function() {},
192 scaled: function() {},
193 },
194
Kevin Lubick35ac0382019-01-02 15:13:57 -0500195 SkFont: {
196 // public API (from C++ bindings)
197 getScaleX: function() {},
198 getSize: function() {},
199 getSkewX: function() {},
200 getTypeface: function() {},
201 measureText: function() {},
202 setScaleX: function() {},
203 setSize: function() {},
204 setSkewX: function() {},
205 setTypeface: function() {},
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400206 // private API (from C++ bindings)
207 _getWidths: function() {},
Kevin Lubick35ac0382019-01-02 15:13:57 -0500208 },
209
Kevin Lubickddd0a332018-12-12 10:35:13 -0500210 SkFontMgr: {
Kevin Lubick61887c72019-09-26 13:20:50 -0400211 // public API (from C++ and JS bindings)
212 FromData: function() {},
Kevin Lubickddd0a332018-12-12 10:35:13 -0500213 RefDefault: function() {},
214 countFamilies: function() {},
215
216 // private API
217 _makeTypefaceFromData: function() {},
Kevin Lubick61887c72019-09-26 13:20:50 -0400218 _fromData: function() {},
Kevin Lubickddd0a332018-12-12 10:35:13 -0500219 },
220
Kevin Lubick006a6f32018-10-19 14:34:34 -0400221 SkImage: {
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500222 // public API (from C++ bindings)
223 height: function() {},
224 width: function() {},
Alexander Khovansky3e119332018-11-15 02:01:19 +0300225 // private API
226 _encodeToData: function() {},
227 _encodeToDataWithFormat: function() {},
Kevin Lubicka064c282019-04-04 09:28:53 -0400228 _makeShader: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400229 },
230
Kevin Lubick15b40232019-10-29 09:55:39 -0400231 SkImageFilter: {
232 MakeBlur: function() {},
233 MakeColorFilter: function() {},
234 MakeCompose: function() {},
235 },
236
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500237 SkMatrix: {
Kevin Lubickb9db3902018-11-26 11:47:54 -0500238 identity: function() {},
Kevin Lubickf3555182019-03-14 10:55:10 -0400239 invert: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500240 mapPoints: function() {},
241 multiply: function() {},
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500242 rotated: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500243 scaled: function() {},
244 skewed: function() {},
245 translated: function() {},
246 },
247
Kevin Lubick15b40232019-10-29 09:55:39 -0400248 SkMaskFilter: {
249 MakeBlur: function() {},
250 },
251
Kevin Lubickb9db3902018-11-26 11:47:54 -0500252 SkPaint: {
253 // public API (from C++ bindings)
254 /** @return {CanvasKit.SkPaint} */
255 copy: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -0500256 getBlendMode: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500257 getColor: function() {},
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500258 getFilterQuality: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500259 getStrokeCap: function() {},
260 getStrokeJoin: function() {},
261 getStrokeMiter: function() {},
262 getStrokeWidth: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500263 setAntiAlias: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -0500264 setBlendMode: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500265 setColor: function() {},
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500266 setFilterQuality: function() {},
Kevin Lubick15b40232019-10-29 09:55:39 -0400267 setImageFilter: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500268 setMaskFilter: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500269 setPathEffect: function() {},
270 setShader: function() {},
271 setStrokeCap: function() {},
272 setStrokeJoin: function() {},
273 setStrokeMiter: function() {},
274 setStrokeWidth: function() {},
275 setStyle: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500276
277 //private API
278 delete: function() {},
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500279 },
280
Kevin Lubick006a6f32018-10-19 14:34:34 -0400281 SkPath: {
282 // public API (from C++ bindings)
Kevin Lubickb9db3902018-11-26 11:47:54 -0500283 computeTightBounds: function() {},
Kevin Lubick1646e7d2018-12-07 13:03:08 -0500284 contains: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500285 /** @return {CanvasKit.SkPath} */
286 copy: function() {},
287 countPoints: function() {},
288 equals: function() {},
289 getBounds: function() {},
290 getFillType: function() {},
291 getPoint: function() {},
Kevin Lubick1646e7d2018-12-07 13:03:08 -0500292 isEmpty: function() {},
Kevin Lubick2b79d1c2018-12-14 16:10:38 -0500293 isVolatile: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500294 reset: function() {},
295 rewind: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500296 setFillType: function() {},
Kevin Lubick2b79d1c2018-12-14 16:10:38 -0500297 setIsVolatile: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500298 toSVGString: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400299
300 // private API
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500301 _addArc: function() {},
Kevin Lubicke384df42019-08-26 15:48:09 -0400302 _addOval: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400303 _addPath: function() {},
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500304 _addRect: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500305 _addRoundRect: function() {},
Alexander Khovansky3e119332018-11-15 02:01:19 +0300306 _arc: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400307 _arcTo: function() {},
308 _close: function() {},
309 _conicTo: function() {},
310 _cubicTo: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400311 _dash: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400312 _lineTo: function() {},
313 _moveTo: function() {},
314 _op: function() {},
315 _quadTo: function() {},
Kevin Lubick79b71342019-11-01 14:36:52 -0400316 _rArcTo: function() {},
317 _rConicTo: function() {},
318 _rCubicTo: function() {},
319 _rLineTo: function() {},
320 _rMoveTo: function() {},
321 _rQuadTo: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400322 _rect: function() {},
323 _simplify: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400324 _stroke: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400325 _transform: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400326 _trim: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400327 delete: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500328 dump: function() {},
329 dumpHex: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400330 },
331
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400332 SkPathMeasure: {
333 getLength: function() {},
334 getPosTan: function() {},
335 isClosed: function() {},
336 nextContour: function() {},
337 },
338
Kevin Lubickcc13fd32019-04-05 13:00:01 -0400339 SkPicture: {
340 DEBUGONLY_serialize: function() {},
341 },
342
343 SkPictureRecorder: {
344 beginRecording: function() {},
345 finishRecordingAsPicture: function() {},
346 },
347
Kevin Lubick006a6f32018-10-19 14:34:34 -0400348 SkRect: {
349 fLeft: {},
350 fTop: {},
351 fRight: {},
352 fBottom: {},
353 },
354
Kevin Lubick2e5fe352019-09-03 12:59:06 -0400355 SkRRect: {
356 rect: {},
Kevin Lubick7d644e12019-09-11 14:22:22 -0400357 rx1: {},
358 ry1: {},
359 rx2: {},
360 ry2: {},
361 rx3: {},
362 ry3: {},
363 rx4: {},
364 ry4: {},
Kevin Lubick2e5fe352019-09-03 12:59:06 -0400365 },
366
Kevin Lubick006a6f32018-10-19 14:34:34 -0400367 SkSurface: {
368 // public API (from C++ bindings)
369 /** @return {CanvasKit.SkCanvas} */
370 getCanvas: function() {},
371 /** @return {CanvasKit.SkImage} */
372 makeImageSnapshot: function() {},
Kevin Lubick543f3522019-03-08 10:04:28 -0500373 makeSurface: function() {},
Kevin Lubickcd544662019-03-22 15:41:36 -0400374 grContext: {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400375
376 // private API
377 _flush: function() {},
378 _getRasterN32PremulSurface: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400379 delete: function() {},
380 },
381
Kevin Lubickec4903d2019-01-14 08:36:08 -0500382 SkTextBlob: {
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400383 // public API (both C++ and JS bindings)
384 MakeFromRSXform: function() {},
Kevin Lubickec4903d2019-01-14 08:36:08 -0500385 MakeFromText: function() {},
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400386 MakeOnPath: function() {},
387 // private API (from C++ bindings)
388 _MakeFromRSXform: function() {},
Kevin Lubickec4903d2019-01-14 08:36:08 -0500389 _MakeFromText: function() {},
390 },
391
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400392 SkVertices: {
393 // public API (from C++ bindings)
Kevin Lubick12c0e502018-11-28 12:51:56 -0500394 bounds: function() {},
395 mode: function() {},
396 uniqueID: function() {},
397 vertexCount: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400398
399 // private API
400 /** @return {CanvasKit.SkVertices} */
401 _applyBones: function() {},
402 },
403
Kevin Lubickd6ba7252019-06-03 14:38:05 -0400404 _SkVerticesBuilder: {
405 // public API (from C++ bindings)
406 boneIndices: function() {},
407 boneWeights: function() {},
408 colors: function() {},
409 detach: function() {},
410 indices: function() {},
411 positions: function() {},
412 texCoords: function() {},
413 },
414
Kevin Lubick369f6a52019-10-03 11:22:08 -0400415 TextStyle: function() {},
416
Kevin Lubick006a6f32018-10-19 14:34:34 -0400417 // Constants and Enums
418 gpu: {},
419 skottie: {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400420
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500421 TRANSPARENT: {},
422 RED: {},
423 BLUE: {},
424 YELLOW: {},
425 CYAN: {},
426 BLACK: {},
Kevin Lubickea905ec2018-11-30 14:05:58 -0500427 WHITE: {},
428
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500429 MOVE_VERB: {},
430 LINE_VERB: {},
431 QUAD_VERB: {},
432 CONIC_VERB: {},
433 CUBIC_VERB: {},
434 CLOSE_VERB: {},
435
Kevin Lubick369f6a52019-10-03 11:22:08 -0400436 NoDecoration: {},
437 UnderlineDecoration: {},
438 OverlineDecoration: {},
439 LineThroughDecoration: {},
440
Kevin Lubick77d9b5c2019-10-29 10:48:26 -0400441 SaveLayerInitWithPrevious: {},
442 SaveLayerF16ColorType: {},
443
Kevin Lubick369f6a52019-10-03 11:22:08 -0400444 Affinity: {
445 Upstream: {},
446 Downstream: {},
447 },
448
Kevin Lubickea905ec2018-11-30 14:05:58 -0500449 AlphaType: {
450 Opaque: {},
451 Premul: {},
452 Unpremul: {},
453 },
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500454
455 BlendMode: {
456 Clear: {},
457 Src: {},
458 Dst: {},
459 SrcOver: {},
460 DstOver: {},
461 SrcIn: {},
462 DstIn: {},
463 SrcOut: {},
464 DstOut: {},
465 SrcATop: {},
466 DstATop: {},
467 Xor: {},
468 Plus: {},
469 Modulate: {},
470 Screen: {},
471 Overlay: {},
472 Darken: {},
473 Lighten: {},
474 ColorDodge: {},
475 ColorBurn: {},
476 HardLight: {},
477 SoftLight: {},
478 Difference: {},
479 Exclusion: {},
480 Multiply: {},
481 Hue: {},
482 Saturation: {},
483 Color: {},
484 Luminosity: {},
485 },
486
487 BlurStyle: {
488 Normal: {},
489 Solid: {},
490 Outer: {},
491 Inner: {},
492 },
493
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500494 ClipOp: {
495 Difference: {},
496 Intersect: {},
497 },
498
Kevin Lubickea905ec2018-11-30 14:05:58 -0500499 ColorType: {
500 Alpha_8: {},
501 RGB_565: {},
502 ARGB_4444: {},
503 RGBA_8888: {},
504 RGB_888x: {},
505 BGRA_8888: {},
506 RGBA_1010102: {},
507 RGB_101010x: {},
508 Gray_8: {},
509 RGBA_F16: {},
510 RGBA_F32: {},
511 },
512
Kevin Lubick006a6f32018-10-19 14:34:34 -0400513 FillType: {
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500514 Winding: {},
515 EvenOdd: {},
516 InverseWinding: {},
517 InverseEvenOdd: {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400518 },
519
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500520 FilterQuality: {
521 None: {},
522 Low: {},
523 Medium: {},
524 High: {},
525 },
526
Kevin Lubickd3b1fe62019-10-21 10:50:26 -0400527 FontSlant: {
528 Upright: {},
529 Italic: {},
530 Oblique: {},
531 },
532
533 FontWeight: {
534 Invisible: {},
535 Thin: {},
536 ExtraLight: {},
537 Light: {},
538 Normal: {},
539 Medium: {},
540 SemiBold: {},
541 Bold: {},
542 ExtraBold: {},
543 Black: {},
544 ExtraBlack: {},
545 },
546
547 FontWidth: {
548 UltraCondensed: {},
549 ExtraCondensed: {},
550 Condensed: {},
551 SemiCondensed: {},
552 Normal: {},
553 SemiExpanded: {},
554 Expanded: {},
555 ExtraExpanded: {},
556 UltraExpanded: {},
557 },
558
Alexander Khovansky3e119332018-11-15 02:01:19 +0300559 ImageFormat: {
560 PNG: {},
561 JPEG: {},
562 },
563
Kevin Lubickb9db3902018-11-26 11:47:54 -0500564 PaintStyle: {
565 Fill: {},
566 Stroke: {},
567 StrokeAndFill: {},
568 },
569
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500570 PathOp: {
571 Difference: {},
572 Intersect: {},
573 Union: {},
574 XOR: {},
575 ReverseDifference: {},
576 },
577
Kevin Lubick369f6a52019-10-03 11:22:08 -0400578 RectHeightStyle: {
579 Tight: {},
580 Max: {},
581 },
582
583 RectWidthStyle: {
584 Tight: {},
585 Max: {},
586 },
587
Kevin Lubickb9db3902018-11-26 11:47:54 -0500588 StrokeCap: {
589 Butt: {},
590 Round: {},
591 Square: {},
592 },
593
594 StrokeJoin: {
595 Miter: {},
596 Round: {},
597 Bevel: {},
598 },
599
Kevin Lubick369f6a52019-10-03 11:22:08 -0400600 TextAlign: {
601 Left: {},
602 Right: {},
603 Center: {},
604 Justify: {},
605 Start: {},
606 End: {},
607 },
608
Kevin Lubickd3b1fe62019-10-21 10:50:26 -0400609 TextDirection: {
610 LTR: {},
611 RTL: {},
612 },
613
Kevin Lubickec4903d2019-01-14 08:36:08 -0500614 TextEncoding: {
615 UTF8: {},
616 UTF16: {},
617 UTF32: {},
618 GlyphID: {},
619 },
620
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500621 TileMode: {
622 Clamp: {},
623 Repeat: {},
624 Mirror: {},
Kevin Lubickd29edd72018-12-07 08:29:52 -0500625 Decal: {},
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500626 },
627
628 VertexMode: {
629 Triangles: {},
630 TrianglesStrip: {},
631 TriangleFan: {},
632 },
633
Kevin Lubick006a6f32018-10-19 14:34:34 -0400634 // Things Enscriptem adds for us
635
Kevin Lubick53965c92018-10-11 08:51:55 -0400636 /**
637 * @type {Float32Array}
638 */
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400639 HEAPF32: {},
Kevin Lubick53965c92018-10-11 08:51:55 -0400640 /**
Kevin Lubickfa5a1382019-10-09 10:46:14 -0400641 * @type {Float64Array}
642 */
643 HEAPF64: {},
644 /**
Kevin Lubick53965c92018-10-11 08:51:55 -0400645 * @type {Uint8Array}
646 */
647 HEAPU8: {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400648 /**
649 * @type {Uint16Array}
650 */
651 HEAPU16: {},
652 /**
Kevin Lubickf5ea37f2019-02-28 10:06:18 -0500653 * @type {Uint32Array}
654 */
655 HEAPU32: {},
Kevin Lubickfa5a1382019-10-09 10:46:14 -0400656 /**
657 * @type {Int8Array}
658 */
659 HEAP8: {},
660 /**
661 * @type {Int16Array}
662 */
663 HEAP16: {},
664 /**
665 * @type {Int32Array}
666 */
667 HEAP32: {},
668
Kevin Lubick006a6f32018-10-19 14:34:34 -0400669 _malloc: function() {},
670 _free: function() {},
671 onRuntimeInitialized: function() {},
672};
Kevin Lubick217056c2018-09-20 17:39:31 -0400673
Kevin Lubick006a6f32018-10-19 14:34:34 -0400674// Public API things that are newly declared in the JS should go here.
675// It's not enough to declare them above, because closure can still erase them
676// unless they go on the prototype.
Kevin Lubick369f6a52019-10-03 11:22:08 -0400677CanvasKit.Paragraph.prototype.getRectsForRange = function() {};
678
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500679CanvasKit.SkPath.prototype.addArc = function() {};
Kevin Lubicke384df42019-08-26 15:48:09 -0400680CanvasKit.SkPath.prototype.addOval = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400681CanvasKit.SkPath.prototype.addPath = function() {};
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500682CanvasKit.SkPath.prototype.addRect = function() {};
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500683CanvasKit.SkPath.prototype.addRoundRect = function() {};
Alexander Khovansky3e119332018-11-15 02:01:19 +0300684CanvasKit.SkPath.prototype.arc = function() {};
Kevin Lubick006a6f32018-10-19 14:34:34 -0400685CanvasKit.SkPath.prototype.arcTo = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400686CanvasKit.SkPath.prototype.close = function() {};
Kevin Lubick006a6f32018-10-19 14:34:34 -0400687CanvasKit.SkPath.prototype.conicTo = function() {};
688CanvasKit.SkPath.prototype.cubicTo = function() {};
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400689CanvasKit.SkPath.prototype.dash = function() {};
Kevin Lubick006a6f32018-10-19 14:34:34 -0400690CanvasKit.SkPath.prototype.lineTo = function() {};
691CanvasKit.SkPath.prototype.moveTo = function() {};
Kevin Lubicke384df42019-08-26 15:48:09 -0400692CanvasKit.SkPath.prototype.offset = function() {};
Kevin Lubick006a6f32018-10-19 14:34:34 -0400693CanvasKit.SkPath.prototype.op = function() {};
694CanvasKit.SkPath.prototype.quadTo = function() {};
Kevin Lubick79b71342019-11-01 14:36:52 -0400695CanvasKit.SkPath.prototype.rArcTo = function() {};
696CanvasKit.SkPath.prototype.rConicTo = function() {};
697CanvasKit.SkPath.prototype.rCubicTo = function() {};
698CanvasKit.SkPath.prototype.rLineTo = function() {};
699CanvasKit.SkPath.prototype.rMoveTo = function() {};
700CanvasKit.SkPath.prototype.rQuadTo = function() {};
Kevin Lubick006a6f32018-10-19 14:34:34 -0400701CanvasKit.SkPath.prototype.rect = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400702CanvasKit.SkPath.prototype.simplify = function() {};
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400703CanvasKit.SkPath.prototype.stroke = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400704CanvasKit.SkPath.prototype.transform = function() {};
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400705CanvasKit.SkPath.prototype.trim = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400706
Kevin Lubickcc13fd32019-04-05 13:00:01 -0400707CanvasKit.SkPicture.prototype.DEBUGONLY_saveAsFile = function() {};
708
Kevin Lubick5b90b842018-10-17 07:57:18 -0400709CanvasKit.SkSurface.prototype.dispose = function() {};
Kevin Lubick359a7e32019-03-19 09:34:37 -0400710CanvasKit.SkSurface.prototype.flush = function() {};
711CanvasKit.SkSurface.prototype.requestAnimationFrame = function() {};
Kevin Lubickcc13fd32019-04-05 13:00:01 -0400712CanvasKit.SkSurface.prototype.captureFrameAsSkPicture = function() {};
Kevin Lubick53965c92018-10-11 08:51:55 -0400713
Kevin Lubick12c0e502018-11-28 12:51:56 -0500714/** @return {CanvasKit.SkVertices} */
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400715CanvasKit.SkVertices.prototype.applyBones = function() {};
716
Alexander Khovansky3e119332018-11-15 02:01:19 +0300717CanvasKit.SkImage.prototype.encodeToData = function() {};
Kevin Lubicka064c282019-04-04 09:28:53 -0400718CanvasKit.SkImage.prototype.makeShader = function() {};
Alexander Khovansky3e119332018-11-15 02:01:19 +0300719
Kevin Lubickee91c072019-03-29 10:39:52 -0400720CanvasKit.SkCanvas.prototype.drawAtlas = function() {};
Kevin Lubickec4903d2019-01-14 08:36:08 -0500721CanvasKit.SkCanvas.prototype.drawText = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500722/** @return {Uint8Array} */
723CanvasKit.SkCanvas.prototype.readPixels = function() {};
724CanvasKit.SkCanvas.prototype.writePixels = function() {};
725
Kevin Lubickddd0a332018-12-12 10:35:13 -0500726CanvasKit.SkFontMgr.prototype.MakeTypefaceFromData = function() {};
727
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400728CanvasKit.SkFont.prototype.getWidths = function() {};
729
730CanvasKit.RSXFormBuilder.prototype.build = function() {};
731CanvasKit.RSXFormBuilder.prototype.delete = function() {};
732CanvasKit.RSXFormBuilder.prototype.push = function() {};
Kevin Lubickee91c072019-03-29 10:39:52 -0400733CanvasKit.RSXFormBuilder.prototype.set = function() {};
734
735CanvasKit.SkColorBuilder.prototype.build = function() {};
736CanvasKit.SkColorBuilder.prototype.delete = function() {};
737CanvasKit.SkColorBuilder.prototype.push = function() {};
738CanvasKit.SkColorBuilder.prototype.set = function() {};
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400739
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400740// Define StrokeOpts object
741var StrokeOpts = {};
742StrokeOpts.prototype.width;
743StrokeOpts.prototype.miter_limit;
744StrokeOpts.prototype.cap;
745StrokeOpts.prototype.join;
Kevin Lubick1646e7d2018-12-07 13:03:08 -0500746StrokeOpts.prototype.precision;
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400747
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500748// Define everything created in the canvas2d spec here
Kevin Lubickb9db3902018-11-26 11:47:54 -0500749var HTMLCanvas = {};
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500750HTMLCanvas.prototype.decodeImage = function() {};
751HTMLCanvas.prototype.dispose = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500752HTMLCanvas.prototype.getContext = function() {};
Kevin Lubick8e4a3312018-12-14 15:03:41 -0500753HTMLCanvas.prototype.loadFont = function() {};
Kevin Lubicka40f8322018-12-17 16:01:36 -0500754HTMLCanvas.prototype.makePath2D = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500755HTMLCanvas.prototype.toDataURL = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500756
757var CanvasRenderingContext2D = {};
758CanvasRenderingContext2D.prototype.addHitRegion = function() {};
759CanvasRenderingContext2D.prototype.arc = function() {};
760CanvasRenderingContext2D.prototype.arcTo = function() {};
761CanvasRenderingContext2D.prototype.beginPath = function() {};
762CanvasRenderingContext2D.prototype.bezierCurveTo = function() {};
763CanvasRenderingContext2D.prototype.clearHitRegions = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500764CanvasRenderingContext2D.prototype.clearRect = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500765CanvasRenderingContext2D.prototype.clip = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500766CanvasRenderingContext2D.prototype.closePath = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500767CanvasRenderingContext2D.prototype.createImageData = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500768CanvasRenderingContext2D.prototype.createLinearGradient = function() {};
Kevin Lubickd29edd72018-12-07 08:29:52 -0500769CanvasRenderingContext2D.prototype.createPattern = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500770CanvasRenderingContext2D.prototype.createRadialGradient = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500771CanvasRenderingContext2D.prototype.drawFocusIfNeeded = function() {};
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500772CanvasRenderingContext2D.prototype.drawImage = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500773CanvasRenderingContext2D.prototype.ellipse = function() {};
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500774CanvasRenderingContext2D.prototype.fill = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500775CanvasRenderingContext2D.prototype.fillRect = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500776CanvasRenderingContext2D.prototype.fillText = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500777CanvasRenderingContext2D.prototype.getImageData = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500778CanvasRenderingContext2D.prototype.getLineDash = function() {};
Kevin Lubick1646e7d2018-12-07 13:03:08 -0500779CanvasRenderingContext2D.prototype.isPointInPath = function() {};
780CanvasRenderingContext2D.prototype.isPointInStroke = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500781CanvasRenderingContext2D.prototype.lineTo = function() {};
782CanvasRenderingContext2D.prototype.measureText = function() {};
783CanvasRenderingContext2D.prototype.moveTo = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500784CanvasRenderingContext2D.prototype.putImageData = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500785CanvasRenderingContext2D.prototype.quadraticCurveTo = function() {};
786CanvasRenderingContext2D.prototype.rect = function() {};
787CanvasRenderingContext2D.prototype.removeHitRegion = function() {};
788CanvasRenderingContext2D.prototype.resetTransform = function() {};
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500789CanvasRenderingContext2D.prototype.restore = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500790CanvasRenderingContext2D.prototype.rotate = function() {};
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500791CanvasRenderingContext2D.prototype.save = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500792CanvasRenderingContext2D.prototype.scale = function() {};
793CanvasRenderingContext2D.prototype.scrollPathIntoView = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500794CanvasRenderingContext2D.prototype.setLineDash = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500795CanvasRenderingContext2D.prototype.setTransform = function() {};
796CanvasRenderingContext2D.prototype.stroke = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500797CanvasRenderingContext2D.prototype.strokeRect = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500798CanvasRenderingContext2D.prototype.strokeText = function() {};
799CanvasRenderingContext2D.prototype.transform = function() {};
800CanvasRenderingContext2D.prototype.translate = function() {};
801
Kevin Lubicka40f8322018-12-17 16:01:36 -0500802var Path2D = {};
803Path2D.prototype.addPath = function() {};
804Path2D.prototype.arc = function() {};
805Path2D.prototype.arcTo = function() {};
806Path2D.prototype.bezierCurveTo = function() {};
807Path2D.prototype.closePath = function() {};
808Path2D.prototype.ellipse = function() {};
809Path2D.prototype.lineTo = function() {};
810Path2D.prototype.moveTo = function() {};
811Path2D.prototype.quadraticCurveTo = function() {};
812Path2D.prototype.rect = function() {};
813
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500814var LinearCanvasGradient = {};
815LinearCanvasGradient.prototype.addColorStop = function() {};
816var RadialCanvasGradient = {};
817RadialCanvasGradient.prototype.addColorStop = function() {};
Kevin Lubickd29edd72018-12-07 08:29:52 -0500818var CanvasPattern = {};
819CanvasPattern.prototype.setTransform = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500820
Kevin Lubick52b9f372018-12-04 13:57:36 -0500821var ImageData = {
822 /**
823 * @type {Uint8ClampedArray}
824 */
825 data: {},
826 height: {},
827 width: {},
828};
829
Kevin Lubickd29edd72018-12-07 08:29:52 -0500830var DOMMatrix = {
831 a: {},
832 b: {},
833 c: {},
834 d: {},
835 e: {},
836 f: {},
837};
838
Kevin Lubick217056c2018-09-20 17:39:31 -0400839// 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 -0500840function loadWebAssemblyModule() {};