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() {}, |
Kevin Lubick | 6283690 | 2019-12-09 09:04:26 -0500 | [diff] [blame] | 465 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 466 | _Blend: function() {}, |
| 467 | _Lerp: function() {}, |
| 468 | }, |
Kevin Lubick | 006a6f3 | 2018-10-19 14:34:34 -0400 | [diff] [blame] | 469 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 470 | SkSurface: { |
| 471 | // public API (from C++ bindings) |
| 472 | /** @return {CanvasKit.SkCanvas} */ |
| 473 | getCanvas: function() {}, |
| 474 | /** @return {CanvasKit.SkImage} */ |
| 475 | makeImageSnapshot: function() {}, |
| 476 | makeSurface: function() {}, |
| 477 | grContext: {}, |
Kevin Lubick | 006a6f3 | 2018-10-19 14:34:34 -0400 | [diff] [blame] | 478 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 479 | // private API |
| 480 | _flush: function() {}, |
| 481 | _getRasterN32PremulSurface: function() {}, |
| 482 | delete: function() {}, |
| 483 | }, |
Kevin Lubick | ec4903d | 2019-01-14 08:36:08 -0500 | [diff] [blame] | 484 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 485 | SkTextBlob: { |
| 486 | // public API (both C++ and JS bindings) |
| 487 | MakeFromRSXform: function() {}, |
| 488 | MakeFromText: function() {}, |
| 489 | MakeOnPath: function() {}, |
| 490 | // private API (from C++ bindings) |
| 491 | _MakeFromRSXform: function() {}, |
| 492 | _MakeFromText: function() {}, |
| 493 | }, |
Nathaniel Nifong | 77798b4 | 2020-02-21 17:15:22 -0500 | [diff] [blame] | 494 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 495 | // These are defined in interface.js |
| 496 | SkVector: { |
| 497 | add: function() {}, |
| 498 | sub: function() {}, |
| 499 | dot: function() {}, |
| 500 | cross: function() {}, |
| 501 | normalize: function() {}, |
| 502 | mulScalar: function() {}, |
| 503 | length: function() {}, |
| 504 | lengthSquared: function() {}, |
| 505 | dist: function() {}, |
| 506 | }, |
Kevin Lubick | b5ae3b5 | 2018-11-03 07:51:19 -0400 | [diff] [blame] | 507 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 508 | SkVertices: { |
| 509 | // public API (from C++ bindings) |
| 510 | bounds: function() {}, |
| 511 | mode: function() {}, |
| 512 | uniqueID: function() {}, |
| 513 | vertexCount: function() {}, |
| 514 | }, |
Kevin Lubick | b5ae3b5 | 2018-11-03 07:51:19 -0400 | [diff] [blame] | 515 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 516 | _SkVerticesBuilder: { |
| 517 | colors: function() {}, |
| 518 | detach: function() {}, |
| 519 | indices: function() {}, |
| 520 | positions: function() {}, |
| 521 | texCoords: function() {}, |
| 522 | }, |
Kevin Lubick | d6ba725 | 2019-06-03 14:38:05 -0400 | [diff] [blame] | 523 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 524 | TextStyle: function() {}, |
Kevin Lubick | 369f6a5 | 2019-10-03 11:22:08 -0400 | [diff] [blame] | 525 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 526 | // Constants and Enums |
| 527 | gpu: {}, |
| 528 | skottie: {}, |
Kevin Lubick | 006a6f3 | 2018-10-19 14:34:34 -0400 | [diff] [blame] | 529 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 530 | TRANSPARENT: {}, |
| 531 | RED: {}, |
| 532 | BLUE: {}, |
| 533 | YELLOW: {}, |
| 534 | CYAN: {}, |
| 535 | BLACK: {}, |
| 536 | WHITE: {}, |
Kevin Lubick | ea905ec | 2018-11-30 14:05:58 -0500 | [diff] [blame] | 537 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 538 | MOVE_VERB: {}, |
| 539 | LINE_VERB: {}, |
| 540 | QUAD_VERB: {}, |
| 541 | CONIC_VERB: {}, |
| 542 | CUBIC_VERB: {}, |
| 543 | CLOSE_VERB: {}, |
Kevin Lubick | da3d8ac | 2019-01-07 11:08:55 -0500 | [diff] [blame] | 544 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 545 | NoDecoration: {}, |
| 546 | UnderlineDecoration: {}, |
| 547 | OverlineDecoration: {}, |
| 548 | LineThroughDecoration: {}, |
Kevin Lubick | 369f6a5 | 2019-10-03 11:22:08 -0400 | [diff] [blame] | 549 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 550 | SaveLayerInitWithPrevious: {}, |
| 551 | SaveLayerF16ColorType: {}, |
Kevin Lubick | 77d9b5c | 2019-10-29 10:48:26 -0400 | [diff] [blame] | 552 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 553 | Affinity: { |
| 554 | Upstream: {}, |
| 555 | Downstream: {}, |
| 556 | }, |
Kevin Lubick | 369f6a5 | 2019-10-03 11:22:08 -0400 | [diff] [blame] | 557 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 558 | AlphaType: { |
| 559 | Opaque: {}, |
| 560 | Premul: {}, |
| 561 | Unpremul: {}, |
| 562 | }, |
Kevin Lubick | 61ef7b2 | 2018-11-27 13:26:59 -0500 | [diff] [blame] | 563 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 564 | BlendMode: { |
| 565 | Clear: {}, |
| 566 | Src: {}, |
| 567 | Dst: {}, |
| 568 | SrcOver: {}, |
| 569 | DstOver: {}, |
| 570 | SrcIn: {}, |
| 571 | DstIn: {}, |
| 572 | SrcOut: {}, |
| 573 | DstOut: {}, |
| 574 | SrcATop: {}, |
| 575 | DstATop: {}, |
| 576 | Xor: {}, |
| 577 | Plus: {}, |
| 578 | Modulate: {}, |
| 579 | Screen: {}, |
| 580 | Overlay: {}, |
| 581 | Darken: {}, |
| 582 | Lighten: {}, |
| 583 | ColorDodge: {}, |
| 584 | ColorBurn: {}, |
| 585 | HardLight: {}, |
| 586 | SoftLight: {}, |
| 587 | Difference: {}, |
| 588 | Exclusion: {}, |
| 589 | Multiply: {}, |
| 590 | Hue: {}, |
| 591 | Saturation: {}, |
| 592 | Color: {}, |
| 593 | Luminosity: {}, |
| 594 | }, |
Kevin Lubick | 61ef7b2 | 2018-11-27 13:26:59 -0500 | [diff] [blame] | 595 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 596 | BlurStyle: { |
| 597 | Normal: {}, |
| 598 | Solid: {}, |
| 599 | Outer: {}, |
| 600 | Inner: {}, |
| 601 | }, |
Kevin Lubick | 61ef7b2 | 2018-11-27 13:26:59 -0500 | [diff] [blame] | 602 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 603 | ClipOp: { |
| 604 | Difference: {}, |
| 605 | Intersect: {}, |
| 606 | }, |
Kevin Lubick | eb2f6b0 | 2018-11-29 15:07:02 -0500 | [diff] [blame] | 607 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 608 | ColorType: { |
| 609 | Alpha_8: {}, |
| 610 | RGB_565: {}, |
| 611 | ARGB_4444: {}, |
| 612 | RGBA_8888: {}, |
| 613 | RGB_888x: {}, |
| 614 | BGRA_8888: {}, |
| 615 | RGBA_1010102: {}, |
| 616 | RGB_101010x: {}, |
| 617 | Gray_8: {}, |
| 618 | RGBA_F16: {}, |
| 619 | RGBA_F32: {}, |
| 620 | }, |
Kevin Lubick | ea905ec | 2018-11-30 14:05:58 -0500 | [diff] [blame] | 621 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 622 | FillType: { |
| 623 | Winding: {}, |
| 624 | EvenOdd: {}, |
| 625 | InverseWinding: {}, |
| 626 | InverseEvenOdd: {}, |
| 627 | }, |
Kevin Lubick | 006a6f3 | 2018-10-19 14:34:34 -0400 | [diff] [blame] | 628 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 629 | FilterQuality: { |
| 630 | None: {}, |
| 631 | Low: {}, |
| 632 | Medium: {}, |
| 633 | High: {}, |
| 634 | }, |
Kevin Lubick | 0a1293c | 2018-12-03 12:31:04 -0500 | [diff] [blame] | 635 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 636 | FontSlant: { |
| 637 | Upright: {}, |
| 638 | Italic: {}, |
| 639 | Oblique: {}, |
| 640 | }, |
Kevin Lubick | d3b1fe6 | 2019-10-21 10:50:26 -0400 | [diff] [blame] | 641 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 642 | FontHinting: { |
| 643 | None: {}, |
| 644 | Slight: {}, |
| 645 | Normal: {}, |
| 646 | Full: {}, |
| 647 | }, |
Kevin Lubick | bde9fcc | 2020-02-28 08:09:08 -0500 | [diff] [blame] | 648 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 649 | FontWeight: { |
| 650 | Invisible: {}, |
| 651 | Thin: {}, |
| 652 | ExtraLight: {}, |
| 653 | Light: {}, |
| 654 | Normal: {}, |
| 655 | Medium: {}, |
| 656 | SemiBold: {}, |
| 657 | Bold: {}, |
| 658 | ExtraBold: {}, |
| 659 | Black: {}, |
| 660 | ExtraBlack: {}, |
| 661 | }, |
Kevin Lubick | d3b1fe6 | 2019-10-21 10:50:26 -0400 | [diff] [blame] | 662 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 663 | FontWidth: { |
| 664 | UltraCondensed: {}, |
| 665 | ExtraCondensed: {}, |
| 666 | Condensed: {}, |
| 667 | SemiCondensed: {}, |
| 668 | Normal: {}, |
| 669 | SemiExpanded: {}, |
| 670 | Expanded: {}, |
| 671 | ExtraExpanded: {}, |
| 672 | UltraExpanded: {}, |
| 673 | }, |
Kevin Lubick | d3b1fe6 | 2019-10-21 10:50:26 -0400 | [diff] [blame] | 674 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 675 | ImageFormat: { |
| 676 | PNG: {}, |
| 677 | JPEG: {}, |
| 678 | }, |
Alexander Khovansky | 3e11933 | 2018-11-15 02:01:19 +0300 | [diff] [blame] | 679 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 680 | PaintStyle: { |
| 681 | Fill: {}, |
| 682 | Stroke: {}, |
| 683 | StrokeAndFill: {}, |
| 684 | }, |
Kevin Lubick | b9db390 | 2018-11-26 11:47:54 -0500 | [diff] [blame] | 685 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 686 | PathOp: { |
| 687 | Difference: {}, |
| 688 | Intersect: {}, |
| 689 | Union: {}, |
| 690 | XOR: {}, |
| 691 | ReverseDifference: {}, |
| 692 | }, |
Kevin Lubick | eb2f6b0 | 2018-11-29 15:07:02 -0500 | [diff] [blame] | 693 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 694 | PointMode: { |
| 695 | Points: {}, |
| 696 | Lines: {}, |
| 697 | Polygon: {}, |
| 698 | }, |
Kevin Lubick | 37ab53e | 2019-11-11 10:06:08 -0500 | [diff] [blame] | 699 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 700 | RectHeightStyle: { |
| 701 | Tight: {}, |
| 702 | Max: {}, |
| 703 | IncludeLineSpacingMiddle: {}, |
| 704 | IncludeLineSpacingTop: {}, |
| 705 | IncludeLineSpacingBottom: {}, |
| 706 | }, |
Kevin Lubick | 369f6a5 | 2019-10-03 11:22:08 -0400 | [diff] [blame] | 707 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 708 | RectWidthStyle: { |
| 709 | Tight: {}, |
| 710 | Max: {}, |
| 711 | }, |
Kevin Lubick | 369f6a5 | 2019-10-03 11:22:08 -0400 | [diff] [blame] | 712 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 713 | StrokeCap: { |
| 714 | Butt: {}, |
| 715 | Round: {}, |
| 716 | Square: {}, |
| 717 | }, |
Kevin Lubick | b9db390 | 2018-11-26 11:47:54 -0500 | [diff] [blame] | 718 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 719 | StrokeJoin: { |
| 720 | Miter: {}, |
| 721 | Round: {}, |
| 722 | Bevel: {}, |
| 723 | }, |
Kevin Lubick | b9db390 | 2018-11-26 11:47:54 -0500 | [diff] [blame] | 724 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 725 | TextAlign: { |
| 726 | Left: {}, |
| 727 | Right: {}, |
| 728 | Center: {}, |
| 729 | Justify: {}, |
| 730 | Start: {}, |
| 731 | End: {}, |
| 732 | }, |
Kevin Lubick | 369f6a5 | 2019-10-03 11:22:08 -0400 | [diff] [blame] | 733 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 734 | TextDirection: { |
| 735 | LTR: {}, |
| 736 | RTL: {}, |
| 737 | }, |
Kevin Lubick | d3b1fe6 | 2019-10-21 10:50:26 -0400 | [diff] [blame] | 738 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 739 | TextEncoding: { |
| 740 | UTF8: {}, |
| 741 | UTF16: {}, |
| 742 | UTF32: {}, |
| 743 | GlyphID: {}, |
| 744 | }, |
Kevin Lubick | ec4903d | 2019-01-14 08:36:08 -0500 | [diff] [blame] | 745 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 746 | TileMode: { |
| 747 | Clamp: {}, |
| 748 | Repeat: {}, |
| 749 | Mirror: {}, |
| 750 | Decal: {}, |
| 751 | }, |
Kevin Lubick | eb2f6b0 | 2018-11-29 15:07:02 -0500 | [diff] [blame] | 752 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 753 | VertexMode: { |
| 754 | Triangles: {}, |
| 755 | TrianglesStrip: {}, |
| 756 | TriangleFan: {}, |
| 757 | }, |
Kevin Lubick | eb2f6b0 | 2018-11-29 15:07:02 -0500 | [diff] [blame] | 758 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 759 | // Things Enscriptem adds for us |
Kevin Lubick | 006a6f3 | 2018-10-19 14:34:34 -0400 | [diff] [blame] | 760 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 761 | /** |
| 762 | * @type {Float32Array} |
| 763 | */ |
| 764 | HEAPF32: {}, |
| 765 | /** |
| 766 | * @type {Float64Array} |
| 767 | */ |
| 768 | HEAPF64: {}, |
| 769 | /** |
| 770 | * @type {Uint8Array} |
| 771 | */ |
| 772 | HEAPU8: {}, |
| 773 | /** |
| 774 | * @type {Uint16Array} |
| 775 | */ |
| 776 | HEAPU16: {}, |
| 777 | /** |
| 778 | * @type {Uint32Array} |
| 779 | */ |
| 780 | HEAPU32: {}, |
| 781 | /** |
| 782 | * @type {Int8Array} |
| 783 | */ |
| 784 | HEAP8: {}, |
| 785 | /** |
| 786 | * @type {Int16Array} |
| 787 | */ |
| 788 | HEAP16: {}, |
| 789 | /** |
| 790 | * @type {Int32Array} |
| 791 | */ |
| 792 | HEAP32: {}, |
Kevin Lubick | fa5a138 | 2019-10-09 10:46:14 -0400 | [diff] [blame] | 793 | |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 794 | _malloc: function() {}, |
| 795 | _free: function() {}, |
| 796 | onRuntimeInitialized: function() {}, |
Kevin Lubick | 006a6f3 | 2018-10-19 14:34:34 -0400 | [diff] [blame] | 797 | }; |
Kevin Lubick | 217056c | 2018-09-20 17:39:31 -0400 | [diff] [blame] | 798 | |
Kevin Lubick | 006a6f3 | 2018-10-19 14:34:34 -0400 | [diff] [blame] | 799 | // Public API things that are newly declared in the JS should go here. |
| 800 | // It's not enough to declare them above, because closure can still erase them |
| 801 | // unless they go on the prototype. |
Kevin Lubick | 369f6a5 | 2019-10-03 11:22:08 -0400 | [diff] [blame] | 802 | CanvasKit.Paragraph.prototype.getRectsForRange = function() {}; |
| 803 | |
Kevin Lubick | 1a05fce | 2018-11-20 12:51:16 -0500 | [diff] [blame] | 804 | CanvasKit.SkPath.prototype.addArc = function() {}; |
Kevin Lubick | e384df4 | 2019-08-26 15:48:09 -0400 | [diff] [blame] | 805 | CanvasKit.SkPath.prototype.addOval = function() {}; |
Kevin Lubick | 217056c | 2018-09-20 17:39:31 -0400 | [diff] [blame] | 806 | CanvasKit.SkPath.prototype.addPath = function() {}; |
Kevin Lubick | 37ab53e | 2019-11-11 10:06:08 -0500 | [diff] [blame] | 807 | CanvasKit.SkPath.prototype.addPoly = function() {}; |
Kevin Lubick | 1a05fce | 2018-11-20 12:51:16 -0500 | [diff] [blame] | 808 | CanvasKit.SkPath.prototype.addRect = function() {}; |
Kevin Lubick | da3d8ac | 2019-01-07 11:08:55 -0500 | [diff] [blame] | 809 | CanvasKit.SkPath.prototype.addRoundRect = function() {}; |
Alexander Khovansky | 3e11933 | 2018-11-15 02:01:19 +0300 | [diff] [blame] | 810 | CanvasKit.SkPath.prototype.arc = function() {}; |
Kevin Lubick | 006a6f3 | 2018-10-19 14:34:34 -0400 | [diff] [blame] | 811 | CanvasKit.SkPath.prototype.arcTo = function() {}; |
Kevin Lubick | 217056c | 2018-09-20 17:39:31 -0400 | [diff] [blame] | 812 | CanvasKit.SkPath.prototype.close = function() {}; |
Kevin Lubick | 006a6f3 | 2018-10-19 14:34:34 -0400 | [diff] [blame] | 813 | CanvasKit.SkPath.prototype.conicTo = function() {}; |
| 814 | CanvasKit.SkPath.prototype.cubicTo = function() {}; |
Kevin Lubick | b5ae3b5 | 2018-11-03 07:51:19 -0400 | [diff] [blame] | 815 | CanvasKit.SkPath.prototype.dash = function() {}; |
Kevin Lubick | 006a6f3 | 2018-10-19 14:34:34 -0400 | [diff] [blame] | 816 | CanvasKit.SkPath.prototype.lineTo = function() {}; |
| 817 | CanvasKit.SkPath.prototype.moveTo = function() {}; |
Kevin Lubick | e384df4 | 2019-08-26 15:48:09 -0400 | [diff] [blame] | 818 | CanvasKit.SkPath.prototype.offset = function() {}; |
Kevin Lubick | 006a6f3 | 2018-10-19 14:34:34 -0400 | [diff] [blame] | 819 | CanvasKit.SkPath.prototype.op = function() {}; |
| 820 | CanvasKit.SkPath.prototype.quadTo = function() {}; |
Kevin Lubick | 79b7134 | 2019-11-01 14:36:52 -0400 | [diff] [blame] | 821 | CanvasKit.SkPath.prototype.rArcTo = function() {}; |
| 822 | CanvasKit.SkPath.prototype.rConicTo = function() {}; |
| 823 | CanvasKit.SkPath.prototype.rCubicTo = function() {}; |
| 824 | CanvasKit.SkPath.prototype.rLineTo = function() {}; |
| 825 | CanvasKit.SkPath.prototype.rMoveTo = function() {}; |
| 826 | CanvasKit.SkPath.prototype.rQuadTo = function() {}; |
Kevin Lubick | 006a6f3 | 2018-10-19 14:34:34 -0400 | [diff] [blame] | 827 | CanvasKit.SkPath.prototype.rect = function() {}; |
Kevin Lubick | 217056c | 2018-09-20 17:39:31 -0400 | [diff] [blame] | 828 | CanvasKit.SkPath.prototype.simplify = function() {}; |
Kevin Lubick | b5ae3b5 | 2018-11-03 07:51:19 -0400 | [diff] [blame] | 829 | CanvasKit.SkPath.prototype.stroke = function() {}; |
Kevin Lubick | 217056c | 2018-09-20 17:39:31 -0400 | [diff] [blame] | 830 | CanvasKit.SkPath.prototype.transform = function() {}; |
Kevin Lubick | b5ae3b5 | 2018-11-03 07:51:19 -0400 | [diff] [blame] | 831 | CanvasKit.SkPath.prototype.trim = function() {}; |
Kevin Lubick | 217056c | 2018-09-20 17:39:31 -0400 | [diff] [blame] | 832 | |
Kevin Lubick | a4f218d | 2020-01-14 08:39:09 -0500 | [diff] [blame] | 833 | CanvasKit.SkPicture.prototype.saveAsFile = function() {}; |
Kevin Lubick | cc13fd3 | 2019-04-05 13:00:01 -0400 | [diff] [blame] | 834 | |
Kevin Lubick | 5b90b84 | 2018-10-17 07:57:18 -0400 | [diff] [blame] | 835 | CanvasKit.SkSurface.prototype.dispose = function() {}; |
Kevin Lubick | 359a7e3 | 2019-03-19 09:34:37 -0400 | [diff] [blame] | 836 | CanvasKit.SkSurface.prototype.flush = function() {}; |
| 837 | CanvasKit.SkSurface.prototype.requestAnimationFrame = function() {}; |
Bryce Thomas | 2c5b856 | 2020-01-22 13:49:41 -0800 | [diff] [blame] | 838 | CanvasKit.SkSurface.prototype.drawOnce = function() {}; |
Kevin Lubick | cc13fd3 | 2019-04-05 13:00:01 -0400 | [diff] [blame] | 839 | CanvasKit.SkSurface.prototype.captureFrameAsSkPicture = function() {}; |
Kevin Lubick | 53965c9 | 2018-10-11 08:51:55 -0400 | [diff] [blame] | 840 | |
Alexander Khovansky | 3e11933 | 2018-11-15 02:01:19 +0300 | [diff] [blame] | 841 | CanvasKit.SkImage.prototype.encodeToData = function() {}; |
Kevin Lubick | a064c28 | 2019-04-04 09:28:53 -0400 | [diff] [blame] | 842 | CanvasKit.SkImage.prototype.makeShader = function() {}; |
Alexander Khovansky | 3e11933 | 2018-11-15 02:01:19 +0300 | [diff] [blame] | 843 | |
Kevin Lubick | ee91c07 | 2019-03-29 10:39:52 -0400 | [diff] [blame] | 844 | CanvasKit.SkCanvas.prototype.drawAtlas = function() {}; |
Kevin Lubick | 37ab53e | 2019-11-11 10:06:08 -0500 | [diff] [blame] | 845 | CanvasKit.SkCanvas.prototype.drawPoints = function() {}; |
Kevin Lubick | ec4903d | 2019-01-14 08:36:08 -0500 | [diff] [blame] | 846 | CanvasKit.SkCanvas.prototype.drawText = function() {}; |
Kevin Lubick | 52b9f37 | 2018-12-04 13:57:36 -0500 | [diff] [blame] | 847 | /** @return {Uint8Array} */ |
| 848 | CanvasKit.SkCanvas.prototype.readPixels = function() {}; |
| 849 | CanvasKit.SkCanvas.prototype.writePixels = function() {}; |
| 850 | |
Kevin Lubick | ddd0a33 | 2018-12-12 10:35:13 -0500 | [diff] [blame] | 851 | CanvasKit.SkFontMgr.prototype.MakeTypefaceFromData = function() {}; |
| 852 | |
Kevin Lubick | d3cfbca | 2019-03-15 15:36:29 -0400 | [diff] [blame] | 853 | CanvasKit.SkFont.prototype.getWidths = function() {}; |
| 854 | |
| 855 | CanvasKit.RSXFormBuilder.prototype.build = function() {}; |
| 856 | CanvasKit.RSXFormBuilder.prototype.delete = function() {}; |
| 857 | CanvasKit.RSXFormBuilder.prototype.push = function() {}; |
Kevin Lubick | ee91c07 | 2019-03-29 10:39:52 -0400 | [diff] [blame] | 858 | CanvasKit.RSXFormBuilder.prototype.set = function() {}; |
| 859 | |
| 860 | CanvasKit.SkColorBuilder.prototype.build = function() {}; |
| 861 | CanvasKit.SkColorBuilder.prototype.delete = function() {}; |
| 862 | CanvasKit.SkColorBuilder.prototype.push = function() {}; |
| 863 | CanvasKit.SkColorBuilder.prototype.set = function() {}; |
Kevin Lubick | d3cfbca | 2019-03-15 15:36:29 -0400 | [diff] [blame] | 864 | |
Kevin Lubick | f3d6c36 | 2020-01-06 08:11:52 -0500 | [diff] [blame] | 865 | CanvasKit.SkRuntimeEffect.prototype.makeShader = function() {}; |
Kevin Lubick | ecd8762 | 2020-02-22 07:37:33 -0500 | [diff] [blame] | 866 | CanvasKit.SkRuntimeEffect.prototype.makeShaderWithChildren = function() {}; |
Kevin Lubick | 4b5b645 | 2019-12-06 13:55:58 -0500 | [diff] [blame] | 867 | |
Kevin Lubick | f8f9cd8 | 2020-02-21 08:26:59 -0500 | [diff] [blame] | 868 | CanvasKit.SkParticleEffect.prototype.effectUniforms = function() {}; |
| 869 | CanvasKit.SkParticleEffect.prototype.particleUniforms = function() {}; |
| 870 | |
Kevin Lubick | b5ae3b5 | 2018-11-03 07:51:19 -0400 | [diff] [blame] | 871 | // Define StrokeOpts object |
| 872 | var StrokeOpts = {}; |
| 873 | StrokeOpts.prototype.width; |
| 874 | StrokeOpts.prototype.miter_limit; |
| 875 | StrokeOpts.prototype.cap; |
| 876 | StrokeOpts.prototype.join; |
Kevin Lubick | 1646e7d | 2018-12-07 13:03:08 -0500 | [diff] [blame] | 877 | StrokeOpts.prototype.precision; |
Kevin Lubick | b5ae3b5 | 2018-11-03 07:51:19 -0400 | [diff] [blame] | 878 | |
Kevin Lubick | eb2f6b0 | 2018-11-29 15:07:02 -0500 | [diff] [blame] | 879 | // Define everything created in the canvas2d spec here |
Kevin Lubick | b9db390 | 2018-11-26 11:47:54 -0500 | [diff] [blame] | 880 | var HTMLCanvas = {}; |
Kevin Lubick | 0a1293c | 2018-12-03 12:31:04 -0500 | [diff] [blame] | 881 | HTMLCanvas.prototype.decodeImage = function() {}; |
| 882 | HTMLCanvas.prototype.dispose = function() {}; |
Kevin Lubick | b9db390 | 2018-11-26 11:47:54 -0500 | [diff] [blame] | 883 | HTMLCanvas.prototype.getContext = function() {}; |
Kevin Lubick | 8e4a331 | 2018-12-14 15:03:41 -0500 | [diff] [blame] | 884 | HTMLCanvas.prototype.loadFont = function() {}; |
Kevin Lubick | a40f832 | 2018-12-17 16:01:36 -0500 | [diff] [blame] | 885 | HTMLCanvas.prototype.makePath2D = function() {}; |
Kevin Lubick | b9db390 | 2018-11-26 11:47:54 -0500 | [diff] [blame] | 886 | HTMLCanvas.prototype.toDataURL = function() {}; |
Kevin Lubick | b9db390 | 2018-11-26 11:47:54 -0500 | [diff] [blame] | 887 | |
| 888 | var CanvasRenderingContext2D = {}; |
| 889 | CanvasRenderingContext2D.prototype.addHitRegion = function() {}; |
| 890 | CanvasRenderingContext2D.prototype.arc = function() {}; |
| 891 | CanvasRenderingContext2D.prototype.arcTo = function() {}; |
| 892 | CanvasRenderingContext2D.prototype.beginPath = function() {}; |
| 893 | CanvasRenderingContext2D.prototype.bezierCurveTo = function() {}; |
| 894 | CanvasRenderingContext2D.prototype.clearHitRegions = function() {}; |
Kevin Lubick | 12c0e50 | 2018-11-28 12:51:56 -0500 | [diff] [blame] | 895 | CanvasRenderingContext2D.prototype.clearRect = function() {}; |
Kevin Lubick | eb2f6b0 | 2018-11-29 15:07:02 -0500 | [diff] [blame] | 896 | CanvasRenderingContext2D.prototype.clip = function() {}; |
Kevin Lubick | b9db390 | 2018-11-26 11:47:54 -0500 | [diff] [blame] | 897 | CanvasRenderingContext2D.prototype.closePath = function() {}; |
Kevin Lubick | 52b9f37 | 2018-12-04 13:57:36 -0500 | [diff] [blame] | 898 | CanvasRenderingContext2D.prototype.createImageData = function() {}; |
Kevin Lubick | eb2f6b0 | 2018-11-29 15:07:02 -0500 | [diff] [blame] | 899 | CanvasRenderingContext2D.prototype.createLinearGradient = function() {}; |
Kevin Lubick | d29edd7 | 2018-12-07 08:29:52 -0500 | [diff] [blame] | 900 | CanvasRenderingContext2D.prototype.createPattern = function() {}; |
Kevin Lubick | eb2f6b0 | 2018-11-29 15:07:02 -0500 | [diff] [blame] | 901 | CanvasRenderingContext2D.prototype.createRadialGradient = function() {}; |
Kevin Lubick | b9db390 | 2018-11-26 11:47:54 -0500 | [diff] [blame] | 902 | CanvasRenderingContext2D.prototype.drawFocusIfNeeded = function() {}; |
Kevin Lubick | 0a1293c | 2018-12-03 12:31:04 -0500 | [diff] [blame] | 903 | CanvasRenderingContext2D.prototype.drawImage = function() {}; |
Kevin Lubick | b9db390 | 2018-11-26 11:47:54 -0500 | [diff] [blame] | 904 | CanvasRenderingContext2D.prototype.ellipse = function() {}; |
Kevin Lubick | 61ef7b2 | 2018-11-27 13:26:59 -0500 | [diff] [blame] | 905 | CanvasRenderingContext2D.prototype.fill = function() {}; |
Kevin Lubick | 12c0e50 | 2018-11-28 12:51:56 -0500 | [diff] [blame] | 906 | CanvasRenderingContext2D.prototype.fillRect = function() {}; |
Kevin Lubick | b9db390 | 2018-11-26 11:47:54 -0500 | [diff] [blame] | 907 | CanvasRenderingContext2D.prototype.fillText = function() {}; |
Kevin Lubick | 52b9f37 | 2018-12-04 13:57:36 -0500 | [diff] [blame] | 908 | CanvasRenderingContext2D.prototype.getImageData = function() {}; |
Kevin Lubick | 12c0e50 | 2018-11-28 12:51:56 -0500 | [diff] [blame] | 909 | CanvasRenderingContext2D.prototype.getLineDash = function() {}; |
Kevin Lubick | 1646e7d | 2018-12-07 13:03:08 -0500 | [diff] [blame] | 910 | CanvasRenderingContext2D.prototype.isPointInPath = function() {}; |
| 911 | CanvasRenderingContext2D.prototype.isPointInStroke = function() {}; |
Kevin Lubick | b9db390 | 2018-11-26 11:47:54 -0500 | [diff] [blame] | 912 | CanvasRenderingContext2D.prototype.lineTo = function() {}; |
| 913 | CanvasRenderingContext2D.prototype.measureText = function() {}; |
| 914 | CanvasRenderingContext2D.prototype.moveTo = function() {}; |
Kevin Lubick | 52b9f37 | 2018-12-04 13:57:36 -0500 | [diff] [blame] | 915 | CanvasRenderingContext2D.prototype.putImageData = function() {}; |
Kevin Lubick | b9db390 | 2018-11-26 11:47:54 -0500 | [diff] [blame] | 916 | CanvasRenderingContext2D.prototype.quadraticCurveTo = function() {}; |
| 917 | CanvasRenderingContext2D.prototype.rect = function() {}; |
| 918 | CanvasRenderingContext2D.prototype.removeHitRegion = function() {}; |
| 919 | CanvasRenderingContext2D.prototype.resetTransform = function() {}; |
Kevin Lubick | 61ef7b2 | 2018-11-27 13:26:59 -0500 | [diff] [blame] | 920 | CanvasRenderingContext2D.prototype.restore = function() {}; |
Kevin Lubick | b9db390 | 2018-11-26 11:47:54 -0500 | [diff] [blame] | 921 | CanvasRenderingContext2D.prototype.rotate = function() {}; |
Kevin Lubick | 61ef7b2 | 2018-11-27 13:26:59 -0500 | [diff] [blame] | 922 | CanvasRenderingContext2D.prototype.save = function() {}; |
Kevin Lubick | b9db390 | 2018-11-26 11:47:54 -0500 | [diff] [blame] | 923 | CanvasRenderingContext2D.prototype.scale = function() {}; |
| 924 | CanvasRenderingContext2D.prototype.scrollPathIntoView = function() {}; |
Kevin Lubick | 12c0e50 | 2018-11-28 12:51:56 -0500 | [diff] [blame] | 925 | CanvasRenderingContext2D.prototype.setLineDash = function() {}; |
Kevin Lubick | b9db390 | 2018-11-26 11:47:54 -0500 | [diff] [blame] | 926 | CanvasRenderingContext2D.prototype.setTransform = function() {}; |
| 927 | CanvasRenderingContext2D.prototype.stroke = function() {}; |
Kevin Lubick | 12c0e50 | 2018-11-28 12:51:56 -0500 | [diff] [blame] | 928 | CanvasRenderingContext2D.prototype.strokeRect = function() {}; |
Kevin Lubick | b9db390 | 2018-11-26 11:47:54 -0500 | [diff] [blame] | 929 | CanvasRenderingContext2D.prototype.strokeText = function() {}; |
| 930 | CanvasRenderingContext2D.prototype.transform = function() {}; |
| 931 | CanvasRenderingContext2D.prototype.translate = function() {}; |
| 932 | |
Kevin Lubick | a40f832 | 2018-12-17 16:01:36 -0500 | [diff] [blame] | 933 | var Path2D = {}; |
| 934 | Path2D.prototype.addPath = function() {}; |
| 935 | Path2D.prototype.arc = function() {}; |
| 936 | Path2D.prototype.arcTo = function() {}; |
| 937 | Path2D.prototype.bezierCurveTo = function() {}; |
| 938 | Path2D.prototype.closePath = function() {}; |
| 939 | Path2D.prototype.ellipse = function() {}; |
| 940 | Path2D.prototype.lineTo = function() {}; |
| 941 | Path2D.prototype.moveTo = function() {}; |
| 942 | Path2D.prototype.quadraticCurveTo = function() {}; |
| 943 | Path2D.prototype.rect = function() {}; |
| 944 | |
Kevin Lubick | eb2f6b0 | 2018-11-29 15:07:02 -0500 | [diff] [blame] | 945 | var LinearCanvasGradient = {}; |
| 946 | LinearCanvasGradient.prototype.addColorStop = function() {}; |
| 947 | var RadialCanvasGradient = {}; |
| 948 | RadialCanvasGradient.prototype.addColorStop = function() {}; |
Kevin Lubick | d29edd7 | 2018-12-07 08:29:52 -0500 | [diff] [blame] | 949 | var CanvasPattern = {}; |
| 950 | CanvasPattern.prototype.setTransform = function() {}; |
Kevin Lubick | eb2f6b0 | 2018-11-29 15:07:02 -0500 | [diff] [blame] | 951 | |
Kevin Lubick | 52b9f37 | 2018-12-04 13:57:36 -0500 | [diff] [blame] | 952 | var ImageData = { |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 953 | /** |
| 954 | * @type {Uint8ClampedArray} |
| 955 | */ |
| 956 | data: {}, |
| 957 | height: {}, |
| 958 | width: {}, |
Kevin Lubick | 52b9f37 | 2018-12-04 13:57:36 -0500 | [diff] [blame] | 959 | }; |
| 960 | |
Kevin Lubick | d29edd7 | 2018-12-07 08:29:52 -0500 | [diff] [blame] | 961 | var DOMMatrix = { |
Nathaniel Nifong | 6066a0c | 2020-03-05 10:27:14 -0500 | [diff] [blame] | 962 | a: {}, |
| 963 | b: {}, |
| 964 | c: {}, |
| 965 | d: {}, |
| 966 | e: {}, |
| 967 | f: {}, |
Kevin Lubick | d29edd7 | 2018-12-07 08:29:52 -0500 | [diff] [blame] | 968 | }; |
| 969 | |
Kevin Lubick | 217056c | 2018-09-20 17:39:31 -0400 | [diff] [blame] | 970 | // 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] | 971 | function loadWebAssemblyModule() {}; |