Kevin Lubick | 217056c | 2018-09-20 17:39:31 -0400 | [diff] [blame] | 1 | /* |
| 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 | |
| 25 | var CanvasKit = { |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 26 | // public API (i.e. things we declare in the pre-js file or in the cpp bindings) |
| 27 | Color: function() {}, |
| 28 | /** @return {CanvasKit.SkRect} */ |
| 29 | LTRBRect: function() {}, |
| 30 | /** @return {CanvasKit.SkRect} */ |
| 31 | XYWHRect: function() {}, |
| 32 | /** @return {CanvasKit.SkRRect} */ |
| 33 | RRectXY: function() {}, |
| 34 | /** @return {ImageData} */ |
| 35 | ImageData: function() {}, |
Kevin Lubick | 543f352 | 2019-03-08 10:04:28 -0500 | [diff] [blame] | 36 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 37 | GetWebGLContext: function() {}, |
| 38 | MakeBlurMaskFilter: function() {}, |
| 39 | MakeCanvas: function() {}, |
| 40 | MakeCanvasSurface: function() {}, |
| 41 | MakeGrContext: function() {}, |
| 42 | /** @return {CanvasKit.SkAnimatedImage} */ |
| 43 | MakeAnimatedImageFromEncoded: function() {}, |
| 44 | /** @return {CanvasKit.SkImage} */ |
| 45 | MakeImage: function() {}, |
| 46 | /** @return {CanvasKit.SkImage} */ |
| 47 | MakeImageFromEncoded: function() {}, |
| 48 | /** @return {LinearCanvasGradient} */ |
| 49 | MakeLinearGradientShader: function() {}, |
| 50 | MakeOnScreenGLSurface: function() {}, |
| 51 | MakePathFromCmds: function() {}, |
| 52 | MakePathFromOp: function() {}, |
| 53 | MakePathFromSVGString: function() {}, |
| 54 | MakeRadialGradientShader: function() {}, |
| 55 | MakeRenderTarget: function() {}, |
| 56 | MakeSkPicture: function() {}, |
| 57 | MakeSWCanvasSurface: function() {}, |
| 58 | MakeManagedAnimation: function() {}, |
| 59 | MakeParticles: function() {}, |
| 60 | MakeSkDashPathEffect: function() {}, |
| 61 | MakeSkVertices: function() {}, |
| 62 | MakeSurface: function() {}, |
| 63 | /** @return {RadialCanvasGradient} */ |
| 64 | MakeTwoPointConicalGradientShader: function() {}, |
| 65 | MakeWebGLCanvasSurface: function() {}, |
| 66 | /** @return {TypedArray} */ |
| 67 | Malloc: function() {}, |
| 68 | /** @return {TonalColors} */ |
| 69 | computeTonalColors: function() {}, |
| 70 | currentContext: function() {}, |
| 71 | getColorComponents: function() {}, |
| 72 | getDecodeCacheLimitBytes: function() {}, |
| 73 | getDecodeCacheUsageBytes: function() {}, |
| 74 | getSkDataBytes: function() {}, |
| 75 | multiplyByAlpha: function() {}, |
| 76 | parseColorString: function() {}, |
| 77 | setCurrentContext: function() {}, |
| 78 | setDecodeCacheLimitBytes: function() {}, |
Kevin Lubick | 217056c | 2018-09-20 17:39:31 -0400 | [diff] [blame] | 79 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 80 | // private API (i.e. things declared in the bindings that we use |
| 81 | // in the pre-js file) |
| 82 | _MakeImage: function() {}, |
| 83 | _MakeLinearGradientShader: function() {}, |
| 84 | _MakePathFromCmds: function() {}, |
| 85 | _MakeRadialGradientShader: function() {}, |
Dan Field | 3d44f73 | 2020-03-16 09:17:30 -0700 | [diff] [blame] | 86 | _MakeSweepGradientShader: function() {}, |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 87 | _MakeManagedAnimation: function() {}, |
| 88 | _MakeParticles: function() {}, |
| 89 | _MakeSkDashPathEffect: function() {}, |
| 90 | _MakeSkPicture: function() {}, |
| 91 | _MakeSkVertices: function() {}, |
| 92 | _MakeTwoPointConicalGradientShader: function() {}, |
| 93 | _decodeAnimatedImage: function() {}, |
| 94 | _decodeImage: function() {}, |
| 95 | _drawShapedText: function() {}, |
| 96 | _getRasterDirectSurface: function() {}, |
| 97 | _getRasterN32PremulSurface: function() {}, |
Kevin Lubick | 217056c | 2018-09-20 17:39:31 -0400 | [diff] [blame] | 98 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 99 | // The testing object is meant to expose internal functions |
| 100 | // for more fine-grained testing, e.g. parseColor |
| 101 | _testing: {}, |
Kevin Lubick | 1a05fce | 2018-11-20 12:51:16 -0500 | [diff] [blame] | 102 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 103 | // Objects and properties on CanvasKit |
Kevin Lubick | 217056c | 2018-09-20 17:39:31 -0400 | [diff] [blame] | 104 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 105 | GrContext: { |
| 106 | // public API (from C++ bindings) |
| 107 | getResourceCacheLimitBytes: function() {}, |
| 108 | getResourceCacheUsageBytes: function() {}, |
| 109 | releaseResourcesAndAbandonContext: function() {}, |
| 110 | setResourceCacheLimitBytes: function() {}, |
| 111 | }, |
Kevin Lubick | cd54466 | 2019-03-22 15:41:36 -0400 | [diff] [blame] | 112 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 113 | Paragraph: { |
| 114 | // public API (from C++ bindings) |
| 115 | didExceedMaxLines: function() {}, |
| 116 | getAlphabeticBaseline: function() {}, |
| 117 | getGlyphPositionAtCoordinate: function() {}, |
| 118 | getHeight: function() {}, |
| 119 | getIdeographicBaseline: function() {}, |
| 120 | getLongestLine: function() {}, |
| 121 | getMaxIntrinsicWidth: function() {}, |
| 122 | getMaxWidth: function() {}, |
| 123 | getMinIntrinsicWidth: function() {}, |
| 124 | getWordBoundary: function() {}, |
| 125 | layout: function() {}, |
Kevin Lubick | 369f6a5 | 2019-10-03 11:22:08 -0400 | [diff] [blame] | 126 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 127 | // private API |
| 128 | /** @return {Float32Array} */ |
| 129 | _getRectsForRange: function() {}, |
| 130 | }, |
Kevin Lubick | 369f6a5 | 2019-10-03 11:22:08 -0400 | [diff] [blame] | 131 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 132 | SkRuntimeEffect: { |
| 133 | // public API (from C++ bindings) |
| 134 | Make: function() {}, |
Kevin Lubick | 4b5b645 | 2019-12-06 13:55:58 -0500 | [diff] [blame] | 135 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 136 | // private API |
| 137 | _makeShader: function() {}, |
| 138 | _makeShaderWithChildren: function() {}, |
| 139 | }, |
Kevin Lubick | 4b5b645 | 2019-12-06 13:55:58 -0500 | [diff] [blame] | 140 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 141 | ParagraphStyle: function() {}, |
| 142 | RSXFormBuilder: function() {}, |
| 143 | SkColorBuilder: function() {}, |
| 144 | SkRectBuilder: function() {}, |
Kevin Lubick | d3cfbca | 2019-03-15 15:36:29 -0400 | [diff] [blame] | 145 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 146 | ShapedText: { |
| 147 | // public API (from C++ bindings) |
| 148 | getBounds: function() {}, |
| 149 | }, |
Kevin Lubick | 1ba9c4d | 2019-02-22 10:04:06 -0500 | [diff] [blame] | 150 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 151 | SkAnimatedImage: { |
| 152 | // public API (from C++ bindings) |
| 153 | decodeNextFrame: function() {}, |
| 154 | getFrameCount: function() {}, |
| 155 | getRepetitionCount: function() {}, |
| 156 | height: function() {}, |
| 157 | reset: function() {}, |
| 158 | width: function() {}, |
| 159 | }, |
Kevin Lubick | 6b921b7 | 2019-09-18 16:18:17 -0400 | [diff] [blame] | 160 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 161 | SkCanvas: { |
| 162 | // public API (from C++ bindings) |
| 163 | clear: function() {}, |
| 164 | clipPath: function() {}, |
| 165 | clipRRect: function() {}, |
| 166 | clipRect: function() {}, |
| 167 | concat: function() {}, |
| 168 | drawAnimatedImage: function() {}, |
| 169 | drawArc: function() {}, |
| 170 | drawCircle: function() {}, |
| 171 | drawColor: function() {}, |
| 172 | drawDRRect: function() {}, |
| 173 | drawImage: function() {}, |
| 174 | drawImageNine: function() {}, |
| 175 | drawImageRect: function() {}, |
| 176 | drawLine: function() {}, |
| 177 | drawOval: function() {}, |
| 178 | drawPaint: function() {}, |
| 179 | drawParagraph: function() {}, |
| 180 | drawPath: function() {}, |
| 181 | drawPicture: function() {}, |
| 182 | drawRRect: function() {}, |
| 183 | drawRect: function() {}, |
| 184 | drawRoundRect: function() {}, |
| 185 | drawShadow: function() {}, |
| 186 | drawText: function() {}, |
| 187 | drawTextBlob: function() {}, |
| 188 | drawVertices: function() {}, |
| 189 | flush: function() {}, |
| 190 | getSaveCount: function() {}, |
| 191 | getTotalMatrix: function() {}, |
| 192 | makeSurface: function() {}, |
| 193 | restore: function() {}, |
| 194 | restoreToCount: function() {}, |
| 195 | rotate: function() {}, |
| 196 | save: function() {}, |
Kevin Lubick | 7957d53 | 2020-03-16 18:08:32 +0000 | [diff] [blame^] | 197 | saveLayer: function() {}, |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 198 | scale: function() {}, |
| 199 | skew: function() {}, |
| 200 | translate: function() {}, |
Kevin Lubick | 006a6f3 | 2018-10-19 14:34:34 -0400 | [diff] [blame] | 201 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 202 | // private API |
| 203 | _drawAtlas: function() {}, |
| 204 | _drawPoints: function() {}, |
| 205 | _drawSimpleText: function() {}, |
| 206 | _readPixels: function() {}, |
| 207 | _writePixels: function() {}, |
| 208 | delete: function() {}, |
| 209 | }, |
Kevin Lubick | 006a6f3 | 2018-10-19 14:34:34 -0400 | [diff] [blame] | 210 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 211 | SkColorFilter: { |
| 212 | // public API (from C++ bindings and JS interface) |
| 213 | MakeBlend: function() {}, |
| 214 | MakeCompose: function() {}, |
| 215 | MakeLerp: function() {}, |
| 216 | MakeLinearToSRGBGamma: function() {}, |
| 217 | MakeMatrix: function() {}, |
| 218 | MakeSRGBToLinearGamma: function() {}, |
| 219 | // private API (from C++ bindings) |
| 220 | _makeMatrix: function() {}, |
| 221 | }, |
Kevin Lubick | d372934 | 2019-09-12 11:11:25 -0400 | [diff] [blame] | 222 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 223 | SkColorMatrix: { |
| 224 | concat: function() {}, |
| 225 | identity: function() {}, |
| 226 | postTranslate: function() {}, |
| 227 | rotated: function() {}, |
| 228 | scaled: function() {}, |
| 229 | }, |
Kevin Lubick | d372934 | 2019-09-12 11:11:25 -0400 | [diff] [blame] | 230 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 231 | SkContourMeasureIter: { |
| 232 | next: function() {}, |
| 233 | }, |
Kevin Lubick | e59c167 | 2019-11-20 14:17:53 -0500 | [diff] [blame] | 234 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 235 | SkContourMeasure: { |
| 236 | getPosTan: function() {}, |
| 237 | getSegment: function() {}, |
| 238 | isClosed: function() {}, |
| 239 | length: function() {}, |
| 240 | }, |
Kevin Lubick | e59c167 | 2019-11-20 14:17:53 -0500 | [diff] [blame] | 241 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 242 | SkFont: { |
| 243 | // public API (from C++ bindings) |
| 244 | getScaleX: function() {}, |
| 245 | getSize: function() {}, |
| 246 | getSkewX: function() {}, |
| 247 | getTypeface: function() {}, |
| 248 | measureText: function() {}, |
| 249 | setHinting: function() {}, |
| 250 | setLinearMetrics: function() {}, |
| 251 | setScaleX: function() {}, |
| 252 | setSize: function() {}, |
| 253 | setSkewX: function() {}, |
| 254 | setSubpixel: function() {}, |
| 255 | setTypeface: function() {}, |
| 256 | // private API (from C++ bindings) |
| 257 | _getWidths: function() {}, |
| 258 | }, |
Kevin Lubick | 35ac038 | 2019-01-02 15:13:57 -0500 | [diff] [blame] | 259 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 260 | SkFontMgr: { |
| 261 | // public API (from C++ and JS bindings) |
| 262 | FromData: function() {}, |
| 263 | RefDefault: function() {}, |
| 264 | countFamilies: function() {}, |
| 265 | getFamilyName: function() {}, |
Kevin Lubick | ddd0a33 | 2018-12-12 10:35:13 -0500 | [diff] [blame] | 266 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 267 | // private API |
| 268 | _makeTypefaceFromData: function() {}, |
| 269 | _fromData: function() {}, |
| 270 | }, |
Kevin Lubick | ddd0a33 | 2018-12-12 10:35:13 -0500 | [diff] [blame] | 271 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 272 | SkImage: { |
| 273 | // public API (from C++ bindings) |
| 274 | height: function() {}, |
| 275 | width: function() {}, |
| 276 | // private API |
| 277 | _encodeToData: function() {}, |
| 278 | _encodeToDataWithFormat: function() {}, |
| 279 | _makeShader: function() {}, |
| 280 | }, |
Kevin Lubick | 006a6f3 | 2018-10-19 14:34:34 -0400 | [diff] [blame] | 281 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 282 | SkImageFilter: { |
| 283 | MakeBlur: function() {}, |
| 284 | MakeColorFilter: function() {}, |
| 285 | MakeCompose: function() {}, |
| 286 | MakeMatrixTransform: function() {}, |
| 287 | }, |
Kevin Lubick | 15b4023 | 2019-10-29 09:55:39 -0400 | [diff] [blame] | 288 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 289 | // These are defined in interface.js |
| 290 | SkM44: { |
| 291 | identity: function() {}, |
| 292 | invert: function() {}, |
| 293 | multiply: function() {}, |
| 294 | rotatedUnitSinCos: function() {}, |
| 295 | rotated: function() {}, |
| 296 | scaled: function() {}, |
| 297 | translated: function() {}, |
| 298 | lookat: function() {}, |
| 299 | perspective: function() {}, |
| 300 | rc: function() {}, |
| 301 | transpose: function() {}, |
| 302 | }, |
Nathaniel Nifong | 77798b4 | 2020-02-21 17:15:22 -0500 | [diff] [blame] | 303 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 304 | SkMatrix: { |
| 305 | identity: function() {}, |
| 306 | invert: function() {}, |
| 307 | mapPoints: function() {}, |
| 308 | multiply: function() {}, |
| 309 | rotated: function() {}, |
| 310 | scaled: function() {}, |
| 311 | skewed: function() {}, |
| 312 | translated: function() {}, |
| 313 | }, |
Kevin Lubick | b9db390 | 2018-11-26 11:47:54 -0500 | [diff] [blame] | 314 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 315 | SkMaskFilter: { |
| 316 | MakeBlur: function() {}, |
| 317 | }, |
Kevin Lubick | 15b4023 | 2019-10-29 09:55:39 -0400 | [diff] [blame] | 318 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 319 | SkPaint: { |
| 320 | // public API (from C++ bindings) |
| 321 | /** @return {CanvasKit.SkPaint} */ |
| 322 | copy: function() {}, |
| 323 | getBlendMode: function() {}, |
| 324 | getColor: function() {}, |
| 325 | getFilterQuality: function() {}, |
| 326 | getStrokeCap: function() {}, |
| 327 | getStrokeJoin: function() {}, |
| 328 | getStrokeMiter: function() {}, |
| 329 | getStrokeWidth: function() {}, |
| 330 | setAntiAlias: function() {}, |
| 331 | setBlendMode: function() {}, |
| 332 | setColor: function() {}, |
| 333 | setFilterQuality: function() {}, |
| 334 | setImageFilter: function() {}, |
| 335 | setMaskFilter: function() {}, |
| 336 | setPathEffect: function() {}, |
| 337 | setShader: function() {}, |
| 338 | setStrokeCap: function() {}, |
| 339 | setStrokeJoin: function() {}, |
| 340 | setStrokeMiter: function() {}, |
| 341 | setStrokeWidth: function() {}, |
| 342 | setStyle: function() {}, |
Kevin Lubick | b9db390 | 2018-11-26 11:47:54 -0500 | [diff] [blame] | 343 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 344 | // Private API |
| 345 | delete: function() {}, |
| 346 | }, |
Kevin Lubick | 1a05fce | 2018-11-20 12:51:16 -0500 | [diff] [blame] | 347 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 348 | SkPathEffect: { |
| 349 | MakeDash: function() {}, |
| 350 | }, |
Nathaniel Nifong | 23b0ed9 | 2020-03-04 15:43:50 -0500 | [diff] [blame] | 351 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 352 | SkParticleEffect: { |
| 353 | // public API (from C++ bindings) |
| 354 | draw: function() {}, |
| 355 | getEffectUniform: function() {}, |
| 356 | getEffectUniformCount: function() {}, |
| 357 | getEffectUniformFloatCount: function() {}, |
| 358 | getEffectUniformName: function() {}, |
| 359 | getParticleUniformCount: function() {}, |
| 360 | getParticleUniformFloatCount: function() {}, |
| 361 | getParticleUniformName: function() {}, |
| 362 | getParticleUniform: function() {}, |
| 363 | setPosition: function() {}, |
| 364 | setRate: function() {}, |
| 365 | start: function() {}, |
| 366 | update: function() {}, |
Kevin Lubick | f8f9cd8 | 2020-02-21 08:26:59 -0500 | [diff] [blame] | 367 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 368 | // private API (from C++ bindings) |
| 369 | _effectUniformPtr: function() {}, |
| 370 | _particleUniformPtr: function() {}, |
| 371 | }, |
Kevin Lubick | f8f9cd8 | 2020-02-21 08:26:59 -0500 | [diff] [blame] | 372 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 373 | SkPath: { |
| 374 | // public API (from C++ bindings) |
| 375 | computeTightBounds: function() {}, |
| 376 | contains: function() {}, |
| 377 | /** @return {CanvasKit.SkPath} */ |
| 378 | copy: function() {}, |
| 379 | countPoints: function() {}, |
| 380 | equals: function() {}, |
| 381 | getBounds: function() {}, |
| 382 | getFillType: function() {}, |
| 383 | getPoint: function() {}, |
| 384 | isEmpty: function() {}, |
| 385 | isVolatile: function() {}, |
| 386 | reset: function() {}, |
| 387 | rewind: function() {}, |
| 388 | setFillType: function() {}, |
| 389 | setIsVolatile: function() {}, |
| 390 | toSVGString: function() {}, |
Kevin Lubick | 006a6f3 | 2018-10-19 14:34:34 -0400 | [diff] [blame] | 391 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 392 | // private API |
| 393 | _addArc: function() {}, |
| 394 | _addOval: function() {}, |
| 395 | _addPath: function() {}, |
| 396 | _addRect: function() {}, |
| 397 | _addPoly: function() {}, |
| 398 | _addRoundRect: function() {}, |
| 399 | _arc: function() {}, |
| 400 | _arcTo: function() {}, |
| 401 | _close: function() {}, |
| 402 | _conicTo: function() {}, |
| 403 | _cubicTo: function() {}, |
| 404 | _dash: function() {}, |
| 405 | _lineTo: function() {}, |
| 406 | _moveTo: function() {}, |
| 407 | _op: function() {}, |
| 408 | _quadTo: function() {}, |
| 409 | _rArcTo: function() {}, |
| 410 | _rConicTo: function() {}, |
| 411 | _rCubicTo: function() {}, |
| 412 | _rLineTo: function() {}, |
| 413 | _rMoveTo: function() {}, |
| 414 | _rQuadTo: function() {}, |
| 415 | _rect: function() {}, |
| 416 | _simplify: function() {}, |
| 417 | _stroke: function() {}, |
| 418 | _transform: function() {}, |
| 419 | _trim: function() {}, |
| 420 | delete: function() {}, |
| 421 | dump: function() {}, |
| 422 | dumpHex: function() {}, |
| 423 | }, |
Kevin Lubick | d3cfbca | 2019-03-15 15:36:29 -0400 | [diff] [blame] | 424 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 425 | SkPathMeasure: { |
| 426 | getLength: function() {}, |
| 427 | getSegment: function() {}, |
| 428 | getPosTan: function() {}, |
| 429 | isClosed: function() {}, |
| 430 | nextContour: function() {}, |
| 431 | }, |
Kevin Lubick | cc13fd3 | 2019-04-05 13:00:01 -0400 | [diff] [blame] | 432 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 433 | SkPicture: { |
| 434 | serialize: function() {}, |
| 435 | }, |
Kevin Lubick | cc13fd3 | 2019-04-05 13:00:01 -0400 | [diff] [blame] | 436 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 437 | SkPictureRecorder: { |
| 438 | beginRecording: function() {}, |
| 439 | finishRecordingAsPicture: function() {}, |
| 440 | }, |
Kevin Lubick | 006a6f3 | 2018-10-19 14:34:34 -0400 | [diff] [blame] | 441 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 442 | SkRect: { |
| 443 | fLeft: {}, |
| 444 | fTop: {}, |
| 445 | fRight: {}, |
| 446 | fBottom: {}, |
| 447 | }, |
Kevin Lubick | 2e5fe35 | 2019-09-03 12:59:06 -0400 | [diff] [blame] | 448 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 449 | SkRRect: { |
| 450 | rect: {}, |
| 451 | rx1: {}, |
| 452 | ry1: {}, |
| 453 | rx2: {}, |
| 454 | ry2: {}, |
| 455 | rx3: {}, |
| 456 | ry3: {}, |
| 457 | rx4: {}, |
| 458 | ry4: {}, |
| 459 | }, |
Kevin Lubick | 6283690 | 2019-12-09 09:04:26 -0500 | [diff] [blame] | 460 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 461 | SkShader: { |
| 462 | Blend: function() {}, |
| 463 | Color: function() {}, |
| 464 | Empty: function() {}, |
| 465 | Lerp: function() {}, |
Nathaniel Nifong | d96c3c7 | 2020-03-09 10:50:43 -0400 | [diff] [blame] | 466 | MakeLinearGradient: function() {}, |
| 467 | MakeRadialGradient: function() {}, |
| 468 | MakeTwoPointConicalGradient: function() {}, |
Dan Field | 3d44f73 | 2020-03-16 09:17:30 -0700 | [diff] [blame] | 469 | MakeSweepGradient: function() {}, |
Kevin Lubick | 6283690 | 2019-12-09 09:04:26 -0500 | [diff] [blame] | 470 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 471 | _Blend: function() {}, |
| 472 | _Lerp: function() {}, |
| 473 | }, |
Kevin Lubick | 006a6f3 | 2018-10-19 14:34:34 -0400 | [diff] [blame] | 474 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 475 | SkSurface: { |
| 476 | // public API (from C++ bindings) |
| 477 | /** @return {CanvasKit.SkCanvas} */ |
| 478 | getCanvas: function() {}, |
| 479 | /** @return {CanvasKit.SkImage} */ |
| 480 | makeImageSnapshot: function() {}, |
| 481 | makeSurface: function() {}, |
| 482 | grContext: {}, |
Kevin Lubick | 006a6f3 | 2018-10-19 14:34:34 -0400 | [diff] [blame] | 483 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 484 | // private API |
| 485 | _flush: function() {}, |
| 486 | _getRasterN32PremulSurface: function() {}, |
| 487 | delete: function() {}, |
| 488 | }, |
Kevin Lubick | ec4903d | 2019-01-14 08:36:08 -0500 | [diff] [blame] | 489 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 490 | SkTextBlob: { |
| 491 | // public API (both C++ and JS bindings) |
| 492 | MakeFromRSXform: function() {}, |
| 493 | MakeFromText: function() {}, |
| 494 | MakeOnPath: function() {}, |
| 495 | // private API (from C++ bindings) |
| 496 | _MakeFromRSXform: function() {}, |
| 497 | _MakeFromText: function() {}, |
| 498 | }, |
Nathaniel Nifong | 77798b4 | 2020-02-21 17:15:22 -0500 | [diff] [blame] | 499 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 500 | // These are defined in interface.js |
| 501 | SkVector: { |
| 502 | add: function() {}, |
| 503 | sub: function() {}, |
| 504 | dot: function() {}, |
| 505 | cross: function() {}, |
| 506 | normalize: function() {}, |
| 507 | mulScalar: function() {}, |
| 508 | length: function() {}, |
| 509 | lengthSquared: function() {}, |
| 510 | dist: function() {}, |
| 511 | }, |
Kevin Lubick | b5ae3b5 | 2018-11-03 07:51:19 -0400 | [diff] [blame] | 512 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 513 | SkVertices: { |
| 514 | // public API (from C++ bindings) |
| 515 | bounds: function() {}, |
| 516 | mode: function() {}, |
| 517 | uniqueID: function() {}, |
| 518 | vertexCount: function() {}, |
| 519 | }, |
Kevin Lubick | b5ae3b5 | 2018-11-03 07:51:19 -0400 | [diff] [blame] | 520 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 521 | _SkVerticesBuilder: { |
| 522 | colors: function() {}, |
| 523 | detach: function() {}, |
| 524 | indices: function() {}, |
| 525 | positions: function() {}, |
| 526 | texCoords: function() {}, |
| 527 | }, |
Kevin Lubick | d6ba725 | 2019-06-03 14:38:05 -0400 | [diff] [blame] | 528 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 529 | TextStyle: function() {}, |
Kevin Lubick | 369f6a5 | 2019-10-03 11:22:08 -0400 | [diff] [blame] | 530 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 531 | // Constants and Enums |
| 532 | gpu: {}, |
| 533 | skottie: {}, |
Kevin Lubick | 006a6f3 | 2018-10-19 14:34:34 -0400 | [diff] [blame] | 534 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 535 | TRANSPARENT: {}, |
| 536 | RED: {}, |
| 537 | BLUE: {}, |
| 538 | YELLOW: {}, |
| 539 | CYAN: {}, |
| 540 | BLACK: {}, |
| 541 | WHITE: {}, |
Kevin Lubick | ea905ec | 2018-11-30 14:05:58 -0500 | [diff] [blame] | 542 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 543 | MOVE_VERB: {}, |
| 544 | LINE_VERB: {}, |
| 545 | QUAD_VERB: {}, |
| 546 | CONIC_VERB: {}, |
| 547 | CUBIC_VERB: {}, |
| 548 | CLOSE_VERB: {}, |
Kevin Lubick | da3d8ac | 2019-01-07 11:08:55 -0500 | [diff] [blame] | 549 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 550 | NoDecoration: {}, |
| 551 | UnderlineDecoration: {}, |
| 552 | OverlineDecoration: {}, |
| 553 | LineThroughDecoration: {}, |
Kevin Lubick | 369f6a5 | 2019-10-03 11:22:08 -0400 | [diff] [blame] | 554 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 555 | SaveLayerInitWithPrevious: {}, |
| 556 | SaveLayerF16ColorType: {}, |
Kevin Lubick | 77d9b5c | 2019-10-29 10:48:26 -0400 | [diff] [blame] | 557 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 558 | Affinity: { |
| 559 | Upstream: {}, |
| 560 | Downstream: {}, |
| 561 | }, |
Kevin Lubick | 369f6a5 | 2019-10-03 11:22:08 -0400 | [diff] [blame] | 562 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 563 | AlphaType: { |
| 564 | Opaque: {}, |
| 565 | Premul: {}, |
| 566 | Unpremul: {}, |
| 567 | }, |
Kevin Lubick | 61ef7b2 | 2018-11-27 13:26:59 -0500 | [diff] [blame] | 568 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 569 | BlendMode: { |
| 570 | Clear: {}, |
| 571 | Src: {}, |
| 572 | Dst: {}, |
| 573 | SrcOver: {}, |
| 574 | DstOver: {}, |
| 575 | SrcIn: {}, |
| 576 | DstIn: {}, |
| 577 | SrcOut: {}, |
| 578 | DstOut: {}, |
| 579 | SrcATop: {}, |
| 580 | DstATop: {}, |
| 581 | Xor: {}, |
| 582 | Plus: {}, |
| 583 | Modulate: {}, |
| 584 | Screen: {}, |
| 585 | Overlay: {}, |
| 586 | Darken: {}, |
| 587 | Lighten: {}, |
| 588 | ColorDodge: {}, |
| 589 | ColorBurn: {}, |
| 590 | HardLight: {}, |
| 591 | SoftLight: {}, |
| 592 | Difference: {}, |
| 593 | Exclusion: {}, |
| 594 | Multiply: {}, |
| 595 | Hue: {}, |
| 596 | Saturation: {}, |
| 597 | Color: {}, |
| 598 | Luminosity: {}, |
| 599 | }, |
Kevin Lubick | 61ef7b2 | 2018-11-27 13:26:59 -0500 | [diff] [blame] | 600 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 601 | BlurStyle: { |
| 602 | Normal: {}, |
| 603 | Solid: {}, |
| 604 | Outer: {}, |
| 605 | Inner: {}, |
| 606 | }, |
Kevin Lubick | 61ef7b2 | 2018-11-27 13:26:59 -0500 | [diff] [blame] | 607 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 608 | ClipOp: { |
| 609 | Difference: {}, |
| 610 | Intersect: {}, |
| 611 | }, |
Kevin Lubick | eb2f6b0 | 2018-11-29 15:07:02 -0500 | [diff] [blame] | 612 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 613 | ColorType: { |
| 614 | Alpha_8: {}, |
| 615 | RGB_565: {}, |
| 616 | ARGB_4444: {}, |
| 617 | RGBA_8888: {}, |
| 618 | RGB_888x: {}, |
| 619 | BGRA_8888: {}, |
| 620 | RGBA_1010102: {}, |
| 621 | RGB_101010x: {}, |
| 622 | Gray_8: {}, |
| 623 | RGBA_F16: {}, |
| 624 | RGBA_F32: {}, |
| 625 | }, |
Kevin Lubick | ea905ec | 2018-11-30 14:05:58 -0500 | [diff] [blame] | 626 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 627 | FillType: { |
| 628 | Winding: {}, |
| 629 | EvenOdd: {}, |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 630 | }, |
Kevin Lubick | 006a6f3 | 2018-10-19 14:34:34 -0400 | [diff] [blame] | 631 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 632 | FilterQuality: { |
| 633 | None: {}, |
| 634 | Low: {}, |
| 635 | Medium: {}, |
| 636 | High: {}, |
| 637 | }, |
Kevin Lubick | 0a1293c | 2018-12-03 12:31:04 -0500 | [diff] [blame] | 638 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 639 | FontSlant: { |
| 640 | Upright: {}, |
| 641 | Italic: {}, |
| 642 | Oblique: {}, |
| 643 | }, |
Kevin Lubick | d3b1fe6 | 2019-10-21 10:50:26 -0400 | [diff] [blame] | 644 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 645 | FontHinting: { |
| 646 | None: {}, |
| 647 | Slight: {}, |
| 648 | Normal: {}, |
| 649 | Full: {}, |
| 650 | }, |
Kevin Lubick | bde9fcc | 2020-02-28 08:09:08 -0500 | [diff] [blame] | 651 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 652 | FontWeight: { |
| 653 | Invisible: {}, |
| 654 | Thin: {}, |
| 655 | ExtraLight: {}, |
| 656 | Light: {}, |
| 657 | Normal: {}, |
| 658 | Medium: {}, |
| 659 | SemiBold: {}, |
| 660 | Bold: {}, |
| 661 | ExtraBold: {}, |
| 662 | Black: {}, |
| 663 | ExtraBlack: {}, |
| 664 | }, |
Kevin Lubick | d3b1fe6 | 2019-10-21 10:50:26 -0400 | [diff] [blame] | 665 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 666 | FontWidth: { |
| 667 | UltraCondensed: {}, |
| 668 | ExtraCondensed: {}, |
| 669 | Condensed: {}, |
| 670 | SemiCondensed: {}, |
| 671 | Normal: {}, |
| 672 | SemiExpanded: {}, |
| 673 | Expanded: {}, |
| 674 | ExtraExpanded: {}, |
| 675 | UltraExpanded: {}, |
| 676 | }, |
Kevin Lubick | d3b1fe6 | 2019-10-21 10:50:26 -0400 | [diff] [blame] | 677 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 678 | ImageFormat: { |
| 679 | PNG: {}, |
| 680 | JPEG: {}, |
| 681 | }, |
Alexander Khovansky | 3e11933 | 2018-11-15 02:01:19 +0300 | [diff] [blame] | 682 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 683 | PaintStyle: { |
| 684 | Fill: {}, |
| 685 | Stroke: {}, |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 686 | }, |
Kevin Lubick | b9db390 | 2018-11-26 11:47:54 -0500 | [diff] [blame] | 687 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 688 | PathOp: { |
| 689 | Difference: {}, |
| 690 | Intersect: {}, |
| 691 | Union: {}, |
| 692 | XOR: {}, |
| 693 | ReverseDifference: {}, |
| 694 | }, |
Kevin Lubick | eb2f6b0 | 2018-11-29 15:07:02 -0500 | [diff] [blame] | 695 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 696 | PointMode: { |
| 697 | Points: {}, |
| 698 | Lines: {}, |
| 699 | Polygon: {}, |
| 700 | }, |
Kevin Lubick | 37ab53e | 2019-11-11 10:06:08 -0500 | [diff] [blame] | 701 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 702 | RectHeightStyle: { |
| 703 | Tight: {}, |
| 704 | Max: {}, |
| 705 | IncludeLineSpacingMiddle: {}, |
| 706 | IncludeLineSpacingTop: {}, |
| 707 | IncludeLineSpacingBottom: {}, |
| 708 | }, |
Kevin Lubick | 369f6a5 | 2019-10-03 11:22:08 -0400 | [diff] [blame] | 709 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 710 | RectWidthStyle: { |
| 711 | Tight: {}, |
| 712 | Max: {}, |
| 713 | }, |
Kevin Lubick | 369f6a5 | 2019-10-03 11:22:08 -0400 | [diff] [blame] | 714 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 715 | StrokeCap: { |
| 716 | Butt: {}, |
| 717 | Round: {}, |
| 718 | Square: {}, |
| 719 | }, |
Kevin Lubick | b9db390 | 2018-11-26 11:47:54 -0500 | [diff] [blame] | 720 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 721 | StrokeJoin: { |
| 722 | Miter: {}, |
| 723 | Round: {}, |
| 724 | Bevel: {}, |
| 725 | }, |
Kevin Lubick | b9db390 | 2018-11-26 11:47:54 -0500 | [diff] [blame] | 726 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 727 | TextAlign: { |
| 728 | Left: {}, |
| 729 | Right: {}, |
| 730 | Center: {}, |
| 731 | Justify: {}, |
| 732 | Start: {}, |
| 733 | End: {}, |
| 734 | }, |
Kevin Lubick | 369f6a5 | 2019-10-03 11:22:08 -0400 | [diff] [blame] | 735 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 736 | TextDirection: { |
| 737 | LTR: {}, |
| 738 | RTL: {}, |
| 739 | }, |
Kevin Lubick | d3b1fe6 | 2019-10-21 10:50:26 -0400 | [diff] [blame] | 740 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 741 | TileMode: { |
| 742 | Clamp: {}, |
| 743 | Repeat: {}, |
| 744 | Mirror: {}, |
| 745 | Decal: {}, |
| 746 | }, |
Kevin Lubick | eb2f6b0 | 2018-11-29 15:07:02 -0500 | [diff] [blame] | 747 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 748 | VertexMode: { |
| 749 | Triangles: {}, |
| 750 | TrianglesStrip: {}, |
| 751 | TriangleFan: {}, |
| 752 | }, |
Kevin Lubick | eb2f6b0 | 2018-11-29 15:07:02 -0500 | [diff] [blame] | 753 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 754 | // Things Enscriptem adds for us |
Kevin Lubick | 006a6f3 | 2018-10-19 14:34:34 -0400 | [diff] [blame] | 755 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 756 | /** |
| 757 | * @type {Float32Array} |
| 758 | */ |
| 759 | HEAPF32: {}, |
| 760 | /** |
| 761 | * @type {Float64Array} |
| 762 | */ |
| 763 | HEAPF64: {}, |
| 764 | /** |
| 765 | * @type {Uint8Array} |
| 766 | */ |
| 767 | HEAPU8: {}, |
| 768 | /** |
| 769 | * @type {Uint16Array} |
| 770 | */ |
| 771 | HEAPU16: {}, |
| 772 | /** |
| 773 | * @type {Uint32Array} |
| 774 | */ |
| 775 | HEAPU32: {}, |
| 776 | /** |
| 777 | * @type {Int8Array} |
| 778 | */ |
| 779 | HEAP8: {}, |
| 780 | /** |
| 781 | * @type {Int16Array} |
| 782 | */ |
| 783 | HEAP16: {}, |
| 784 | /** |
| 785 | * @type {Int32Array} |
| 786 | */ |
| 787 | HEAP32: {}, |
Kevin Lubick | fa5a138 | 2019-10-09 10:46:14 -0400 | [diff] [blame] | 788 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 789 | _malloc: function() {}, |
| 790 | _free: function() {}, |
| 791 | onRuntimeInitialized: function() {}, |
Kevin Lubick | 006a6f3 | 2018-10-19 14:34:34 -0400 | [diff] [blame] | 792 | }; |
Kevin Lubick | 217056c | 2018-09-20 17:39:31 -0400 | [diff] [blame] | 793 | |
Kevin Lubick | 006a6f3 | 2018-10-19 14:34:34 -0400 | [diff] [blame] | 794 | // Public API things that are newly declared in the JS should go here. |
| 795 | // It's not enough to declare them above, because closure can still erase them |
| 796 | // unless they go on the prototype. |
Kevin Lubick | 369f6a5 | 2019-10-03 11:22:08 -0400 | [diff] [blame] | 797 | CanvasKit.Paragraph.prototype.getRectsForRange = function() {}; |
| 798 | |
Kevin Lubick | 1a05fce | 2018-11-20 12:51:16 -0500 | [diff] [blame] | 799 | CanvasKit.SkPath.prototype.addArc = function() {}; |
Kevin Lubick | e384df4 | 2019-08-26 15:48:09 -0400 | [diff] [blame] | 800 | CanvasKit.SkPath.prototype.addOval = function() {}; |
Kevin Lubick | 217056c | 2018-09-20 17:39:31 -0400 | [diff] [blame] | 801 | CanvasKit.SkPath.prototype.addPath = function() {}; |
Kevin Lubick | 37ab53e | 2019-11-11 10:06:08 -0500 | [diff] [blame] | 802 | CanvasKit.SkPath.prototype.addPoly = function() {}; |
Kevin Lubick | 1a05fce | 2018-11-20 12:51:16 -0500 | [diff] [blame] | 803 | CanvasKit.SkPath.prototype.addRect = function() {}; |
Kevin Lubick | da3d8ac | 2019-01-07 11:08:55 -0500 | [diff] [blame] | 804 | CanvasKit.SkPath.prototype.addRoundRect = function() {}; |
Alexander Khovansky | 3e11933 | 2018-11-15 02:01:19 +0300 | [diff] [blame] | 805 | CanvasKit.SkPath.prototype.arc = function() {}; |
Kevin Lubick | 006a6f3 | 2018-10-19 14:34:34 -0400 | [diff] [blame] | 806 | CanvasKit.SkPath.prototype.arcTo = function() {}; |
Kevin Lubick | 217056c | 2018-09-20 17:39:31 -0400 | [diff] [blame] | 807 | CanvasKit.SkPath.prototype.close = function() {}; |
Kevin Lubick | 006a6f3 | 2018-10-19 14:34:34 -0400 | [diff] [blame] | 808 | CanvasKit.SkPath.prototype.conicTo = function() {}; |
| 809 | CanvasKit.SkPath.prototype.cubicTo = function() {}; |
Kevin Lubick | b5ae3b5 | 2018-11-03 07:51:19 -0400 | [diff] [blame] | 810 | CanvasKit.SkPath.prototype.dash = function() {}; |
Kevin Lubick | 006a6f3 | 2018-10-19 14:34:34 -0400 | [diff] [blame] | 811 | CanvasKit.SkPath.prototype.lineTo = function() {}; |
| 812 | CanvasKit.SkPath.prototype.moveTo = function() {}; |
Kevin Lubick | e384df4 | 2019-08-26 15:48:09 -0400 | [diff] [blame] | 813 | CanvasKit.SkPath.prototype.offset = function() {}; |
Kevin Lubick | 006a6f3 | 2018-10-19 14:34:34 -0400 | [diff] [blame] | 814 | CanvasKit.SkPath.prototype.op = function() {}; |
| 815 | CanvasKit.SkPath.prototype.quadTo = function() {}; |
Kevin Lubick | 79b7134 | 2019-11-01 14:36:52 -0400 | [diff] [blame] | 816 | CanvasKit.SkPath.prototype.rArcTo = function() {}; |
| 817 | CanvasKit.SkPath.prototype.rConicTo = function() {}; |
| 818 | CanvasKit.SkPath.prototype.rCubicTo = function() {}; |
| 819 | CanvasKit.SkPath.prototype.rLineTo = function() {}; |
| 820 | CanvasKit.SkPath.prototype.rMoveTo = function() {}; |
| 821 | CanvasKit.SkPath.prototype.rQuadTo = function() {}; |
Kevin Lubick | 006a6f3 | 2018-10-19 14:34:34 -0400 | [diff] [blame] | 822 | CanvasKit.SkPath.prototype.rect = function() {}; |
Kevin Lubick | 217056c | 2018-09-20 17:39:31 -0400 | [diff] [blame] | 823 | CanvasKit.SkPath.prototype.simplify = function() {}; |
Kevin Lubick | b5ae3b5 | 2018-11-03 07:51:19 -0400 | [diff] [blame] | 824 | CanvasKit.SkPath.prototype.stroke = function() {}; |
Kevin Lubick | 217056c | 2018-09-20 17:39:31 -0400 | [diff] [blame] | 825 | CanvasKit.SkPath.prototype.transform = function() {}; |
Kevin Lubick | b5ae3b5 | 2018-11-03 07:51:19 -0400 | [diff] [blame] | 826 | CanvasKit.SkPath.prototype.trim = function() {}; |
Kevin Lubick | 217056c | 2018-09-20 17:39:31 -0400 | [diff] [blame] | 827 | |
Kevin Lubick | a4f218d | 2020-01-14 08:39:09 -0500 | [diff] [blame] | 828 | CanvasKit.SkPicture.prototype.saveAsFile = function() {}; |
Kevin Lubick | cc13fd3 | 2019-04-05 13:00:01 -0400 | [diff] [blame] | 829 | |
Kevin Lubick | 5b90b84 | 2018-10-17 07:57:18 -0400 | [diff] [blame] | 830 | CanvasKit.SkSurface.prototype.dispose = function() {}; |
Kevin Lubick | 359a7e3 | 2019-03-19 09:34:37 -0400 | [diff] [blame] | 831 | CanvasKit.SkSurface.prototype.flush = function() {}; |
| 832 | CanvasKit.SkSurface.prototype.requestAnimationFrame = function() {}; |
Bryce Thomas | 2c5b856 | 2020-01-22 13:49:41 -0800 | [diff] [blame] | 833 | CanvasKit.SkSurface.prototype.drawOnce = function() {}; |
Kevin Lubick | cc13fd3 | 2019-04-05 13:00:01 -0400 | [diff] [blame] | 834 | CanvasKit.SkSurface.prototype.captureFrameAsSkPicture = function() {}; |
Kevin Lubick | 53965c9 | 2018-10-11 08:51:55 -0400 | [diff] [blame] | 835 | |
Alexander Khovansky | 3e11933 | 2018-11-15 02:01:19 +0300 | [diff] [blame] | 836 | CanvasKit.SkImage.prototype.encodeToData = function() {}; |
Kevin Lubick | a064c28 | 2019-04-04 09:28:53 -0400 | [diff] [blame] | 837 | CanvasKit.SkImage.prototype.makeShader = function() {}; |
Alexander Khovansky | 3e11933 | 2018-11-15 02:01:19 +0300 | [diff] [blame] | 838 | |
Kevin Lubick | ee91c07 | 2019-03-29 10:39:52 -0400 | [diff] [blame] | 839 | CanvasKit.SkCanvas.prototype.drawAtlas = function() {}; |
Kevin Lubick | 37ab53e | 2019-11-11 10:06:08 -0500 | [diff] [blame] | 840 | CanvasKit.SkCanvas.prototype.drawPoints = function() {}; |
Kevin Lubick | ec4903d | 2019-01-14 08:36:08 -0500 | [diff] [blame] | 841 | CanvasKit.SkCanvas.prototype.drawText = function() {}; |
Kevin Lubick | 52b9f37 | 2018-12-04 13:57:36 -0500 | [diff] [blame] | 842 | /** @return {Uint8Array} */ |
| 843 | CanvasKit.SkCanvas.prototype.readPixels = function() {}; |
| 844 | CanvasKit.SkCanvas.prototype.writePixels = function() {}; |
| 845 | |
Kevin Lubick | ddd0a33 | 2018-12-12 10:35:13 -0500 | [diff] [blame] | 846 | CanvasKit.SkFontMgr.prototype.MakeTypefaceFromData = function() {}; |
| 847 | |
Kevin Lubick | d3cfbca | 2019-03-15 15:36:29 -0400 | [diff] [blame] | 848 | CanvasKit.SkFont.prototype.getWidths = function() {}; |
| 849 | |
| 850 | CanvasKit.RSXFormBuilder.prototype.build = function() {}; |
| 851 | CanvasKit.RSXFormBuilder.prototype.delete = function() {}; |
| 852 | CanvasKit.RSXFormBuilder.prototype.push = function() {}; |
Kevin Lubick | ee91c07 | 2019-03-29 10:39:52 -0400 | [diff] [blame] | 853 | CanvasKit.RSXFormBuilder.prototype.set = function() {}; |
| 854 | |
| 855 | CanvasKit.SkColorBuilder.prototype.build = function() {}; |
| 856 | CanvasKit.SkColorBuilder.prototype.delete = function() {}; |
| 857 | CanvasKit.SkColorBuilder.prototype.push = function() {}; |
| 858 | CanvasKit.SkColorBuilder.prototype.set = function() {}; |
Kevin Lubick | d3cfbca | 2019-03-15 15:36:29 -0400 | [diff] [blame] | 859 | |
Kevin Lubick | f3d6c36 | 2020-01-06 08:11:52 -0500 | [diff] [blame] | 860 | CanvasKit.SkRuntimeEffect.prototype.makeShader = function() {}; |
Kevin Lubick | ecd8762 | 2020-02-22 07:37:33 -0500 | [diff] [blame] | 861 | CanvasKit.SkRuntimeEffect.prototype.makeShaderWithChildren = function() {}; |
Kevin Lubick | 4b5b645 | 2019-12-06 13:55:58 -0500 | [diff] [blame] | 862 | |
Kevin Lubick | f8f9cd8 | 2020-02-21 08:26:59 -0500 | [diff] [blame] | 863 | CanvasKit.SkParticleEffect.prototype.effectUniforms = function() {}; |
| 864 | CanvasKit.SkParticleEffect.prototype.particleUniforms = function() {}; |
| 865 | |
Kevin Lubick | b5ae3b5 | 2018-11-03 07:51:19 -0400 | [diff] [blame] | 866 | // Define StrokeOpts object |
| 867 | var StrokeOpts = {}; |
| 868 | StrokeOpts.prototype.width; |
| 869 | StrokeOpts.prototype.miter_limit; |
| 870 | StrokeOpts.prototype.cap; |
| 871 | StrokeOpts.prototype.join; |
Kevin Lubick | 1646e7d | 2018-12-07 13:03:08 -0500 | [diff] [blame] | 872 | StrokeOpts.prototype.precision; |
Kevin Lubick | b5ae3b5 | 2018-11-03 07:51:19 -0400 | [diff] [blame] | 873 | |
Kevin Lubick | eb2f6b0 | 2018-11-29 15:07:02 -0500 | [diff] [blame] | 874 | // Define everything created in the canvas2d spec here |
Kevin Lubick | b9db390 | 2018-11-26 11:47:54 -0500 | [diff] [blame] | 875 | var HTMLCanvas = {}; |
Kevin Lubick | 0a1293c | 2018-12-03 12:31:04 -0500 | [diff] [blame] | 876 | HTMLCanvas.prototype.decodeImage = function() {}; |
| 877 | HTMLCanvas.prototype.dispose = function() {}; |
Kevin Lubick | b9db390 | 2018-11-26 11:47:54 -0500 | [diff] [blame] | 878 | HTMLCanvas.prototype.getContext = function() {}; |
Kevin Lubick | 8e4a331 | 2018-12-14 15:03:41 -0500 | [diff] [blame] | 879 | HTMLCanvas.prototype.loadFont = function() {}; |
Kevin Lubick | a40f832 | 2018-12-17 16:01:36 -0500 | [diff] [blame] | 880 | HTMLCanvas.prototype.makePath2D = function() {}; |
Kevin Lubick | b9db390 | 2018-11-26 11:47:54 -0500 | [diff] [blame] | 881 | HTMLCanvas.prototype.toDataURL = function() {}; |
Kevin Lubick | b9db390 | 2018-11-26 11:47:54 -0500 | [diff] [blame] | 882 | |
| 883 | var CanvasRenderingContext2D = {}; |
| 884 | CanvasRenderingContext2D.prototype.addHitRegion = function() {}; |
| 885 | CanvasRenderingContext2D.prototype.arc = function() {}; |
| 886 | CanvasRenderingContext2D.prototype.arcTo = function() {}; |
| 887 | CanvasRenderingContext2D.prototype.beginPath = function() {}; |
| 888 | CanvasRenderingContext2D.prototype.bezierCurveTo = function() {}; |
| 889 | CanvasRenderingContext2D.prototype.clearHitRegions = function() {}; |
Kevin Lubick | 12c0e50 | 2018-11-28 12:51:56 -0500 | [diff] [blame] | 890 | CanvasRenderingContext2D.prototype.clearRect = function() {}; |
Kevin Lubick | eb2f6b0 | 2018-11-29 15:07:02 -0500 | [diff] [blame] | 891 | CanvasRenderingContext2D.prototype.clip = function() {}; |
Kevin Lubick | b9db390 | 2018-11-26 11:47:54 -0500 | [diff] [blame] | 892 | CanvasRenderingContext2D.prototype.closePath = function() {}; |
Kevin Lubick | 52b9f37 | 2018-12-04 13:57:36 -0500 | [diff] [blame] | 893 | CanvasRenderingContext2D.prototype.createImageData = function() {}; |
Kevin Lubick | eb2f6b0 | 2018-11-29 15:07:02 -0500 | [diff] [blame] | 894 | CanvasRenderingContext2D.prototype.createLinearGradient = function() {}; |
Kevin Lubick | d29edd7 | 2018-12-07 08:29:52 -0500 | [diff] [blame] | 895 | CanvasRenderingContext2D.prototype.createPattern = function() {}; |
Kevin Lubick | eb2f6b0 | 2018-11-29 15:07:02 -0500 | [diff] [blame] | 896 | CanvasRenderingContext2D.prototype.createRadialGradient = function() {}; |
Kevin Lubick | b9db390 | 2018-11-26 11:47:54 -0500 | [diff] [blame] | 897 | CanvasRenderingContext2D.prototype.drawFocusIfNeeded = function() {}; |
Kevin Lubick | 0a1293c | 2018-12-03 12:31:04 -0500 | [diff] [blame] | 898 | CanvasRenderingContext2D.prototype.drawImage = function() {}; |
Kevin Lubick | b9db390 | 2018-11-26 11:47:54 -0500 | [diff] [blame] | 899 | CanvasRenderingContext2D.prototype.ellipse = function() {}; |
Kevin Lubick | 61ef7b2 | 2018-11-27 13:26:59 -0500 | [diff] [blame] | 900 | CanvasRenderingContext2D.prototype.fill = function() {}; |
Kevin Lubick | 12c0e50 | 2018-11-28 12:51:56 -0500 | [diff] [blame] | 901 | CanvasRenderingContext2D.prototype.fillRect = function() {}; |
Kevin Lubick | b9db390 | 2018-11-26 11:47:54 -0500 | [diff] [blame] | 902 | CanvasRenderingContext2D.prototype.fillText = function() {}; |
Kevin Lubick | 52b9f37 | 2018-12-04 13:57:36 -0500 | [diff] [blame] | 903 | CanvasRenderingContext2D.prototype.getImageData = function() {}; |
Kevin Lubick | 12c0e50 | 2018-11-28 12:51:56 -0500 | [diff] [blame] | 904 | CanvasRenderingContext2D.prototype.getLineDash = function() {}; |
Kevin Lubick | 1646e7d | 2018-12-07 13:03:08 -0500 | [diff] [blame] | 905 | CanvasRenderingContext2D.prototype.isPointInPath = function() {}; |
| 906 | CanvasRenderingContext2D.prototype.isPointInStroke = function() {}; |
Kevin Lubick | b9db390 | 2018-11-26 11:47:54 -0500 | [diff] [blame] | 907 | CanvasRenderingContext2D.prototype.lineTo = function() {}; |
| 908 | CanvasRenderingContext2D.prototype.measureText = function() {}; |
| 909 | CanvasRenderingContext2D.prototype.moveTo = function() {}; |
Kevin Lubick | 52b9f37 | 2018-12-04 13:57:36 -0500 | [diff] [blame] | 910 | CanvasRenderingContext2D.prototype.putImageData = function() {}; |
Kevin Lubick | b9db390 | 2018-11-26 11:47:54 -0500 | [diff] [blame] | 911 | CanvasRenderingContext2D.prototype.quadraticCurveTo = function() {}; |
| 912 | CanvasRenderingContext2D.prototype.rect = function() {}; |
| 913 | CanvasRenderingContext2D.prototype.removeHitRegion = function() {}; |
| 914 | CanvasRenderingContext2D.prototype.resetTransform = function() {}; |
Kevin Lubick | 61ef7b2 | 2018-11-27 13:26:59 -0500 | [diff] [blame] | 915 | CanvasRenderingContext2D.prototype.restore = function() {}; |
Kevin Lubick | b9db390 | 2018-11-26 11:47:54 -0500 | [diff] [blame] | 916 | CanvasRenderingContext2D.prototype.rotate = function() {}; |
Kevin Lubick | 61ef7b2 | 2018-11-27 13:26:59 -0500 | [diff] [blame] | 917 | CanvasRenderingContext2D.prototype.save = function() {}; |
Kevin Lubick | b9db390 | 2018-11-26 11:47:54 -0500 | [diff] [blame] | 918 | CanvasRenderingContext2D.prototype.scale = function() {}; |
| 919 | CanvasRenderingContext2D.prototype.scrollPathIntoView = function() {}; |
Kevin Lubick | 12c0e50 | 2018-11-28 12:51:56 -0500 | [diff] [blame] | 920 | CanvasRenderingContext2D.prototype.setLineDash = function() {}; |
Kevin Lubick | b9db390 | 2018-11-26 11:47:54 -0500 | [diff] [blame] | 921 | CanvasRenderingContext2D.prototype.setTransform = function() {}; |
| 922 | CanvasRenderingContext2D.prototype.stroke = function() {}; |
Kevin Lubick | 12c0e50 | 2018-11-28 12:51:56 -0500 | [diff] [blame] | 923 | CanvasRenderingContext2D.prototype.strokeRect = function() {}; |
Kevin Lubick | b9db390 | 2018-11-26 11:47:54 -0500 | [diff] [blame] | 924 | CanvasRenderingContext2D.prototype.strokeText = function() {}; |
| 925 | CanvasRenderingContext2D.prototype.transform = function() {}; |
| 926 | CanvasRenderingContext2D.prototype.translate = function() {}; |
| 927 | |
Kevin Lubick | a40f832 | 2018-12-17 16:01:36 -0500 | [diff] [blame] | 928 | var Path2D = {}; |
| 929 | Path2D.prototype.addPath = function() {}; |
| 930 | Path2D.prototype.arc = function() {}; |
| 931 | Path2D.prototype.arcTo = function() {}; |
| 932 | Path2D.prototype.bezierCurveTo = function() {}; |
| 933 | Path2D.prototype.closePath = function() {}; |
| 934 | Path2D.prototype.ellipse = function() {}; |
| 935 | Path2D.prototype.lineTo = function() {}; |
| 936 | Path2D.prototype.moveTo = function() {}; |
| 937 | Path2D.prototype.quadraticCurveTo = function() {}; |
| 938 | Path2D.prototype.rect = function() {}; |
| 939 | |
Kevin Lubick | eb2f6b0 | 2018-11-29 15:07:02 -0500 | [diff] [blame] | 940 | var LinearCanvasGradient = {}; |
| 941 | LinearCanvasGradient.prototype.addColorStop = function() {}; |
| 942 | var RadialCanvasGradient = {}; |
| 943 | RadialCanvasGradient.prototype.addColorStop = function() {}; |
Kevin Lubick | d29edd7 | 2018-12-07 08:29:52 -0500 | [diff] [blame] | 944 | var CanvasPattern = {}; |
| 945 | CanvasPattern.prototype.setTransform = function() {}; |
Kevin Lubick | eb2f6b0 | 2018-11-29 15:07:02 -0500 | [diff] [blame] | 946 | |
Kevin Lubick | 52b9f37 | 2018-12-04 13:57:36 -0500 | [diff] [blame] | 947 | var ImageData = { |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 948 | /** |
| 949 | * @type {Uint8ClampedArray} |
| 950 | */ |
| 951 | data: {}, |
| 952 | height: {}, |
| 953 | width: {}, |
Kevin Lubick | 52b9f37 | 2018-12-04 13:57:36 -0500 | [diff] [blame] | 954 | }; |
| 955 | |
Kevin Lubick | d29edd7 | 2018-12-07 08:29:52 -0500 | [diff] [blame] | 956 | var DOMMatrix = { |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 957 | a: {}, |
| 958 | b: {}, |
| 959 | c: {}, |
| 960 | d: {}, |
| 961 | e: {}, |
| 962 | f: {}, |
Kevin Lubick | d29edd7 | 2018-12-07 08:29:52 -0500 | [diff] [blame] | 963 | }; |
| 964 | |
Kevin Lubick | 217056c | 2018-09-20 17:39:31 -0400 | [diff] [blame] | 965 | // Not sure why this is needed - might be a bug in emsdk that this isn't properly declared. |
Kevin Lubick | 6fccc9d | 2018-11-20 15:55:10 -0500 | [diff] [blame] | 966 | function loadWebAssemblyModule() {}; |