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