blob: 07bfe1d8e35584e9be3f94851a53f88d33b10ff6 [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 Lubick35ac0382019-01-02 15:13:57 -0500149 SkFont: {
150 // public API (from C++ bindings)
151 getScaleX: function() {},
152 getSize: function() {},
153 getSkewX: function() {},
154 getTypeface: function() {},
155 measureText: function() {},
156 setScaleX: function() {},
157 setSize: function() {},
158 setSkewX: function() {},
159 setTypeface: function() {},
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400160 // private API (from C++ bindings)
161 _getWidths: function() {},
Kevin Lubick35ac0382019-01-02 15:13:57 -0500162 },
163
Kevin Lubickddd0a332018-12-12 10:35:13 -0500164 SkFontMgr: {
165 // public API (from C++ bindings)
166 RefDefault: function() {},
167 countFamilies: function() {},
168
169 // private API
170 _makeTypefaceFromData: function() {},
171 },
172
Kevin Lubick006a6f32018-10-19 14:34:34 -0400173 SkImage: {
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500174 // public API (from C++ bindings)
175 height: function() {},
176 width: function() {},
Alexander Khovansky3e119332018-11-15 02:01:19 +0300177 // private API
178 _encodeToData: function() {},
179 _encodeToDataWithFormat: function() {},
Kevin Lubicka064c282019-04-04 09:28:53 -0400180 _makeShader: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400181 },
182
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500183 SkMatrix: {
Kevin Lubickb9db3902018-11-26 11:47:54 -0500184 identity: function() {},
Kevin Lubickf3555182019-03-14 10:55:10 -0400185 invert: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500186 mapPoints: function() {},
187 multiply: function() {},
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500188 rotated: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500189 scaled: function() {},
190 skewed: function() {},
191 translated: function() {},
192 },
193
194 SkPaint: {
195 // public API (from C++ bindings)
196 /** @return {CanvasKit.SkPaint} */
197 copy: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -0500198 getBlendMode: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500199 getColor: function() {},
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500200 getFilterQuality: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500201 getStrokeCap: function() {},
202 getStrokeJoin: function() {},
203 getStrokeMiter: function() {},
204 getStrokeWidth: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500205 setAntiAlias: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -0500206 setBlendMode: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500207 setColor: function() {},
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500208 setFilterQuality: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500209 setMaskFilter: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500210 setPathEffect: function() {},
211 setShader: function() {},
212 setStrokeCap: function() {},
213 setStrokeJoin: function() {},
214 setStrokeMiter: function() {},
215 setStrokeWidth: function() {},
216 setStyle: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500217
218 //private API
219 delete: function() {},
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500220 },
221
Kevin Lubick006a6f32018-10-19 14:34:34 -0400222 SkPath: {
223 // public API (from C++ bindings)
Kevin Lubickb9db3902018-11-26 11:47:54 -0500224 computeTightBounds: function() {},
Kevin Lubick1646e7d2018-12-07 13:03:08 -0500225 contains: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500226 /** @return {CanvasKit.SkPath} */
227 copy: function() {},
228 countPoints: function() {},
229 equals: function() {},
230 getBounds: function() {},
231 getFillType: function() {},
232 getPoint: function() {},
Kevin Lubick1646e7d2018-12-07 13:03:08 -0500233 isEmpty: function() {},
Kevin Lubick2b79d1c2018-12-14 16:10:38 -0500234 isVolatile: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500235 reset: function() {},
236 rewind: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500237 setFillType: function() {},
Kevin Lubick2b79d1c2018-12-14 16:10:38 -0500238 setIsVolatile: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500239 toSVGString: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400240
241 // private API
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500242 _addArc: function() {},
Kevin Lubicke384df42019-08-26 15:48:09 -0400243 _addOval: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400244 _addPath: function() {},
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500245 _addRect: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500246 _addRoundRect: function() {},
Alexander Khovansky3e119332018-11-15 02:01:19 +0300247 _arc: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400248 _arcTo: function() {},
249 _close: function() {},
250 _conicTo: function() {},
251 _cubicTo: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400252 _dash: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400253 _lineTo: function() {},
254 _moveTo: function() {},
255 _op: function() {},
256 _quadTo: function() {},
257 _rect: function() {},
258 _simplify: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400259 _stroke: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400260 _transform: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400261 _trim: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400262 delete: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500263 dump: function() {},
264 dumpHex: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400265 },
266
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400267 SkPathMeasure: {
268 getLength: function() {},
269 getPosTan: function() {},
270 isClosed: function() {},
271 nextContour: function() {},
272 },
273
Kevin Lubickcc13fd32019-04-05 13:00:01 -0400274 SkPicture: {
275 DEBUGONLY_serialize: function() {},
276 },
277
278 SkPictureRecorder: {
279 beginRecording: function() {},
280 finishRecordingAsPicture: function() {},
281 },
282
Kevin Lubick006a6f32018-10-19 14:34:34 -0400283 SkRect: {
284 fLeft: {},
285 fTop: {},
286 fRight: {},
287 fBottom: {},
288 },
289
Kevin Lubick2e5fe352019-09-03 12:59:06 -0400290 SkRRect: {
291 rect: {},
Kevin Lubick7d644e12019-09-11 14:22:22 -0400292 rx1: {},
293 ry1: {},
294 rx2: {},
295 ry2: {},
296 rx3: {},
297 ry3: {},
298 rx4: {},
299 ry4: {},
Kevin Lubick2e5fe352019-09-03 12:59:06 -0400300 },
301
Kevin Lubick006a6f32018-10-19 14:34:34 -0400302 SkSurface: {
303 // public API (from C++ bindings)
304 /** @return {CanvasKit.SkCanvas} */
305 getCanvas: function() {},
306 /** @return {CanvasKit.SkImage} */
307 makeImageSnapshot: function() {},
Kevin Lubick543f3522019-03-08 10:04:28 -0500308 makeSurface: function() {},
Kevin Lubickcd544662019-03-22 15:41:36 -0400309 grContext: {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400310
311 // private API
312 _flush: function() {},
313 _getRasterN32PremulSurface: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400314 delete: function() {},
315 },
316
Kevin Lubickec4903d2019-01-14 08:36:08 -0500317 SkTextBlob: {
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400318 // public API (both C++ and JS bindings)
319 MakeFromRSXform: function() {},
Kevin Lubickec4903d2019-01-14 08:36:08 -0500320 MakeFromText: function() {},
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400321 MakeOnPath: function() {},
322 // private API (from C++ bindings)
323 _MakeFromRSXform: function() {},
Kevin Lubickec4903d2019-01-14 08:36:08 -0500324 _MakeFromText: function() {},
325 },
326
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400327 SkVertices: {
328 // public API (from C++ bindings)
Kevin Lubick12c0e502018-11-28 12:51:56 -0500329 bounds: function() {},
330 mode: function() {},
331 uniqueID: function() {},
332 vertexCount: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400333
334 // private API
335 /** @return {CanvasKit.SkVertices} */
336 _applyBones: function() {},
337 },
338
Kevin Lubickd6ba7252019-06-03 14:38:05 -0400339 _SkVerticesBuilder: {
340 // public API (from C++ bindings)
341 boneIndices: function() {},
342 boneWeights: function() {},
343 colors: function() {},
344 detach: function() {},
345 indices: function() {},
346 positions: function() {},
347 texCoords: function() {},
348 },
349
Kevin Lubick006a6f32018-10-19 14:34:34 -0400350 // Constants and Enums
351 gpu: {},
352 skottie: {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400353
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500354 TRANSPARENT: {},
355 RED: {},
356 BLUE: {},
357 YELLOW: {},
358 CYAN: {},
359 BLACK: {},
Kevin Lubickea905ec2018-11-30 14:05:58 -0500360 WHITE: {},
361
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500362 MOVE_VERB: {},
363 LINE_VERB: {},
364 QUAD_VERB: {},
365 CONIC_VERB: {},
366 CUBIC_VERB: {},
367 CLOSE_VERB: {},
368
Kevin Lubickea905ec2018-11-30 14:05:58 -0500369 AlphaType: {
370 Opaque: {},
371 Premul: {},
372 Unpremul: {},
373 },
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500374
375 BlendMode: {
376 Clear: {},
377 Src: {},
378 Dst: {},
379 SrcOver: {},
380 DstOver: {},
381 SrcIn: {},
382 DstIn: {},
383 SrcOut: {},
384 DstOut: {},
385 SrcATop: {},
386 DstATop: {},
387 Xor: {},
388 Plus: {},
389 Modulate: {},
390 Screen: {},
391 Overlay: {},
392 Darken: {},
393 Lighten: {},
394 ColorDodge: {},
395 ColorBurn: {},
396 HardLight: {},
397 SoftLight: {},
398 Difference: {},
399 Exclusion: {},
400 Multiply: {},
401 Hue: {},
402 Saturation: {},
403 Color: {},
404 Luminosity: {},
405 },
406
407 BlurStyle: {
408 Normal: {},
409 Solid: {},
410 Outer: {},
411 Inner: {},
412 },
413
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500414 ClipOp: {
415 Difference: {},
416 Intersect: {},
417 },
418
Kevin Lubickea905ec2018-11-30 14:05:58 -0500419 ColorType: {
420 Alpha_8: {},
421 RGB_565: {},
422 ARGB_4444: {},
423 RGBA_8888: {},
424 RGB_888x: {},
425 BGRA_8888: {},
426 RGBA_1010102: {},
427 RGB_101010x: {},
428 Gray_8: {},
429 RGBA_F16: {},
430 RGBA_F32: {},
431 },
432
Kevin Lubick006a6f32018-10-19 14:34:34 -0400433 FillType: {
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500434 Winding: {},
435 EvenOdd: {},
436 InverseWinding: {},
437 InverseEvenOdd: {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400438 },
439
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500440 FilterQuality: {
441 None: {},
442 Low: {},
443 Medium: {},
444 High: {},
445 },
446
Alexander Khovansky3e119332018-11-15 02:01:19 +0300447 ImageFormat: {
448 PNG: {},
449 JPEG: {},
450 },
451
Kevin Lubickb9db3902018-11-26 11:47:54 -0500452 PaintStyle: {
453 Fill: {},
454 Stroke: {},
455 StrokeAndFill: {},
456 },
457
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500458 PathOp: {
459 Difference: {},
460 Intersect: {},
461 Union: {},
462 XOR: {},
463 ReverseDifference: {},
464 },
465
Kevin Lubickb9db3902018-11-26 11:47:54 -0500466 StrokeCap: {
467 Butt: {},
468 Round: {},
469 Square: {},
470 },
471
472 StrokeJoin: {
473 Miter: {},
474 Round: {},
475 Bevel: {},
476 },
477
Kevin Lubickec4903d2019-01-14 08:36:08 -0500478 TextEncoding: {
479 UTF8: {},
480 UTF16: {},
481 UTF32: {},
482 GlyphID: {},
483 },
484
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500485 TileMode: {
486 Clamp: {},
487 Repeat: {},
488 Mirror: {},
Kevin Lubickd29edd72018-12-07 08:29:52 -0500489 Decal: {},
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500490 },
491
492 VertexMode: {
493 Triangles: {},
494 TrianglesStrip: {},
495 TriangleFan: {},
496 },
497
Kevin Lubick006a6f32018-10-19 14:34:34 -0400498 // Things Enscriptem adds for us
499
Kevin Lubick53965c92018-10-11 08:51:55 -0400500 /** Represents the heap of the WASM code
501 * @type {ArrayBuffer}
502 */
503 buffer: {},
504 /**
505 * @type {Float32Array}
506 */
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400507 HEAPF32: {},
Kevin Lubick53965c92018-10-11 08:51:55 -0400508 /**
509 * @type {Uint8Array}
510 */
511 HEAPU8: {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400512 /**
513 * @type {Uint16Array}
514 */
515 HEAPU16: {},
516 /**
517 * @type {Int32Array}
518 */
519 HEAP32: {},
Kevin Lubickf5ea37f2019-02-28 10:06:18 -0500520 /**
521 * @type {Uint32Array}
522 */
523 HEAPU32: {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400524 _malloc: function() {},
525 _free: function() {},
526 onRuntimeInitialized: function() {},
527};
Kevin Lubick217056c2018-09-20 17:39:31 -0400528
Kevin Lubick006a6f32018-10-19 14:34:34 -0400529// Public API things that are newly declared in the JS should go here.
530// It's not enough to declare them above, because closure can still erase them
531// unless they go on the prototype.
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500532CanvasKit.SkPath.prototype.addArc = function() {};
Kevin Lubicke384df42019-08-26 15:48:09 -0400533CanvasKit.SkPath.prototype.addOval = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400534CanvasKit.SkPath.prototype.addPath = function() {};
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500535CanvasKit.SkPath.prototype.addRect = function() {};
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500536CanvasKit.SkPath.prototype.addRoundRect = function() {};
Alexander Khovansky3e119332018-11-15 02:01:19 +0300537CanvasKit.SkPath.prototype.arc = function() {};
Kevin Lubick006a6f32018-10-19 14:34:34 -0400538CanvasKit.SkPath.prototype.arcTo = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400539CanvasKit.SkPath.prototype.close = function() {};
Kevin Lubick006a6f32018-10-19 14:34:34 -0400540CanvasKit.SkPath.prototype.conicTo = function() {};
541CanvasKit.SkPath.prototype.cubicTo = function() {};
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400542CanvasKit.SkPath.prototype.dash = function() {};
Kevin Lubick006a6f32018-10-19 14:34:34 -0400543CanvasKit.SkPath.prototype.lineTo = function() {};
544CanvasKit.SkPath.prototype.moveTo = function() {};
Kevin Lubicke384df42019-08-26 15:48:09 -0400545CanvasKit.SkPath.prototype.offset = function() {};
Kevin Lubick006a6f32018-10-19 14:34:34 -0400546CanvasKit.SkPath.prototype.op = function() {};
547CanvasKit.SkPath.prototype.quadTo = function() {};
548CanvasKit.SkPath.prototype.rect = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400549CanvasKit.SkPath.prototype.simplify = function() {};
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400550CanvasKit.SkPath.prototype.stroke = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400551CanvasKit.SkPath.prototype.transform = function() {};
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400552CanvasKit.SkPath.prototype.trim = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400553
Kevin Lubickcc13fd32019-04-05 13:00:01 -0400554CanvasKit.SkPicture.prototype.DEBUGONLY_saveAsFile = function() {};
555
Kevin Lubick5b90b842018-10-17 07:57:18 -0400556CanvasKit.SkSurface.prototype.dispose = function() {};
Kevin Lubick359a7e32019-03-19 09:34:37 -0400557CanvasKit.SkSurface.prototype.flush = function() {};
558CanvasKit.SkSurface.prototype.requestAnimationFrame = function() {};
Kevin Lubickcc13fd32019-04-05 13:00:01 -0400559CanvasKit.SkSurface.prototype.captureFrameAsSkPicture = function() {};
Kevin Lubick53965c92018-10-11 08:51:55 -0400560
Kevin Lubick12c0e502018-11-28 12:51:56 -0500561/** @return {CanvasKit.SkVertices} */
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400562CanvasKit.SkVertices.prototype.applyBones = function() {};
563
Alexander Khovansky3e119332018-11-15 02:01:19 +0300564CanvasKit.SkImage.prototype.encodeToData = function() {};
Kevin Lubicka064c282019-04-04 09:28:53 -0400565CanvasKit.SkImage.prototype.makeShader = function() {};
Alexander Khovansky3e119332018-11-15 02:01:19 +0300566
Kevin Lubickee91c072019-03-29 10:39:52 -0400567CanvasKit.SkCanvas.prototype.drawAtlas = function() {};
Kevin Lubickec4903d2019-01-14 08:36:08 -0500568CanvasKit.SkCanvas.prototype.drawText = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500569/** @return {Uint8Array} */
570CanvasKit.SkCanvas.prototype.readPixels = function() {};
571CanvasKit.SkCanvas.prototype.writePixels = function() {};
572
Kevin Lubickddd0a332018-12-12 10:35:13 -0500573CanvasKit.SkFontMgr.prototype.MakeTypefaceFromData = function() {};
574
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400575CanvasKit.SkFont.prototype.getWidths = function() {};
576
577CanvasKit.RSXFormBuilder.prototype.build = function() {};
578CanvasKit.RSXFormBuilder.prototype.delete = function() {};
579CanvasKit.RSXFormBuilder.prototype.push = function() {};
Kevin Lubickee91c072019-03-29 10:39:52 -0400580CanvasKit.RSXFormBuilder.prototype.set = function() {};
581
582CanvasKit.SkColorBuilder.prototype.build = function() {};
583CanvasKit.SkColorBuilder.prototype.delete = function() {};
584CanvasKit.SkColorBuilder.prototype.push = function() {};
585CanvasKit.SkColorBuilder.prototype.set = function() {};
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400586
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400587// Define StrokeOpts object
588var StrokeOpts = {};
589StrokeOpts.prototype.width;
590StrokeOpts.prototype.miter_limit;
591StrokeOpts.prototype.cap;
592StrokeOpts.prototype.join;
Kevin Lubick1646e7d2018-12-07 13:03:08 -0500593StrokeOpts.prototype.precision;
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400594
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500595// Define everything created in the canvas2d spec here
Kevin Lubickb9db3902018-11-26 11:47:54 -0500596var HTMLCanvas = {};
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500597HTMLCanvas.prototype.decodeImage = function() {};
598HTMLCanvas.prototype.dispose = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500599HTMLCanvas.prototype.getContext = function() {};
Kevin Lubick8e4a3312018-12-14 15:03:41 -0500600HTMLCanvas.prototype.loadFont = function() {};
Kevin Lubicka40f8322018-12-17 16:01:36 -0500601HTMLCanvas.prototype.makePath2D = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500602HTMLCanvas.prototype.toDataURL = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500603
604var CanvasRenderingContext2D = {};
605CanvasRenderingContext2D.prototype.addHitRegion = function() {};
606CanvasRenderingContext2D.prototype.arc = function() {};
607CanvasRenderingContext2D.prototype.arcTo = function() {};
608CanvasRenderingContext2D.prototype.beginPath = function() {};
609CanvasRenderingContext2D.prototype.bezierCurveTo = function() {};
610CanvasRenderingContext2D.prototype.clearHitRegions = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500611CanvasRenderingContext2D.prototype.clearRect = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500612CanvasRenderingContext2D.prototype.clip = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500613CanvasRenderingContext2D.prototype.closePath = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500614CanvasRenderingContext2D.prototype.createImageData = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500615CanvasRenderingContext2D.prototype.createLinearGradient = function() {};
Kevin Lubickd29edd72018-12-07 08:29:52 -0500616CanvasRenderingContext2D.prototype.createPattern = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500617CanvasRenderingContext2D.prototype.createRadialGradient = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500618CanvasRenderingContext2D.prototype.drawFocusIfNeeded = function() {};
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500619CanvasRenderingContext2D.prototype.drawImage = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500620CanvasRenderingContext2D.prototype.ellipse = function() {};
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500621CanvasRenderingContext2D.prototype.fill = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500622CanvasRenderingContext2D.prototype.fillRect = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500623CanvasRenderingContext2D.prototype.fillText = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500624CanvasRenderingContext2D.prototype.getImageData = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500625CanvasRenderingContext2D.prototype.getLineDash = function() {};
Kevin Lubick1646e7d2018-12-07 13:03:08 -0500626CanvasRenderingContext2D.prototype.isPointInPath = function() {};
627CanvasRenderingContext2D.prototype.isPointInStroke = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500628CanvasRenderingContext2D.prototype.lineTo = function() {};
629CanvasRenderingContext2D.prototype.measureText = function() {};
630CanvasRenderingContext2D.prototype.moveTo = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500631CanvasRenderingContext2D.prototype.putImageData = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500632CanvasRenderingContext2D.prototype.quadraticCurveTo = function() {};
633CanvasRenderingContext2D.prototype.rect = function() {};
634CanvasRenderingContext2D.prototype.removeHitRegion = function() {};
635CanvasRenderingContext2D.prototype.resetTransform = function() {};
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500636CanvasRenderingContext2D.prototype.restore = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500637CanvasRenderingContext2D.prototype.rotate = function() {};
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500638CanvasRenderingContext2D.prototype.save = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500639CanvasRenderingContext2D.prototype.scale = function() {};
640CanvasRenderingContext2D.prototype.scrollPathIntoView = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500641CanvasRenderingContext2D.prototype.setLineDash = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500642CanvasRenderingContext2D.prototype.setTransform = function() {};
643CanvasRenderingContext2D.prototype.stroke = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500644CanvasRenderingContext2D.prototype.strokeRect = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500645CanvasRenderingContext2D.prototype.strokeText = function() {};
646CanvasRenderingContext2D.prototype.transform = function() {};
647CanvasRenderingContext2D.prototype.translate = function() {};
648
Kevin Lubicka40f8322018-12-17 16:01:36 -0500649var Path2D = {};
650Path2D.prototype.addPath = function() {};
651Path2D.prototype.arc = function() {};
652Path2D.prototype.arcTo = function() {};
653Path2D.prototype.bezierCurveTo = function() {};
654Path2D.prototype.closePath = function() {};
655Path2D.prototype.ellipse = function() {};
656Path2D.prototype.lineTo = function() {};
657Path2D.prototype.moveTo = function() {};
658Path2D.prototype.quadraticCurveTo = function() {};
659Path2D.prototype.rect = function() {};
660
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500661var LinearCanvasGradient = {};
662LinearCanvasGradient.prototype.addColorStop = function() {};
663var RadialCanvasGradient = {};
664RadialCanvasGradient.prototype.addColorStop = function() {};
Kevin Lubickd29edd72018-12-07 08:29:52 -0500665var CanvasPattern = {};
666CanvasPattern.prototype.setTransform = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500667
Kevin Lubick52b9f372018-12-04 13:57:36 -0500668var ImageData = {
669 /**
670 * @type {Uint8ClampedArray}
671 */
672 data: {},
673 height: {},
674 width: {},
675};
676
Kevin Lubickd29edd72018-12-07 08:29:52 -0500677var DOMMatrix = {
678 a: {},
679 b: {},
680 c: {},
681 d: {},
682 e: {},
683 f: {},
684};
685
Kevin Lubick217056c2018-09-20 17:39:31 -0400686// 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 -0500687function loadWebAssemblyModule() {};