blob: c0ee254083f3df694b34e0f554becaffb6e42567 [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() {},
Kevin Lubick37ab53e2019-11-11 10:06:08 -0500144 drawImageNine: function() {},
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500145 drawImageRect: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500146 drawLine: function() {},
147 drawOval: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400148 drawPaint: function() {},
Kevin Lubick369f6a52019-10-03 11:22:08 -0400149 drawParagraph: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400150 drawPath: function() {},
Kevin Lubickcc13fd32019-04-05 13:00:01 -0400151 drawPicture: function() {},
Kevin Lubick2e5fe352019-09-03 12:59:06 -0400152 drawRRect: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -0500153 drawRect: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500154 drawRoundRect: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500155 drawShadow: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -0500156 drawText: function() {},
Kevin Lubickec4903d2019-01-14 08:36:08 -0500157 drawTextBlob: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -0500158 drawVertices: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400159 flush: function() {},
Kevin Lubick2e5fe352019-09-03 12:59:06 -0400160 getSaveCount: function() {},
Kevin Lubick5d5723c2018-12-07 10:09:11 -0500161 getTotalMatrix: function() {},
Kevin Lubick543f3522019-03-08 10:04:28 -0500162 makeSurface: function() {},
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500163 restore: function() {},
Kevin Lubickb3574c92019-03-06 08:25:36 -0500164 restoreToCount: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400165 rotate: function() {},
166 save: function() {},
Kevin Lubickb3574c92019-03-06 08:25:36 -0500167 saveLayer: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400168 scale: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400169 skew: function() {},
170 translate: function() {},
171
172 // private API
Kevin Lubickee91c072019-03-29 10:39:52 -0400173 _drawAtlas: function() {},
Kevin Lubick37ab53e2019-11-11 10:06:08 -0500174 _drawPoints: function() {},
Kevin Lubickec4903d2019-01-14 08:36:08 -0500175 _drawSimpleText: function() {},
Kevin Lubick52b9f372018-12-04 13:57:36 -0500176 _readPixels: function() {},
177 _writePixels: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400178 delete: function() {},
179 },
180
Kevin Lubickd3729342019-09-12 11:11:25 -0400181 SkColorFilter: {
182 // public API (from C++ bindings and JS interface)
183 MakeBlend: function() {},
184 MakeCompose: function() {},
185 MakeLerp: function() {},
186 MakeLinearToSRGBGamma: function() {},
187 MakeMatrix: function() {},
188 MakeSRGBToLinearGamma: function() {},
189 // private API (from C++ bindings)
190 _makeMatrix: function() {},
191 },
192
193 SkColorMatrix: {
194 concat: function() {},
195 identity: function() {},
196 postTranslate: function() {},
197 rotated: function() {},
198 scaled: function() {},
199 },
200
Kevin Lubick35ac0382019-01-02 15:13:57 -0500201 SkFont: {
202 // public API (from C++ bindings)
203 getScaleX: function() {},
204 getSize: function() {},
205 getSkewX: function() {},
206 getTypeface: function() {},
207 measureText: function() {},
208 setScaleX: function() {},
209 setSize: function() {},
210 setSkewX: function() {},
211 setTypeface: function() {},
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400212 // private API (from C++ bindings)
213 _getWidths: function() {},
Kevin Lubick35ac0382019-01-02 15:13:57 -0500214 },
215
Kevin Lubickddd0a332018-12-12 10:35:13 -0500216 SkFontMgr: {
Kevin Lubick61887c72019-09-26 13:20:50 -0400217 // public API (from C++ and JS bindings)
218 FromData: function() {},
Kevin Lubickddd0a332018-12-12 10:35:13 -0500219 RefDefault: function() {},
220 countFamilies: function() {},
221
222 // private API
223 _makeTypefaceFromData: function() {},
Kevin Lubick61887c72019-09-26 13:20:50 -0400224 _fromData: function() {},
Kevin Lubickddd0a332018-12-12 10:35:13 -0500225 },
226
Kevin Lubick006a6f32018-10-19 14:34:34 -0400227 SkImage: {
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500228 // public API (from C++ bindings)
229 height: function() {},
230 width: function() {},
Alexander Khovansky3e119332018-11-15 02:01:19 +0300231 // private API
232 _encodeToData: function() {},
233 _encodeToDataWithFormat: function() {},
Kevin Lubicka064c282019-04-04 09:28:53 -0400234 _makeShader: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400235 },
236
Kevin Lubick15b40232019-10-29 09:55:39 -0400237 SkImageFilter: {
238 MakeBlur: function() {},
239 MakeColorFilter: function() {},
240 MakeCompose: function() {},
241 },
242
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500243 SkMatrix: {
Kevin Lubickb9db3902018-11-26 11:47:54 -0500244 identity: function() {},
Kevin Lubickf3555182019-03-14 10:55:10 -0400245 invert: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500246 mapPoints: function() {},
247 multiply: function() {},
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500248 rotated: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500249 scaled: function() {},
250 skewed: function() {},
251 translated: function() {},
252 },
253
Kevin Lubick15b40232019-10-29 09:55:39 -0400254 SkMaskFilter: {
255 MakeBlur: function() {},
256 },
257
Kevin Lubickb9db3902018-11-26 11:47:54 -0500258 SkPaint: {
259 // public API (from C++ bindings)
260 /** @return {CanvasKit.SkPaint} */
261 copy: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -0500262 getBlendMode: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500263 getColor: function() {},
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500264 getFilterQuality: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500265 getStrokeCap: function() {},
266 getStrokeJoin: function() {},
267 getStrokeMiter: function() {},
268 getStrokeWidth: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500269 setAntiAlias: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -0500270 setBlendMode: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500271 setColor: function() {},
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500272 setFilterQuality: function() {},
Kevin Lubick15b40232019-10-29 09:55:39 -0400273 setImageFilter: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500274 setMaskFilter: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500275 setPathEffect: function() {},
276 setShader: function() {},
277 setStrokeCap: function() {},
278 setStrokeJoin: function() {},
279 setStrokeMiter: function() {},
280 setStrokeWidth: function() {},
281 setStyle: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500282
283 //private API
284 delete: function() {},
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500285 },
286
Kevin Lubick006a6f32018-10-19 14:34:34 -0400287 SkPath: {
288 // public API (from C++ bindings)
Kevin Lubickb9db3902018-11-26 11:47:54 -0500289 computeTightBounds: function() {},
Kevin Lubick1646e7d2018-12-07 13:03:08 -0500290 contains: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500291 /** @return {CanvasKit.SkPath} */
292 copy: function() {},
293 countPoints: function() {},
294 equals: function() {},
295 getBounds: function() {},
296 getFillType: function() {},
297 getPoint: function() {},
Kevin Lubick1646e7d2018-12-07 13:03:08 -0500298 isEmpty: function() {},
Kevin Lubick2b79d1c2018-12-14 16:10:38 -0500299 isVolatile: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500300 reset: function() {},
301 rewind: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500302 setFillType: function() {},
Kevin Lubick2b79d1c2018-12-14 16:10:38 -0500303 setIsVolatile: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500304 toSVGString: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400305
306 // private API
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500307 _addArc: function() {},
Kevin Lubicke384df42019-08-26 15:48:09 -0400308 _addOval: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400309 _addPath: function() {},
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500310 _addRect: function() {},
Kevin Lubick37ab53e2019-11-11 10:06:08 -0500311 _addPoly: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500312 _addRoundRect: function() {},
Alexander Khovansky3e119332018-11-15 02:01:19 +0300313 _arc: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400314 _arcTo: function() {},
315 _close: function() {},
316 _conicTo: function() {},
317 _cubicTo: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400318 _dash: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400319 _lineTo: function() {},
320 _moveTo: function() {},
321 _op: function() {},
322 _quadTo: function() {},
Kevin Lubick79b71342019-11-01 14:36:52 -0400323 _rArcTo: function() {},
324 _rConicTo: function() {},
325 _rCubicTo: function() {},
326 _rLineTo: function() {},
327 _rMoveTo: function() {},
328 _rQuadTo: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400329 _rect: function() {},
330 _simplify: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400331 _stroke: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400332 _transform: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400333 _trim: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400334 delete: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500335 dump: function() {},
336 dumpHex: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400337 },
338
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400339 SkPathMeasure: {
340 getLength: function() {},
Kevin Lubick37ab53e2019-11-11 10:06:08 -0500341 getSegment: function() {},
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400342 getPosTan: function() {},
343 isClosed: function() {},
344 nextContour: function() {},
345 },
346
Kevin Lubickcc13fd32019-04-05 13:00:01 -0400347 SkPicture: {
348 DEBUGONLY_serialize: function() {},
349 },
350
351 SkPictureRecorder: {
352 beginRecording: function() {},
353 finishRecordingAsPicture: function() {},
354 },
355
Kevin Lubick006a6f32018-10-19 14:34:34 -0400356 SkRect: {
357 fLeft: {},
358 fTop: {},
359 fRight: {},
360 fBottom: {},
361 },
362
Kevin Lubick2e5fe352019-09-03 12:59:06 -0400363 SkRRect: {
364 rect: {},
Kevin Lubick7d644e12019-09-11 14:22:22 -0400365 rx1: {},
366 ry1: {},
367 rx2: {},
368 ry2: {},
369 rx3: {},
370 ry3: {},
371 rx4: {},
372 ry4: {},
Kevin Lubick2e5fe352019-09-03 12:59:06 -0400373 },
374
Kevin Lubick006a6f32018-10-19 14:34:34 -0400375 SkSurface: {
376 // public API (from C++ bindings)
377 /** @return {CanvasKit.SkCanvas} */
378 getCanvas: function() {},
379 /** @return {CanvasKit.SkImage} */
380 makeImageSnapshot: function() {},
Kevin Lubick543f3522019-03-08 10:04:28 -0500381 makeSurface: function() {},
Kevin Lubickcd544662019-03-22 15:41:36 -0400382 grContext: {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400383
384 // private API
385 _flush: function() {},
386 _getRasterN32PremulSurface: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400387 delete: function() {},
388 },
389
Kevin Lubickec4903d2019-01-14 08:36:08 -0500390 SkTextBlob: {
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400391 // public API (both C++ and JS bindings)
392 MakeFromRSXform: function() {},
Kevin Lubickec4903d2019-01-14 08:36:08 -0500393 MakeFromText: function() {},
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400394 MakeOnPath: function() {},
395 // private API (from C++ bindings)
396 _MakeFromRSXform: function() {},
Kevin Lubickec4903d2019-01-14 08:36:08 -0500397 _MakeFromText: function() {},
398 },
399
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400400 SkVertices: {
401 // public API (from C++ bindings)
Kevin Lubick12c0e502018-11-28 12:51:56 -0500402 bounds: function() {},
403 mode: function() {},
404 uniqueID: function() {},
405 vertexCount: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400406
407 // private API
408 /** @return {CanvasKit.SkVertices} */
409 _applyBones: function() {},
410 },
411
Kevin Lubickd6ba7252019-06-03 14:38:05 -0400412 _SkVerticesBuilder: {
413 // public API (from C++ bindings)
414 boneIndices: function() {},
415 boneWeights: function() {},
416 colors: function() {},
417 detach: function() {},
418 indices: function() {},
419 positions: function() {},
420 texCoords: function() {},
421 },
422
Kevin Lubick369f6a52019-10-03 11:22:08 -0400423 TextStyle: function() {},
424
Kevin Lubick006a6f32018-10-19 14:34:34 -0400425 // Constants and Enums
426 gpu: {},
427 skottie: {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400428
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500429 TRANSPARENT: {},
430 RED: {},
431 BLUE: {},
432 YELLOW: {},
433 CYAN: {},
434 BLACK: {},
Kevin Lubickea905ec2018-11-30 14:05:58 -0500435 WHITE: {},
436
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500437 MOVE_VERB: {},
438 LINE_VERB: {},
439 QUAD_VERB: {},
440 CONIC_VERB: {},
441 CUBIC_VERB: {},
442 CLOSE_VERB: {},
443
Kevin Lubick369f6a52019-10-03 11:22:08 -0400444 NoDecoration: {},
445 UnderlineDecoration: {},
446 OverlineDecoration: {},
447 LineThroughDecoration: {},
448
Kevin Lubick77d9b5c2019-10-29 10:48:26 -0400449 SaveLayerInitWithPrevious: {},
450 SaveLayerF16ColorType: {},
451
Kevin Lubick369f6a52019-10-03 11:22:08 -0400452 Affinity: {
453 Upstream: {},
454 Downstream: {},
455 },
456
Kevin Lubickea905ec2018-11-30 14:05:58 -0500457 AlphaType: {
458 Opaque: {},
459 Premul: {},
460 Unpremul: {},
461 },
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500462
463 BlendMode: {
464 Clear: {},
465 Src: {},
466 Dst: {},
467 SrcOver: {},
468 DstOver: {},
469 SrcIn: {},
470 DstIn: {},
471 SrcOut: {},
472 DstOut: {},
473 SrcATop: {},
474 DstATop: {},
475 Xor: {},
476 Plus: {},
477 Modulate: {},
478 Screen: {},
479 Overlay: {},
480 Darken: {},
481 Lighten: {},
482 ColorDodge: {},
483 ColorBurn: {},
484 HardLight: {},
485 SoftLight: {},
486 Difference: {},
487 Exclusion: {},
488 Multiply: {},
489 Hue: {},
490 Saturation: {},
491 Color: {},
492 Luminosity: {},
493 },
494
495 BlurStyle: {
496 Normal: {},
497 Solid: {},
498 Outer: {},
499 Inner: {},
500 },
501
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500502 ClipOp: {
503 Difference: {},
504 Intersect: {},
505 },
506
Kevin Lubickea905ec2018-11-30 14:05:58 -0500507 ColorType: {
508 Alpha_8: {},
509 RGB_565: {},
510 ARGB_4444: {},
511 RGBA_8888: {},
512 RGB_888x: {},
513 BGRA_8888: {},
514 RGBA_1010102: {},
515 RGB_101010x: {},
516 Gray_8: {},
517 RGBA_F16: {},
518 RGBA_F32: {},
519 },
520
Kevin Lubick006a6f32018-10-19 14:34:34 -0400521 FillType: {
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500522 Winding: {},
523 EvenOdd: {},
524 InverseWinding: {},
525 InverseEvenOdd: {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400526 },
527
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500528 FilterQuality: {
529 None: {},
530 Low: {},
531 Medium: {},
532 High: {},
533 },
534
Kevin Lubickd3b1fe62019-10-21 10:50:26 -0400535 FontSlant: {
536 Upright: {},
537 Italic: {},
538 Oblique: {},
539 },
540
541 FontWeight: {
542 Invisible: {},
543 Thin: {},
544 ExtraLight: {},
545 Light: {},
546 Normal: {},
547 Medium: {},
548 SemiBold: {},
549 Bold: {},
550 ExtraBold: {},
551 Black: {},
552 ExtraBlack: {},
553 },
554
555 FontWidth: {
556 UltraCondensed: {},
557 ExtraCondensed: {},
558 Condensed: {},
559 SemiCondensed: {},
560 Normal: {},
561 SemiExpanded: {},
562 Expanded: {},
563 ExtraExpanded: {},
564 UltraExpanded: {},
565 },
566
Alexander Khovansky3e119332018-11-15 02:01:19 +0300567 ImageFormat: {
568 PNG: {},
569 JPEG: {},
570 },
571
Kevin Lubickb9db3902018-11-26 11:47:54 -0500572 PaintStyle: {
573 Fill: {},
574 Stroke: {},
575 StrokeAndFill: {},
576 },
577
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500578 PathOp: {
579 Difference: {},
580 Intersect: {},
581 Union: {},
582 XOR: {},
583 ReverseDifference: {},
584 },
585
Kevin Lubick37ab53e2019-11-11 10:06:08 -0500586 PointMode: {
587 Points: {},
588 Lines: {},
589 Polygon: {},
590 },
591
Kevin Lubick369f6a52019-10-03 11:22:08 -0400592 RectHeightStyle: {
593 Tight: {},
594 Max: {},
595 },
596
597 RectWidthStyle: {
598 Tight: {},
599 Max: {},
600 },
601
Kevin Lubickb9db3902018-11-26 11:47:54 -0500602 StrokeCap: {
603 Butt: {},
604 Round: {},
605 Square: {},
606 },
607
608 StrokeJoin: {
609 Miter: {},
610 Round: {},
611 Bevel: {},
612 },
613
Kevin Lubick369f6a52019-10-03 11:22:08 -0400614 TextAlign: {
615 Left: {},
616 Right: {},
617 Center: {},
618 Justify: {},
619 Start: {},
620 End: {},
621 },
622
Kevin Lubickd3b1fe62019-10-21 10:50:26 -0400623 TextDirection: {
624 LTR: {},
625 RTL: {},
626 },
627
Kevin Lubickec4903d2019-01-14 08:36:08 -0500628 TextEncoding: {
629 UTF8: {},
630 UTF16: {},
631 UTF32: {},
632 GlyphID: {},
633 },
634
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500635 TileMode: {
636 Clamp: {},
637 Repeat: {},
638 Mirror: {},
Kevin Lubickd29edd72018-12-07 08:29:52 -0500639 Decal: {},
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500640 },
641
642 VertexMode: {
643 Triangles: {},
644 TrianglesStrip: {},
645 TriangleFan: {},
646 },
647
Kevin Lubick006a6f32018-10-19 14:34:34 -0400648 // Things Enscriptem adds for us
649
Kevin Lubick53965c92018-10-11 08:51:55 -0400650 /**
651 * @type {Float32Array}
652 */
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400653 HEAPF32: {},
Kevin Lubick53965c92018-10-11 08:51:55 -0400654 /**
Kevin Lubickfa5a1382019-10-09 10:46:14 -0400655 * @type {Float64Array}
656 */
657 HEAPF64: {},
658 /**
Kevin Lubick53965c92018-10-11 08:51:55 -0400659 * @type {Uint8Array}
660 */
661 HEAPU8: {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400662 /**
663 * @type {Uint16Array}
664 */
665 HEAPU16: {},
666 /**
Kevin Lubickf5ea37f2019-02-28 10:06:18 -0500667 * @type {Uint32Array}
668 */
669 HEAPU32: {},
Kevin Lubickfa5a1382019-10-09 10:46:14 -0400670 /**
671 * @type {Int8Array}
672 */
673 HEAP8: {},
674 /**
675 * @type {Int16Array}
676 */
677 HEAP16: {},
678 /**
679 * @type {Int32Array}
680 */
681 HEAP32: {},
682
Kevin Lubick006a6f32018-10-19 14:34:34 -0400683 _malloc: function() {},
684 _free: function() {},
685 onRuntimeInitialized: function() {},
686};
Kevin Lubick217056c2018-09-20 17:39:31 -0400687
Kevin Lubick006a6f32018-10-19 14:34:34 -0400688// Public API things that are newly declared in the JS should go here.
689// It's not enough to declare them above, because closure can still erase them
690// unless they go on the prototype.
Kevin Lubick369f6a52019-10-03 11:22:08 -0400691CanvasKit.Paragraph.prototype.getRectsForRange = function() {};
692
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500693CanvasKit.SkPath.prototype.addArc = function() {};
Kevin Lubicke384df42019-08-26 15:48:09 -0400694CanvasKit.SkPath.prototype.addOval = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400695CanvasKit.SkPath.prototype.addPath = function() {};
Kevin Lubick37ab53e2019-11-11 10:06:08 -0500696CanvasKit.SkPath.prototype.addPoly = function() {};
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500697CanvasKit.SkPath.prototype.addRect = function() {};
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500698CanvasKit.SkPath.prototype.addRoundRect = function() {};
Alexander Khovansky3e119332018-11-15 02:01:19 +0300699CanvasKit.SkPath.prototype.arc = function() {};
Kevin Lubick006a6f32018-10-19 14:34:34 -0400700CanvasKit.SkPath.prototype.arcTo = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400701CanvasKit.SkPath.prototype.close = function() {};
Kevin Lubick006a6f32018-10-19 14:34:34 -0400702CanvasKit.SkPath.prototype.conicTo = function() {};
703CanvasKit.SkPath.prototype.cubicTo = function() {};
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400704CanvasKit.SkPath.prototype.dash = function() {};
Kevin Lubick006a6f32018-10-19 14:34:34 -0400705CanvasKit.SkPath.prototype.lineTo = function() {};
706CanvasKit.SkPath.prototype.moveTo = function() {};
Kevin Lubicke384df42019-08-26 15:48:09 -0400707CanvasKit.SkPath.prototype.offset = function() {};
Kevin Lubick006a6f32018-10-19 14:34:34 -0400708CanvasKit.SkPath.prototype.op = function() {};
709CanvasKit.SkPath.prototype.quadTo = function() {};
Kevin Lubick79b71342019-11-01 14:36:52 -0400710CanvasKit.SkPath.prototype.rArcTo = function() {};
711CanvasKit.SkPath.prototype.rConicTo = function() {};
712CanvasKit.SkPath.prototype.rCubicTo = function() {};
713CanvasKit.SkPath.prototype.rLineTo = function() {};
714CanvasKit.SkPath.prototype.rMoveTo = function() {};
715CanvasKit.SkPath.prototype.rQuadTo = function() {};
Kevin Lubick006a6f32018-10-19 14:34:34 -0400716CanvasKit.SkPath.prototype.rect = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400717CanvasKit.SkPath.prototype.simplify = function() {};
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400718CanvasKit.SkPath.prototype.stroke = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400719CanvasKit.SkPath.prototype.transform = function() {};
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400720CanvasKit.SkPath.prototype.trim = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400721
Kevin Lubickcc13fd32019-04-05 13:00:01 -0400722CanvasKit.SkPicture.prototype.DEBUGONLY_saveAsFile = function() {};
723
Kevin Lubick5b90b842018-10-17 07:57:18 -0400724CanvasKit.SkSurface.prototype.dispose = function() {};
Kevin Lubick359a7e32019-03-19 09:34:37 -0400725CanvasKit.SkSurface.prototype.flush = function() {};
726CanvasKit.SkSurface.prototype.requestAnimationFrame = function() {};
Kevin Lubickcc13fd32019-04-05 13:00:01 -0400727CanvasKit.SkSurface.prototype.captureFrameAsSkPicture = function() {};
Kevin Lubick53965c92018-10-11 08:51:55 -0400728
Kevin Lubick12c0e502018-11-28 12:51:56 -0500729/** @return {CanvasKit.SkVertices} */
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400730CanvasKit.SkVertices.prototype.applyBones = function() {};
731
Alexander Khovansky3e119332018-11-15 02:01:19 +0300732CanvasKit.SkImage.prototype.encodeToData = function() {};
Kevin Lubicka064c282019-04-04 09:28:53 -0400733CanvasKit.SkImage.prototype.makeShader = function() {};
Alexander Khovansky3e119332018-11-15 02:01:19 +0300734
Kevin Lubickee91c072019-03-29 10:39:52 -0400735CanvasKit.SkCanvas.prototype.drawAtlas = function() {};
Kevin Lubick37ab53e2019-11-11 10:06:08 -0500736CanvasKit.SkCanvas.prototype.drawPoints = function() {};
Kevin Lubickec4903d2019-01-14 08:36:08 -0500737CanvasKit.SkCanvas.prototype.drawText = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500738/** @return {Uint8Array} */
739CanvasKit.SkCanvas.prototype.readPixels = function() {};
740CanvasKit.SkCanvas.prototype.writePixels = function() {};
741
Kevin Lubickddd0a332018-12-12 10:35:13 -0500742CanvasKit.SkFontMgr.prototype.MakeTypefaceFromData = function() {};
743
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400744CanvasKit.SkFont.prototype.getWidths = function() {};
745
746CanvasKit.RSXFormBuilder.prototype.build = function() {};
747CanvasKit.RSXFormBuilder.prototype.delete = function() {};
748CanvasKit.RSXFormBuilder.prototype.push = function() {};
Kevin Lubickee91c072019-03-29 10:39:52 -0400749CanvasKit.RSXFormBuilder.prototype.set = function() {};
750
751CanvasKit.SkColorBuilder.prototype.build = function() {};
752CanvasKit.SkColorBuilder.prototype.delete = function() {};
753CanvasKit.SkColorBuilder.prototype.push = function() {};
754CanvasKit.SkColorBuilder.prototype.set = function() {};
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400755
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400756// Define StrokeOpts object
757var StrokeOpts = {};
758StrokeOpts.prototype.width;
759StrokeOpts.prototype.miter_limit;
760StrokeOpts.prototype.cap;
761StrokeOpts.prototype.join;
Kevin Lubick1646e7d2018-12-07 13:03:08 -0500762StrokeOpts.prototype.precision;
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400763
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500764// Define everything created in the canvas2d spec here
Kevin Lubickb9db3902018-11-26 11:47:54 -0500765var HTMLCanvas = {};
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500766HTMLCanvas.prototype.decodeImage = function() {};
767HTMLCanvas.prototype.dispose = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500768HTMLCanvas.prototype.getContext = function() {};
Kevin Lubick8e4a3312018-12-14 15:03:41 -0500769HTMLCanvas.prototype.loadFont = function() {};
Kevin Lubicka40f8322018-12-17 16:01:36 -0500770HTMLCanvas.prototype.makePath2D = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500771HTMLCanvas.prototype.toDataURL = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500772
773var CanvasRenderingContext2D = {};
774CanvasRenderingContext2D.prototype.addHitRegion = function() {};
775CanvasRenderingContext2D.prototype.arc = function() {};
776CanvasRenderingContext2D.prototype.arcTo = function() {};
777CanvasRenderingContext2D.prototype.beginPath = function() {};
778CanvasRenderingContext2D.prototype.bezierCurveTo = function() {};
779CanvasRenderingContext2D.prototype.clearHitRegions = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500780CanvasRenderingContext2D.prototype.clearRect = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500781CanvasRenderingContext2D.prototype.clip = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500782CanvasRenderingContext2D.prototype.closePath = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500783CanvasRenderingContext2D.prototype.createImageData = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500784CanvasRenderingContext2D.prototype.createLinearGradient = function() {};
Kevin Lubickd29edd72018-12-07 08:29:52 -0500785CanvasRenderingContext2D.prototype.createPattern = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500786CanvasRenderingContext2D.prototype.createRadialGradient = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500787CanvasRenderingContext2D.prototype.drawFocusIfNeeded = function() {};
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500788CanvasRenderingContext2D.prototype.drawImage = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500789CanvasRenderingContext2D.prototype.ellipse = function() {};
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500790CanvasRenderingContext2D.prototype.fill = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500791CanvasRenderingContext2D.prototype.fillRect = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500792CanvasRenderingContext2D.prototype.fillText = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500793CanvasRenderingContext2D.prototype.getImageData = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500794CanvasRenderingContext2D.prototype.getLineDash = function() {};
Kevin Lubick1646e7d2018-12-07 13:03:08 -0500795CanvasRenderingContext2D.prototype.isPointInPath = function() {};
796CanvasRenderingContext2D.prototype.isPointInStroke = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500797CanvasRenderingContext2D.prototype.lineTo = function() {};
798CanvasRenderingContext2D.prototype.measureText = function() {};
799CanvasRenderingContext2D.prototype.moveTo = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500800CanvasRenderingContext2D.prototype.putImageData = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500801CanvasRenderingContext2D.prototype.quadraticCurveTo = function() {};
802CanvasRenderingContext2D.prototype.rect = function() {};
803CanvasRenderingContext2D.prototype.removeHitRegion = function() {};
804CanvasRenderingContext2D.prototype.resetTransform = function() {};
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500805CanvasRenderingContext2D.prototype.restore = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500806CanvasRenderingContext2D.prototype.rotate = function() {};
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500807CanvasRenderingContext2D.prototype.save = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500808CanvasRenderingContext2D.prototype.scale = function() {};
809CanvasRenderingContext2D.prototype.scrollPathIntoView = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500810CanvasRenderingContext2D.prototype.setLineDash = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500811CanvasRenderingContext2D.prototype.setTransform = function() {};
812CanvasRenderingContext2D.prototype.stroke = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500813CanvasRenderingContext2D.prototype.strokeRect = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500814CanvasRenderingContext2D.prototype.strokeText = function() {};
815CanvasRenderingContext2D.prototype.transform = function() {};
816CanvasRenderingContext2D.prototype.translate = function() {};
817
Kevin Lubicka40f8322018-12-17 16:01:36 -0500818var Path2D = {};
819Path2D.prototype.addPath = function() {};
820Path2D.prototype.arc = function() {};
821Path2D.prototype.arcTo = function() {};
822Path2D.prototype.bezierCurveTo = function() {};
823Path2D.prototype.closePath = function() {};
824Path2D.prototype.ellipse = function() {};
825Path2D.prototype.lineTo = function() {};
826Path2D.prototype.moveTo = function() {};
827Path2D.prototype.quadraticCurveTo = function() {};
828Path2D.prototype.rect = function() {};
829
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500830var LinearCanvasGradient = {};
831LinearCanvasGradient.prototype.addColorStop = function() {};
832var RadialCanvasGradient = {};
833RadialCanvasGradient.prototype.addColorStop = function() {};
Kevin Lubickd29edd72018-12-07 08:29:52 -0500834var CanvasPattern = {};
835CanvasPattern.prototype.setTransform = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500836
Kevin Lubick52b9f372018-12-04 13:57:36 -0500837var ImageData = {
838 /**
839 * @type {Uint8ClampedArray}
840 */
841 data: {},
842 height: {},
843 width: {},
844};
845
Kevin Lubickd29edd72018-12-07 08:29:52 -0500846var DOMMatrix = {
847 a: {},
848 b: {},
849 c: {},
850 d: {},
851 e: {},
852 f: {},
853};
854
Kevin Lubick217056c2018-09-20 17:39:31 -0400855// 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 -0500856function loadWebAssemblyModule() {};