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