blob: c51278e36debcf39daf90289533d76857a98863d [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)
Kevin Lubick6b921b72019-09-18 16:18:17 -0400123 decodeNextFrame: function() {},
Kevin Lubick47bd9f12019-11-08 06:55:15 -0800124 getFrameCount: function() {},
125 getRepetitionCount: function() {},
126 height: function() {},
127 reset: function() {},
128 width: function() {},
Kevin Lubick6b921b72019-09-18 16:18:17 -0400129 },
130
Kevin Lubick006a6f32018-10-19 14:34:34 -0400131 SkCanvas: {
132 // public API (from C++ bindings)
133 clear: function() {},
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500134 clipPath: function() {},
Kevin Lubick6dbc4ed2019-10-22 09:43:34 -0400135 clipRRect: function() {},
Kevin Lubick5d5723c2018-12-07 10:09:11 -0500136 clipRect: function() {},
137 concat: function() {},
Kevin Lubick6dbc4ed2019-10-22 09:43:34 -0400138 drawAnimatedImage: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500139 drawArc: function() {},
Kevin Lubicke384df42019-08-26 15:48:09 -0400140 drawCircle: function() {},
Kevin Lubick6dbc4ed2019-10-22 09:43:34 -0400141 drawColor: function() {},
Kevin Lubick2e5fe352019-09-03 12:59:06 -0400142 drawDRRect: function() {},
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500143 drawImage: function() {},
144 drawImageRect: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500145 drawLine: function() {},
146 drawOval: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400147 drawPaint: function() {},
Kevin Lubick369f6a52019-10-03 11:22:08 -0400148 drawParagraph: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400149 drawPath: function() {},
Kevin Lubickcc13fd32019-04-05 13:00:01 -0400150 drawPicture: function() {},
Kevin Lubick2e5fe352019-09-03 12:59:06 -0400151 drawRRect: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -0500152 drawRect: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500153 drawRoundRect: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500154 drawShadow: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -0500155 drawText: function() {},
Kevin Lubickec4903d2019-01-14 08:36:08 -0500156 drawTextBlob: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -0500157 drawVertices: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400158 flush: function() {},
Kevin Lubick2e5fe352019-09-03 12:59:06 -0400159 getSaveCount: function() {},
Kevin Lubick5d5723c2018-12-07 10:09:11 -0500160 getTotalMatrix: function() {},
Kevin Lubick543f3522019-03-08 10:04:28 -0500161 makeSurface: function() {},
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500162 restore: function() {},
Kevin Lubickb3574c92019-03-06 08:25:36 -0500163 restoreToCount: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400164 rotate: function() {},
165 save: function() {},
Kevin Lubickb3574c92019-03-06 08:25:36 -0500166 saveLayer: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400167 scale: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400168 skew: function() {},
169 translate: function() {},
170
171 // private API
Kevin Lubickee91c072019-03-29 10:39:52 -0400172 _drawAtlas: function() {},
Kevin Lubickec4903d2019-01-14 08:36:08 -0500173 _drawSimpleText: function() {},
Kevin Lubick52b9f372018-12-04 13:57:36 -0500174 _readPixels: function() {},
175 _writePixels: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400176 delete: function() {},
177 },
178
Kevin Lubickd3729342019-09-12 11:11:25 -0400179 SkColorFilter: {
180 // public API (from C++ bindings and JS interface)
181 MakeBlend: function() {},
182 MakeCompose: function() {},
183 MakeLerp: function() {},
184 MakeLinearToSRGBGamma: function() {},
185 MakeMatrix: function() {},
186 MakeSRGBToLinearGamma: function() {},
187 // private API (from C++ bindings)
188 _makeMatrix: function() {},
189 },
190
191 SkColorMatrix: {
192 concat: function() {},
193 identity: function() {},
194 postTranslate: function() {},
195 rotated: function() {},
196 scaled: function() {},
197 },
198
Kevin Lubick35ac0382019-01-02 15:13:57 -0500199 SkFont: {
200 // public API (from C++ bindings)
201 getScaleX: function() {},
202 getSize: function() {},
203 getSkewX: function() {},
204 getTypeface: function() {},
205 measureText: function() {},
206 setScaleX: function() {},
207 setSize: function() {},
208 setSkewX: function() {},
209 setTypeface: function() {},
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400210 // private API (from C++ bindings)
211 _getWidths: function() {},
Kevin Lubick35ac0382019-01-02 15:13:57 -0500212 },
213
Kevin Lubickddd0a332018-12-12 10:35:13 -0500214 SkFontMgr: {
Kevin Lubick61887c72019-09-26 13:20:50 -0400215 // public API (from C++ and JS bindings)
216 FromData: function() {},
Kevin Lubickddd0a332018-12-12 10:35:13 -0500217 RefDefault: function() {},
218 countFamilies: function() {},
219
220 // private API
221 _makeTypefaceFromData: function() {},
Kevin Lubick61887c72019-09-26 13:20:50 -0400222 _fromData: function() {},
Kevin Lubickddd0a332018-12-12 10:35:13 -0500223 },
224
Kevin Lubick006a6f32018-10-19 14:34:34 -0400225 SkImage: {
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500226 // public API (from C++ bindings)
227 height: function() {},
228 width: function() {},
Alexander Khovansky3e119332018-11-15 02:01:19 +0300229 // private API
230 _encodeToData: function() {},
231 _encodeToDataWithFormat: function() {},
Kevin Lubicka064c282019-04-04 09:28:53 -0400232 _makeShader: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400233 },
234
Kevin Lubick15b40232019-10-29 09:55:39 -0400235 SkImageFilter: {
236 MakeBlur: function() {},
237 MakeColorFilter: function() {},
238 MakeCompose: function() {},
239 },
240
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500241 SkMatrix: {
Kevin Lubickb9db3902018-11-26 11:47:54 -0500242 identity: function() {},
Kevin Lubickf3555182019-03-14 10:55:10 -0400243 invert: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500244 mapPoints: function() {},
245 multiply: function() {},
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500246 rotated: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500247 scaled: function() {},
248 skewed: function() {},
249 translated: function() {},
250 },
251
Kevin Lubick15b40232019-10-29 09:55:39 -0400252 SkMaskFilter: {
253 MakeBlur: function() {},
254 },
255
Kevin Lubickb9db3902018-11-26 11:47:54 -0500256 SkPaint: {
257 // public API (from C++ bindings)
258 /** @return {CanvasKit.SkPaint} */
259 copy: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -0500260 getBlendMode: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500261 getColor: function() {},
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500262 getFilterQuality: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500263 getStrokeCap: function() {},
264 getStrokeJoin: function() {},
265 getStrokeMiter: function() {},
266 getStrokeWidth: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500267 setAntiAlias: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -0500268 setBlendMode: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500269 setColor: function() {},
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500270 setFilterQuality: function() {},
Kevin Lubick15b40232019-10-29 09:55:39 -0400271 setImageFilter: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500272 setMaskFilter: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500273 setPathEffect: function() {},
274 setShader: function() {},
275 setStrokeCap: function() {},
276 setStrokeJoin: function() {},
277 setStrokeMiter: function() {},
278 setStrokeWidth: function() {},
279 setStyle: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500280
281 //private API
282 delete: function() {},
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500283 },
284
Kevin Lubick006a6f32018-10-19 14:34:34 -0400285 SkPath: {
286 // public API (from C++ bindings)
Kevin Lubickb9db3902018-11-26 11:47:54 -0500287 computeTightBounds: function() {},
Kevin Lubick1646e7d2018-12-07 13:03:08 -0500288 contains: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500289 /** @return {CanvasKit.SkPath} */
290 copy: function() {},
291 countPoints: function() {},
292 equals: function() {},
293 getBounds: function() {},
294 getFillType: function() {},
295 getPoint: function() {},
Kevin Lubick1646e7d2018-12-07 13:03:08 -0500296 isEmpty: function() {},
Kevin Lubick2b79d1c2018-12-14 16:10:38 -0500297 isVolatile: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500298 reset: function() {},
299 rewind: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500300 setFillType: function() {},
Kevin Lubick2b79d1c2018-12-14 16:10:38 -0500301 setIsVolatile: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500302 toSVGString: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400303
304 // private API
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500305 _addArc: function() {},
Kevin Lubicke384df42019-08-26 15:48:09 -0400306 _addOval: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400307 _addPath: function() {},
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500308 _addRect: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500309 _addRoundRect: function() {},
Alexander Khovansky3e119332018-11-15 02:01:19 +0300310 _arc: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400311 _arcTo: function() {},
312 _close: function() {},
313 _conicTo: function() {},
314 _cubicTo: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400315 _dash: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400316 _lineTo: function() {},
317 _moveTo: function() {},
318 _op: function() {},
319 _quadTo: function() {},
Kevin Lubick79b71342019-11-01 14:36:52 -0400320 _rArcTo: function() {},
321 _rConicTo: function() {},
322 _rCubicTo: function() {},
323 _rLineTo: function() {},
324 _rMoveTo: function() {},
325 _rQuadTo: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400326 _rect: function() {},
327 _simplify: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400328 _stroke: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400329 _transform: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400330 _trim: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400331 delete: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500332 dump: function() {},
333 dumpHex: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400334 },
335
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400336 SkPathMeasure: {
337 getLength: function() {},
338 getPosTan: function() {},
339 isClosed: function() {},
340 nextContour: function() {},
341 },
342
Kevin Lubickcc13fd32019-04-05 13:00:01 -0400343 SkPicture: {
344 DEBUGONLY_serialize: function() {},
345 },
346
347 SkPictureRecorder: {
348 beginRecording: function() {},
349 finishRecordingAsPicture: function() {},
350 },
351
Kevin Lubick006a6f32018-10-19 14:34:34 -0400352 SkRect: {
353 fLeft: {},
354 fTop: {},
355 fRight: {},
356 fBottom: {},
357 },
358
Kevin Lubick2e5fe352019-09-03 12:59:06 -0400359 SkRRect: {
360 rect: {},
Kevin Lubick7d644e12019-09-11 14:22:22 -0400361 rx1: {},
362 ry1: {},
363 rx2: {},
364 ry2: {},
365 rx3: {},
366 ry3: {},
367 rx4: {},
368 ry4: {},
Kevin Lubick2e5fe352019-09-03 12:59:06 -0400369 },
370
Kevin Lubick006a6f32018-10-19 14:34:34 -0400371 SkSurface: {
372 // public API (from C++ bindings)
373 /** @return {CanvasKit.SkCanvas} */
374 getCanvas: function() {},
375 /** @return {CanvasKit.SkImage} */
376 makeImageSnapshot: function() {},
Kevin Lubick543f3522019-03-08 10:04:28 -0500377 makeSurface: function() {},
Kevin Lubickcd544662019-03-22 15:41:36 -0400378 grContext: {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400379
380 // private API
381 _flush: function() {},
382 _getRasterN32PremulSurface: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400383 delete: function() {},
384 },
385
Kevin Lubickec4903d2019-01-14 08:36:08 -0500386 SkTextBlob: {
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400387 // public API (both C++ and JS bindings)
388 MakeFromRSXform: function() {},
Kevin Lubickec4903d2019-01-14 08:36:08 -0500389 MakeFromText: function() {},
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400390 MakeOnPath: function() {},
391 // private API (from C++ bindings)
392 _MakeFromRSXform: function() {},
Kevin Lubickec4903d2019-01-14 08:36:08 -0500393 _MakeFromText: function() {},
394 },
395
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400396 SkVertices: {
397 // public API (from C++ bindings)
Kevin Lubick12c0e502018-11-28 12:51:56 -0500398 bounds: function() {},
399 mode: function() {},
400 uniqueID: function() {},
401 vertexCount: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400402
403 // private API
404 /** @return {CanvasKit.SkVertices} */
405 _applyBones: function() {},
406 },
407
Kevin Lubickd6ba7252019-06-03 14:38:05 -0400408 _SkVerticesBuilder: {
409 // public API (from C++ bindings)
410 boneIndices: function() {},
411 boneWeights: function() {},
412 colors: function() {},
413 detach: function() {},
414 indices: function() {},
415 positions: function() {},
416 texCoords: function() {},
417 },
418
Kevin Lubick369f6a52019-10-03 11:22:08 -0400419 TextStyle: function() {},
420
Kevin Lubick006a6f32018-10-19 14:34:34 -0400421 // Constants and Enums
422 gpu: {},
423 skottie: {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400424
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500425 TRANSPARENT: {},
426 RED: {},
427 BLUE: {},
428 YELLOW: {},
429 CYAN: {},
430 BLACK: {},
Kevin Lubickea905ec2018-11-30 14:05:58 -0500431 WHITE: {},
432
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500433 MOVE_VERB: {},
434 LINE_VERB: {},
435 QUAD_VERB: {},
436 CONIC_VERB: {},
437 CUBIC_VERB: {},
438 CLOSE_VERB: {},
439
Kevin Lubick369f6a52019-10-03 11:22:08 -0400440 NoDecoration: {},
441 UnderlineDecoration: {},
442 OverlineDecoration: {},
443 LineThroughDecoration: {},
444
Kevin Lubick77d9b5c2019-10-29 10:48:26 -0400445 SaveLayerInitWithPrevious: {},
446 SaveLayerF16ColorType: {},
447
Kevin Lubick369f6a52019-10-03 11:22:08 -0400448 Affinity: {
449 Upstream: {},
450 Downstream: {},
451 },
452
Kevin Lubickea905ec2018-11-30 14:05:58 -0500453 AlphaType: {
454 Opaque: {},
455 Premul: {},
456 Unpremul: {},
457 },
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500458
459 BlendMode: {
460 Clear: {},
461 Src: {},
462 Dst: {},
463 SrcOver: {},
464 DstOver: {},
465 SrcIn: {},
466 DstIn: {},
467 SrcOut: {},
468 DstOut: {},
469 SrcATop: {},
470 DstATop: {},
471 Xor: {},
472 Plus: {},
473 Modulate: {},
474 Screen: {},
475 Overlay: {},
476 Darken: {},
477 Lighten: {},
478 ColorDodge: {},
479 ColorBurn: {},
480 HardLight: {},
481 SoftLight: {},
482 Difference: {},
483 Exclusion: {},
484 Multiply: {},
485 Hue: {},
486 Saturation: {},
487 Color: {},
488 Luminosity: {},
489 },
490
491 BlurStyle: {
492 Normal: {},
493 Solid: {},
494 Outer: {},
495 Inner: {},
496 },
497
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500498 ClipOp: {
499 Difference: {},
500 Intersect: {},
501 },
502
Kevin Lubickea905ec2018-11-30 14:05:58 -0500503 ColorType: {
504 Alpha_8: {},
505 RGB_565: {},
506 ARGB_4444: {},
507 RGBA_8888: {},
508 RGB_888x: {},
509 BGRA_8888: {},
510 RGBA_1010102: {},
511 RGB_101010x: {},
512 Gray_8: {},
513 RGBA_F16: {},
514 RGBA_F32: {},
515 },
516
Kevin Lubick006a6f32018-10-19 14:34:34 -0400517 FillType: {
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500518 Winding: {},
519 EvenOdd: {},
520 InverseWinding: {},
521 InverseEvenOdd: {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400522 },
523
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500524 FilterQuality: {
525 None: {},
526 Low: {},
527 Medium: {},
528 High: {},
529 },
530
Kevin Lubickd3b1fe62019-10-21 10:50:26 -0400531 FontSlant: {
532 Upright: {},
533 Italic: {},
534 Oblique: {},
535 },
536
537 FontWeight: {
538 Invisible: {},
539 Thin: {},
540 ExtraLight: {},
541 Light: {},
542 Normal: {},
543 Medium: {},
544 SemiBold: {},
545 Bold: {},
546 ExtraBold: {},
547 Black: {},
548 ExtraBlack: {},
549 },
550
551 FontWidth: {
552 UltraCondensed: {},
553 ExtraCondensed: {},
554 Condensed: {},
555 SemiCondensed: {},
556 Normal: {},
557 SemiExpanded: {},
558 Expanded: {},
559 ExtraExpanded: {},
560 UltraExpanded: {},
561 },
562
Alexander Khovansky3e119332018-11-15 02:01:19 +0300563 ImageFormat: {
564 PNG: {},
565 JPEG: {},
566 },
567
Kevin Lubickb9db3902018-11-26 11:47:54 -0500568 PaintStyle: {
569 Fill: {},
570 Stroke: {},
571 StrokeAndFill: {},
572 },
573
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500574 PathOp: {
575 Difference: {},
576 Intersect: {},
577 Union: {},
578 XOR: {},
579 ReverseDifference: {},
580 },
581
Kevin Lubick369f6a52019-10-03 11:22:08 -0400582 RectHeightStyle: {
583 Tight: {},
584 Max: {},
585 },
586
587 RectWidthStyle: {
588 Tight: {},
589 Max: {},
590 },
591
Kevin Lubickb9db3902018-11-26 11:47:54 -0500592 StrokeCap: {
593 Butt: {},
594 Round: {},
595 Square: {},
596 },
597
598 StrokeJoin: {
599 Miter: {},
600 Round: {},
601 Bevel: {},
602 },
603
Kevin Lubick369f6a52019-10-03 11:22:08 -0400604 TextAlign: {
605 Left: {},
606 Right: {},
607 Center: {},
608 Justify: {},
609 Start: {},
610 End: {},
611 },
612
Kevin Lubickd3b1fe62019-10-21 10:50:26 -0400613 TextDirection: {
614 LTR: {},
615 RTL: {},
616 },
617
Kevin Lubickec4903d2019-01-14 08:36:08 -0500618 TextEncoding: {
619 UTF8: {},
620 UTF16: {},
621 UTF32: {},
622 GlyphID: {},
623 },
624
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500625 TileMode: {
626 Clamp: {},
627 Repeat: {},
628 Mirror: {},
Kevin Lubickd29edd72018-12-07 08:29:52 -0500629 Decal: {},
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500630 },
631
632 VertexMode: {
633 Triangles: {},
634 TrianglesStrip: {},
635 TriangleFan: {},
636 },
637
Kevin Lubick006a6f32018-10-19 14:34:34 -0400638 // Things Enscriptem adds for us
639
Kevin Lubick53965c92018-10-11 08:51:55 -0400640 /**
641 * @type {Float32Array}
642 */
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400643 HEAPF32: {},
Kevin Lubick53965c92018-10-11 08:51:55 -0400644 /**
Kevin Lubickfa5a1382019-10-09 10:46:14 -0400645 * @type {Float64Array}
646 */
647 HEAPF64: {},
648 /**
Kevin Lubick53965c92018-10-11 08:51:55 -0400649 * @type {Uint8Array}
650 */
651 HEAPU8: {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400652 /**
653 * @type {Uint16Array}
654 */
655 HEAPU16: {},
656 /**
Kevin Lubickf5ea37f2019-02-28 10:06:18 -0500657 * @type {Uint32Array}
658 */
659 HEAPU32: {},
Kevin Lubickfa5a1382019-10-09 10:46:14 -0400660 /**
661 * @type {Int8Array}
662 */
663 HEAP8: {},
664 /**
665 * @type {Int16Array}
666 */
667 HEAP16: {},
668 /**
669 * @type {Int32Array}
670 */
671 HEAP32: {},
672
Kevin Lubick006a6f32018-10-19 14:34:34 -0400673 _malloc: function() {},
674 _free: function() {},
675 onRuntimeInitialized: function() {},
676};
Kevin Lubick217056c2018-09-20 17:39:31 -0400677
Kevin Lubick006a6f32018-10-19 14:34:34 -0400678// Public API things that are newly declared in the JS should go here.
679// It's not enough to declare them above, because closure can still erase them
680// unless they go on the prototype.
Kevin Lubick369f6a52019-10-03 11:22:08 -0400681CanvasKit.Paragraph.prototype.getRectsForRange = function() {};
682
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500683CanvasKit.SkPath.prototype.addArc = function() {};
Kevin Lubicke384df42019-08-26 15:48:09 -0400684CanvasKit.SkPath.prototype.addOval = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400685CanvasKit.SkPath.prototype.addPath = function() {};
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500686CanvasKit.SkPath.prototype.addRect = function() {};
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500687CanvasKit.SkPath.prototype.addRoundRect = function() {};
Alexander Khovansky3e119332018-11-15 02:01:19 +0300688CanvasKit.SkPath.prototype.arc = function() {};
Kevin Lubick006a6f32018-10-19 14:34:34 -0400689CanvasKit.SkPath.prototype.arcTo = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400690CanvasKit.SkPath.prototype.close = function() {};
Kevin Lubick006a6f32018-10-19 14:34:34 -0400691CanvasKit.SkPath.prototype.conicTo = function() {};
692CanvasKit.SkPath.prototype.cubicTo = function() {};
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400693CanvasKit.SkPath.prototype.dash = function() {};
Kevin Lubick006a6f32018-10-19 14:34:34 -0400694CanvasKit.SkPath.prototype.lineTo = function() {};
695CanvasKit.SkPath.prototype.moveTo = function() {};
Kevin Lubicke384df42019-08-26 15:48:09 -0400696CanvasKit.SkPath.prototype.offset = function() {};
Kevin Lubick006a6f32018-10-19 14:34:34 -0400697CanvasKit.SkPath.prototype.op = function() {};
698CanvasKit.SkPath.prototype.quadTo = function() {};
Kevin Lubick79b71342019-11-01 14:36:52 -0400699CanvasKit.SkPath.prototype.rArcTo = function() {};
700CanvasKit.SkPath.prototype.rConicTo = function() {};
701CanvasKit.SkPath.prototype.rCubicTo = function() {};
702CanvasKit.SkPath.prototype.rLineTo = function() {};
703CanvasKit.SkPath.prototype.rMoveTo = function() {};
704CanvasKit.SkPath.prototype.rQuadTo = function() {};
Kevin Lubick006a6f32018-10-19 14:34:34 -0400705CanvasKit.SkPath.prototype.rect = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400706CanvasKit.SkPath.prototype.simplify = function() {};
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400707CanvasKit.SkPath.prototype.stroke = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400708CanvasKit.SkPath.prototype.transform = function() {};
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400709CanvasKit.SkPath.prototype.trim = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400710
Kevin Lubickcc13fd32019-04-05 13:00:01 -0400711CanvasKit.SkPicture.prototype.DEBUGONLY_saveAsFile = function() {};
712
Kevin Lubick5b90b842018-10-17 07:57:18 -0400713CanvasKit.SkSurface.prototype.dispose = function() {};
Kevin Lubick359a7e32019-03-19 09:34:37 -0400714CanvasKit.SkSurface.prototype.flush = function() {};
715CanvasKit.SkSurface.prototype.requestAnimationFrame = function() {};
Kevin Lubickcc13fd32019-04-05 13:00:01 -0400716CanvasKit.SkSurface.prototype.captureFrameAsSkPicture = function() {};
Kevin Lubick53965c92018-10-11 08:51:55 -0400717
Kevin Lubick12c0e502018-11-28 12:51:56 -0500718/** @return {CanvasKit.SkVertices} */
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400719CanvasKit.SkVertices.prototype.applyBones = function() {};
720
Alexander Khovansky3e119332018-11-15 02:01:19 +0300721CanvasKit.SkImage.prototype.encodeToData = function() {};
Kevin Lubicka064c282019-04-04 09:28:53 -0400722CanvasKit.SkImage.prototype.makeShader = function() {};
Alexander Khovansky3e119332018-11-15 02:01:19 +0300723
Kevin Lubickee91c072019-03-29 10:39:52 -0400724CanvasKit.SkCanvas.prototype.drawAtlas = function() {};
Kevin Lubickec4903d2019-01-14 08:36:08 -0500725CanvasKit.SkCanvas.prototype.drawText = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500726/** @return {Uint8Array} */
727CanvasKit.SkCanvas.prototype.readPixels = function() {};
728CanvasKit.SkCanvas.prototype.writePixels = function() {};
729
Kevin Lubickddd0a332018-12-12 10:35:13 -0500730CanvasKit.SkFontMgr.prototype.MakeTypefaceFromData = function() {};
731
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400732CanvasKit.SkFont.prototype.getWidths = function() {};
733
734CanvasKit.RSXFormBuilder.prototype.build = function() {};
735CanvasKit.RSXFormBuilder.prototype.delete = function() {};
736CanvasKit.RSXFormBuilder.prototype.push = function() {};
Kevin Lubickee91c072019-03-29 10:39:52 -0400737CanvasKit.RSXFormBuilder.prototype.set = function() {};
738
739CanvasKit.SkColorBuilder.prototype.build = function() {};
740CanvasKit.SkColorBuilder.prototype.delete = function() {};
741CanvasKit.SkColorBuilder.prototype.push = function() {};
742CanvasKit.SkColorBuilder.prototype.set = function() {};
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400743
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400744// Define StrokeOpts object
745var StrokeOpts = {};
746StrokeOpts.prototype.width;
747StrokeOpts.prototype.miter_limit;
748StrokeOpts.prototype.cap;
749StrokeOpts.prototype.join;
Kevin Lubick1646e7d2018-12-07 13:03:08 -0500750StrokeOpts.prototype.precision;
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400751
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500752// Define everything created in the canvas2d spec here
Kevin Lubickb9db3902018-11-26 11:47:54 -0500753var HTMLCanvas = {};
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500754HTMLCanvas.prototype.decodeImage = function() {};
755HTMLCanvas.prototype.dispose = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500756HTMLCanvas.prototype.getContext = function() {};
Kevin Lubick8e4a3312018-12-14 15:03:41 -0500757HTMLCanvas.prototype.loadFont = function() {};
Kevin Lubicka40f8322018-12-17 16:01:36 -0500758HTMLCanvas.prototype.makePath2D = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500759HTMLCanvas.prototype.toDataURL = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500760
761var CanvasRenderingContext2D = {};
762CanvasRenderingContext2D.prototype.addHitRegion = function() {};
763CanvasRenderingContext2D.prototype.arc = function() {};
764CanvasRenderingContext2D.prototype.arcTo = function() {};
765CanvasRenderingContext2D.prototype.beginPath = function() {};
766CanvasRenderingContext2D.prototype.bezierCurveTo = function() {};
767CanvasRenderingContext2D.prototype.clearHitRegions = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500768CanvasRenderingContext2D.prototype.clearRect = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500769CanvasRenderingContext2D.prototype.clip = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500770CanvasRenderingContext2D.prototype.closePath = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500771CanvasRenderingContext2D.prototype.createImageData = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500772CanvasRenderingContext2D.prototype.createLinearGradient = function() {};
Kevin Lubickd29edd72018-12-07 08:29:52 -0500773CanvasRenderingContext2D.prototype.createPattern = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500774CanvasRenderingContext2D.prototype.createRadialGradient = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500775CanvasRenderingContext2D.prototype.drawFocusIfNeeded = function() {};
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500776CanvasRenderingContext2D.prototype.drawImage = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500777CanvasRenderingContext2D.prototype.ellipse = function() {};
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500778CanvasRenderingContext2D.prototype.fill = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500779CanvasRenderingContext2D.prototype.fillRect = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500780CanvasRenderingContext2D.prototype.fillText = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500781CanvasRenderingContext2D.prototype.getImageData = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500782CanvasRenderingContext2D.prototype.getLineDash = function() {};
Kevin Lubick1646e7d2018-12-07 13:03:08 -0500783CanvasRenderingContext2D.prototype.isPointInPath = function() {};
784CanvasRenderingContext2D.prototype.isPointInStroke = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500785CanvasRenderingContext2D.prototype.lineTo = function() {};
786CanvasRenderingContext2D.prototype.measureText = function() {};
787CanvasRenderingContext2D.prototype.moveTo = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500788CanvasRenderingContext2D.prototype.putImageData = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500789CanvasRenderingContext2D.prototype.quadraticCurveTo = function() {};
790CanvasRenderingContext2D.prototype.rect = function() {};
791CanvasRenderingContext2D.prototype.removeHitRegion = function() {};
792CanvasRenderingContext2D.prototype.resetTransform = function() {};
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500793CanvasRenderingContext2D.prototype.restore = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500794CanvasRenderingContext2D.prototype.rotate = function() {};
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500795CanvasRenderingContext2D.prototype.save = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500796CanvasRenderingContext2D.prototype.scale = function() {};
797CanvasRenderingContext2D.prototype.scrollPathIntoView = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500798CanvasRenderingContext2D.prototype.setLineDash = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500799CanvasRenderingContext2D.prototype.setTransform = function() {};
800CanvasRenderingContext2D.prototype.stroke = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500801CanvasRenderingContext2D.prototype.strokeRect = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500802CanvasRenderingContext2D.prototype.strokeText = function() {};
803CanvasRenderingContext2D.prototype.transform = function() {};
804CanvasRenderingContext2D.prototype.translate = function() {};
805
Kevin Lubicka40f8322018-12-17 16:01:36 -0500806var Path2D = {};
807Path2D.prototype.addPath = function() {};
808Path2D.prototype.arc = function() {};
809Path2D.prototype.arcTo = function() {};
810Path2D.prototype.bezierCurveTo = function() {};
811Path2D.prototype.closePath = function() {};
812Path2D.prototype.ellipse = function() {};
813Path2D.prototype.lineTo = function() {};
814Path2D.prototype.moveTo = function() {};
815Path2D.prototype.quadraticCurveTo = function() {};
816Path2D.prototype.rect = function() {};
817
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500818var LinearCanvasGradient = {};
819LinearCanvasGradient.prototype.addColorStop = function() {};
820var RadialCanvasGradient = {};
821RadialCanvasGradient.prototype.addColorStop = function() {};
Kevin Lubickd29edd72018-12-07 08:29:52 -0500822var CanvasPattern = {};
823CanvasPattern.prototype.setTransform = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500824
Kevin Lubick52b9f372018-12-04 13:57:36 -0500825var ImageData = {
826 /**
827 * @type {Uint8ClampedArray}
828 */
829 data: {},
830 height: {},
831 width: {},
832};
833
Kevin Lubickd29edd72018-12-07 08:29:52 -0500834var DOMMatrix = {
835 a: {},
836 b: {},
837 c: {},
838 d: {},
839 e: {},
840 f: {},
841};
842
Kevin Lubick217056c2018-09-20 17:39:31 -0400843// 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 -0500844function loadWebAssemblyModule() {};