@shopify/react-native-skia 1.11.4 → 1.11.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (136) hide show
  1. package/android/CMakeLists.txt +0 -1
  2. package/cpp/api/JsiSkParagraph.h +1 -3
  3. package/cpp/api/recorder/Convertor.h +57 -9
  4. package/cpp/api/recorder/Drawings.h +11 -36
  5. package/cpp/jsi/ViewProperty.h +1 -3
  6. package/lib/commonjs/animation/functions/interpolateColors.d.ts +1 -1
  7. package/lib/commonjs/dom/nodes/datatypes/Gradient.d.ts +2 -2
  8. package/lib/commonjs/dom/types/NodeType.js +8 -0
  9. package/lib/commonjs/dom/types/NodeType.js.map +1 -1
  10. package/lib/commonjs/external/reanimated/buffers.d.ts +1 -1
  11. package/lib/commonjs/renderer/__tests__/setup.d.ts +1 -1
  12. package/lib/commonjs/skia/types/Image/ColorType.js +20 -2
  13. package/lib/commonjs/skia/types/Image/ColorType.js.map +1 -1
  14. package/lib/commonjs/skia/types/Image/ColorType.web.js +18 -2
  15. package/lib/commonjs/skia/types/Image/ColorType.web.js.map +1 -1
  16. package/lib/commonjs/skia/types/ImageFilter/ImageFilter.js +14 -0
  17. package/lib/commonjs/skia/types/ImageFilter/ImageFilter.js.map +1 -1
  18. package/lib/commonjs/skia/types/MaskFilter.js +5 -2
  19. package/lib/commonjs/skia/types/MaskFilter.js.map +1 -1
  20. package/lib/commonjs/skia/types/Paint/BlendMode.js +31 -2
  21. package/lib/commonjs/skia/types/Paint/BlendMode.js.map +1 -1
  22. package/lib/commonjs/skia/types/Paragraph/ParagraphBuilder.js +14 -0
  23. package/lib/commonjs/skia/types/Paragraph/ParagraphBuilder.js.map +1 -1
  24. package/lib/commonjs/skia/types/Path/Path.js +4 -0
  25. package/lib/commonjs/skia/types/Path/Path.js.map +1 -1
  26. package/lib/commonjs/skia/web/JsiSkCanvas.d.ts +1 -1
  27. package/lib/commonjs/skia/web/JsiSkImage.d.ts +2 -2
  28. package/lib/commonjs/skia/web/JsiSkPaint.d.ts +1 -1
  29. package/lib/commonjs/skia/web/JsiSkPicture.d.ts +1 -1
  30. package/lib/commonjs/skia/web/JsiSkPoint.d.ts +1 -1
  31. package/lib/commonjs/skia/web/JsiSkRRect.d.ts +1 -1
  32. package/lib/commonjs/skia/web/JsiSkRSXform.d.ts +1 -1
  33. package/lib/commonjs/skia/web/JsiSkRect.d.ts +1 -1
  34. package/lib/commonjs/sksg/Container.d.ts +1 -0
  35. package/lib/commonjs/sksg/Container.js +8 -9
  36. package/lib/commonjs/sksg/Container.js.map +1 -1
  37. package/lib/commonjs/sksg/Recorder/Core.js +2 -0
  38. package/lib/commonjs/sksg/Recorder/Core.js.map +1 -1
  39. package/lib/commonjs/specs/NativeSkiaModule.web.d.ts +6 -0
  40. package/lib/commonjs/specs/NativeSkiaModule.web.js +33 -0
  41. package/lib/commonjs/specs/NativeSkiaModule.web.js.map +1 -1
  42. package/lib/commonjs/specs/SkiaPictureViewNativeComponent.web.d.ts +9 -0
  43. package/lib/commonjs/specs/SkiaPictureViewNativeComponent.web.js +32 -0
  44. package/lib/commonjs/specs/SkiaPictureViewNativeComponent.web.js.map +1 -0
  45. package/lib/commonjs/views/types.d.ts +1 -0
  46. package/lib/commonjs/views/types.js.map +1 -1
  47. package/lib/commonjs/web/LoadSkiaWeb.js +1 -2
  48. package/lib/commonjs/web/LoadSkiaWeb.js.map +1 -1
  49. package/lib/module/animation/functions/interpolateColors.d.ts +1 -1
  50. package/lib/module/dom/nodes/datatypes/Gradient.d.ts +2 -2
  51. package/lib/module/dom/types/NodeType.js +8 -0
  52. package/lib/module/dom/types/NodeType.js.map +1 -1
  53. package/lib/module/external/reanimated/buffers.d.ts +1 -1
  54. package/lib/module/renderer/__tests__/setup.d.ts +1 -1
  55. package/lib/module/skia/types/Image/ColorType.js +20 -2
  56. package/lib/module/skia/types/Image/ColorType.js.map +1 -1
  57. package/lib/module/skia/types/Image/ColorType.web.js +18 -2
  58. package/lib/module/skia/types/Image/ColorType.web.js.map +1 -1
  59. package/lib/module/skia/types/ImageFilter/ImageFilter.js +14 -0
  60. package/lib/module/skia/types/ImageFilter/ImageFilter.js.map +1 -1
  61. package/lib/module/skia/types/MaskFilter.js +5 -2
  62. package/lib/module/skia/types/MaskFilter.js.map +1 -1
  63. package/lib/module/skia/types/Paint/BlendMode.js +31 -2
  64. package/lib/module/skia/types/Paint/BlendMode.js.map +1 -1
  65. package/lib/module/skia/types/Paragraph/ParagraphBuilder.js +14 -0
  66. package/lib/module/skia/types/Paragraph/ParagraphBuilder.js.map +1 -1
  67. package/lib/module/skia/types/Path/Path.js +4 -0
  68. package/lib/module/skia/types/Path/Path.js.map +1 -1
  69. package/lib/module/skia/web/JsiSkCanvas.d.ts +1 -1
  70. package/lib/module/skia/web/JsiSkImage.d.ts +2 -2
  71. package/lib/module/skia/web/JsiSkPaint.d.ts +1 -1
  72. package/lib/module/skia/web/JsiSkPicture.d.ts +1 -1
  73. package/lib/module/skia/web/JsiSkPoint.d.ts +1 -1
  74. package/lib/module/skia/web/JsiSkRRect.d.ts +1 -1
  75. package/lib/module/skia/web/JsiSkRSXform.d.ts +1 -1
  76. package/lib/module/skia/web/JsiSkRect.d.ts +1 -1
  77. package/lib/module/sksg/Container.d.ts +1 -0
  78. package/lib/module/sksg/Container.js +8 -9
  79. package/lib/module/sksg/Container.js.map +1 -1
  80. package/lib/module/sksg/Recorder/Core.js +2 -0
  81. package/lib/module/sksg/Recorder/Core.js.map +1 -1
  82. package/lib/module/specs/NativeSkiaModule.web.d.ts +6 -0
  83. package/lib/module/specs/NativeSkiaModule.web.js +30 -1
  84. package/lib/module/specs/NativeSkiaModule.web.js.map +1 -1
  85. package/lib/module/specs/SkiaPictureViewNativeComponent.web.d.ts +9 -0
  86. package/lib/module/specs/SkiaPictureViewNativeComponent.web.js +26 -0
  87. package/lib/module/specs/SkiaPictureViewNativeComponent.web.js.map +1 -0
  88. package/lib/module/views/types.d.ts +1 -0
  89. package/lib/module/views/types.js.map +1 -1
  90. package/lib/typescript/lib/commonjs/animation/functions/interpolateColors.d.ts +1 -1
  91. package/lib/typescript/lib/commonjs/renderer/components/image/ImageShader.d.ts +1 -1
  92. package/lib/typescript/lib/commonjs/skia/web/JsiSkColor.d.ts +1 -1
  93. package/lib/typescript/lib/commonjs/skia/web/JsiSkia.d.ts +1 -1
  94. package/lib/typescript/lib/commonjs/specs/NativeSkiaModule.web.d.ts +1 -0
  95. package/lib/typescript/lib/commonjs/specs/SkiaPictureViewNativeComponent.web.d.ts +10 -0
  96. package/lib/typescript/lib/module/animation/functions/interpolateColors.d.ts +1 -1
  97. package/lib/typescript/lib/module/mock/index.d.ts +2 -2
  98. package/lib/typescript/lib/module/renderer/components/image/ImageShader.d.ts +1 -1
  99. package/lib/typescript/lib/module/skia/Skia.web.d.ts +1 -1
  100. package/lib/typescript/lib/module/skia/web/JsiSkColor.d.ts +1 -1
  101. package/lib/typescript/lib/module/skia/web/JsiSkia.d.ts +1 -1
  102. package/lib/typescript/lib/module/specs/NativeSkiaModule.web.d.ts +1 -0
  103. package/lib/typescript/lib/module/specs/SkiaPictureViewNativeComponent.web.d.ts +9 -0
  104. package/lib/typescript/src/animation/functions/interpolateColors.d.ts +1 -1
  105. package/lib/typescript/src/dom/nodes/datatypes/Gradient.d.ts +2 -2
  106. package/lib/typescript/src/external/reanimated/buffers.d.ts +1 -1
  107. package/lib/typescript/src/renderer/__tests__/setup.d.ts +1 -1
  108. package/lib/typescript/src/skia/web/JsiSkCanvas.d.ts +1 -1
  109. package/lib/typescript/src/skia/web/JsiSkImage.d.ts +2 -2
  110. package/lib/typescript/src/skia/web/JsiSkPaint.d.ts +1 -1
  111. package/lib/typescript/src/skia/web/JsiSkPicture.d.ts +1 -1
  112. package/lib/typescript/src/skia/web/JsiSkPoint.d.ts +1 -1
  113. package/lib/typescript/src/skia/web/JsiSkRRect.d.ts +1 -1
  114. package/lib/typescript/src/skia/web/JsiSkRSXform.d.ts +1 -1
  115. package/lib/typescript/src/skia/web/JsiSkRect.d.ts +1 -1
  116. package/lib/typescript/src/sksg/Container.d.ts +1 -0
  117. package/lib/typescript/src/specs/NativeSkiaModule.web.d.ts +6 -0
  118. package/lib/typescript/src/specs/SkiaPictureViewNativeComponent.web.d.ts +9 -0
  119. package/lib/typescript/src/views/types.d.ts +1 -0
  120. package/package.json +1 -1
  121. package/src/sksg/Container.ts +8 -8
  122. package/src/specs/NativeSkiaModule.web.ts +38 -0
  123. package/src/specs/SkiaPictureViewNativeComponent.web.ts +39 -0
  124. package/src/views/types.ts +1 -0
  125. package/cpp/jsi/JsiValue.cpp +0 -345
  126. package/cpp/jsi/JsiValue.h +0 -222
  127. package/lib/commonjs/renderer/Canvas.web.d.ts +0 -10
  128. package/lib/commonjs/renderer/Canvas.web.js +0 -110
  129. package/lib/commonjs/renderer/Canvas.web.js.map +0 -1
  130. package/lib/module/renderer/Canvas.web.d.ts +0 -10
  131. package/lib/module/renderer/Canvas.web.js +0 -105
  132. package/lib/module/renderer/Canvas.web.js.map +0 -1
  133. package/lib/typescript/lib/commonjs/renderer/Canvas.web.d.ts +0 -3
  134. package/lib/typescript/lib/module/renderer/Canvas.web.d.ts +0 -1
  135. package/lib/typescript/src/renderer/Canvas.web.d.ts +0 -10
  136. package/src/renderer/Canvas.web.tsx +0 -134
