blob: 71c6b07acc5acd2c82699b2a7d198d4ebd454b6c [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 = {
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -050026 // public API (i.e. things we declare in the pre-js file or in the cpp bindings)
27 Color: function() {},
Nathaniel Nifonge5d32542020-03-26 09:27:48 -040028 Color4f: function() {},
Kevin Lubick93f1a382020-06-02 16:15:23 -040029 ColorAsInt: function() {},
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -050030 LTRBRect: function() {},
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -050031 XYWHRect: function() {},
Kevin Lubickf8823b52020-09-03 10:02:10 -040032 LTRBiRect: function() {},
33 XYWHiRect: function() {},
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -050034 RRectXY: function() {},
35 /** @return {ImageData} */
36 ImageData: function() {},
Kevin Lubick543f3522019-03-08 10:04:28 -050037
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -050038 GetWebGLContext: function() {},
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -050039 MakeCanvas: function() {},
40 MakeCanvasSurface: function() {},
41 MakeGrContext: function() {},
Kevin Lubick54c1b3d2020-10-07 16:09:22 -040042 /** @return {CanvasKit.AnimatedImage} */
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -050043 MakeAnimatedImageFromEncoded: function() {},
Kevin Lubick54c1b3d2020-10-07 16:09:22 -040044 /** @return {CanvasKit.Image} */
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -050045 MakeImage: function() {},
Kevin Lubick54c1b3d2020-10-07 16:09:22 -040046 /** @return {CanvasKit.Image} */
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -050047 MakeImageFromEncoded: function() {},
Elliot Evans28796192020-06-15 12:53:27 -060048 MakeImageFromCanvasImageSource: function() {},
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -050049 MakeOnScreenGLSurface: function() {},
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -050050 MakeRenderTarget: function() {},
Kevin Lubick54c1b3d2020-10-07 16:09:22 -040051 MakePicture: function() {},
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -050052 MakeSWCanvasSurface: function() {},
53 MakeManagedAnimation: function() {},
54 MakeParticles: function() {},
Kevin Lubick54c1b3d2020-10-07 16:09:22 -040055 MakeVertices: function() {},
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -050056 MakeSurface: function() {},
Kevin Lubicka8f4c912020-11-04 07:23:37 -050057 MakeRasterDirectSurface: function() {},
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -050058 MakeWebGLCanvasSurface: function() {},
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -050059 Malloc: function() {},
Kevin Lubick30793852020-09-25 10:52:16 -040060 MallocGlyphIDs: function() {},
Kevin Lubickcf118922020-05-28 14:43:38 -040061 Free: function() {},
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -050062 computeTonalColors: function() {},
Kevin Lubickf7fdf1a2020-12-10 15:21:01 -050063 deleteContext: function() {},
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -050064 getColorComponents: function() {},
65 getDecodeCacheLimitBytes: function() {},
66 getDecodeCacheUsageBytes: function() {},
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -050067 multiplyByAlpha: function() {},
68 parseColorString: function() {},
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -050069 setDecodeCacheLimitBytes: function() {},
Kevin Lubickcbaea292021-01-13 14:16:58 -050070 getShadowLocalBounds: function() {},
Kevin Lubicke70af512020-05-14 14:50:54 -040071 // Defined by emscripten.
Kevin Lubickf7fdf1a2020-12-10 15:21:01 -050072 createContext: function() {},
Kevin Lubicke70af512020-05-14 14:50:54 -040073
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -050074 // private API (i.e. things declared in the bindings that we use
75 // in the pre-js file)
Kevin Lubickf6114042021-08-25 13:13:09 -040076 _MakeGrContext: function() {},
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -050077 _MakeImage: function() {},
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -050078 _MakeManagedAnimation: function() {},
Kevin Lubickf6114042021-08-25 13:13:09 -040079 _MakeOnScreenGLSurface: function() {},
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -050080 _MakeParticles: function() {},
Kevin Lubick54c1b3d2020-10-07 16:09:22 -040081 _MakePicture: function() {},
Kevin Lubickf6114042021-08-25 13:13:09 -040082 _MakeRenderTargetII: function() {},
83 _MakeRenderTargetWH: function() {},
84 _computeTonalColors: function() {},
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -050085 _decodeAnimatedImage: function() {},
86 _decodeImage: function() {},
Kevin Lubickcbaea292021-01-13 14:16:58 -050087 _getShadowLocalBounds: function() {},
Kevin Lubick7b6a9282021-06-03 08:02:03 -040088 _setTextureCleanup: function() {},
Kevin Lubick217056c2018-09-20 17:39:31 -040089
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -050090 // The testing object is meant to expose internal functions
91 // for more fine-grained testing, e.g. parseColor
92 _testing: {},
Kevin Lubick1a05fce2018-11-20 12:51:16 -050093
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -050094 // Objects and properties on CanvasKit
Kevin Lubick217056c2018-09-20 17:39:31 -040095
Kevin Lubickf8823b52020-09-03 10:02:10 -040096 Animation: {
97 prototype: {
98 render: function() {},
Kevin Lubicked962642021-02-02 08:18:11 -050099 size: function() {},
Kevin Lubickf8823b52020-09-03 10:02:10 -0400100 },
101 _render: function() {},
Kevin Lubicked962642021-02-02 08:18:11 -0500102 _size: function() {},
Kevin Lubickf8823b52020-09-03 10:02:10 -0400103 },
104
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500105 GrContext: {
106 // public API (from C++ bindings)
107 getResourceCacheLimitBytes: function() {},
108 getResourceCacheUsageBytes: function() {},
109 releaseResourcesAndAbandonContext: function() {},
110 setResourceCacheLimitBytes: function() {},
111 },
Kevin Lubickcd544662019-03-22 15:41:36 -0400112
Nathaniel Nifong1bedbeb2020-05-04 16:46:17 -0400113 ManagedAnimation: {
114 prototype: {
Kevin Lubickf8823b52020-09-03 10:02:10 -0400115 render: function() {},
116 seek: function() {},
117 seekFrame: function() {},
Nathaniel Nifong1bedbeb2020-05-04 16:46:17 -0400118 setColor: function() {},
Kevin Lubicked962642021-02-02 08:18:11 -0500119 size: function() {},
Nathaniel Nifong1bedbeb2020-05-04 16:46:17 -0400120 },
Kevin Lubickf8823b52020-09-03 10:02:10 -0400121 _render: function() {},
122 _seek: function() {},
123 _seekFrame: function() {},
Kevin Lubicked962642021-02-02 08:18:11 -0500124 _size: function() {},
Nathaniel Nifong1bedbeb2020-05-04 16:46:17 -0400125 },
126
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500127 Paragraph: {
128 // public API (from C++ bindings)
129 didExceedMaxLines: function() {},
130 getAlphabeticBaseline: function() {},
131 getGlyphPositionAtCoordinate: function() {},
132 getHeight: function() {},
133 getIdeographicBaseline: function() {},
Kevin Lubicke677f4a2020-11-04 09:46:22 -0500134 getLineMetrics: function() {},
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500135 getLongestLine: function() {},
136 getMaxIntrinsicWidth: function() {},
137 getMaxWidth: function() {},
138 getMinIntrinsicWidth: function() {},
139 getWordBoundary: function() {},
Mike Reedca2ad532021-05-03 13:51:30 -0400140 getShapedLines: function() {},
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500141 layout: function() {},
Kevin Lubick369f6a52019-10-03 11:22:08 -0400142
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500143 // private API
144 /** @return {Float32Array} */
145 _getRectsForRange: function() {},
Harry Terkelsen223ffcd2020-10-02 15:24:13 -0700146 _getRectsForPlaceholders: function() {},
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500147 },
Kevin Lubick369f6a52019-10-03 11:22:08 -0400148
Nathaniel Nifong1bedbeb2020-05-04 16:46:17 -0400149 ParagraphBuilder: {
150 Make: function() {},
Harry Terkelsen10f019c2020-08-04 13:21:09 -0700151 MakeFromFontProvider: function() {},
Mike Reedc48c3e52021-05-06 18:12:27 -0400152 ShapeText: function() {},
Nathaniel Nifong1bedbeb2020-05-04 16:46:17 -0400153 addText: function() {},
154 build: function() {},
155 pop: function() {},
156
157 prototype: {
158 pushStyle: function() {},
Nathaniel Nifonge09b3142020-08-04 09:06:54 -0400159 pushPaintStyle: function() {},
Harry Terkelsen223ffcd2020-10-02 15:24:13 -0700160 addPlaceholder: function() {},
Nathaniel Nifong1bedbeb2020-05-04 16:46:17 -0400161 },
162
163 // private API
164 _Make: function() {},
Harry Terkelsen10f019c2020-08-04 13:21:09 -0700165 _MakeFromFontProvider: function() {},
Mike Reedc48c3e52021-05-06 18:12:27 -0400166 _ShapeText: function() {},
Nathaniel Nifong1bedbeb2020-05-04 16:46:17 -0400167 _pushStyle: function() {},
Nathaniel Nifonge09b3142020-08-04 09:06:54 -0400168 _pushPaintStyle: function() {},
Harry Terkelsen223ffcd2020-10-02 15:24:13 -0700169 _addPlaceholder: function() {},
Nathaniel Nifong1bedbeb2020-05-04 16:46:17 -0400170 },
171
Kevin Lubick54c1b3d2020-10-07 16:09:22 -0400172 RuntimeEffect: {
Kevin Lubick70b67292021-02-03 11:26:12 -0500173 // public API (from JS bindings)
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500174 Make: function() {},
Brian Osmanf2f3d522021-02-03 16:12:09 -0500175 getUniform: function() {},
176 getUniformCount: function() {},
177 getUniformFloatCount: function() {},
178 getUniformName: function() {},
Kevin Lubick70b67292021-02-03 11:26:12 -0500179 prototype: {
180 makeShader: function() {},
181 makeShaderWithChildren: function() {},
182 },
183 // private API (from C++ bindings)
184 _Make: function() {},
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500185 _makeShader: function() {},
186 _makeShaderWithChildren: function() {},
187 },
Kevin Lubick4b5b6452019-12-06 13:55:58 -0500188
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500189 ParagraphStyle: function() {},
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400190
Kevin Lubick54c1b3d2020-10-07 16:09:22 -0400191 AnimatedImage: {
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500192 // public API (from C++ bindings)
193 decodeNextFrame: function() {},
194 getFrameCount: function() {},
195 getRepetitionCount: function() {},
196 height: function() {},
Kevin Lubick6017b482021-05-20 13:39:30 -0400197 makeImageAtCurrentFrame: function() {},
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500198 reset: function() {},
199 width: function() {},
200 },
Kevin Lubick6b921b72019-09-18 16:18:17 -0400201
Kevin Lubick54c1b3d2020-10-07 16:09:22 -0400202 Canvas: {
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500203 // public API (from C++ bindings)
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500204 clipPath: function() {},
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500205 getSaveCount: function() {},
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500206 makeSurface: function() {},
Nathaniel Nifong00de91c2020-05-06 16:22:33 -0400207 markCTM: function() {},
208 findMarkedCTM: function() {},
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500209 restore: function() {},
210 restoreToCount: function() {},
211 rotate: function() {},
212 save: function() {},
Kevin Lubick9fe83912020-11-03 17:08:34 -0500213 saveLayerPaint: function() {},
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500214 scale: function() {},
215 skew: function() {},
216 translate: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400217
Nathaniel Nifong1bedbeb2020-05-04 16:46:17 -0400218 prototype: {
219 clear: function() {},
Kevin Lubickbe728012020-09-03 11:57:12 +0000220 clipRRect: function() {},
Kevin Lubickf8823b52020-09-03 10:02:10 -0400221 clipRect: function() {},
Kevin Lubickbe728012020-09-03 11:57:12 +0000222 concat: function() {},
Kevin Lubickf8823b52020-09-03 10:02:10 -0400223 drawArc: function() {},
Kevin Lubickbe728012020-09-03 11:57:12 +0000224 drawAtlas: function() {},
Kevin Lubickf6114042021-08-25 13:13:09 -0400225 drawCircle: function() {},
Nathaniel Nifong1bedbeb2020-05-04 16:46:17 -0400226 drawColor: function() {},
Kevin Lubick93f1a382020-06-02 16:15:23 -0400227 drawColorComponents: function() {},
Kevin Lubickf6114042021-08-25 13:13:09 -0400228 drawColorInt: function() {},
Mike Reed9983b1e2021-04-14 14:49:35 -0400229 drawDRRect: function() {},
230 drawGlyphs: function() {},
Kevin Lubickf6114042021-08-25 13:13:09 -0400231 drawImage: function() {},
232 drawImageCubic: function() {},
Kevin Lubickf8823b52020-09-03 10:02:10 -0400233 drawImageNine: function() {},
Kevin Lubickf6114042021-08-25 13:13:09 -0400234 drawImageOptions: function() {},
Kevin Lubickf8823b52020-09-03 10:02:10 -0400235 drawImageRect: function() {},
Kevin Lubick72f40762020-12-16 16:00:55 -0500236 drawImageRectCubic: function() {},
237 drawImageRectOptions: function() {},
Kevin Lubickf6114042021-08-25 13:13:09 -0400238 drawLine: function() {},
Kevin Lubickf8823b52020-09-03 10:02:10 -0400239 drawOval: function() {},
Kevin Lubickf6114042021-08-25 13:13:09 -0400240 drawPaint: function() {},
241 drawParagraph: function() {},
Mike Reedbe834bf2021-04-14 14:51:59 -0400242 drawPatch: function() {},
Kevin Lubickf6114042021-08-25 13:13:09 -0400243 drawPath: function() {},
244 drawPicture: function() {},
Kevin Lubickbe728012020-09-03 11:57:12 +0000245 drawPoints: function() {},
246 drawRRect: function() {},
Kevin Lubickf6114042021-08-25 13:13:09 -0400247 drawRect4f: function() {},
248 drawRect: function() {},
Nathaniel Nifong1bedbeb2020-05-04 16:46:17 -0400249 drawShadow: function() {},
Kevin Lubickbe728012020-09-03 11:57:12 +0000250 drawText: function() {},
Kevin Lubickf6114042021-08-25 13:13:09 -0400251 drawTextBlob: function() {},
252 drawVertices: function() {},
Kevin Lubickbe728012020-09-03 11:57:12 +0000253 findMarkedCTM: function() {},
254 getLocalToDevice: function() {},
255 getTotalMatrix: function() {},
256 readPixels: function() {},
Kevin Lubickf8823b52020-09-03 10:02:10 -0400257 saveLayer: function() {},
Kevin Lubickbe728012020-09-03 11:57:12 +0000258 writePixels : function() {},
Nathaniel Nifong1bedbeb2020-05-04 16:46:17 -0400259 },
260
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500261 // private API
Nathaniel Nifong1bedbeb2020-05-04 16:46:17 -0400262 _clear: function() {},
Kevin Lubickbe728012020-09-03 11:57:12 +0000263 _clipRRect: function() {},
Kevin Lubickf8823b52020-09-03 10:02:10 -0400264 _clipRect: function() {},
Kevin Lubick6bffe392020-04-02 15:24:15 -0400265 _concat: function() {},
Kevin Lubickf8823b52020-09-03 10:02:10 -0400266 _drawArc: function() {},
Mike Reed55144312021-03-25 13:13:23 -0400267 _drawAtlasCubic: function() {},
Kevin Lubickf6114042021-08-25 13:13:09 -0400268 _drawAtlasOptions: function() {},
269 _drawCircle: function() {},
Nathaniel Nifong1bedbeb2020-05-04 16:46:17 -0400270 _drawColor: function() {},
Kevin Lubickf6114042021-08-25 13:13:09 -0400271 _drawColorInt: function() {},
Kevin Lubickbe728012020-09-03 11:57:12 +0000272 _drawDRRect: function() {},
Mike Reed9983b1e2021-04-14 14:49:35 -0400273 _drawGlyphs: function() {},
Kevin Lubickf6114042021-08-25 13:13:09 -0400274 _drawImage: function() {},
275 _drawImageCubic: function() {},
Kevin Lubickf8823b52020-09-03 10:02:10 -0400276 _drawImageNine: function() {},
Kevin Lubickf6114042021-08-25 13:13:09 -0400277 _drawImageOptions: function() {},
Kevin Lubickf8823b52020-09-03 10:02:10 -0400278 _drawImageRect: function() {},
Kevin Lubick72f40762020-12-16 16:00:55 -0500279 _drawImageRectCubic: function() {},
280 _drawImageRectOptions: function() {},
Kevin Lubickf6114042021-08-25 13:13:09 -0400281 _drawLine: function() {},
Kevin Lubickf8823b52020-09-03 10:02:10 -0400282 _drawOval: function() {},
Kevin Lubickf6114042021-08-25 13:13:09 -0400283 _drawPaint: function() {},
284 _drawParagraph: function() {},
Mike Reed6e7d2b32021-03-29 16:38:01 -0400285 _drawPatch: function() {},
Kevin Lubickf6114042021-08-25 13:13:09 -0400286 _drawPath: function() {},
287 _drawPicture: function() {},
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500288 _drawPoints: function() {},
Kevin Lubickbe728012020-09-03 11:57:12 +0000289 _drawRRect: function() {},
Kevin Lubickf6114042021-08-25 13:13:09 -0400290 _drawRect4f: function() {},
291 _drawRect: function() {},
Nathaniel Nifong1bedbeb2020-05-04 16:46:17 -0400292 _drawShadow: function() {},
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500293 _drawSimpleText: function() {},
Kevin Lubickf6114042021-08-25 13:13:09 -0400294 _drawTextBlob: function() {},
295 _drawVertices: function() {},
Michael Ludwig370de722020-09-02 21:20:44 +0000296 _findMarkedCTM: function() {},
Kevin Lubickbe728012020-09-03 11:57:12 +0000297 _getLocalToDevice: function() {},
298 _getTotalMatrix: function() {},
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500299 _readPixels: function() {},
Kevin Lubickf8823b52020-09-03 10:02:10 -0400300 _saveLayer: function() {},
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500301 _writePixels: function() {},
302 delete: function() {},
303 },
Kevin Lubick006a6f32018-10-19 14:34:34 -0400304
Kevin Lubick54c1b3d2020-10-07 16:09:22 -0400305 ColorFilter: {
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500306 // public API (from C++ bindings and JS interface)
307 MakeBlend: function() {},
308 MakeCompose: function() {},
309 MakeLerp: function() {},
310 MakeLinearToSRGBGamma: function() {},
311 MakeMatrix: function() {},
312 MakeSRGBToLinearGamma: function() {},
313 // private API (from C++ bindings)
Nathaniel Nifong1bedbeb2020-05-04 16:46:17 -0400314 _MakeBlend: function() {},
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500315 _makeMatrix: function() {},
316 },
Kevin Lubickd3729342019-09-12 11:11:25 -0400317
Kevin Lubick54c1b3d2020-10-07 16:09:22 -0400318 ColorMatrix: {
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500319 concat: function() {},
320 identity: function() {},
321 postTranslate: function() {},
322 rotated: function() {},
323 scaled: function() {},
324 },
Kevin Lubickd3729342019-09-12 11:11:25 -0400325
Kevin Lubick54c1b3d2020-10-07 16:09:22 -0400326 ColorSpace: {
Nathaniel Nifongb1ebbb12020-05-26 13:10:20 -0400327 Equals: function() {},
328 SRGB: {},
329 DISPLAY_P3: {},
330 ADOBE_RGB: {},
331 // private API (from C++ bindings)
332 _MakeSRGB: function() {},
333 _MakeDisplayP3: function() {},
334 _MakeAdobeRGB: function() {},
335 },
336
Kevin Lubick54c1b3d2020-10-07 16:09:22 -0400337 ContourMeasureIter: {
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500338 next: function() {},
339 },
Kevin Lubicke59c1672019-11-20 14:17:53 -0500340
Kevin Lubick54c1b3d2020-10-07 16:09:22 -0400341 ContourMeasure: {
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500342 getSegment: function() {},
343 isClosed: function() {},
344 length: function() {},
Kevin Lubicke9e8e5d2021-02-02 10:21:24 -0500345 prototype: {
346 getPosTan: function() {},
347 },
348 _getPosTan: function() {},
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500349 },
Kevin Lubicke59c1672019-11-20 14:17:53 -0500350
Kevin Lubick54c1b3d2020-10-07 16:09:22 -0400351 Font: {
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500352 // public API (from C++ bindings)
Mike Reed4c8c87e2021-04-19 13:20:51 -0400353 getMetrics: function() {},
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500354 getScaleX: function() {},
355 getSize: function() {},
356 getSkewX: function() {},
Mike Reed1f85dd92021-05-09 14:02:58 -0400357 isEmbolden: function() {},
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500358 getTypeface: function() {},
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500359 setHinting: function() {},
360 setLinearMetrics: function() {},
361 setScaleX: function() {},
362 setSize: function() {},
363 setSkewX: function() {},
Mike Reed1f85dd92021-05-09 14:02:58 -0400364 setEmbolden: function() {},
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500365 setSubpixel: function() {},
366 setTypeface: function() {},
Kevin Lubick30793852020-09-25 10:52:16 -0400367
368 prototype: {
369 getGlyphBounds: function() {},
370 getGlyphIDs: function() {},
371 getGlyphWidths: function() {},
Mike Reedbc7c7542021-05-14 20:55:58 -0400372 getGlyphIntercepts: function() {},
Kevin Lubick30793852020-09-25 10:52:16 -0400373 },
374
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500375 // private API (from C++ bindings)
Kevin Lubick30793852020-09-25 10:52:16 -0400376 _getGlyphIDs: function() {},
Kevin Lubick72fb3fc2021-06-02 08:38:04 -0400377 _getGlyphIntercepts: function() {},
Kevin Lubick30793852020-09-25 10:52:16 -0400378 _getGlyphWidthBounds: function() {},
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500379 },
Kevin Lubick35ac0382019-01-02 15:13:57 -0500380
Kevin Lubick54c1b3d2020-10-07 16:09:22 -0400381 FontMgr: {
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500382 // public API (from C++ and JS bindings)
383 FromData: function() {},
384 RefDefault: function() {},
385 countFamilies: function() {},
386 getFamilyName: function() {},
Kevin Lubickddd0a332018-12-12 10:35:13 -0500387
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500388 // private API
389 _makeTypefaceFromData: function() {},
390 _fromData: function() {},
391 },
Kevin Lubickddd0a332018-12-12 10:35:13 -0500392
Harry Terkelsen10f019c2020-08-04 13:21:09 -0700393 TypefaceFontProvider: {
394 // public API (from C++ and JS bindings)
395 Make: function() {},
396 registerFont: function() {},
397
398 // private API
399 _registerFont: function() {},
400 },
401
Kevin Lubick54c1b3d2020-10-07 16:09:22 -0400402 Image: {
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500403 // public API (from C++ bindings)
Kevin Lubick8172d162021-02-16 15:38:42 -0500404 encodeToBytes: function() {},
Kevin Lubickae0d3ff2020-11-18 11:23:15 -0500405 getColorSpace: function() {},
406 getImageInfo: function() {},
Kevin Lubick652d7902020-12-11 14:51:36 -0500407 makeCopyWithDefaultMipmaps: function() {},
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500408 height: function() {},
409 width: function() {},
Kevin Lubick652d7902020-12-11 14:51:36 -0500410
411 prototype: {
Kevin Lubick652d7902020-12-11 14:51:36 -0500412 makeShaderCubic: function() {},
413 makeShaderOptions: function() {},
414 },
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500415 // private API
Kevin Lubick652d7902020-12-11 14:51:36 -0500416 _makeShaderCubic: function() {},
417 _makeShaderOptions: function() {},
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500418 },
Kevin Lubick006a6f32018-10-19 14:34:34 -0400419
Kevin Lubick54c1b3d2020-10-07 16:09:22 -0400420 ImageFilter: {
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500421 MakeBlur: function() {},
422 MakeColorFilter: function() {},
423 MakeCompose: function() {},
424 MakeMatrixTransform: function() {},
Kevin Lubick6bffe392020-04-02 15:24:15 -0400425
426 // private API
Mike Reed5caab8e2021-07-20 09:52:27 -0400427 _MakeMatrixTransformCubic: function() {},
428 _MakeMatrixTransformOptions: function() {},
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500429 },
Kevin Lubick15b40232019-10-29 09:55:39 -0400430
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500431 // These are defined in interface.js
Kevin Lubick54c1b3d2020-10-07 16:09:22 -0400432 M44: {
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500433 identity: function() {},
434 invert: function() {},
Nathaniel Nifong6130d502020-07-06 19:50:13 -0400435 mustInvert: function() {},
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500436 multiply: function() {},
437 rotatedUnitSinCos: function() {},
438 rotated: function() {},
439 scaled: function() {},
440 translated: function() {},
441 lookat: function() {},
442 perspective: function() {},
443 rc: function() {},
444 transpose: function() {},
Nathaniel Nifong6130d502020-07-06 19:50:13 -0400445 setupCamera: function() {},
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500446 },
Nathaniel Nifong77798b42020-02-21 17:15:22 -0500447
Kevin Lubick54c1b3d2020-10-07 16:09:22 -0400448 Matrix: {
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500449 identity: function() {},
450 invert: function() {},
451 mapPoints: function() {},
452 multiply: function() {},
453 rotated: function() {},
454 scaled: function() {},
455 skewed: function() {},
456 translated: function() {},
457 },
Kevin Lubickb9db3902018-11-26 11:47:54 -0500458
Kevin Lubick54c1b3d2020-10-07 16:09:22 -0400459 MaskFilter: {
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500460 MakeBlur: function() {},
461 },
Kevin Lubick15b40232019-10-29 09:55:39 -0400462
Mike Reed764bc212021-03-25 09:25:17 -0400463 MipmapMode: {
464 None: {},
465 Nearest: {},
466 Linear: {},
467 },
468
Kevin Lubick54c1b3d2020-10-07 16:09:22 -0400469 Paint: {
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500470 // public API (from C++ bindings)
Kevin Lubick54c1b3d2020-10-07 16:09:22 -0400471 /** @return {CanvasKit.Paint} */
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500472 copy: function() {},
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500473 getStrokeCap: function() {},
474 getStrokeJoin: function() {},
475 getStrokeMiter: function() {},
476 getStrokeWidth: function() {},
477 setAntiAlias: function() {},
478 setBlendMode: function() {},
Kevin Lubick93f1a382020-06-02 16:15:23 -0400479 setColorInt: function() {},
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500480 setImageFilter: function() {},
481 setMaskFilter: function() {},
482 setPathEffect: function() {},
483 setShader: function() {},
484 setStrokeCap: function() {},
485 setStrokeJoin: function() {},
486 setStrokeMiter: function() {},
487 setStrokeWidth: function() {},
488 setStyle: function() {},
Kevin Lubickb9db3902018-11-26 11:47:54 -0500489
Nathaniel Nifong1bedbeb2020-05-04 16:46:17 -0400490 prototype: {
Kevin Lubicked962642021-02-02 08:18:11 -0500491 getColor: function() {},
Nathaniel Nifong1bedbeb2020-05-04 16:46:17 -0400492 setColor: function() {},
Kevin Lubick93f1a382020-06-02 16:15:23 -0400493 setColorComponents: function() {},
494 setColorInt: function() {},
Nathaniel Nifong1bedbeb2020-05-04 16:46:17 -0400495 },
496
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500497 // Private API
498 delete: function() {},
Nathaniel Nifong1bedbeb2020-05-04 16:46:17 -0400499 _getColor: function() {},
500 _setColor: function() {},
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500501 },
Kevin Lubick1a05fce2018-11-20 12:51:16 -0500502
Kevin Lubick54c1b3d2020-10-07 16:09:22 -0400503 PathEffect: {
Kevin Lubickf279c632020-03-18 09:53:55 -0400504 MakeCorner: function() {},
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500505 MakeDash: function() {},
Kevin Lubickf279c632020-03-18 09:53:55 -0400506 MakeDiscrete: function() {},
507
508 // Private C++ API
509 _MakeDash: function() {},
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500510 },
Nathaniel Nifong23b0ed92020-03-04 15:43:50 -0500511
Kevin Lubick54c1b3d2020-10-07 16:09:22 -0400512 ParticleEffect: {
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500513 // public API (from C++ bindings)
514 draw: function() {},
Brian Osman38316892021-01-29 14:32:09 -0500515 getUniform: function() {},
516 getUniformCount: function() {},
517 getUniformFloatCount: function() {},
518 getUniformName: function() {},
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500519 setRate: function() {},
520 start: function() {},
521 update: function() {},
Kevin Lubickf8f9cd82020-02-21 08:26:59 -0500522
Kevin Lubicked962642021-02-02 08:18:11 -0500523 prototype: {
524 setPosition: function() {},
525 uniforms: function() {},
526 },
527
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500528 // private API (from C++ bindings)
Brian Osman38316892021-01-29 14:32:09 -0500529 _uniformPtr: function() {},
Kevin Lubicked962642021-02-02 08:18:11 -0500530 _setPosition: function() {},
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500531 },
Kevin Lubickf8f9cd82020-02-21 08:26:59 -0500532
Kevin Lubick54c1b3d2020-10-07 16:09:22 -0400533 Path: {
Kevin Lubickd9b9e5e2020-06-23 16:58:10 -0400534 // public API (from C++ and JS bindings)
535 MakeFromCmds: function() {},
Kevin Lubickffc20c22020-10-09 10:55:06 -0400536 MakeFromSVGString: function() {},
537 MakeFromOp: function() {},
Kevin Lubickd9b9e5e2020-06-23 16:58:10 -0400538 MakeFromVerbsPointsWeights: function() {},
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500539 contains: function() {},
Kevin Lubick54c1b3d2020-10-07 16:09:22 -0400540 /** @return {CanvasKit.Path} */
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500541 copy: function() {},
542 countPoints: function() {},
543 equals: function() {},
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500544 getFillType: function() {},
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500545 isEmpty: function() {},
546 isVolatile: function() {},
Kevin Lubick391429f2021-07-21 10:00:28 -0400547 makeAsWinding: function() {},
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500548 reset: function() {},
549 rewind: function() {},
550 setFillType: function() {},
551 setIsVolatile: function() {},
Kevin Lubickd9b9e5e2020-06-23 16:58:10 -0400552 toCmds: function() {},
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500553 toSVGString: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400554
Kevin Lubickf8823b52020-09-03 10:02:10 -0400555 prototype: {
556 addArc: function() {},
557 addOval: function() {},
558 addPath: function() {},
559 addPoly: function() {},
560 addRect: function() {},
561 addRRect: function() {},
562 addVerbsPointsWeights: function() {},
563 arc: function() {},
564 arcToOval: function() {},
565 arcToRotated: function() {},
566 arcToTangent: function() {},
567 close: function() {},
568 conicTo: function() {},
Kevin Lubick7d96c5c2020-10-01 10:55:16 -0400569 computeTightBounds: function() {},
Kevin Lubickf8823b52020-09-03 10:02:10 -0400570 cubicTo: function() {},
571 dash: function() {},
Kevin Lubick58605b02021-02-23 08:27:46 -0500572 getBounds: function() {},
Kevin Lubicked962642021-02-02 08:18:11 -0500573 getPoint: function() {},
Kevin Lubickf8823b52020-09-03 10:02:10 -0400574 lineTo: function() {},
575 moveTo: function() {},
576 offset: function() {},
577 op: function() {},
578 quadTo: function() {},
579 rArcTo: function() {},
580 rConicTo: function() {},
581 rCubicTo: function() {},
Kevin Lubickf8823b52020-09-03 10:02:10 -0400582 rLineTo: function() {},
583 rMoveTo: function() {},
584 rQuadTo: function() {},
585 simplify: function() {},
586 stroke: function() {},
587 transform: function() {},
588 trim: function() {},
589 },
590
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500591 // private API
Kevin Lubickd9b9e5e2020-06-23 16:58:10 -0400592 _MakeFromCmds: function() {},
593 _MakeFromVerbsPointsWeights: function() {},
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500594 _addArc: function() {},
595 _addOval: function() {},
596 _addPath: function() {},
Michael Ludwig1f49ceb2020-09-02 21:20:44 +0000597 _addPoly: function() {},
Kevin Lubickf8823b52020-09-03 10:02:10 -0400598 _addRect: function() {},
599 _addRRect: function() {},
Kevin Lubickd9b9e5e2020-06-23 16:58:10 -0400600 _addVerbsPointsWeights: function() {},
Nathaniel Nifongd0c9d0c2020-07-15 16:46:17 -0400601 _arcToOval: function() {},
Michael Ludwig1f49ceb2020-09-02 21:20:44 +0000602 _arcToRotated: function() {},
Kevin Lubickf8823b52020-09-03 10:02:10 -0400603 _arcToTangent: function() {},
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500604 _close: function() {},
605 _conicTo: function() {},
Kevin Lubick7d96c5c2020-10-01 10:55:16 -0400606 _computeTightBounds: function() {},
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500607 _cubicTo: function() {},
608 _dash: function() {},
Kevin Lubick58605b02021-02-23 08:27:46 -0500609 _getBounds: function() {},
Kevin Lubicked962642021-02-02 08:18:11 -0500610 _getPoint: function() {},
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500611 _lineTo: function() {},
612 _moveTo: function() {},
613 _op: function() {},
614 _quadTo: function() {},
615 _rArcTo: function() {},
616 _rConicTo: function() {},
617 _rCubicTo: function() {},
Kevin Lubickf8823b52020-09-03 10:02:10 -0400618 _rect: function() {},
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500619 _rLineTo: function() {},
620 _rMoveTo: function() {},
621 _rQuadTo: function() {},
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500622 _simplify: function() {},
623 _stroke: function() {},
624 _transform: function() {},
625 _trim: function() {},
626 delete: function() {},
627 dump: function() {},
628 dumpHex: function() {},
629 },
Kevin Lubickd3cfbca2019-03-15 15:36:29 -0400630
Kevin Lubick54c1b3d2020-10-07 16:09:22 -0400631 Picture: {
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500632 serialize: function() {},
633 },
Kevin Lubickcc13fd32019-04-05 13:00:01 -0400634
Kevin Lubick54c1b3d2020-10-07 16:09:22 -0400635 PictureRecorder: {
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500636 finishRecordingAsPicture: function() {},
Kevin Lubickf8823b52020-09-03 10:02:10 -0400637 prototype: {
638 beginRecording: function() {},
639 },
640 _beginRecording: function() {},
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500641 },
Kevin Lubick62836902019-12-09 09:04:26 -0500642
Kevin Lubick54c1b3d2020-10-07 16:09:22 -0400643 Shader: {
Kevin Lubick421ba882020-10-15 13:07:33 -0400644 // Deprecated names
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500645 Blend: function() {},
646 Color: function() {},
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500647 Lerp: function() {},
Kevin Lubick162d7572020-10-15 13:09:02 -0400648 // public API (from JS / C++ bindings)
Kevin Lubick421ba882020-10-15 13:07:33 -0400649 MakeBlend: function() {},
650 MakeColor: function() {},
Kevin Lubick162d7572020-10-15 13:09:02 -0400651 MakeFractalNoise: function() {},
Nathaniel Nifongd96c3c72020-03-09 10:50:43 -0400652 MakeLinearGradient: function() {},
653 MakeRadialGradient: function() {},
Dan Field3d44f732020-03-16 09:17:30 -0700654 MakeSweepGradient: function() {},
Kevin Lubick162d7572020-10-15 13:09:02 -0400655 MakeTurbulence: function() {},
656 MakeTwoPointConicalGradient: function() {},
Nathaniel Nifong1bedbeb2020-05-04 16:46:17 -0400657
658 // private API (from C++ bindings)
Kevin Lubick421ba882020-10-15 13:07:33 -0400659 _MakeColor: function() {},
660 _MakeLinearGradient: function() {},
661 _MakeRadialGradient: function() {},
662 _MakeSweepGradient: function() {},
663 _MakeTwoPointConicalGradient: function() {},
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500664 },
Kevin Lubick006a6f32018-10-19 14:34:34 -0400665
Kevin Lubick54c1b3d2020-10-07 16:09:22 -0400666 Surface: {
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500667 // public API (from C++ bindings)
Nathaniel Nifongb1ebbb12020-05-26 13:10:20 -0400668 imageInfo: function() {},
Kevin Lubickf8823b52020-09-03 10:02:10 -0400669
Chris Dalton312669e2020-06-19 09:45:57 -0600670 sampleCnt: function() {},
Nathaniel Nifong2d7afd42020-07-17 10:28:36 -0400671 reportBackendTypeIsGPU: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400672
Kevin Lubickf8823b52020-09-03 10:02:10 -0400673 prototype: {
Kevin Lubickf6114042021-08-25 13:13:09 -0400674 getCanvas: function() {},
Kevin Lubick7b6a9282021-06-03 08:02:03 -0400675 makeImageFromTexture: function() {},
676 makeImageFromTextureSource: function() {},
Kevin Lubick54c1b3d2020-10-07 16:09:22 -0400677 /** @return {CanvasKit.Image} */
Kevin Lubickf8823b52020-09-03 10:02:10 -0400678 makeImageSnapshot: function() {},
Kevin Lubickf6114042021-08-25 13:13:09 -0400679 makeSurface: function() {},
Kevin Lubickf8823b52020-09-03 10:02:10 -0400680 },
681
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500682 // private API
683 _flush: function() {},
Kevin Lubickf6114042021-08-25 13:13:09 -0400684 _getCanvas: function() {},
Kevin Lubick7b6a9282021-06-03 08:02:03 -0400685 _makeImageFromTexture: function() {},
Kevin Lubickf8823b52020-09-03 10:02:10 -0400686 _makeImageSnapshot: function() {},
Kevin Lubickf6114042021-08-25 13:13:09 -0400687 _makeSurface: function() {},
Kevin Lubick15d7a382020-11-11 16:48:30 -0500688 _makeRasterDirect: function() {},
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500689 delete: function() {},
690 },
Kevin Lubickec4903d2019-01-14 08:36:08 -0500691
Kevin Lubick54c1b3d2020-10-07 16:09:22 -0400692 TextBlob: {
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500693 // public API (both C++ and JS bindings)
Kevin Lubick30793852020-09-25 10:52:16 -0400694 MakeFromGlyphs: function() {},
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500695 MakeFromRSXform: function() {},
Kevin Lubick30793852020-09-25 10:52:16 -0400696 MakeFromRSXformGlyphs: function() {},
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500697 MakeFromText: function() {},
698 MakeOnPath: function() {},
699 // private API (from C++ bindings)
Kevin Lubick30793852020-09-25 10:52:16 -0400700 _MakeFromGlyphs: function() {},
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500701 _MakeFromRSXform: function() {},
Kevin Lubick30793852020-09-25 10:52:16 -0400702 _MakeFromRSXformGlyphs: function() {},
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500703 _MakeFromText: function() {},
704 },
Nathaniel Nifong77798b42020-02-21 17:15:22 -0500705
Kevin Lubick7027be62021-06-25 14:06:42 -0400706 Typeface: {
707 MakeFreeTypeFaceFromData: function() {},
Kevin Lubick83fd9692021-06-25 14:08:39 -0400708 prototype: {
709 getGlyphIDs: function() {},
710 },
Kevin Lubick7027be62021-06-25 14:06:42 -0400711 _MakeFreeTypeFaceFromData: function() {},
Kevin Lubick83fd9692021-06-25 14:08:39 -0400712 _getGlyphIDs: function() {},
Kevin Lubick7027be62021-06-25 14:06:42 -0400713 },
714
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500715 // These are defined in interface.js
Kevin Lubick54c1b3d2020-10-07 16:09:22 -0400716 Vector: {
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500717 add: function() {},
718 sub: function() {},
719 dot: function() {},
720 cross: function() {},
721 normalize: function() {},
722 mulScalar: function() {},
723 length: function() {},
724 lengthSquared: function() {},
725 dist: function() {},
726 },
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400727
Kevin Lubick54c1b3d2020-10-07 16:09:22 -0400728 Vertices: {
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500729 // public API (from C++ bindings)
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500730 uniqueID: function() {},
Kevin Lubickf8823b52020-09-03 10:02:10 -0400731
732 prototype: {
733 bounds: function() {},
734 },
735 // private API (from C++ bindings)
736
737 _bounds: function() {},
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500738 },
Kevin Lubickb5ae3b52018-11-03 07:51:19 -0400739
Kevin Lubick54c1b3d2020-10-07 16:09:22 -0400740 _VerticesBuilder: {
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500741 colors: function() {},
742 detach: function() {},
743 indices: function() {},
744 positions: function() {},
745 texCoords: function() {},
746 },
Kevin Lubickd6ba7252019-06-03 14:38:05 -0400747
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500748 TextStyle: function() {},
Kevin Lubick369f6a52019-10-03 11:22:08 -0400749
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500750 // Constants and Enums
751 gpu: {},
752 skottie: {},
Kevin Lubick006a6f32018-10-19 14:34:34 -0400753
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500754 TRANSPARENT: {},
Nathaniel Nifonge5d32542020-03-26 09:27:48 -0400755 BLACK: {},
756 WHITE: {},
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500757 RED: {},
Nathaniel Nifonge5d32542020-03-26 09:27:48 -0400758 GREEN: {},
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500759 BLUE: {},
760 YELLOW: {},
761 CYAN: {},
Nathaniel Nifonge5d32542020-03-26 09:27:48 -0400762 MAGENTA: {},
Kevin Lubickea905ec2018-11-30 14:05:58 -0500763
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500764 MOVE_VERB: {},
765 LINE_VERB: {},
766 QUAD_VERB: {},
767 CONIC_VERB: {},
768 CUBIC_VERB: {},
769 CLOSE_VERB: {},
Kevin Lubickda3d8ac2019-01-07 11:08:55 -0500770
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500771 NoDecoration: {},
772 UnderlineDecoration: {},
773 OverlineDecoration: {},
774 LineThroughDecoration: {},
Kevin Lubick369f6a52019-10-03 11:22:08 -0400775
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500776 SaveLayerInitWithPrevious: {},
777 SaveLayerF16ColorType: {},
Kevin Lubick77d9b5c2019-10-29 10:48:26 -0400778
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500779 Affinity: {
780 Upstream: {},
781 Downstream: {},
782 },
Kevin Lubick369f6a52019-10-03 11:22:08 -0400783
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500784 AlphaType: {
785 Opaque: {},
786 Premul: {},
787 Unpremul: {},
788 },
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500789
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500790 BlendMode: {
791 Clear: {},
792 Src: {},
793 Dst: {},
794 SrcOver: {},
795 DstOver: {},
796 SrcIn: {},
797 DstIn: {},
798 SrcOut: {},
799 DstOut: {},
800 SrcATop: {},
801 DstATop: {},
802 Xor: {},
803 Plus: {},
804 Modulate: {},
805 Screen: {},
806 Overlay: {},
807 Darken: {},
808 Lighten: {},
809 ColorDodge: {},
810 ColorBurn: {},
811 HardLight: {},
812 SoftLight: {},
813 Difference: {},
814 Exclusion: {},
815 Multiply: {},
816 Hue: {},
817 Saturation: {},
818 Color: {},
819 Luminosity: {},
820 },
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500821
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500822 BlurStyle: {
823 Normal: {},
824 Solid: {},
825 Outer: {},
826 Inner: {},
827 },
Kevin Lubick61ef7b22018-11-27 13:26:59 -0500828
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500829 ClipOp: {
830 Difference: {},
831 Intersect: {},
832 },
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500833
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500834 ColorType: {
835 Alpha_8: {},
836 RGB_565: {},
837 ARGB_4444: {},
838 RGBA_8888: {},
839 RGB_888x: {},
840 BGRA_8888: {},
841 RGBA_1010102: {},
842 RGB_101010x: {},
843 Gray_8: {},
844 RGBA_F16: {},
845 RGBA_F32: {},
846 },
Kevin Lubickea905ec2018-11-30 14:05:58 -0500847
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500848 FillType: {
849 Winding: {},
850 EvenOdd: {},
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500851 },
Kevin Lubick006a6f32018-10-19 14:34:34 -0400852
Kevin Lubick2d633492020-12-17 09:58:32 -0500853 FilterMode: {
854 Linear: {},
855 Nearest: {},
856 },
857
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500858 FontSlant: {
859 Upright: {},
860 Italic: {},
861 Oblique: {},
862 },
Kevin Lubickd3b1fe62019-10-21 10:50:26 -0400863
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500864 FontHinting: {
865 None: {},
866 Slight: {},
867 Normal: {},
868 Full: {},
869 },
Kevin Lubickbde9fcc2020-02-28 08:09:08 -0500870
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500871 FontWeight: {
872 Invisible: {},
873 Thin: {},
874 ExtraLight: {},
875 Light: {},
876 Normal: {},
877 Medium: {},
878 SemiBold: {},
879 Bold: {},
880 ExtraBold: {},
881 Black: {},
882 ExtraBlack: {},
883 },
Kevin Lubickd3b1fe62019-10-21 10:50:26 -0400884
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500885 FontWidth: {
886 UltraCondensed: {},
887 ExtraCondensed: {},
888 Condensed: {},
889 SemiCondensed: {},
890 Normal: {},
891 SemiExpanded: {},
892 Expanded: {},
893 ExtraExpanded: {},
894 UltraExpanded: {},
895 },
Kevin Lubickd3b1fe62019-10-21 10:50:26 -0400896
Kevin Lubick995f2e62021-04-30 11:12:01 -0400897 GlyphRunFlags: {
898 IsWhiteSpace: {},
899 },
900
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500901 ImageFormat: {
902 PNG: {},
903 JPEG: {},
904 },
Alexander Khovansky3e119332018-11-15 02:01:19 +0300905
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500906 PaintStyle: {
907 Fill: {},
908 Stroke: {},
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500909 },
Kevin Lubickb9db3902018-11-26 11:47:54 -0500910
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500911 PathOp: {
912 Difference: {},
913 Intersect: {},
914 Union: {},
915 XOR: {},
916 ReverseDifference: {},
917 },
Kevin Lubickeb2f6b02018-11-29 15:07:02 -0500918
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500919 PointMode: {
920 Points: {},
921 Lines: {},
922 Polygon: {},
923 },
Kevin Lubick37ab53e2019-11-11 10:06:08 -0500924
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500925 RectHeightStyle: {
926 Tight: {},
927 Max: {},
928 IncludeLineSpacingMiddle: {},
929 IncludeLineSpacingTop: {},
930 IncludeLineSpacingBottom: {},
Kevin Lubick4a84c342021-04-08 08:49:00 -0400931 Strut: {},
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500932 },
Kevin Lubick369f6a52019-10-03 11:22:08 -0400933
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500934 RectWidthStyle: {
935 Tight: {},
936 Max: {},
937 },
Kevin Lubick369f6a52019-10-03 11:22:08 -0400938
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500939 StrokeCap: {
940 Butt: {},
941 Round: {},
942 Square: {},
943 },
Kevin Lubickb9db3902018-11-26 11:47:54 -0500944
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500945 StrokeJoin: {
946 Miter: {},
947 Round: {},
948 Bevel: {},
949 },
Kevin Lubickb9db3902018-11-26 11:47:54 -0500950
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500951 TextAlign: {
952 Left: {},
953 Right: {},
954 Center: {},
955 Justify: {},
956 Start: {},
957 End: {},
958 },
Kevin Lubick369f6a52019-10-03 11:22:08 -0400959
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500960 TextDirection: {
961 LTR: {},
962 RTL: {},
963 },
Kevin Lubickd3b1fe62019-10-21 10:50:26 -0400964
Kevin Lubick4755b0b2021-04-22 13:53:35 -0400965 TextHeightBehavior: {
966 All: {},
967 DisableFirstAscent: {},
968 DisableLastDescent: {},
969 DisableAll: {},
970 },
971
Harry Terkelsen223ffcd2020-10-02 15:24:13 -0700972 DecorationStyle: {
973 Solid: {},
974 Double: {},
975 Dotted: {},
976 Dashed: {},
977 Wavy: {},
978 },
979
980 PlaceholderAlignment: {
981 Baseline: {},
982 AboveBaseline: {},
983 BelowBaseline: {},
984 Top: {},
985 Bottom: {},
986 Middle: {},
987 },
988
989 TextBaseline: {
990 Alphabetic: {},
991 Ideographic: {},
992 },
993
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -0500994 TileMode: {
995 Clamp: {},
996 Repeat: {},
997 Mirror: {},
998 Decal: {},
999 },
Kevin Lubickeb2f6b02018-11-29 15:07:02 -05001000
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -05001001 VertexMode: {
1002 Triangles: {},
1003 TrianglesStrip: {},
1004 TriangleFan: {},
1005 },
Kevin Lubickeb2f6b02018-11-29 15:07:02 -05001006
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -05001007 // Things Enscriptem adds for us
Kevin Lubick006a6f32018-10-19 14:34:34 -04001008
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -05001009 /**
1010 * @type {Float32Array}
1011 */
1012 HEAPF32: {},
1013 /**
1014 * @type {Float64Array}
1015 */
1016 HEAPF64: {},
1017 /**
1018 * @type {Uint8Array}
1019 */
1020 HEAPU8: {},
1021 /**
1022 * @type {Uint16Array}
1023 */
1024 HEAPU16: {},
1025 /**
1026 * @type {Uint32Array}
1027 */
1028 HEAPU32: {},
1029 /**
1030 * @type {Int8Array}
1031 */
1032 HEAP8: {},
1033 /**
1034 * @type {Int16Array}
1035 */
1036 HEAP16: {},
1037 /**
1038 * @type {Int32Array}
1039 */
1040 HEAP32: {},
Kevin Lubickfa5a1382019-10-09 10:46:14 -04001041
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -05001042 _malloc: function() {},
1043 _free: function() {},
1044 onRuntimeInitialized: function() {},
Kevin Lubick006a6f32018-10-19 14:34:34 -04001045};
Kevin Lubick217056c2018-09-20 17:39:31 -04001046
Kevin Lubick006a6f32018-10-19 14:34:34 -04001047// Public API things that are newly declared in the JS should go here.
1048// It's not enough to declare them above, because closure can still erase them
1049// unless they go on the prototype.
Kevin Lubick369f6a52019-10-03 11:22:08 -04001050CanvasKit.Paragraph.prototype.getRectsForRange = function() {};
Harry Terkelsen223ffcd2020-10-02 15:24:13 -07001051CanvasKit.Paragraph.prototype.getRectsForPlaceholders = function() {};
Kevin Lubick369f6a52019-10-03 11:22:08 -04001052
Kevin Lubick54c1b3d2020-10-07 16:09:22 -04001053CanvasKit.Surface.prototype.dispose = function() {};
1054CanvasKit.Surface.prototype.flush = function() {};
1055CanvasKit.Surface.prototype.requestAnimationFrame = function() {};
1056CanvasKit.Surface.prototype.drawOnce = function() {};
Kevin Lubick53965c92018-10-11 08:51:55 -04001057
Kevin Lubick54c1b3d2020-10-07 16:09:22 -04001058CanvasKit.FontMgr.prototype.MakeTypefaceFromData = function() {};
Kevin Lubickddd0a332018-12-12 10:35:13 -05001059
Kevin Lubick54c1b3d2020-10-07 16:09:22 -04001060CanvasKit.RuntimeEffect.prototype.makeShader = function() {};
1061CanvasKit.RuntimeEffect.prototype.makeShaderWithChildren = function() {};
Kevin Lubick4b5b6452019-12-06 13:55:58 -05001062
Kevin Lubickb5ae3b52018-11-03 07:51:19 -04001063// Define StrokeOpts object
1064var StrokeOpts = {};
1065StrokeOpts.prototype.width;
1066StrokeOpts.prototype.miter_limit;
1067StrokeOpts.prototype.cap;
1068StrokeOpts.prototype.join;
Kevin Lubick1646e7d2018-12-07 13:03:08 -05001069StrokeOpts.prototype.precision;
Kevin Lubickb5ae3b52018-11-03 07:51:19 -04001070
Kevin Lubickeb2f6b02018-11-29 15:07:02 -05001071// Define everything created in the canvas2d spec here
Kevin Lubickb9db3902018-11-26 11:47:54 -05001072var HTMLCanvas = {};
Kevin Lubick0a1293c2018-12-03 12:31:04 -05001073HTMLCanvas.prototype.decodeImage = function() {};
1074HTMLCanvas.prototype.dispose = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -05001075HTMLCanvas.prototype.getContext = function() {};
Kevin Lubick8e4a3312018-12-14 15:03:41 -05001076HTMLCanvas.prototype.loadFont = function() {};
Kevin Lubicka40f8322018-12-17 16:01:36 -05001077HTMLCanvas.prototype.makePath2D = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -05001078HTMLCanvas.prototype.toDataURL = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -05001079
Elliot Evans28796192020-06-15 12:53:27 -06001080var ImageBitmapRenderingContext = {};
1081ImageBitmapRenderingContext.prototype.transferFromImageBitmap = function() {};
1082
Kevin Lubickb9db3902018-11-26 11:47:54 -05001083var CanvasRenderingContext2D = {};
1084CanvasRenderingContext2D.prototype.addHitRegion = function() {};
1085CanvasRenderingContext2D.prototype.arc = function() {};
1086CanvasRenderingContext2D.prototype.arcTo = function() {};
1087CanvasRenderingContext2D.prototype.beginPath = function() {};
1088CanvasRenderingContext2D.prototype.bezierCurveTo = function() {};
1089CanvasRenderingContext2D.prototype.clearHitRegions = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -05001090CanvasRenderingContext2D.prototype.clearRect = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -05001091CanvasRenderingContext2D.prototype.clip = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -05001092CanvasRenderingContext2D.prototype.closePath = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -05001093CanvasRenderingContext2D.prototype.createImageData = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -05001094CanvasRenderingContext2D.prototype.createLinearGradient = function() {};
Kevin Lubickd29edd72018-12-07 08:29:52 -05001095CanvasRenderingContext2D.prototype.createPattern = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -05001096CanvasRenderingContext2D.prototype.createRadialGradient = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -05001097CanvasRenderingContext2D.prototype.drawFocusIfNeeded = function() {};
Kevin Lubick0a1293c2018-12-03 12:31:04 -05001098CanvasRenderingContext2D.prototype.drawImage = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -05001099CanvasRenderingContext2D.prototype.ellipse = function() {};
Kevin Lubick61ef7b22018-11-27 13:26:59 -05001100CanvasRenderingContext2D.prototype.fill = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -05001101CanvasRenderingContext2D.prototype.fillRect = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -05001102CanvasRenderingContext2D.prototype.fillText = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -05001103CanvasRenderingContext2D.prototype.getImageData = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -05001104CanvasRenderingContext2D.prototype.getLineDash = function() {};
Kevin Lubick1646e7d2018-12-07 13:03:08 -05001105CanvasRenderingContext2D.prototype.isPointInPath = function() {};
1106CanvasRenderingContext2D.prototype.isPointInStroke = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -05001107CanvasRenderingContext2D.prototype.lineTo = function() {};
1108CanvasRenderingContext2D.prototype.measureText = function() {};
1109CanvasRenderingContext2D.prototype.moveTo = function() {};
Kevin Lubick52b9f372018-12-04 13:57:36 -05001110CanvasRenderingContext2D.prototype.putImageData = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -05001111CanvasRenderingContext2D.prototype.quadraticCurveTo = function() {};
1112CanvasRenderingContext2D.prototype.rect = function() {};
1113CanvasRenderingContext2D.prototype.removeHitRegion = function() {};
1114CanvasRenderingContext2D.prototype.resetTransform = function() {};
Kevin Lubick61ef7b22018-11-27 13:26:59 -05001115CanvasRenderingContext2D.prototype.restore = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -05001116CanvasRenderingContext2D.prototype.rotate = function() {};
Kevin Lubick61ef7b22018-11-27 13:26:59 -05001117CanvasRenderingContext2D.prototype.save = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -05001118CanvasRenderingContext2D.prototype.scale = function() {};
1119CanvasRenderingContext2D.prototype.scrollPathIntoView = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -05001120CanvasRenderingContext2D.prototype.setLineDash = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -05001121CanvasRenderingContext2D.prototype.setTransform = function() {};
1122CanvasRenderingContext2D.prototype.stroke = function() {};
Kevin Lubick12c0e502018-11-28 12:51:56 -05001123CanvasRenderingContext2D.prototype.strokeRect = function() {};
Kevin Lubickb9db3902018-11-26 11:47:54 -05001124CanvasRenderingContext2D.prototype.strokeText = function() {};
1125CanvasRenderingContext2D.prototype.transform = function() {};
1126CanvasRenderingContext2D.prototype.translate = function() {};
1127
Kevin Lubicka40f8322018-12-17 16:01:36 -05001128var Path2D = {};
1129Path2D.prototype.addPath = function() {};
1130Path2D.prototype.arc = function() {};
1131Path2D.prototype.arcTo = function() {};
1132Path2D.prototype.bezierCurveTo = function() {};
1133Path2D.prototype.closePath = function() {};
1134Path2D.prototype.ellipse = function() {};
1135Path2D.prototype.lineTo = function() {};
1136Path2D.prototype.moveTo = function() {};
1137Path2D.prototype.quadraticCurveTo = function() {};
1138Path2D.prototype.rect = function() {};
1139
Kevin Lubickeb2f6b02018-11-29 15:07:02 -05001140var LinearCanvasGradient = {};
1141LinearCanvasGradient.prototype.addColorStop = function() {};
1142var RadialCanvasGradient = {};
1143RadialCanvasGradient.prototype.addColorStop = function() {};
Kevin Lubickd29edd72018-12-07 08:29:52 -05001144var CanvasPattern = {};
1145CanvasPattern.prototype.setTransform = function() {};
Kevin Lubickeb2f6b02018-11-29 15:07:02 -05001146
Kevin Lubick52b9f372018-12-04 13:57:36 -05001147var ImageData = {
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -05001148 /**
1149 * @type {Uint8ClampedArray}
1150 */
1151 data: {},
1152 height: {},
1153 width: {},
Kevin Lubick52b9f372018-12-04 13:57:36 -05001154};
1155
Kevin Lubickd29edd72018-12-07 08:29:52 -05001156var DOMMatrix = {
Nathaniel Nifong6066a0c2020-03-05 10:27:14 -05001157 a: {},
1158 b: {},
1159 c: {},
1160 d: {},
1161 e: {},
1162 f: {},
Kevin Lubickd29edd72018-12-07 08:29:52 -05001163};
1164
Kevin Lubick217056c2018-09-20 17:39:31 -04001165// 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 -05001166function loadWebAssemblyModule() {};
Nathaniel Nifonga237f9e2020-07-17 15:20:44 -04001167
1168// This is a part of emscripten's webgl glue code. Preserving this attribute is necessary
1169// to override it in the puppeteer tests
1170var LibraryEGL = {
1171 contextAttributes: {
1172 majorVersion: {}
1173 }
Harry Terkelsen10f019c2020-08-04 13:21:09 -07001174}