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