@@ -1 +1 @@
1
- {"version":3,"names":["PlaceholderAlignment","exports"],"sources":["ParagraphBuilder.ts"],"sourcesContent":["import type { SkJSIInstance } from \"../JsiInstance\";\nimport type { SkPaint } from \"../Paint\";\n\nimport type { SkParagraph } from \"./Paragraph\";\nimport type { SkParagraphStyle } from \"./ParagraphStyle\";\nimport type { SkTextStyle, TextBaseline } from \"./TextStyle\";\nimport type { SkTypefaceFontProvider } from \"./TypefaceFontProvider\";\n\nexport interface ParagraphBuilderFactory {\n /**\n * Creates a new ParagraphBuilder object from custom fonts.\n * @param paragraphStyle Initial paragraph style\n * @param typefaceProvider Typeface provider\n */\n Make(\n paragraphStyle?: SkParagraphStyle,\n typefaceProvider?: SkTypefaceFontProvider\n ): SkParagraphBuilder;\n}\n\nexport enum PlaceholderAlignment {\n /// Match the baseline of the placeholder with the baseline.\n Baseline = 0,\n\n /// Align the bottom edge of the placeholder with the baseline such that the\n /// placeholder sits on top of the baseline.\n AboveBaseline,\n\n /// Align the top edge of the placeholder with the baseline specified in\n /// such that the placeholder hangs below the baseline.\n BelowBaseline,\n\n /// Align the top edge of the placeholder with the top edge of the font.\n /// When the placeholder is very tall, the extra space will hang from\n /// the top and extend through the bottom of the line.\n Top,\n\n /// Align the bottom edge of the placeholder with the top edge of the font.\n /// When the placeholder is very tall, the extra space will rise from\n /// the bottom and extend through the top of the line.\n Bottom,\n\n /// Align the middle of the placeholder with the middle of the text. When the\n /// placeholder is very tall, the extra space will grow equally from\n /// the top and bottom of the line.\n Middle,\n}\n\nexport interface SkParagraphBuilder extends SkJSIInstance<\"ParagraphBuilder\"> {\n /**\n * Creates a Paragraph object from the builder and the inputs given to the builder.\n */\n build(): SkParagraph;\n /**\n * Restores the builder to its initial empty state.\n */\n reset(): void;\n /**\n * Pushes a text-style to the builder\n * @param style Style to push\n * @param foregroundPaint Foreground paint object\n * @param backgroundPaint Background paint object\n * @returns The builder\n */\n pushStyle: (\n style: SkTextStyle,\n foregroundPaint?: SkPaint | undefined,\n backgroundPaint?: SkPaint | undefined\n ) => SkParagraphBuilder;\n /**\n * Pops the current text style from the builder\n * @returns The builder\n */\n pop: () => SkParagraphBuilder;\n /**\n * Adds text to the builder\n * @param text\n * @returns The builder\n */\n addText: (text: string) => SkParagraphBuilder;\n /**\n * Pushes the information required to leave an open space.\n * @param width\n * @param height\n * @param alignment\n * @param baseline\n * @param offset\n */\n addPlaceholder(\n width?: number,\n height?: number,\n alignment?: PlaceholderAlignment,\n baseline?: TextBaseline,\n offset?: number\n ): SkParagraphBuilder;\n}\n"],"mappings":";;;;;;IAoBYA,oBAAoB,GAAAC,OAAA,CAAAD,oBAAA,0BAApBA,oBAAoB;EAApBA,oBAAoB,CAApBA,oBAAoB;EAApBA,oBAAoB,CAApBA,oBAAoB;EAApBA,oBAAoB,CAApBA,oBAAoB;EAApBA,oBAAoB,CAApBA,oBAAoB;EAApBA,oBAAoB,CAApBA,oBAAoB;EAApBA,oBAAoB,CAApBA,oBAAoB;EAAA,OAApBA,oBAAoB;AAAA","ignoreList":[]}
1
+ {"version":3,"names":["PlaceholderAlignment","exports"],"sources":["ParagraphBuilder.ts"],"sourcesContent":["import type { SkJSIInstance } from \"../JsiInstance\";\nimport type { SkPaint } from \"../Paint\";\n\nimport type { SkParagraph } from \"./Paragraph\";\nimport type { SkParagraphStyle } from \"./ParagraphStyle\";\nimport type { SkTextStyle, TextBaseline } from \"./TextStyle\";\nimport type { SkTypefaceFontProvider } from \"./TypefaceFontProvider\";\n\nexport interface ParagraphBuilderFactory {\n /**\n * Creates a new ParagraphBuilder object from custom fonts.\n * @param paragraphStyle Initial paragraph style\n * @param typefaceProvider Typeface provider\n */\n Make(\n paragraphStyle?: SkParagraphStyle,\n typefaceProvider?: SkTypefaceFontProvider\n ): SkParagraphBuilder;\n}\n\nexport enum PlaceholderAlignment {\n /// Match the baseline of the placeholder with the baseline.\n Baseline = 0,\n\n /// Align the bottom edge of the placeholder with the baseline such that the\n /// placeholder sits on top of the baseline.\n AboveBaseline,\n\n /// Align the top edge of the placeholder with the baseline specified in\n /// such that the placeholder hangs below the baseline.\n BelowBaseline,\n\n /// Align the top edge of the placeholder with the top edge of the font.\n /// When the placeholder is very tall, the extra space will hang from\n /// the top and extend through the bottom of the line.\n Top,\n\n /// Align the bottom edge of the placeholder with the top edge of the font.\n /// When the placeholder is very tall, the extra space will rise from\n /// the bottom and extend through the top of the line.\n Bottom,\n\n /// Align the middle of the placeholder with the middle of the text. When the\n /// placeholder is very tall, the extra space will grow equally from\n /// the top and bottom of the line.\n Middle,\n}\n\nexport interface SkParagraphBuilder extends SkJSIInstance<\"ParagraphBuilder\"> {\n /**\n * Creates a Paragraph object from the builder and the inputs given to the builder.\n */\n build(): SkParagraph;\n /**\n * Restores the builder to its initial empty state.\n */\n reset(): void;\n /**\n * Pushes a text-style to the builder\n * @param style Style to push\n * @param foregroundPaint Foreground paint object\n * @param backgroundPaint Background paint object\n * @returns The builder\n */\n pushStyle: (\n style: SkTextStyle,\n foregroundPaint?: SkPaint | undefined,\n backgroundPaint?: SkPaint | undefined\n ) => SkParagraphBuilder;\n /**\n * Pops the current text style from the builder\n * @returns The builder\n */\n pop: () => SkParagraphBuilder;\n /**\n * Adds text to the builder\n * @param text\n * @returns The builder\n */\n addText: (text: string) => SkParagraphBuilder;\n /**\n * Pushes the information required to leave an open space.\n * @param width\n * @param height\n * @param alignment\n * @param baseline\n * @param offset\n */\n addPlaceholder(\n width?: number,\n height?: number,\n alignment?: PlaceholderAlignment,\n baseline?: TextBaseline,\n offset?: number\n ): SkParagraphBuilder;\n}\n"],"mappings":";;;;;;IAoBYA,oBAAoB,GAAAC,OAAA,CAAAD,oBAAA,0BAApBA,oBAAoB;EAC9B;EADUA,oBAAoB,CAApBA,oBAAoB;EAI9B;EACA;EALUA,oBAAoB,CAApBA,oBAAoB;EAQ9B;EACA;EATUA,oBAAoB,CAApBA,oBAAoB;EAY9B;EACA;EACA;EAdUA,oBAAoB,CAApBA,oBAAoB;EAiB9B;EACA;EACA;EAnBUA,oBAAoB,CAApBA,oBAAoB;EAsB9B;EACA;EACA;EAxBUA,oBAAoB,CAApBA,oBAAoB;EAAA,OAApBA,oBAAoB;AAAA","ignoreList":[]}
@@ -16,9 +16,13 @@ let FillType = exports.FillType = /*#__PURE__*/function (FillType) {
16
16
  }({});
17
17
  let PathOp = exports.PathOp = /*#__PURE__*/function (PathOp) {
18
18
  PathOp[PathOp["Difference"] = 0] = "Difference";
19
+ //!< subtract the op path from the first path
19
20
  PathOp[PathOp["Intersect"] = 1] = "Intersect";
21
+ //!< intersect the two paths
20
22
  PathOp[PathOp["Union"] = 2] = "Union";
23
+ //!< union (inclusive-or) the two paths
21
24
  PathOp[PathOp["XOR"] = 3] = "XOR";
25
+ //!< exclusive-or the two paths
22
26
  PathOp[PathOp["ReverseDifference"] = 4] = "ReverseDifference";
23
27
  return PathOp;
24
28
  }({});
