blob: 27f3385e2eae3a425212300ece17192c26b78a88 [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 Lubick0a1293c2018-12-03 12:31:04 -050042 /** @return {CanvasKit.SkImage} */
43 MakeImageFromEncoded: function() {},
Kevin Lubickeb2f6b02018-11-29 15:07:02 -050044 /** @return {LinearCanvasGradient} */
Kevin Lubickb5ae3b52018-11-03 07:51:19 -040045 MakeLinearGradientShader: function() {},
Kevin Lubick543f3522019-03-08 10:04:28 -050046 MakeOnScreenGLSurface: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -050047 MakePathFromCmds: function() {},
Kevin Lubicka40f8322018-12-17 16:01:36 -050048 MakePathFromOp: function() {},
49 MakePathFromSVGString: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -050050 MakeRadialGradientShader: function() {},
Kevin Lubick543f3522019-03-08 10:04:28 -050051 MakeRenderTarget: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -050052 MakeSWCanvasSurface: function() {},
Kevin Lubickf5ea37f2019-02-28 10:06:18 -050053 MakeManagedAnimation: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -040054 MakeSkDashPathEffect: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -040055 MakeSkVertices: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -040056 MakeSurface: function() {},
Kevin Lubickeb2f6b02018-11-29 15:07:02 -050057 /** @return {RadialCanvasGradient} */
58 MakeTwoPointConicalGradientShader: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -050059 MakeWebGLCanvasSurface: function() {},
Kevin Lubick50f377e2019-09-11 15:23:00 -040060 /** @return {TonalColors} */
61 computeTonalColors: function() {},
Kevin Lubick217056c2018-09-20 17:39:31 -040062 currentContext: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -050063 getColorComponents: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -050064 getSkDataBytes: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -050065 multiplyByAlpha: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -040066 setCurrentContext: function() {},
Kevin Lubick217056c2018-09-20 17:39:31 -040067
68 // private API (i.e. things declared in the bindings that we use
69 // in the pre-js file)
Kevin Lubick52b9f372018-12-04 13:57:36 -050070 _MakeImage: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -040071 _MakeLinearGradientShader: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -050072 _MakePathFromCmds: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -040073 _MakeRadialGradientShader: function() {},
Kevin Lubickf5ea37f2019-02-28 10:06:18 -050074 _MakeManagedAnimation: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -040075 _MakeSkDashPathEffect: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -040076 _MakeSkVertices: function() {},
Kevin Lubickeb2f6b02018-11-29 15:07:02 -050077 _MakeTwoPointConicalGradientShader: function() {},
Kevin Lubick0a1293c2018-12-03 12:31:04 -050078 _decodeImage: function() {},
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -050079 _drawShapedText: function() {},
Kevin Lubickea905ec2018-11-30 14:05:58 -050080 _getRasterDirectSurface: function() {},
Kevin Lubick134be1d2018-10-30 15:05:04 -040081 _getRasterN32PremulSurface: function() {},
Kevin Lubick217056c2018-09-20 17:39:31 -040082
Kevin Lubick1a05fce2018-11-20 12:51:16 -050083 // The testing object is meant to expose internal functions
84 // for more fine-grained testing, e.g. parseColor
85 _testing: {},
86
Kevin Lubick217056c2018-09-20 17:39:31 -040087 // Objects and properties on CanvasKit
88
Kevin Lubickcd544662019-03-22 15:41:36 -040089 GrContext: {
90 // public API (from C++ bindings)
91 getResourceCacheLimitBytes: function() {},
92 getResourceCacheUsageBytes: function() {},
93 setResourceCacheLimitBytes: function() {},
94 },
95
Kevin Lubickd3cfbca2019-03-15 15:36:29 -040096 RSXFormBuilder: function() {},
Kevin Lubickee91c072019-03-29 10:39:52 -040097 SkColorBuilder: function() {},
98 SkRectBuilder: function() {},
Kevin Lubickd3cfbca2019-03-15 15:36:29 -040099
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -0500100 ShapedText: {
101 // public API (from C++ bindings)
102 getBounds: function() {},
103 },
104
Kevin Lubick006a6f32018-10-19 14:34:34 -0400105 SkCanvas: {
106 // public API (from C++ bindings)
107 clear: function() {},
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500108 clipPath: function() {},
Kevin Lubick5d5723c2018-12-07 10:09:11 -0500109 clipRect: function() {},
110 concat: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500111 drawArc: function() {},
Kevin Lubicke384df42019-08-26 15:48:09 -0400112 drawCircle: function() {},
Kevin Lubick2e5fe352019-09-03 12:59:06 -0400113 drawDRRect: function() {},
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500114 drawImage: function() {},
115 drawImageRect: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500116 drawLine: function() {},
117 drawOval: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400118 drawPaint: function() {},
119 drawPath: function() {},
Kevin Lubickcc13fd32019-04-05 13:00:01 -0400120 drawPicture: function() {},
Kevin Lubick2e5fe352019-09-03 12:59:06 -0400121 drawRRect: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -0500122 drawRect: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500123 drawRoundRect: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500124 drawShadow: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -0500125 drawText: function() {},
Kevin Lubickec4903d2019-01-14 08:36:08 -0500126 drawTextBlob: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -0500127 drawVertices: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400128 flush: function() {},
Kevin Lubick2e5fe352019-09-03 12:59:06 -0400129 getSaveCount: function() {},
Kevin Lubick5d5723c2018-12-07 10:09:11 -0500130 getTotalMatrix: function() {},
Kevin Lubick543f3522019-03-08 10:04:28 -0500131 makeSurface: function() {},
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500132 restore: function() {},
Kevin Lubickb3574c92019-03-06 08:25:36 -0500133 restoreToCount: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400134 rotate: function() {},
135 save: function() {},
Kevin Lubickb3574c92019-03-06 08:25:36 -0500136 saveLayer: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400137 scale: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400138 skew: function() {},
139 translate: function() {},
140
141 // private API
Kevin Lubickee91c072019-03-29 10:39:52 -0400142 _drawAtlas: function() {},
Kevin Lubickec4903d2019-01-14 08:36:08 -0500143 _drawSimpleText: function() {},
Kevin Lubick52b9f372018-12-04 13:57:36 -0500144 _readPixels: function() {},
145 _writePixels: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400146 delete: function() {},
147 },
148
Kevin Lubickd3729342019-09-12 11:11:25 -0400149 SkColorFilter: {
150 // public API (from C++ bindings and JS interface)
151 MakeBlend: function() {},
152 MakeCompose: function() {},
153 MakeLerp: function() {},
154 MakeLinearToSRGBGamma: function() {},
155 MakeMatrix: function() {},
156 MakeSRGBToLinearGamma: function() {},
157 // private API (from C++ bindings)
158 _makeMatrix: function() {},
159 },
160
161 SkColorMatrix: {
162 concat: function() {},
163 identity: function() {},
164 postTranslate: function() {},
165 rotated: function() {},
166 scaled: function() {},
167 },
168
Kevin Lubick35ac0382019-01-02 15:13:57 -0500169 SkFont: {
170 // public API (from C++ bindings)
171 getScaleX: function() {},
172 getSize: function() {},
173 getSkewX: function() {},
174 getTypeface: function() {},
175 measureText: function() {},
176 setScaleX: function() {},
177 setSize: function() {},
178 setSkewX: function() {},
179 setTypeface: function() {},
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400180 // private API (from C++ bindings)
181 _getWidths: function() {},
Kevin Lubick35ac0382019-01-02 15:13:57 -0500182 },
183
Kevin Lubickddd0a332018-12-12 10:35:13 -0500184 SkFontMgr: {
185 // public API (from C++ bindings)
186 RefDefault: function() {},
187 countFamilies: function() {},
188
189 // private API
190 _makeTypefaceFromData: function() {},
191 },
192
Kevin Lubick006a6f32018-10-19 14:34:34 -0400193 SkImage: {
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500194 // public API (from C++ bindings)
195 height: function() {},
196 width: function() {},
Alexander Khovansky3e119332018-11-15 02:01:19 +0300197 // private API
198 _encodeToData: function() {},
199 _encodeToDataWithFormat: function() {},
Kevin Lubicka064c282019-04-04 09:28:53 -0400200 _makeShader: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400201 },
202
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500203 SkMatrix: {
Kevin Lubickb9db3902018-11-26 11:47:54 -0500204 identity: function() {},
Kevin Lubickf3555182019-03-14 10:55:10 -0400205 invert: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500206 mapPoints: function() {},
207 multiply: function() {},
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500208 rotated: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500209 scaled: function() {},
210 skewed: function() {},
211 translated: function() {},
212 },
213
214 SkPaint: {
215 // public API (from C++ bindings)
216 /** @return {CanvasKit.SkPaint} */
217 copy: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -0500218 getBlendMode: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500219 getColor: function() {},
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500220 getFilterQuality: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500221 getStrokeCap: function() {},
222 getStrokeJoin: function() {},
223 getStrokeMiter: function() {},
224 getStrokeWidth: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500225 setAntiAlias: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -0500226 setBlendMode: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500227 setColor: function() {},
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500228 setFilterQuality: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500229 setMaskFilter: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500230 setPathEffect: function() {},
231 setShader: function() {},
232 setStrokeCap: function() {},
233 setStrokeJoin: function() {},
234 setStrokeMiter: function() {},
235 setStrokeWidth: function() {},
236 setStyle: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500237
238 //private API
239 delete: function() {},
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500240 },
241
Kevin Lubick006a6f32018-10-19 14:34:34 -0400242 SkPath: {
243 // public API (from C++ bindings)
Kevin Lubickb9db3902018-11-26 11:47:54 -0500244 computeTightBounds: function() {},
Kevin Lubick1646e7d2018-12-07 13:03:08 -0500245 contains: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500246 /** @return {CanvasKit.SkPath} */
247 copy: function() {},
248 countPoints: function() {},
249 equals: function() {},
250 getBounds: function() {},
251 getFillType: function() {},
252 getPoint: function() {},
Kevin Lubick1646e7d2018-12-07 13:03:08 -0500253 isEmpty: function() {},
Kevin Lubick2b79d1c2018-12-14 16:10:38 -0500254 isVolatile: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500255 reset: function() {},
256 rewind: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500257 setFillType: function() {},
Kevin Lubick2b79d1c2018-12-14 16:10:38 -0500258 setIsVolatile: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500259 toSVGString: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400260
261 // private API
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500262 _addArc: function() {},
Kevin Lubicke384df42019-08-26 15:48:09 -0400263 _addOval: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400264 _addPath: function() {},
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500265 _addRect: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500266 _addRoundRect: function() {},
Alexander Khovansky3e119332018-11-15 02:01:19 +0300267 _arc: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400268 _arcTo: function() {},
269 _close: function() {},
270 _conicTo: function() {},
271 _cubicTo: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400272 _dash: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400273 _lineTo: function() {},
274 _moveTo: function() {},
275 _op: function() {},
276 _quadTo: function() {},
277 _rect: function() {},
278 _simplify: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400279 _stroke: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400280 _transform: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400281 _trim: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400282 delete: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500283 dump: function() {},
284 dumpHex: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400285 },
286
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400287 SkPathMeasure: {
288 getLength: function() {},
289 getPosTan: function() {},
290 isClosed: function() {},
291 nextContour: function() {},
292 },
293
Kevin Lubickcc13fd32019-04-05 13:00:01 -0400294 SkPicture: {
295 DEBUGONLY_serialize: function() {},
296 },
297
298 SkPictureRecorder: {
299 beginRecording: function() {},
300 finishRecordingAsPicture: function() {},
301 },
302
Kevin Lubick006a6f32018-10-19 14:34:34 -0400303 SkRect: {
304 fLeft: {},
305 fTop: {},
306 fRight: {},
307 fBottom: {},
308 },
309
Kevin Lubick2e5fe352019-09-03 12:59:06 -0400310 SkRRect: {
311 rect: {},
Kevin Lubick7d644e12019-09-11 14:22:22 -0400312 rx1: {},
313 ry1: {},
314 rx2: {},
315 ry2: {},
316 rx3: {},
317 ry3: {},
318 rx4: {},
319 ry4: {},
Kevin Lubick2e5fe352019-09-03 12:59:06 -0400320 },
321
Kevin Lubick006a6f32018-10-19 14:34:34 -0400322 SkSurface: {
323 // public API (from C++ bindings)
324 /** @return {CanvasKit.SkCanvas} */
325 getCanvas: function() {},
326 /** @return {CanvasKit.SkImage} */
327 makeImageSnapshot: function() {},
Kevin Lubick543f3522019-03-08 10:04:28 -0500328 makeSurface: function() {},
Kevin Lubickcd544662019-03-22 15:41:36 -0400329 grContext: {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400330
331 // private API
332 _flush: function() {},
333 _getRasterN32PremulSurface: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400334 delete: function() {},
335 },
336
Kevin Lubickec4903d2019-01-14 08:36:08 -0500337 SkTextBlob: {
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400338 // public API (both C++ and JS bindings)
339 MakeFromRSXform: function() {},
Kevin Lubickec4903d2019-01-14 08:36:08 -0500340 MakeFromText: function() {},
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400341 MakeOnPath: function() {},
342 // private API (from C++ bindings)
343 _MakeFromRSXform: function() {},
Kevin Lubickec4903d2019-01-14 08:36:08 -0500344 _MakeFromText: function() {},
345 },
346
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400347 SkVertices: {
348 // public API (from C++ bindings)
Kevin Lubick12c0e502018-11-28 12:51:56 -0500349 bounds: function() {},
350 mode: function() {},
351 uniqueID: function() {},
352 vertexCount: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400353
354 // private API
355 /** @return {CanvasKit.SkVertices} */
356 _applyBones: function() {},
357 },
358
Kevin Lubickd6ba7252019-06-03 14:38:05 -0400359 _SkVerticesBuilder: {
360 // public API (from C++ bindings)
361 boneIndices: function() {},
362 boneWeights: function() {},
363 colors: function() {},
364 detach: function() {},
365 indices: function() {},
366 positions: function() {},
367 texCoords: function() {},
368 },
369
Kevin Lubick006a6f32018-10-19 14:34:34 -0400370 // Constants and Enums
371 gpu: {},
372 skottie: {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400373
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500374 TRANSPARENT: {},
375 RED: {},
376 BLUE: {},
377 YELLOW: {},
378 CYAN: {},
379 BLACK: {},
Kevin Lubickea905ec2018-11-30 14:05:58 -0500380 WHITE: {},
381
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500382 MOVE_VERB: {},
383 LINE_VERB: {},
384 QUAD_VERB: {},
385 CONIC_VERB: {},
386 CUBIC_VERB: {},
387 CLOSE_VERB: {},
388
Kevin Lubickea905ec2018-11-30 14:05:58 -0500389 AlphaType: {
390 Opaque: {},
391 Premul: {},
392 Unpremul: {},
393 },
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500394
395 BlendMode: {
396 Clear: {},
397 Src: {},
398 Dst: {},
399 SrcOver: {},
400 DstOver: {},
401 SrcIn: {},
402 DstIn: {},
403 SrcOut: {},
404 DstOut: {},
405 SrcATop: {},
406 DstATop: {},
407 Xor: {},
408 Plus: {},
409 Modulate: {},
410 Screen: {},
411 Overlay: {},
412 Darken: {},
413 Lighten: {},
414 ColorDodge: {},
415 ColorBurn: {},
416 HardLight: {},
417 SoftLight: {},
418 Difference: {},
419 Exclusion: {},
420 Multiply: {},
421 Hue: {},
422 Saturation: {},
423 Color: {},
424 Luminosity: {},
425 },
426
427 BlurStyle: {
428 Normal: {},
429 Solid: {},
430 Outer: {},
431 Inner: {},
432 },
433
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500434 ClipOp: {
435 Difference: {},
436 Intersect: {},
437 },
438
Kevin Lubickea905ec2018-11-30 14:05:58 -0500439 ColorType: {
440 Alpha_8: {},
441 RGB_565: {},
442 ARGB_4444: {},
443 RGBA_8888: {},
444 RGB_888x: {},
445 BGRA_8888: {},
446 RGBA_1010102: {},
447 RGB_101010x: {},
448 Gray_8: {},
449 RGBA_F16: {},
450 RGBA_F32: {},
451 },
452
Kevin Lubick006a6f32018-10-19 14:34:34 -0400453 FillType: {
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500454 Winding: {},
455 EvenOdd: {},
456 InverseWinding: {},
457 InverseEvenOdd: {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400458 },
459
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500460 FilterQuality: {
461 None: {},
462 Low: {},
463 Medium: {},
464 High: {},
465 },
466
Alexander Khovansky3e119332018-11-15 02:01:19 +0300467 ImageFormat: {
468 PNG: {},
469 JPEG: {},
470 },
471
Kevin Lubickb9db3902018-11-26 11:47:54 -0500472 PaintStyle: {
473 Fill: {},
474 Stroke: {},
475 StrokeAndFill: {},
476 },
477
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500478 PathOp: {
479 Difference: {},
480 Intersect: {},
481 Union: {},
482 XOR: {},
483 ReverseDifference: {},
484 },
485
Kevin Lubickb9db3902018-11-26 11:47:54 -0500486 StrokeCap: {
487 Butt: {},
488 Round: {},
489 Square: {},
490 },
491
492 StrokeJoin: {
493 Miter: {},
494 Round: {},
495 Bevel: {},
496 },
497
Kevin Lubickec4903d2019-01-14 08:36:08 -0500498 TextEncoding: {
499 UTF8: {},
500 UTF16: {},
501 UTF32: {},
502 GlyphID: {},
503 },
504
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500505 TileMode: {
506 Clamp: {},
507 Repeat: {},
508 Mirror: {},
Kevin Lubickd29edd72018-12-07 08:29:52 -0500509 Decal: {},
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500510 },
511
512 VertexMode: {
513 Triangles: {},
514 TrianglesStrip: {},
515 TriangleFan: {},
516 },
517
Kevin Lubick006a6f32018-10-19 14:34:34 -0400518 // Things Enscriptem adds for us
519
Kevin Lubick53965c92018-10-11 08:51:55 -0400520 /** Represents the heap of the WASM code
521 * @type {ArrayBuffer}
522 */
523 buffer: {},
524 /**
525 * @type {Float32Array}
526 */
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400527 HEAPF32: {},
Kevin Lubick53965c92018-10-11 08:51:55 -0400528 /**
529 * @type {Uint8Array}
530 */
531 HEAPU8: {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400532 /**
533 * @type {Uint16Array}
534 */
535 HEAPU16: {},
536 /**
537 * @type {Int32Array}
538 */
539 HEAP32: {},
Kevin Lubickf5ea37f2019-02-28 10:06:18 -0500540 /**
541 * @type {Uint32Array}
542 */
543 HEAPU32: {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400544 _malloc: function() {},
545 _free: function() {},
546 onRuntimeInitialized: function() {},
547};
Kevin Lubick217056c2018-09-20 17:39:31 -0400548
Kevin Lubick006a6f32018-10-19 14:34:34 -0400549// Public API things that are newly declared in the JS should go here.
550// It's not enough to declare them above, because closure can still erase them
551// unless they go on the prototype.
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500552CanvasKit.SkPath.prototype.addArc = function() {};
Kevin Lubicke384df42019-08-26 15:48:09 -0400553CanvasKit.SkPath.prototype.addOval = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400554CanvasKit.SkPath.prototype.addPath = function() {};
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500555CanvasKit.SkPath.prototype.addRect = function() {};
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500556CanvasKit.SkPath.prototype.addRoundRect = function() {};
Alexander Khovansky3e119332018-11-15 02:01:19 +0300557CanvasKit.SkPath.prototype.arc = function() {};
Kevin Lubick006a6f32018-10-19 14:34:34 -0400558CanvasKit.SkPath.prototype.arcTo = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400559CanvasKit.SkPath.prototype.close = function() {};
Kevin Lubick006a6f32018-10-19 14:34:34 -0400560CanvasKit.SkPath.prototype.conicTo = function() {};
561CanvasKit.SkPath.prototype.cubicTo = function() {};
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400562CanvasKit.SkPath.prototype.dash = function() {};
Kevin Lubick006a6f32018-10-19 14:34:34 -0400563CanvasKit.SkPath.prototype.lineTo = function() {};
564CanvasKit.SkPath.prototype.moveTo = function() {};
Kevin Lubicke384df42019-08-26 15:48:09 -0400565CanvasKit.SkPath.prototype.offset = function() {};
Kevin Lubick006a6f32018-10-19 14:34:34 -0400566CanvasKit.SkPath.prototype.op = function() {};
567CanvasKit.SkPath.prototype.quadTo = function() {};
568CanvasKit.SkPath.prototype.rect = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400569CanvasKit.SkPath.prototype.simplify = function() {};
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400570CanvasKit.SkPath.prototype.stroke = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400571CanvasKit.SkPath.prototype.transform = function() {};
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400572CanvasKit.SkPath.prototype.trim = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400573
Kevin Lubickcc13fd32019-04-05 13:00:01 -0400574CanvasKit.SkPicture.prototype.DEBUGONLY_saveAsFile = function() {};
575
Kevin Lubick5b90b842018-10-17 07:57:18 -0400576CanvasKit.SkSurface.prototype.dispose = function() {};
Kevin Lubick359a7e32019-03-19 09:34:37 -0400577CanvasKit.SkSurface.prototype.flush = function() {};
578CanvasKit.SkSurface.prototype.requestAnimationFrame = function() {};
Kevin Lubickcc13fd32019-04-05 13:00:01 -0400579CanvasKit.SkSurface.prototype.captureFrameAsSkPicture = function() {};
Kevin Lubick53965c92018-10-11 08:51:55 -0400580
Kevin Lubick12c0e502018-11-28 12:51:56 -0500581/** @return {CanvasKit.SkVertices} */
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400582CanvasKit.SkVertices.prototype.applyBones = function() {};
583
Alexander Khovansky3e119332018-11-15 02:01:19 +0300584CanvasKit.SkImage.prototype.encodeToData = function() {};
Kevin Lubicka064c282019-04-04 09:28:53 -0400585CanvasKit.SkImage.prototype.makeShader = function() {};
Alexander Khovansky3e119332018-11-15 02:01:19 +0300586
Kevin Lubickee91c072019-03-29 10:39:52 -0400587CanvasKit.SkCanvas.prototype.drawAtlas = function() {};
Kevin Lubickec4903d2019-01-14 08:36:08 -0500588CanvasKit.SkCanvas.prototype.drawText = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500589/** @return {Uint8Array} */
590CanvasKit.SkCanvas.prototype.readPixels = function() {};
591CanvasKit.SkCanvas.prototype.writePixels = function() {};
592
Kevin Lubickddd0a332018-12-12 10:35:13 -0500593CanvasKit.SkFontMgr.prototype.MakeTypefaceFromData = function() {};
594
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400595CanvasKit.SkFont.prototype.getWidths = function() {};
596
597CanvasKit.RSXFormBuilder.prototype.build = function() {};
598CanvasKit.RSXFormBuilder.prototype.delete = function() {};
599CanvasKit.RSXFormBuilder.prototype.push = function() {};
Kevin Lubickee91c072019-03-29 10:39:52 -0400600CanvasKit.RSXFormBuilder.prototype.set = function() {};
601
602CanvasKit.SkColorBuilder.prototype.build = function() {};
603CanvasKit.SkColorBuilder.prototype.delete = function() {};
604CanvasKit.SkColorBuilder.prototype.push = function() {};
605CanvasKit.SkColorBuilder.prototype.set = function() {};
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400606
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400607// Define StrokeOpts object
608var StrokeOpts = {};
609StrokeOpts.prototype.width;
610StrokeOpts.prototype.miter_limit;
611StrokeOpts.prototype.cap;
612StrokeOpts.prototype.join;
Kevin Lubick1646e7d2018-12-07 13:03:08 -0500613StrokeOpts.prototype.precision;
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400614
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500615// Define everything created in the canvas2d spec here
Kevin Lubickb9db3902018-11-26 11:47:54 -0500616var HTMLCanvas = {};
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500617HTMLCanvas.prototype.decodeImage = function() {};
618HTMLCanvas.prototype.dispose = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500619HTMLCanvas.prototype.getContext = function() {};
Kevin Lubick8e4a3312018-12-14 15:03:41 -0500620HTMLCanvas.prototype.loadFont = function() {};
Kevin Lubicka40f8322018-12-17 16:01:36 -0500621HTMLCanvas.prototype.makePath2D = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500622HTMLCanvas.prototype.toDataURL = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500623
624var CanvasRenderingContext2D = {};
625CanvasRenderingContext2D.prototype.addHitRegion = function() {};
626CanvasRenderingContext2D.prototype.arc = function() {};
627CanvasRenderingContext2D.prototype.arcTo = function() {};
628CanvasRenderingContext2D.prototype.beginPath = function() {};
629CanvasRenderingContext2D.prototype.bezierCurveTo = function() {};
630CanvasRenderingContext2D.prototype.clearHitRegions = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500631CanvasRenderingContext2D.prototype.clearRect = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500632CanvasRenderingContext2D.prototype.clip = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500633CanvasRenderingContext2D.prototype.closePath = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500634CanvasRenderingContext2D.prototype.createImageData = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500635CanvasRenderingContext2D.prototype.createLinearGradient = function() {};
Kevin Lubickd29edd72018-12-07 08:29:52 -0500636CanvasRenderingContext2D.prototype.createPattern = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500637CanvasRenderingContext2D.prototype.createRadialGradient = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500638CanvasRenderingContext2D.prototype.drawFocusIfNeeded = function() {};
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500639CanvasRenderingContext2D.prototype.drawImage = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500640CanvasRenderingContext2D.prototype.ellipse = function() {};
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500641CanvasRenderingContext2D.prototype.fill = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500642CanvasRenderingContext2D.prototype.fillRect = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500643CanvasRenderingContext2D.prototype.fillText = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500644CanvasRenderingContext2D.prototype.getImageData = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500645CanvasRenderingContext2D.prototype.getLineDash = function() {};
Kevin Lubick1646e7d2018-12-07 13:03:08 -0500646CanvasRenderingContext2D.prototype.isPointInPath = function() {};
647CanvasRenderingContext2D.prototype.isPointInStroke = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500648CanvasRenderingContext2D.prototype.lineTo = function() {};
649CanvasRenderingContext2D.prototype.measureText = function() {};
650CanvasRenderingContext2D.prototype.moveTo = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500651CanvasRenderingContext2D.prototype.putImageData = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500652CanvasRenderingContext2D.prototype.quadraticCurveTo = function() {};
653CanvasRenderingContext2D.prototype.rect = function() {};
654CanvasRenderingContext2D.prototype.removeHitRegion = function() {};
655CanvasRenderingContext2D.prototype.resetTransform = function() {};
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500656CanvasRenderingContext2D.prototype.restore = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500657CanvasRenderingContext2D.prototype.rotate = function() {};
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500658CanvasRenderingContext2D.prototype.save = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500659CanvasRenderingContext2D.prototype.scale = function() {};
660CanvasRenderingContext2D.prototype.scrollPathIntoView = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500661CanvasRenderingContext2D.prototype.setLineDash = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500662CanvasRenderingContext2D.prototype.setTransform = function() {};
663CanvasRenderingContext2D.prototype.stroke = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500664CanvasRenderingContext2D.prototype.strokeRect = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500665CanvasRenderingContext2D.prototype.strokeText = function() {};
666CanvasRenderingContext2D.prototype.transform = function() {};
667CanvasRenderingContext2D.prototype.translate = function() {};
668
Kevin Lubicka40f8322018-12-17 16:01:36 -0500669var Path2D = {};
670Path2D.prototype.addPath = function() {};
671Path2D.prototype.arc = function() {};
672Path2D.prototype.arcTo = function() {};
673Path2D.prototype.bezierCurveTo = function() {};
674Path2D.prototype.closePath = function() {};
675Path2D.prototype.ellipse = function() {};
676Path2D.prototype.lineTo = function() {};
677Path2D.prototype.moveTo = function() {};
678Path2D.prototype.quadraticCurveTo = function() {};
679Path2D.prototype.rect = function() {};
680
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500681var LinearCanvasGradient = {};
682LinearCanvasGradient.prototype.addColorStop = function() {};
683var RadialCanvasGradient = {};
684RadialCanvasGradient.prototype.addColorStop = function() {};
Kevin Lubickd29edd72018-12-07 08:29:52 -0500685var CanvasPattern = {};
686CanvasPattern.prototype.setTransform = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500687
Kevin Lubick52b9f372018-12-04 13:57:36 -0500688var ImageData = {
689 /**
690 * @type {Uint8ClampedArray}
691 */
692 data: {},
693 height: {},
694 width: {},
695};
696
Kevin Lubickd29edd72018-12-07 08:29:52 -0500697var DOMMatrix = {
698 a: {},
699 b: {},
700 c: {},
701 d: {},
702 e: {},
703 f: {},
704};
705
Kevin Lubick217056c2018-09-20 17:39:31 -0400706// 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 -0500707function loadWebAssemblyModule() {};