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 | 61ef7b2 | 2018-11-27 13:26:59 -0500 | [diff] [blame] | 30 | MakeBlurMaskFilter: function() {}, |
Kevin Lubick | 006a6f3 | 2018-10-19 14:34:34 -0400 | [diff] [blame] | 31 | MakeCanvas: function() {}, |
| 32 | MakeCanvasSurface: function() {}, |
Kevin Lubick | b5ae3b5 | 2018-11-03 07:51:19 -0400 | [diff] [blame] | 33 | MakeImageShader: function() {}, |
Kevin Lubick | eb2f6b0 | 2018-11-29 15:07:02 -0500 | [diff] [blame^] | 34 | /** @return {LinearCanvasGradient} */ |
Kevin Lubick | b5ae3b5 | 2018-11-03 07:51:19 -0400 | [diff] [blame] | 35 | MakeLinearGradientShader: function() {}, |
Kevin Lubick | 134be1d | 2018-10-30 15:05:04 -0400 | [diff] [blame] | 36 | MakeNimaActor: function() {}, |
Kevin Lubick | 61ef7b2 | 2018-11-27 13:26:59 -0500 | [diff] [blame] | 37 | MakeRadialGradientShader: function() {}, |
| 38 | MakeSWCanvasSurface: function() {}, |
Kevin Lubick | 006a6f3 | 2018-10-19 14:34:34 -0400 | [diff] [blame] | 39 | MakeSkDashPathEffect: function() {}, |
Kevin Lubick | b5ae3b5 | 2018-11-03 07:51:19 -0400 | [diff] [blame] | 40 | MakeSkVertices: function() {}, |
Kevin Lubick | 006a6f3 | 2018-10-19 14:34:34 -0400 | [diff] [blame] | 41 | MakeSurface: function() {}, |
Kevin Lubick | eb2f6b0 | 2018-11-29 15:07:02 -0500 | [diff] [blame^] | 42 | /** @return {RadialCanvasGradient} */ |
| 43 | MakeTwoPointConicalGradientShader: function() {}, |
Kevin Lubick | 61ef7b2 | 2018-11-27 13:26:59 -0500 | [diff] [blame] | 44 | MakeWebGLCanvasSurface: function() {}, |
Kevin Lubick | 217056c | 2018-09-20 17:39:31 -0400 | [diff] [blame] | 45 | currentContext: function() {}, |
Kevin Lubick | 61ef7b2 | 2018-11-27 13:26:59 -0500 | [diff] [blame] | 46 | getColorComponents: function() {}, |
Kevin Lubick | 12c0e50 | 2018-11-28 12:51:56 -0500 | [diff] [blame] | 47 | getSkDataBytes: function() {}, |
Kevin Lubick | 006a6f3 | 2018-10-19 14:34:34 -0400 | [diff] [blame] | 48 | initFonts: function() {}, |
Kevin Lubick | 12c0e50 | 2018-11-28 12:51:56 -0500 | [diff] [blame] | 49 | multiplyByAlpha: function() {}, |
Kevin Lubick | 006a6f3 | 2018-10-19 14:34:34 -0400 | [diff] [blame] | 50 | setCurrentContext: function() {}, |
Kevin Lubick | 217056c | 2018-09-20 17:39:31 -0400 | [diff] [blame] | 51 | |
| 52 | // private API (i.e. things declared in the bindings that we use |
| 53 | // in the pre-js file) |
Kevin Lubick | b5ae3b5 | 2018-11-03 07:51:19 -0400 | [diff] [blame] | 54 | _MakeImageShader: function() {}, |
| 55 | _MakeLinearGradientShader: function() {}, |
Kevin Lubick | 134be1d | 2018-10-30 15:05:04 -0400 | [diff] [blame] | 56 | _MakeNimaActor: function() {}, |
Kevin Lubick | b5ae3b5 | 2018-11-03 07:51:19 -0400 | [diff] [blame] | 57 | _MakeRadialGradientShader: function() {}, |
Kevin Lubick | 006a6f3 | 2018-10-19 14:34:34 -0400 | [diff] [blame] | 58 | _MakeSkDashPathEffect: function() {}, |
Kevin Lubick | b5ae3b5 | 2018-11-03 07:51:19 -0400 | [diff] [blame] | 59 | _MakeSkVertices: function() {}, |
Kevin Lubick | eb2f6b0 | 2018-11-29 15:07:02 -0500 | [diff] [blame^] | 60 | _MakeTwoPointConicalGradientShader: function() {}, |
Kevin Lubick | 134be1d | 2018-10-30 15:05:04 -0400 | [diff] [blame] | 61 | _getRasterN32PremulSurface: function() {}, |
| 62 | _getWebGLSurface: function() {}, |
Kevin Lubick | 217056c | 2018-09-20 17:39:31 -0400 | [diff] [blame] | 63 | |
Kevin Lubick | 1a05fce | 2018-11-20 12:51:16 -0500 | [diff] [blame] | 64 | // The testing object is meant to expose internal functions |
| 65 | // for more fine-grained testing, e.g. parseColor |
| 66 | _testing: {}, |
| 67 | |
Kevin Lubick | 217056c | 2018-09-20 17:39:31 -0400 | [diff] [blame] | 68 | // Objects and properties on CanvasKit |
| 69 | |
Kevin Lubick | 134be1d | 2018-10-30 15:05:04 -0400 | [diff] [blame] | 70 | NimaActor: { |
| 71 | // public API (from C++ bindings) |
| 72 | duration: function() {}, |
| 73 | getAnimationNames: function() {}, |
| 74 | render: function() {}, |
| 75 | seek: function() {}, |
| 76 | setAnimationByIndex: function() {}, |
| 77 | setAnimationByName: function() {}, |
| 78 | |
| 79 | // private API |
| 80 | }, |
| 81 | |
Kevin Lubick | 006a6f3 | 2018-10-19 14:34:34 -0400 | [diff] [blame] | 82 | SkCanvas: { |
| 83 | // public API (from C++ bindings) |
| 84 | clear: function() {}, |
Kevin Lubick | eb2f6b0 | 2018-11-29 15:07:02 -0500 | [diff] [blame^] | 85 | clipPath: function() {}, |
Kevin Lubick | 006a6f3 | 2018-10-19 14:34:34 -0400 | [diff] [blame] | 86 | drawPaint: function() {}, |
| 87 | drawPath: function() {}, |
Kevin Lubick | 12c0e50 | 2018-11-28 12:51:56 -0500 | [diff] [blame] | 88 | drawRect: function() {}, |
Kevin Lubick | 61ef7b2 | 2018-11-27 13:26:59 -0500 | [diff] [blame] | 89 | drawShadow: function() {}, |
Kevin Lubick | 12c0e50 | 2018-11-28 12:51:56 -0500 | [diff] [blame] | 90 | drawText: function() {}, |
| 91 | drawVertices: function() {}, |
Kevin Lubick | 006a6f3 | 2018-10-19 14:34:34 -0400 | [diff] [blame] | 92 | flush: function() {}, |
Kevin Lubick | eb2f6b0 | 2018-11-29 15:07:02 -0500 | [diff] [blame^] | 93 | restore: function() {}, |
Kevin Lubick | 006a6f3 | 2018-10-19 14:34:34 -0400 | [diff] [blame] | 94 | rotate: function() {}, |
| 95 | save: function() {}, |
| 96 | scale: function() {}, |
| 97 | setMatrix: function() {}, |
| 98 | skew: function() {}, |
| 99 | translate: function() {}, |
| 100 | |
| 101 | // private API |
| 102 | delete: function() {}, |
| 103 | }, |
| 104 | |
| 105 | SkImage: { |
Alexander Khovansky | 3e11933 | 2018-11-15 02:01:19 +0300 | [diff] [blame] | 106 | // private API |
| 107 | _encodeToData: function() {}, |
| 108 | _encodeToDataWithFormat: function() {}, |
Kevin Lubick | 006a6f3 | 2018-10-19 14:34:34 -0400 | [diff] [blame] | 109 | }, |
| 110 | |
Kevin Lubick | 1a05fce | 2018-11-20 12:51:16 -0500 | [diff] [blame] | 111 | SkMatrix: { |
Kevin Lubick | b9db390 | 2018-11-26 11:47:54 -0500 | [diff] [blame] | 112 | identity: function() {}, |
| 113 | mapPoints: function() {}, |
| 114 | multiply: function() {}, |
Kevin Lubick | 1a05fce | 2018-11-20 12:51:16 -0500 | [diff] [blame] | 115 | rotated: function() {}, |
Kevin Lubick | b9db390 | 2018-11-26 11:47:54 -0500 | [diff] [blame] | 116 | scaled: function() {}, |
| 117 | skewed: function() {}, |
| 118 | translated: function() {}, |
| 119 | }, |
| 120 | |
| 121 | SkPaint: { |
| 122 | // public API (from C++ bindings) |
| 123 | /** @return {CanvasKit.SkPaint} */ |
| 124 | copy: function() {}, |
Kevin Lubick | 12c0e50 | 2018-11-28 12:51:56 -0500 | [diff] [blame] | 125 | getBlendMode: function() {}, |
Kevin Lubick | 61ef7b2 | 2018-11-27 13:26:59 -0500 | [diff] [blame] | 126 | getColor: function() {}, |
Kevin Lubick | b9db390 | 2018-11-26 11:47:54 -0500 | [diff] [blame] | 127 | getStrokeCap: function() {}, |
| 128 | getStrokeJoin: function() {}, |
| 129 | getStrokeMiter: function() {}, |
| 130 | getStrokeWidth: function() {}, |
| 131 | getTextSize: function() {}, |
| 132 | measureText: function() {}, |
| 133 | setAntiAlias: function() {}, |
Kevin Lubick | 12c0e50 | 2018-11-28 12:51:56 -0500 | [diff] [blame] | 134 | setBlendMode: function() {}, |
Kevin Lubick | b9db390 | 2018-11-26 11:47:54 -0500 | [diff] [blame] | 135 | setColor: function() {}, |
Kevin Lubick | 61ef7b2 | 2018-11-27 13:26:59 -0500 | [diff] [blame] | 136 | setMaskFilter: function() {}, |
Kevin Lubick | b9db390 | 2018-11-26 11:47:54 -0500 | [diff] [blame] | 137 | setPathEffect: function() {}, |
| 138 | setShader: function() {}, |
| 139 | setStrokeCap: function() {}, |
| 140 | setStrokeJoin: function() {}, |
| 141 | setStrokeMiter: function() {}, |
| 142 | setStrokeWidth: function() {}, |
| 143 | setStyle: function() {}, |
| 144 | setTextSize: function() {}, |
| 145 | |
| 146 | //private API |
| 147 | delete: function() {}, |
Kevin Lubick | 1a05fce | 2018-11-20 12:51:16 -0500 | [diff] [blame] | 148 | }, |
| 149 | |
Kevin Lubick | 006a6f3 | 2018-10-19 14:34:34 -0400 | [diff] [blame] | 150 | SkPath: { |
| 151 | // public API (from C++ bindings) |
Kevin Lubick | b9db390 | 2018-11-26 11:47:54 -0500 | [diff] [blame] | 152 | computeTightBounds: function() {}, |
| 153 | /** @return {CanvasKit.SkPath} */ |
| 154 | copy: function() {}, |
| 155 | countPoints: function() {}, |
| 156 | equals: function() {}, |
| 157 | getBounds: function() {}, |
| 158 | getFillType: function() {}, |
| 159 | getPoint: function() {}, |
| 160 | setFillType: function() {}, |
| 161 | toSVGString: function() {}, |
Kevin Lubick | 006a6f3 | 2018-10-19 14:34:34 -0400 | [diff] [blame] | 162 | |
| 163 | // private API |
Kevin Lubick | 1a05fce | 2018-11-20 12:51:16 -0500 | [diff] [blame] | 164 | _addArc: function() {}, |
Kevin Lubick | 006a6f3 | 2018-10-19 14:34:34 -0400 | [diff] [blame] | 165 | _addPath: function() {}, |
Kevin Lubick | 1a05fce | 2018-11-20 12:51:16 -0500 | [diff] [blame] | 166 | _addRect: function() {}, |
Alexander Khovansky | 3e11933 | 2018-11-15 02:01:19 +0300 | [diff] [blame] | 167 | _arc: function() {}, |
Kevin Lubick | 006a6f3 | 2018-10-19 14:34:34 -0400 | [diff] [blame] | 168 | _arcTo: function() {}, |
| 169 | _close: function() {}, |
| 170 | _conicTo: function() {}, |
| 171 | _cubicTo: function() {}, |
Kevin Lubick | b5ae3b5 | 2018-11-03 07:51:19 -0400 | [diff] [blame] | 172 | _dash: function() {}, |
Kevin Lubick | 006a6f3 | 2018-10-19 14:34:34 -0400 | [diff] [blame] | 173 | _lineTo: function() {}, |
| 174 | _moveTo: function() {}, |
| 175 | _op: function() {}, |
| 176 | _quadTo: function() {}, |
| 177 | _rect: function() {}, |
| 178 | _simplify: function() {}, |
Kevin Lubick | b5ae3b5 | 2018-11-03 07:51:19 -0400 | [diff] [blame] | 179 | _stroke: function() {}, |
Kevin Lubick | 006a6f3 | 2018-10-19 14:34:34 -0400 | [diff] [blame] | 180 | _transform: function() {}, |
Kevin Lubick | b5ae3b5 | 2018-11-03 07:51:19 -0400 | [diff] [blame] | 181 | _trim: function() {}, |
Kevin Lubick | 006a6f3 | 2018-10-19 14:34:34 -0400 | [diff] [blame] | 182 | delete: function() {}, |
Kevin Lubick | b9db390 | 2018-11-26 11:47:54 -0500 | [diff] [blame] | 183 | dump: function() {}, |
| 184 | dumpHex: function() {}, |
Kevin Lubick | 006a6f3 | 2018-10-19 14:34:34 -0400 | [diff] [blame] | 185 | }, |
| 186 | |
| 187 | SkRect: { |
| 188 | fLeft: {}, |
| 189 | fTop: {}, |
| 190 | fRight: {}, |
| 191 | fBottom: {}, |
| 192 | }, |
| 193 | |
| 194 | SkSurface: { |
| 195 | // public API (from C++ bindings) |
| 196 | /** @return {CanvasKit.SkCanvas} */ |
| 197 | getCanvas: function() {}, |
| 198 | /** @return {CanvasKit.SkImage} */ |
| 199 | makeImageSnapshot: function() {}, |
| 200 | |
| 201 | // private API |
| 202 | _flush: function() {}, |
| 203 | _getRasterN32PremulSurface: function() {}, |
| 204 | _readPixels: function() {}, |
| 205 | delete: function() {}, |
| 206 | }, |
| 207 | |
Kevin Lubick | b5ae3b5 | 2018-11-03 07:51:19 -0400 | [diff] [blame] | 208 | SkVertices: { |
| 209 | // public API (from C++ bindings) |
Kevin Lubick | 12c0e50 | 2018-11-28 12:51:56 -0500 | [diff] [blame] | 210 | bounds: function() {}, |
| 211 | mode: function() {}, |
| 212 | uniqueID: function() {}, |
| 213 | vertexCount: function() {}, |
Kevin Lubick | b5ae3b5 | 2018-11-03 07:51:19 -0400 | [diff] [blame] | 214 | |
| 215 | // private API |
| 216 | /** @return {CanvasKit.SkVertices} */ |
| 217 | _applyBones: function() {}, |
| 218 | }, |
| 219 | |
Kevin Lubick | 006a6f3 | 2018-10-19 14:34:34 -0400 | [diff] [blame] | 220 | // Constants and Enums |
| 221 | gpu: {}, |
| 222 | skottie: {}, |
Kevin Lubick | 006a6f3 | 2018-10-19 14:34:34 -0400 | [diff] [blame] | 223 | |
Kevin Lubick | 61ef7b2 | 2018-11-27 13:26:59 -0500 | [diff] [blame] | 224 | TRANSPARENT: {}, |
| 225 | RED: {}, |
| 226 | BLUE: {}, |
| 227 | YELLOW: {}, |
| 228 | CYAN: {}, |
| 229 | BLACK: {}, |
| 230 | |
| 231 | BlendMode: { |
| 232 | Clear: {}, |
| 233 | Src: {}, |
| 234 | Dst: {}, |
| 235 | SrcOver: {}, |
| 236 | DstOver: {}, |
| 237 | SrcIn: {}, |
| 238 | DstIn: {}, |
| 239 | SrcOut: {}, |
| 240 | DstOut: {}, |
| 241 | SrcATop: {}, |
| 242 | DstATop: {}, |
| 243 | Xor: {}, |
| 244 | Plus: {}, |
| 245 | Modulate: {}, |
| 246 | Screen: {}, |
| 247 | Overlay: {}, |
| 248 | Darken: {}, |
| 249 | Lighten: {}, |
| 250 | ColorDodge: {}, |
| 251 | ColorBurn: {}, |
| 252 | HardLight: {}, |
| 253 | SoftLight: {}, |
| 254 | Difference: {}, |
| 255 | Exclusion: {}, |
| 256 | Multiply: {}, |
| 257 | Hue: {}, |
| 258 | Saturation: {}, |
| 259 | Color: {}, |
| 260 | Luminosity: {}, |
| 261 | }, |
| 262 | |
| 263 | BlurStyle: { |
| 264 | Normal: {}, |
| 265 | Solid: {}, |
| 266 | Outer: {}, |
| 267 | Inner: {}, |
| 268 | }, |
| 269 | |
Kevin Lubick | eb2f6b0 | 2018-11-29 15:07:02 -0500 | [diff] [blame^] | 270 | ClipOp: { |
| 271 | Difference: {}, |
| 272 | Intersect: {}, |
| 273 | }, |
| 274 | |
Kevin Lubick | 006a6f3 | 2018-10-19 14:34:34 -0400 | [diff] [blame] | 275 | FillType: { |
Kevin Lubick | 1a05fce | 2018-11-20 12:51:16 -0500 | [diff] [blame] | 276 | Winding: {}, |
| 277 | EvenOdd: {}, |
| 278 | InverseWinding: {}, |
| 279 | InverseEvenOdd: {}, |
Kevin Lubick | 006a6f3 | 2018-10-19 14:34:34 -0400 | [diff] [blame] | 280 | }, |
| 281 | |
Alexander Khovansky | 3e11933 | 2018-11-15 02:01:19 +0300 | [diff] [blame] | 282 | ImageFormat: { |
| 283 | PNG: {}, |
| 284 | JPEG: {}, |
| 285 | }, |
| 286 | |
Kevin Lubick | b9db390 | 2018-11-26 11:47:54 -0500 | [diff] [blame] | 287 | PaintStyle: { |
| 288 | Fill: {}, |
| 289 | Stroke: {}, |
| 290 | StrokeAndFill: {}, |
| 291 | }, |
| 292 | |
Kevin Lubick | eb2f6b0 | 2018-11-29 15:07:02 -0500 | [diff] [blame^] | 293 | PathOp: { |
| 294 | Difference: {}, |
| 295 | Intersect: {}, |
| 296 | Union: {}, |
| 297 | XOR: {}, |
| 298 | ReverseDifference: {}, |
| 299 | }, |
| 300 | |
Kevin Lubick | b9db390 | 2018-11-26 11:47:54 -0500 | [diff] [blame] | 301 | StrokeCap: { |
| 302 | Butt: {}, |
| 303 | Round: {}, |
| 304 | Square: {}, |
| 305 | }, |
| 306 | |
| 307 | StrokeJoin: { |
| 308 | Miter: {}, |
| 309 | Round: {}, |
| 310 | Bevel: {}, |
| 311 | }, |
| 312 | |
Kevin Lubick | eb2f6b0 | 2018-11-29 15:07:02 -0500 | [diff] [blame^] | 313 | TileMode: { |
| 314 | Clamp: {}, |
| 315 | Repeat: {}, |
| 316 | Mirror: {}, |
| 317 | }, |
| 318 | |
| 319 | VertexMode: { |
| 320 | Triangles: {}, |
| 321 | TrianglesStrip: {}, |
| 322 | TriangleFan: {}, |
| 323 | }, |
| 324 | |
Kevin Lubick | 006a6f3 | 2018-10-19 14:34:34 -0400 | [diff] [blame] | 325 | // Things Enscriptem adds for us |
| 326 | |
Kevin Lubick | 53965c9 | 2018-10-11 08:51:55 -0400 | [diff] [blame] | 327 | /** Represents the heap of the WASM code |
| 328 | * @type {ArrayBuffer} |
| 329 | */ |
| 330 | buffer: {}, |
| 331 | /** |
| 332 | * @type {Float32Array} |
| 333 | */ |
Kevin Lubick | b5ae3b5 | 2018-11-03 07:51:19 -0400 | [diff] [blame] | 334 | HEAPF32: {}, |
Kevin Lubick | 53965c9 | 2018-10-11 08:51:55 -0400 | [diff] [blame] | 335 | /** |
| 336 | * @type {Uint8Array} |
| 337 | */ |
| 338 | HEAPU8: {}, |
Kevin Lubick | b5ae3b5 | 2018-11-03 07:51:19 -0400 | [diff] [blame] | 339 | /** |
| 340 | * @type {Uint16Array} |
| 341 | */ |
| 342 | HEAPU16: {}, |
| 343 | /** |
| 344 | * @type {Int32Array} |
| 345 | */ |
| 346 | HEAP32: {}, |
Kevin Lubick | 53965c9 | 2018-10-11 08:51:55 -0400 | [diff] [blame] | 347 | |
Kevin Lubick | 006a6f3 | 2018-10-19 14:34:34 -0400 | [diff] [blame] | 348 | _malloc: function() {}, |
| 349 | _free: function() {}, |
| 350 | onRuntimeInitialized: function() {}, |
| 351 | }; |
Kevin Lubick | 217056c | 2018-09-20 17:39:31 -0400 | [diff] [blame] | 352 | |
Kevin Lubick | 006a6f3 | 2018-10-19 14:34:34 -0400 | [diff] [blame] | 353 | // Public API things that are newly declared in the JS should go here. |
| 354 | // It's not enough to declare them above, because closure can still erase them |
| 355 | // unless they go on the prototype. |
Kevin Lubick | 1a05fce | 2018-11-20 12:51:16 -0500 | [diff] [blame] | 356 | CanvasKit.SkPath.prototype.addArc = function() {}; |
Kevin Lubick | 217056c | 2018-09-20 17:39:31 -0400 | [diff] [blame] | 357 | CanvasKit.SkPath.prototype.addPath = function() {}; |
Kevin Lubick | 1a05fce | 2018-11-20 12:51:16 -0500 | [diff] [blame] | 358 | CanvasKit.SkPath.prototype.addRect = function() {}; |
Alexander Khovansky | 3e11933 | 2018-11-15 02:01:19 +0300 | [diff] [blame] | 359 | CanvasKit.SkPath.prototype.arc = function() {}; |
Kevin Lubick | 006a6f3 | 2018-10-19 14:34:34 -0400 | [diff] [blame] | 360 | CanvasKit.SkPath.prototype.arcTo = function() {}; |
Kevin Lubick | 217056c | 2018-09-20 17:39:31 -0400 | [diff] [blame] | 361 | CanvasKit.SkPath.prototype.close = function() {}; |
Kevin Lubick | 006a6f3 | 2018-10-19 14:34:34 -0400 | [diff] [blame] | 362 | CanvasKit.SkPath.prototype.conicTo = function() {}; |
| 363 | CanvasKit.SkPath.prototype.cubicTo = function() {}; |
Kevin Lubick | b5ae3b5 | 2018-11-03 07:51:19 -0400 | [diff] [blame] | 364 | CanvasKit.SkPath.prototype.dash = function() {}; |
Kevin Lubick | 006a6f3 | 2018-10-19 14:34:34 -0400 | [diff] [blame] | 365 | CanvasKit.SkPath.prototype.lineTo = function() {}; |
| 366 | CanvasKit.SkPath.prototype.moveTo = function() {}; |
| 367 | CanvasKit.SkPath.prototype.op = function() {}; |
| 368 | CanvasKit.SkPath.prototype.quadTo = function() {}; |
| 369 | CanvasKit.SkPath.prototype.rect = function() {}; |
Kevin Lubick | 217056c | 2018-09-20 17:39:31 -0400 | [diff] [blame] | 370 | CanvasKit.SkPath.prototype.simplify = function() {}; |
Kevin Lubick | b5ae3b5 | 2018-11-03 07:51:19 -0400 | [diff] [blame] | 371 | CanvasKit.SkPath.prototype.stroke = function() {}; |
Kevin Lubick | 217056c | 2018-09-20 17:39:31 -0400 | [diff] [blame] | 372 | CanvasKit.SkPath.prototype.transform = function() {}; |
Kevin Lubick | b5ae3b5 | 2018-11-03 07:51:19 -0400 | [diff] [blame] | 373 | CanvasKit.SkPath.prototype.trim = function() {}; |
Kevin Lubick | 217056c | 2018-09-20 17:39:31 -0400 | [diff] [blame] | 374 | |
Kevin Lubick | 53965c9 | 2018-10-11 08:51:55 -0400 | [diff] [blame] | 375 | CanvasKit.SkSurface.prototype.flush = function() {}; |
Kevin Lubick | 5b90b84 | 2018-10-17 07:57:18 -0400 | [diff] [blame] | 376 | CanvasKit.SkSurface.prototype.dispose = function() {}; |
Kevin Lubick | 53965c9 | 2018-10-11 08:51:55 -0400 | [diff] [blame] | 377 | |
Kevin Lubick | 12c0e50 | 2018-11-28 12:51:56 -0500 | [diff] [blame] | 378 | /** @return {CanvasKit.SkVertices} */ |
Kevin Lubick | b5ae3b5 | 2018-11-03 07:51:19 -0400 | [diff] [blame] | 379 | CanvasKit.SkVertices.prototype.applyBones = function() {}; |
| 380 | |
Alexander Khovansky | 3e11933 | 2018-11-15 02:01:19 +0300 | [diff] [blame] | 381 | CanvasKit.SkImage.prototype.encodeToData = function() {}; |
| 382 | |
Kevin Lubick | b5ae3b5 | 2018-11-03 07:51:19 -0400 | [diff] [blame] | 383 | // Define StrokeOpts object |
| 384 | var StrokeOpts = {}; |
| 385 | StrokeOpts.prototype.width; |
| 386 | StrokeOpts.prototype.miter_limit; |
| 387 | StrokeOpts.prototype.cap; |
| 388 | StrokeOpts.prototype.join; |
| 389 | |
Kevin Lubick | eb2f6b0 | 2018-11-29 15:07:02 -0500 | [diff] [blame^] | 390 | // Define everything created in the canvas2d spec here |
Kevin Lubick | b9db390 | 2018-11-26 11:47:54 -0500 | [diff] [blame] | 391 | var HTMLCanvas = {}; |
| 392 | HTMLCanvas.prototype.getContext = function() {}; |
| 393 | HTMLCanvas.prototype.toDataURL = function() {}; |
| 394 | HTMLCanvas.prototype.dispose = function() {}; |
| 395 | |
| 396 | var CanvasRenderingContext2D = {}; |
| 397 | CanvasRenderingContext2D.prototype.addHitRegion = function() {}; |
| 398 | CanvasRenderingContext2D.prototype.arc = function() {}; |
| 399 | CanvasRenderingContext2D.prototype.arcTo = function() {}; |
| 400 | CanvasRenderingContext2D.prototype.beginPath = function() {}; |
| 401 | CanvasRenderingContext2D.prototype.bezierCurveTo = function() {}; |
| 402 | CanvasRenderingContext2D.prototype.clearHitRegions = function() {}; |
Kevin Lubick | 12c0e50 | 2018-11-28 12:51:56 -0500 | [diff] [blame] | 403 | CanvasRenderingContext2D.prototype.clearRect = function() {}; |
Kevin Lubick | eb2f6b0 | 2018-11-29 15:07:02 -0500 | [diff] [blame^] | 404 | CanvasRenderingContext2D.prototype.clip = function() {}; |
Kevin Lubick | b9db390 | 2018-11-26 11:47:54 -0500 | [diff] [blame] | 405 | CanvasRenderingContext2D.prototype.closePath = function() {}; |
Kevin Lubick | eb2f6b0 | 2018-11-29 15:07:02 -0500 | [diff] [blame^] | 406 | CanvasRenderingContext2D.prototype.createLinearGradient = function() {}; |
| 407 | CanvasRenderingContext2D.prototype.createRadialGradient = function() {}; |
Kevin Lubick | b9db390 | 2018-11-26 11:47:54 -0500 | [diff] [blame] | 408 | CanvasRenderingContext2D.prototype.drawFocusIfNeeded = function() {}; |
| 409 | CanvasRenderingContext2D.prototype.ellipse = function() {}; |
Kevin Lubick | 61ef7b2 | 2018-11-27 13:26:59 -0500 | [diff] [blame] | 410 | CanvasRenderingContext2D.prototype.fill = function() {}; |
Kevin Lubick | 12c0e50 | 2018-11-28 12:51:56 -0500 | [diff] [blame] | 411 | CanvasRenderingContext2D.prototype.fillRect = function() {}; |
Kevin Lubick | b9db390 | 2018-11-26 11:47:54 -0500 | [diff] [blame] | 412 | CanvasRenderingContext2D.prototype.fillText = function() {}; |
Kevin Lubick | 12c0e50 | 2018-11-28 12:51:56 -0500 | [diff] [blame] | 413 | CanvasRenderingContext2D.prototype.getLineDash = function() {}; |
Kevin Lubick | b9db390 | 2018-11-26 11:47:54 -0500 | [diff] [blame] | 414 | CanvasRenderingContext2D.prototype.lineTo = function() {}; |
| 415 | CanvasRenderingContext2D.prototype.measureText = function() {}; |
| 416 | CanvasRenderingContext2D.prototype.moveTo = function() {}; |
| 417 | CanvasRenderingContext2D.prototype.quadraticCurveTo = function() {}; |
| 418 | CanvasRenderingContext2D.prototype.rect = function() {}; |
| 419 | CanvasRenderingContext2D.prototype.removeHitRegion = function() {}; |
| 420 | CanvasRenderingContext2D.prototype.resetTransform = function() {}; |
Kevin Lubick | 61ef7b2 | 2018-11-27 13:26:59 -0500 | [diff] [blame] | 421 | CanvasRenderingContext2D.prototype.restore = function() {}; |
Kevin Lubick | b9db390 | 2018-11-26 11:47:54 -0500 | [diff] [blame] | 422 | CanvasRenderingContext2D.prototype.rotate = function() {}; |
Kevin Lubick | 61ef7b2 | 2018-11-27 13:26:59 -0500 | [diff] [blame] | 423 | CanvasRenderingContext2D.prototype.save = function() {}; |
Kevin Lubick | b9db390 | 2018-11-26 11:47:54 -0500 | [diff] [blame] | 424 | CanvasRenderingContext2D.prototype.scale = function() {}; |
| 425 | CanvasRenderingContext2D.prototype.scrollPathIntoView = function() {}; |
Kevin Lubick | 12c0e50 | 2018-11-28 12:51:56 -0500 | [diff] [blame] | 426 | CanvasRenderingContext2D.prototype.setLineDash = function() {}; |
Kevin Lubick | b9db390 | 2018-11-26 11:47:54 -0500 | [diff] [blame] | 427 | CanvasRenderingContext2D.prototype.setTransform = function() {}; |
| 428 | CanvasRenderingContext2D.prototype.stroke = function() {}; |
Kevin Lubick | 12c0e50 | 2018-11-28 12:51:56 -0500 | [diff] [blame] | 429 | CanvasRenderingContext2D.prototype.strokeRect = function() {}; |
Kevin Lubick | b9db390 | 2018-11-26 11:47:54 -0500 | [diff] [blame] | 430 | CanvasRenderingContext2D.prototype.strokeText = function() {}; |
| 431 | CanvasRenderingContext2D.prototype.transform = function() {}; |
| 432 | CanvasRenderingContext2D.prototype.translate = function() {}; |
| 433 | |
Kevin Lubick | eb2f6b0 | 2018-11-29 15:07:02 -0500 | [diff] [blame^] | 434 | var LinearCanvasGradient = {}; |
| 435 | LinearCanvasGradient.prototype.addColorStop = function() {}; |
| 436 | var RadialCanvasGradient = {}; |
| 437 | RadialCanvasGradient.prototype.addColorStop = function() {}; |
| 438 | |
Kevin Lubick | 217056c | 2018-09-20 17:39:31 -0400 | [diff] [blame] | 439 | // 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] | 440 | function loadWebAssemblyModule() {}; |
Kevin Lubick | 12c0e50 | 2018-11-28 12:51:56 -0500 | [diff] [blame] | 441 | |
| 442 | var DOMMatrix = {}; |