@@ -1 +1 @@
1
- {"version":3,"names":["FillType","exports","PathOp","PathVerb","isPath","obj","__typename__"],"sources":["Path.ts"],"sourcesContent":["import type { SkRect } from \"../Rect\";\nimport type { SkPoint } from \"../Point\";\nimport type { InputRRect } from \"../RRect\";\nimport type { StrokeJoin, StrokeCap } from \"../Paint\";\nimport type { InputMatrix, SkMatrix } from \"../Matrix\";\nimport type { SkJSIInstance } from \"../JsiInstance\";\n\n/**\n * Options used for Path.stroke(). If an option is omitted, a sensible default will be used.\n */\nexport interface StrokeOpts {\n /** The width of the stroked lines. */\n width?: number;\n miter_limit?: number;\n /**\n * if > 1, increase precision, else if (0 < resScale < 1) reduce precision to\n * favor speed and size\n */\n precision?: number;\n join?: StrokeJoin;\n cap?: StrokeCap;\n}\n\nexport enum FillType {\n Winding,\n EvenOdd,\n InverseWinding,\n InverseEvenOdd,\n}\n\nexport enum PathOp {\n Difference, //!< subtract the op path from the first path\n Intersect, //!< intersect the two paths\n Union, //!< union (inclusive-or) the two paths\n XOR, //!< exclusive-or the two paths\n ReverseDifference,\n}\n\nexport enum PathVerb {\n Move,\n Line,\n Quad,\n Conic,\n Cubic,\n Close,\n}\n\nexport type PathCommand = number[];\n\nexport const isPath = (obj: SkJSIInstance<string> | null): obj is SkPath => {\n \"worklet\";\n return obj !== null && obj.__typename__ === \"Path\";\n};\n\nexport interface SkPath extends SkJSIInstance<\"Path\"> {\n /**\n * Appends arc to Path, as the start of new contour. Arc added is part of ellipse\n * bounded by oval, from startAngle through sweepAngle. Both startAngle and\n * sweepAngle are measured in degrees, where zero degrees is aligned with the\n * positive x-axis, and positive sweeps extends arc clockwise.\n * Returns the modified path for easier chaining.\n * @param oval\n * @param startAngle\n * @param sweepAngle\n */\n addArc(\n oval: SkRect,\n startAngleInDegrees: number,\n sweepAngleInDegrees: number\n ): SkPath;\n\n /**\n * Adds oval to Path, appending kMove_Verb, four kConic_Verb, and kClose_Verb.\n * Oval is upright ellipse bounded by Rect oval with radii equal to half oval width\n * and half oval height. Oval begins at start and continues clockwise by default.\n * Returns the modified path for easier chaining.\n * @param oval\n * @param isCCW - if the path should be drawn counter-clockwise or not\n * @param startIndex - index of initial point of ellipse\n */\n addOval(oval: SkRect, isCCW?: boolean, startIndex?: number): SkPath;\n\n /**\n * Returns the number of points in this path. Initially zero.\n */\n countPoints(): number;\n\n /**\n * Adds contour created from array of n points, adding (count - 1) line segments.\n * Contour added starts at pts[0], then adds a line for every additional point\n * in pts array. If close is true, appends kClose_Verb to Path, connecting\n * pts[count - 1] and pts[0].\n * Returns the modified path for easier chaining.\n * @param points\n * @param close - if true, will add a line connecting last point to the first point.\n */\n addPoly(points: SkPoint[], close: boolean): SkPath;\n\n /** Adds beginning of contour at SkPoint (x, y).\n\n @param x x-axis value of contour start\n @param y y-axis value of contour start\n @return reference to SkPath\n\n example: https://fiddle.skia.org/c/@Path_moveTo\n */\n moveTo(x: number, y: number): SkPath;\n /** Adds line from last point to (x, y). If SkPath is empty, or last SkPath::Verb is\n kClose_Verb, last point is set to (0, 0) before adding line.\n\n lineTo() appends kMove_Verb to verb array and (0, 0) to SkPoint array, if needed.\n lineTo() then appends kLine_Verb to verb array and (x, y) to SkPoint array.\n\n @param x end of added line on x-axis\n @param y end of added line on y-axis\n @return reference to SkPath\n\n example: https://fiddle.skia.org/c/@Path_lineTo\n */\n lineTo(x: number, y: number): SkPath;\n\n /**\n * Returns a new path that covers the same area as the original path, but with the\n * Winding FillType. This may re-draw some contours in the path as counter-clockwise\n * instead of clockwise to achieve that effect. If such a transformation cannot\n * be done, null is returned.\n */\n makeAsWinding(): SkPath | null;\n\n /**\n * Translates all the points in the path by dx, dy.\n * @param dx\n * @param dy\n */\n offset(dx: number, dy: number): SkPath;\n\n /**\n * Relative version of arcToRotated.\n * @param rx\n * @param ry\n * @param xAxisRotate\n * @param useSmallArc\n * @param isCCW\n * @param dx\n * @param dy\n */\n rArcTo(\n rx: number,\n ry: number,\n xAxisRotateInDegrees: number,\n useSmallArc: boolean,\n isCCW: boolean,\n dx: number,\n dy: number\n ): SkPath;\n\n /**\n * Relative version of conicTo.\n * @param dx1\n * @param dy1\n * @param dx2\n * @param dy2\n * @param w\n */\n rConicTo(\n dx1: number,\n dy1: number,\n dx2: number,\n dy2: number,\n w: number\n ): SkPath;\n\n /**\n * Relative version of cubicTo.\n * @param cpx1\n * @param cpy1\n * @param cpx2\n * @param cpy2\n * @param x\n * @param y\n */\n rCubicTo(\n cpx1: number,\n cpy1: number,\n cpx2: number,\n cpy2: number,\n x: number,\n y: number\n ): SkPath;\n\n /**\n * Relative version of moveTo.\n * @param x\n * @param y\n */\n rMoveTo(x: number, y: number): SkPath;\n\n /**\n * Relative version of lineTo.\n * @param x\n * @param y\n */\n rLineTo(x: number, y: number): SkPath;\n\n /**\n * Relative version of quadTo.\n * @param x1\n * @param y1\n * @param x2\n * @param y2\n */\n rQuadTo(x1: number, y1: number, x2: number, y2: number): SkPath;\n\n /**\n * Sets FillType, the rule used to fill Path.\n * @param fill\n */\n setFillType(fill: FillType): SkPath;\n\n /**\n * Specifies whether Path is volatile; whether it will be altered or discarded\n * by the caller after it is drawn. Path by default have volatile set false.\n *\n * Mark animating or temporary paths as volatile to improve performance.\n * Mark unchanging Path non-volatile to improve repeated rendering.\n * @param volatile\n */\n setIsVolatile(volatile: boolean): SkPath;\n\n /**\n * Turns this path into the filled equivalent of the stroked path. Returns false if the operation\n * fails (e.g. the path is a hairline).\n * @param opts - describe how stroked path should look.\n * If such a transformation cannot be done, null is returned.\n */\n stroke(opts?: StrokeOpts): null | SkPath;\n\n /**\n * Appends CLOSE_VERB to Path. A closed contour connects the first and last point\n * with a line, forming a continuous loop.\n */\n close(): SkPath;\n\n /**\n * Sets Path to its initial state.\n * Removes verb array, point array, and weights, and sets FillType to Winding.\n * Internal storage associated with Path is released\n */\n reset(): SkPath;\n\n /**\n * Sets Path to its initial state.\n * Removes verb array, point array, and weights, and sets FillType to Winding.\n * Internal storage associated with Path is *not* released.\n * Use rewind() instead of reset() if Path storage will be reused and performance\n * is critical.\n */\n rewind(): SkPath;\n\n /**\n * Returns minimum and maximum axes values of the lines and curves in Path.\n * Returns (0, 0, 0, 0) if Path contains no points.\n * Returned bounds width and height may be larger or smaller than area affected\n * when Path is drawn.\n *\n * Behaves identically to getBounds() when Path contains\n * only lines. If Path contains curves, computed bounds includes\n * the maximum extent of the quad, conic, or cubic; is slower than getBounds();\n * and unlike getBounds(), does not cache the result.\n */\n computeTightBounds(): SkRect;\n\n /**\n * Appends arc to Path. Arc added is part of ellipse\n * bounded by oval, from startAngle through sweepAngle. Both startAngle and\n * sweepAngle are measured in degrees, where zero degrees is aligned with the\n * positive x-axis, and positive sweeps extends arc clockwise.\n * Returns the modified path for easier chaining.\n * @param oval\n * @param startAngleInDegrees\n * @param sweepAngleInDegrees\n * @param forceMoveTo\n */\n arcToOval(\n oval: SkRect,\n startAngleInDegrees: number,\n sweepAngleInDegrees: number,\n forceMoveTo: boolean\n ): SkPath;\n\n /**\n * Appends arc to Path. Arc is implemented by one or more conics weighted to\n * describe part of oval with radii (rx, ry) rotated by xAxisRotate degrees. Arc\n * curves from last Path Point to (x, y), choosing one of four possible routes:\n * clockwise or counterclockwise, and smaller or larger. See SkPath.h for more details.\n * Returns the modified path for easier chaining.\n * @param rx\n * @param ry\n * @param xAxisRotate\n * @param useSmallArc\n * @param isCCW\n * @param x\n * @param y\n */\n arcToRotated(\n rx: number,\n ry: number,\n xAxisRotateInDegrees: number,\n useSmallArc: boolean,\n isCCW: boolean,\n x: number,\n y: number\n ): SkPath;\n\n /**\n * Appends arc to Path, after appending line if needed. Arc is implemented by conic\n * weighted to describe part of circle. Arc is contained by tangent from\n * last Path point to (x1, y1), and tangent from (x1, y1) to (x2, y2). Arc\n * is part of circle sized to radius, positioned so it touches both tangent lines.\n * Returns the modified path for easier chaining.\n * @param x1\n * @param y1\n * @param x2\n * @param y2\n * @param radius\n */\n arcToTangent(\n x1: number,\n y1: number,\n x2: number,\n y2: number,\n radius: number\n ): SkPath;\n\n /**\n * Adds conic from last point towards (x1, y1), to (x2, y2), weighted by w.\n * If Path is empty, or path is closed, the last point is set to (0, 0)\n * before adding conic.\n * Returns the modified path for easier chaining.\n * @param x1\n * @param y1\n * @param x2\n * @param y2\n * @param w\n */\n conicTo(x1: number, y1: number, x2: number, y2: number, w: number): SkPath;\n\n /**\n * Returns true if the point (x, y) is contained by Path, taking into\n * account FillType.\n * @param x\n * @param y\n */\n contains(x: number, y: number): boolean;\n\n /**\n * Returns a copy of this Path.\n */\n copy(): SkPath;\n\n /**\n * Adds cubic from last point towards (x1, y1), then towards (x2, y2), ending at\n * (x3, y3). If Path is empty, or path is closed, the last point is set to\n * (0, 0) before adding cubic.\n * @param cpx1\n * @param cpy1\n * @param cpx2\n * @param cpy2\n * @param x\n * @param y\n */\n cubicTo(\n cpx1: number,\n cpy1: number,\n cpx2: number,\n cpy2: number,\n x: number,\n y: number\n ): SkPath;\n\n /**\n * Changes this path to be the dashed version of itself. This is the same effect as creating\n * a DashPathEffect and calling filterPath on this path.\n * @param on\n * @param off\n * @param phase\n */\n dash(on: number, off: number, phase: number): boolean;\n\n /**\n * Returns true if other path is equal to this path.\n * @param other\n */\n equals(other: SkPath): boolean;\n\n /**\n * Returns minimum and maximum axes values of Point array.\n * Returns (0, 0, 0, 0) if Path contains no points. Returned bounds width and height may\n * be larger or smaller than area affected when Path is drawn.\n */\n getBounds(): SkRect;\n\n /**\n * Return the FillType for this path.\n */\n getFillType(): FillType;\n\n /**\n Adds quad from last point towards (x1, y1), to (x2, y2).\n\n If SkPath is empty, or last SkPath::Verb is kClose_Verb, last point is set to (0, 0) before adding quad.\n\n Appends kMove_Verb to verb array and (0, 0) to SkPoint array, if needed; then appends kQuad_Verb to verb array;\n and (x1, y1), (x2, y2) to SkPoint array.\n\n Parameters\n x1\tcontrol SkPoint of quad on x-axis\n y1\tcontrol SkPoint of quad on y-axis\n x2\tend SkPoint of quad on x-axis\n y2\tend SkPoint of quad on y-axis\n Returns\n reference to SkPath\n example: https://fiddle.skia.org/c/@Path_quadTo\n */\n quadTo(x1: number, y1: number, x2: number, y2: number): SkPath;\n\n /**\n * Adds Rect to Path, appending kMove_Verb, three kLine_Verb, and kClose_Verb,\n * starting with top-left corner of Rect; followed by top-right, bottom-right,\n * and bottom-left if isCCW is false; or followed by bottom-left,\n * bottom-right, and top-right if isCCW is true.\n * Returns the modified path for easier chaining.\n * @param rect\n * @param isCCW\n */\n addRect(rect: SkRect, isCCW?: boolean): SkPath;\n\n /**\n * Adds rrect to Path, creating a new closed contour.\n * Returns the modified path for easier chaining.\n * @param rrect\n * @param isCCW\n */\n addRRect(rrect: InputRRect, isCCW?: boolean): SkPath;\n\n /** Appends src to SkPath, transformed by matrix. Transformed curves may have\n different verbs, SkPoint, and conic weights.\n\n If mode is kAppend_AddPathMode, src verb array, SkPoint array, and conic\n weights are added unaltered. If mode is kExtend_AddPathMode, add line\n before appending verbs, SkPoint, and conic weights.\n\n @param src SkPath verbs, SkPoint, and conic weights to add\n @param matrix transform applied to src\n @param extend extends path with line if true\n @return reference to SkPath\n */\n addPath(src: SkPath, matrix?: SkMatrix, extend?: boolean): SkPath;\n\n /**\n * Returns the Point at index in Point array. Valid range for index is\n * 0 to countPoints() - 1.\n * @param index\n */\n getPoint(index: number): SkPoint;\n\n /**\n * Returns true if there are no verbs in the path.\n */\n isEmpty(): boolean;\n\n /**\n * Returns true if the path is volatile; it will not be altered or discarded\n * by the caller after it is drawn. Path by default have volatile set false, allowing\n * Surface to attach a cache of data which speeds repeated drawing. If true, Surface\n * may not speed repeated drawing.\n */\n isVolatile(): boolean;\n\n /** Adds circle centered at (x, y) of size radius to SkPath, appending kMove_Verb,\n four kConic_Verb, and kClose_Verb. Circle begins at: (x + radius, y), continuing\n clockwise if dir is kCW_Direction, and counterclockwise if dir is kCCW_Direction.\n\n Has no effect if radius is zero or negative.\n\n @param x center of circle\n @param y center of circle\n @param radius distance from center to edge \n @return reference to SkPath\n */\n addCircle(x: number, y: number, r: number): SkPath;\n\n getLastPt(): { x: number; y: number };\n\n /** Set this path to the result of applying the Op to this path and the\n specified path: this = (this op operand).\n The resulting path will be constructed from non-overlapping contours.\n The curve order is reduced where possible so that cubics may be turned\n into quadratics, and quadratics maybe turned into lines.\n\n Returns true if operation was able to produce a result;\n otherwise, result is unmodified.\n\n @param path The second path (for difference, the subtrahend)\n @param op The operator to apply.\n @param result The product of the operands. The result may be one of the\n inputs.\n @return True if the operation succeeded.\n */\n op(path: SkPath, op: PathOp): boolean;\n\n /** Set this path to a set of non-overlapping contours that describe the\n same area as the original path.\n The curve order is reduced where possible so that cubics may\n be turned into quadratics, and quadratics maybe turned into lines.\n\n Returns true if operation was able to produce a result;\n otherwise, result is unmodified.\n\n @param result The simplified path. The result may be the input.\n @return True if simplification succeeded.\n */\n simplify(): boolean;\n\n /**\n * Returns this path as an SVG string.\n */\n toSVGString(): string;\n\n /**\n * Take start and stop \"t\" values (values between 0...1), and modify this path such that\n * it is a subset of the original path.\n * The trim values apply to the entire path, so if it contains several contours, all of them\n * are including in the calculation.\n * Null is returned if either input value is NaN.\n * @param startT - a value in the range [0.0, 1.0]. 0.0 is the beginning of the path.\n * @param stopT - a value in the range [0.0, 1.0]. 1.0 is the end of the path.\n * @param isComplement\n */\n trim(startT: number, stopT: number, isComplement: boolean): null | SkPath;\n\n /**\n * Transforms the path by the specified matrix.\n */\n transform(m3: InputMatrix): SkPath;\n\n /**\n * Interpolates between Path with point array of equal size.\n * Copy verb array and weights to result, and set result path to a weighted\n * average of this path array and ending path.\n\n * weight is most useful when between zero (ending path) and\n one (this path); will work with values outside of this\n range.\n\n * interpolate() returns undefined if path is not\n * the same size as ending path. Call isInterpolatable() to check Path\n * compatibility prior to calling interpolate().\n\n * @param ending path to interpolate with\n * @param weight contribution of this path, and\n * one minus contribution of ending path\n * @param output path to be replaced with the interpolated averages\n * @return Path replaced by interpolated averages or null if \n * not interpolatable\n * */\n interpolate(end: SkPath, weight: number, output?: SkPath): SkPath | null;\n\n /** Returns true if Path contain equal verbs and equal weights.\n * @param compare path to compare\n * @return true if Path can be interpolated equivalent\n *\n * */\n isInterpolatable(compare: SkPath): boolean;\n\n /**\n * Serializes the contents of this path as a series of commands.\n */\n toCmds(): PathCommand[];\n}\n"],"mappings":";;;;;;AAOA;AACA;AACA;AAFA,IAgBYA,QAAQ,GAAAC,OAAA,CAAAD,QAAA,0BAARA,QAAQ;EAARA,QAAQ,CAARA,QAAQ;EAARA,QAAQ,CAARA,QAAQ;EAARA,QAAQ,CAARA,QAAQ;EAARA,QAAQ,CAARA,QAAQ;EAAA,OAARA,QAAQ;AAAA;AAAA,IAORE,MAAM,GAAAD,OAAA,CAAAC,MAAA,0BAANA,MAAM;EAANA,MAAM,CAANA,MAAM;EAANA,MAAM,CAANA,MAAM;EAANA,MAAM,CAANA,MAAM;EAANA,MAAM,CAANA,MAAM;EAANA,MAAM,CAANA,MAAM;EAAA,OAANA,MAAM;AAAA;AAAA,IAQNC,QAAQ,GAAAF,OAAA,CAAAE,QAAA,0BAARA,QAAQ;EAARA,QAAQ,CAARA,QAAQ;EAARA,QAAQ,CAARA,QAAQ;EAARA,QAAQ,CAARA,QAAQ;EAARA,QAAQ,CAARA,QAAQ;EAARA,QAAQ,CAARA,QAAQ;EAARA,QAAQ,CAARA,QAAQ;EAAA,OAARA,QAAQ;AAAA;AAWb,MAAMC,MAAM,GAAIC,GAAiC,IAAoB;EAC1E,SAAS;;EACT,OAAOA,GAAG,KAAK,IAAI,IAAIA,GAAG,CAACC,YAAY,KAAK,MAAM;AACpD,CAAC;AAACL,OAAA,CAAAG,MAAA,GAAAA,MAAA","ignoreList":[]}
1
+ {"version":3,"names":["FillType","exports","PathOp","PathVerb","isPath","obj","__typename__"],"sources":["Path.ts"],"sourcesContent":["import type { SkRect } from \"../Rect\";\nimport type { SkPoint } from \"../Point\";\nimport type { InputRRect } from \"../RRect\";\nimport type { StrokeJoin, StrokeCap } from \"../Paint\";\nimport type { InputMatrix, SkMatrix } from \"../Matrix\";\nimport type { SkJSIInstance } from \"../JsiInstance\";\n\n/**\n * Options used for Path.stroke(). If an option is omitted, a sensible default will be used.\n */\nexport interface StrokeOpts {\n /** The width of the stroked lines. */\n width?: number;\n miter_limit?: number;\n /**\n * if > 1, increase precision, else if (0 < resScale < 1) reduce precision to\n * favor speed and size\n */\n precision?: number;\n join?: StrokeJoin;\n cap?: StrokeCap;\n}\n\nexport enum FillType {\n Winding,\n EvenOdd,\n InverseWinding,\n InverseEvenOdd,\n}\n\nexport enum PathOp {\n Difference, //!< subtract the op path from the first path\n Intersect, //!< intersect the two paths\n Union, //!< union (inclusive-or) the two paths\n XOR, //!< exclusive-or the two paths\n ReverseDifference,\n}\n\nexport enum PathVerb {\n Move,\n Line,\n Quad,\n Conic,\n Cubic,\n Close,\n}\n\nexport type PathCommand = number[];\n\nexport const isPath = (obj: SkJSIInstance<string> | null): obj is SkPath => {\n \"worklet\";\n return obj !== null && obj.__typename__ === \"Path\";\n};\n\nexport interface SkPath extends SkJSIInstance<\"Path\"> {\n /**\n * Appends arc to Path, as the start of new contour. Arc added is part of ellipse\n * bounded by oval, from startAngle through sweepAngle. Both startAngle and\n * sweepAngle are measured in degrees, where zero degrees is aligned with the\n * positive x-axis, and positive sweeps extends arc clockwise.\n * Returns the modified path for easier chaining.\n * @param oval\n * @param startAngle\n * @param sweepAngle\n */\n addArc(\n oval: SkRect,\n startAngleInDegrees: number,\n sweepAngleInDegrees: number\n ): SkPath;\n\n /**\n * Adds oval to Path, appending kMove_Verb, four kConic_Verb, and kClose_Verb.\n * Oval is upright ellipse bounded by Rect oval with radii equal to half oval width\n * and half oval height. Oval begins at start and continues clockwise by default.\n * Returns the modified path for easier chaining.\n * @param oval\n * @param isCCW - if the path should be drawn counter-clockwise or not\n * @param startIndex - index of initial point of ellipse\n */\n addOval(oval: SkRect, isCCW?: boolean, startIndex?: number): SkPath;\n\n /**\n * Returns the number of points in this path. Initially zero.\n */\n countPoints(): number;\n\n /**\n * Adds contour created from array of n points, adding (count - 1) line segments.\n * Contour added starts at pts[0], then adds a line for every additional point\n * in pts array. If close is true, appends kClose_Verb to Path, connecting\n * pts[count - 1] and pts[0].\n * Returns the modified path for easier chaining.\n * @param points\n * @param close - if true, will add a line connecting last point to the first point.\n */\n addPoly(points: SkPoint[], close: boolean): SkPath;\n\n /** Adds beginning of contour at SkPoint (x, y).\n\n @param x x-axis value of contour start\n @param y y-axis value of contour start\n @return reference to SkPath\n\n example: https://fiddle.skia.org/c/@Path_moveTo\n */\n moveTo(x: number, y: number): SkPath;\n /** Adds line from last point to (x, y). If SkPath is empty, or last SkPath::Verb is\n kClose_Verb, last point is set to (0, 0) before adding line.\n\n lineTo() appends kMove_Verb to verb array and (0, 0) to SkPoint array, if needed.\n lineTo() then appends kLine_Verb to verb array and (x, y) to SkPoint array.\n\n @param x end of added line on x-axis\n @param y end of added line on y-axis\n @return reference to SkPath\n\n example: https://fiddle.skia.org/c/@Path_lineTo\n */\n lineTo(x: number, y: number): SkPath;\n\n /**\n * Returns a new path that covers the same area as the original path, but with the\n * Winding FillType. This may re-draw some contours in the path as counter-clockwise\n * instead of clockwise to achieve that effect. If such a transformation cannot\n * be done, null is returned.\n */\n makeAsWinding(): SkPath | null;\n\n /**\n * Translates all the points in the path by dx, dy.\n * @param dx\n * @param dy\n */\n offset(dx: number, dy: number): SkPath;\n\n /**\n * Relative version of arcToRotated.\n * @param rx\n * @param ry\n * @param xAxisRotate\n * @param useSmallArc\n * @param isCCW\n * @param dx\n * @param dy\n */\n rArcTo(\n rx: number,\n ry: number,\n xAxisRotateInDegrees: number,\n useSmallArc: boolean,\n isCCW: boolean,\n dx: number,\n dy: number\n ): SkPath;\n\n /**\n * Relative version of conicTo.\n * @param dx1\n * @param dy1\n * @param dx2\n * @param dy2\n * @param w\n */\n rConicTo(\n dx1: number,\n dy1: number,\n dx2: number,\n dy2: number,\n w: number\n ): SkPath;\n\n /**\n * Relative version of cubicTo.\n * @param cpx1\n * @param cpy1\n * @param cpx2\n * @param cpy2\n * @param x\n * @param y\n */\n rCubicTo(\n cpx1: number,\n cpy1: number,\n cpx2: number,\n cpy2: number,\n x: number,\n y: number\n ): SkPath;\n\n /**\n * Relative version of moveTo.\n * @param x\n * @param y\n */\n rMoveTo(x: number, y: number): SkPath;\n\n /**\n * Relative version of lineTo.\n * @param x\n * @param y\n */\n rLineTo(x: number, y: number): SkPath;\n\n /**\n * Relative version of quadTo.\n * @param x1\n * @param y1\n * @param x2\n * @param y2\n */\n rQuadTo(x1: number, y1: number, x2: number, y2: number): SkPath;\n\n /**\n * Sets FillType, the rule used to fill Path.\n * @param fill\n */\n setFillType(fill: FillType): SkPath;\n\n /**\n * Specifies whether Path is volatile; whether it will be altered or discarded\n * by the caller after it is drawn. Path by default have volatile set false.\n *\n * Mark animating or temporary paths as volatile to improve performance.\n * Mark unchanging Path non-volatile to improve repeated rendering.\n * @param volatile\n */\n setIsVolatile(volatile: boolean): SkPath;\n\n /**\n * Turns this path into the filled equivalent of the stroked path. Returns false if the operation\n * fails (e.g. the path is a hairline).\n * @param opts - describe how stroked path should look.\n * If such a transformation cannot be done, null is returned.\n */\n stroke(opts?: StrokeOpts): null | SkPath;\n\n /**\n * Appends CLOSE_VERB to Path. A closed contour connects the first and last point\n * with a line, forming a continuous loop.\n */\n close(): SkPath;\n\n /**\n * Sets Path to its initial state.\n * Removes verb array, point array, and weights, and sets FillType to Winding.\n * Internal storage associated with Path is released\n */\n reset(): SkPath;\n\n /**\n * Sets Path to its initial state.\n * Removes verb array, point array, and weights, and sets FillType to Winding.\n * Internal storage associated with Path is *not* released.\n * Use rewind() instead of reset() if Path storage will be reused and performance\n * is critical.\n */\n rewind(): SkPath;\n\n /**\n * Returns minimum and maximum axes values of the lines and curves in Path.\n * Returns (0, 0, 0, 0) if Path contains no points.\n * Returned bounds width and height may be larger or smaller than area affected\n * when Path is drawn.\n *\n * Behaves identically to getBounds() when Path contains\n * only lines. If Path contains curves, computed bounds includes\n * the maximum extent of the quad, conic, or cubic; is slower than getBounds();\n * and unlike getBounds(), does not cache the result.\n */\n computeTightBounds(): SkRect;\n\n /**\n * Appends arc to Path. Arc added is part of ellipse\n * bounded by oval, from startAngle through sweepAngle. Both startAngle and\n * sweepAngle are measured in degrees, where zero degrees is aligned with the\n * positive x-axis, and positive sweeps extends arc clockwise.\n * Returns the modified path for easier chaining.\n * @param oval\n * @param startAngleInDegrees\n * @param sweepAngleInDegrees\n * @param forceMoveTo\n */\n arcToOval(\n oval: SkRect,\n startAngleInDegrees: number,\n sweepAngleInDegrees: number,\n forceMoveTo: boolean\n ): SkPath;\n\n /**\n * Appends arc to Path. Arc is implemented by one or more conics weighted to\n * describe part of oval with radii (rx, ry) rotated by xAxisRotate degrees. Arc\n * curves from last Path Point to (x, y), choosing one of four possible routes:\n * clockwise or counterclockwise, and smaller or larger. See SkPath.h for more details.\n * Returns the modified path for easier chaining.\n * @param rx\n * @param ry\n * @param xAxisRotate\n * @param useSmallArc\n * @param isCCW\n * @param x\n * @param y\n */\n arcToRotated(\n rx: number,\n ry: number,\n xAxisRotateInDegrees: number,\n useSmallArc: boolean,\n isCCW: boolean,\n x: number,\n y: number\n ): SkPath;\n\n /**\n * Appends arc to Path, after appending line if needed. Arc is implemented by conic\n * weighted to describe part of circle. Arc is contained by tangent from\n * last Path point to (x1, y1), and tangent from (x1, y1) to (x2, y2). Arc\n * is part of circle sized to radius, positioned so it touches both tangent lines.\n * Returns the modified path for easier chaining.\n * @param x1\n * @param y1\n * @param x2\n * @param y2\n * @param radius\n */\n arcToTangent(\n x1: number,\n y1: number,\n x2: number,\n y2: number,\n radius: number\n ): SkPath;\n\n /**\n * Adds conic from last point towards (x1, y1), to (x2, y2), weighted by w.\n * If Path is empty, or path is closed, the last point is set to (0, 0)\n * before adding conic.\n * Returns the modified path for easier chaining.\n * @param x1\n * @param y1\n * @param x2\n * @param y2\n * @param w\n */\n conicTo(x1: number, y1: number, x2: number, y2: number, w: number): SkPath;\n\n /**\n * Returns true if the point (x, y) is contained by Path, taking into\n * account FillType.\n * @param x\n * @param y\n */\n contains(x: number, y: number): boolean;\n\n /**\n * Returns a copy of this Path.\n */\n copy(): SkPath;\n\n /**\n * Adds cubic from last point towards (x1, y1), then towards (x2, y2), ending at\n * (x3, y3). If Path is empty, or path is closed, the last point is set to\n * (0, 0) before adding cubic.\n * @param cpx1\n * @param cpy1\n * @param cpx2\n * @param cpy2\n * @param x\n * @param y\n */\n cubicTo(\n cpx1: number,\n cpy1: number,\n cpx2: number,\n cpy2: number,\n x: number,\n y: number\n ): SkPath;\n\n /**\n * Changes this path to be the dashed version of itself. This is the same effect as creating\n * a DashPathEffect and calling filterPath on this path.\n * @param on\n * @param off\n * @param phase\n */\n dash(on: number, off: number, phase: number): boolean;\n\n /**\n * Returns true if other path is equal to this path.\n * @param other\n */\n equals(other: SkPath): boolean;\n\n /**\n * Returns minimum and maximum axes values of Point array.\n * Returns (0, 0, 0, 0) if Path contains no points. Returned bounds width and height may\n * be larger or smaller than area affected when Path is drawn.\n */\n getBounds(): SkRect;\n\n /**\n * Return the FillType for this path.\n */\n getFillType(): FillType;\n\n /**\n Adds quad from last point towards (x1, y1), to (x2, y2).\n\n If SkPath is empty, or last SkPath::Verb is kClose_Verb, last point is set to (0, 0) before adding quad.\n\n Appends kMove_Verb to verb array and (0, 0) to SkPoint array, if needed; then appends kQuad_Verb to verb array;\n and (x1, y1), (x2, y2) to SkPoint array.\n\n Parameters\n x1\tcontrol SkPoint of quad on x-axis\n y1\tcontrol SkPoint of quad on y-axis\n x2\tend SkPoint of quad on x-axis\n y2\tend SkPoint of quad on y-axis\n Returns\n reference to SkPath\n example: https://fiddle.skia.org/c/@Path_quadTo\n */\n quadTo(x1: number, y1: number, x2: number, y2: number): SkPath;\n\n /**\n * Adds Rect to Path, appending kMove_Verb, three kLine_Verb, and kClose_Verb,\n * starting with top-left corner of Rect; followed by top-right, bottom-right,\n * and bottom-left if isCCW is false; or followed by bottom-left,\n * bottom-right, and top-right if isCCW is true.\n * Returns the modified path for easier chaining.\n * @param rect\n * @param isCCW\n */\n addRect(rect: SkRect, isCCW?: boolean): SkPath;\n\n /**\n * Adds rrect to Path, creating a new closed contour.\n * Returns the modified path for easier chaining.\n * @param rrect\n * @param isCCW\n */\n addRRect(rrect: InputRRect, isCCW?: boolean): SkPath;\n\n /** Appends src to SkPath, transformed by matrix. Transformed curves may have\n different verbs, SkPoint, and conic weights.\n\n If mode is kAppend_AddPathMode, src verb array, SkPoint array, and conic\n weights are added unaltered. If mode is kExtend_AddPathMode, add line\n before appending verbs, SkPoint, and conic weights.\n\n @param src SkPath verbs, SkPoint, and conic weights to add\n @param matrix transform applied to src\n @param extend extends path with line if true\n @return reference to SkPath\n */\n addPath(src: SkPath, matrix?: SkMatrix, extend?: boolean): SkPath;\n\n /**\n * Returns the Point at index in Point array. Valid range for index is\n * 0 to countPoints() - 1.\n * @param index\n */\n getPoint(index: number): SkPoint;\n\n /**\n * Returns true if there are no verbs in the path.\n */\n isEmpty(): boolean;\n\n /**\n * Returns true if the path is volatile; it will not be altered or discarded\n * by the caller after it is drawn. Path by default have volatile set false, allowing\n * Surface to attach a cache of data which speeds repeated drawing. If true, Surface\n * may not speed repeated drawing.\n */\n isVolatile(): boolean;\n\n /** Adds circle centered at (x, y) of size radius to SkPath, appending kMove_Verb,\n four kConic_Verb, and kClose_Verb. Circle begins at: (x + radius, y), continuing\n clockwise if dir is kCW_Direction, and counterclockwise if dir is kCCW_Direction.\n\n Has no effect if radius is zero or negative.\n\n @param x center of circle\n @param y center of circle\n @param radius distance from center to edge \n @return reference to SkPath\n */\n addCircle(x: number, y: number, r: number): SkPath;\n\n getLastPt(): { x: number; y: number };\n\n /** Set this path to the result of applying the Op to this path and the\n specified path: this = (this op operand).\n The resulting path will be constructed from non-overlapping contours.\n The curve order is reduced where possible so that cubics may be turned\n into quadratics, and quadratics maybe turned into lines.\n\n Returns true if operation was able to produce a result;\n otherwise, result is unmodified.\n\n @param path The second path (for difference, the subtrahend)\n @param op The operator to apply.\n @param result The product of the operands. The result may be one of the\n inputs.\n @return True if the operation succeeded.\n */\n op(path: SkPath, op: PathOp): boolean;\n\n /** Set this path to a set of non-overlapping contours that describe the\n same area as the original path.\n The curve order is reduced where possible so that cubics may\n be turned into quadratics, and quadratics maybe turned into lines.\n\n Returns true if operation was able to produce a result;\n otherwise, result is unmodified.\n\n @param result The simplified path. The result may be the input.\n @return True if simplification succeeded.\n */\n simplify(): boolean;\n\n /**\n * Returns this path as an SVG string.\n */\n toSVGString(): string;\n\n /**\n * Take start and stop \"t\" values (values between 0...1), and modify this path such that\n * it is a subset of the original path.\n * The trim values apply to the entire path, so if it contains several contours, all of them\n * are including in the calculation.\n * Null is returned if either input value is NaN.\n * @param startT - a value in the range [0.0, 1.0]. 0.0 is the beginning of the path.\n * @param stopT - a value in the range [0.0, 1.0]. 1.0 is the end of the path.\n * @param isComplement\n */\n trim(startT: number, stopT: number, isComplement: boolean): null | SkPath;\n\n /**\n * Transforms the path by the specified matrix.\n */\n transform(m3: InputMatrix): SkPath;\n\n /**\n * Interpolates between Path with point array of equal size.\n * Copy verb array and weights to result, and set result path to a weighted\n * average of this path array and ending path.\n\n * weight is most useful when between zero (ending path) and\n one (this path); will work with values outside of this\n range.\n\n * interpolate() returns undefined if path is not\n * the same size as ending path. Call isInterpolatable() to check Path\n * compatibility prior to calling interpolate().\n\n * @param ending path to interpolate with\n * @param weight contribution of this path, and\n * one minus contribution of ending path\n * @param output path to be replaced with the interpolated averages\n * @return Path replaced by interpolated averages or null if \n * not interpolatable\n * */\n interpolate(end: SkPath, weight: number, output?: SkPath): SkPath | null;\n\n /** Returns true if Path contain equal verbs and equal weights.\n * @param compare path to compare\n * @return true if Path can be interpolated equivalent\n *\n * */\n isInterpolatable(compare: SkPath): boolean;\n\n /**\n * Serializes the contents of this path as a series of commands.\n */\n toCmds(): PathCommand[];\n}\n"],"mappings":";;;;;;AAOA;AACA;AACA;AAFA,IAgBYA,QAAQ,GAAAC,OAAA,CAAAD,QAAA,0BAARA,QAAQ;EAARA,QAAQ,CAARA,QAAQ;EAARA,QAAQ,CAARA,QAAQ;EAARA,QAAQ,CAARA,QAAQ;EAARA,QAAQ,CAARA,QAAQ;EAAA,OAARA,QAAQ;AAAA;AAAA,IAORE,MAAM,GAAAD,OAAA,CAAAC,MAAA,0BAANA,MAAM;EAANA,MAAM,CAANA,MAAM;EACJ;EADFA,MAAM,CAANA,MAAM;EAEL;EAFDA,MAAM,CAANA,MAAM;EAGT;EAHGA,MAAM,CAANA,MAAM;EAIX;EAJKA,MAAM,CAANA,MAAM;EAAA,OAANA,MAAM;AAAA;AAAA,IAQNC,QAAQ,GAAAF,OAAA,CAAAE,QAAA,0BAARA,QAAQ;EAARA,QAAQ,CAARA,QAAQ;EAARA,QAAQ,CAARA,QAAQ;EAARA,QAAQ,CAARA,QAAQ;EAARA,QAAQ,CAARA,QAAQ;EAARA,QAAQ,CAARA,QAAQ;EAARA,QAAQ,CAARA,QAAQ;EAAA,OAARA,QAAQ;AAAA;AAWb,MAAMC,MAAM,GAAIC,GAAiC,IAAoB;EAC1E,SAAS;;EACT,OAAOA,GAAG,KAAK,IAAI,IAAIA,GAAG,CAACC,YAAY,KAAK,MAAM;AACpD,CAAC;AAACL,OAAA,CAAAG,MAAA,GAAAA,MAAA","ignoreList":[]}
@@ -43,5 +43,5 @@ export declare class JsiSkCanvas extends HostObject<Canvas, "Canvas"> implements
43
43
  concat(m: SkMatrix | number[]): void;
