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