blob: 02c61b76ed3b69eb6622970cfdee0dcfe2b89bbf [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 Lubick006a6f32018-10-19 14:34:34 -040047 MakeSkDashPathEffect: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -040048 MakeSkVertices: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -040049 MakeSurface: function() {},
Kevin Lubickeb2f6b02018-11-29 15:07:02 -050050 /** @return {RadialCanvasGradient} */
51 MakeTwoPointConicalGradientShader: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -050052 MakeWebGLCanvasSurface: function() {},
Kevin Lubick217056c2018-09-20 17:39:31 -040053 currentContext: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -050054 getColorComponents: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -050055 getSkDataBytes: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -050056 multiplyByAlpha: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -040057 setCurrentContext: function() {},
Kevin Lubick217056c2018-09-20 17:39:31 -040058
59 // private API (i.e. things declared in the bindings that we use
60 // in the pre-js file)
Kevin Lubick52b9f372018-12-04 13:57:36 -050061 _MakeImage: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -040062 _MakeImageShader: function() {},
63 _MakeLinearGradientShader: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -050064 _MakePathFromCmds: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -040065 _MakeRadialGradientShader: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -040066 _MakeSkDashPathEffect: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -040067 _MakeSkVertices: function() {},
Kevin Lubickeb2f6b02018-11-29 15:07:02 -050068 _MakeTwoPointConicalGradientShader: function() {},
Kevin Lubick0a1293c2018-12-03 12:31:04 -050069 _decodeImage: function() {},
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -050070 _drawShapedText: function() {},
Kevin Lubickea905ec2018-11-30 14:05:58 -050071 _getRasterDirectSurface: function() {},
Kevin Lubick134be1d2018-10-30 15:05:04 -040072 _getRasterN32PremulSurface: function() {},
73 _getWebGLSurface: function() {},
Kevin Lubick217056c2018-09-20 17:39:31 -040074
Kevin Lubick1a05fce2018-11-20 12:51:16 -050075 // The testing object is meant to expose internal functions
76 // for more fine-grained testing, e.g. parseColor
77 _testing: {},
78
Kevin Lubick217056c2018-09-20 17:39:31 -040079 // Objects and properties on CanvasKit
80
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -050081 ShapedText: {
82 // public API (from C++ bindings)
83 getBounds: function() {},
84 },
85
Kevin Lubick006a6f32018-10-19 14:34:34 -040086 SkCanvas: {
87 // public API (from C++ bindings)
88 clear: function() {},
Kevin Lubickeb2f6b02018-11-29 15:07:02 -050089 clipPath: function() {},
Kevin Lubick5d5723c2018-12-07 10:09:11 -050090 clipRect: function() {},
91 concat: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -050092 drawArc: function() {},
Kevin Lubick0a1293c2018-12-03 12:31:04 -050093 drawImage: function() {},
94 drawImageRect: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -050095 drawLine: function() {},
96 drawOval: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -040097 drawPaint: function() {},
98 drawPath: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -050099 drawRect: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500100 drawRoundRect: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500101 drawShadow: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -0500102 drawText: function() {},
Kevin Lubickec4903d2019-01-14 08:36:08 -0500103 drawTextBlob: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -0500104 drawVertices: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400105 flush: function() {},
Kevin Lubick5d5723c2018-12-07 10:09:11 -0500106 getTotalMatrix: function() {},
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500107 restore: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400108 rotate: function() {},
109 save: function() {},
110 scale: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400111 skew: function() {},
112 translate: function() {},
113
114 // private API
Kevin Lubickec4903d2019-01-14 08:36:08 -0500115 _drawSimpleText: function() {},
Kevin Lubick52b9f372018-12-04 13:57:36 -0500116 _readPixels: function() {},
117 _writePixels: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400118 delete: function() {},
119 },
120
Kevin Lubick35ac0382019-01-02 15:13:57 -0500121 SkFont: {
122 // public API (from C++ bindings)
123 getScaleX: function() {},
124 getSize: function() {},
125 getSkewX: function() {},
126 getTypeface: function() {},
127 measureText: function() {},
128 setScaleX: function() {},
129 setSize: function() {},
130 setSkewX: function() {},
131 setTypeface: function() {},
132 },
133
Kevin Lubickddd0a332018-12-12 10:35:13 -0500134 SkFontMgr: {
135 // public API (from C++ bindings)
136 RefDefault: function() {},
137 countFamilies: function() {},
138
139 // private API
140 _makeTypefaceFromData: function() {},
141 },
142
Kevin Lubick006a6f32018-10-19 14:34:34 -0400143 SkImage: {
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500144 // public API (from C++ bindings)
145 height: function() {},
146 width: function() {},
Alexander Khovansky3e119332018-11-15 02:01:19 +0300147 // private API
148 _encodeToData: function() {},
149 _encodeToDataWithFormat: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400150 },
151
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500152 SkMatrix: {
Kevin Lubickb9db3902018-11-26 11:47:54 -0500153 identity: function() {},
154 mapPoints: function() {},
155 multiply: function() {},
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500156 rotated: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500157 scaled: function() {},
158 skewed: function() {},
159 translated: function() {},
160 },
161
162 SkPaint: {
163 // public API (from C++ bindings)
164 /** @return {CanvasKit.SkPaint} */
165 copy: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -0500166 getBlendMode: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500167 getColor: function() {},
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500168 getFilterQuality: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500169 getStrokeCap: function() {},
170 getStrokeJoin: function() {},
171 getStrokeMiter: function() {},
172 getStrokeWidth: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500173 setAntiAlias: function() {},
Kevin Lubick12c0e502018-11-28 12:51:56 -0500174 setBlendMode: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500175 setColor: function() {},
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500176 setFilterQuality: function() {},
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500177 setMaskFilter: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500178 setPathEffect: function() {},
179 setShader: function() {},
180 setStrokeCap: function() {},
181 setStrokeJoin: function() {},
182 setStrokeMiter: function() {},
183 setStrokeWidth: function() {},
184 setStyle: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500185
186 //private API
187 delete: function() {},
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500188 },
189
Kevin Lubick006a6f32018-10-19 14:34:34 -0400190 SkPath: {
191 // public API (from C++ bindings)
Kevin Lubickb9db3902018-11-26 11:47:54 -0500192 computeTightBounds: function() {},
Kevin Lubick1646e7d2018-12-07 13:03:08 -0500193 contains: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500194 /** @return {CanvasKit.SkPath} */
195 copy: function() {},
196 countPoints: function() {},
197 equals: function() {},
198 getBounds: function() {},
199 getFillType: function() {},
200 getPoint: function() {},
Kevin Lubick1646e7d2018-12-07 13:03:08 -0500201 isEmpty: function() {},
Kevin Lubick2b79d1c2018-12-14 16:10:38 -0500202 isVolatile: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500203 reset: function() {},
204 rewind: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500205 setFillType: function() {},
Kevin Lubick2b79d1c2018-12-14 16:10:38 -0500206 setIsVolatile: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500207 toSVGString: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400208
209 // private API
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500210 _addArc: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400211 _addPath: function() {},
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500212 _addRect: function() {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500213 _addRoundRect: function() {},
Alexander Khovansky3e119332018-11-15 02:01:19 +0300214 _arc: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400215 _arcTo: function() {},
216 _close: function() {},
217 _conicTo: function() {},
218 _cubicTo: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400219 _dash: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400220 _lineTo: function() {},
221 _moveTo: function() {},
222 _op: function() {},
223 _quadTo: function() {},
224 _rect: function() {},
225 _simplify: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400226 _stroke: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400227 _transform: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400228 _trim: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400229 delete: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500230 dump: function() {},
231 dumpHex: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400232 },
233
234 SkRect: {
235 fLeft: {},
236 fTop: {},
237 fRight: {},
238 fBottom: {},
239 },
240
241 SkSurface: {
242 // public API (from C++ bindings)
243 /** @return {CanvasKit.SkCanvas} */
244 getCanvas: function() {},
245 /** @return {CanvasKit.SkImage} */
246 makeImageSnapshot: function() {},
247
248 // private API
249 _flush: function() {},
250 _getRasterN32PremulSurface: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400251 delete: function() {},
252 },
253
Kevin Lubickec4903d2019-01-14 08:36:08 -0500254 SkTextBlob: {
255 MakeFromText: function() {},
256 _MakeFromText: function() {},
257 },
258
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400259 SkVertices: {
260 // public API (from C++ bindings)
Kevin Lubick12c0e502018-11-28 12:51:56 -0500261 bounds: function() {},
262 mode: function() {},
263 uniqueID: function() {},
264 vertexCount: function() {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400265
266 // private API
267 /** @return {CanvasKit.SkVertices} */
268 _applyBones: function() {},
269 },
270
Kevin Lubick006a6f32018-10-19 14:34:34 -0400271 // Constants and Enums
272 gpu: {},
273 skottie: {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400274
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500275 TRANSPARENT: {},
276 RED: {},
277 BLUE: {},
278 YELLOW: {},
279 CYAN: {},
280 BLACK: {},
Kevin Lubickea905ec2018-11-30 14:05:58 -0500281 WHITE: {},
282
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500283 MOVE_VERB: {},
284 LINE_VERB: {},
285 QUAD_VERB: {},
286 CONIC_VERB: {},
287 CUBIC_VERB: {},
288 CLOSE_VERB: {},
289
Kevin Lubickea905ec2018-11-30 14:05:58 -0500290 AlphaType: {
291 Opaque: {},
292 Premul: {},
293 Unpremul: {},
294 },
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500295
296 BlendMode: {
297 Clear: {},
298 Src: {},
299 Dst: {},
300 SrcOver: {},
301 DstOver: {},
302 SrcIn: {},
303 DstIn: {},
304 SrcOut: {},
305 DstOut: {},
306 SrcATop: {},
307 DstATop: {},
308 Xor: {},
309 Plus: {},
310 Modulate: {},
311 Screen: {},
312 Overlay: {},
313 Darken: {},
314 Lighten: {},
315 ColorDodge: {},
316 ColorBurn: {},
317 HardLight: {},
318 SoftLight: {},
319 Difference: {},
320 Exclusion: {},
321 Multiply: {},
322 Hue: {},
323 Saturation: {},
324 Color: {},
325 Luminosity: {},
326 },
327
328 BlurStyle: {
329 Normal: {},
330 Solid: {},
331 Outer: {},
332 Inner: {},
333 },
334
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500335 ClipOp: {
336 Difference: {},
337 Intersect: {},
338 },
339
Kevin Lubickea905ec2018-11-30 14:05:58 -0500340 ColorType: {
341 Alpha_8: {},
342 RGB_565: {},
343 ARGB_4444: {},
344 RGBA_8888: {},
345 RGB_888x: {},
346 BGRA_8888: {},
347 RGBA_1010102: {},
348 RGB_101010x: {},
349 Gray_8: {},
350 RGBA_F16: {},
351 RGBA_F32: {},
352 },
353
Kevin Lubick006a6f32018-10-19 14:34:34 -0400354 FillType: {
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500355 Winding: {},
356 EvenOdd: {},
357 InverseWinding: {},
358 InverseEvenOdd: {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400359 },
360
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500361 FilterQuality: {
362 None: {},
363 Low: {},
364 Medium: {},
365 High: {},
366 },
367
Alexander Khovansky3e119332018-11-15 02:01:19 +0300368 ImageFormat: {
369 PNG: {},
370 JPEG: {},
371 },
372
Kevin Lubickb9db3902018-11-26 11:47:54 -0500373 PaintStyle: {
374 Fill: {},
375 Stroke: {},
376 StrokeAndFill: {},
377 },
378
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500379 PathOp: {
380 Difference: {},
381 Intersect: {},
382 Union: {},
383 XOR: {},
384 ReverseDifference: {},
385 },
386
Kevin Lubickb9db3902018-11-26 11:47:54 -0500387 StrokeCap: {
388 Butt: {},
389 Round: {},
390 Square: {},
391 },
392
393 StrokeJoin: {
394 Miter: {},
395 Round: {},
396 Bevel: {},
397 },
398
Kevin Lubickec4903d2019-01-14 08:36:08 -0500399 TextEncoding: {
400 UTF8: {},
401 UTF16: {},
402 UTF32: {},
403 GlyphID: {},
404 },
405
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500406 TileMode: {
407 Clamp: {},
408 Repeat: {},
409 Mirror: {},
Kevin Lubickd29edd72018-12-07 08:29:52 -0500410 Decal: {},
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500411 },
412
413 VertexMode: {
414 Triangles: {},
415 TrianglesStrip: {},
416 TriangleFan: {},
417 },
418
Kevin Lubick006a6f32018-10-19 14:34:34 -0400419 // Things Enscriptem adds for us
420
Kevin Lubick53965c92018-10-11 08:51:55 -0400421 /** Represents the heap of the WASM code
422 * @type {ArrayBuffer}
423 */
424 buffer: {},
425 /**
426 * @type {Float32Array}
427 */
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400428 HEAPF32: {},
Kevin Lubick53965c92018-10-11 08:51:55 -0400429 /**
430 * @type {Uint8Array}
431 */
432 HEAPU8: {},
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400433 /**
434 * @type {Uint16Array}
435 */
436 HEAPU16: {},
437 /**
438 * @type {Int32Array}
439 */
440 HEAP32: {},
Kevin Lubick53965c92018-10-11 08:51:55 -0400441
Kevin Lubick006a6f32018-10-19 14:34:34 -0400442 _malloc: function() {},
443 _free: function() {},
444 onRuntimeInitialized: function() {},
445};
Kevin Lubick217056c2018-09-20 17:39:31 -0400446
Kevin Lubick006a6f32018-10-19 14:34:34 -0400447// Public API things that are newly declared in the JS should go here.
448// It's not enough to declare them above, because closure can still erase them
449// unless they go on the prototype.
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500450CanvasKit.SkPath.prototype.addArc = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400451CanvasKit.SkPath.prototype.addPath = function() {};
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500452CanvasKit.SkPath.prototype.addRect = function() {};
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500453CanvasKit.SkPath.prototype.addRoundRect = function() {};
Alexander Khovansky3e119332018-11-15 02:01:19 +0300454CanvasKit.SkPath.prototype.arc = function() {};
Kevin Lubick006a6f32018-10-19 14:34:34 -0400455CanvasKit.SkPath.prototype.arcTo = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400456CanvasKit.SkPath.prototype.close = function() {};
Kevin Lubick006a6f32018-10-19 14:34:34 -0400457CanvasKit.SkPath.prototype.conicTo = function() {};
458CanvasKit.SkPath.prototype.cubicTo = function() {};
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400459CanvasKit.SkPath.prototype.dash = function() {};
Kevin Lubick006a6f32018-10-19 14:34:34 -0400460CanvasKit.SkPath.prototype.lineTo = function() {};
461CanvasKit.SkPath.prototype.moveTo = function() {};
462CanvasKit.SkPath.prototype.op = function() {};
463CanvasKit.SkPath.prototype.quadTo = function() {};
464CanvasKit.SkPath.prototype.rect = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400465CanvasKit.SkPath.prototype.simplify = function() {};
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400466CanvasKit.SkPath.prototype.stroke = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400467CanvasKit.SkPath.prototype.transform = function() {};
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400468CanvasKit.SkPath.prototype.trim = function() {};
Kevin Lubick217056c2018-09-20 17:39:31 -0400469
Kevin Lubick53965c92018-10-11 08:51:55 -0400470CanvasKit.SkSurface.prototype.flush = function() {};
Kevin Lubick5b90b842018-10-17 07:57:18 -0400471CanvasKit.SkSurface.prototype.dispose = function() {};
Kevin Lubick53965c92018-10-11 08:51:55 -0400472
Kevin Lubick12c0e502018-11-28 12:51:56 -0500473/** @return {CanvasKit.SkVertices} */
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400474CanvasKit.SkVertices.prototype.applyBones = function() {};
475
Alexander Khovansky3e119332018-11-15 02:01:19 +0300476CanvasKit.SkImage.prototype.encodeToData = function() {};
477
Kevin Lubickec4903d2019-01-14 08:36:08 -0500478CanvasKit.SkCanvas.prototype.drawText = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500479/** @return {Uint8Array} */
480CanvasKit.SkCanvas.prototype.readPixels = function() {};
481CanvasKit.SkCanvas.prototype.writePixels = function() {};
482
Kevin Lubickddd0a332018-12-12 10:35:13 -0500483CanvasKit.SkFontMgr.prototype.MakeTypefaceFromData = function() {};
484
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400485// Define StrokeOpts object
486var StrokeOpts = {};
487StrokeOpts.prototype.width;
488StrokeOpts.prototype.miter_limit;
489StrokeOpts.prototype.cap;
490StrokeOpts.prototype.join;
Kevin Lubick1646e7d2018-12-07 13:03:08 -0500491StrokeOpts.prototype.precision;
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400492
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500493// Define everything created in the canvas2d spec here
Kevin Lubickb9db3902018-11-26 11:47:54 -0500494var HTMLCanvas = {};
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500495HTMLCanvas.prototype.decodeImage = function() {};
496HTMLCanvas.prototype.dispose = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500497HTMLCanvas.prototype.getContext = function() {};
Kevin Lubick8e4a3312018-12-14 15:03:41 -0500498HTMLCanvas.prototype.loadFont = function() {};
Kevin Lubicka40f8322018-12-17 16:01:36 -0500499HTMLCanvas.prototype.makePath2D = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500500HTMLCanvas.prototype.toDataURL = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500501
502var CanvasRenderingContext2D = {};
503CanvasRenderingContext2D.prototype.addHitRegion = function() {};
504CanvasRenderingContext2D.prototype.arc = function() {};
505CanvasRenderingContext2D.prototype.arcTo = function() {};
506CanvasRenderingContext2D.prototype.beginPath = function() {};
507CanvasRenderingContext2D.prototype.bezierCurveTo = function() {};
508CanvasRenderingContext2D.prototype.clearHitRegions = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500509CanvasRenderingContext2D.prototype.clearRect = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500510CanvasRenderingContext2D.prototype.clip = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500511CanvasRenderingContext2D.prototype.closePath = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500512CanvasRenderingContext2D.prototype.createImageData = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500513CanvasRenderingContext2D.prototype.createLinearGradient = function() {};
Kevin Lubickd29edd72018-12-07 08:29:52 -0500514CanvasRenderingContext2D.prototype.createPattern = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500515CanvasRenderingContext2D.prototype.createRadialGradient = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500516CanvasRenderingContext2D.prototype.drawFocusIfNeeded = function() {};
Kevin Lubick0a1293c2018-12-03 12:31:04 -0500517CanvasRenderingContext2D.prototype.drawImage = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500518CanvasRenderingContext2D.prototype.ellipse = function() {};
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500519CanvasRenderingContext2D.prototype.fill = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500520CanvasRenderingContext2D.prototype.fillRect = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500521CanvasRenderingContext2D.prototype.fillText = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500522CanvasRenderingContext2D.prototype.getImageData = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500523CanvasRenderingContext2D.prototype.getLineDash = function() {};
Kevin Lubick1646e7d2018-12-07 13:03:08 -0500524CanvasRenderingContext2D.prototype.isPointInPath = function() {};
525CanvasRenderingContext2D.prototype.isPointInStroke = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500526CanvasRenderingContext2D.prototype.lineTo = function() {};
527CanvasRenderingContext2D.prototype.measureText = function() {};
528CanvasRenderingContext2D.prototype.moveTo = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -0500529CanvasRenderingContext2D.prototype.putImageData = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500530CanvasRenderingContext2D.prototype.quadraticCurveTo = function() {};
531CanvasRenderingContext2D.prototype.rect = function() {};
532CanvasRenderingContext2D.prototype.removeHitRegion = function() {};
533CanvasRenderingContext2D.prototype.resetTransform = function() {};
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500534CanvasRenderingContext2D.prototype.restore = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500535CanvasRenderingContext2D.prototype.rotate = function() {};
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500536CanvasRenderingContext2D.prototype.save = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500537CanvasRenderingContext2D.prototype.scale = function() {};
538CanvasRenderingContext2D.prototype.scrollPathIntoView = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500539CanvasRenderingContext2D.prototype.setLineDash = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500540CanvasRenderingContext2D.prototype.setTransform = function() {};
541CanvasRenderingContext2D.prototype.stroke = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500542CanvasRenderingContext2D.prototype.strokeRect = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -0500543CanvasRenderingContext2D.prototype.strokeText = function() {};
544CanvasRenderingContext2D.prototype.transform = function() {};
545CanvasRenderingContext2D.prototype.translate = function() {};
546
Kevin Lubicka40f8322018-12-17 16:01:36 -0500547var Path2D = {};
548Path2D.prototype.addPath = function() {};
549Path2D.prototype.arc = function() {};
550Path2D.prototype.arcTo = function() {};
551Path2D.prototype.bezierCurveTo = function() {};
552Path2D.prototype.closePath = function() {};
553Path2D.prototype.ellipse = function() {};
554Path2D.prototype.lineTo = function() {};
555Path2D.prototype.moveTo = function() {};
556Path2D.prototype.quadraticCurveTo = function() {};
557Path2D.prototype.rect = function() {};
558
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500559var LinearCanvasGradient = {};
560LinearCanvasGradient.prototype.addColorStop = function() {};
561var RadialCanvasGradient = {};
562RadialCanvasGradient.prototype.addColorStop = function() {};
Kevin Lubickd29edd72018-12-07 08:29:52 -0500563var CanvasPattern = {};
564CanvasPattern.prototype.setTransform = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500565
Kevin Lubick52b9f372018-12-04 13:57:36 -0500566var ImageData = {
567 /**
568 * @type {Uint8ClampedArray}
569 */
570 data: {},
571 height: {},
572 width: {},
573};
574
Kevin Lubickd29edd72018-12-07 08:29:52 -0500575var DOMMatrix = {
576 a: {},
577 b: {},
578 c: {},
579 d: {},
580 e: {},
581 f: {},
582};
583
Kevin Lubick217056c2018-09-20 17:39:31 -0400584// 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 -0500585function loadWebAssemblyModule() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -0500586
587var DOMMatrix = {};