44
44
  drawPicture(skp: SkPicture): void;
45
45
  drawAtlas(atlas: SkImage, srcs: SkRect[], dsts: SkRSXform[], paint: SkPaint, blendMode?: BlendMode, colors?: SkColor[], sampling?: CubicResampler | FilterOptions): void;
46
- readPixels(srcX: number, srcY: number, imageInfo: ImageInfo): Float32Array | Uint8Array | null;
46
+ readPixels(srcX: number, srcY: number, imageInfo: ImageInfo): Float32Array<ArrayBufferLike> | Uint8Array<ArrayBufferLike> | null;
47
47
  }
@@ -9,9 +9,9 @@ export declare class JsiSkImage extends HostObject<Image, "Image"> implements Sk
9
9
  getImageInfo(): ImageInfo;
10
10
  makeShaderOptions(tx: TileMode, ty: TileMode, fm: FilterMode, mm: MipmapMode, localMatrix?: SkMatrix): SkShader;
11
11
  makeShaderCubic(tx: TileMode, ty: TileMode, B: number, C: number, localMatrix?: SkMatrix): SkShader;
12
- encodeToBytes(fmt?: ImageFormat, quality?: number): Uint8Array;
12
+ encodeToBytes(fmt?: ImageFormat, quality?: number): Uint8Array<ArrayBufferLike>;
13
13
  encodeToBase64(fmt?: ImageFormat, quality?: number): string;
