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