blob: 4d8a4751debfc3f409be74821b3501d03e1f96ab [file] [log] [blame]
Kevin Lubick217056c2018-09-20 17:39:31 -04001/*
2 * This externs file prevents the Closure JS compiler from minifying away
3 * names of objects created by Emscripten.
4 * Basically, by defining empty objects and functions here, Closure will
5 * know not to rename them. This is needed because of our pre-js files,
6 * that is, the JS we hand-write to bundle into the output. That JS will be
7 * hit by the closure compiler and thus needs to know about what functions
8 * have special names and should not be minified.
9 *
10 * Emscripten does not support automatically generating an externs file, so we
11 * do it by hand. The general process is to write some JS code, and then put any
12 * calls to CanvasKit or related things in here. Running ./compile.sh and then
13 * looking at the minified results or running the Release trybot should
14 * verify nothing was missed. Optionally, looking directly at the minified
15 * pathkit.js can be useful when developing locally.
16 *
17 * Docs:
18 * https://github.com/cljsjs/packages/wiki/Creating-Externs
19 * https://github.com/google/closure-compiler/wiki/Types-in-the-Closure-Type-System
20 *
21 * Example externs:
22 * https://github.com/google/closure-compiler/tree/master/externs
23 */
24
25var CanvasKit = {
26 // public API (i.e. things we declare in the pre-js file)
Kevin Lubick006a6f32018-10-19 14:34:34 -040027 Color: function() {},
28 /** @return {CanvasKit.SkRect} */
29 LTRBRect: function() {},
Kevin Lubick0a1293c2018-12-03 12:31:04 -050030 /** @return {CanvasKit.SkRect} */
31 XYWHRect: function() {},
Kevin Lubick7d644e12019-09-11 14:22:22 -040032 /** @return {CanvasKit.SkRRect} */
33 RRectXY: function() {},
Kevin Lubick52b9f372018-12-04 13:57:36 -050034 /** @return {ImageData} */
35 ImageData: function() {},
Kevin Lubick543f3522019-03-08 10:04:28 -050036
37 GetWebGLContext: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -050038 MakeBlurMaskFilter: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -040039 MakeCanvas: function() {},
40 MakeCanvasSurface: function() {},
Kevin Lubick543f3522019-03-08 10:04:28 -050041 MakeGrContext: function() {},
Kevin Lubick6b921b72019-09-18 16:18:17 -040042 /** @return {CanvasKit.SkAnimatedImage} */
43 MakeAnimatedImageFromEncoded: function() {},
Kevin Lubick0a1293c2018-12-03 12:31:04 -050044 /** @return {CanvasKit.SkImage} */
45 MakeImageFromEncoded: function() {},
Kevin Lubickeb2f6b02018-11-29 15:07:02 -050046 /** @return {LinearCanvasGradient} */
Kevin Lubickb5ae3b52018-11-03 07:51:19 -040047 MakeLinearGradientShader: function() {},
Kevin Lubick543f3522019-03-08 10:04:28 -050048 MakeOnScreenGLSurface: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -050049 MakePathFromCmds: function() {},
Kevin Lubicka40f8322018-12-17 16:01:36 -050050 MakePathFromOp: function() {},
51 MakePathFromSVGString: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -050052 MakeRadialGradientShader: function() {},
Kevin Lubick543f3522019-03-08 10:04:28 -050053 MakeRenderTarget: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -050054 MakeSWCanvasSurface: function() {},
Kevin Lubickf5ea37f2019-02-28 10:06:18 -050055 MakeManagedAnimation: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -040056 MakeSkDashPathEffect: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -040057 MakeSkVertices: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -040058 MakeSurface: function() {},
Kevin Lubickeb2f6b02018-11-29 15:07:02 -050059 /** @return {RadialCanvasGradient} */
60 MakeTwoPointConicalGradientShader: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -050061 MakeWebGLCanvasSurface: function() {},
Kevin Lubicke25df6c2019-10-22 09:04:32 -040062 /** @return {TypedArray} */
63 Malloc: function() {},
Kevin Lubick50f377e2019-09-11 15:23:00 -040064 /** @return {TonalColors} */
65 computeTonalColors: function() {},
Kevin Lubick217056c2018-09-20 17:39:31 -040066 currentContext: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -050067 getColorComponents: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -050068 getSkDataBytes: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -050069 multiplyByAlpha: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -040070 setCurrentContext: function() {},
Kevin Lubick217056c2018-09-20 17:39:31 -040071
72 // private API (i.e. things declared in the bindings that we use
73 // in the pre-js file)
Kevin Lubick52b9f372018-12-04 13:57:36 -050074 _MakeImage: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -040075 _MakeLinearGradientShader: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -050076 _MakePathFromCmds: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -040077 _MakeRadialGradientShader: function() {},
Kevin Lubickf5ea37f2019-02-28 10:06:18 -050078 _MakeManagedAnimation: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -040079 _MakeSkDashPathEffect: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -040080 _MakeSkVertices: function() {},
Kevin Lubickeb2f6b02018-11-29 15:07:02 -050081 _MakeTwoPointConicalGradientShader: function() {},
Kevin Lubick6b921b72019-09-18 16:18:17 -040082 _decodeAnimatedImage: function() {},
Kevin Lubick0a1293c2018-12-03 12:31:04 -050083 _decodeImage: function() {},
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -050084 _drawShapedText: function() {},
Kevin Lubickea905ec2018-11-30 14:05:58 -050085 _getRasterDirectSurface: function() {},
Kevin Lubick134be1d2018-10-30 15:05:04 -040086 _getRasterN32PremulSurface: function() {},
Kevin Lubick217056c2018-09-20 17:39:31 -040087
Kevin Lubick1a05fce2018-11-20 12:51:16 -050088 // The testing object is meant to expose internal functions
89 // for more fine-grained testing, e.g. parseColor
90 _testing: {},
91
Kevin Lubick217056c2018-09-20 17:39:31 -040092 // Objects and properties on CanvasKit
93
Kevin Lubickcd544662019-03-22 15:41:36 -040094 GrContext: {
95 // public API (from C++ bindings)
96 getResourceCacheLimitBytes: function() {},
97 getResourceCacheUsageBytes: function() {},
98 setResourceCacheLimitBytes: function() {},
99 },
100
Kevin Lubick369f6a52019-10-03 11:22:08 -0400101 Paragraph: {
102 // public API (from C++ bindings)
103 getGlyphPositionAtCoordinate: function() {},
104 layout: function() {},
105
106 // private API
107 /** @return {Float32Array} */
108 _getRectsForRange: function() {},
109 },
110
111 ParagraphStyle: function() {},
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400112 RSXFormBuilder: function() {},
Kevin Lubickee91c072019-03-29 10:39:52 -0400113 SkColorBuilder: function() {},
114 SkRectBuilder: function() {},
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400115
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -0500116 ShapedText: {
117 // public API (from C++ bindings)
118 getBounds: function() {},
119 },
120
Kevin Lubick6b921b72019-09-18 16:18:17 -0400121 SkAnimatedImage: {
122 // public API (from C++ bindings)
123 getRepetitionCount: function() {},
124 decodeNextFrame: function() {},
125 },
126
Kevin Lubick006a6f32018-10-19 14:34:34 -0400127 SkCanvas: {
128 // public API (from C++ bindings)
129 clear: function() {},
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500130 clipPath: function() {},
Kevin Lubick6dbc4ed2019-10-22 09:43:34 -0400131 clipRRect: function() {},
Kevin Lubick5d5723c2018-12-07 10:09:11 -0500132 clipRect: function() {},
133 concat: function() {},
Kevin Lubick6dbc4ed2019-10-22 09:43:34 -0400134 drawAnimatedImage: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500135 drawArc: function() {},
Kevin Lubicke384df42019-08-26 15:48:09 -0400136 drawCircle: function() {},
Kevin Lubick6dbc4ed2019-10-22 09:43:34 -0400137 drawColor: function() {},
Kevin Lubick2e5fe352019-09-03 12:59:06 -0400138 drawDRRect: function() {},
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500139 drawImage: function() {},
140 drawImageRect: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500141 drawLine: function() {},
142 drawOval: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400143 drawPaint: function() {},
Kevin Lubick369f6a52019-10-03 11:22:08 -0400144 drawParagraph: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400145 drawPath: function() {},
Kevin Lubickcc13fd32019-04-05 13:00:01 -0400146 drawPicture: function() {},
Kevin Lubick2e5fe352019-09-03 12:59:06 -0400147 drawRRect: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -0500148 drawRect: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500149 drawRoundRect: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500150 drawShadow: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -0500151 drawText: function() {},
Kevin Lubickec4903d2019-01-14 08:36:08 -0500152 drawTextBlob: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -0500153 drawVertices: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400154 flush: function() {},
Kevin Lubick2e5fe352019-09-03 12:59:06 -0400155 getSaveCount: function() {},
Kevin Lubick5d5723c2018-12-07 10:09:11 -0500156 getTotalMatrix: function() {},
Kevin Lubick543f3522019-03-08 10:04:28 -0500157 makeSurface: function() {},
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500158 restore: function() {},
Kevin Lubickb3574c92019-03-06 08:25:36 -0500159 restoreToCount: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400160 rotate: function() {},
161 save: function() {},
Kevin Lubickb3574c92019-03-06 08:25:36 -0500162 saveLayer: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400163 scale: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400164 skew: function() {},
165 translate: function() {},
166
167 // private API
Kevin Lubickee91c072019-03-29 10:39:52 -0400168 _drawAtlas: function() {},
Kevin Lubickec4903d2019-01-14 08:36:08 -0500169 _drawSimpleText: function() {},
Kevin Lubick52b9f372018-12-04 13:57:36 -0500170 _readPixels: function() {},
171 _writePixels: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400172 delete: function() {},
173 },
174
Kevin Lubickd3729342019-09-12 11:11:25 -0400175 SkColorFilter: {
176 // public API (from C++ bindings and JS interface)
177 MakeBlend: function() {},
178 MakeCompose: function() {},
179 MakeLerp: function() {},
180 MakeLinearToSRGBGamma: function() {},
181 MakeMatrix: function() {},
182 MakeSRGBToLinearGamma: function() {},
183 // private API (from C++ bindings)
184 _makeMatrix: function() {},
185 },
186
187 SkColorMatrix: {
188 concat: function() {},
189 identity: function() {},
190 postTranslate: function() {},
191 rotated: function() {},
192 scaled: function() {},
193 },
194
Kevin Lubick35ac0382019-01-02 15:13:57 -0500195 SkFont: {
196 // public API (from C++ bindings)
197 getScaleX: function() {},
198 getSize: function() {},
199 getSkewX: function() {},
200 getTypeface: function() {},
201 measureText: function() {},
202 setScaleX: function() {},
203 setSize: function() {},
204 setSkewX: function() {},
205 setTypeface: function() {},
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400206 // private API (from C++ bindings)
207 _getWidths: function() {},
Kevin Lubick35ac0382019-01-02 15:13:57 -0500208 },
209
Kevin Lubickddd0a332018-12-12 10:35:13 -0500210 SkFontMgr: {
Kevin Lubick61887c72019-09-26 13:20:50 -0400211 // public API (from C++ and JS bindings)
212 FromData: function() {},
Kevin Lubickddd0a332018-12-12 10:35:13 -0500213 RefDefault: function() {},
214 countFamilies: function() {},
215
216 // private API
217 _makeTypefaceFromData: function() {},
Kevin Lubick61887c72019-09-26 13:20:50 -0400218 _fromData: function() {},
Kevin Lubickddd0a332018-12-12 10:35:13 -0500219 },
220
Kevin Lubick006a6f32018-10-19 14:34:34 -0400221 SkImage: {
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500222 // public API (from C++ bindings)
223 height: function() {},
224 width: function() {},
Alexander Khovansky3e119332018-11-15 02:01:19 +0300225 // private API
226 _encodeToData: function() {},
227 _encodeToDataWithFormat: function() {},
Kevin Lubicka064c282019-04-04 09:28:53 -0400228 _makeShader: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400229 },
230
Kevin Lubick15b40232019-10-29 09:55:39 -0400231 SkImageFilter: {
232 MakeBlur: function() {},
233 MakeColorFilter: function() {},
234 MakeCompose: function() {},
235 },
236
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500237 SkMatrix: {
Kevin Lubickb9db3902018-11-26 11:47:54 -0500238 identity: function() {},
Kevin Lubickf3555182019-03-14 10:55:10 -0400239 invert: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500240 mapPoints: function() {},
241 multiply: function() {},
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500242 rotated: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500243 scaled: function() {},
244 skewed: function() {},
245 translated: function() {},
246 },
247
Kevin Lubick15b40232019-10-29 09:55:39 -0400248 SkMaskFilter: {
249 MakeBlur: function() {},
250 },
251
Kevin Lubickb9db3902018-11-26 11:47:54 -0500252 SkPaint: {
253 // public API (from C++ bindings)
254 /** @return {CanvasKit.SkPaint} */
255 copy: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -0500256 getBlendMode: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500257 getColor: function() {},
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500258 getFilterQuality: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500259 getStrokeCap: function() {},
260 getStrokeJoin: function() {},
261 getStrokeMiter: function() {},
262 getStrokeWidth: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500263 setAntiAlias: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -0500264 setBlendMode: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500265 setColor: function() {},
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500266 setFilterQuality: function() {},
Kevin Lubick15b40232019-10-29 09:55:39 -0400267 setImageFilter: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500268 setMaskFilter: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500269 setPathEffect: function() {},
270 setShader: function() {},
271 setStrokeCap: function() {},
272 setStrokeJoin: function() {},
273 setStrokeMiter: function() {},
274 setStrokeWidth: function() {},
275 setStyle: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500276
277 //private API
278 delete: function() {},
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500279 },
280
Kevin Lubick006a6f32018-10-19 14:34:34 -0400281 SkPath: {
282 // public API (from C++ bindings)
Kevin Lubickb9db3902018-11-26 11:47:54 -0500283 computeTightBounds: function() {},
Kevin Lubick1646e7d2018-12-07 13:03:08 -0500284 contains: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500285 /** @return {CanvasKit.SkPath} */
286 copy: function() {},
287 countPoints: function() {},
288 equals: function() {},
289 getBounds: function() {},
290 getFillType: function() {},
291 getPoint: function() {},
Kevin Lubick1646e7d2018-12-07 13:03:08 -0500292 isEmpty: function() {},
Kevin Lubick2b79d1c2018-12-14 16:10:38 -0500293 isVolatile: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500294 reset: function() {},
295 rewind: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500296 setFillType: function() {},
Kevin Lubick2b79d1c2018-12-14 16:10:38 -0500297 setIsVolatile: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500298 toSVGString: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400299
300 // private API
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500301 _addArc: function() {},
Kevin Lubicke384df42019-08-26 15:48:09 -0400302 _addOval: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400303 _addPath: function() {},
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500304 _addRect: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500305 _addRoundRect: function() {},
Alexander Khovansky3e119332018-11-15 02:01:19 +0300306 _arc: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400307 _arcTo: function() {},
308 _close: function() {},
309 _conicTo: function() {},
310 _cubicTo: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400311 _dash: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400312 _lineTo: function() {},
313 _moveTo: function() {},
314 _op: function() {},
315 _quadTo: function() {},
316 _rect: function() {},
317 _simplify: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400318 _stroke: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400319 _transform: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400320 _trim: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400321 delete: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500322 dump: function() {},
323 dumpHex: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400324 },
325
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400326 SkPathMeasure: {
327 getLength: function() {},
328 getPosTan: function() {},
329 isClosed: function() {},
330 nextContour: function() {},
331 },
332
Kevin Lubickcc13fd32019-04-05 13:00:01 -0400333 SkPicture: {
334 DEBUGONLY_serialize: function() {},
335 },
336
337 SkPictureRecorder: {
338 beginRecording: function() {},
339 finishRecordingAsPicture: function() {},
340 },
341
Kevin Lubick006a6f32018-10-19 14:34:34 -0400342 SkRect: {
343 fLeft: {},
344 fTop: {},
345 fRight: {},
346 fBottom: {},
347 },
348
Kevin Lubick2e5fe352019-09-03 12:59:06 -0400349 SkRRect: {
350 rect: {},
Kevin Lubick7d644e12019-09-11 14:22:22 -0400351 rx1: {},
352 ry1: {},
353 rx2: {},
354 ry2: {},
355 rx3: {},
356 ry3: {},
357 rx4: {},
358 ry4: {},
Kevin Lubick2e5fe352019-09-03 12:59:06 -0400359 },
360
Kevin Lubick006a6f32018-10-19 14:34:34 -0400361 SkSurface: {
362 // public API (from C++ bindings)
363 /** @return {CanvasKit.SkCanvas} */
364 getCanvas: function() {},
365 /** @return {CanvasKit.SkImage} */
366 makeImageSnapshot: function() {},
Kevin Lubick543f3522019-03-08 10:04:28 -0500367 makeSurface: function() {},
Kevin Lubickcd544662019-03-22 15:41:36 -0400368 grContext: {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400369
370 // private API
371 _flush: function() {},
372 _getRasterN32PremulSurface: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400373 delete: function() {},
374 },
375
Kevin Lubickec4903d2019-01-14 08:36:08 -0500376 SkTextBlob: {
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400377 // public API (both C++ and JS bindings)
378 MakeFromRSXform: function() {},
Kevin Lubickec4903d2019-01-14 08:36:08 -0500379 MakeFromText: function() {},
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400380 MakeOnPath: function() {},
381 // private API (from C++ bindings)
382 _MakeFromRSXform: function() {},
Kevin Lubickec4903d2019-01-14 08:36:08 -0500383 _MakeFromText: function() {},
384 },
385
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400386 SkVertices: {
387 // public API (from C++ bindings)
Kevin Lubick12c0e502018-11-28 12:51:56 -0500388 bounds: function() {},
389 mode: function() {},
390 uniqueID: function() {},
391 vertexCount: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400392
393 // private API
394 /** @return {CanvasKit.SkVertices} */
395 _applyBones: function() {},
396 },
397
Kevin Lubickd6ba7252019-06-03 14:38:05 -0400398 _SkVerticesBuilder: {
399 // public API (from C++ bindings)
400 boneIndices: function() {},
401 boneWeights: function() {},
402 colors: function() {},
403 detach: function() {},
404 indices: function() {},
405 positions: function() {},
406 texCoords: function() {},
407 },
408
Kevin Lubick369f6a52019-10-03 11:22:08 -0400409 TextStyle: function() {},
410
Kevin Lubick006a6f32018-10-19 14:34:34 -0400411 // Constants and Enums
412 gpu: {},
413 skottie: {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400414
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500415 TRANSPARENT: {},
416 RED: {},
417 BLUE: {},
418 YELLOW: {},
419 CYAN: {},
420 BLACK: {},
Kevin Lubickea905ec2018-11-30 14:05:58 -0500421 WHITE: {},
422
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500423 MOVE_VERB: {},
424 LINE_VERB: {},
425 QUAD_VERB: {},
426 CONIC_VERB: {},
427 CUBIC_VERB: {},
428 CLOSE_VERB: {},
429
Kevin Lubick369f6a52019-10-03 11:22:08 -0400430 NoDecoration: {},
431 UnderlineDecoration: {},
432 OverlineDecoration: {},
433 LineThroughDecoration: {},
434
Kevin Lubick77d9b5c2019-10-29 10:48:26 -0400435 SaveLayerInitWithPrevious: {},
436 SaveLayerF16ColorType: {},
437
Kevin Lubick369f6a52019-10-03 11:22:08 -0400438 Affinity: {
439 Upstream: {},
440 Downstream: {},
441 },
442
Kevin Lubickea905ec2018-11-30 14:05:58 -0500443 AlphaType: {
444 Opaque: {},
445 Premul: {},
446 Unpremul: {},
447 },
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500448
449 BlendMode: {
450 Clear: {},
451 Src: {},
452 Dst: {},
453 SrcOver: {},
454 DstOver: {},
455 SrcIn: {},
456 DstIn: {},
457 SrcOut: {},
458 DstOut: {},
459 SrcATop: {},
460 DstATop: {},
461 Xor: {},
462 Plus: {},
463 Modulate: {},
464 Screen: {},
465 Overlay: {},
466 Darken: {},
467 Lighten: {},
468 ColorDodge: {},
469 ColorBurn: {},
470 HardLight: {},
471 SoftLight: {},
472 Difference: {},
473 Exclusion: {},
474 Multiply: {},
475 Hue: {},
476 Saturation: {},
477 Color: {},
478 Luminosity: {},
479 },
480
481 BlurStyle: {
482 Normal: {},
483 Solid: {},
484 Outer: {},
485 Inner: {},
486 },
487
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500488 ClipOp: {
489 Difference: {},
490 Intersect: {},
491 },
492
Kevin Lubickea905ec2018-11-30 14:05:58 -0500493 ColorType: {
494 Alpha_8: {},
495 RGB_565: {},
496 ARGB_4444: {},
497 RGBA_8888: {},
498 RGB_888x: {},
499 BGRA_8888: {},
500 RGBA_1010102: {},
501 RGB_101010x: {},
502 Gray_8: {},
503 RGBA_F16: {},
504 RGBA_F32: {},
505 },
506
Kevin Lubick006a6f32018-10-19 14:34:34 -0400507 FillType: {
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500508 Winding: {},
509 EvenOdd: {},
510 InverseWinding: {},
511 InverseEvenOdd: {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400512 },
513
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500514 FilterQuality: {
515 None: {},
516 Low: {},
517 Medium: {},
518 High: {},
519 },
520
Kevin Lubickd3b1fe62019-10-21 10:50:26 -0400521 FontSlant: {
522 Upright: {},
523 Italic: {},
524 Oblique: {},
525 },
526
527 FontWeight: {
528 Invisible: {},
529 Thin: {},
530 ExtraLight: {},
531 Light: {},
532 Normal: {},
533 Medium: {},
534 SemiBold: {},
535 Bold: {},
536 ExtraBold: {},
537 Black: {},
538 ExtraBlack: {},
539 },
540
541 FontWidth: {
542 UltraCondensed: {},
543 ExtraCondensed: {},
544 Condensed: {},
545 SemiCondensed: {},
546 Normal: {},
547 SemiExpanded: {},
548 Expanded: {},
549 ExtraExpanded: {},
550 UltraExpanded: {},
551 },
552
Alexander Khovansky3e119332018-11-15 02:01:19 +0300553 ImageFormat: {
554 PNG: {},
555 JPEG: {},
556 },
557
Kevin Lubickb9db3902018-11-26 11:47:54 -0500558 PaintStyle: {
559 Fill: {},
560 Stroke: {},
561 StrokeAndFill: {},
562 },
563
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500564 PathOp: {
565 Difference: {},
566 Intersect: {},
567 Union: {},
568 XOR: {},
569 ReverseDifference: {},
570 },
571
Kevin Lubick369f6a52019-10-03 11:22:08 -0400572 RectHeightStyle: {
573 Tight: {},
574 Max: {},
575 },
576
577 RectWidthStyle: {
578 Tight: {},
579 Max: {},
580 },
581
Kevin Lubickb9db3902018-11-26 11:47:54 -0500582 StrokeCap: {
583 Butt: {},
584 Round: {},
585 Square: {},
586 },
587
588 StrokeJoin: {
589 Miter: {},
590 Round: {},
591 Bevel: {},
592 },
593
Kevin Lubick369f6a52019-10-03 11:22:08 -0400594 TextAlign: {
595 Left: {},
596 Right: {},
597 Center: {},
598 Justify: {},
599 Start: {},
600 End: {},
601 },
602
Kevin Lubickd3b1fe62019-10-21 10:50:26 -0400603 TextDirection: {
604 LTR: {},
605 RTL: {},
606 },
607
Kevin Lubickec4903d2019-01-14 08:36:08 -0500608 TextEncoding: {
609 UTF8: {},
610 UTF16: {},
611 UTF32: {},
612 GlyphID: {},
613 },
614
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500615 TileMode: {
616 Clamp: {},
617 Repeat: {},
618 Mirror: {},
Kevin Lubickd29edd72018-12-07 08:29:52 -0500619 Decal: {},
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500620 },
621
622 VertexMode: {
623 Triangles: {},
624 TrianglesStrip: {},
625 TriangleFan: {},
626 },
627
Kevin Lubick006a6f32018-10-19 14:34:34 -0400628 // Things Enscriptem adds for us
629
Kevin Lubick53965c92018-10-11 08:51:55 -0400630 /**
631 * @type {Float32Array}
632 */
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400633 HEAPF32: {},
Kevin Lubick53965c92018-10-11 08:51:55 -0400634 /**
Kevin Lubickfa5a1382019-10-09 10:46:14 -0400635 * @type {Float64Array}
636 */
637 HEAPF64: {},
638 /**
Kevin Lubick53965c92018-10-11 08:51:55 -0400639 * @type {Uint8Array}
640 */
641 HEAPU8: {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400642 /**
643 * @type {Uint16Array}
644 */
645 HEAPU16: {},
646 /**
Kevin Lubickf5ea37f2019-02-28 10:06:18 -0500647 * @type {Uint32Array}
648 */
649 HEAPU32: {},
Kevin Lubickfa5a1382019-10-09 10:46:14 -0400650 /**
651 * @type {Int8Array}
652 */
653 HEAP8: {},
654 /**
655 * @type {Int16Array}
656 */
657 HEAP16: {},
658 /**
659 * @type {Int32Array}
660 */
661 HEAP32: {},
662
Kevin Lubick006a6f32018-10-19 14:34:34 -0400663 _malloc: function() {},
664 _free: function() {},
665 onRuntimeInitialized: function() {},
666};
Kevin Lubick217056c2018-09-20 17:39:31 -0400667
Kevin Lubick006a6f32018-10-19 14:34:34 -0400668// Public API things that are newly declared in the JS should go here.
669// It's not enough to declare them above, because closure can still erase them
670// unless they go on the prototype.
Kevin Lubick369f6a52019-10-03 11:22:08 -0400671CanvasKit.Paragraph.prototype.getRectsForRange = function() {};
672
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500673CanvasKit.SkPath.prototype.addArc = function() {};
Kevin Lubicke384df42019-08-26 15:48:09 -0400674CanvasKit.SkPath.prototype.addOval = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400675CanvasKit.SkPath.prototype.addPath = function() {};
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500676CanvasKit.SkPath.prototype.addRect = function() {};
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500677CanvasKit.SkPath.prototype.addRoundRect = function() {};
Alexander Khovansky3e119332018-11-15 02:01:19 +0300678CanvasKit.SkPath.prototype.arc = function() {};
Kevin Lubick006a6f32018-10-19 14:34:34 -0400679CanvasKit.SkPath.prototype.arcTo = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400680CanvasKit.SkPath.prototype.close = function() {};
Kevin Lubick006a6f32018-10-19 14:34:34 -0400681CanvasKit.SkPath.prototype.conicTo = function() {};
682CanvasKit.SkPath.prototype.cubicTo = function() {};
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400683CanvasKit.SkPath.prototype.dash = function() {};
Kevin Lubick006a6f32018-10-19 14:34:34 -0400684CanvasKit.SkPath.prototype.lineTo = function() {};
685CanvasKit.SkPath.prototype.moveTo = function() {};
Kevin Lubicke384df42019-08-26 15:48:09 -0400686CanvasKit.SkPath.prototype.offset = function() {};
Kevin Lubick006a6f32018-10-19 14:34:34 -0400687CanvasKit.SkPath.prototype.op = function() {};
688CanvasKit.SkPath.prototype.quadTo = function() {};
689CanvasKit.SkPath.prototype.rect = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400690CanvasKit.SkPath.prototype.simplify = function() {};
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400691CanvasKit.SkPath.prototype.stroke = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400692CanvasKit.SkPath.prototype.transform = function() {};
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400693CanvasKit.SkPath.prototype.trim = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400694
Kevin Lubickcc13fd32019-04-05 13:00:01 -0400695CanvasKit.SkPicture.prototype.DEBUGONLY_saveAsFile = function() {};
696
Kevin Lubick5b90b842018-10-17 07:57:18 -0400697CanvasKit.SkSurface.prototype.dispose = function() {};
Kevin Lubick359a7e32019-03-19 09:34:37 -0400698CanvasKit.SkSurface.prototype.flush = function() {};
699CanvasKit.SkSurface.prototype.requestAnimationFrame = function() {};
Kevin Lubickcc13fd32019-04-05 13:00:01 -0400700CanvasKit.SkSurface.prototype.captureFrameAsSkPicture = function() {};
Kevin Lubick53965c92018-10-11 08:51:55 -0400701
Kevin Lubick12c0e502018-11-28 12:51:56 -0500702/** @return {CanvasKit.SkVertices} */
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400703CanvasKit.SkVertices.prototype.applyBones = function() {};
704
Alexander Khovansky3e119332018-11-15 02:01:19 +0300705CanvasKit.SkImage.prototype.encodeToData = function() {};
Kevin Lubicka064c282019-04-04 09:28:53 -0400706CanvasKit.SkImage.prototype.makeShader = function() {};
Alexander Khovansky3e119332018-11-15 02:01:19 +0300707
Kevin Lubickee91c072019-03-29 10:39:52 -0400708CanvasKit.SkCanvas.prototype.drawAtlas = function() {};
Kevin Lubickec4903d2019-01-14 08:36:08 -0500709CanvasKit.SkCanvas.prototype.drawText = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500710/** @return {Uint8Array} */
711CanvasKit.SkCanvas.prototype.readPixels = function() {};
712CanvasKit.SkCanvas.prototype.writePixels = function() {};
713
Kevin Lubickddd0a332018-12-12 10:35:13 -0500714CanvasKit.SkFontMgr.prototype.MakeTypefaceFromData = function() {};
715
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400716CanvasKit.SkFont.prototype.getWidths = function() {};
717
718CanvasKit.RSXFormBuilder.prototype.build = function() {};
719CanvasKit.RSXFormBuilder.prototype.delete = function() {};
720CanvasKit.RSXFormBuilder.prototype.push = function() {};
Kevin Lubickee91c072019-03-29 10:39:52 -0400721CanvasKit.RSXFormBuilder.prototype.set = function() {};
722
723CanvasKit.SkColorBuilder.prototype.build = function() {};
724CanvasKit.SkColorBuilder.prototype.delete = function() {};
725CanvasKit.SkColorBuilder.prototype.push = function() {};
726CanvasKit.SkColorBuilder.prototype.set = function() {};
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400727
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400728// Define StrokeOpts object
729var StrokeOpts = {};
730StrokeOpts.prototype.width;
731StrokeOpts.prototype.miter_limit;
732StrokeOpts.prototype.cap;
733StrokeOpts.prototype.join;
Kevin Lubick1646e7d2018-12-07 13:03:08 -0500734StrokeOpts.prototype.precision;
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400735
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500736// Define everything created in the canvas2d spec here
Kevin Lubickb9db3902018-11-26 11:47:54 -0500737var HTMLCanvas = {};
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500738HTMLCanvas.prototype.decodeImage = function() {};
739HTMLCanvas.prototype.dispose = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500740HTMLCanvas.prototype.getContext = function() {};
Kevin Lubick8e4a3312018-12-14 15:03:41 -0500741HTMLCanvas.prototype.loadFont = function() {};
Kevin Lubicka40f8322018-12-17 16:01:36 -0500742HTMLCanvas.prototype.makePath2D = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500743HTMLCanvas.prototype.toDataURL = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500744
745var CanvasRenderingContext2D = {};
746CanvasRenderingContext2D.prototype.addHitRegion = function() {};
747CanvasRenderingContext2D.prototype.arc = function() {};
748CanvasRenderingContext2D.prototype.arcTo = function() {};
749CanvasRenderingContext2D.prototype.beginPath = function() {};
750CanvasRenderingContext2D.prototype.bezierCurveTo = function() {};
751CanvasRenderingContext2D.prototype.clearHitRegions = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500752CanvasRenderingContext2D.prototype.clearRect = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500753CanvasRenderingContext2D.prototype.clip = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500754CanvasRenderingContext2D.prototype.closePath = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500755CanvasRenderingContext2D.prototype.createImageData = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500756CanvasRenderingContext2D.prototype.createLinearGradient = function() {};
Kevin Lubickd29edd72018-12-07 08:29:52 -0500757CanvasRenderingContext2D.prototype.createPattern = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500758CanvasRenderingContext2D.prototype.createRadialGradient = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500759CanvasRenderingContext2D.prototype.drawFocusIfNeeded = function() {};
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500760CanvasRenderingContext2D.prototype.drawImage = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500761CanvasRenderingContext2D.prototype.ellipse = function() {};
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500762CanvasRenderingContext2D.prototype.fill = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500763CanvasRenderingContext2D.prototype.fillRect = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500764CanvasRenderingContext2D.prototype.fillText = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500765CanvasRenderingContext2D.prototype.getImageData = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500766CanvasRenderingContext2D.prototype.getLineDash = function() {};
Kevin Lubick1646e7d2018-12-07 13:03:08 -0500767CanvasRenderingContext2D.prototype.isPointInPath = function() {};
768CanvasRenderingContext2D.prototype.isPointInStroke = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500769CanvasRenderingContext2D.prototype.lineTo = function() {};
770CanvasRenderingContext2D.prototype.measureText = function() {};
771CanvasRenderingContext2D.prototype.moveTo = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500772CanvasRenderingContext2D.prototype.putImageData = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500773CanvasRenderingContext2D.prototype.quadraticCurveTo = function() {};
774CanvasRenderingContext2D.prototype.rect = function() {};
775CanvasRenderingContext2D.prototype.removeHitRegion = function() {};
776CanvasRenderingContext2D.prototype.resetTransform = function() {};
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500777CanvasRenderingContext2D.prototype.restore = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500778CanvasRenderingContext2D.prototype.rotate = function() {};
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500779CanvasRenderingContext2D.prototype.save = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500780CanvasRenderingContext2D.prototype.scale = function() {};
781CanvasRenderingContext2D.prototype.scrollPathIntoView = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500782CanvasRenderingContext2D.prototype.setLineDash = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500783CanvasRenderingContext2D.prototype.setTransform = function() {};
784CanvasRenderingContext2D.prototype.stroke = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500785CanvasRenderingContext2D.prototype.strokeRect = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500786CanvasRenderingContext2D.prototype.strokeText = function() {};
787CanvasRenderingContext2D.prototype.transform = function() {};
788CanvasRenderingContext2D.prototype.translate = function() {};
789
Kevin Lubicka40f8322018-12-17 16:01:36 -0500790var Path2D = {};
791Path2D.prototype.addPath = function() {};
792Path2D.prototype.arc = function() {};
793Path2D.prototype.arcTo = function() {};
794Path2D.prototype.bezierCurveTo = function() {};
795Path2D.prototype.closePath = function() {};
796Path2D.prototype.ellipse = function() {};
797Path2D.prototype.lineTo = function() {};
798Path2D.prototype.moveTo = function() {};
799Path2D.prototype.quadraticCurveTo = function() {};
800Path2D.prototype.rect = function() {};
801
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500802var LinearCanvasGradient = {};
803LinearCanvasGradient.prototype.addColorStop = function() {};
804var RadialCanvasGradient = {};
805RadialCanvasGradient.prototype.addColorStop = function() {};
Kevin Lubickd29edd72018-12-07 08:29:52 -0500806var CanvasPattern = {};
807CanvasPattern.prototype.setTransform = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500808
Kevin Lubick52b9f372018-12-04 13:57:36 -0500809var ImageData = {
810 /**
811 * @type {Uint8ClampedArray}
812 */
813 data: {},
814 height: {},
815 width: {},
816};
817
Kevin Lubickd29edd72018-12-07 08:29:52 -0500818var DOMMatrix = {
819 a: {},
820 b: {},
821 c: {},
822 d: {},
823 e: {},
824 f: {},
825};
826
Kevin Lubick217056c2018-09-20 17:39:31 -0400827// 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 -0500828function loadWebAssemblyModule() {};