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 25var CanvasKit = { 26 // public API (i.e. things we declare in the pre-js file or in the cpp bindings) 27 Color: function() {}, 28 Color4f: function() {}, 29 ColorAsInt: function() {}, 30 LTRBRect: function() {}, 31 XYWHRect: function() {}, 32 LTRBiRect: function() {}, 33 XYWHiRect: function() {}, 34 RRectXY: function() {}, 35 /** @return {ImageData} */ 36 ImageData: function() {}, 37 38 GetWebGLContext: function() {}, 39 MakeCanvas: function() {}, 40 MakeCanvasSurface: function() {}, 41 MakeGrContext: function() {}, 42 /** @return {CanvasKit.AnimatedImage} */ 43 MakeAnimatedImageFromEncoded: function() {}, 44 /** @return {CanvasKit.Image} */ 45 MakeImage: function() {}, 46 /** @return {CanvasKit.Image} */ 47 MakeImageFromEncoded: function() {}, 48 MakeImageFromCanvasImageSource: function() {}, 49 MakeOnScreenGLSurface: function() {}, 50 MakeRenderTarget: function() {}, 51 MakePicture: function() {}, 52 MakeSWCanvasSurface: function() {}, 53 MakeManagedAnimation: function() {}, 54 MakeParticles: function() {}, 55 MakeVertices: function() {}, 56 MakeSurface: function() {}, 57 MakeRasterDirectSurface: function() {}, 58 MakeWebGLCanvasSurface: function() {}, 59 Malloc: function() {}, 60 MallocGlyphIDs: function() {}, 61 MakeLazyImageFromTextureSource: function() {}, 62 Free: function() {}, 63 computeTonalColors: function() {}, 64 deleteContext: function() {}, 65 getColorComponents: function() {}, 66 getDecodeCacheLimitBytes: function() {}, 67 getDecodeCacheUsageBytes: function() {}, 68 multiplyByAlpha: function() {}, 69 parseColorString: function() {}, 70 setDecodeCacheLimitBytes: function() {}, 71 getShadowLocalBounds: function() {}, 72 // Defined by emscripten. 73 createContext: function() {}, 74 75 // private API (i.e. things declared in the bindings that we use 76 // in the pre-js file) 77 _MakeGrContext: function() {}, 78 _MakeImage: function() {}, 79 _MakeManagedAnimation: function() {}, 80 _MakeOnScreenGLSurface: function() {}, 81 _MakeParticles: function() {}, 82 _MakePicture: function() {}, 83 _MakeRenderTargetII: function() {}, 84 _MakeRenderTargetWH: function() {}, 85 _computeTonalColors: function() {}, 86 _decodeAnimatedImage: function() {}, 87 _decodeImage: function() {}, 88 _getShadowLocalBounds: function() {}, 89 _setTextureCleanup: function() {}, 90 91 // The testing object is meant to expose internal functions 92 // for more fine-grained testing, e.g. parseColor 93 _testing: {}, 94 95 // Objects and properties on CanvasKit 96 97 Animation: { 98 prototype: { 99 render: function() {}, 100 size: function() {}, 101 }, 102 _render: function() {}, 103 _size: function() {}, 104 }, 105 106 GrContext: { 107 // public API (from C++ bindings) 108 getResourceCacheLimitBytes: function() {}, 109 getResourceCacheUsageBytes: function() {}, 110 releaseResourcesAndAbandonContext: function() {}, 111 setResourceCacheLimitBytes: function() {}, 112 }, 113 114 ManagedAnimation: { 115 prototype: { 116 render: function() {}, 117 seek: function() {}, 118 seekFrame: function() {}, 119 setColor: function() {}, 120 size: function() {}, 121 }, 122 _render: function() {}, 123 _seek: function() {}, 124 _seekFrame: function() {}, 125 _size: function() {}, 126 }, 127 128 Paragraph: { 129 // public API (from C++ bindings) 130 didExceedMaxLines: function() {}, 131 getAlphabeticBaseline: function() {}, 132 getGlyphPositionAtCoordinate: function() {}, 133 getHeight: function() {}, 134 getIdeographicBaseline: function() {}, 135 getLineMetrics: function() {}, 136 getLongestLine: function() {}, 137 getMaxIntrinsicWidth: function() {}, 138 getMaxWidth: function() {}, 139 getMinIntrinsicWidth: function() {}, 140 getWordBoundary: function() {}, 141 getShapedLines: function() {}, 142 layout: function() {}, 143 144 // private API 145 /** @return {Float32Array} */ 146 _getRectsForRange: function() {}, 147 _getRectsForPlaceholders: function() {}, 148 }, 149 150 ParagraphBuilder: { 151 Make: function() {}, 152 MakeFromFontProvider: function() {}, 153 ShapeText: function() {}, 154 addText: function() {}, 155 build: function() {}, 156 pop: function() {}, 157 reset: function() {}, 158 159 prototype: { 160 pushStyle: function() {}, 161 pushPaintStyle: function() {}, 162 addPlaceholder: function() {}, 163 }, 164 165 // private API 166 _Make: function() {}, 167 _MakeFromFontProvider: function() {}, 168 _ShapeText: function() {}, 169 _pushStyle: function() {}, 170 _pushPaintStyle: function() {}, 171 _addPlaceholder: function() {}, 172 }, 173 174 RuntimeEffect: { 175 // public API (from JS bindings) 176 Make: function() {}, 177 getUniform: function() {}, 178 getUniformCount: function() {}, 179 getUniformFloatCount: function() {}, 180 getUniformName: function() {}, 181 prototype: { 182 makeShader: function() {}, 183 makeShaderWithChildren: function() {}, 184 }, 185 // private API (from C++ bindings) 186 _Make: function() {}, 187 _makeShader: function() {}, 188 _makeShaderWithChildren: function() {}, 189 }, 190 191 ParagraphStyle: function() {}, 192 193 AnimatedImage: { 194 // public API (from C++ bindings) 195 decodeNextFrame: function() {}, 196 getFrameCount: function() {}, 197 getRepetitionCount: function() {}, 198 height: function() {}, 199 makeImageAtCurrentFrame: function() {}, 200 reset: function() {}, 201 width: function() {}, 202 }, 203 204 Canvas: { 205 // public API (from C++ bindings) 206 clipPath: function() {}, 207 getSaveCount: function() {}, 208 makeSurface: function() {}, 209 restore: function() {}, 210 restoreToCount: function() {}, 211 rotate: function() {}, 212 save: function() {}, 213 saveLayerPaint: function() {}, 214 scale: function() {}, 215 skew: function() {}, 216 translate: function() {}, 217 218 prototype: { 219 clear: function() {}, 220 clipRRect: function() {}, 221 clipRect: function() {}, 222 concat: function() {}, 223 drawArc: function() {}, 224 drawAtlas: function() {}, 225 drawCircle: function() {}, 226 drawColor: function() {}, 227 drawColorComponents: function() {}, 228 drawColorInt: function() {}, 229 drawDRRect: function() {}, 230 drawGlyphs: function() {}, 231 drawImage: function() {}, 232 drawImageCubic: function() {}, 233 drawImageNine: function() {}, 234 drawImageOptions: function() {}, 235 drawImageRect: function() {}, 236 drawImageRectCubic: function() {}, 237 drawImageRectOptions: function() {}, 238 drawLine: function() {}, 239 drawOval: function() {}, 240 drawPaint: function() {}, 241 drawParagraph: function() {}, 242 drawPatch: function() {}, 243 drawPath: function() {}, 244 drawPicture: function() {}, 245 drawPoints: function() {}, 246 drawRRect: function() {}, 247 drawRect4f: function() {}, 248 drawRect: function() {}, 249 drawShadow: function() {}, 250 drawText: function() {}, 251 drawTextBlob: function() {}, 252 drawVertices: function() {}, 253 getLocalToDevice: function() {}, 254 getTotalMatrix: function() {}, 255 readPixels: function() {}, 256 saveLayer: function() {}, 257 writePixels : function() {}, 258 }, 259 260 // private API 261 _clear: function() {}, 262 _clipRRect: function() {}, 263 _clipRect: function() {}, 264 _concat: function() {}, 265 _drawArc: function() {}, 266 _drawAtlasCubic: function() {}, 267 _drawAtlasOptions: function() {}, 268 _drawCircle: function() {}, 269 _drawColor: function() {}, 270 _drawColorInt: function() {}, 271 _drawDRRect: function() {}, 272 _drawGlyphs: function() {}, 273 _drawImage: function() {}, 274 _drawImageCubic: function() {}, 275 _drawImageNine: function() {}, 276 _drawImageOptions: function() {}, 277 _drawImageRect: function() {}, 278 _drawImageRectCubic: function() {}, 279 _drawImageRectOptions: function() {}, 280 _drawLine: function() {}, 281 _drawOval: function() {}, 282 _drawPaint: function() {}, 283 _drawParagraph: function() {}, 284 _drawPatch: function() {}, 285 _drawPath: function() {}, 286 _drawPicture: function() {}, 287 _drawPoints: function() {}, 288 _drawRRect: function() {}, 289 _drawRect4f: function() {}, 290 _drawRect: function() {}, 291 _drawShadow: function() {}, 292 _drawSimpleText: function() {}, 293 _drawTextBlob: function() {}, 294 _drawVertices: function() {}, 295 _getLocalToDevice: function() {}, 296 _getTotalMatrix: function() {}, 297 _readPixels: function() {}, 298 _saveLayer: function() {}, 299 _writePixels: function() {}, 300 delete: function() {}, 301 }, 302 303 ColorFilter: { 304 // public API (from C++ bindings and JS interface) 305 MakeBlend: function() {}, 306 MakeCompose: function() {}, 307 MakeLerp: function() {}, 308 MakeLinearToSRGBGamma: function() {}, 309 MakeMatrix: function() {}, 310 MakeSRGBToLinearGamma: function() {}, 311 // private API (from C++ bindings) 312 _MakeBlend: function() {}, 313 _makeMatrix: function() {}, 314 }, 315 316 ColorMatrix: { 317 concat: function() {}, 318 identity: function() {}, 319 postTranslate: function() {}, 320 rotated: function() {}, 321 scaled: function() {}, 322 }, 323 324 ColorSpace: { 325 Equals: function() {}, 326 SRGB: {}, 327 DISPLAY_P3: {}, 328 ADOBE_RGB: {}, 329 // private API (from C++ bindings) 330 _MakeSRGB: function() {}, 331 _MakeDisplayP3: function() {}, 332 _MakeAdobeRGB: function() {}, 333 }, 334 335 ContourMeasureIter: { 336 next: function() {}, 337 }, 338 339 ContourMeasure: { 340 getSegment: function() {}, 341 isClosed: function() {}, 342 length: function() {}, 343 prototype: { 344 getPosTan: function() {}, 345 }, 346 _getPosTan: function() {}, 347 }, 348 349 Font: { 350 // public API (from C++ bindings) 351 getMetrics: function() {}, 352 getScaleX: function() {}, 353 getSize: function() {}, 354 getSkewX: function() {}, 355 isEmbolden: function() {}, 356 getTypeface: function() {}, 357 setHinting: function() {}, 358 setLinearMetrics: function() {}, 359 setScaleX: function() {}, 360 setSize: function() {}, 361 setSkewX: function() {}, 362 setEmbolden: function() {}, 363 setSubpixel: function() {}, 364 setTypeface: function() {}, 365 366 prototype: { 367 getGlyphBounds: function() {}, 368 getGlyphIDs: function() {}, 369 getGlyphWidths: function() {}, 370 getGlyphIntercepts: function() {}, 371 }, 372 373 // private API (from C++ bindings) 374 _getGlyphIDs: function() {}, 375 _getGlyphIntercepts: function() {}, 376 _getGlyphWidthBounds: function() {}, 377 }, 378 379 FontMgr: { 380 // public API (from C++ and JS bindings) 381 FromData: function() {}, 382 countFamilies: function() {}, 383 getFamilyName: function() {}, 384 385 // private API 386 _makeTypefaceFromData: function() {}, 387 _fromData: function() {}, 388 }, 389 390 TypefaceFontProvider: { 391 // public API (from C++ and JS bindings) 392 Make: function() {}, 393 registerFont: function() {}, 394 395 // private API 396 _registerFont: function() {}, 397 }, 398 399 Image: { 400 // public API (from C++ bindings) 401 encodeToBytes: function() {}, 402 getColorSpace: function() {}, 403 getImageInfo: function() {}, 404 makeCopyWithDefaultMipmaps: function() {}, 405 height: function() {}, 406 width: function() {}, 407 408 prototype: { 409 makeShaderCubic: function() {}, 410 makeShaderOptions: function() {}, 411 }, 412 // private API 413 _makeShaderCubic: function() {}, 414 _makeShaderOptions: function() {}, 415 _makeFromGenerator: function() {}, 416 }, 417 418 ImageFilter: { 419 MakeBlur: function() {}, 420 MakeColorFilter: function() {}, 421 MakeCompose: function() {}, 422 MakeMatrixTransform: function() {}, 423 424 // private API 425 _MakeMatrixTransformCubic: function() {}, 426 _MakeMatrixTransformOptions: function() {}, 427 }, 428 429 // These are defined in interface.js 430 M44: { 431 identity: function() {}, 432 invert: function() {}, 433 mustInvert: function() {}, 434 multiply: function() {}, 435 rotatedUnitSinCos: function() {}, 436 rotated: function() {}, 437 scaled: function() {}, 438 translated: function() {}, 439 lookat: function() {}, 440 perspective: function() {}, 441 rc: function() {}, 442 transpose: function() {}, 443 setupCamera: function() {}, 444 }, 445 446 Matrix: { 447 identity: function() {}, 448 invert: function() {}, 449 mapPoints: function() {}, 450 multiply: function() {}, 451 rotated: function() {}, 452 scaled: function() {}, 453 skewed: function() {}, 454 translated: function() {}, 455 }, 456 457 MaskFilter: { 458 MakeBlur: function() {}, 459 }, 460 461 MipmapMode: { 462 None: {}, 463 Nearest: {}, 464 Linear: {}, 465 }, 466 467 Paint: { 468 // public API (from C++ bindings) 469 /** @return {CanvasKit.Paint} */ 470 copy: function() {}, 471 getStrokeCap: function() {}, 472 getStrokeJoin: function() {}, 473 getStrokeMiter: function() {}, 474 getStrokeWidth: function() {}, 475 setAntiAlias: function() {}, 476 setBlendMode: function() {}, 477 setColorInt: function() {}, 478 setImageFilter: function() {}, 479 setMaskFilter: function() {}, 480 setPathEffect: function() {}, 481 setShader: function() {}, 482 setStrokeCap: function() {}, 483 setStrokeJoin: function() {}, 484 setStrokeMiter: function() {}, 485 setStrokeWidth: function() {}, 486 setStyle: function() {}, 487 488 prototype: { 489 getColor: function() {}, 490 setColor: function() {}, 491 setColorComponents: function() {}, 492 setColorInt: function() {}, 493 }, 494 495 // Private API 496 delete: function() {}, 497 _getColor: function() {}, 498 _setColor: function() {}, 499 }, 500 501 PathEffect: { 502 MakeCorner: function() {}, 503 MakeDash: function() {}, 504 MakeDiscrete: function() {}, 505 MakePath1D: function() {}, 506 MakeLine2D: function() {}, 507 MakePath2D: function() {}, 508 509 // Private C++ API 510 _MakeDash: function() {}, 511 _MakeLine2D: function() {}, 512 _MakePath2D: function() {}, 513 }, 514 515 ParticleEffect: { 516 // public API (from C++ bindings) 517 draw: function() {}, 518 getUniform: function() {}, 519 getUniformCount: function() {}, 520 getUniformFloatCount: function() {}, 521 getUniformName: function() {}, 522 setRate: function() {}, 523 start: function() {}, 524 update: function() {}, 525 526 prototype: { 527 setPosition: function() {}, 528 uniforms: function() {}, 529 }, 530 531 // private API (from C++ bindings) 532 _uniformPtr: function() {}, 533 _setPosition: function() {}, 534 }, 535 536 Path: { 537 // public API (from C++ and JS bindings) 538 MakeFromCmds: function() {}, 539 MakeFromSVGString: function() {}, 540 MakeFromOp: function() {}, 541 MakeFromVerbsPointsWeights: function() {}, 542 contains: function() {}, 543 /** @return {CanvasKit.Path} */ 544 copy: function() {}, 545 countPoints: function() {}, 546 equals: function() {}, 547 getFillType: function() {}, 548 isEmpty: function() {}, 549 isVolatile: function() {}, 550 makeAsWinding: function() {}, 551 reset: function() {}, 552 rewind: function() {}, 553 setFillType: function() {}, 554 setIsVolatile: function() {}, 555 toCmds: function() {}, 556 toSVGString: function() {}, 557 558 prototype: { 559 addArc: function() {}, 560 addOval: function() {}, 561 addPath: function() {}, 562 addPoly: function() {}, 563 addRect: function() {}, 564 addRRect: function() {}, 565 addVerbsPointsWeights: function() {}, 566 arc: function() {}, 567 arcToOval: function() {}, 568 arcToRotated: function() {}, 569 arcToTangent: function() {}, 570 close: function() {}, 571 conicTo: function() {}, 572 computeTightBounds: function() {}, 573 cubicTo: function() {}, 574 dash: function() {}, 575 getBounds: function() {}, 576 getPoint: function() {}, 577 lineTo: function() {}, 578 moveTo: function() {}, 579 offset: function() {}, 580 op: function() {}, 581 quadTo: function() {}, 582 rArcTo: function() {}, 583 rConicTo: function() {}, 584 rCubicTo: function() {}, 585 rLineTo: function() {}, 586 rMoveTo: function() {}, 587 rQuadTo: function() {}, 588 simplify: function() {}, 589 stroke: function() {}, 590 transform: function() {}, 591 trim: function() {}, 592 }, 593 594 // private API 595 _MakeFromCmds: function() {}, 596 _MakeFromVerbsPointsWeights: function() {}, 597 _addArc: function() {}, 598 _addOval: function() {}, 599 _addPath: function() {}, 600 _addPoly: function() {}, 601 _addRect: function() {}, 602 _addRRect: function() {}, 603 _addVerbsPointsWeights: function() {}, 604 _arcToOval: function() {}, 605 _arcToRotated: function() {}, 606 _arcToTangent: function() {}, 607 _close: function() {}, 608 _conicTo: function() {}, 609 _computeTightBounds: function() {}, 610 _cubicTo: function() {}, 611 _dash: function() {}, 612 _getBounds: function() {}, 613 _getPoint: function() {}, 614 _lineTo: function() {}, 615 _moveTo: function() {}, 616 _op: function() {}, 617 _quadTo: function() {}, 618 _rArcTo: function() {}, 619 _rConicTo: function() {}, 620 _rCubicTo: function() {}, 621 _rect: function() {}, 622 _rLineTo: function() {}, 623 _rMoveTo: function() {}, 624 _rQuadTo: function() {}, 625 _simplify: function() {}, 626 _stroke: function() {}, 627 _transform: function() {}, 628 _trim: function() {}, 629 delete: function() {}, 630 dump: function() {}, 631 dumpHex: function() {}, 632 }, 633 634 Picture: { 635 serialize: function() {}, 636 prototype: { 637 makeShader: function() {}, 638 }, 639 _makeShader: function() {}, 640 }, 641 642 PictureRecorder: { 643 finishRecordingAsPicture: function() {}, 644 prototype: { 645 beginRecording: function() {}, 646 }, 647 _beginRecording: function() {}, 648 }, 649 650 Shader: { 651 // Deprecated names 652 Blend: function() {}, 653 Color: function() {}, 654 Lerp: function() {}, 655 // public API (from JS / C++ bindings) 656 MakeBlend: function() {}, 657 MakeColor: function() {}, 658 MakeFractalNoise: function() {}, 659 MakeLinearGradient: function() {}, 660 MakeRadialGradient: function() {}, 661 MakeSweepGradient: function() {}, 662 MakeTurbulence: function() {}, 663 MakeTwoPointConicalGradient: function() {}, 664 665 // private API (from C++ bindings) 666 _MakeColor: function() {}, 667 _MakeLinearGradient: function() {}, 668 _MakeRadialGradient: function() {}, 669 _MakeSweepGradient: function() {}, 670 _MakeTwoPointConicalGradient: function() {}, 671 }, 672 673 Surface: { 674 // public API (from C++ bindings) 675 imageInfo: function() {}, 676 677 sampleCnt: function() {}, 678 reportBackendTypeIsGPU: function() {}, 679 680 prototype: { 681 getCanvas: function() {}, 682 makeImageFromTexture: function() {}, 683 makeImageFromTextureSource: function() {}, 684 /** @return {CanvasKit.Image} */ 685 makeImageSnapshot: function() {}, 686 makeSurface: function() {}, 687 updateTextureFromSource: function() {}, 688 }, 689 690 // private API 691 _flush: function() {}, 692 _getCanvas: function() {}, 693 _makeImageFromTexture: function() {}, 694 _makeImageSnapshot: function() {}, 695 _makeSurface: function() {}, 696 _makeRasterDirect: function() {}, 697 _resetContext: function() {}, 698 delete: function() {}, 699 }, 700 701 TextBlob: { 702 // public API (both C++ and JS bindings) 703 MakeFromGlyphs: function() {}, 704 MakeFromRSXform: function() {}, 705 MakeFromRSXformGlyphs: function() {}, 706 MakeFromText: function() {}, 707 MakeOnPath: function() {}, 708 // private API (from C++ bindings) 709 _MakeFromGlyphs: function() {}, 710 _MakeFromRSXform: function() {}, 711 _MakeFromRSXformGlyphs: function() {}, 712 _MakeFromText: function() {}, 713 }, 714 715 Typeface: { 716 MakeFreeTypeFaceFromData: function() {}, 717 prototype: { 718 getGlyphIDs: function() {}, 719 }, 720 _MakeFreeTypeFaceFromData: function() {}, 721 _getGlyphIDs: function() {}, 722 }, 723 724 // These are defined in interface.js 725 Vector: { 726 add: function() {}, 727 sub: function() {}, 728 dot: function() {}, 729 cross: function() {}, 730 normalize: function() {}, 731 mulScalar: function() {}, 732 length: function() {}, 733 lengthSquared: function() {}, 734 dist: function() {}, 735 }, 736 737 Vertices: { 738 // public API (from C++ bindings) 739 uniqueID: function() {}, 740 741 prototype: { 742 bounds: function() {}, 743 }, 744 // private API (from C++ bindings) 745 746 _bounds: function() {}, 747 }, 748 749 _VerticesBuilder: { 750 colors: function() {}, 751 detach: function() {}, 752 indices: function() {}, 753 positions: function() {}, 754 texCoords: function() {}, 755 }, 756 757 TextStyle: function() {}, 758 759 // Constants and Enums 760 gpu: {}, 761 skottie: {}, 762 763 TRANSPARENT: {}, 764 BLACK: {}, 765 WHITE: {}, 766 RED: {}, 767 GREEN: {}, 768 BLUE: {}, 769 YELLOW: {}, 770 CYAN: {}, 771 MAGENTA: {}, 772 773 MOVE_VERB: {}, 774 LINE_VERB: {}, 775 QUAD_VERB: {}, 776 CONIC_VERB: {}, 777 CUBIC_VERB: {}, 778 CLOSE_VERB: {}, 779 780 NoDecoration: {}, 781 UnderlineDecoration: {}, 782 OverlineDecoration: {}, 783 LineThroughDecoration: {}, 784 785 SaveLayerInitWithPrevious: {}, 786 SaveLayerF16ColorType: {}, 787 788 Affinity: { 789 Upstream: {}, 790 Downstream: {}, 791 }, 792 793 AlphaType: { 794 Opaque: {}, 795 Premul: {}, 796 Unpremul: {}, 797 }, 798 799 BlendMode: { 800 Clear: {}, 801 Src: {}, 802 Dst: {}, 803 SrcOver: {}, 804 DstOver: {}, 805 SrcIn: {}, 806 DstIn: {}, 807 SrcOut: {}, 808 DstOut: {}, 809 SrcATop: {}, 810 DstATop: {}, 811 Xor: {}, 812 Plus: {}, 813 Modulate: {}, 814 Screen: {}, 815 Overlay: {}, 816 Darken: {}, 817 Lighten: {}, 818 ColorDodge: {}, 819 ColorBurn: {}, 820 HardLight: {}, 821 SoftLight: {}, 822 Difference: {}, 823 Exclusion: {}, 824 Multiply: {}, 825 Hue: {}, 826 Saturation: {}, 827 Color: {}, 828 Luminosity: {}, 829 }, 830 831 BlurStyle: { 832 Normal: {}, 833 Solid: {}, 834 Outer: {}, 835 Inner: {}, 836 }, 837 838 ClipOp: { 839 Difference: {}, 840 Intersect: {}, 841 }, 842 843 ColorType: { 844 Alpha_8: {}, 845 RGB_565: {}, 846 ARGB_4444: {}, 847 RGBA_8888: {}, 848 RGB_888x: {}, 849 BGRA_8888: {}, 850 RGBA_1010102: {}, 851 RGB_101010x: {}, 852 Gray_8: {}, 853 RGBA_F16: {}, 854 RGBA_F32: {}, 855 }, 856 857 FillType: { 858 Winding: {}, 859 EvenOdd: {}, 860 }, 861 862 FilterMode: { 863 Linear: {}, 864 Nearest: {}, 865 }, 866 867 FontSlant: { 868 Upright: {}, 869 Italic: {}, 870 Oblique: {}, 871 }, 872 873 FontHinting: { 874 None: {}, 875 Slight: {}, 876 Normal: {}, 877 Full: {}, 878 }, 879 880 FontWeight: { 881 Invisible: {}, 882 Thin: {}, 883 ExtraLight: {}, 884 Light: {}, 885 Normal: {}, 886 Medium: {}, 887 SemiBold: {}, 888 Bold: {}, 889 ExtraBold: {}, 890 Black: {}, 891 ExtraBlack: {}, 892 }, 893 894 FontWidth: { 895 UltraCondensed: {}, 896 ExtraCondensed: {}, 897 Condensed: {}, 898 SemiCondensed: {}, 899 Normal: {}, 900 SemiExpanded: {}, 901 Expanded: {}, 902 ExtraExpanded: {}, 903 UltraExpanded: {}, 904 }, 905 906 GlyphRunFlags: { 907 IsWhiteSpace: {}, 908 }, 909 910 ImageFormat: { 911 PNG: {}, 912 JPEG: {}, 913 }, 914 915 PaintStyle: { 916 Fill: {}, 917 Stroke: {}, 918 }, 919 920 PathOp: { 921 Difference: {}, 922 Intersect: {}, 923 Union: {}, 924 XOR: {}, 925 ReverseDifference: {}, 926 }, 927 928 PointMode: { 929 Points: {}, 930 Lines: {}, 931 Polygon: {}, 932 }, 933 934 RectHeightStyle: { 935 Tight: {}, 936 Max: {}, 937 IncludeLineSpacingMiddle: {}, 938 IncludeLineSpacingTop: {}, 939 IncludeLineSpacingBottom: {}, 940 Strut: {}, 941 }, 942 943 RectWidthStyle: { 944 Tight: {}, 945 Max: {}, 946 }, 947 948 StrokeCap: { 949 Butt: {}, 950 Round: {}, 951 Square: {}, 952 }, 953 954 StrokeJoin: { 955 Miter: {}, 956 Round: {}, 957 Bevel: {}, 958 }, 959 960 TextAlign: { 961 Left: {}, 962 Right: {}, 963 Center: {}, 964 Justify: {}, 965 Start: {}, 966 End: {}, 967 }, 968 969 TextDirection: { 970 LTR: {}, 971 RTL: {}, 972 }, 973 974 TextHeightBehavior: { 975 All: {}, 976 DisableFirstAscent: {}, 977 DisableLastDescent: {}, 978 DisableAll: {}, 979 }, 980 981 DecorationStyle: { 982 Solid: {}, 983 Double: {}, 984 Dotted: {}, 985 Dashed: {}, 986 Wavy: {}, 987 }, 988 989 PlaceholderAlignment: { 990 Baseline: {}, 991 AboveBaseline: {}, 992 BelowBaseline: {}, 993 Top: {}, 994 Bottom: {}, 995 Middle: {}, 996 }, 997 998 TextBaseline: { 999 Alphabetic: {}, 1000 Ideographic: {}, 1001 }, 1002 1003 TileMode: { 1004 Clamp: {}, 1005 Repeat: {}, 1006 Mirror: {}, 1007 Decal: {}, 1008 }, 1009 1010 VertexMode: { 1011 Triangles: {}, 1012 TrianglesStrip: {}, 1013 TriangleFan: {}, 1014 }, 1015 1016 // Things Enscriptem adds for us 1017 1018 /** 1019 * @type {Float32Array} 1020 */ 1021 HEAPF32: {}, 1022 /** 1023 * @type {Float64Array} 1024 */ 1025 HEAPF64: {}, 1026 /** 1027 * @type {Uint8Array} 1028 */ 1029 HEAPU8: {}, 1030 /** 1031 * @type {Uint16Array} 1032 */ 1033 HEAPU16: {}, 1034 /** 1035 * @type {Uint32Array} 1036 */ 1037 HEAPU32: {}, 1038 /** 1039 * @type {Int8Array} 1040 */ 1041 HEAP8: {}, 1042 /** 1043 * @type {Int16Array} 1044 */ 1045 HEAP16: {}, 1046 /** 1047 * @type {Int32Array} 1048 */ 1049 HEAP32: {}, 1050 1051 _malloc: function() {}, 1052 _free: function() {}, 1053 onRuntimeInitialized: function() {}, 1054}; 1055 1056// Public API things that are newly declared in the JS should go here. 1057// It's not enough to declare them above, because closure can still erase them 1058// unless they go on the prototype. 1059CanvasKit.Paragraph.prototype.getRectsForRange = function() {}; 1060CanvasKit.Paragraph.prototype.getRectsForPlaceholders = function() {}; 1061 1062CanvasKit.Surface.prototype.dispose = function() {}; 1063CanvasKit.Surface.prototype.flush = function() {}; 1064CanvasKit.Surface.prototype.requestAnimationFrame = function() {}; 1065CanvasKit.Surface.prototype.drawOnce = function() {}; 1066 1067CanvasKit.RuntimeEffect.prototype.makeShader = function() {}; 1068CanvasKit.RuntimeEffect.prototype.makeShaderWithChildren = function() {}; 1069 1070// Define StrokeOpts object 1071var StrokeOpts = {}; 1072StrokeOpts.prototype.width; 1073StrokeOpts.prototype.miter_limit; 1074StrokeOpts.prototype.cap; 1075StrokeOpts.prototype.join; 1076StrokeOpts.prototype.precision; 1077 1078// Define everything created in the canvas2d spec here 1079var HTMLCanvas = {}; 1080HTMLCanvas.prototype.decodeImage = function() {}; 1081HTMLCanvas.prototype.dispose = function() {}; 1082HTMLCanvas.prototype.getContext = function() {}; 1083HTMLCanvas.prototype.loadFont = function() {}; 1084HTMLCanvas.prototype.makePath2D = function() {}; 1085HTMLCanvas.prototype.toDataURL = function() {}; 1086 1087var ImageBitmapRenderingContext = {}; 1088ImageBitmapRenderingContext.prototype.transferFromImageBitmap = function() {}; 1089 1090var CanvasRenderingContext2D = {}; 1091CanvasRenderingContext2D.prototype.addHitRegion = function() {}; 1092CanvasRenderingContext2D.prototype.arc = function() {}; 1093CanvasRenderingContext2D.prototype.arcTo = function() {}; 1094CanvasRenderingContext2D.prototype.beginPath = function() {}; 1095CanvasRenderingContext2D.prototype.bezierCurveTo = function() {}; 1096CanvasRenderingContext2D.prototype.clearHitRegions = function() {}; 1097CanvasRenderingContext2D.prototype.clearRect = function() {}; 1098CanvasRenderingContext2D.prototype.clip = function() {}; 1099CanvasRenderingContext2D.prototype.closePath = function() {}; 1100CanvasRenderingContext2D.prototype.createImageData = function() {}; 1101CanvasRenderingContext2D.prototype.createLinearGradient = function() {}; 1102CanvasRenderingContext2D.prototype.createPattern = function() {}; 1103CanvasRenderingContext2D.prototype.createRadialGradient = function() {}; 1104CanvasRenderingContext2D.prototype.drawFocusIfNeeded = function() {}; 1105CanvasRenderingContext2D.prototype.drawImage = function() {}; 1106CanvasRenderingContext2D.prototype.ellipse = function() {}; 1107CanvasRenderingContext2D.prototype.fill = function() {}; 1108CanvasRenderingContext2D.prototype.fillRect = function() {}; 1109CanvasRenderingContext2D.prototype.fillText = function() {}; 1110CanvasRenderingContext2D.prototype.getImageData = function() {}; 1111CanvasRenderingContext2D.prototype.getLineDash = function() {}; 1112CanvasRenderingContext2D.prototype.isPointInPath = function() {}; 1113CanvasRenderingContext2D.prototype.isPointInStroke = function() {}; 1114CanvasRenderingContext2D.prototype.lineTo = function() {}; 1115CanvasRenderingContext2D.prototype.measureText = function() {}; 1116CanvasRenderingContext2D.prototype.moveTo = function() {}; 1117CanvasRenderingContext2D.prototype.putImageData = function() {}; 1118CanvasRenderingContext2D.prototype.quadraticCurveTo = function() {}; 1119CanvasRenderingContext2D.prototype.rect = function() {}; 1120CanvasRenderingContext2D.prototype.removeHitRegion = function() {}; 1121CanvasRenderingContext2D.prototype.resetTransform = function() {}; 1122CanvasRenderingContext2D.prototype.restore = function() {}; 1123CanvasRenderingContext2D.prototype.rotate = function() {}; 1124CanvasRenderingContext2D.prototype.save = function() {}; 1125CanvasRenderingContext2D.prototype.scale = function() {}; 1126CanvasRenderingContext2D.prototype.scrollPathIntoView = function() {}; 1127CanvasRenderingContext2D.prototype.setLineDash = function() {}; 1128CanvasRenderingContext2D.prototype.setTransform = function() {}; 1129CanvasRenderingContext2D.prototype.stroke = function() {}; 1130CanvasRenderingContext2D.prototype.strokeRect = function() {}; 1131CanvasRenderingContext2D.prototype.strokeText = function() {}; 1132CanvasRenderingContext2D.prototype.transform = function() {}; 1133CanvasRenderingContext2D.prototype.translate = function() {}; 1134 1135var Path2D = {}; 1136Path2D.prototype.addPath = function() {}; 1137Path2D.prototype.arc = function() {}; 1138Path2D.prototype.arcTo = function() {}; 1139Path2D.prototype.bezierCurveTo = function() {}; 1140Path2D.prototype.closePath = function() {}; 1141Path2D.prototype.ellipse = function() {}; 1142Path2D.prototype.lineTo = function() {}; 1143Path2D.prototype.moveTo = function() {}; 1144Path2D.prototype.quadraticCurveTo = function() {}; 1145Path2D.prototype.rect = function() {}; 1146 1147var LinearCanvasGradient = {}; 1148LinearCanvasGradient.prototype.addColorStop = function() {}; 1149var RadialCanvasGradient = {}; 1150RadialCanvasGradient.prototype.addColorStop = function() {}; 1151var CanvasPattern = {}; 1152CanvasPattern.prototype.setTransform = function() {}; 1153 1154var ImageData = { 1155 /** 1156 * @type {Uint8ClampedArray} 1157 */ 1158 data: {}, 1159 height: {}, 1160 width: {}, 1161}; 1162 1163var DOMMatrix = { 1164 a: {}, 1165 b: {}, 1166 c: {}, 1167 d: {}, 1168 e: {}, 1169 f: {}, 1170}; 1171 1172// Not sure why this is needed - might be a bug in emsdk that this isn't properly declared. 1173function loadWebAssemblyModule() {}; 1174 1175// This is a part of emscripten's webgl glue code. Preserving this attribute is necessary 1176// to override it in the puppeteer tests 1177var LibraryEGL = { 1178 contextAttributes: { 1179 majorVersion: {} 1180 } 1181} 1182