14
- readPixels(srcX?: number, srcY?: number, imageInfo?: ImageInfo): Float32Array | Uint8Array | null;
14
+ readPixels(srcX?: number, srcY?: number, imageInfo?: ImageInfo): Float32Array<ArrayBufferLike> | Uint8Array<ArrayBufferLike> | null;
15
15
  dispose: () => void;
16
16
  makeNonTextureImage(): SkImage;
17
17
  getNativeTextureUnstable(): unknown;
@@ -8,7 +8,7 @@ export declare class JsiSkPaint extends HostObject<Paint, "Paint"> implements Sk
8
8
  assign(paint: JsiSkPaint): void;
9
9
  reset(): void;
10
10
  getAlphaf(): number;
11
- getColor(): Float32Array;
11
+ getColor(): import("canvaskit-wasm").Color;
12
12
  getStrokeCap(): number;
13
13
  getStrokeJoin(): number;
14
14
  getStrokeMiter(): number;
@@ -6,5 +6,5 @@ export declare class JsiSkPicture extends HostObject<Picture, "Picture"> impleme
6
6
  constructor(CanvasKit: CanvasKit, ref: Picture);
7
7
  dispose: () => void;
8
8
  makeShader(tmx: TileMode, tmy: TileMode, mode: FilterMode, localMatrix?: SkMatrix, tileRect?: SkRect): JsiSkShader;
9
- serialize(): Uint8Array | null;
9
+ serialize(): Uint8Array<ArrayBufferLike> | null;
10
10
  }
@@ -2,7 +2,7 @@ import type { CanvasKit, Point } from "canvaskit-wasm";
2
2
  import type { SkPoint } from "../types";
3
3
  import { BaseHostObject } from "./Host";
