blob: cd13a388d4f7a2877cfdaa4a0e1a9bdd2843012c [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 Lubickb5ae3b52018-11-03 07:51:19 -040040 MakeImageShader: function() {},
Kevin Lubick0a1293c2018-12-03 12:31:04 -050041 /** @return {CanvasKit.SkImage} */
42 MakeImageFromEncoded: function() {},
Kevin Lubickeb2f6b02018-11-29 15:07:02 -050043 /** @return {LinearCanvasGradient} */
Kevin Lubickb5ae3b52018-11-03 07:51:19 -040044 MakeLinearGradientShader: function() {},
Kevin Lubick543f3522019-03-08 10:04:28 -050045 MakeOnScreenGLSurface: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -050046 MakePathFromCmds: function() {},
Kevin Lubicka40f8322018-12-17 16:01:36 -050047 MakePathFromOp: function() {},
48 MakePathFromSVGString: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -050049 MakeRadialGradientShader: function() {},
Kevin Lubick543f3522019-03-08 10:04:28 -050050 MakeRenderTarget: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -050051 MakeSWCanvasSurface: function() {},
Kevin Lubickf5ea37f2019-02-28 10:06:18 -050052 MakeManagedAnimation: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -040053 MakeSkDashPathEffect: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -040054 MakeSkVertices: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -040055 MakeSurface: function() {},
Kevin Lubickeb2f6b02018-11-29 15:07:02 -050056 /** @return {RadialCanvasGradient} */
57 MakeTwoPointConicalGradientShader: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -050058 MakeWebGLCanvasSurface: function() {},
Kevin Lubick217056c2018-09-20 17:39:31 -040059 currentContext: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -050060 getColorComponents: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -050061 getSkDataBytes: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -050062 multiplyByAlpha: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -040063 setCurrentContext: function() {},
Kevin Lubick217056c2018-09-20 17:39:31 -040064
65 // private API (i.e. things declared in the bindings that we use
66 // in the pre-js file)
Kevin Lubick52b9f372018-12-04 13:57:36 -050067 _MakeImage: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -040068 _MakeImageShader: function() {},
69 _MakeLinearGradientShader: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -050070 _MakePathFromCmds: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -040071 _MakeRadialGradientShader: function() {},
Kevin Lubickf5ea37f2019-02-28 10:06:18 -050072 _MakeManagedAnimation: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -040073 _MakeSkDashPathEffect: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -040074 _MakeSkVertices: function() {},
Kevin Lubickeb2f6b02018-11-29 15:07:02 -050075 _MakeTwoPointConicalGradientShader: function() {},
Kevin Lubick0a1293c2018-12-03 12:31:04 -050076 _decodeImage: function() {},
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -050077 _drawShapedText: function() {},
Kevin Lubickea905ec2018-11-30 14:05:58 -050078 _getRasterDirectSurface: function() {},
Kevin Lubick134be1d2018-10-30 15:05:04 -040079 _getRasterN32PremulSurface: function() {},
Kevin Lubick217056c2018-09-20 17:39:31 -040080
Kevin Lubick1a05fce2018-11-20 12:51:16 -050081 // The testing object is meant to expose internal functions
82 // for more fine-grained testing, e.g. parseColor
83 _testing: {},
84
Kevin Lubick217056c2018-09-20 17:39:31 -040085 // Objects and properties on CanvasKit
86
Kevin Lubickcd544662019-03-22 15:41:36 -040087 GrContext: {
88 // public API (from C++ bindings)
89 getResourceCacheLimitBytes: function() {},
90 getResourceCacheUsageBytes: function() {},
91 setResourceCacheLimitBytes: function() {},
92 },
93
Kevin Lubickd3cfbca2019-03-15 15:36:29 -040094 RSXFormBuilder: function() {},
95
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 Lubick0a1293c2018-12-03 12:31:04 -0500108 drawImage: function() {},
109 drawImageRect: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500110 drawLine: function() {},
111 drawOval: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400112 drawPaint: function() {},
113 drawPath: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -0500114 drawRect: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500115 drawRoundRect: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500116 drawShadow: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -0500117 drawText: function() {},
Kevin Lubickec4903d2019-01-14 08:36:08 -0500118 drawTextBlob: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -0500119 drawVertices: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400120 flush: function() {},
Kevin Lubick5d5723c2018-12-07 10:09:11 -0500121 getTotalMatrix: function() {},
Kevin Lubick543f3522019-03-08 10:04:28 -0500122 makeSurface: function() {},
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500123 restore: function() {},
Kevin Lubickb3574c92019-03-06 08:25:36 -0500124 restoreToCount: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400125 rotate: function() {},
126 save: function() {},
Kevin Lubickb3574c92019-03-06 08:25:36 -0500127 saveLayer: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400128 scale: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400129 skew: function() {},
130 translate: function() {},
131
132 // private API
Kevin Lubickec4903d2019-01-14 08:36:08 -0500133 _drawSimpleText: function() {},
Kevin Lubick52b9f372018-12-04 13:57:36 -0500134 _readPixels: function() {},
135 _writePixels: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400136 delete: function() {},
137 },
138
Kevin Lubick35ac0382019-01-02 15:13:57 -0500139 SkFont: {
140 // public API (from C++ bindings)
141 getScaleX: function() {},
142 getSize: function() {},
143 getSkewX: function() {},
144 getTypeface: function() {},
145 measureText: function() {},
146 setScaleX: function() {},
147 setSize: function() {},
148 setSkewX: function() {},
149 setTypeface: function() {},
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400150 // private API (from C++ bindings)
151 _getWidths: function() {},
Kevin Lubick35ac0382019-01-02 15:13:57 -0500152 },
153
Kevin Lubickddd0a332018-12-12 10:35:13 -0500154 SkFontMgr: {
155 // public API (from C++ bindings)
156 RefDefault: function() {},
157 countFamilies: function() {},
158
159 // private API
160 _makeTypefaceFromData: function() {},
161 },
162
Kevin Lubick006a6f32018-10-19 14:34:34 -0400163 SkImage: {
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500164 // public API (from C++ bindings)
165 height: function() {},
166 width: function() {},
Alexander Khovansky3e119332018-11-15 02:01:19 +0300167 // private API
168 _encodeToData: function() {},
169 _encodeToDataWithFormat: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400170 },
171
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500172 SkMatrix: {
Kevin Lubickb9db3902018-11-26 11:47:54 -0500173 identity: function() {},
Kevin Lubickf3555182019-03-14 10:55:10 -0400174 invert: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500175 mapPoints: function() {},
176 multiply: function() {},
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500177 rotated: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500178 scaled: function() {},
179 skewed: function() {},
180 translated: function() {},
181 },
182
183 SkPaint: {
184 // public API (from C++ bindings)
185 /** @return {CanvasKit.SkPaint} */
186 copy: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -0500187 getBlendMode: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500188 getColor: function() {},
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500189 getFilterQuality: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500190 getStrokeCap: function() {},
191 getStrokeJoin: function() {},
192 getStrokeMiter: function() {},
193 getStrokeWidth: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500194 setAntiAlias: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -0500195 setBlendMode: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500196 setColor: function() {},
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500197 setFilterQuality: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500198 setMaskFilter: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500199 setPathEffect: function() {},
200 setShader: function() {},
201 setStrokeCap: function() {},
202 setStrokeJoin: function() {},
203 setStrokeMiter: function() {},
204 setStrokeWidth: function() {},
205 setStyle: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500206
207 //private API
208 delete: function() {},
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500209 },
210
Kevin Lubick006a6f32018-10-19 14:34:34 -0400211 SkPath: {
212 // public API (from C++ bindings)
Kevin Lubickb9db3902018-11-26 11:47:54 -0500213 computeTightBounds: function() {},
Kevin Lubick1646e7d2018-12-07 13:03:08 -0500214 contains: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500215 /** @return {CanvasKit.SkPath} */
216 copy: function() {},
217 countPoints: function() {},
218 equals: function() {},
219 getBounds: function() {},
220 getFillType: function() {},
221 getPoint: function() {},
Kevin Lubick1646e7d2018-12-07 13:03:08 -0500222 isEmpty: function() {},
Kevin Lubick2b79d1c2018-12-14 16:10:38 -0500223 isVolatile: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500224 reset: function() {},
225 rewind: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500226 setFillType: function() {},
Kevin Lubick2b79d1c2018-12-14 16:10:38 -0500227 setIsVolatile: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500228 toSVGString: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400229
230 // private API
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500231 _addArc: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400232 _addPath: function() {},
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500233 _addRect: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500234 _addRoundRect: function() {},
Alexander Khovansky3e119332018-11-15 02:01:19 +0300235 _arc: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400236 _arcTo: function() {},
237 _close: function() {},
238 _conicTo: function() {},
239 _cubicTo: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400240 _dash: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400241 _lineTo: function() {},
242 _moveTo: function() {},
243 _op: function() {},
244 _quadTo: function() {},
245 _rect: function() {},
246 _simplify: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400247 _stroke: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400248 _transform: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400249 _trim: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400250 delete: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500251 dump: function() {},
252 dumpHex: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400253 },
254
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400255 SkPathMeasure: {
256 getLength: function() {},
257 getPosTan: function() {},
258 isClosed: function() {},
259 nextContour: function() {},
260 },
261
Kevin Lubick006a6f32018-10-19 14:34:34 -0400262 SkRect: {
263 fLeft: {},
264 fTop: {},
265 fRight: {},
266 fBottom: {},
267 },
268
269 SkSurface: {
270 // public API (from C++ bindings)
271 /** @return {CanvasKit.SkCanvas} */
272 getCanvas: function() {},
273 /** @return {CanvasKit.SkImage} */
274 makeImageSnapshot: function() {},
Kevin Lubick543f3522019-03-08 10:04:28 -0500275 makeSurface: function() {},
Kevin Lubickcd544662019-03-22 15:41:36 -0400276 grContext: {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400277
278 // private API
279 _flush: function() {},
280 _getRasterN32PremulSurface: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400281 delete: function() {},
282 },
283
Kevin Lubickec4903d2019-01-14 08:36:08 -0500284 SkTextBlob: {
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400285 // public API (both C++ and JS bindings)
286 MakeFromRSXform: function() {},
Kevin Lubickec4903d2019-01-14 08:36:08 -0500287 MakeFromText: function() {},
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400288 MakeOnPath: function() {},
289 // private API (from C++ bindings)
290 _MakeFromRSXform: function() {},
Kevin Lubickec4903d2019-01-14 08:36:08 -0500291 _MakeFromText: function() {},
292 },
293
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400294 SkVertices: {
295 // public API (from C++ bindings)
Kevin Lubick12c0e502018-11-28 12:51:56 -0500296 bounds: function() {},
297 mode: function() {},
298 uniqueID: function() {},
299 vertexCount: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400300
301 // private API
302 /** @return {CanvasKit.SkVertices} */
303 _applyBones: function() {},
304 },
305
Kevin Lubick006a6f32018-10-19 14:34:34 -0400306 // Constants and Enums
307 gpu: {},
308 skottie: {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400309
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500310 TRANSPARENT: {},
311 RED: {},
312 BLUE: {},
313 YELLOW: {},
314 CYAN: {},
315 BLACK: {},
Kevin Lubickea905ec2018-11-30 14:05:58 -0500316 WHITE: {},
317
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500318 MOVE_VERB: {},
319 LINE_VERB: {},
320 QUAD_VERB: {},
321 CONIC_VERB: {},
322 CUBIC_VERB: {},
323 CLOSE_VERB: {},
324
Kevin Lubickea905ec2018-11-30 14:05:58 -0500325 AlphaType: {
326 Opaque: {},
327 Premul: {},
328 Unpremul: {},
329 },
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500330
331 BlendMode: {
332 Clear: {},
333 Src: {},
334 Dst: {},
335 SrcOver: {},
336 DstOver: {},
337 SrcIn: {},
338 DstIn: {},
339 SrcOut: {},
340 DstOut: {},
341 SrcATop: {},
342 DstATop: {},
343 Xor: {},
344 Plus: {},
345 Modulate: {},
346 Screen: {},
347 Overlay: {},
348 Darken: {},
349 Lighten: {},
350 ColorDodge: {},
351 ColorBurn: {},
352 HardLight: {},
353 SoftLight: {},
354 Difference: {},
355 Exclusion: {},
356 Multiply: {},
357 Hue: {},
358 Saturation: {},
359 Color: {},
360 Luminosity: {},
361 },
362
363 BlurStyle: {
364 Normal: {},
365 Solid: {},
366 Outer: {},
367 Inner: {},
368 },
369
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500370 ClipOp: {
371 Difference: {},
372 Intersect: {},
373 },
374
Kevin Lubickea905ec2018-11-30 14:05:58 -0500375 ColorType: {
376 Alpha_8: {},
377 RGB_565: {},
378 ARGB_4444: {},
379 RGBA_8888: {},
380 RGB_888x: {},
381 BGRA_8888: {},
382 RGBA_1010102: {},
383 RGB_101010x: {},
384 Gray_8: {},
385 RGBA_F16: {},
386 RGBA_F32: {},
387 },
388
Kevin Lubick006a6f32018-10-19 14:34:34 -0400389 FillType: {
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500390 Winding: {},
391 EvenOdd: {},
392 InverseWinding: {},
393 InverseEvenOdd: {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400394 },
395
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500396 FilterQuality: {
397 None: {},
398 Low: {},
399 Medium: {},
400 High: {},
401 },
402
Alexander Khovansky3e119332018-11-15 02:01:19 +0300403 ImageFormat: {
404 PNG: {},
405 JPEG: {},
406 },
407
Kevin Lubickb9db3902018-11-26 11:47:54 -0500408 PaintStyle: {
409 Fill: {},
410 Stroke: {},
411 StrokeAndFill: {},
412 },
413
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500414 PathOp: {
415 Difference: {},
416 Intersect: {},
417 Union: {},
418 XOR: {},
419 ReverseDifference: {},
420 },
421
Kevin Lubickb9db3902018-11-26 11:47:54 -0500422 StrokeCap: {
423 Butt: {},
424 Round: {},
425 Square: {},
426 },
427
428 StrokeJoin: {
429 Miter: {},
430 Round: {},
431 Bevel: {},
432 },
433
Kevin Lubickec4903d2019-01-14 08:36:08 -0500434 TextEncoding: {
435 UTF8: {},
436 UTF16: {},
437 UTF32: {},
438 GlyphID: {},
439 },
440
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500441 TileMode: {
442 Clamp: {},
443 Repeat: {},
444 Mirror: {},
Kevin Lubickd29edd72018-12-07 08:29:52 -0500445 Decal: {},
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500446 },
447
448 VertexMode: {
449 Triangles: {},
450 TrianglesStrip: {},
451 TriangleFan: {},
452 },
453
Kevin Lubick006a6f32018-10-19 14:34:34 -0400454 // Things Enscriptem adds for us
455
Kevin Lubick53965c92018-10-11 08:51:55 -0400456 /** Represents the heap of the WASM code
457 * @type {ArrayBuffer}
458 */
459 buffer: {},
460 /**
461 * @type {Float32Array}
462 */
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400463 HEAPF32: {},
Kevin Lubick53965c92018-10-11 08:51:55 -0400464 /**
465 * @type {Uint8Array}
466 */
467 HEAPU8: {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400468 /**
469 * @type {Uint16Array}
470 */
471 HEAPU16: {},
472 /**
473 * @type {Int32Array}
474 */
475 HEAP32: {},
Kevin Lubickf5ea37f2019-02-28 10:06:18 -0500476 /**
477 * @type {Uint32Array}
478 */
479 HEAPU32: {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400480 _malloc: function() {},
481 _free: function() {},
482 onRuntimeInitialized: function() {},
483};
Kevin Lubick217056c2018-09-20 17:39:31 -0400484
Kevin Lubick006a6f32018-10-19 14:34:34 -0400485// Public API things that are newly declared in the JS should go here.
486// It's not enough to declare them above, because closure can still erase them
487// unless they go on the prototype.
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500488CanvasKit.SkPath.prototype.addArc = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400489CanvasKit.SkPath.prototype.addPath = function() {};
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500490CanvasKit.SkPath.prototype.addRect = function() {};
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500491CanvasKit.SkPath.prototype.addRoundRect = function() {};
Alexander Khovansky3e119332018-11-15 02:01:19 +0300492CanvasKit.SkPath.prototype.arc = function() {};
Kevin Lubick006a6f32018-10-19 14:34:34 -0400493CanvasKit.SkPath.prototype.arcTo = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400494CanvasKit.SkPath.prototype.close = function() {};
Kevin Lubick006a6f32018-10-19 14:34:34 -0400495CanvasKit.SkPath.prototype.conicTo = function() {};
496CanvasKit.SkPath.prototype.cubicTo = function() {};
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400497CanvasKit.SkPath.prototype.dash = function() {};
Kevin Lubick006a6f32018-10-19 14:34:34 -0400498CanvasKit.SkPath.prototype.lineTo = function() {};
499CanvasKit.SkPath.prototype.moveTo = function() {};
500CanvasKit.SkPath.prototype.op = function() {};
501CanvasKit.SkPath.prototype.quadTo = function() {};
502CanvasKit.SkPath.prototype.rect = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400503CanvasKit.SkPath.prototype.simplify = function() {};
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400504CanvasKit.SkPath.prototype.stroke = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400505CanvasKit.SkPath.prototype.transform = function() {};
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400506CanvasKit.SkPath.prototype.trim = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400507
Kevin Lubick5b90b842018-10-17 07:57:18 -0400508CanvasKit.SkSurface.prototype.dispose = function() {};
Kevin Lubick359a7e32019-03-19 09:34:37 -0400509CanvasKit.SkSurface.prototype.flush = function() {};
510CanvasKit.SkSurface.prototype.requestAnimationFrame = function() {};
Kevin Lubick53965c92018-10-11 08:51:55 -0400511
Kevin Lubick12c0e502018-11-28 12:51:56 -0500512/** @return {CanvasKit.SkVertices} */
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400513CanvasKit.SkVertices.prototype.applyBones = function() {};
514
Alexander Khovansky3e119332018-11-15 02:01:19 +0300515CanvasKit.SkImage.prototype.encodeToData = function() {};
516
Kevin Lubickec4903d2019-01-14 08:36:08 -0500517CanvasKit.SkCanvas.prototype.drawText = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500518/** @return {Uint8Array} */
519CanvasKit.SkCanvas.prototype.readPixels = function() {};
520CanvasKit.SkCanvas.prototype.writePixels = function() {};
521
Kevin Lubickddd0a332018-12-12 10:35:13 -0500522CanvasKit.SkFontMgr.prototype.MakeTypefaceFromData = function() {};
523
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400524CanvasKit.SkFont.prototype.getWidths = function() {};
525
526CanvasKit.RSXFormBuilder.prototype.build = function() {};
527CanvasKit.RSXFormBuilder.prototype.delete = function() {};
528CanvasKit.RSXFormBuilder.prototype.push = function() {};
529
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400530// Define StrokeOpts object
531var StrokeOpts = {};
532StrokeOpts.prototype.width;
533StrokeOpts.prototype.miter_limit;
534StrokeOpts.prototype.cap;
535StrokeOpts.prototype.join;
Kevin Lubick1646e7d2018-12-07 13:03:08 -0500536StrokeOpts.prototype.precision;
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400537
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500538// Define everything created in the canvas2d spec here
Kevin Lubickb9db3902018-11-26 11:47:54 -0500539var HTMLCanvas = {};
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500540HTMLCanvas.prototype.decodeImage = function() {};
541HTMLCanvas.prototype.dispose = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500542HTMLCanvas.prototype.getContext = function() {};
Kevin Lubick8e4a3312018-12-14 15:03:41 -0500543HTMLCanvas.prototype.loadFont = function() {};
Kevin Lubicka40f8322018-12-17 16:01:36 -0500544HTMLCanvas.prototype.makePath2D = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500545HTMLCanvas.prototype.toDataURL = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500546
547var CanvasRenderingContext2D = {};
548CanvasRenderingContext2D.prototype.addHitRegion = function() {};
549CanvasRenderingContext2D.prototype.arc = function() {};
550CanvasRenderingContext2D.prototype.arcTo = function() {};
551CanvasRenderingContext2D.prototype.beginPath = function() {};
552CanvasRenderingContext2D.prototype.bezierCurveTo = function() {};
553CanvasRenderingContext2D.prototype.clearHitRegions = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500554CanvasRenderingContext2D.prototype.clearRect = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500555CanvasRenderingContext2D.prototype.clip = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500556CanvasRenderingContext2D.prototype.closePath = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500557CanvasRenderingContext2D.prototype.createImageData = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500558CanvasRenderingContext2D.prototype.createLinearGradient = function() {};
Kevin Lubickd29edd72018-12-07 08:29:52 -0500559CanvasRenderingContext2D.prototype.createPattern = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500560CanvasRenderingContext2D.prototype.createRadialGradient = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500561CanvasRenderingContext2D.prototype.drawFocusIfNeeded = function() {};
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500562CanvasRenderingContext2D.prototype.drawImage = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500563CanvasRenderingContext2D.prototype.ellipse = function() {};
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500564CanvasRenderingContext2D.prototype.fill = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500565CanvasRenderingContext2D.prototype.fillRect = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500566CanvasRenderingContext2D.prototype.fillText = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500567CanvasRenderingContext2D.prototype.getImageData = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500568CanvasRenderingContext2D.prototype.getLineDash = function() {};
Kevin Lubick1646e7d2018-12-07 13:03:08 -0500569CanvasRenderingContext2D.prototype.isPointInPath = function() {};
570CanvasRenderingContext2D.prototype.isPointInStroke = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500571CanvasRenderingContext2D.prototype.lineTo = function() {};
572CanvasRenderingContext2D.prototype.measureText = function() {};
573CanvasRenderingContext2D.prototype.moveTo = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500574CanvasRenderingContext2D.prototype.putImageData = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500575CanvasRenderingContext2D.prototype.quadraticCurveTo = function() {};
576CanvasRenderingContext2D.prototype.rect = function() {};
577CanvasRenderingContext2D.prototype.removeHitRegion = function() {};
578CanvasRenderingContext2D.prototype.resetTransform = function() {};
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500579CanvasRenderingContext2D.prototype.restore = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500580CanvasRenderingContext2D.prototype.rotate = function() {};
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500581CanvasRenderingContext2D.prototype.save = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500582CanvasRenderingContext2D.prototype.scale = function() {};
583CanvasRenderingContext2D.prototype.scrollPathIntoView = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500584CanvasRenderingContext2D.prototype.setLineDash = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500585CanvasRenderingContext2D.prototype.setTransform = function() {};
586CanvasRenderingContext2D.prototype.stroke = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500587CanvasRenderingContext2D.prototype.strokeRect = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500588CanvasRenderingContext2D.prototype.strokeText = function() {};
589CanvasRenderingContext2D.prototype.transform = function() {};
590CanvasRenderingContext2D.prototype.translate = function() {};
591
Kevin Lubicka40f8322018-12-17 16:01:36 -0500592var Path2D = {};
593Path2D.prototype.addPath = function() {};
594Path2D.prototype.arc = function() {};
595Path2D.prototype.arcTo = function() {};
596Path2D.prototype.bezierCurveTo = function() {};
597Path2D.prototype.closePath = function() {};
598Path2D.prototype.ellipse = function() {};
599Path2D.prototype.lineTo = function() {};
600Path2D.prototype.moveTo = function() {};
601Path2D.prototype.quadraticCurveTo = function() {};
602Path2D.prototype.rect = function() {};
603
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500604var LinearCanvasGradient = {};
605LinearCanvasGradient.prototype.addColorStop = function() {};
606var RadialCanvasGradient = {};
607RadialCanvasGradient.prototype.addColorStop = function() {};
Kevin Lubickd29edd72018-12-07 08:29:52 -0500608var CanvasPattern = {};
609CanvasPattern.prototype.setTransform = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500610
Kevin Lubick52b9f372018-12-04 13:57:36 -0500611var ImageData = {
612 /**
613 * @type {Uint8ClampedArray}
614 */
615 data: {},
616 height: {},
617 width: {},
618};
619
Kevin Lubickd29edd72018-12-07 08:29:52 -0500620var DOMMatrix = {
621 a: {},
622 b: {},
623 c: {},
624 d: {},
625 e: {},
626 f: {},
627};
628
Kevin Lubick217056c2018-09-20 17:39:31 -0400629// 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 -0500630function loadWebAssemblyModule() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500631
632var DOMMatrix = {};