blob: 24ce99fddc485840a4e0ef5cbe061232e3ca3f2e [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 Lubick52b9f372018-12-04 13:57:36 -050032 /** @return {ImageData} */
33 ImageData: function() {},
Kevin Lubick543f3522019-03-08 10:04:28 -050034
35 GetWebGLContext: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -050036 MakeBlurMaskFilter: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -040037 MakeCanvas: function() {},
38 MakeCanvasSurface: function() {},
Kevin Lubick543f3522019-03-08 10:04:28 -050039 MakeGrContext: function() {},
Kevin Lubick0a1293c2018-12-03 12:31:04 -050040 /** @return {CanvasKit.SkImage} */
41 MakeImageFromEncoded: function() {},
Kevin Lubickeb2f6b02018-11-29 15:07:02 -050042 /** @return {LinearCanvasGradient} */
Kevin Lubickb5ae3b52018-11-03 07:51:19 -040043 MakeLinearGradientShader: function() {},
Kevin Lubick543f3522019-03-08 10:04:28 -050044 MakeOnScreenGLSurface: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -050045 MakePathFromCmds: function() {},
Kevin Lubicka40f8322018-12-17 16:01:36 -050046 MakePathFromOp: function() {},
47 MakePathFromSVGString: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -050048 MakeRadialGradientShader: function() {},
Kevin Lubick543f3522019-03-08 10:04:28 -050049 MakeRenderTarget: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -050050 MakeSWCanvasSurface: function() {},
Kevin Lubickf5ea37f2019-02-28 10:06:18 -050051 MakeManagedAnimation: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -040052 MakeSkDashPathEffect: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -040053 MakeSkVertices: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -040054 MakeSurface: function() {},
Kevin Lubickeb2f6b02018-11-29 15:07:02 -050055 /** @return {RadialCanvasGradient} */
56 MakeTwoPointConicalGradientShader: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -050057 MakeWebGLCanvasSurface: function() {},
Kevin Lubick217056c2018-09-20 17:39:31 -040058 currentContext: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -050059 getColorComponents: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -050060 getSkDataBytes: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -050061 multiplyByAlpha: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -040062 setCurrentContext: function() {},
Kevin Lubick217056c2018-09-20 17:39:31 -040063
64 // private API (i.e. things declared in the bindings that we use
65 // in the pre-js file)
Kevin Lubick52b9f372018-12-04 13:57:36 -050066 _MakeImage: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -040067 _MakeLinearGradientShader: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -050068 _MakePathFromCmds: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -040069 _MakeRadialGradientShader: function() {},
Kevin Lubickf5ea37f2019-02-28 10:06:18 -050070 _MakeManagedAnimation: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -040071 _MakeSkDashPathEffect: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -040072 _MakeSkVertices: function() {},
Kevin Lubickeb2f6b02018-11-29 15:07:02 -050073 _MakeTwoPointConicalGradientShader: function() {},
Kevin Lubick0a1293c2018-12-03 12:31:04 -050074 _decodeImage: function() {},
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -050075 _drawShapedText: function() {},
Kevin Lubickea905ec2018-11-30 14:05:58 -050076 _getRasterDirectSurface: function() {},
Kevin Lubick134be1d2018-10-30 15:05:04 -040077 _getRasterN32PremulSurface: function() {},
Kevin Lubick217056c2018-09-20 17:39:31 -040078
Kevin Lubick1a05fce2018-11-20 12:51:16 -050079 // The testing object is meant to expose internal functions
80 // for more fine-grained testing, e.g. parseColor
81 _testing: {},
82
Kevin Lubick217056c2018-09-20 17:39:31 -040083 // Objects and properties on CanvasKit
84
Kevin Lubickcd544662019-03-22 15:41:36 -040085 GrContext: {
86 // public API (from C++ bindings)
87 getResourceCacheLimitBytes: function() {},
88 getResourceCacheUsageBytes: function() {},
89 setResourceCacheLimitBytes: function() {},
90 },
91
Kevin Lubickd3cfbca2019-03-15 15:36:29 -040092 RSXFormBuilder: function() {},
Kevin Lubickee91c072019-03-29 10:39:52 -040093 SkColorBuilder: function() {},
94 SkRectBuilder: function() {},
Kevin Lubickd3cfbca2019-03-15 15:36:29 -040095
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -050096 ShapedText: {
97 // public API (from C++ bindings)
98 getBounds: function() {},
99 },
100
Kevin Lubick006a6f32018-10-19 14:34:34 -0400101 SkCanvas: {
102 // public API (from C++ bindings)
103 clear: function() {},
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500104 clipPath: function() {},
Kevin Lubick5d5723c2018-12-07 10:09:11 -0500105 clipRect: function() {},
106 concat: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500107 drawArc: function() {},
Kevin Lubicke384df42019-08-26 15:48:09 -0400108 drawCircle: function() {},
Kevin Lubick2e5fe352019-09-03 12:59:06 -0400109 drawDRRect: function() {},
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500110 drawImage: function() {},
111 drawImageRect: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500112 drawLine: function() {},
113 drawOval: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400114 drawPaint: function() {},
115 drawPath: function() {},
Kevin Lubickcc13fd32019-04-05 13:00:01 -0400116 drawPicture: function() {},
Kevin Lubick2e5fe352019-09-03 12:59:06 -0400117 drawRRect: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -0500118 drawRect: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500119 drawRoundRect: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500120 drawShadow: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -0500121 drawText: function() {},
Kevin Lubickec4903d2019-01-14 08:36:08 -0500122 drawTextBlob: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -0500123 drawVertices: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400124 flush: function() {},
Kevin Lubick2e5fe352019-09-03 12:59:06 -0400125 getSaveCount: function() {},
Kevin Lubick5d5723c2018-12-07 10:09:11 -0500126 getTotalMatrix: function() {},
Kevin Lubick543f3522019-03-08 10:04:28 -0500127 makeSurface: function() {},
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500128 restore: function() {},
Kevin Lubickb3574c92019-03-06 08:25:36 -0500129 restoreToCount: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400130 rotate: function() {},
131 save: function() {},
Kevin Lubickb3574c92019-03-06 08:25:36 -0500132 saveLayer: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400133 scale: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400134 skew: function() {},
135 translate: function() {},
136
137 // private API
Kevin Lubickee91c072019-03-29 10:39:52 -0400138 _drawAtlas: function() {},
Kevin Lubickec4903d2019-01-14 08:36:08 -0500139 _drawSimpleText: function() {},
Kevin Lubick52b9f372018-12-04 13:57:36 -0500140 _readPixels: function() {},
141 _writePixels: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400142 delete: function() {},
143 },
144
Kevin Lubick35ac0382019-01-02 15:13:57 -0500145 SkFont: {
146 // public API (from C++ bindings)
147 getScaleX: function() {},
148 getSize: function() {},
149 getSkewX: function() {},
150 getTypeface: function() {},
151 measureText: function() {},
152 setScaleX: function() {},
153 setSize: function() {},
154 setSkewX: function() {},
155 setTypeface: function() {},
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400156 // private API (from C++ bindings)
157 _getWidths: function() {},
Kevin Lubick35ac0382019-01-02 15:13:57 -0500158 },
159
Kevin Lubickddd0a332018-12-12 10:35:13 -0500160 SkFontMgr: {
161 // public API (from C++ bindings)
162 RefDefault: function() {},
163 countFamilies: function() {},
164
165 // private API
166 _makeTypefaceFromData: function() {},
167 },
168
Kevin Lubick006a6f32018-10-19 14:34:34 -0400169 SkImage: {
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500170 // public API (from C++ bindings)
171 height: function() {},
172 width: function() {},
Alexander Khovansky3e119332018-11-15 02:01:19 +0300173 // private API
174 _encodeToData: function() {},
175 _encodeToDataWithFormat: function() {},
Kevin Lubicka064c282019-04-04 09:28:53 -0400176 _makeShader: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400177 },
178
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500179 SkMatrix: {
Kevin Lubickb9db3902018-11-26 11:47:54 -0500180 identity: function() {},
Kevin Lubickf3555182019-03-14 10:55:10 -0400181 invert: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500182 mapPoints: function() {},
183 multiply: function() {},
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500184 rotated: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500185 scaled: function() {},
186 skewed: function() {},
187 translated: function() {},
188 },
189
190 SkPaint: {
191 // public API (from C++ bindings)
192 /** @return {CanvasKit.SkPaint} */
193 copy: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -0500194 getBlendMode: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500195 getColor: function() {},
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500196 getFilterQuality: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500197 getStrokeCap: function() {},
198 getStrokeJoin: function() {},
199 getStrokeMiter: function() {},
200 getStrokeWidth: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500201 setAntiAlias: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -0500202 setBlendMode: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500203 setColor: function() {},
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500204 setFilterQuality: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500205 setMaskFilter: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500206 setPathEffect: function() {},
207 setShader: function() {},
208 setStrokeCap: function() {},
209 setStrokeJoin: function() {},
210 setStrokeMiter: function() {},
211 setStrokeWidth: function() {},
212 setStyle: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500213
214 //private API
215 delete: function() {},
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500216 },
217
Kevin Lubick006a6f32018-10-19 14:34:34 -0400218 SkPath: {
219 // public API (from C++ bindings)
Kevin Lubickb9db3902018-11-26 11:47:54 -0500220 computeTightBounds: function() {},
Kevin Lubick1646e7d2018-12-07 13:03:08 -0500221 contains: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500222 /** @return {CanvasKit.SkPath} */
223 copy: function() {},
224 countPoints: function() {},
225 equals: function() {},
226 getBounds: function() {},
227 getFillType: function() {},
228 getPoint: function() {},
Kevin Lubick1646e7d2018-12-07 13:03:08 -0500229 isEmpty: function() {},
Kevin Lubick2b79d1c2018-12-14 16:10:38 -0500230 isVolatile: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500231 reset: function() {},
232 rewind: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500233 setFillType: function() {},
Kevin Lubick2b79d1c2018-12-14 16:10:38 -0500234 setIsVolatile: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500235 toSVGString: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400236
237 // private API
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500238 _addArc: function() {},
Kevin Lubicke384df42019-08-26 15:48:09 -0400239 _addOval: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400240 _addPath: function() {},
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500241 _addRect: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500242 _addRoundRect: function() {},
Alexander Khovansky3e119332018-11-15 02:01:19 +0300243 _arc: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400244 _arcTo: function() {},
245 _close: function() {},
246 _conicTo: function() {},
247 _cubicTo: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400248 _dash: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400249 _lineTo: function() {},
250 _moveTo: function() {},
251 _op: function() {},
252 _quadTo: function() {},
253 _rect: function() {},
254 _simplify: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400255 _stroke: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400256 _transform: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400257 _trim: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400258 delete: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500259 dump: function() {},
260 dumpHex: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400261 },
262
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400263 SkPathMeasure: {
264 getLength: function() {},
265 getPosTan: function() {},
266 isClosed: function() {},
267 nextContour: function() {},
268 },
269
Kevin Lubickcc13fd32019-04-05 13:00:01 -0400270 SkPicture: {
271 DEBUGONLY_serialize: function() {},
272 },
273
274 SkPictureRecorder: {
275 beginRecording: function() {},
276 finishRecordingAsPicture: function() {},
277 },
278
Kevin Lubick006a6f32018-10-19 14:34:34 -0400279 SkRect: {
280 fLeft: {},
281 fTop: {},
282 fRight: {},
283 fBottom: {},
284 },
285
Kevin Lubick2e5fe352019-09-03 12:59:06 -0400286 SkRRect: {
287 rect: {},
288 rx: {},
289 ry: {},
290 },
291
Kevin Lubick006a6f32018-10-19 14:34:34 -0400292 SkSurface: {
293 // public API (from C++ bindings)
294 /** @return {CanvasKit.SkCanvas} */
295 getCanvas: function() {},
296 /** @return {CanvasKit.SkImage} */
297 makeImageSnapshot: function() {},
Kevin Lubick543f3522019-03-08 10:04:28 -0500298 makeSurface: function() {},
Kevin Lubickcd544662019-03-22 15:41:36 -0400299 grContext: {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400300
301 // private API
302 _flush: function() {},
303 _getRasterN32PremulSurface: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400304 delete: function() {},
305 },
306
Kevin Lubickec4903d2019-01-14 08:36:08 -0500307 SkTextBlob: {
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400308 // public API (both C++ and JS bindings)
309 MakeFromRSXform: function() {},
Kevin Lubickec4903d2019-01-14 08:36:08 -0500310 MakeFromText: function() {},
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400311 MakeOnPath: function() {},
312 // private API (from C++ bindings)
313 _MakeFromRSXform: function() {},
Kevin Lubickec4903d2019-01-14 08:36:08 -0500314 _MakeFromText: function() {},
315 },
316
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400317 SkVertices: {
318 // public API (from C++ bindings)
Kevin Lubick12c0e502018-11-28 12:51:56 -0500319 bounds: function() {},
320 mode: function() {},
321 uniqueID: function() {},
322 vertexCount: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400323
324 // private API
325 /** @return {CanvasKit.SkVertices} */
326 _applyBones: function() {},
327 },
328
Kevin Lubickd6ba7252019-06-03 14:38:05 -0400329 _SkVerticesBuilder: {
330 // public API (from C++ bindings)
331 boneIndices: function() {},
332 boneWeights: function() {},
333 colors: function() {},
334 detach: function() {},
335 indices: function() {},
336 positions: function() {},
337 texCoords: function() {},
338 },
339
Kevin Lubick006a6f32018-10-19 14:34:34 -0400340 // Constants and Enums
341 gpu: {},
342 skottie: {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400343
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500344 TRANSPARENT: {},
345 RED: {},
346 BLUE: {},
347 YELLOW: {},
348 CYAN: {},
349 BLACK: {},
Kevin Lubickea905ec2018-11-30 14:05:58 -0500350 WHITE: {},
351
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500352 MOVE_VERB: {},
353 LINE_VERB: {},
354 QUAD_VERB: {},
355 CONIC_VERB: {},
356 CUBIC_VERB: {},
357 CLOSE_VERB: {},
358
Kevin Lubickea905ec2018-11-30 14:05:58 -0500359 AlphaType: {
360 Opaque: {},
361 Premul: {},
362 Unpremul: {},
363 },
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500364
365 BlendMode: {
366 Clear: {},
367 Src: {},
368 Dst: {},
369 SrcOver: {},
370 DstOver: {},
371 SrcIn: {},
372 DstIn: {},
373 SrcOut: {},
374 DstOut: {},
375 SrcATop: {},
376 DstATop: {},
377 Xor: {},
378 Plus: {},
379 Modulate: {},
380 Screen: {},
381 Overlay: {},
382 Darken: {},
383 Lighten: {},
384 ColorDodge: {},
385 ColorBurn: {},
386 HardLight: {},
387 SoftLight: {},
388 Difference: {},
389 Exclusion: {},
390 Multiply: {},
391 Hue: {},
392 Saturation: {},
393 Color: {},
394 Luminosity: {},
395 },
396
397 BlurStyle: {
398 Normal: {},
399 Solid: {},
400 Outer: {},
401 Inner: {},
402 },
403
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500404 ClipOp: {
405 Difference: {},
406 Intersect: {},
407 },
408
Kevin Lubickea905ec2018-11-30 14:05:58 -0500409 ColorType: {
410 Alpha_8: {},
411 RGB_565: {},
412 ARGB_4444: {},
413 RGBA_8888: {},
414 RGB_888x: {},
415 BGRA_8888: {},
416 RGBA_1010102: {},
417 RGB_101010x: {},
418 Gray_8: {},
419 RGBA_F16: {},
420 RGBA_F32: {},
421 },
422
Kevin Lubick006a6f32018-10-19 14:34:34 -0400423 FillType: {
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500424 Winding: {},
425 EvenOdd: {},
426 InverseWinding: {},
427 InverseEvenOdd: {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400428 },
429
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500430 FilterQuality: {
431 None: {},
432 Low: {},
433 Medium: {},
434 High: {},
435 },
436
Alexander Khovansky3e119332018-11-15 02:01:19 +0300437 ImageFormat: {
438 PNG: {},
439 JPEG: {},
440 },
441
Kevin Lubickb9db3902018-11-26 11:47:54 -0500442 PaintStyle: {
443 Fill: {},
444 Stroke: {},
445 StrokeAndFill: {},
446 },
447
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500448 PathOp: {
449 Difference: {},
450 Intersect: {},
451 Union: {},
452 XOR: {},
453 ReverseDifference: {},
454 },
455
Kevin Lubickb9db3902018-11-26 11:47:54 -0500456 StrokeCap: {
457 Butt: {},
458 Round: {},
459 Square: {},
460 },
461
462 StrokeJoin: {
463 Miter: {},
464 Round: {},
465 Bevel: {},
466 },
467
Kevin Lubickec4903d2019-01-14 08:36:08 -0500468 TextEncoding: {
469 UTF8: {},
470 UTF16: {},
471 UTF32: {},
472 GlyphID: {},
473 },
474
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500475 TileMode: {
476 Clamp: {},
477 Repeat: {},
478 Mirror: {},
Kevin Lubickd29edd72018-12-07 08:29:52 -0500479 Decal: {},
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500480 },
481
482 VertexMode: {
483 Triangles: {},
484 TrianglesStrip: {},
485 TriangleFan: {},
486 },
487
Kevin Lubick006a6f32018-10-19 14:34:34 -0400488 // Things Enscriptem adds for us
489
Kevin Lubick53965c92018-10-11 08:51:55 -0400490 /** Represents the heap of the WASM code
491 * @type {ArrayBuffer}
492 */
493 buffer: {},
494 /**
495 * @type {Float32Array}
496 */
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400497 HEAPF32: {},
Kevin Lubick53965c92018-10-11 08:51:55 -0400498 /**
499 * @type {Uint8Array}
500 */
501 HEAPU8: {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400502 /**
503 * @type {Uint16Array}
504 */
505 HEAPU16: {},
506 /**
507 * @type {Int32Array}
508 */
509 HEAP32: {},
Kevin Lubickf5ea37f2019-02-28 10:06:18 -0500510 /**
511 * @type {Uint32Array}
512 */
513 HEAPU32: {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400514 _malloc: function() {},
515 _free: function() {},
516 onRuntimeInitialized: function() {},
517};
Kevin Lubick217056c2018-09-20 17:39:31 -0400518
Kevin Lubick006a6f32018-10-19 14:34:34 -0400519// Public API things that are newly declared in the JS should go here.
520// It's not enough to declare them above, because closure can still erase them
521// unless they go on the prototype.
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500522CanvasKit.SkPath.prototype.addArc = function() {};
Kevin Lubicke384df42019-08-26 15:48:09 -0400523CanvasKit.SkPath.prototype.addOval = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400524CanvasKit.SkPath.prototype.addPath = function() {};
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500525CanvasKit.SkPath.prototype.addRect = function() {};
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500526CanvasKit.SkPath.prototype.addRoundRect = function() {};
Alexander Khovansky3e119332018-11-15 02:01:19 +0300527CanvasKit.SkPath.prototype.arc = function() {};
Kevin Lubick006a6f32018-10-19 14:34:34 -0400528CanvasKit.SkPath.prototype.arcTo = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400529CanvasKit.SkPath.prototype.close = function() {};
Kevin Lubick006a6f32018-10-19 14:34:34 -0400530CanvasKit.SkPath.prototype.conicTo = function() {};
531CanvasKit.SkPath.prototype.cubicTo = function() {};
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400532CanvasKit.SkPath.prototype.dash = function() {};
Kevin Lubick006a6f32018-10-19 14:34:34 -0400533CanvasKit.SkPath.prototype.lineTo = function() {};
534CanvasKit.SkPath.prototype.moveTo = function() {};
Kevin Lubicke384df42019-08-26 15:48:09 -0400535CanvasKit.SkPath.prototype.offset = function() {};
Kevin Lubick006a6f32018-10-19 14:34:34 -0400536CanvasKit.SkPath.prototype.op = function() {};
537CanvasKit.SkPath.prototype.quadTo = function() {};
538CanvasKit.SkPath.prototype.rect = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400539CanvasKit.SkPath.prototype.simplify = function() {};
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400540CanvasKit.SkPath.prototype.stroke = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400541CanvasKit.SkPath.prototype.transform = function() {};
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400542CanvasKit.SkPath.prototype.trim = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400543
Kevin Lubickcc13fd32019-04-05 13:00:01 -0400544CanvasKit.SkPicture.prototype.DEBUGONLY_saveAsFile = function() {};
545
Kevin Lubick5b90b842018-10-17 07:57:18 -0400546CanvasKit.SkSurface.prototype.dispose = function() {};
Kevin Lubick359a7e32019-03-19 09:34:37 -0400547CanvasKit.SkSurface.prototype.flush = function() {};
548CanvasKit.SkSurface.prototype.requestAnimationFrame = function() {};
Kevin Lubickcc13fd32019-04-05 13:00:01 -0400549CanvasKit.SkSurface.prototype.captureFrameAsSkPicture = function() {};
Kevin Lubick53965c92018-10-11 08:51:55 -0400550
Kevin Lubick12c0e502018-11-28 12:51:56 -0500551/** @return {CanvasKit.SkVertices} */
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400552CanvasKit.SkVertices.prototype.applyBones = function() {};
553
Alexander Khovansky3e119332018-11-15 02:01:19 +0300554CanvasKit.SkImage.prototype.encodeToData = function() {};
Kevin Lubicka064c282019-04-04 09:28:53 -0400555CanvasKit.SkImage.prototype.makeShader = function() {};
Alexander Khovansky3e119332018-11-15 02:01:19 +0300556
Kevin Lubickee91c072019-03-29 10:39:52 -0400557CanvasKit.SkCanvas.prototype.drawAtlas = function() {};
Kevin Lubickec4903d2019-01-14 08:36:08 -0500558CanvasKit.SkCanvas.prototype.drawText = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500559/** @return {Uint8Array} */
560CanvasKit.SkCanvas.prototype.readPixels = function() {};
561CanvasKit.SkCanvas.prototype.writePixels = function() {};
562
Kevin Lubickddd0a332018-12-12 10:35:13 -0500563CanvasKit.SkFontMgr.prototype.MakeTypefaceFromData = function() {};
564
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400565CanvasKit.SkFont.prototype.getWidths = function() {};
566
567CanvasKit.RSXFormBuilder.prototype.build = function() {};
568CanvasKit.RSXFormBuilder.prototype.delete = function() {};
569CanvasKit.RSXFormBuilder.prototype.push = function() {};
Kevin Lubickee91c072019-03-29 10:39:52 -0400570CanvasKit.RSXFormBuilder.prototype.set = function() {};
571
572CanvasKit.SkColorBuilder.prototype.build = function() {};
573CanvasKit.SkColorBuilder.prototype.delete = function() {};
574CanvasKit.SkColorBuilder.prototype.push = function() {};
575CanvasKit.SkColorBuilder.prototype.set = function() {};
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400576
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400577// Define StrokeOpts object
578var StrokeOpts = {};
579StrokeOpts.prototype.width;
580StrokeOpts.prototype.miter_limit;
581StrokeOpts.prototype.cap;
582StrokeOpts.prototype.join;
Kevin Lubick1646e7d2018-12-07 13:03:08 -0500583StrokeOpts.prototype.precision;
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400584
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500585// Define everything created in the canvas2d spec here
Kevin Lubickb9db3902018-11-26 11:47:54 -0500586var HTMLCanvas = {};
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500587HTMLCanvas.prototype.decodeImage = function() {};
588HTMLCanvas.prototype.dispose = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500589HTMLCanvas.prototype.getContext = function() {};
Kevin Lubick8e4a3312018-12-14 15:03:41 -0500590HTMLCanvas.prototype.loadFont = function() {};
Kevin Lubicka40f8322018-12-17 16:01:36 -0500591HTMLCanvas.prototype.makePath2D = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500592HTMLCanvas.prototype.toDataURL = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500593
594var CanvasRenderingContext2D = {};
595CanvasRenderingContext2D.prototype.addHitRegion = function() {};
596CanvasRenderingContext2D.prototype.arc = function() {};
597CanvasRenderingContext2D.prototype.arcTo = function() {};
598CanvasRenderingContext2D.prototype.beginPath = function() {};
599CanvasRenderingContext2D.prototype.bezierCurveTo = function() {};
600CanvasRenderingContext2D.prototype.clearHitRegions = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500601CanvasRenderingContext2D.prototype.clearRect = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500602CanvasRenderingContext2D.prototype.clip = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500603CanvasRenderingContext2D.prototype.closePath = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500604CanvasRenderingContext2D.prototype.createImageData = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500605CanvasRenderingContext2D.prototype.createLinearGradient = function() {};
Kevin Lubickd29edd72018-12-07 08:29:52 -0500606CanvasRenderingContext2D.prototype.createPattern = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500607CanvasRenderingContext2D.prototype.createRadialGradient = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500608CanvasRenderingContext2D.prototype.drawFocusIfNeeded = function() {};
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500609CanvasRenderingContext2D.prototype.drawImage = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500610CanvasRenderingContext2D.prototype.ellipse = function() {};
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500611CanvasRenderingContext2D.prototype.fill = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500612CanvasRenderingContext2D.prototype.fillRect = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500613CanvasRenderingContext2D.prototype.fillText = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500614CanvasRenderingContext2D.prototype.getImageData = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500615CanvasRenderingContext2D.prototype.getLineDash = function() {};
Kevin Lubick1646e7d2018-12-07 13:03:08 -0500616CanvasRenderingContext2D.prototype.isPointInPath = function() {};
617CanvasRenderingContext2D.prototype.isPointInStroke = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500618CanvasRenderingContext2D.prototype.lineTo = function() {};
619CanvasRenderingContext2D.prototype.measureText = function() {};
620CanvasRenderingContext2D.prototype.moveTo = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500621CanvasRenderingContext2D.prototype.putImageData = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500622CanvasRenderingContext2D.prototype.quadraticCurveTo = function() {};
623CanvasRenderingContext2D.prototype.rect = function() {};
624CanvasRenderingContext2D.prototype.removeHitRegion = function() {};
625CanvasRenderingContext2D.prototype.resetTransform = function() {};
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500626CanvasRenderingContext2D.prototype.restore = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500627CanvasRenderingContext2D.prototype.rotate = function() {};
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500628CanvasRenderingContext2D.prototype.save = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500629CanvasRenderingContext2D.prototype.scale = function() {};
630CanvasRenderingContext2D.prototype.scrollPathIntoView = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500631CanvasRenderingContext2D.prototype.setLineDash = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500632CanvasRenderingContext2D.prototype.setTransform = function() {};
633CanvasRenderingContext2D.prototype.stroke = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500634CanvasRenderingContext2D.prototype.strokeRect = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500635CanvasRenderingContext2D.prototype.strokeText = function() {};
636CanvasRenderingContext2D.prototype.transform = function() {};
637CanvasRenderingContext2D.prototype.translate = function() {};
638
Kevin Lubicka40f8322018-12-17 16:01:36 -0500639var Path2D = {};
640Path2D.prototype.addPath = function() {};
641Path2D.prototype.arc = function() {};
642Path2D.prototype.arcTo = function() {};
643Path2D.prototype.bezierCurveTo = function() {};
644Path2D.prototype.closePath = function() {};
645Path2D.prototype.ellipse = function() {};
646Path2D.prototype.lineTo = function() {};
647Path2D.prototype.moveTo = function() {};
648Path2D.prototype.quadraticCurveTo = function() {};
649Path2D.prototype.rect = function() {};
650
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500651var LinearCanvasGradient = {};
652LinearCanvasGradient.prototype.addColorStop = function() {};
653var RadialCanvasGradient = {};
654RadialCanvasGradient.prototype.addColorStop = function() {};
Kevin Lubickd29edd72018-12-07 08:29:52 -0500655var CanvasPattern = {};
656CanvasPattern.prototype.setTransform = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500657
Kevin Lubick52b9f372018-12-04 13:57:36 -0500658var ImageData = {
659 /**
660 * @type {Uint8ClampedArray}
661 */
662 data: {},
663 height: {},
664 width: {},
665};
666
Kevin Lubickd29edd72018-12-07 08:29:52 -0500667var DOMMatrix = {
668 a: {},
669 b: {},
670 c: {},
671 d: {},
672 e: {},
673 f: {},
674};
675
Kevin Lubick217056c2018-09-20 17:39:31 -0400676// 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 -0500677function loadWebAssemblyModule() {};