4
4
  export declare class JsiSkPoint extends BaseHostObject<Point, "Point"> implements SkPoint {
5
- static fromValue(point: SkPoint): Float32Array;
5
+ static fromValue(point: SkPoint): Float32Array<ArrayBuffer>;
6
6
  constructor(CanvasKit: CanvasKit, ref: Point);
7
7
  dispose: () => void;
8
8
  get x(): number;
@@ -4,7 +4,7 @@ import { BaseHostObject } from "./Host";
4
4
  import { JsiSkRect } from "./JsiSkRect";
5
5
  export declare class JsiSkRRect extends BaseHostObject<RRect, "RRect"> implements SkRRect {
6
6
  dispose: () => void;
7
- static fromValue(CanvasKit: CanvasKit, rect: InputRRect): Float32Array;
7
+ static fromValue(CanvasKit: CanvasKit, rect: InputRRect): Float32Array<ArrayBuffer>;
8
8
  constructor(CanvasKit: CanvasKit, rect: SkRect, rx: number, ry: number);
9
9
  get rx(): number;
10
10
  get ry(): number;
@@ -3,7 +3,7 @@ import type { SkRSXform } from "../types";
3
3
  import { BaseHostObject } from "./Host";
4
4
  export type RSXform = Float32Array;
5
5
  export declare class JsiSkRSXform extends BaseHostObject<RSXform, "RSXform"> implements SkRSXform {
6
- static fromValue(rsxform: SkRSXform): Float32Array;
6
+ static fromValue(rsxform: SkRSXform): Float32Array<ArrayBuffer>;
7
7
  constructor(CanvasKit: CanvasKit, ref: RSXform);
8
8
  set(scos: number, ssin: number, tx: number, ty: number): void;
9
9
  get scos(): number;
@@ -2,7 +2,7 @@ import type { CanvasKit, Rect } from "canvaskit-wasm";
2
2
  import type { SkHostRect, SkRect } from "../types";
3
3
  import { BaseHostObject } from "./Host";
4
4
  export declare class JsiSkRect extends BaseHostObject<Rect, "Rect"> implements SkHostRect {
5
- static fromValue(CanvasKit: CanvasKit, rect: SkRect): Float32Array;
5
+ static fromValue(CanvasKit: CanvasKit, rect: SkRect): Rect;
6
6
  dispose: () => void;
7
7
  constructor(CanvasKit: CanvasKit, ref: Rect);
8
8
  setXYWH(x: number, y: number, width: number, height: number): void;
@@ -1,6 +1,7 @@
1
1
  import type { Skia, SkCanvas } from "../skia/types";
2
2
  import type { Node } from "./Node";
3
3
  import type { Recording } from "./Recorder/Recorder";
4
+ import "../views/api";
4
5
  export declare abstract class Container {
5
6
  protected Skia: Skia;
6
7
  protected nativeId: number;
@@ -11,6 +11,7 @@ var _Visitor = require("./Recorder/Visitor");
11
11
  var _Player = require("./Recorder/Player");
12
12
  var _DrawingContext = require("./Recorder/DrawingContext");
13
13
  var _ReanimatedRecorder = require("./Recorder/ReanimatedRecorder");
14
+ require("../views/api");
14
15
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
15
16
  function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
16
17
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
@@ -28,8 +29,6 @@ const drawOnscreen = (Skia, nativeId, recording) => {
28
29
  //const end = performance.now();
29
30
  //console.log("Recording time: ", end - start);
30
31
  SkiaViewApi.setJsiProperty(nativeId, "picture", picture);
31
- rec.dispose();
32
- picture.dispose();
33
32
  };
34
33
  const nativeDrawOnscreen = (nativeId, recorder) => {
35
34
  "worklet";
@@ -139,6 +138,11 @@ class NativeReanimatedContainer extends Container {
139
138
  (0, _Visitor.visit)(recorder, this.root);
140
139
  const sharedValues = recorder.getSharedValues();
141
140
  const sharedRecorder = recorder.getRecorder();
141
+ _ReanimatedProxy.default.runOnUI(() => {
142
+ "worklet";
143
+
144
+ nativeDrawOnscreen(nativeId, sharedRecorder);
145
+ })();
142
146
  if (sharedValues.length > 0) {
143
147
  this.mapperId = _ReanimatedProxy.default.startMapper(() => {
144
148
  "worklet";
@@ -147,17 +151,12 @@ class NativeReanimatedContainer extends Container {
147
151
  nativeDrawOnscreen(nativeId, sharedRecorder);
148
152
  }, sharedValues);
149
153
  }
150
- _ReanimatedProxy.default.runOnUI(() => {
151
- "worklet";
152
-
153
- nativeDrawOnscreen(nativeId, sharedRecorder);
154
- })();
155
154
  }
156
155
  }
157
156
  const createContainer = (Skia, nativeId) => {
158
- const native = global.SkiaViewApi !== undefined;
157
+ const web = global.SkiaViewApi && global.SkiaViewApi.web;
159
158
  if (_renderHelpers.HAS_REANIMATED_3 && nativeId !== -1) {
160
- if (native) {
159
+ if (!web) {
161
160
  return new NativeReanimatedContainer(Skia, nativeId);
162
161
  } else {
163
162
  return new ReanimatedContainer(Skia, nativeId);
@@ -1 +1 @@
1
- {"version":3,"names":["_ReanimatedProxy","_interopRequireDefault","require","_renderHelpers","_Recorder","_Visitor","_Player","_DrawingContext","_ReanimatedRecorder","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","drawOnscreen","Skia","nativeId","recording","rec","PictureRecorder","canvas","beginRecording","ctx","createDrawingContext","paintPool","replay","commands","picture","finishRecordingAsPicture","SkiaViewApi","setJsiProperty","dispose","nativeDrawOnscreen","recorder","play","Container","constructor","unmount","unmounted","drawOnCanvas","Error","exports","StaticContainer","redraw","Recorder","visit","root","getRecording","isOnScreen","ReanimatedContainer","mapperId","Rea","stopMapper","record","animationValues","size","startMapper","Array","from","runOnUI","NativeReanimatedContainer","ReanimatedRecorder","sharedValues","getSharedValues","sharedRecorder","getRecorder","length","applyUpdates","createContainer","native","global","undefined","HAS_REANIMATED_3"],"sources":["Container.ts"],"sourcesContent":["import Rea from \"../external/reanimated/ReanimatedProxy\";\nimport type { Skia, SkCanvas } from \"../skia/types\";\nimport { HAS_REANIMATED_3 } from \"../external/reanimated/renderHelpers\";\nimport type { JsiRecorder } from \"../skia/types/Recorder\";\n\nimport type { Node } from \"./Node\";\nimport type { Recording } from \"./Recorder/Recorder\";\nimport { Recorder } from \"./Recorder/Recorder\";\nimport { visit } from \"./Recorder/Visitor\";\nimport { replay } from \"./Recorder/Player\";\nimport { createDrawingContext } from \"./Recorder/DrawingContext\";\nimport { ReanimatedRecorder } from \"./Recorder/ReanimatedRecorder\";\n\nconst drawOnscreen = (Skia: Skia, nativeId: number, recording: Recording) => {\n \"worklet\";\n\n const rec = Skia.PictureRecorder();\n const canvas = rec.beginRecording();\n //const start = performance.now();\n\n const ctx = createDrawingContext(Skia, recording.paintPool, canvas);\n replay(ctx, recording.commands);\n const picture = rec.finishRecordingAsPicture();\n //const end = performance.now();\n //console.log(\"Recording time: \", end - start);\n SkiaViewApi.setJsiProperty(nativeId, \"picture\", picture);\n rec.dispose();\n picture.dispose();\n};\n\nconst nativeDrawOnscreen = (nativeId: number, recorder: JsiRecorder) => {\n \"worklet\";\n\n //const start = performance.now();\n\n const picture = recorder.play();\n //const end = performance.now();\n //console.log(\"Recording time: \", end - start);\n SkiaViewApi.setJsiProperty(nativeId, \"picture\", picture);\n};\n\nexport abstract class Container {\n public root: Node[] = [];\n protected recording: Recording | null = null;\n protected unmounted = false;\n\n constructor(protected Skia: Skia, protected nativeId: number) {}\n\n unmount() {\n this.unmounted = true;\n }\n\n drawOnCanvas(canvas: SkCanvas) {\n if (!this.recording) {\n throw new Error(\"No recording to draw\");\n }\n const ctx = createDrawingContext(\n this.Skia,\n this.recording.paintPool,\n canvas\n );\n replay(ctx, this.recording.commands);\n }\n\n abstract redraw(): void;\n}\n\nclass StaticContainer extends Container {\n constructor(Skia: Skia, nativeId: number) {\n super(Skia, nativeId);\n }\n\n redraw() {\n const recorder = new Recorder();\n visit(recorder, this.root);\n this.recording = recorder.getRecording();\n const isOnScreen = this.nativeId !== -1;\n if (isOnScreen) {\n const rec = this.Skia.PictureRecorder();\n const canvas = rec.beginRecording();\n this.drawOnCanvas(canvas);\n const picture = rec.finishRecordingAsPicture();\n SkiaViewApi.setJsiProperty(this.nativeId, \"picture\", picture);\n }\n }\n}\n\nclass ReanimatedContainer extends Container {\n private mapperId: number | null = null;\n\n constructor(Skia: Skia, nativeId: number) {\n super(Skia, nativeId);\n }\n\n redraw() {\n if (this.mapperId !== null) {\n Rea.stopMapper(this.mapperId);\n }\n if (this.unmounted) {\n return;\n }\n const recorder = new Recorder();\n visit(recorder, this.root);\n const record = recorder.getRecording();\n const { animationValues } = record;\n this.recording = {\n commands: record.commands,\n paintPool: record.paintPool,\n };\n const { nativeId, Skia, recording } = this;\n if (animationValues.size > 0) {\n this.mapperId = Rea.startMapper(() => {\n \"worklet\";\n drawOnscreen(Skia, nativeId, recording!);\n }, Array.from(animationValues));\n }\n Rea.runOnUI(() => {\n \"worklet\";\n drawOnscreen(Skia, nativeId, recording!);\n })();\n }\n}\n\nclass NativeReanimatedContainer extends Container {\n private mapperId: number | null = null;\n\n constructor(Skia: Skia, nativeId: number) {\n super(Skia, nativeId);\n }\n\n redraw() {\n if (this.mapperId !== null) {\n Rea.stopMapper(this.mapperId);\n }\n if (this.unmounted) {\n return;\n }\n const { nativeId, Skia } = this;\n const recorder = new ReanimatedRecorder(Skia);\n visit(recorder, this.root);\n const sharedValues = recorder.getSharedValues();\n const sharedRecorder = recorder.getRecorder();\n if (sharedValues.length > 0) {\n this.mapperId = Rea.startMapper(() => {\n \"worklet\";\n sharedRecorder.applyUpdates(sharedValues);\n nativeDrawOnscreen(nativeId, sharedRecorder);\n }, sharedValues);\n }\n Rea.runOnUI(() => {\n \"worklet\";\n nativeDrawOnscreen(nativeId, sharedRecorder);\n })();\n }\n}\n\nexport const createContainer = (Skia: Skia, nativeId: number) => {\n const native = global.SkiaViewApi !== undefined;\n if (HAS_REANIMATED_3 && nativeId !== -1) {\n if (native) {\n return new NativeReanimatedContainer(Skia, nativeId);\n } else {\n return new ReanimatedContainer(Skia, nativeId);\n }\n } else {\n return new StaticContainer(Skia, nativeId);\n }\n};\n"],"mappings":";;;;;;AAAA,IAAAA,gBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,cAAA,GAAAD,OAAA;AAKA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,eAAA,GAAAL,OAAA;AAC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Ac,GAAG/B,QAAQ,CAACgC,WAAW,CAAC,CAAC;IAC7C,IAAIH,YAAY,CAACI,MAAM,GAAG,CAAC,EAAE;MAC3B,IAAI,CAAChB,QAAQ,GAAGC,wBAAG,CAACK,WAAW,CAAC,MAAM;QACpC,SAAS;;QACTQ,cAAc,CAACG,YAAY,CAACL,YAAY,CAAC;QACzC9B,kBAAkB,CAAChB,QAAQ,EAAEgD,cAAc,CAAC;MAC9C,CAAC,EAAEF,YAAY,CAAC;IAClB;IACAX,wBAAG,CAACQ,OAAO,CAAC,MAAM;MAChB,SAAS;;MACT3B,kBAAkB,CAAChB,QAAQ,EAAEgD,cAAc,CAAC;IAC9C,CAAC,CAAC,CAAC,CAAC;EACN;AACF;AAEO,MAAMI,eAAe,GAAGA,CAACrD,IAAU,EAAEC,QAAgB,KAAK;EAC/D,MAAMqD,MAAM,GAAGC,MAAM,CAACzC,WAAW,KAAK0C,SAAS;EAC/C,IAAIC,+BAAgB,IAAIxD,QAAQ,KAAK,CAAC,CAAC,EAAE;IACvC,IAAIqD,MAAM,EAAE;MACV,OAAO,IAAIT,yBAAyB,CAAC7C,IAAI,EAAEC,QAAQ,CAAC;IACtD,CAAC,MAAM;MACL,OAAO,IAAIiC,mBAAmB,CAAClC,IAAI,EAAEC,QAAQ,CAAC;IAChD;EACF,CAAC,MAAM;IACL,OAAO,IAAI0B,eAAe,CAAC3B,IAAI,EAAEC,QAAQ,CAAC;EAC5C;AACF,CAAC;AAACyB,OAAA,CAAA2B,eAAA,GAAAA,eAAA","ignoreList":[]}
1
+ {"version":3,"names":["_ReanimatedProxy","_interopRequireDefault","require","_renderHelpers","_Recorder","_Visitor","_Player","_DrawingContext","_ReanimatedRecorder","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","drawOnscreen","Skia","nativeId","recording","rec","PictureRecorder","canvas","beginRecording","ctx","createDrawingContext","paintPool","replay","commands","picture","finishRecordingAsPicture","SkiaViewApi","setJsiProperty","nativeDrawOnscreen","recorder","play","Container","constructor","unmount","unmounted","drawOnCanvas","Error","exports","StaticContainer","redraw","Recorder","visit","root","getRecording","isOnScreen","ReanimatedContainer","mapperId","Rea","stopMapper","record","animationValues","size","startMapper","Array","from","runOnUI","NativeReanimatedContainer","ReanimatedRecorder","sharedValues","getSharedValues","sharedRecorder","getRecorder","length","applyUpdates","createContainer","web","global","HAS_REANIMATED_3"],"sources":["Container.ts"],"sourcesContent":["import Rea from \"../external/reanimated/ReanimatedProxy\";\nimport type { Skia, SkCanvas } from \"../skia/types\";\nimport { HAS_REANIMATED_3 } from \"../external/reanimated/renderHelpers\";\nimport type { JsiRecorder } from \"../skia/types/Recorder\";\n\nimport type { Node } from \"./Node\";\nimport type { Recording } from \"./Recorder/Recorder\";\nimport { Recorder } from \"./Recorder/Recorder\";\nimport { visit } from \"./Recorder/Visitor\";\nimport { replay } from \"./Recorder/Player\";\nimport { createDrawingContext } from \"./Recorder/DrawingContext\";\nimport { ReanimatedRecorder } from \"./Recorder/ReanimatedRecorder\";\n\nimport \"../views/api\";\n\nconst drawOnscreen = (Skia: Skia, nativeId: number, recording: Recording) => {\n \"worklet\";\n\n const rec = Skia.PictureRecorder();\n const canvas = rec.beginRecording();\n //const start = performance.now();\n\n const ctx = createDrawingContext(Skia, recording.paintPool, canvas);\n replay(ctx, recording.commands);\n const picture = rec.finishRecordingAsPicture();\n //const end = performance.now();\n //console.log(\"Recording time: \", end - start);\n SkiaViewApi.setJsiProperty(nativeId, \"picture\", picture);\n};\n\nconst nativeDrawOnscreen = (nativeId: number, recorder: JsiRecorder) => {\n \"worklet\";\n\n //const start = performance.now();\n\n const picture = recorder.play();\n //const end = performance.now();\n //console.log(\"Recording time: \", end - start);\n SkiaViewApi.setJsiProperty(nativeId, \"picture\", picture);\n};\n\nexport abstract class Container {\n public root: Node[] = [];\n protected recording: Recording | null = null;\n protected unmounted = false;\n\n constructor(protected Skia: Skia, protected nativeId: number) {}\n\n unmount() {\n this.unmounted = true;\n }\n\n drawOnCanvas(canvas: SkCanvas) {\n if (!this.recording) {\n throw new Error(\"No recording to draw\");\n }\n const ctx = createDrawingContext(\n this.Skia,\n this.recording.paintPool,\n canvas\n );\n replay(ctx, this.recording.commands);\n }\n\n abstract redraw(): void;\n}\n\nclass StaticContainer extends Container {\n constructor(Skia: Skia, nativeId: number) {\n super(Skia, nativeId);\n }\n\n redraw() {\n const recorder = new Recorder();\n visit(recorder, this.root);\n this.recording = recorder.getRecording();\n const isOnScreen = this.nativeId !== -1;\n if (isOnScreen) {\n const rec = this.Skia.PictureRecorder();\n const canvas = rec.beginRecording();\n this.drawOnCanvas(canvas);\n const picture = rec.finishRecordingAsPicture();\n SkiaViewApi.setJsiProperty(this.nativeId, \"picture\", picture);\n }\n }\n}\n\nclass ReanimatedContainer extends Container {\n private mapperId: number | null = null;\n\n constructor(Skia: Skia, nativeId: number) {\n super(Skia, nativeId);\n }\n\n redraw() {\n if (this.mapperId !== null) {\n Rea.stopMapper(this.mapperId);\n }\n if (this.unmounted) {\n return;\n }\n const recorder = new Recorder();\n visit(recorder, this.root);\n const record = recorder.getRecording();\n const { animationValues } = record;\n this.recording = {\n commands: record.commands,\n paintPool: record.paintPool,\n };\n const { nativeId, Skia, recording } = this;\n if (animationValues.size > 0) {\n this.mapperId = Rea.startMapper(() => {\n \"worklet\";\n drawOnscreen(Skia, nativeId, recording!);\n }, Array.from(animationValues));\n }\n Rea.runOnUI(() => {\n \"worklet\";\n drawOnscreen(Skia, nativeId, recording!);\n })();\n }\n}\n\nclass NativeReanimatedContainer extends Container {\n private mapperId: number | null = null;\n\n constructor(Skia: Skia, nativeId: number) {\n super(Skia, nativeId);\n }\n\n redraw() {\n if (this.mapperId !== null) {\n Rea.stopMapper(this.mapperId);\n }\n if (this.unmounted) {\n return;\n }\n const { nativeId, Skia } = this;\n const recorder = new ReanimatedRecorder(Skia);\n visit(recorder, this.root);\n const sharedValues = recorder.getSharedValues();\n const sharedRecorder = recorder.getRecorder();\n Rea.runOnUI(() => {\n \"worklet\";\n nativeDrawOnscreen(nativeId, sharedRecorder);\n })();\n if (sharedValues.length > 0) {\n this.mapperId = Rea.startMapper(() => {\n \"worklet\";\n sharedRecorder.applyUpdates(sharedValues);\n nativeDrawOnscreen(nativeId, sharedRecorder);\n }, sharedValues);\n }\n }\n}\n\nexport const createContainer = (Skia: Skia, nativeId: number) => {\n const web = global.SkiaViewApi && global.SkiaViewApi.web;\n if (HAS_REANIMATED_3 && nativeId !== -1) {\n if (!web) {\n return new NativeReanimatedContainer(Skia, nativeId);\n } else {\n return new ReanimatedContainer(Skia, nativeId);\n }\n } else {\n return new StaticContainer(Skia, nativeId);\n }\n};\n"],"mappings":";;;;;;AAAA,IAAAA,gBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,cAAA,GAAAD,OAAA;AAKA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,eAAA,GAAAL,OAAA;AACA,IAAAM,mBAAA,GAAAN,OAAA;AAEAA,OAAA;AAAsB,SAAAD,uBAAAQ,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,gBAAAH,CAAA,EAAAI,CAAA,EAAAC,CAAA,YAAAD,CAAA,GAAAE,cAAA,CAAAF,CAAA,MAAAJ,CAAA,GAAAO,MAAA,CAAAC,cAAA,CAAAR,CAAA,EAAAI,CAAA,IAAAK,KAAA,EAAAJ,CAAA,EAAAK,UAAA,MAAAC,YAAA,MAAAC,QAAA,UAAAZ,CAAA,CAAAI,CAAA,IAAAC,CAAA,EAAAL,CAAA;AAAA,SAAAM,eAAAD,CAAA,QAAAQ,CAAA,GAAAC,YAAA,CAAAT,CAAA,uCAAAQ,CAAA,GAAAA,CAAA,GAAAA,CAAA;A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IE,+BAAgB,IAAItD,QAAQ,KAAK,CAAC,CAAC,EAAE;IACvC,IAAI,CAACoD,GAAG,EAAE;MACR,OAAO,IAAIT,yBAAyB,CAAC5C,IAAI,EAAEC,QAAQ,CAAC;IACtD,CAAC,MAAM;MACL,OAAO,IAAIgC,mBAAmB,CAACjC,IAAI,EAAEC,QAAQ,CAAC;IAChD;EACF,CAAC,MAAM;IACL,OAAO,IAAIyB,eAAe,CAAC1B,IAAI,EAAEC,QAAQ,CAAC;EAC5C;AACF,CAAC;AAACwB,OAAA,CAAA2B,eAAA,GAAAA,eAAA","ignoreList":[]}
@@ -47,6 +47,7 @@ exports.materializeProps = exports.isGroup = exports.isDrawCommand = exports.isC
47
47
  // DrawAtlas = "DrawAtlas",
48
48
  // }
49
49
  let CommandType = exports.CommandType = /*#__PURE__*/function (CommandType) {
50
+ // Context
50
51
  CommandType[CommandType["Group"] = 0] = "Group";
51
52
  CommandType[CommandType["SavePaint"] = 1] = "SavePaint";
52
53
  CommandType[CommandType["RestorePaint"] = 2] = "RestorePaint";
@@ -64,6 +65,7 @@ let CommandType = exports.CommandType = /*#__PURE__*/function (CommandType) {
64
65
  CommandType[CommandType["SaveBackdropFilter"] = 14] = "SaveBackdropFilter";
65
66
  CommandType[CommandType["SaveLayer"] = 15] = "SaveLayer";
66
67
  CommandType[CommandType["RestorePaintDeclaration"] = 16] = "RestorePaintDeclaration";
68
+ // Drawing
67
69
  CommandType[CommandType["DrawBox"] = 17] = "DrawBox";
68
70
  CommandType[CommandType["DrawImage"] = 18] = "DrawImage";
69
71
  CommandType[CommandType["DrawCircle"] = 19] = "DrawCircle";
@@ -1 +1 @@
1
- {"version":3,"names":["CommandType","exports","materializeProps","command","animatedProps","key","props","value","isCommand","type","isGroup","Group","isDrawCommand"],"sources":["Core.ts"],"sourcesContent":["import type { SharedValue } from \"react-native-reanimated\";\n\nimport type {\n BlurMaskFilterProps,\n CircleProps,\n CTMProps,\n ImageProps,\n PointsProps,\n PathProps,\n RectProps,\n RoundedRectProps,\n OvalProps,\n LineProps,\n PatchProps,\n VerticesProps,\n DiffRectProps,\n TextProps,\n TextPathProps,\n TextBlobProps,\n GlyphsProps,\n PictureProps,\n ImageSVGProps,\n ParagraphProps,\n AtlasProps,\n DrawingNodeProps,\n} from \"../../dom/types\";\n\n// export enum CommandType {\n// // Context\n// Group = \"Group\",\n// SavePaint = \"SavePaint\",\n// RestorePaint = \"RestorePaint\",\n// SaveCTM = \"SaveCTM\",\n// RestoreCTM = \"RestoreCTM\",\n// PushColorFilter = \"PushColorFilter\",\n// PushBlurMaskFilter = \"PushBlurMaskFilter\",\n// PushImageFilter = \"PushImageFilter\",\n// PushPathEffect = \"PushPathEffect\",\n// PushShader = \"PushShader\",\n// ComposeColorFilter = \"ComposeColorFilter\",\n// ComposeImageFilter = \"ComposeImageFilter\",\n// ComposePathEffect = \"ComposePathEffect\",\n// MaterializePaint = \"MaterializePaint\",\n// SaveBackdropFilter = \"SaveBackdropFilter\",\n// SaveLayer = \"SaveLayer\",\n// RestorePaintDeclaration = \"RestorePaintDeclaration\",\n// // Drawing\n// DrawBox = \"DrawBox\",\n// DrawImage = \"DrawImage\",\n// DrawCircle = \"DrawCircle\",\n// DrawPaint = \"DrawPaint\",\n// DrawPoints = \"DrawPoints\",\n// DrawPath = \"DrawPath\",\n// DrawRect = \"DrawRect\",\n// DrawRRect = \"DrawRRect\",\n// DrawOval = \"DrawOval\",\n// DrawLine = \"DrawLine\",\n// DrawPatch = \"DrawPatch\",\n// DrawVertices = \"DrawVertices\",\n// DrawDiffRect = \"DrawDiffRect\",\n// DrawText = \"DrawText\",\n// DrawTextPath = \"DrawTextPath\",\n// DrawTextBlob = \"DrawTextBlob\",\n// DrawGlyphs = \"DrawGlyphs\",\n// DrawPicture = \"DrawPicture\",\n// DrawImageSVG = \"DrawImageSVG\",\n// DrawParagraph = \"DrawParagraph\",\n// DrawAtlas = \"DrawAtlas\",\n// }\nexport enum CommandType {\n // Context\n Group,\n SavePaint,\n RestorePaint,\n SaveCTM,\n RestoreCTM,\n PushColorFilter,\n PushBlurMaskFilter,\n PushImageFilter,\n PushPathEffect,\n PushShader,\n ComposeColorFilter,\n ComposeImageFilter,\n ComposePathEffect,\n MaterializePaint,\n SaveBackdropFilter,\n SaveLayer,\n RestorePaintDeclaration,\n // Drawing\n DrawBox,\n DrawImage,\n DrawCircle,\n DrawPaint,\n DrawPoints,\n DrawPath,\n DrawRect,\n DrawRRect,\n DrawOval,\n DrawLine,\n DrawPatch,\n DrawVertices,\n DrawDiffRect,\n DrawText,\n DrawTextPath,\n DrawTextBlob,\n DrawGlyphs,\n DrawPicture,\n DrawImageSVG,\n DrawParagraph,\n DrawAtlas,\n}\n\nexport type Command<T extends CommandType = CommandType> = {\n type: T;\n [key: string]: unknown;\n};\n\nexport const materializeProps = (command: {\n props: Record<string, unknown>;\n animatedProps?: Record<string, SharedValue<unknown>>;\n}) => {\n \"worklet\";\n if (command.animatedProps) {\n for (const key in command.animatedProps) {\n command.props[key] = command.animatedProps[key].value;\n }\n }\n};\n\nexport const isCommand = <T extends CommandType>(\n command: Command,\n type: T\n): command is Command<T> => {\n \"worklet\";\n return command.type === type;\n};\n\ninterface GroupCommand extends Command<CommandType.Group> {\n children: Command[];\n}\n\nexport const isGroup = (command: Command): command is GroupCommand => {\n \"worklet\";\n return command.type === CommandType.Group;\n};\n\ninterface Props {\n [CommandType.DrawImage]: ImageProps;\n [CommandType.DrawCircle]: CircleProps;\n [CommandType.SaveCTM]: CTMProps;\n [CommandType.SavePaint]: DrawingNodeProps;\n [CommandType.PushBlurMaskFilter]: BlurMaskFilterProps;\n [CommandType.DrawPoints]: PointsProps;\n [CommandType.DrawPath]: PathProps;\n [CommandType.DrawRect]: RectProps;\n [CommandType.DrawRRect]: RoundedRectProps;\n [CommandType.DrawOval]: OvalProps;\n [CommandType.DrawLine]: LineProps;\n [CommandType.DrawPatch]: PatchProps;\n [CommandType.DrawVertices]: VerticesProps;\n [CommandType.DrawDiffRect]: DiffRectProps;\n [CommandType.DrawText]: TextProps;\n [CommandType.DrawTextPath]: TextPathProps;\n [CommandType.DrawTextBlob]: TextBlobProps;\n [CommandType.DrawGlyphs]: GlyphsProps;\n [CommandType.DrawPicture]: PictureProps;\n [CommandType.DrawImageSVG]: ImageSVGProps;\n [CommandType.DrawParagraph]: ParagraphProps;\n [CommandType.DrawAtlas]: AtlasProps;\n}\n\ninterface DrawCommand<T extends CommandType> extends Command<T> {\n props: T extends keyof Props ? Props[T] : never;\n}\n\nexport const isDrawCommand = <T extends keyof Props>(\n command: Command,\n type: T\n): command is DrawCommand<T> => {\n \"worklet\";\n return command.type === type;\n};\n"],"mappings":";;;;;;AA2BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA,IACYA,WAAW,GAAAC,OAAA,CAAAD,WAAA,0BAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW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;AAC9B,CAAC;AAACR,OAAA,CAAAW,aAAA,GAAAA,aAAA","ignoreList":[]}
1
+ {"version":3,"names":["CommandType","exports","materializeProps","command","animatedProps","key","props","value","isCommand","type","isGroup","Group","isDrawCommand"],"sources":["Core.ts"],"sourcesContent":["import type { SharedValue } from \"react-native-reanimated\";\n\nimport type {\n BlurMaskFilterProps,\n CircleProps,\n CTMProps,\n ImageProps,\n PointsProps,\n PathProps,\n RectProps,\n RoundedRectProps,\n OvalProps,\n LineProps,\n PatchProps,\n VerticesProps,\n DiffRectProps,\n TextProps,\n TextPathProps,\n TextBlobProps,\n GlyphsProps,\n PictureProps,\n ImageSVGProps,\n ParagraphProps,\n AtlasProps,\n DrawingNodeProps,\n} from \"../../dom/types\";\n\n// export enum CommandType {\n// // Context\n// Group = \"Group\",\n// SavePaint = \"SavePaint\",\n// RestorePaint = \"RestorePaint\",\n// SaveCTM = \"SaveCTM\",\n// RestoreCTM = \"RestoreCTM\",\n// PushColorFilter = \"PushColorFilter\",\n// PushBlurMaskFilter = \"PushBlurMaskFilter\",\n// PushImageFilter = \"PushImageFilter\",\n// PushPathEffect = \"PushPathEffect\",\n// PushShader = \"PushShader\",\n// ComposeColorFilter = \"ComposeColorFilter\",\n// ComposeImageFilter = \"ComposeImageFilter\",\n// ComposePathEffect = \"ComposePathEffect\",\n// MaterializePaint = \"MaterializePaint\",\n// SaveBackdropFilter = \"SaveBackdropFilter\",\n// SaveLayer = \"SaveLayer\",\n// RestorePaintDeclaration = \"RestorePaintDeclaration\",\n// // Drawing\n// DrawBox = \"DrawBox\",\n// DrawImage = \"DrawImage\",\n// DrawCircle = \"DrawCircle\",\n// DrawPaint = \"DrawPaint\",\n// DrawPoints = \"DrawPoints\",\n// DrawPath = \"DrawPath\",\n// DrawRect = \"DrawRect\",\n// DrawRRect = \"DrawRRect\",\n// DrawOval = \"DrawOval\",\n// DrawLine = \"DrawLine\",\n// DrawPatch = \"DrawPatch\",\n// DrawVertices = \"DrawVertices\",\n// DrawDiffRect = \"DrawDiffRect\",\n// DrawText = \"DrawText\",\n// DrawTextPath = \"DrawTextPath\",\n// DrawTextBlob = \"DrawTextBlob\",\n// DrawGlyphs = \"DrawGlyphs\",\n// DrawPicture = \"DrawPicture\",\n// DrawImageSVG = \"DrawImageSVG\",\n// DrawParagraph = \"DrawParagraph\",\n// DrawAtlas = \"DrawAtlas\",\n// }\nexport enum CommandType {\n // Context\n Group,\n SavePaint,\n RestorePaint,\n SaveCTM,\n RestoreCTM,\n PushColorFilter,\n PushBlurMaskFilter,\n PushImageFilter,\n PushPathEffect,\n PushShader,\n ComposeColorFilter,\n ComposeImageFilter,\n ComposePathEffect,\n MaterializePaint,\n SaveBackdropFilter,\n SaveLayer,\n RestorePaintDeclaration,\n // Drawing\n DrawBox,\n DrawImage,\n DrawCircle,\n DrawPaint,\n DrawPoints,\n DrawPath,\n DrawRect,\n DrawRRect,\n DrawOval,\n DrawLine,\n DrawPatch,\n DrawVertices,\n DrawDiffRect,\n DrawText,\n DrawTextPath,\n DrawTextBlob,\n DrawGlyphs,\n DrawPicture,\n DrawImageSVG,\n DrawParagraph,\n DrawAtlas,\n}\n\nexport type Command<T extends CommandType = CommandType> = {\n type: T;\n [key: string]: unknown;\n};\n\nexport const materializeProps = (command: {\n props: Record<string, unknown>;\n animatedProps?: Record<string, SharedValue<unknown>>;\n}) => {\n \"worklet\";\n if (command.animatedProps) {\n for (const key in command.animatedProps) {\n command.props[key] = command.animatedProps[key].value;\n }\n }\n};\n\nexport const isCommand = <T extends CommandType>(\n command: Command,\n type: T\n): command is Command<T> => {\n \"worklet\";\n return command.type === type;\n};\n\ninterface GroupCommand extends Command<CommandType.Group> {\n children: Command[];\n}\n\nexport const isGroup = (command: Command): command is GroupCommand => {\n \"worklet\";\n return command.type === CommandType.Group;\n};\n\ninterface Props {\n [CommandType.DrawImage]: ImageProps;\n [CommandType.DrawCircle]: CircleProps;\n [CommandType.SaveCTM]: CTMProps;\n [CommandType.SavePaint]: DrawingNodeProps;\n [CommandType.PushBlurMaskFilter]: BlurMaskFilterProps;\n [CommandType.DrawPoints]: PointsProps;\n [CommandType.DrawPath]: PathProps;\n [CommandType.DrawRect]: RectProps;\n [CommandType.DrawRRect]: RoundedRectProps;\n [CommandType.DrawOval]: OvalProps;\n [CommandType.DrawLine]: LineProps;\n [CommandType.DrawPatch]: PatchProps;\n [CommandType.DrawVertices]: VerticesProps;\n [CommandType.DrawDiffRect]: DiffRectProps;\n [CommandType.DrawText]: TextProps;\n [CommandType.DrawTextPath]: TextPathProps;\n [CommandType.DrawTextBlob]: TextBlobProps;\n [CommandType.DrawGlyphs]: GlyphsProps;\n [CommandType.DrawPicture]: PictureProps;\n [CommandType.DrawImageSVG]: ImageSVGProps;\n [CommandType.DrawParagraph]: ParagraphProps;\n [CommandType.DrawAtlas]: AtlasProps;\n}\n\ninterface DrawCommand<T extends CommandType> extends Command<T> {\n props: T extends keyof Props ? Props[T] : never;\n}\n\nexport const isDrawCommand = <T extends keyof Props>(\n command: Command,\n type: T\n): command is DrawCommand<T> => {\n \"worklet\";\n return command.type === type;\n};\n"],"mappings":";;;;;;AA2BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA,IACYA,WAAW,GAAAC,OAAA,CAAAD,WAAA,0BAAXA,WAAW;EACrB;EADUA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,W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,GAAAA,SAAA;AAMK,MAAME,OAAO,GAAIP,OAAgB,IAA8B;EACpE,SAAS;;EACT,OAAOA,OAAO,CAACM,IAAI,KAAKT,WAAW,CAACW,KAAK;AAC3C,CAAC;AAACV,OAAA,CAAAS,OAAA,GAAAA,OAAA;AA+BK,MAAME,aAAa,GAAGA,CAC3BT,OAAgB,EAChBM,IAAO,KACuB;EAC9B,SAAS;;EACT,OAAON,OAAO,CAACM,IAAI,KAAKA,IAAI;AAC9B,CAAC;AAACR,OAAA,CAAAW,aAAA,GAAAA,aAAA","ignoreList":[]}
@@ -0,0 +1,6 @@
1
+ import type { ISkiaViewApi } from "../views/types";
2
+ import type { SkiaPictureView } from "../views/SkiaPictureView.web";
3
+ export type ISkiaViewApiWeb = ISkiaViewApi & {
4
+ views: Record<string, SkiaPictureView>;
5
+ registerView(nativeId: string, view: SkiaPictureView): void;
6
+ };
@@ -1,2 +1,35 @@
1
1
  "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ global.SkiaViewApi = {
7
+ views: {},
8
+ web: true,
9
+ registerView(nativeId, view) {
10
+ this.views[nativeId] = view;
11
+ },
12
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
13
+ setJsiProperty(nativeId, name, value) {
14
+ if (name === "picture") {
15
+ this.views[`${nativeId}`].setPicture(value);
16
+ }
17
+ },
18
+ requestRedraw(nativeId) {
19
+ this.views[`${nativeId}`].redraw();
20
+ },
21
+ makeImageSnapshot(nativeId, rect) {
22
+ return this.views[`${nativeId}`].makeImageSnapshot(rect);
23
+ },
24
+ makeImageSnapshotAsync(nativeId, rect) {
25
+ return new Promise((resolve, reject) => {
26
+ const result = this.views[`${nativeId}`].makeImageSnapshot(rect);
27
+ if (result) {
28
+ resolve(result);
29
+ } else {
30
+ reject(new Error("Failed to make image snapshot"));
31
+ }
32
+ });
33
+ }
34
+ };
2
35
  //# sourceMappingURL=NativeSkiaModule.web.js.map
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["NativeSkiaModule.web.ts"],"sourcesContent":[""],"mappings":"","ignoreList":[]}
1
+ {"version":3,"names":["global","SkiaViewApi","views","web","registerView","nativeId","view","setJsiProperty","name","value","setPicture","requestRedraw","redraw","makeImageSnapshot","rect","makeImageSnapshotAsync","Promise","resolve","reject","result","Error"],"sources":["NativeSkiaModule.web.ts"],"sourcesContent":["import type { SkRect } from \"../skia/types\";\nimport type { ISkiaViewApi } from \"../views/types\";\nimport type { SkiaPictureView } from \"../views/SkiaPictureView.web\";\n\nexport type ISkiaViewApiWeb = ISkiaViewApi & {\n views: Record<string, SkiaPictureView>;\n registerView(nativeId: string, view: SkiaPictureView): void;\n};\n\nglobal.SkiaViewApi = {\n views: {},\n web: true,\n registerView(nativeId: string, view: SkiaPictureView) {\n this.views[nativeId] = view;\n },\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n setJsiProperty(nativeId: number, name: string, value: any) {\n if (name === \"picture\") {\n this.views[`${nativeId}`].setPicture(value);\n }\n },\n requestRedraw(nativeId: number) {\n this.views[`${nativeId}`].redraw();\n },\n makeImageSnapshot(nativeId: number, rect?: SkRect) {\n return this.views[`${nativeId}`].makeImageSnapshot(rect);\n },\n makeImageSnapshotAsync(nativeId: number, rect?: SkRect) {\n return new Promise((resolve, reject) => {\n const result = this.views[`${nativeId}`].makeImageSnapshot(rect);\n if (result) {\n resolve(result);\n } else {\n reject(new Error(\"Failed to make image snapshot\"));\n }\n });\n },\n} as ISkiaViewApiWeb;\n"],"mappings":";;;;;AASAA,MAAM,CAACC,WAAW,GAAG;EACnBC,KAAK,EAAE,CAAC,CAAC;EACTC,GAAG,EAAE,IAAI;EACTC,YAAYA,CAACC,QAAgB,EAAEC,IAAqB,EAAE;IACpD,IAAI,CAACJ,KAAK,CAACG,QAAQ,CAAC,GAAGC,IAAI;EAC7B,CAAC;EACD;EACAC,cAAcA,CAACF,QAAgB,EAAEG,IAAY,EAAEC,KAAU,EAAE;IACzD,IAAID,IAAI,KAAK,SAAS,EAAE;MACtB,IAAI,CAACN,KAAK,CAAC,GAAGG,QAAQ,EAAE,CAAC,CAACK,UAAU,CAACD,KAAK,CAAC;IAC7C;EACF,CAAC;EACDE,aAAaA,CAACN,QAAgB,EAAE;IAC9B,IAAI,CAACH,KAAK,CAAC,GAAGG,QAAQ,EAAE,CAAC,CAACO,MAAM,CAAC,CAAC;EACpC,CAAC;EACDC,iBAAiBA,CAACR,QAAgB,EAAES,IAAa,EAAE;IACjD,OAAO,IAAI,CAACZ,KAAK,CAAC,GAAGG,QAAQ,EAAE,CAAC,CAACQ,iBAAiB,CAACC,IAAI,CAAC;EAC1D,CAAC;EACDC,sBAAsBA,CAACV,QAAgB,EAAES,IAAa,EAAE;IACtD,OAAO,IAAIE,OAAO,CAAC,CAACC,OAAO,EAAEC,MAAM,KAAK;MACtC,MAAMC,MAAM,GAAG,IAAI,CAACjB,KAAK,CAAC,GAAGG,QAAQ,EAAE,CAAC,CAACQ,iBAAiB,CAACC,IAAI,CAAC;MAChE,IAAIK,MAAM,EAAE;QACVF,OAAO,CAACE,MAAM,CAAC;MACjB,CAAC,MAAM;QACLD,MAAM,CAAC,IAAIE,KAAK,CAAC,+BAA+B,CAAC,CAAC;MACpD;IACF,CAAC,CAAC;EACJ;AACF,CAAoB","ignoreList":[]}
@@ -0,0 +1,9 @@
1
+ import type { ViewProps } from "react-native";
2
+ import { SkiaPictureView } from "../views/SkiaPictureView.web";
3
+ export interface NativeProps extends ViewProps {
4
+ debug?: boolean;
5
+ opaque?: boolean;
6
+ nativeID: string;
7
+ }
8
+ declare const SkiaPictureViewNativeComponent: ({ nativeID, debug, opaque, onLayout, ...viewProps }: NativeProps) => import("react").CElement<import("..").SkiaPictureViewNativeProps, SkiaPictureView>;
9
+ export default SkiaPictureViewNativeComponent;
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _react = require("react");
8
+ var _SkiaPictureView = require("../views/SkiaPictureView.web");
9
+ const SkiaPictureViewNativeComponent = ({
10
+ nativeID,
11
+ debug,
12
+ opaque,
13
+ onLayout,
14
+ ...viewProps
15
+ }) => {
16
+ const ref = (0, _react.useRef)(null);
17
+ (0, _react.useEffect)(() => {
18
+ if (ref.current) {
19
+ global.SkiaViewApi.registerView(nativeID, ref.current);
20
+ }
21
+ }, [nativeID]);
22
+ return /*#__PURE__*/(0, _react.createElement)(_SkiaPictureView.SkiaPictureView, {
23
+ ref,
24
+ debug,
25
+ opaque,
26
+ onLayout,
27
+ ...viewProps
28
+ });
29
+ };
30
+ // eslint-disable-next-line import/no-default-export
31
+ var _default = exports.default = SkiaPictureViewNativeComponent;
32
+ //# sourceMappingURL=SkiaPictureViewNativeComponent.web.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","require","_SkiaPictureView","SkiaPictureViewNativeComponent","nativeID","debug","opaque","onLayout","viewProps","ref","useRef","useEffect","current","global","SkiaViewApi","registerView","createElement","SkiaPictureView","_default","exports","default"],"sources":["SkiaPictureViewNativeComponent.web.ts"],"sourcesContent":["import type { ViewProps } from \"react-native\";\nimport { createElement, useEffect, useRef } from \"react\";\n\nimport { SkiaPictureView } from \"../views/SkiaPictureView.web\";\n\nimport type { ISkiaViewApiWeb } from \"./NativeSkiaModule.web\";\n\nexport interface NativeProps extends ViewProps {\n debug?: boolean;\n opaque?: boolean;\n nativeID: string;\n}\n\nconst SkiaPictureViewNativeComponent = ({\n nativeID,\n debug,\n opaque,\n onLayout,\n ...viewProps\n}: NativeProps) => {\n const ref = useRef(null);\n useEffect(() => {\n if (ref.current) {\n (global.SkiaViewApi as ISkiaViewApiWeb).registerView(\n nativeID,\n ref.current\n );\n }\n }, [nativeID]);\n return createElement(SkiaPictureView, {\n ref,\n debug,\n opaque,\n onLayout,\n ...viewProps,\n });\n};\n// eslint-disable-next-line import/no-default-export\nexport default SkiaPictureViewNativeComponent;\n"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,gBAAA,GAAAD,OAAA;AAUA,MAAME,8BAA8B,GAAGA,CAAC;EACtCC,QAAQ;EACRC,KAAK;EACLC,MAAM;EACNC,QAAQ;EACR,GAAGC;AACQ,CAAC,KAAK;EACjB,MAAMC,GAAG,GAAG,IAAAC,aAAM,EAAC,IAAI,CAAC;EACxB,IAAAC,gBAAS,EAAC,MAAM;IACd,IAAIF,GAAG,CAACG,OAAO,EAAE;MACdC,MAAM,CAACC,WAAW,CAAqBC,YAAY,CAClDX,QAAQ,EACRK,GAAG,CAACG,OACN,CAAC;IACH;EACF,CAAC,EAAE,CAACR,QAAQ,CAAC,CAAC;EACd,oBAAO,IAAAY,oBAAa,EAACC,gCAAe,EAAE;IACpCR,GAAG;IACHJ,KAAK;IACLC,MAAM;IACNC,QAAQ;IACR,GAAGC;EACL,CAAC,CAAC;AACJ,CAAC;AACD;AAAA,IAAAU,QAAA,GAAAC,OAAA,CAAAC,OAAA,GACejB,8BAA8B","ignoreList":[]}
@@ -7,6 +7,7 @@ export type NativeSkiaViewProps = ViewProps & {
7
7
  opaque?: boolean;
8
8
  };
9
9
  export interface ISkiaViewApi {
10
+ web?: boolean;
10
11
  setJsiProperty: <T>(nativeId: number, name: string, value: T) => void;
11
12
  requestRedraw: (nativeId: number) => void;
12
13
  makeImageSnapshot: (nativeId: number, rect?: SkRect) => SkImage;
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type { ViewProps } from \"react-native\";\nimport type { SharedValue } from \"react-native-reanimated\";\n\nimport type { Node } from \"../dom/types\";\nimport type { SkImage, SkPicture, SkRect, SkSize } from \"../skia/types\";\n\nexport type NativeSkiaViewProps = ViewProps & {\n debug?: boolean;\n opaque?: boolean;\n};\n\nexport interface ISkiaViewApi {\n setJsiProperty: <T>(nativeId: number, name: string, value: T) => void;\n requestRedraw: (nativeId: number) => void;\n makeImageSnapshot: (nativeId: number, rect?: SkRect) => SkImage;\n makeImageSnapshotAsync: (nativeId: number, rect?: SkRect) => Promise<SkImage>;\n}\n\nexport interface SkiaBaseViewProps extends ViewProps {\n /**\n * When set to true the view will display information about the\n * average time it takes to render.\n */\n debug?: boolean;\n /**\n * Pass an animated value to the onSize property to get updates when\n * the Skia view is resized.\n */\n onSize?: SharedValue<SkSize>;\n\n opaque?: boolean;\n}\n\nexport interface SkiaPictureViewNativeProps extends SkiaBaseViewProps {\n picture?: SkPicture;\n}\n\nexport interface SkiaDomViewNativeProps extends SkiaBaseViewProps {\n root?: Node<unknown>;\n}\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type { ViewProps } from \"react-native\";\nimport type { SharedValue } from \"react-native-reanimated\";\n\nimport type { Node } from \"../dom/types\";\nimport type { SkImage, SkPicture, SkRect, SkSize } from \"../skia/types\";\n\nexport type NativeSkiaViewProps = ViewProps & {\n debug?: boolean;\n opaque?: boolean;\n};\n\nexport interface ISkiaViewApi {\n web?: boolean;\n setJsiProperty: <T>(nativeId: number, name: string, value: T) => void;\n requestRedraw: (nativeId: number) => void;\n makeImageSnapshot: (nativeId: number, rect?: SkRect) => SkImage;\n makeImageSnapshotAsync: (nativeId: number, rect?: SkRect) => Promise<SkImage>;\n}\n\nexport interface SkiaBaseViewProps extends ViewProps {\n /**\n * When set to true the view will display information about the\n * average time it takes to render.\n */\n debug?: boolean;\n /**\n * Pass an animated value to the onSize property to get updates when\n * the Skia view is resized.\n */\n onSize?: SharedValue<SkSize>;\n\n opaque?: boolean;\n}\n\nexport interface SkiaPictureViewNativeProps extends SkiaBaseViewProps {\n picture?: SkPicture;\n}\n\nexport interface SkiaDomViewNativeProps extends SkiaBaseViewProps {\n root?: Node<unknown>;\n}\n"],"mappings":"","ignoreList":[]}
@@ -11,11 +11,10 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
11
11
 
12
12
  let ckSharedPromise;
13
13
  const LoadSkiaWeb = async opts => {
14
- var _ckSharedPromise;
15
14
  if (global.CanvasKit !== undefined) {
16
15
  return;
17
16
  }
18
- ckSharedPromise = (_ckSharedPromise = ckSharedPromise) !== null && _ckSharedPromise !== void 0 ? _ckSharedPromise : (0, _canvaskit.default)(opts);
17
+ ckSharedPromise = ckSharedPromise !== null && ckSharedPromise !== void 0 ? ckSharedPromise : (0, _canvaskit.default)(opts);
19
18
  const CanvasKit = await ckSharedPromise;
20
19
  // The CanvasKit API is stored on the global object and used
21
20
  // to create the JsiSKApi in the Skia.web.ts file.
@@ -1 +1 @@
1
- {"version":3,"names":["_canvaskit","_interopRequireDefault","require","e","__esModule","default","ckSharedPromise","LoadSkiaWeb","opts","_ckSharedPromise","global","CanvasKit","undefined","CanvasKitInit","exports","LoadSkia"],"sources":["LoadSkiaWeb.tsx"],"sourcesContent":["// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore\nimport CanvasKitInit from \"canvaskit-wasm/bin/full/canvaskit\";\nimport type {\n CanvasKit as CanvasKitType,\n CanvasKitInitOptions,\n} from \"canvaskit-wasm\";\n\ndeclare global {\n var CanvasKit: CanvasKitType;\n}\n\nlet ckSharedPromise: Promise<CanvasKitType>;\n\nexport const LoadSkiaWeb = async (opts?: CanvasKitInitOptions) => {\n if (global.CanvasKit !== undefined) {\n return;\n }\n ckSharedPromise = ckSharedPromise ?? CanvasKitInit(opts);\n const CanvasKit = await ckSharedPromise;\n // The CanvasKit API is stored on the global object and used\n // to create the JsiSKApi in the Skia.web.ts file.\n global.CanvasKit = CanvasKit;\n};\n\n// We keep this function for backward compatibility\nexport const LoadSkia = LoadSkiaWeb;\n"],"mappings":";;;;;;AAEA,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA8D,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAF9D;AACA;;AAWA,IAAIG,eAAuC;AAEpC,MAAMC,WAAW,GAAG,MAAOC,IAA2B,IAAK;EAAA,IAAAC,gBAAA;EAChE,IAAIC,MAAM,CAACC,SAAS,KAAKC,SAAS,EAAE;IAClC;EACF;EACAN,eAAe,IAAAG,gBAAA,GAAGH,eAAe,cAAAG,gBAAA,cAAAA,gBAAA,GAAI,IAAAI,kBAAa,EAACL,IAAI,CAAC;EACxD,MAAMG,SAAS,GAAG,MAAML,eAAe;EACvC;EACA;EACAI,MAAM,CAACC,SAAS,GAAGA,SAAS;AAC9B,CAAC;;AAED;AAAAG,OAAA,CAAAP,WAAA,GAAAA,WAAA;AACO,MAAMQ,QAAQ,GAAAD,OAAA,CAAAC,QAAA,GAAGR,WAAW","ignoreList":[]}
1
+ {"version":3,"names":["_canvaskit","_interopRequireDefault","require","e","__esModule","default","ckSharedPromise","LoadSkiaWeb","opts","global","CanvasKit","undefined","CanvasKitInit","exports","LoadSkia"],"sources":["LoadSkiaWeb.tsx"],"sourcesContent":["// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore\nimport CanvasKitInit from \"canvaskit-wasm/bin/full/canvaskit\";\nimport type {\n CanvasKit as CanvasKitType,\n CanvasKitInitOptions,\n} from \"canvaskit-wasm\";\n\ndeclare global {\n var CanvasKit: CanvasKitType;\n}\n\nlet ckSharedPromise: Promise<CanvasKitType>;\n\nexport const LoadSkiaWeb = async (opts?: CanvasKitInitOptions) => {\n if (global.CanvasKit !== undefined) {\n return;\n }\n ckSharedPromise = ckSharedPromise ?? CanvasKitInit(opts);\n const CanvasKit = await ckSharedPromise;\n // The CanvasKit API is stored on the global object and used\n // to create the JsiSKApi in the Skia.web.ts file.\n global.CanvasKit = CanvasKit;\n};\n\n// We keep this function for backward compatibility\nexport const LoadSkia = LoadSkiaWeb;\n"],"mappings":";;;;;;AAEA,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA8D,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAF9D;AACA;;AAWA,IAAIG,eAAuC;AAEpC,MAAMC,WAAW,GAAG,MAAOC,IAA2B,IAAK;EAChE,IAAIC,MAAM,CAACC,SAAS,KAAKC,SAAS,EAAE;IAClC;EACF;EACAL,eAAe,GAAGA,eAAe,aAAfA,eAAe,cAAfA,eAAe,GAAI,IAAAM,kBAAa,EAACJ,IAAI,CAAC;EACxD,MAAME,SAAS,GAAG,MAAMJ,eAAe;EACvC;EACA;EACAG,MAAM,CAACC,SAAS,GAAGA,SAAS;AAC9B,CAAC;;AAED;AAAAG,OAAA,CAAAN,WAAA,GAAAA,WAAA;AACO,MAAMO,QAAQ,GAAAD,OAAA,CAAAC,QAAA,GAAGP,WAAW","ignoreList":[]}
@@ -1,3 +1,3 @@
1
1
  import type { Color } from "../../skia";
2
2
  export declare const interpolateColors: (value: number, inputRange: number[], _outputRange: Color[]) => number[];
3
- export declare const mixColors: (value: number, x: Color, y: Color) => Float32Array;
3
+ export declare const mixColors: (value: number, x: Color, y: Color) => Float32Array<ArrayBuffer>;
@@ -242,9 +242,9 @@ export declare const transformOrigin: (origin: Vector, transform: Transforms3d)
242
242
  rotateY: number;
243
243
  matrix: import("../../../skia/types").Matrix4;
244
244
  }, "matrix">)[];
245
- export declare const processColor: (Skia: Skia, color: number | string | Float32Array | number[]) => Float32Array;
245
+ export declare const processColor: (Skia: Skia, color: number | string | Float32Array | number[]) => import("../../../skia/types").SkColor;
246
246
  export declare const processGradientProps: (Skia: Skia, { colors, positions, mode, flags, ...transform }: GradientProps) => {
247
- colors: Float32Array[];
247
+ colors: import("../../../skia/types").SkColor[];
248
248
  positions: number[] | null;
249
249
  mode: TileMode;
250
250
  flags: number | undefined;