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