blob: 2abc058c426bd542d0ed0f791c9c5d7eb14bea82 [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 Lubick61ef7b22018-11-27 13:26:59 -050034 MakeBlurMaskFilter: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -040035 MakeCanvas: function() {},
36 MakeCanvasSurface: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -040037 MakeImageShader: function() {},
Kevin Lubick0a1293c2018-12-03 12:31:04 -050038 /** @return {CanvasKit.SkImage} */
39 MakeImageFromEncoded: function() {},
Kevin Lubickeb2f6b02018-11-29 15:07:02 -050040 /** @return {LinearCanvasGradient} */
Kevin Lubickb5ae3b52018-11-03 07:51:19 -040041 MakeLinearGradientShader: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -050042 MakePathFromCmds: function() {},
Kevin Lubicka40f8322018-12-17 16:01:36 -050043 MakePathFromOp: function() {},
44 MakePathFromSVGString: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -050045 MakeRadialGradientShader: function() {},
46 MakeSWCanvasSurface: function() {},
Kevin Lubickf5ea37f2019-02-28 10:06:18 -050047 MakeManagedAnimation: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -040048 MakeSkDashPathEffect: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -040049 MakeSkVertices: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -040050 MakeSurface: function() {},
Kevin Lubickeb2f6b02018-11-29 15:07:02 -050051 /** @return {RadialCanvasGradient} */
52 MakeTwoPointConicalGradientShader: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -050053 MakeWebGLCanvasSurface: function() {},
Kevin Lubick217056c2018-09-20 17:39:31 -040054 currentContext: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -050055 getColorComponents: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -050056 getSkDataBytes: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -050057 multiplyByAlpha: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -040058 setCurrentContext: function() {},
Kevin Lubick217056c2018-09-20 17:39:31 -040059
60 // private API (i.e. things declared in the bindings that we use
61 // in the pre-js file)
Kevin Lubick52b9f372018-12-04 13:57:36 -050062 _MakeImage: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -040063 _MakeImageShader: function() {},
64 _MakeLinearGradientShader: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -050065 _MakePathFromCmds: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -040066 _MakeRadialGradientShader: function() {},
Kevin Lubickf5ea37f2019-02-28 10:06:18 -050067 _MakeManagedAnimation: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -040068 _MakeSkDashPathEffect: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -040069 _MakeSkVertices: function() {},
Kevin Lubickeb2f6b02018-11-29 15:07:02 -050070 _MakeTwoPointConicalGradientShader: function() {},
Kevin Lubick0a1293c2018-12-03 12:31:04 -050071 _decodeImage: function() {},
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -050072 _drawShapedText: function() {},
Kevin Lubickea905ec2018-11-30 14:05:58 -050073 _getRasterDirectSurface: function() {},
Kevin Lubick134be1d2018-10-30 15:05:04 -040074 _getRasterN32PremulSurface: function() {},
75 _getWebGLSurface: function() {},
Kevin Lubick217056c2018-09-20 17:39:31 -040076
Kevin Lubick1a05fce2018-11-20 12:51:16 -050077 // The testing object is meant to expose internal functions
78 // for more fine-grained testing, e.g. parseColor
79 _testing: {},
80
Kevin Lubick217056c2018-09-20 17:39:31 -040081 // Objects and properties on CanvasKit
82
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -050083 ShapedText: {
84 // public API (from C++ bindings)
85 getBounds: function() {},
86 },
87
Kevin Lubick006a6f32018-10-19 14:34:34 -040088 SkCanvas: {
89 // public API (from C++ bindings)
90 clear: function() {},
Kevin Lubickeb2f6b02018-11-29 15:07:02 -050091 clipPath: function() {},
Kevin Lubick5d5723c2018-12-07 10:09:11 -050092 clipRect: function() {},
93 concat: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -050094 drawArc: function() {},
Kevin Lubick0a1293c2018-12-03 12:31:04 -050095 drawImage: function() {},
96 drawImageRect: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -050097 drawLine: function() {},
98 drawOval: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -040099 drawPaint: function() {},
100 drawPath: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -0500101 drawRect: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500102 drawRoundRect: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500103 drawShadow: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -0500104 drawText: function() {},
Kevin Lubickec4903d2019-01-14 08:36:08 -0500105 drawTextBlob: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -0500106 drawVertices: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400107 flush: function() {},
Kevin Lubick5d5723c2018-12-07 10:09:11 -0500108 getTotalMatrix: function() {},
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500109 restore: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400110 rotate: function() {},
111 save: function() {},
112 scale: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400113 skew: function() {},
114 translate: function() {},
115
116 // private API
Kevin Lubickec4903d2019-01-14 08:36:08 -0500117 _drawSimpleText: function() {},
Kevin Lubick52b9f372018-12-04 13:57:36 -0500118 _readPixels: function() {},
119 _writePixels: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400120 delete: function() {},
121 },
122
Kevin Lubick35ac0382019-01-02 15:13:57 -0500123 SkFont: {
124 // public API (from C++ bindings)
125 getScaleX: function() {},
126 getSize: function() {},
127 getSkewX: function() {},
128 getTypeface: function() {},
129 measureText: function() {},
130 setScaleX: function() {},
131 setSize: function() {},
132 setSkewX: function() {},
133 setTypeface: function() {},
134 },
135
Kevin Lubickddd0a332018-12-12 10:35:13 -0500136 SkFontMgr: {
137 // public API (from C++ bindings)
138 RefDefault: function() {},
139 countFamilies: function() {},
140
141 // private API
142 _makeTypefaceFromData: function() {},
143 },
144
Kevin Lubick006a6f32018-10-19 14:34:34 -0400145 SkImage: {
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500146 // public API (from C++ bindings)
147 height: function() {},
148 width: function() {},
Alexander Khovansky3e119332018-11-15 02:01:19 +0300149 // private API
150 _encodeToData: function() {},
151 _encodeToDataWithFormat: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400152 },
153
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500154 SkMatrix: {
Kevin Lubickb9db3902018-11-26 11:47:54 -0500155 identity: function() {},
156 mapPoints: function() {},
157 multiply: function() {},
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500158 rotated: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500159 scaled: function() {},
160 skewed: function() {},
161 translated: function() {},
162 },
163
164 SkPaint: {
165 // public API (from C++ bindings)
166 /** @return {CanvasKit.SkPaint} */
167 copy: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -0500168 getBlendMode: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500169 getColor: function() {},
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500170 getFilterQuality: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500171 getStrokeCap: function() {},
172 getStrokeJoin: function() {},
173 getStrokeMiter: function() {},
174 getStrokeWidth: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500175 setAntiAlias: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -0500176 setBlendMode: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500177 setColor: function() {},
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500178 setFilterQuality: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500179 setMaskFilter: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500180 setPathEffect: function() {},
181 setShader: function() {},
182 setStrokeCap: function() {},
183 setStrokeJoin: function() {},
184 setStrokeMiter: function() {},
185 setStrokeWidth: function() {},
186 setStyle: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500187
188 //private API
189 delete: function() {},
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500190 },
191
Kevin Lubick006a6f32018-10-19 14:34:34 -0400192 SkPath: {
193 // public API (from C++ bindings)
Kevin Lubickb9db3902018-11-26 11:47:54 -0500194 computeTightBounds: function() {},
Kevin Lubick1646e7d2018-12-07 13:03:08 -0500195 contains: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500196 /** @return {CanvasKit.SkPath} */
197 copy: function() {},
198 countPoints: function() {},
199 equals: function() {},
200 getBounds: function() {},
201 getFillType: function() {},
202 getPoint: function() {},
Kevin Lubick1646e7d2018-12-07 13:03:08 -0500203 isEmpty: function() {},
Kevin Lubick2b79d1c2018-12-14 16:10:38 -0500204 isVolatile: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500205 reset: function() {},
206 rewind: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500207 setFillType: function() {},
Kevin Lubick2b79d1c2018-12-14 16:10:38 -0500208 setIsVolatile: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500209 toSVGString: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400210
211 // private API
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500212 _addArc: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400213 _addPath: function() {},
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500214 _addRect: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500215 _addRoundRect: function() {},
Alexander Khovansky3e119332018-11-15 02:01:19 +0300216 _arc: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400217 _arcTo: function() {},
218 _close: function() {},
219 _conicTo: function() {},
220 _cubicTo: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400221 _dash: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400222 _lineTo: function() {},
223 _moveTo: function() {},
224 _op: function() {},
225 _quadTo: function() {},
226 _rect: function() {},
227 _simplify: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400228 _stroke: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400229 _transform: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400230 _trim: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400231 delete: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500232 dump: function() {},
233 dumpHex: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400234 },
235
236 SkRect: {
237 fLeft: {},
238 fTop: {},
239 fRight: {},
240 fBottom: {},
241 },
242
243 SkSurface: {
244 // public API (from C++ bindings)
245 /** @return {CanvasKit.SkCanvas} */
246 getCanvas: function() {},
247 /** @return {CanvasKit.SkImage} */
248 makeImageSnapshot: function() {},
249
250 // private API
251 _flush: function() {},
252 _getRasterN32PremulSurface: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400253 delete: function() {},
254 },
255
Kevin Lubickec4903d2019-01-14 08:36:08 -0500256 SkTextBlob: {
257 MakeFromText: function() {},
258 _MakeFromText: function() {},
259 },
260
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400261 SkVertices: {
262 // public API (from C++ bindings)
Kevin Lubick12c0e502018-11-28 12:51:56 -0500263 bounds: function() {},
264 mode: function() {},
265 uniqueID: function() {},
266 vertexCount: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400267
268 // private API
269 /** @return {CanvasKit.SkVertices} */
270 _applyBones: function() {},
271 },
272
Kevin Lubick006a6f32018-10-19 14:34:34 -0400273 // Constants and Enums
274 gpu: {},
275 skottie: {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400276
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500277 TRANSPARENT: {},
278 RED: {},
279 BLUE: {},
280 YELLOW: {},
281 CYAN: {},
282 BLACK: {},
Kevin Lubickea905ec2018-11-30 14:05:58 -0500283 WHITE: {},
284
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500285 MOVE_VERB: {},
286 LINE_VERB: {},
287 QUAD_VERB: {},
288 CONIC_VERB: {},
289 CUBIC_VERB: {},
290 CLOSE_VERB: {},
291
Kevin Lubickea905ec2018-11-30 14:05:58 -0500292 AlphaType: {
293 Opaque: {},
294 Premul: {},
295 Unpremul: {},
296 },
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500297
298 BlendMode: {
299 Clear: {},
300 Src: {},
301 Dst: {},
302 SrcOver: {},
303 DstOver: {},
304 SrcIn: {},
305 DstIn: {},
306 SrcOut: {},
307 DstOut: {},
308 SrcATop: {},
309 DstATop: {},
310 Xor: {},
311 Plus: {},
312 Modulate: {},
313 Screen: {},
314 Overlay: {},
315 Darken: {},
316 Lighten: {},
317 ColorDodge: {},
318 ColorBurn: {},
319 HardLight: {},
320 SoftLight: {},
321 Difference: {},
322 Exclusion: {},
323 Multiply: {},
324 Hue: {},
325 Saturation: {},
326 Color: {},
327 Luminosity: {},
328 },
329
330 BlurStyle: {
331 Normal: {},
332 Solid: {},
333 Outer: {},
334 Inner: {},
335 },
336
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500337 ClipOp: {
338 Difference: {},
339 Intersect: {},
340 },
341
Kevin Lubickea905ec2018-11-30 14:05:58 -0500342 ColorType: {
343 Alpha_8: {},
344 RGB_565: {},
345 ARGB_4444: {},
346 RGBA_8888: {},
347 RGB_888x: {},
348 BGRA_8888: {},
349 RGBA_1010102: {},
350 RGB_101010x: {},
351 Gray_8: {},
352 RGBA_F16: {},
353 RGBA_F32: {},
354 },
355
Kevin Lubick006a6f32018-10-19 14:34:34 -0400356 FillType: {
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500357 Winding: {},
358 EvenOdd: {},
359 InverseWinding: {},
360 InverseEvenOdd: {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400361 },
362
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500363 FilterQuality: {
364 None: {},
365 Low: {},
366 Medium: {},
367 High: {},
368 },
369
Alexander Khovansky3e119332018-11-15 02:01:19 +0300370 ImageFormat: {
371 PNG: {},
372 JPEG: {},
373 },
374
Kevin Lubickb9db3902018-11-26 11:47:54 -0500375 PaintStyle: {
376 Fill: {},
377 Stroke: {},
378 StrokeAndFill: {},
379 },
380
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500381 PathOp: {
382 Difference: {},
383 Intersect: {},
384 Union: {},
385 XOR: {},
386 ReverseDifference: {},
387 },
388
Kevin Lubickb9db3902018-11-26 11:47:54 -0500389 StrokeCap: {
390 Butt: {},
391 Round: {},
392 Square: {},
393 },
394
395 StrokeJoin: {
396 Miter: {},
397 Round: {},
398 Bevel: {},
399 },
400
Kevin Lubickec4903d2019-01-14 08:36:08 -0500401 TextEncoding: {
402 UTF8: {},
403 UTF16: {},
404 UTF32: {},
405 GlyphID: {},
406 },
407
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500408 TileMode: {
409 Clamp: {},
410 Repeat: {},
411 Mirror: {},
Kevin Lubickd29edd72018-12-07 08:29:52 -0500412 Decal: {},
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500413 },
414
415 VertexMode: {
416 Triangles: {},
417 TrianglesStrip: {},
418 TriangleFan: {},
419 },
420
Kevin Lubick006a6f32018-10-19 14:34:34 -0400421 // Things Enscriptem adds for us
422
Kevin Lubick53965c92018-10-11 08:51:55 -0400423 /** Represents the heap of the WASM code
424 * @type {ArrayBuffer}
425 */
426 buffer: {},
427 /**
428 * @type {Float32Array}
429 */
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400430 HEAPF32: {},
Kevin Lubick53965c92018-10-11 08:51:55 -0400431 /**
432 * @type {Uint8Array}
433 */
434 HEAPU8: {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400435 /**
436 * @type {Uint16Array}
437 */
438 HEAPU16: {},
439 /**
440 * @type {Int32Array}
441 */
442 HEAP32: {},
Kevin Lubickf5ea37f2019-02-28 10:06:18 -0500443 /**
444 * @type {Uint32Array}
445 */
446 HEAPU32: {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400447 _malloc: function() {},
448 _free: function() {},
449 onRuntimeInitialized: function() {},
450};
Kevin Lubick217056c2018-09-20 17:39:31 -0400451
Kevin Lubick006a6f32018-10-19 14:34:34 -0400452// Public API things that are newly declared in the JS should go here.
453// It's not enough to declare them above, because closure can still erase them
454// unless they go on the prototype.
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500455CanvasKit.SkPath.prototype.addArc = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400456CanvasKit.SkPath.prototype.addPath = function() {};
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500457CanvasKit.SkPath.prototype.addRect = function() {};
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500458CanvasKit.SkPath.prototype.addRoundRect = function() {};
Alexander Khovansky3e119332018-11-15 02:01:19 +0300459CanvasKit.SkPath.prototype.arc = function() {};
Kevin Lubick006a6f32018-10-19 14:34:34 -0400460CanvasKit.SkPath.prototype.arcTo = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400461CanvasKit.SkPath.prototype.close = function() {};
Kevin Lubick006a6f32018-10-19 14:34:34 -0400462CanvasKit.SkPath.prototype.conicTo = function() {};
463CanvasKit.SkPath.prototype.cubicTo = function() {};
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400464CanvasKit.SkPath.prototype.dash = function() {};
Kevin Lubick006a6f32018-10-19 14:34:34 -0400465CanvasKit.SkPath.prototype.lineTo = function() {};
466CanvasKit.SkPath.prototype.moveTo = function() {};
467CanvasKit.SkPath.prototype.op = function() {};
468CanvasKit.SkPath.prototype.quadTo = function() {};
469CanvasKit.SkPath.prototype.rect = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400470CanvasKit.SkPath.prototype.simplify = function() {};
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400471CanvasKit.SkPath.prototype.stroke = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400472CanvasKit.SkPath.prototype.transform = function() {};
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400473CanvasKit.SkPath.prototype.trim = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400474
Kevin Lubick53965c92018-10-11 08:51:55 -0400475CanvasKit.SkSurface.prototype.flush = function() {};
Kevin Lubick5b90b842018-10-17 07:57:18 -0400476CanvasKit.SkSurface.prototype.dispose = function() {};
Kevin Lubick53965c92018-10-11 08:51:55 -0400477
Kevin Lubick12c0e502018-11-28 12:51:56 -0500478/** @return {CanvasKit.SkVertices} */
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400479CanvasKit.SkVertices.prototype.applyBones = function() {};
480
Alexander Khovansky3e119332018-11-15 02:01:19 +0300481CanvasKit.SkImage.prototype.encodeToData = function() {};
482
Kevin Lubickec4903d2019-01-14 08:36:08 -0500483CanvasKit.SkCanvas.prototype.drawText = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500484/** @return {Uint8Array} */
485CanvasKit.SkCanvas.prototype.readPixels = function() {};
486CanvasKit.SkCanvas.prototype.writePixels = function() {};
487
Kevin Lubickddd0a332018-12-12 10:35:13 -0500488CanvasKit.SkFontMgr.prototype.MakeTypefaceFromData = function() {};
489
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400490// Define StrokeOpts object
491var StrokeOpts = {};
492StrokeOpts.prototype.width;
493StrokeOpts.prototype.miter_limit;
494StrokeOpts.prototype.cap;
495StrokeOpts.prototype.join;
Kevin Lubick1646e7d2018-12-07 13:03:08 -0500496StrokeOpts.prototype.precision;
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400497
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500498// Define everything created in the canvas2d spec here
Kevin Lubickb9db3902018-11-26 11:47:54 -0500499var HTMLCanvas = {};
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500500HTMLCanvas.prototype.decodeImage = function() {};
501HTMLCanvas.prototype.dispose = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500502HTMLCanvas.prototype.getContext = function() {};
Kevin Lubick8e4a3312018-12-14 15:03:41 -0500503HTMLCanvas.prototype.loadFont = function() {};
Kevin Lubicka40f8322018-12-17 16:01:36 -0500504HTMLCanvas.prototype.makePath2D = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500505HTMLCanvas.prototype.toDataURL = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500506
507var CanvasRenderingContext2D = {};
508CanvasRenderingContext2D.prototype.addHitRegion = function() {};
509CanvasRenderingContext2D.prototype.arc = function() {};
510CanvasRenderingContext2D.prototype.arcTo = function() {};
511CanvasRenderingContext2D.prototype.beginPath = function() {};
512CanvasRenderingContext2D.prototype.bezierCurveTo = function() {};
513CanvasRenderingContext2D.prototype.clearHitRegions = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500514CanvasRenderingContext2D.prototype.clearRect = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500515CanvasRenderingContext2D.prototype.clip = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500516CanvasRenderingContext2D.prototype.closePath = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500517CanvasRenderingContext2D.prototype.createImageData = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500518CanvasRenderingContext2D.prototype.createLinearGradient = function() {};
Kevin Lubickd29edd72018-12-07 08:29:52 -0500519CanvasRenderingContext2D.prototype.createPattern = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500520CanvasRenderingContext2D.prototype.createRadialGradient = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500521CanvasRenderingContext2D.prototype.drawFocusIfNeeded = function() {};
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500522CanvasRenderingContext2D.prototype.drawImage = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500523CanvasRenderingContext2D.prototype.ellipse = function() {};
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500524CanvasRenderingContext2D.prototype.fill = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500525CanvasRenderingContext2D.prototype.fillRect = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500526CanvasRenderingContext2D.prototype.fillText = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500527CanvasRenderingContext2D.prototype.getImageData = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500528CanvasRenderingContext2D.prototype.getLineDash = function() {};
Kevin Lubick1646e7d2018-12-07 13:03:08 -0500529CanvasRenderingContext2D.prototype.isPointInPath = function() {};
530CanvasRenderingContext2D.prototype.isPointInStroke = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500531CanvasRenderingContext2D.prototype.lineTo = function() {};
532CanvasRenderingContext2D.prototype.measureText = function() {};
533CanvasRenderingContext2D.prototype.moveTo = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500534CanvasRenderingContext2D.prototype.putImageData = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500535CanvasRenderingContext2D.prototype.quadraticCurveTo = function() {};
536CanvasRenderingContext2D.prototype.rect = function() {};
537CanvasRenderingContext2D.prototype.removeHitRegion = function() {};
538CanvasRenderingContext2D.prototype.resetTransform = function() {};
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500539CanvasRenderingContext2D.prototype.restore = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500540CanvasRenderingContext2D.prototype.rotate = function() {};
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500541CanvasRenderingContext2D.prototype.save = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500542CanvasRenderingContext2D.prototype.scale = function() {};
543CanvasRenderingContext2D.prototype.scrollPathIntoView = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500544CanvasRenderingContext2D.prototype.setLineDash = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500545CanvasRenderingContext2D.prototype.setTransform = function() {};
546CanvasRenderingContext2D.prototype.stroke = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500547CanvasRenderingContext2D.prototype.strokeRect = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500548CanvasRenderingContext2D.prototype.strokeText = function() {};
549CanvasRenderingContext2D.prototype.transform = function() {};
550CanvasRenderingContext2D.prototype.translate = function() {};
551
Kevin Lubicka40f8322018-12-17 16:01:36 -0500552var Path2D = {};
553Path2D.prototype.addPath = function() {};
554Path2D.prototype.arc = function() {};
555Path2D.prototype.arcTo = function() {};
556Path2D.prototype.bezierCurveTo = function() {};
557Path2D.prototype.closePath = function() {};
558Path2D.prototype.ellipse = function() {};
559Path2D.prototype.lineTo = function() {};
560Path2D.prototype.moveTo = function() {};
561Path2D.prototype.quadraticCurveTo = function() {};
562Path2D.prototype.rect = function() {};
563
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500564var LinearCanvasGradient = {};
565LinearCanvasGradient.prototype.addColorStop = function() {};
566var RadialCanvasGradient = {};
567RadialCanvasGradient.prototype.addColorStop = function() {};
Kevin Lubickd29edd72018-12-07 08:29:52 -0500568var CanvasPattern = {};
569CanvasPattern.prototype.setTransform = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500570
Kevin Lubick52b9f372018-12-04 13:57:36 -0500571var ImageData = {
572 /**
573 * @type {Uint8ClampedArray}
574 */
575 data: {},
576 height: {},
577 width: {},
578};
579
Kevin Lubickd29edd72018-12-07 08:29:52 -0500580var DOMMatrix = {
581 a: {},
582 b: {},
583 c: {},
584 d: {},
585 e: {},
586 f: {},
587};
588
Kevin Lubick217056c2018-09-20 17:39:31 -0400589// 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 -0500590function loadWebAssemblyModule() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500591
592var DOMMatrix = {};