blob: c3fc81721410aa87bcf1f13d8718b603a71fd7e6 [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() {},
112
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400113 RSXFormBuilder: function() {},
Kevin Lubickee91c072019-03-29 10:39:52 -0400114 SkColorBuilder: function() {},
115 SkRectBuilder: function() {},
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400116
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -0500117 ShapedText: {
118 // public API (from C++ bindings)
119 getBounds: function() {},
120 },
121
Kevin Lubick6b921b72019-09-18 16:18:17 -0400122 SkAnimatedImage: {
123 // public API (from C++ bindings)
124 getRepetitionCount: function() {},
125 decodeNextFrame: function() {},
126 },
127
Kevin Lubick006a6f32018-10-19 14:34:34 -0400128 SkCanvas: {
129 // public API (from C++ bindings)
130 clear: function() {},
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500131 clipPath: function() {},
Kevin Lubick6dbc4ed2019-10-22 09:43:34 -0400132 clipRRect: function() {},
Kevin Lubick5d5723c2018-12-07 10:09:11 -0500133 clipRect: function() {},
134 concat: function() {},
Kevin Lubick6dbc4ed2019-10-22 09:43:34 -0400135 drawAnimatedImage: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500136 drawArc: function() {},
Kevin Lubicke384df42019-08-26 15:48:09 -0400137 drawCircle: function() {},
Kevin Lubick6dbc4ed2019-10-22 09:43:34 -0400138 drawColor: function() {},
Kevin Lubick2e5fe352019-09-03 12:59:06 -0400139 drawDRRect: function() {},
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500140 drawImage: function() {},
141 drawImageRect: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500142 drawLine: function() {},
143 drawOval: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400144 drawPaint: function() {},
Kevin Lubick369f6a52019-10-03 11:22:08 -0400145 drawParagraph: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400146 drawPath: function() {},
Kevin Lubickcc13fd32019-04-05 13:00:01 -0400147 drawPicture: function() {},
Kevin Lubick2e5fe352019-09-03 12:59:06 -0400148 drawRRect: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -0500149 drawRect: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500150 drawRoundRect: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500151 drawShadow: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -0500152 drawText: function() {},
Kevin Lubickec4903d2019-01-14 08:36:08 -0500153 drawTextBlob: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -0500154 drawVertices: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400155 flush: function() {},
Kevin Lubick2e5fe352019-09-03 12:59:06 -0400156 getSaveCount: function() {},
Kevin Lubick5d5723c2018-12-07 10:09:11 -0500157 getTotalMatrix: function() {},
Kevin Lubick543f3522019-03-08 10:04:28 -0500158 makeSurface: function() {},
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500159 restore: function() {},
Kevin Lubickb3574c92019-03-06 08:25:36 -0500160 restoreToCount: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400161 rotate: function() {},
162 save: function() {},
Kevin Lubickb3574c92019-03-06 08:25:36 -0500163 saveLayer: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400164 scale: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400165 skew: function() {},
166 translate: function() {},
167
168 // private API
Kevin Lubickee91c072019-03-29 10:39:52 -0400169 _drawAtlas: function() {},
Kevin Lubickec4903d2019-01-14 08:36:08 -0500170 _drawSimpleText: function() {},
Kevin Lubick52b9f372018-12-04 13:57:36 -0500171 _readPixels: function() {},
172 _writePixels: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400173 delete: function() {},
174 },
175
Kevin Lubickd3729342019-09-12 11:11:25 -0400176 SkColorFilter: {
177 // public API (from C++ bindings and JS interface)
178 MakeBlend: function() {},
179 MakeCompose: function() {},
180 MakeLerp: function() {},
181 MakeLinearToSRGBGamma: function() {},
182 MakeMatrix: function() {},
183 MakeSRGBToLinearGamma: function() {},
184 // private API (from C++ bindings)
185 _makeMatrix: function() {},
186 },
187
188 SkColorMatrix: {
189 concat: function() {},
190 identity: function() {},
191 postTranslate: function() {},
192 rotated: function() {},
193 scaled: function() {},
194 },
195
Kevin Lubick35ac0382019-01-02 15:13:57 -0500196 SkFont: {
197 // public API (from C++ bindings)
198 getScaleX: function() {},
199 getSize: function() {},
200 getSkewX: function() {},
201 getTypeface: function() {},
202 measureText: function() {},
203 setScaleX: function() {},
204 setSize: function() {},
205 setSkewX: function() {},
206 setTypeface: function() {},
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400207 // private API (from C++ bindings)
208 _getWidths: function() {},
Kevin Lubick35ac0382019-01-02 15:13:57 -0500209 },
210
Kevin Lubickddd0a332018-12-12 10:35:13 -0500211 SkFontMgr: {
Kevin Lubick61887c72019-09-26 13:20:50 -0400212 // public API (from C++ and JS bindings)
213 FromData: function() {},
Kevin Lubickddd0a332018-12-12 10:35:13 -0500214 RefDefault: function() {},
215 countFamilies: function() {},
216
217 // private API
218 _makeTypefaceFromData: function() {},
Kevin Lubick61887c72019-09-26 13:20:50 -0400219 _fromData: function() {},
Kevin Lubickddd0a332018-12-12 10:35:13 -0500220 },
221
Kevin Lubick006a6f32018-10-19 14:34:34 -0400222 SkImage: {
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500223 // public API (from C++ bindings)
224 height: function() {},
225 width: function() {},
Alexander Khovansky3e119332018-11-15 02:01:19 +0300226 // private API
227 _encodeToData: function() {},
228 _encodeToDataWithFormat: function() {},
Kevin Lubicka064c282019-04-04 09:28:53 -0400229 _makeShader: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400230 },
231
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500232 SkMatrix: {
Kevin Lubickb9db3902018-11-26 11:47:54 -0500233 identity: function() {},
Kevin Lubickf3555182019-03-14 10:55:10 -0400234 invert: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500235 mapPoints: function() {},
236 multiply: function() {},
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500237 rotated: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500238 scaled: function() {},
239 skewed: function() {},
240 translated: function() {},
241 },
242
243 SkPaint: {
244 // public API (from C++ bindings)
245 /** @return {CanvasKit.SkPaint} */
246 copy: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -0500247 getBlendMode: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500248 getColor: function() {},
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500249 getFilterQuality: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500250 getStrokeCap: function() {},
251 getStrokeJoin: function() {},
252 getStrokeMiter: function() {},
253 getStrokeWidth: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500254 setAntiAlias: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -0500255 setBlendMode: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500256 setColor: function() {},
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500257 setFilterQuality: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500258 setMaskFilter: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500259 setPathEffect: function() {},
260 setShader: function() {},
261 setStrokeCap: function() {},
262 setStrokeJoin: function() {},
263 setStrokeMiter: function() {},
264 setStrokeWidth: function() {},
265 setStyle: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500266
267 //private API
268 delete: function() {},
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500269 },
270
Kevin Lubick006a6f32018-10-19 14:34:34 -0400271 SkPath: {
272 // public API (from C++ bindings)
Kevin Lubickb9db3902018-11-26 11:47:54 -0500273 computeTightBounds: function() {},
Kevin Lubick1646e7d2018-12-07 13:03:08 -0500274 contains: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500275 /** @return {CanvasKit.SkPath} */
276 copy: function() {},
277 countPoints: function() {},
278 equals: function() {},
279 getBounds: function() {},
280 getFillType: function() {},
281 getPoint: function() {},
Kevin Lubick1646e7d2018-12-07 13:03:08 -0500282 isEmpty: function() {},
Kevin Lubick2b79d1c2018-12-14 16:10:38 -0500283 isVolatile: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500284 reset: function() {},
285 rewind: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500286 setFillType: function() {},
Kevin Lubick2b79d1c2018-12-14 16:10:38 -0500287 setIsVolatile: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500288 toSVGString: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400289
290 // private API
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500291 _addArc: function() {},
Kevin Lubicke384df42019-08-26 15:48:09 -0400292 _addOval: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400293 _addPath: function() {},
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500294 _addRect: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500295 _addRoundRect: function() {},
Alexander Khovansky3e119332018-11-15 02:01:19 +0300296 _arc: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400297 _arcTo: function() {},
298 _close: function() {},
299 _conicTo: function() {},
300 _cubicTo: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400301 _dash: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400302 _lineTo: function() {},
303 _moveTo: function() {},
304 _op: function() {},
305 _quadTo: function() {},
306 _rect: function() {},
307 _simplify: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400308 _stroke: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400309 _transform: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400310 _trim: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400311 delete: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500312 dump: function() {},
313 dumpHex: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400314 },
315
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400316 SkPathMeasure: {
317 getLength: function() {},
318 getPosTan: function() {},
319 isClosed: function() {},
320 nextContour: function() {},
321 },
322
Kevin Lubickcc13fd32019-04-05 13:00:01 -0400323 SkPicture: {
324 DEBUGONLY_serialize: function() {},
325 },
326
327 SkPictureRecorder: {
328 beginRecording: function() {},
329 finishRecordingAsPicture: function() {},
330 },
331
Kevin Lubick006a6f32018-10-19 14:34:34 -0400332 SkRect: {
333 fLeft: {},
334 fTop: {},
335 fRight: {},
336 fBottom: {},
337 },
338
Kevin Lubick2e5fe352019-09-03 12:59:06 -0400339 SkRRect: {
340 rect: {},
Kevin Lubick7d644e12019-09-11 14:22:22 -0400341 rx1: {},
342 ry1: {},
343 rx2: {},
344 ry2: {},
345 rx3: {},
346 ry3: {},
347 rx4: {},
348 ry4: {},
Kevin Lubick2e5fe352019-09-03 12:59:06 -0400349 },
350
Kevin Lubick006a6f32018-10-19 14:34:34 -0400351 SkSurface: {
352 // public API (from C++ bindings)
353 /** @return {CanvasKit.SkCanvas} */
354 getCanvas: function() {},
355 /** @return {CanvasKit.SkImage} */
356 makeImageSnapshot: function() {},
Kevin Lubick543f3522019-03-08 10:04:28 -0500357 makeSurface: function() {},
Kevin Lubickcd544662019-03-22 15:41:36 -0400358 grContext: {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400359
360 // private API
361 _flush: function() {},
362 _getRasterN32PremulSurface: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400363 delete: function() {},
364 },
365
Kevin Lubickec4903d2019-01-14 08:36:08 -0500366 SkTextBlob: {
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400367 // public API (both C++ and JS bindings)
368 MakeFromRSXform: function() {},
Kevin Lubickec4903d2019-01-14 08:36:08 -0500369 MakeFromText: function() {},
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400370 MakeOnPath: function() {},
371 // private API (from C++ bindings)
372 _MakeFromRSXform: function() {},
Kevin Lubickec4903d2019-01-14 08:36:08 -0500373 _MakeFromText: function() {},
374 },
375
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400376 SkVertices: {
377 // public API (from C++ bindings)
Kevin Lubick12c0e502018-11-28 12:51:56 -0500378 bounds: function() {},
379 mode: function() {},
380 uniqueID: function() {},
381 vertexCount: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400382
383 // private API
384 /** @return {CanvasKit.SkVertices} */
385 _applyBones: function() {},
386 },
387
Kevin Lubickd6ba7252019-06-03 14:38:05 -0400388 _SkVerticesBuilder: {
389 // public API (from C++ bindings)
390 boneIndices: function() {},
391 boneWeights: function() {},
392 colors: function() {},
393 detach: function() {},
394 indices: function() {},
395 positions: function() {},
396 texCoords: function() {},
397 },
398
Kevin Lubick369f6a52019-10-03 11:22:08 -0400399 TextStyle: function() {},
400
Kevin Lubick006a6f32018-10-19 14:34:34 -0400401 // Constants and Enums
402 gpu: {},
403 skottie: {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400404
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500405 TRANSPARENT: {},
406 RED: {},
407 BLUE: {},
408 YELLOW: {},
409 CYAN: {},
410 BLACK: {},
Kevin Lubickea905ec2018-11-30 14:05:58 -0500411 WHITE: {},
412
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500413 MOVE_VERB: {},
414 LINE_VERB: {},
415 QUAD_VERB: {},
416 CONIC_VERB: {},
417 CUBIC_VERB: {},
418 CLOSE_VERB: {},
419
Kevin Lubick369f6a52019-10-03 11:22:08 -0400420 NoDecoration: {},
421 UnderlineDecoration: {},
422 OverlineDecoration: {},
423 LineThroughDecoration: {},
424
425 Affinity: {
426 Upstream: {},
427 Downstream: {},
428 },
429
Kevin Lubickea905ec2018-11-30 14:05:58 -0500430 AlphaType: {
431 Opaque: {},
432 Premul: {},
433 Unpremul: {},
434 },
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500435
436 BlendMode: {
437 Clear: {},
438 Src: {},
439 Dst: {},
440 SrcOver: {},
441 DstOver: {},
442 SrcIn: {},
443 DstIn: {},
444 SrcOut: {},
445 DstOut: {},
446 SrcATop: {},
447 DstATop: {},
448 Xor: {},
449 Plus: {},
450 Modulate: {},
451 Screen: {},
452 Overlay: {},
453 Darken: {},
454 Lighten: {},
455 ColorDodge: {},
456 ColorBurn: {},
457 HardLight: {},
458 SoftLight: {},
459 Difference: {},
460 Exclusion: {},
461 Multiply: {},
462 Hue: {},
463 Saturation: {},
464 Color: {},
465 Luminosity: {},
466 },
467
468 BlurStyle: {
469 Normal: {},
470 Solid: {},
471 Outer: {},
472 Inner: {},
473 },
474
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500475 ClipOp: {
476 Difference: {},
477 Intersect: {},
478 },
479
Kevin Lubickea905ec2018-11-30 14:05:58 -0500480 ColorType: {
481 Alpha_8: {},
482 RGB_565: {},
483 ARGB_4444: {},
484 RGBA_8888: {},
485 RGB_888x: {},
486 BGRA_8888: {},
487 RGBA_1010102: {},
488 RGB_101010x: {},
489 Gray_8: {},
490 RGBA_F16: {},
491 RGBA_F32: {},
492 },
493
Kevin Lubick006a6f32018-10-19 14:34:34 -0400494 FillType: {
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500495 Winding: {},
496 EvenOdd: {},
497 InverseWinding: {},
498 InverseEvenOdd: {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400499 },
500
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500501 FilterQuality: {
502 None: {},
503 Low: {},
504 Medium: {},
505 High: {},
506 },
507
Kevin Lubickd3b1fe62019-10-21 10:50:26 -0400508 FontSlant: {
509 Upright: {},
510 Italic: {},
511 Oblique: {},
512 },
513
514 FontWeight: {
515 Invisible: {},
516 Thin: {},
517 ExtraLight: {},
518 Light: {},
519 Normal: {},
520 Medium: {},
521 SemiBold: {},
522 Bold: {},
523 ExtraBold: {},
524 Black: {},
525 ExtraBlack: {},
526 },
527
528 FontWidth: {
529 UltraCondensed: {},
530 ExtraCondensed: {},
531 Condensed: {},
532 SemiCondensed: {},
533 Normal: {},
534 SemiExpanded: {},
535 Expanded: {},
536 ExtraExpanded: {},
537 UltraExpanded: {},
538 },
539
Alexander Khovansky3e119332018-11-15 02:01:19 +0300540 ImageFormat: {
541 PNG: {},
542 JPEG: {},
543 },
544
Kevin Lubickb9db3902018-11-26 11:47:54 -0500545 PaintStyle: {
546 Fill: {},
547 Stroke: {},
548 StrokeAndFill: {},
549 },
550
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500551 PathOp: {
552 Difference: {},
553 Intersect: {},
554 Union: {},
555 XOR: {},
556 ReverseDifference: {},
557 },
558
Kevin Lubick369f6a52019-10-03 11:22:08 -0400559 RectHeightStyle: {
560 Tight: {},
561 Max: {},
562 },
563
564 RectWidthStyle: {
565 Tight: {},
566 Max: {},
567 },
568
Kevin Lubickb9db3902018-11-26 11:47:54 -0500569 StrokeCap: {
570 Butt: {},
571 Round: {},
572 Square: {},
573 },
574
575 StrokeJoin: {
576 Miter: {},
577 Round: {},
578 Bevel: {},
579 },
580
Kevin Lubick369f6a52019-10-03 11:22:08 -0400581 TextAlign: {
582 Left: {},
583 Right: {},
584 Center: {},
585 Justify: {},
586 Start: {},
587 End: {},
588 },
589
Kevin Lubickd3b1fe62019-10-21 10:50:26 -0400590 TextDirection: {
591 LTR: {},
592 RTL: {},
593 },
594
Kevin Lubickec4903d2019-01-14 08:36:08 -0500595 TextEncoding: {
596 UTF8: {},
597 UTF16: {},
598 UTF32: {},
599 GlyphID: {},
600 },
601
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500602 TileMode: {
603 Clamp: {},
604 Repeat: {},
605 Mirror: {},
Kevin Lubickd29edd72018-12-07 08:29:52 -0500606 Decal: {},
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500607 },
608
609 VertexMode: {
610 Triangles: {},
611 TrianglesStrip: {},
612 TriangleFan: {},
613 },
614
Kevin Lubick006a6f32018-10-19 14:34:34 -0400615 // Things Enscriptem adds for us
616
Kevin Lubick53965c92018-10-11 08:51:55 -0400617 /**
618 * @type {Float32Array}
619 */
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400620 HEAPF32: {},
Kevin Lubick53965c92018-10-11 08:51:55 -0400621 /**
Kevin Lubickfa5a1382019-10-09 10:46:14 -0400622 * @type {Float64Array}
623 */
624 HEAPF64: {},
625 /**
Kevin Lubick53965c92018-10-11 08:51:55 -0400626 * @type {Uint8Array}
627 */
628 HEAPU8: {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400629 /**
630 * @type {Uint16Array}
631 */
632 HEAPU16: {},
633 /**
Kevin Lubickf5ea37f2019-02-28 10:06:18 -0500634 * @type {Uint32Array}
635 */
636 HEAPU32: {},
Kevin Lubickfa5a1382019-10-09 10:46:14 -0400637 /**
638 * @type {Int8Array}
639 */
640 HEAP8: {},
641 /**
642 * @type {Int16Array}
643 */
644 HEAP16: {},
645 /**
646 * @type {Int32Array}
647 */
648 HEAP32: {},
649
Kevin Lubick006a6f32018-10-19 14:34:34 -0400650 _malloc: function() {},
651 _free: function() {},
652 onRuntimeInitialized: function() {},
653};
Kevin Lubick217056c2018-09-20 17:39:31 -0400654
Kevin Lubick006a6f32018-10-19 14:34:34 -0400655// Public API things that are newly declared in the JS should go here.
656// It's not enough to declare them above, because closure can still erase them
657// unless they go on the prototype.
Kevin Lubick369f6a52019-10-03 11:22:08 -0400658CanvasKit.Paragraph.prototype.getRectsForRange = function() {};
659
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500660CanvasKit.SkPath.prototype.addArc = function() {};
Kevin Lubicke384df42019-08-26 15:48:09 -0400661CanvasKit.SkPath.prototype.addOval = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400662CanvasKit.SkPath.prototype.addPath = function() {};
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500663CanvasKit.SkPath.prototype.addRect = function() {};
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500664CanvasKit.SkPath.prototype.addRoundRect = function() {};
Alexander Khovansky3e119332018-11-15 02:01:19 +0300665CanvasKit.SkPath.prototype.arc = function() {};
Kevin Lubick006a6f32018-10-19 14:34:34 -0400666CanvasKit.SkPath.prototype.arcTo = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400667CanvasKit.SkPath.prototype.close = function() {};
Kevin Lubick006a6f32018-10-19 14:34:34 -0400668CanvasKit.SkPath.prototype.conicTo = function() {};
669CanvasKit.SkPath.prototype.cubicTo = function() {};
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400670CanvasKit.SkPath.prototype.dash = function() {};
Kevin Lubick006a6f32018-10-19 14:34:34 -0400671CanvasKit.SkPath.prototype.lineTo = function() {};
672CanvasKit.SkPath.prototype.moveTo = function() {};
Kevin Lubicke384df42019-08-26 15:48:09 -0400673CanvasKit.SkPath.prototype.offset = function() {};
Kevin Lubick006a6f32018-10-19 14:34:34 -0400674CanvasKit.SkPath.prototype.op = function() {};
675CanvasKit.SkPath.prototype.quadTo = function() {};
676CanvasKit.SkPath.prototype.rect = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400677CanvasKit.SkPath.prototype.simplify = function() {};
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400678CanvasKit.SkPath.prototype.stroke = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400679CanvasKit.SkPath.prototype.transform = function() {};
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400680CanvasKit.SkPath.prototype.trim = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400681
Kevin Lubickcc13fd32019-04-05 13:00:01 -0400682CanvasKit.SkPicture.prototype.DEBUGONLY_saveAsFile = function() {};
683
Kevin Lubick5b90b842018-10-17 07:57:18 -0400684CanvasKit.SkSurface.prototype.dispose = function() {};
Kevin Lubick359a7e32019-03-19 09:34:37 -0400685CanvasKit.SkSurface.prototype.flush = function() {};
686CanvasKit.SkSurface.prototype.requestAnimationFrame = function() {};
Kevin Lubickcc13fd32019-04-05 13:00:01 -0400687CanvasKit.SkSurface.prototype.captureFrameAsSkPicture = function() {};
Kevin Lubick53965c92018-10-11 08:51:55 -0400688
Kevin Lubick12c0e502018-11-28 12:51:56 -0500689/** @return {CanvasKit.SkVertices} */
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400690CanvasKit.SkVertices.prototype.applyBones = function() {};
691
Alexander Khovansky3e119332018-11-15 02:01:19 +0300692CanvasKit.SkImage.prototype.encodeToData = function() {};
Kevin Lubicka064c282019-04-04 09:28:53 -0400693CanvasKit.SkImage.prototype.makeShader = function() {};
Alexander Khovansky3e119332018-11-15 02:01:19 +0300694
Kevin Lubickee91c072019-03-29 10:39:52 -0400695CanvasKit.SkCanvas.prototype.drawAtlas = function() {};
Kevin Lubickec4903d2019-01-14 08:36:08 -0500696CanvasKit.SkCanvas.prototype.drawText = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500697/** @return {Uint8Array} */
698CanvasKit.SkCanvas.prototype.readPixels = function() {};
699CanvasKit.SkCanvas.prototype.writePixels = function() {};
700
Kevin Lubickddd0a332018-12-12 10:35:13 -0500701CanvasKit.SkFontMgr.prototype.MakeTypefaceFromData = function() {};
702
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400703CanvasKit.SkFont.prototype.getWidths = function() {};
704
705CanvasKit.RSXFormBuilder.prototype.build = function() {};
706CanvasKit.RSXFormBuilder.prototype.delete = function() {};
707CanvasKit.RSXFormBuilder.prototype.push = function() {};
Kevin Lubickee91c072019-03-29 10:39:52 -0400708CanvasKit.RSXFormBuilder.prototype.set = function() {};
709
710CanvasKit.SkColorBuilder.prototype.build = function() {};
711CanvasKit.SkColorBuilder.prototype.delete = function() {};
712CanvasKit.SkColorBuilder.prototype.push = function() {};
713CanvasKit.SkColorBuilder.prototype.set = function() {};
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400714
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400715// Define StrokeOpts object
716var StrokeOpts = {};
717StrokeOpts.prototype.width;
718StrokeOpts.prototype.miter_limit;
719StrokeOpts.prototype.cap;
720StrokeOpts.prototype.join;
Kevin Lubick1646e7d2018-12-07 13:03:08 -0500721StrokeOpts.prototype.precision;
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400722
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500723// Define everything created in the canvas2d spec here
Kevin Lubickb9db3902018-11-26 11:47:54 -0500724var HTMLCanvas = {};
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500725HTMLCanvas.prototype.decodeImage = function() {};
726HTMLCanvas.prototype.dispose = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500727HTMLCanvas.prototype.getContext = function() {};
Kevin Lubick8e4a3312018-12-14 15:03:41 -0500728HTMLCanvas.prototype.loadFont = function() {};
Kevin Lubicka40f8322018-12-17 16:01:36 -0500729HTMLCanvas.prototype.makePath2D = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500730HTMLCanvas.prototype.toDataURL = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500731
732var CanvasRenderingContext2D = {};
733CanvasRenderingContext2D.prototype.addHitRegion = function() {};
734CanvasRenderingContext2D.prototype.arc = function() {};
735CanvasRenderingContext2D.prototype.arcTo = function() {};
736CanvasRenderingContext2D.prototype.beginPath = function() {};
737CanvasRenderingContext2D.prototype.bezierCurveTo = function() {};
738CanvasRenderingContext2D.prototype.clearHitRegions = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500739CanvasRenderingContext2D.prototype.clearRect = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500740CanvasRenderingContext2D.prototype.clip = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500741CanvasRenderingContext2D.prototype.closePath = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500742CanvasRenderingContext2D.prototype.createImageData = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500743CanvasRenderingContext2D.prototype.createLinearGradient = function() {};
Kevin Lubickd29edd72018-12-07 08:29:52 -0500744CanvasRenderingContext2D.prototype.createPattern = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500745CanvasRenderingContext2D.prototype.createRadialGradient = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500746CanvasRenderingContext2D.prototype.drawFocusIfNeeded = function() {};
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500747CanvasRenderingContext2D.prototype.drawImage = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500748CanvasRenderingContext2D.prototype.ellipse = function() {};
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500749CanvasRenderingContext2D.prototype.fill = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500750CanvasRenderingContext2D.prototype.fillRect = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500751CanvasRenderingContext2D.prototype.fillText = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500752CanvasRenderingContext2D.prototype.getImageData = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500753CanvasRenderingContext2D.prototype.getLineDash = function() {};
Kevin Lubick1646e7d2018-12-07 13:03:08 -0500754CanvasRenderingContext2D.prototype.isPointInPath = function() {};
755CanvasRenderingContext2D.prototype.isPointInStroke = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500756CanvasRenderingContext2D.prototype.lineTo = function() {};
757CanvasRenderingContext2D.prototype.measureText = function() {};
758CanvasRenderingContext2D.prototype.moveTo = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500759CanvasRenderingContext2D.prototype.putImageData = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500760CanvasRenderingContext2D.prototype.quadraticCurveTo = function() {};
761CanvasRenderingContext2D.prototype.rect = function() {};
762CanvasRenderingContext2D.prototype.removeHitRegion = function() {};
763CanvasRenderingContext2D.prototype.resetTransform = function() {};
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500764CanvasRenderingContext2D.prototype.restore = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500765CanvasRenderingContext2D.prototype.rotate = function() {};
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500766CanvasRenderingContext2D.prototype.save = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500767CanvasRenderingContext2D.prototype.scale = function() {};
768CanvasRenderingContext2D.prototype.scrollPathIntoView = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500769CanvasRenderingContext2D.prototype.setLineDash = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500770CanvasRenderingContext2D.prototype.setTransform = function() {};
771CanvasRenderingContext2D.prototype.stroke = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500772CanvasRenderingContext2D.prototype.strokeRect = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500773CanvasRenderingContext2D.prototype.strokeText = function() {};
774CanvasRenderingContext2D.prototype.transform = function() {};
775CanvasRenderingContext2D.prototype.translate = function() {};
776
Kevin Lubicka40f8322018-12-17 16:01:36 -0500777var Path2D = {};
778Path2D.prototype.addPath = function() {};
779Path2D.prototype.arc = function() {};
780Path2D.prototype.arcTo = function() {};
781Path2D.prototype.bezierCurveTo = function() {};
782Path2D.prototype.closePath = function() {};
783Path2D.prototype.ellipse = function() {};
784Path2D.prototype.lineTo = function() {};
785Path2D.prototype.moveTo = function() {};
786Path2D.prototype.quadraticCurveTo = function() {};
787Path2D.prototype.rect = function() {};
788
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500789var LinearCanvasGradient = {};
790LinearCanvasGradient.prototype.addColorStop = function() {};
791var RadialCanvasGradient = {};
792RadialCanvasGradient.prototype.addColorStop = function() {};
Kevin Lubickd29edd72018-12-07 08:29:52 -0500793var CanvasPattern = {};
794CanvasPattern.prototype.setTransform = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500795
Kevin Lubick52b9f372018-12-04 13:57:36 -0500796var ImageData = {
797 /**
798 * @type {Uint8ClampedArray}
799 */
800 data: {},
801 height: {},
802 width: {},
803};
804
Kevin Lubickd29edd72018-12-07 08:29:52 -0500805var DOMMatrix = {
806 a: {},
807 b: {},
808 c: {},
809 d: {},
810 e: {},
811 f: {},
812};
813
Kevin Lubick217056c2018-09-20 17:39:31 -0400814// 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 -0500815function loadWebAssemblyModule() {};