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