blob: 59b01effd56354392ec522699d5fd328e378a19e [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() {},
Kevin Lubickd2677192019-11-15 14:13:20 -0500241 MakeMatrixTransform: function() {},
Kevin Lubick15b40232019-10-29 09:55:39 -0400242 },
243
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500244 SkMatrix: {
Kevin Lubickb9db3902018-11-26 11:47:54 -0500245 identity: function() {},
Kevin Lubickf3555182019-03-14 10:55:10 -0400246 invert: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500247 mapPoints: function() {},
248 multiply: function() {},
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500249 rotated: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500250 scaled: function() {},
251 skewed: function() {},
252 translated: function() {},
253 },
254
Kevin Lubick15b40232019-10-29 09:55:39 -0400255 SkMaskFilter: {
256 MakeBlur: function() {},
257 },
258
Kevin Lubickb9db3902018-11-26 11:47:54 -0500259 SkPaint: {
260 // public API (from C++ bindings)
261 /** @return {CanvasKit.SkPaint} */
262 copy: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -0500263 getBlendMode: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500264 getColor: function() {},
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500265 getFilterQuality: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500266 getStrokeCap: function() {},
267 getStrokeJoin: function() {},
268 getStrokeMiter: function() {},
269 getStrokeWidth: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500270 setAntiAlias: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -0500271 setBlendMode: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500272 setColor: function() {},
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500273 setFilterQuality: function() {},
Kevin Lubick15b40232019-10-29 09:55:39 -0400274 setImageFilter: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500275 setMaskFilter: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500276 setPathEffect: function() {},
277 setShader: function() {},
278 setStrokeCap: function() {},
279 setStrokeJoin: function() {},
280 setStrokeMiter: function() {},
281 setStrokeWidth: function() {},
282 setStyle: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500283
284 //private API
285 delete: function() {},
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500286 },
287
Kevin Lubick006a6f32018-10-19 14:34:34 -0400288 SkPath: {
289 // public API (from C++ bindings)
Kevin Lubickb9db3902018-11-26 11:47:54 -0500290 computeTightBounds: function() {},
Kevin Lubick1646e7d2018-12-07 13:03:08 -0500291 contains: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500292 /** @return {CanvasKit.SkPath} */
293 copy: function() {},
294 countPoints: function() {},
295 equals: function() {},
296 getBounds: function() {},
297 getFillType: function() {},
298 getPoint: function() {},
Kevin Lubick1646e7d2018-12-07 13:03:08 -0500299 isEmpty: function() {},
Kevin Lubick2b79d1c2018-12-14 16:10:38 -0500300 isVolatile: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500301 reset: function() {},
302 rewind: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500303 setFillType: function() {},
Kevin Lubick2b79d1c2018-12-14 16:10:38 -0500304 setIsVolatile: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500305 toSVGString: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400306
307 // private API
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500308 _addArc: function() {},
Kevin Lubicke384df42019-08-26 15:48:09 -0400309 _addOval: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400310 _addPath: function() {},
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500311 _addRect: function() {},
Kevin Lubick37ab53e2019-11-11 10:06:08 -0500312 _addPoly: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500313 _addRoundRect: function() {},
Alexander Khovansky3e119332018-11-15 02:01:19 +0300314 _arc: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400315 _arcTo: function() {},
316 _close: function() {},
317 _conicTo: function() {},
318 _cubicTo: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400319 _dash: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400320 _lineTo: function() {},
321 _moveTo: function() {},
322 _op: function() {},
323 _quadTo: function() {},
Kevin Lubick79b71342019-11-01 14:36:52 -0400324 _rArcTo: function() {},
325 _rConicTo: function() {},
326 _rCubicTo: function() {},
327 _rLineTo: function() {},
328 _rMoveTo: function() {},
329 _rQuadTo: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400330 _rect: function() {},
331 _simplify: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400332 _stroke: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400333 _transform: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400334 _trim: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400335 delete: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500336 dump: function() {},
337 dumpHex: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400338 },
339
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400340 SkPathMeasure: {
341 getLength: function() {},
Kevin Lubick37ab53e2019-11-11 10:06:08 -0500342 getSegment: function() {},
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400343 getPosTan: function() {},
344 isClosed: function() {},
345 nextContour: function() {},
346 },
347
Kevin Lubickcc13fd32019-04-05 13:00:01 -0400348 SkPicture: {
349 DEBUGONLY_serialize: function() {},
350 },
351
352 SkPictureRecorder: {
353 beginRecording: function() {},
354 finishRecordingAsPicture: function() {},
355 },
356
Kevin Lubick006a6f32018-10-19 14:34:34 -0400357 SkRect: {
358 fLeft: {},
359 fTop: {},
360 fRight: {},
361 fBottom: {},
362 },
363
Kevin Lubick2e5fe352019-09-03 12:59:06 -0400364 SkRRect: {
365 rect: {},
Kevin Lubick7d644e12019-09-11 14:22:22 -0400366 rx1: {},
367 ry1: {},
368 rx2: {},
369 ry2: {},
370 rx3: {},
371 ry3: {},
372 rx4: {},
373 ry4: {},
Kevin Lubick2e5fe352019-09-03 12:59:06 -0400374 },
375
Kevin Lubick006a6f32018-10-19 14:34:34 -0400376 SkSurface: {
377 // public API (from C++ bindings)
378 /** @return {CanvasKit.SkCanvas} */
379 getCanvas: function() {},
380 /** @return {CanvasKit.SkImage} */
381 makeImageSnapshot: function() {},
Kevin Lubick543f3522019-03-08 10:04:28 -0500382 makeSurface: function() {},
Kevin Lubickcd544662019-03-22 15:41:36 -0400383 grContext: {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400384
385 // private API
386 _flush: function() {},
387 _getRasterN32PremulSurface: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400388 delete: function() {},
389 },
390
Kevin Lubickec4903d2019-01-14 08:36:08 -0500391 SkTextBlob: {
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400392 // public API (both C++ and JS bindings)
393 MakeFromRSXform: function() {},
Kevin Lubickec4903d2019-01-14 08:36:08 -0500394 MakeFromText: function() {},
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400395 MakeOnPath: function() {},
396 // private API (from C++ bindings)
397 _MakeFromRSXform: function() {},
Kevin Lubickec4903d2019-01-14 08:36:08 -0500398 _MakeFromText: function() {},
399 },
400
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400401 SkVertices: {
402 // public API (from C++ bindings)
Kevin Lubick12c0e502018-11-28 12:51:56 -0500403 bounds: function() {},
404 mode: function() {},
405 uniqueID: function() {},
406 vertexCount: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400407
408 // private API
409 /** @return {CanvasKit.SkVertices} */
410 _applyBones: function() {},
411 },
412
Kevin Lubickd6ba7252019-06-03 14:38:05 -0400413 _SkVerticesBuilder: {
414 // public API (from C++ bindings)
415 boneIndices: function() {},
416 boneWeights: function() {},
417 colors: function() {},
418 detach: function() {},
419 indices: function() {},
420 positions: function() {},
421 texCoords: function() {},
422 },
423
Kevin Lubick369f6a52019-10-03 11:22:08 -0400424 TextStyle: function() {},
425
Kevin Lubick006a6f32018-10-19 14:34:34 -0400426 // Constants and Enums
427 gpu: {},
428 skottie: {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400429
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500430 TRANSPARENT: {},
431 RED: {},
432 BLUE: {},
433 YELLOW: {},
434 CYAN: {},
435 BLACK: {},
Kevin Lubickea905ec2018-11-30 14:05:58 -0500436 WHITE: {},
437
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500438 MOVE_VERB: {},
439 LINE_VERB: {},
440 QUAD_VERB: {},
441 CONIC_VERB: {},
442 CUBIC_VERB: {},
443 CLOSE_VERB: {},
444
Kevin Lubick369f6a52019-10-03 11:22:08 -0400445 NoDecoration: {},
446 UnderlineDecoration: {},
447 OverlineDecoration: {},
448 LineThroughDecoration: {},
449
Kevin Lubick77d9b5c2019-10-29 10:48:26 -0400450 SaveLayerInitWithPrevious: {},
451 SaveLayerF16ColorType: {},
452
Kevin Lubick369f6a52019-10-03 11:22:08 -0400453 Affinity: {
454 Upstream: {},
455 Downstream: {},
456 },
457
Kevin Lubickea905ec2018-11-30 14:05:58 -0500458 AlphaType: {
459 Opaque: {},
460 Premul: {},
461 Unpremul: {},
462 },
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500463
464 BlendMode: {
465 Clear: {},
466 Src: {},
467 Dst: {},
468 SrcOver: {},
469 DstOver: {},
470 SrcIn: {},
471 DstIn: {},
472 SrcOut: {},
473 DstOut: {},
474 SrcATop: {},
475 DstATop: {},
476 Xor: {},
477 Plus: {},
478 Modulate: {},
479 Screen: {},
480 Overlay: {},
481 Darken: {},
482 Lighten: {},
483 ColorDodge: {},
484 ColorBurn: {},
485 HardLight: {},
486 SoftLight: {},
487 Difference: {},
488 Exclusion: {},
489 Multiply: {},
490 Hue: {},
491 Saturation: {},
492 Color: {},
493 Luminosity: {},
494 },
495
496 BlurStyle: {
497 Normal: {},
498 Solid: {},
499 Outer: {},
500 Inner: {},
501 },
502
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500503 ClipOp: {
504 Difference: {},
505 Intersect: {},
506 },
507
Kevin Lubickea905ec2018-11-30 14:05:58 -0500508 ColorType: {
509 Alpha_8: {},
510 RGB_565: {},
511 ARGB_4444: {},
512 RGBA_8888: {},
513 RGB_888x: {},
514 BGRA_8888: {},
515 RGBA_1010102: {},
516 RGB_101010x: {},
517 Gray_8: {},
518 RGBA_F16: {},
519 RGBA_F32: {},
520 },
521
Kevin Lubick006a6f32018-10-19 14:34:34 -0400522 FillType: {
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500523 Winding: {},
524 EvenOdd: {},
525 InverseWinding: {},
526 InverseEvenOdd: {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400527 },
528
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500529 FilterQuality: {
530 None: {},
531 Low: {},
532 Medium: {},
533 High: {},
534 },
535
Kevin Lubickd3b1fe62019-10-21 10:50:26 -0400536 FontSlant: {
537 Upright: {},
538 Italic: {},
539 Oblique: {},
540 },
541
542 FontWeight: {
543 Invisible: {},
544 Thin: {},
545 ExtraLight: {},
546 Light: {},
547 Normal: {},
548 Medium: {},
549 SemiBold: {},
550 Bold: {},
551 ExtraBold: {},
552 Black: {},
553 ExtraBlack: {},
554 },
555
556 FontWidth: {
557 UltraCondensed: {},
558 ExtraCondensed: {},
559 Condensed: {},
560 SemiCondensed: {},
561 Normal: {},
562 SemiExpanded: {},
563 Expanded: {},
564 ExtraExpanded: {},
565 UltraExpanded: {},
566 },
567
Alexander Khovansky3e119332018-11-15 02:01:19 +0300568 ImageFormat: {
569 PNG: {},
570 JPEG: {},
571 },
572
Kevin Lubickb9db3902018-11-26 11:47:54 -0500573 PaintStyle: {
574 Fill: {},
575 Stroke: {},
576 StrokeAndFill: {},
577 },
578
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500579 PathOp: {
580 Difference: {},
581 Intersect: {},
582 Union: {},
583 XOR: {},
584 ReverseDifference: {},
585 },
586
Kevin Lubick37ab53e2019-11-11 10:06:08 -0500587 PointMode: {
588 Points: {},
589 Lines: {},
590 Polygon: {},
591 },
592
Kevin Lubick369f6a52019-10-03 11:22:08 -0400593 RectHeightStyle: {
594 Tight: {},
595 Max: {},
596 },
597
598 RectWidthStyle: {
599 Tight: {},
600 Max: {},
601 },
602
Kevin Lubickb9db3902018-11-26 11:47:54 -0500603 StrokeCap: {
604 Butt: {},
605 Round: {},
606 Square: {},
607 },
608
609 StrokeJoin: {
610 Miter: {},
611 Round: {},
612 Bevel: {},
613 },
614
Kevin Lubick369f6a52019-10-03 11:22:08 -0400615 TextAlign: {
616 Left: {},
617 Right: {},
618 Center: {},
619 Justify: {},
620 Start: {},
621 End: {},
622 },
623
Kevin Lubickd3b1fe62019-10-21 10:50:26 -0400624 TextDirection: {
625 LTR: {},
626 RTL: {},
627 },
628
Kevin Lubickec4903d2019-01-14 08:36:08 -0500629 TextEncoding: {
630 UTF8: {},
631 UTF16: {},
632 UTF32: {},
633 GlyphID: {},
634 },
635
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500636 TileMode: {
637 Clamp: {},
638 Repeat: {},
639 Mirror: {},
Kevin Lubickd29edd72018-12-07 08:29:52 -0500640 Decal: {},
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500641 },
642
643 VertexMode: {
644 Triangles: {},
645 TrianglesStrip: {},
646 TriangleFan: {},
647 },
648
Kevin Lubick006a6f32018-10-19 14:34:34 -0400649 // Things Enscriptem adds for us
650
Kevin Lubick53965c92018-10-11 08:51:55 -0400651 /**
652 * @type {Float32Array}
653 */
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400654 HEAPF32: {},
Kevin Lubick53965c92018-10-11 08:51:55 -0400655 /**
Kevin Lubickfa5a1382019-10-09 10:46:14 -0400656 * @type {Float64Array}
657 */
658 HEAPF64: {},
659 /**
Kevin Lubick53965c92018-10-11 08:51:55 -0400660 * @type {Uint8Array}
661 */
662 HEAPU8: {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400663 /**
664 * @type {Uint16Array}
665 */
666 HEAPU16: {},
667 /**
Kevin Lubickf5ea37f2019-02-28 10:06:18 -0500668 * @type {Uint32Array}
669 */
670 HEAPU32: {},
Kevin Lubickfa5a1382019-10-09 10:46:14 -0400671 /**
672 * @type {Int8Array}
673 */
674 HEAP8: {},
675 /**
676 * @type {Int16Array}
677 */
678 HEAP16: {},
679 /**
680 * @type {Int32Array}
681 */
682 HEAP32: {},
683
Kevin Lubick006a6f32018-10-19 14:34:34 -0400684 _malloc: function() {},
685 _free: function() {},
686 onRuntimeInitialized: function() {},
687};
Kevin Lubick217056c2018-09-20 17:39:31 -0400688
Kevin Lubick006a6f32018-10-19 14:34:34 -0400689// Public API things that are newly declared in the JS should go here.
690// It's not enough to declare them above, because closure can still erase them
691// unless they go on the prototype.
Kevin Lubick369f6a52019-10-03 11:22:08 -0400692CanvasKit.Paragraph.prototype.getRectsForRange = function() {};
693
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500694CanvasKit.SkPath.prototype.addArc = function() {};
Kevin Lubicke384df42019-08-26 15:48:09 -0400695CanvasKit.SkPath.prototype.addOval = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400696CanvasKit.SkPath.prototype.addPath = function() {};
Kevin Lubick37ab53e2019-11-11 10:06:08 -0500697CanvasKit.SkPath.prototype.addPoly = function() {};
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500698CanvasKit.SkPath.prototype.addRect = function() {};
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500699CanvasKit.SkPath.prototype.addRoundRect = function() {};
Alexander Khovansky3e119332018-11-15 02:01:19 +0300700CanvasKit.SkPath.prototype.arc = function() {};
Kevin Lubick006a6f32018-10-19 14:34:34 -0400701CanvasKit.SkPath.prototype.arcTo = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400702CanvasKit.SkPath.prototype.close = function() {};
Kevin Lubick006a6f32018-10-19 14:34:34 -0400703CanvasKit.SkPath.prototype.conicTo = function() {};
704CanvasKit.SkPath.prototype.cubicTo = function() {};
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400705CanvasKit.SkPath.prototype.dash = function() {};
Kevin Lubick006a6f32018-10-19 14:34:34 -0400706CanvasKit.SkPath.prototype.lineTo = function() {};
707CanvasKit.SkPath.prototype.moveTo = function() {};
Kevin Lubicke384df42019-08-26 15:48:09 -0400708CanvasKit.SkPath.prototype.offset = function() {};
Kevin Lubick006a6f32018-10-19 14:34:34 -0400709CanvasKit.SkPath.prototype.op = function() {};
710CanvasKit.SkPath.prototype.quadTo = function() {};
Kevin Lubick79b71342019-11-01 14:36:52 -0400711CanvasKit.SkPath.prototype.rArcTo = function() {};
712CanvasKit.SkPath.prototype.rConicTo = function() {};
713CanvasKit.SkPath.prototype.rCubicTo = function() {};
714CanvasKit.SkPath.prototype.rLineTo = function() {};
715CanvasKit.SkPath.prototype.rMoveTo = function() {};
716CanvasKit.SkPath.prototype.rQuadTo = function() {};
Kevin Lubick006a6f32018-10-19 14:34:34 -0400717CanvasKit.SkPath.prototype.rect = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400718CanvasKit.SkPath.prototype.simplify = function() {};
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400719CanvasKit.SkPath.prototype.stroke = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400720CanvasKit.SkPath.prototype.transform = function() {};
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400721CanvasKit.SkPath.prototype.trim = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400722
Kevin Lubickcc13fd32019-04-05 13:00:01 -0400723CanvasKit.SkPicture.prototype.DEBUGONLY_saveAsFile = function() {};
724
Kevin Lubick5b90b842018-10-17 07:57:18 -0400725CanvasKit.SkSurface.prototype.dispose = function() {};
Kevin Lubick359a7e32019-03-19 09:34:37 -0400726CanvasKit.SkSurface.prototype.flush = function() {};
727CanvasKit.SkSurface.prototype.requestAnimationFrame = function() {};
Kevin Lubickcc13fd32019-04-05 13:00:01 -0400728CanvasKit.SkSurface.prototype.captureFrameAsSkPicture = function() {};
Kevin Lubick53965c92018-10-11 08:51:55 -0400729
Kevin Lubick12c0e502018-11-28 12:51:56 -0500730/** @return {CanvasKit.SkVertices} */
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400731CanvasKit.SkVertices.prototype.applyBones = function() {};
732
Alexander Khovansky3e119332018-11-15 02:01:19 +0300733CanvasKit.SkImage.prototype.encodeToData = function() {};
Kevin Lubicka064c282019-04-04 09:28:53 -0400734CanvasKit.SkImage.prototype.makeShader = function() {};
Alexander Khovansky3e119332018-11-15 02:01:19 +0300735
Kevin Lubickee91c072019-03-29 10:39:52 -0400736CanvasKit.SkCanvas.prototype.drawAtlas = function() {};
Kevin Lubick37ab53e2019-11-11 10:06:08 -0500737CanvasKit.SkCanvas.prototype.drawPoints = function() {};
Kevin Lubickec4903d2019-01-14 08:36:08 -0500738CanvasKit.SkCanvas.prototype.drawText = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500739/** @return {Uint8Array} */
740CanvasKit.SkCanvas.prototype.readPixels = function() {};
741CanvasKit.SkCanvas.prototype.writePixels = function() {};
742
Kevin Lubickddd0a332018-12-12 10:35:13 -0500743CanvasKit.SkFontMgr.prototype.MakeTypefaceFromData = function() {};
744
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400745CanvasKit.SkFont.prototype.getWidths = function() {};
746
747CanvasKit.RSXFormBuilder.prototype.build = function() {};
748CanvasKit.RSXFormBuilder.prototype.delete = function() {};
749CanvasKit.RSXFormBuilder.prototype.push = function() {};
Kevin Lubickee91c072019-03-29 10:39:52 -0400750CanvasKit.RSXFormBuilder.prototype.set = function() {};
751
752CanvasKit.SkColorBuilder.prototype.build = function() {};
753CanvasKit.SkColorBuilder.prototype.delete = function() {};
754CanvasKit.SkColorBuilder.prototype.push = function() {};
755CanvasKit.SkColorBuilder.prototype.set = function() {};
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400756
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400757// Define StrokeOpts object
758var StrokeOpts = {};
759StrokeOpts.prototype.width;
760StrokeOpts.prototype.miter_limit;
761StrokeOpts.prototype.cap;
762StrokeOpts.prototype.join;
Kevin Lubick1646e7d2018-12-07 13:03:08 -0500763StrokeOpts.prototype.precision;
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400764
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500765// Define everything created in the canvas2d spec here
Kevin Lubickb9db3902018-11-26 11:47:54 -0500766var HTMLCanvas = {};
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500767HTMLCanvas.prototype.decodeImage = function() {};
768HTMLCanvas.prototype.dispose = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500769HTMLCanvas.prototype.getContext = function() {};
Kevin Lubick8e4a3312018-12-14 15:03:41 -0500770HTMLCanvas.prototype.loadFont = function() {};
Kevin Lubicka40f8322018-12-17 16:01:36 -0500771HTMLCanvas.prototype.makePath2D = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500772HTMLCanvas.prototype.toDataURL = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500773
774var CanvasRenderingContext2D = {};
775CanvasRenderingContext2D.prototype.addHitRegion = function() {};
776CanvasRenderingContext2D.prototype.arc = function() {};
777CanvasRenderingContext2D.prototype.arcTo = function() {};
778CanvasRenderingContext2D.prototype.beginPath = function() {};
779CanvasRenderingContext2D.prototype.bezierCurveTo = function() {};
780CanvasRenderingContext2D.prototype.clearHitRegions = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500781CanvasRenderingContext2D.prototype.clearRect = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500782CanvasRenderingContext2D.prototype.clip = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500783CanvasRenderingContext2D.prototype.closePath = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500784CanvasRenderingContext2D.prototype.createImageData = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500785CanvasRenderingContext2D.prototype.createLinearGradient = function() {};
Kevin Lubickd29edd72018-12-07 08:29:52 -0500786CanvasRenderingContext2D.prototype.createPattern = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500787CanvasRenderingContext2D.prototype.createRadialGradient = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500788CanvasRenderingContext2D.prototype.drawFocusIfNeeded = function() {};
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500789CanvasRenderingContext2D.prototype.drawImage = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500790CanvasRenderingContext2D.prototype.ellipse = function() {};
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500791CanvasRenderingContext2D.prototype.fill = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500792CanvasRenderingContext2D.prototype.fillRect = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500793CanvasRenderingContext2D.prototype.fillText = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500794CanvasRenderingContext2D.prototype.getImageData = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500795CanvasRenderingContext2D.prototype.getLineDash = function() {};
Kevin Lubick1646e7d2018-12-07 13:03:08 -0500796CanvasRenderingContext2D.prototype.isPointInPath = function() {};
797CanvasRenderingContext2D.prototype.isPointInStroke = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500798CanvasRenderingContext2D.prototype.lineTo = function() {};
799CanvasRenderingContext2D.prototype.measureText = function() {};
800CanvasRenderingContext2D.prototype.moveTo = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500801CanvasRenderingContext2D.prototype.putImageData = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500802CanvasRenderingContext2D.prototype.quadraticCurveTo = function() {};
803CanvasRenderingContext2D.prototype.rect = function() {};
804CanvasRenderingContext2D.prototype.removeHitRegion = function() {};
805CanvasRenderingContext2D.prototype.resetTransform = function() {};
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500806CanvasRenderingContext2D.prototype.restore = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500807CanvasRenderingContext2D.prototype.rotate = function() {};
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500808CanvasRenderingContext2D.prototype.save = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500809CanvasRenderingContext2D.prototype.scale = function() {};
810CanvasRenderingContext2D.prototype.scrollPathIntoView = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500811CanvasRenderingContext2D.prototype.setLineDash = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500812CanvasRenderingContext2D.prototype.setTransform = function() {};
813CanvasRenderingContext2D.prototype.stroke = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500814CanvasRenderingContext2D.prototype.strokeRect = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500815CanvasRenderingContext2D.prototype.strokeText = function() {};
816CanvasRenderingContext2D.prototype.transform = function() {};
817CanvasRenderingContext2D.prototype.translate = function() {};
818
Kevin Lubicka40f8322018-12-17 16:01:36 -0500819var Path2D = {};
820Path2D.prototype.addPath = function() {};
821Path2D.prototype.arc = function() {};
822Path2D.prototype.arcTo = function() {};
823Path2D.prototype.bezierCurveTo = function() {};
824Path2D.prototype.closePath = function() {};
825Path2D.prototype.ellipse = function() {};
826Path2D.prototype.lineTo = function() {};
827Path2D.prototype.moveTo = function() {};
828Path2D.prototype.quadraticCurveTo = function() {};
829Path2D.prototype.rect = function() {};
830
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500831var LinearCanvasGradient = {};
832LinearCanvasGradient.prototype.addColorStop = function() {};
833var RadialCanvasGradient = {};
834RadialCanvasGradient.prototype.addColorStop = function() {};
Kevin Lubickd29edd72018-12-07 08:29:52 -0500835var CanvasPattern = {};
836CanvasPattern.prototype.setTransform = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500837
Kevin Lubick52b9f372018-12-04 13:57:36 -0500838var ImageData = {
839 /**
840 * @type {Uint8ClampedArray}
841 */
842 data: {},
843 height: {},
844 width: {},
845};
846
Kevin Lubickd29edd72018-12-07 08:29:52 -0500847var DOMMatrix = {
848 a: {},
849 b: {},
850 c: {},
851 d: {},
852 e: {},
853 f: {},
854};
855
Kevin Lubick217056c2018-09-20 17:39:31 -0400856// 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 -0500857function loadWebAssemblyModule() {};