@shopify/react-native-skia 0.1.230 → 0.1.232

Sign up to get free protection for your applications and to get access to all the features.
Files changed (142) hide show
  1. package/android/CMakeLists.txt +1 -0
  2. package/android/cpp/rnskia-android/SkiaOpenGLSurfaceFactory.cpp +2 -2
  3. package/cpp/api/JsiSkAnimatedImage.h +1 -1
  4. package/cpp/api/JsiSkDataFactory.h +6 -6
  5. package/cpp/api/JsiSkImage.h +4 -4
  6. package/cpp/api/JsiSkPath.h +1 -1
  7. package/cpp/api/JsiSkRRect.h +30 -3
  8. package/cpp/api/third_party/base64.cpp +153 -0
  9. package/cpp/api/third_party/base64.h +50 -0
  10. package/cpp/jsi/JsiPromises.h +1 -1
  11. package/cpp/rnskia/dom/props/FontProp.h +2 -4
  12. package/cpp/rnskia/dom/props/RRectProp.h +50 -0
  13. package/ios/RNSkia-iOS/SkiaMetalSurfaceFactory.mm +1 -1
  14. package/lib/commonjs/dom/nodes/JsiSkDOM.d.ts +2 -1
  15. package/lib/commonjs/dom/nodes/datatypes/Rect.d.ts +1 -1
  16. package/lib/commonjs/dom/nodes/drawings/RRectNode.d.ts +3 -3
  17. package/lib/commonjs/dom/nodes/drawings/RRectNode.js.map +1 -1
  18. package/lib/commonjs/dom/nodes/drawings/Text.js +1 -11
  19. package/lib/commonjs/dom/nodes/drawings/Text.js.map +1 -1
  20. package/lib/commonjs/dom/types/Common.d.ts +2 -2
  21. package/lib/commonjs/dom/types/Common.js.map +1 -1
  22. package/lib/commonjs/dom/types/Drawings.d.ts +1 -1
  23. package/lib/commonjs/dom/types/Drawings.js.map +1 -1
  24. package/lib/commonjs/headless/index.d.ts +3 -1
  25. package/lib/commonjs/headless/index.js +12 -6
  26. package/lib/commonjs/headless/index.js.map +1 -1
  27. package/lib/commonjs/skia/types/Canvas.d.ts +4 -4
  28. package/lib/commonjs/skia/types/Canvas.js.map +1 -1
  29. package/lib/commonjs/skia/types/Matrix4.d.ts +5 -0
  30. package/lib/commonjs/skia/types/Matrix4.js +8 -3
  31. package/lib/commonjs/skia/types/Matrix4.js.map +1 -1
  32. package/lib/commonjs/skia/types/Paragraph/Paragraph.d.ts +2 -2
  33. package/lib/commonjs/skia/types/Paragraph/Paragraph.js.map +1 -1
  34. package/lib/commonjs/skia/types/Paragraph/ParagraphStyle.d.ts +6 -6
  35. package/lib/commonjs/skia/types/Paragraph/ParagraphStyle.js +25 -25
  36. package/lib/commonjs/skia/types/Paragraph/ParagraphStyle.js.map +1 -1
  37. package/lib/commonjs/skia/types/Path/Path.d.ts +2 -2
  38. package/lib/commonjs/skia/types/Path/Path.js.map +1 -1
  39. package/lib/commonjs/skia/types/RRect.d.ts +9 -0
  40. package/lib/commonjs/skia/types/RRect.js.map +1 -1
  41. package/lib/commonjs/skia/web/JsiSkCanvas.d.ts +4 -4
  42. package/lib/commonjs/skia/web/JsiSkCanvas.js.map +1 -1
  43. package/lib/commonjs/skia/web/JsiSkParagraphStyle.js +1 -1
  44. package/lib/commonjs/skia/web/JsiSkParagraphStyle.js.map +1 -1
  45. package/lib/commonjs/skia/web/JsiSkPath.d.ts +2 -2
  46. package/lib/commonjs/skia/web/JsiSkPath.js.map +1 -1
  47. package/lib/commonjs/skia/web/JsiSkRRect.d.ts +2 -2
  48. package/lib/commonjs/skia/web/JsiSkRRect.js +4 -0
  49. package/lib/commonjs/skia/web/JsiSkRRect.js.map +1 -1
  50. package/lib/commonjs/web/LoadSkiaWeb.js +4 -1
  51. package/lib/commonjs/web/LoadSkiaWeb.js.map +1 -1
  52. package/lib/module/dom/nodes/JsiSkDOM.d.ts +2 -1
  53. package/lib/module/dom/nodes/datatypes/Rect.d.ts +1 -1
  54. package/lib/module/dom/nodes/drawings/RRectNode.d.ts +3 -3
  55. package/lib/module/dom/nodes/drawings/RRectNode.js.map +1 -1
  56. package/lib/module/dom/nodes/drawings/Text.js +1 -11
  57. package/lib/module/dom/nodes/drawings/Text.js.map +1 -1
  58. package/lib/module/dom/types/Common.d.ts +2 -2
  59. package/lib/module/dom/types/Common.js.map +1 -1
  60. package/lib/module/dom/types/Drawings.d.ts +1 -1
  61. package/lib/module/dom/types/Drawings.js.map +1 -1
  62. package/lib/module/headless/index.d.ts +3 -1
  63. package/lib/module/headless/index.js +5 -3
  64. package/lib/module/headless/index.js.map +1 -1
  65. package/lib/module/skia/types/Canvas.d.ts +4 -4
  66. package/lib/module/skia/types/Canvas.js.map +1 -1
  67. package/lib/module/skia/types/Matrix4.d.ts +5 -0
  68. package/lib/module/skia/types/Matrix4.js +6 -4
  69. package/lib/module/skia/types/Matrix4.js.map +1 -1
  70. package/lib/module/skia/types/Paragraph/Paragraph.d.ts +2 -2
  71. package/lib/module/skia/types/Paragraph/Paragraph.js.map +1 -1
  72. package/lib/module/skia/types/Paragraph/ParagraphStyle.d.ts +6 -6
  73. package/lib/module/skia/types/Paragraph/ParagraphStyle.js +21 -21
  74. package/lib/module/skia/types/Paragraph/ParagraphStyle.js.map +1 -1
  75. package/lib/module/skia/types/Path/Path.d.ts +2 -2
  76. package/lib/module/skia/types/Path/Path.js.map +1 -1
  77. package/lib/module/skia/types/RRect.d.ts +9 -0
  78. package/lib/module/skia/types/RRect.js.map +1 -1
  79. package/lib/module/skia/web/JsiSkCanvas.d.ts +4 -4
  80. package/lib/module/skia/web/JsiSkCanvas.js.map +1 -1
  81. package/lib/module/skia/web/JsiSkParagraphStyle.js +2 -2
  82. package/lib/module/skia/web/JsiSkParagraphStyle.js.map +1 -1
  83. package/lib/module/skia/web/JsiSkPath.d.ts +2 -2
  84. package/lib/module/skia/web/JsiSkPath.js.map +1 -1
  85. package/lib/module/skia/web/JsiSkRRect.d.ts +2 -2
  86. package/lib/module/skia/web/JsiSkRRect.js +4 -0
  87. package/lib/module/skia/web/JsiSkRRect.js.map +1 -1
  88. package/lib/module/web/LoadSkiaWeb.js +5 -1
  89. package/lib/module/web/LoadSkiaWeb.js.map +1 -1
  90. package/lib/typescript/src/dom/nodes/JsiSkDOM.d.ts +2 -1
  91. package/lib/typescript/src/dom/nodes/datatypes/Rect.d.ts +1 -1
  92. package/lib/typescript/src/dom/nodes/drawings/RRectNode.d.ts +3 -3
  93. package/lib/typescript/src/dom/types/Common.d.ts +2 -2
  94. package/lib/typescript/src/dom/types/Drawings.d.ts +1 -1
  95. package/lib/typescript/src/headless/index.d.ts +3 -1
  96. package/lib/typescript/src/skia/types/Canvas.d.ts +4 -4
  97. package/lib/typescript/src/skia/types/Matrix4.d.ts +5 -0
  98. package/lib/typescript/src/skia/types/Paragraph/Paragraph.d.ts +2 -2
  99. package/lib/typescript/src/skia/types/Paragraph/ParagraphStyle.d.ts +6 -6
  100. package/lib/typescript/src/skia/types/Path/Path.d.ts +2 -2
  101. package/lib/typescript/src/skia/types/RRect.d.ts +9 -0
  102. package/lib/typescript/src/skia/web/JsiSkCanvas.d.ts +4 -4
  103. package/lib/typescript/src/skia/web/JsiSkPath.d.ts +2 -2
  104. package/lib/typescript/src/skia/web/JsiSkRRect.d.ts +2 -2
  105. package/libs/android/arm64-v8a/libskia.a +0 -0
  106. package/libs/android/armeabi-v7a/libskia.a +0 -0
  107. package/libs/android/x86/libskia.a +0 -0
  108. package/libs/android/x86_64/libskia.a +0 -0
  109. package/libs/ios/libskia.xcframework/ios-arm64_arm64e/libskia.a +0 -0
  110. package/libs/ios/libskia.xcframework/ios-arm64_arm64e_x86_64-simulator/libskia.a +0 -0
  111. package/libs/ios/libskottie.xcframework/Info.plist +5 -5
  112. package/libs/ios/libskottie.xcframework/ios-arm64_arm64e/libskottie.a +0 -0
  113. package/libs/ios/libskottie.xcframework/ios-arm64_arm64e_x86_64-simulator/libskottie.a +0 -0
  114. package/libs/ios/libskparagraph.xcframework/ios-arm64_arm64e/libskparagraph.a +0 -0
  115. package/libs/ios/libskparagraph.xcframework/ios-arm64_arm64e_x86_64-simulator/libskparagraph.a +0 -0
  116. package/libs/ios/libsksg.xcframework/ios-arm64_arm64e/libsksg.a +0 -0
  117. package/libs/ios/libsksg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsksg.a +0 -0
  118. package/libs/ios/libskshaper.xcframework/Info.plist +5 -5
  119. package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e/libskshaper.a +0 -0
  120. package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e_x86_64-simulator/libskshaper.a +0 -0
  121. package/libs/ios/libskunicode.xcframework/ios-arm64_arm64e/libskunicode.a +0 -0
  122. package/libs/ios/libskunicode.xcframework/ios-arm64_arm64e_x86_64-simulator/libskunicode.a +0 -0
  123. package/libs/ios/libsvg.xcframework/Info.plist +5 -5
  124. package/libs/ios/libsvg.xcframework/ios-arm64_arm64e/libsvg.a +0 -0
  125. package/libs/ios/libsvg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsvg.a +0 -0
  126. package/package.json +1 -1
  127. package/src/dom/nodes/drawings/RRectNode.ts +2 -2
  128. package/src/dom/nodes/drawings/Text.ts +1 -14
  129. package/src/dom/types/Common.ts +2 -1
  130. package/src/dom/types/Drawings.ts +1 -1
  131. package/src/headless/index.ts +7 -3
  132. package/src/skia/types/Canvas.ts +4 -4
  133. package/src/skia/types/Matrix4.ts +8 -6
  134. package/src/skia/types/Paragraph/Paragraph.ts +2 -2
  135. package/src/skia/types/Paragraph/ParagraphStyle.ts +6 -6
  136. package/src/skia/types/Path/Path.ts +2 -2
  137. package/src/skia/types/RRect.ts +11 -0
  138. package/src/skia/web/JsiSkCanvas.ts +4 -4
  139. package/src/skia/web/JsiSkParagraphStyle.ts +2 -2
  140. package/src/skia/web/JsiSkPath.ts +2 -2
  141. package/src/skia/web/JsiSkRRect.ts +23 -2
  142. package/src/web/LoadSkiaWeb.tsx +4 -1
@@ -1,3 +1,5 @@
1
1
  import type { ReactNode } from "react";
2
+ import type { SkSurface } from "../skia";
2
3
  export * from "../renderer/components";
3
- export declare const draw: (element: ReactNode, width: number, height: number) => any;
4
+ export declare const makeOffscreenSurface: (width: number, height: number) => any;
5
+ export declare const drawOffscreen: (surface: SkSurface, element: ReactNode) => import("../skia").SkImage;
@@ -4,9 +4,10 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  var _exportNames = {
7
- draw: true
7
+ makeOffscreenSurface: true,
8
+ drawOffscreen: true
8
9
  };
9
- exports.draw = void 0;
10
+ exports.makeOffscreenSurface = exports.drawOffscreen = void 0;
10
11
 
11
12
  var _web = require("../skia/web");
12
13
 
@@ -32,7 +33,7 @@ Object.keys(_components).forEach(function (key) {
32
33
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
33
34
  let Skia;
34
35
 
35
- const draw = (element, width, height) => {
36
+ const makeOffscreenSurface = (width, height) => {
36
37
  if (!Skia) {
37
38
  Skia = (0, _web.JsiSkApi)(CanvasKit);
38
39
  }
@@ -43,15 +44,20 @@ const draw = (element, width, height) => {
43
44
  throw new Error("Couldn't create surface!");
44
45
  }
45
46
 
47
+ return surface;
48
+ };
49
+
50
+ exports.makeOffscreenSurface = makeOffscreenSurface;
51
+
52
+ const drawOffscreen = (surface, element) => {
46
53
  const root = new _Reconciler.SkiaRoot(Skia);
47
54
  root.render(element);
48
55
  const canvas = surface.getCanvas();
49
56
  const ctx = new _types.JsiDrawingContext(Skia, canvas);
50
57
  root.dom.render(ctx);
51
58
  surface.flush();
52
- const image = surface.makeImageSnapshot();
53
- return image;
59
+ return surface.makeImageSnapshot();
54
60
  };
55
61
 
56
- exports.draw = draw;
62
+ exports.drawOffscreen = drawOffscreen;
57
63
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["Skia","draw","element","width","height","JsiSkApi","CanvasKit","surface","Surface","MakeOffscreen","Error","root","SkiaRoot","render","canvas","getCanvas","ctx","JsiDrawingContext","dom","flush","image","makeImageSnapshot"],"sources":["index.ts"],"sourcesContent":["// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore\nimport CanvasKitInit from \"canvaskit-wasm/bin/full/canvaskit\";\nimport type { ReactNode } from \"react\";\n\nimport { JsiSkApi } from \"../skia/web\";\nimport { SkiaRoot } from \"../renderer/Reconciler\";\nimport { JsiDrawingContext } from \"../dom/types\";\n\nexport * from \"../renderer/components\";\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nlet Skia: any;\n\nexport const draw = (element: ReactNode, width: number, height: number) => {\n if (!Skia) {\n Skia = JsiSkApi(CanvasKit);\n }\n const surface = Skia.Surface.MakeOffscreen(width, height);\n if (surface === null) {\n throw new Error(\"Couldn't create surface!\");\n }\n const root = new SkiaRoot(Skia);\n root.render(element);\n const canvas = surface.getCanvas();\n const ctx = new JsiDrawingContext(Skia, canvas);\n root.dom.render(ctx);\n surface.flush();\n const image = surface.makeImageSnapshot();\n return image;\n};\n"],"mappings":";;;;;;;;;;AAKA;;AACA;;AACA;;AAEA;;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AATA;AACA;AAUA;AACA,IAAIA,IAAJ;;AAEO,MAAMC,IAAI,GAAG,CAACC,OAAD,EAAqBC,KAArB,EAAoCC,MAApC,KAAuD;EACzE,IAAI,CAACJ,IAAL,EAAW;IACTA,IAAI,GAAG,IAAAK,aAAA,EAASC,SAAT,CAAP;EACD;;EACD,MAAMC,OAAO,GAAGP,IAAI,CAACQ,OAAL,CAAaC,aAAb,CAA2BN,KAA3B,EAAkCC,MAAlC,CAAhB;;EACA,IAAIG,OAAO,KAAK,IAAhB,EAAsB;IACpB,MAAM,IAAIG,KAAJ,CAAU,0BAAV,CAAN;EACD;;EACD,MAAMC,IAAI,GAAG,IAAIC,oBAAJ,CAAaZ,IAAb,CAAb;EACAW,IAAI,CAACE,MAAL,CAAYX,OAAZ;EACA,MAAMY,MAAM,GAAGP,OAAO,CAACQ,SAAR,EAAf;EACA,MAAMC,GAAG,GAAG,IAAIC,wBAAJ,CAAsBjB,IAAtB,EAA4Bc,MAA5B,CAAZ;EACAH,IAAI,CAACO,GAAL,CAASL,MAAT,CAAgBG,GAAhB;EACAT,OAAO,CAACY,KAAR;EACA,MAAMC,KAAK,GAAGb,OAAO,CAACc,iBAAR,EAAd;EACA,OAAOD,KAAP;AACD,CAhBM"}
1
+ {"version":3,"names":["Skia","makeOffscreenSurface","width","height","JsiSkApi","CanvasKit","surface","Surface","MakeOffscreen","Error","drawOffscreen","element","root","SkiaRoot","render","canvas","getCanvas","ctx","JsiDrawingContext","dom","flush","makeImageSnapshot"],"sources":["index.ts"],"sourcesContent":["// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore\nimport CanvasKitInit from \"canvaskit-wasm/bin/full/canvaskit\";\nimport type { ReactNode } from \"react\";\n\nimport { JsiSkApi } from \"../skia/web\";\nimport { SkiaRoot } from \"../renderer/Reconciler\";\nimport { JsiDrawingContext } from \"../dom/types\";\nimport type { SkSurface } from \"../skia\";\n\nexport * from \"../renderer/components\";\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nlet Skia: any;\n\nexport const makeOffscreenSurface = (width: number, height: number) => {\n if (!Skia) {\n Skia = JsiSkApi(CanvasKit);\n }\n const surface = Skia.Surface.MakeOffscreen(width, height);\n if (surface === null) {\n throw new Error(\"Couldn't create surface!\");\n }\n return surface;\n};\n\nexport const drawOffscreen = (surface: SkSurface, element: ReactNode) => {\n const root = new SkiaRoot(Skia);\n root.render(element);\n const canvas = surface.getCanvas();\n const ctx = new JsiDrawingContext(Skia, canvas);\n root.dom.render(ctx);\n surface.flush();\n return surface.makeImageSnapshot();\n};\n"],"mappings":";;;;;;;;;;;AAKA;;AACA;;AACA;;AAGA;;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AAVA;AACA;AAWA;AACA,IAAIA,IAAJ;;AAEO,MAAMC,oBAAoB,GAAG,CAACC,KAAD,EAAgBC,MAAhB,KAAmC;EACrE,IAAI,CAACH,IAAL,EAAW;IACTA,IAAI,GAAG,IAAAI,aAAA,EAASC,SAAT,CAAP;EACD;;EACD,MAAMC,OAAO,GAAGN,IAAI,CAACO,OAAL,CAAaC,aAAb,CAA2BN,KAA3B,EAAkCC,MAAlC,CAAhB;;EACA,IAAIG,OAAO,KAAK,IAAhB,EAAsB;IACpB,MAAM,IAAIG,KAAJ,CAAU,0BAAV,CAAN;EACD;;EACD,OAAOH,OAAP;AACD,CATM;;;;AAWA,MAAMI,aAAa,GAAG,CAACJ,OAAD,EAAqBK,OAArB,KAA4C;EACvE,MAAMC,IAAI,GAAG,IAAIC,oBAAJ,CAAab,IAAb,CAAb;EACAY,IAAI,CAACE,MAAL,CAAYH,OAAZ;EACA,MAAMI,MAAM,GAAGT,OAAO,CAACU,SAAR,EAAf;EACA,MAAMC,GAAG,GAAG,IAAIC,wBAAJ,CAAsBlB,IAAtB,EAA4Be,MAA5B,CAAZ;EACAH,IAAI,CAACO,GAAL,CAASL,MAAT,CAAgBG,GAAhB;EACAX,OAAO,CAACc,KAAR;EACA,OAAOd,OAAO,CAACe,iBAAR,EAAP;AACD,CARM"}
@@ -5,7 +5,7 @@ import type { SkPath } from "./Path";
5
5
  import type { SkImage, MipmapMode, FilterMode, ImageInfo } from "./Image";
6
6
  import type { SkSVG } from "./SVG";
7
7
  import type { SkColor } from "./Color";
8
- import type { SkRRect } from "./RRect";
8
+ import type { InputRRect } from "./RRect";
9
9
  import type { BlendMode } from "./Paint/BlendMode";
10
10
  import type { SkPoint, PointMode } from "./Point";
11
11
  import type { InputMatrix } from "./Matrix";
@@ -202,7 +202,7 @@ export interface SkCanvas {
202
202
  * @param rrect
203
203
  * @param paint
204
204
  */
205
- drawRRect(rrect: SkRRect, paint: SkPaint): void;
205
+ drawRRect(rrect: InputRRect, paint: SkPaint): void;
206
206
  /**
207
207
  * Draws RRect outer and inner using clip, Matrix, and Paint paint.
208
208
  * outer must contain inner or the drawing is undefined.
@@ -210,7 +210,7 @@ export interface SkCanvas {
210
210
  * @param inner
211
211
  * @param paint
212
212
  */
213
- drawDRRect(outer: SkRRect, inner: SkRRect, paint: SkPaint): void;
213
+ drawDRRect(outer: InputRRect, inner: InputRRect, paint: SkPaint): void;
214
214
  /**
215
215
  * Draws an oval bounded by the given rectangle using the current clip, current matrix,
216
216
  * and the provided paint.
@@ -367,7 +367,7 @@ export interface SkCanvas {
367
367
  * @param op
368
368
  * @param doAntiAlias
369
369
  */
370
- clipRRect(rrect: SkRRect, op: ClipOp, doAntiAlias: boolean): void;
370
+ clipRRect(rrect: InputRRect, op: ClipOp, doAntiAlias: boolean): void;
371
371
  /**
372
372
  * Replaces current matrix with m premultiplied with the existing matrix.
373
373
  * @param m
@@ -1 +1 @@
1
- {"version":3,"names":["ClipOp","SaveLayerFlag"],"sources":["Canvas.ts"],"sourcesContent":["import type { SkPaint } from \"./Paint\";\nimport type { SkRect } from \"./Rect\";\nimport type { SkFont } from \"./Font\";\nimport type { SkPath } from \"./Path\";\nimport type { SkImage, MipmapMode, FilterMode, ImageInfo } from \"./Image\";\nimport type { SkSVG } from \"./SVG\";\nimport type { SkColor } from \"./Color\";\nimport type { SkRRect } from \"./RRect\";\nimport type { BlendMode } from \"./Paint/BlendMode\";\nimport type { SkPoint, PointMode } from \"./Point\";\nimport type { InputMatrix } from \"./Matrix\";\nimport type { SkImageFilter } from \"./ImageFilter\";\nimport type { SkVertices } from \"./Vertices\";\nimport type { SkTextBlob } from \"./TextBlob\";\nimport type { SkPicture } from \"./Picture\";\n\nexport enum ClipOp {\n Difference,\n Intersect,\n}\n\nexport enum SaveLayerFlag {\n SaveLayerInitWithPrevious = 1 << 2,\n SaveLayerF16ColorType = 1 << 4,\n}\n\nexport interface SkCanvas {\n /**\n * Draws the given image with its top-left corner at (left, top) using the current clip,\n * the current matrix, and optionally-provided paint.\n * @param img\n * @param left\n * @param top\n * @param paint\n */\n drawImage: (image: SkImage, x: number, y: number, paint?: SkPaint) => void;\n\n /**\n * Draws sub-rectangle src from provided image, scaled and translated to fill dst rectangle.\n * @param img\n * @param src\n * @param dest\n * @param paint\n * @param fastSample - if false, will filter strictly within src.\n */\n drawImageRect(\n img: SkImage,\n src: SkRect,\n dest: SkRect,\n paint: SkPaint,\n fastSample?: boolean\n ): void;\n\n /**\n * Draws the given image with its top-left corner at (left, top) using the current clip,\n * the current matrix. It will use the cubic sampling options B and C if necessary.\n * @param img\n * @param left\n * @param top\n * @param B - See CubicResampler in SkSamplingOptions.h for more information\n * @param C - See CubicResampler in SkSamplingOptions.h for more information\n * @param paint\n */\n drawImageCubic(\n img: SkImage,\n left: number,\n top: number,\n B: number,\n C: number,\n paint?: SkPaint | null\n ): void;\n\n /**\n * Draws the given image with its top-left corner at (left, top) using the current clip,\n * the current matrix. It will use the provided sampling options if necessary.\n * @param img\n * @param left\n * @param top\n * @param fm - The filter mode.\n * @param mm - The mipmap mode. Note: for settings other than None, the image must have mipmaps\n * calculated with makeCopyWithDefaultMipmaps;\n * @param paint\n */\n drawImageOptions(\n img: SkImage,\n left: number,\n top: number,\n fm: FilterMode,\n mm: MipmapMode,\n paint?: SkPaint | null\n ): void;\n\n /**\n * Draws the provided image stretched proportionally to fit into dst rectangle.\n * The center rectangle divides the image into nine sections: four sides, four corners, and\n * the center.\n * @param img\n * @param center\n * @param dest\n * @param filter - what technique to use when sampling the image\n * @param paint\n */\n drawImageNine(\n img: SkImage,\n center: SkRect,\n dest: SkRect,\n filter: FilterMode,\n paint?: SkPaint | null\n ): void;\n\n /**\n * Draws sub-rectangle src from provided image, scaled and translated to fill dst rectangle.\n * It will use the cubic sampling options B and C if necessary.\n * @param img\n * @param src\n * @param dest\n * @param B - See CubicResampler in SkSamplingOptions.h for more information\n * @param C - See CubicResampler in SkSamplingOptions.h for more information\n * @param paint\n */\n drawImageRectCubic(\n img: SkImage,\n src: SkRect,\n dest: SkRect,\n B: number,\n C: number,\n paint?: SkPaint | null\n ): void;\n\n /**\n * Draws sub-rectangle src from provided image, scaled and translated to fill dst rectangle.\n * It will use the provided sampling options if necessary.\n * @param img\n * @param src\n * @param dest\n * @param fm - The filter mode.\n * @param mm - The mipmap mode. Note: for settings other than None, the image must have mipmaps\n * calculated with makeCopyWithDefaultMipmaps;\n * @param paint\n */\n drawImageRectOptions(\n img: SkImage,\n src: SkRect,\n dest: SkRect,\n fm: FilterMode,\n mm: MipmapMode,\n paint?: SkPaint | null\n ): void;\n\n /** Fills clip with SkPaint paint. SkPaint components, SkShader,\n SkColorFilter, SkImageFilter, and SkBlendMode affect drawing;\n SkMaskFilter and SkPathEffect in paint are ignored.\n\n @param paint graphics state used to fill SkCanvas\n\n example: https://fiddle.skia.org/c/@Canvas_drawPaint\n */\n drawPaint: (paint: SkPaint) => void;\n\n /** Draws line segment from (x0, y0) to (x1, y1) using clip, SkMatrix, and SkPaint paint.\n In paint: SkPaint stroke width describes the line thickness;\n SkPaint::Cap draws the end rounded or square;\n SkPaint::Style is ignored, as if were set to SkPaint::kStroke_Style.\n\n @param x0 start of line segment on x-axis\n @param y0 start of line segment on y-axis\n @param x1 end of line segment on x-axis\n @param y1 end of line segment on y-axis\n @param paint stroke, blend, color, and so on, used to draw\n\n example: https://fiddle.skia.org/c/@Canvas_drawLine\n */\n drawLine: (\n x0: number,\n y0: number,\n x1: number,\n y1: number,\n paint: SkPaint\n ) => void;\n /** Draws SkRect rect using clip, SkMatrix, and SkPaint paint.\n In paint: SkPaint::Style determines if rectangle is stroked or filled;\n if stroked, SkPaint stroke width describes the line thickness, and\n SkPaint::Join draws the corners rounded or square.\n\n @param rect rectangle to draw\n @param paint stroke or fill, blend, color, and so on, used to draw\n\n example: https://fiddle.skia.org/c/@Canvas_drawRect\n */\n drawRect: (rect: SkRect, paint: SkPaint) => void;\n\n /**\n * Draws a circle at (cx, cy) with the given radius.\n * @param cx\n * @param cy\n * @param radius\n * @param paint\n */\n drawCircle(cx: number, cy: number, radius: number, paint: SkPaint): void;\n\n /**\n * Draws the given vertices (a triangle mesh) using the current clip, current matrix, and the\n * provided paint.\n * If paint contains an Shader and vertices does not contain texCoords, the shader\n * is mapped using the vertices' positions.\n * If vertices colors are defined in vertices, and Paint paint contains Shader,\n * BlendMode mode combines vertices colors with Shader.\n * @param verts\n * @param mode\n * @param paint\n */\n drawVertices(verts: SkVertices, mode: BlendMode, paint: SkPaint): void;\n\n /**\n * Draws a cubic patch defined by 12 control points [top, right, bottom, left] with optional\n * colors and shader-coordinates [4] specifed for each corner [top-left, top-right, bottom-right, bottom-left]\n * @param cubics 12 points : 4 connected cubics specifying the boundary of the patch\n * @param colors optional colors interpolated across the patch\n * @param texs optional shader coordinates interpolated across the patch\n * @param mode Specifies how shader and colors blend (if both are specified)\n * @param paint\n */\n drawPatch(\n cubics: readonly SkPoint[],\n colors?: readonly SkColor[] | null,\n texs?: readonly SkPoint[] | null,\n mode?: BlendMode | null,\n paint?: SkPaint\n ): void;\n\n /**\n * Restores state to a previous stack value.\n * @param saveCount\n */\n restoreToCount(saveCount: number): void;\n\n /**\n * Draws the given points using the current clip, current matrix, and the provided paint.\n *\n * See Canvas.h for more on the mode and its interaction with paint.\n * @param mode\n * @param points\n * @param paint\n */\n drawPoints(mode: PointMode, points: SkPoint[], paint: SkPaint): void;\n\n /** Draws arc using clip, SkMatrix, and SkPaint paint.\n\n Arc is part of oval bounded by oval, sweeping from startAngle to startAngle plus\n sweepAngle. startAngle and sweepAngle are in degrees.\n\n startAngle of zero places start point at the right middle edge of oval.\n A positive sweepAngle places arc end point clockwise from start point;\n a negative sweepAngle places arc end point counterclockwise from start point.\n sweepAngle may exceed 360 degrees, a full circle.\n If useCenter is true, draw a wedge that includes lines from oval\n center to arc end points. If useCenter is false, draw arc between end points.\n\n If SkRect oval is empty or sweepAngle is zero, nothing is drawn.\n\n @param oval SkRect bounds of oval containing arc to draw\n @param startAngle angle in degrees where arc begins\n @param sweepAngle sweep angle in degrees; positive is clockwise\n @param useCenter if true, include the center of the oval\n @param paint SkPaint stroke or fill, blend, color, and so on, used to draw\n */\n drawArc: (\n oval: SkRect,\n startAngle: number,\n sweepAngle: number,\n useCenter: boolean,\n paint: SkPaint\n ) => void;\n\n /**\n * Draws the given rectangle with rounded corners using the current clip, current matrix,\n * and the provided paint.\n * @param rrect\n * @param paint\n */\n drawRRect(rrect: SkRRect, paint: SkPaint): void;\n\n /**\n * Draws RRect outer and inner using clip, Matrix, and Paint paint.\n * outer must contain inner or the drawing is undefined.\n * @param outer\n * @param inner\n * @param paint\n */\n drawDRRect(outer: SkRRect, inner: SkRRect, paint: SkPaint): void;\n\n /**\n * Draws an oval bounded by the given rectangle using the current clip, current matrix,\n * and the provided paint.\n * @param oval\n * @param paint\n */\n drawOval(oval: SkRect, paint: SkPaint): void;\n\n /** Draws SkPath path using clip, SkMatrix, and SkPaint paint.\n SkPath contains an array of path contour, each of which may be open or closed.\n\n In paint: SkPaint::Style determines if SkRRect is stroked or filled:\n if filled, SkPath::FillType determines whether path contour describes inside or\n outside of fill; if stroked, SkPaint stroke width describes the line thickness,\n SkPaint::Cap describes line ends, and SkPaint::Join describes how\n corners are drawn.\n\n @param path SkPath to draw\n @param paint stroke, blend, color, and so on, used to draw\n\n example: https://fiddle.skia.org/c/@Canvas_drawPath\n */\n drawPath: (path: SkPath, paint: SkPaint) => void;\n\n /**\n * Draw the given text at the location (x, y) using the provided paint and font. The text will\n * be drawn as is; no shaping, left-to-right, etc.\n * @param str\n * @param x\n * @param y\n * @param paint\n * @param font\n */\n drawText(\n str: string,\n x: number,\n y: number,\n paint: SkPaint,\n font: SkFont\n ): void;\n\n /**\n * Draws the given TextBlob at (x, y) using the current clip, current matrix, and the\n * provided paint. Reminder that the fonts used to draw TextBlob are part of the blob.\n * @param blob\n * @param x\n * @param y\n * @param paint\n */\n drawTextBlob(blob: SkTextBlob, x: number, y: number, paint: SkPaint): void;\n\n /**\n * Draws a run of glyphs, at corresponding positions, in a given font.\n * @param glyphs the array of glyph IDs (Uint16TypedArray)\n * @param positions the array of x,y floats to position each glyph\n * @param x x-coordinate of the origin of the entire run\n * @param y y-coordinate of the origin of the entire run\n * @param font the font that contains the glyphs\n * @param paint\n */\n drawGlyphs(\n glyphs: number[],\n positions: SkPoint[],\n x: number,\n y: number,\n font: SkFont,\n paint: SkPaint\n ): void;\n\n /**\n * Renders the SVG Dom object to the canvas. If width/height are omitted,\n * the SVG will be rendered to fit the canvas.\n */\n drawSvg: (svgDom: SkSVG, width?: number, height?: number) => void;\n /** Saves SkMatrix and clip.\n Calling restore() discards changes to SkMatrix and clip,\n restoring the SkMatrix and clip to their state when save() was called.\n\n SkMatrix may be changed by translate(), scale(), rotate(), skew(), concat(), setMatrix(),\n and resetMatrix(). Clip may be changed by clipRect(), clipRRect(), clipPath(), clipRegion().\n\n Saved SkCanvas state is put on a stack; multiple calls to save() should be balance\n by an equal number of calls to restore().\n\n Call restoreToCount() with result to restore this and subsequent saves.\n\n @return depth of saved stack\n\n example: https://fiddle.skia.org/c/@Canvas_save\n */\n save: () => number;\n\n /**\n * Saves Matrix and clip, and allocates a SkBitmap for subsequent drawing.\n * Calling restore() discards changes to Matrix and clip, and draws the SkBitmap.\n * It returns the height of the stack.\n * See Canvas.h for more.\n * @param paint\n * @param bounds\n * @param backdrop\n * @param flags\n */\n saveLayer(\n paint?: SkPaint,\n bounds?: SkRect | null,\n backdrop?: SkImageFilter | null,\n flags?: SaveLayerFlag\n ): number;\n\n /** Removes changes to SkMatrix and clip since SkCanvas state was\n last saved. The state is removed from the stack.\n\n Does nothing if the stack is empty.\n\n example: https://fiddle.skia.org/c/@AutoCanvasRestore_restore\n\n example: https://fiddle.skia.org/c/@Canvas_restore\n */\n restore: () => void;\n\n /**\n * Rotates the current matrix by the number of degrees.\n * @param rot - angle of rotation in degrees.\n * @param rx\n * @param ry\n */\n rotate(rotationInDegrees: number, rx: number, ry: number): void;\n\n /**\n * Scales the current matrix by sx on the x-axis and sy on the y-axis.\n * @param sx\n * @param sy\n */\n scale(sx: number, sy: number): void;\n\n /**\n * Skews Matrix by sx on the x-axis and sy on the y-axis. A positive value of sx\n * skews the drawing right as y-axis values increase; a positive value of sy skews\n * the drawing down as x-axis values increase.\n * @param sx\n * @param sy\n */\n skew(sx: number, sy: number): void;\n\n /**\n * Translates Matrix by dx along the x-axis and dy along the y-axis.\n * @param dx\n * @param dy\n */\n translate(dx: number, dy: number): void;\n\n /**\n * Fills clip with the given color.\n * @param color\n * @param blendMode - defaults to SrcOver.\n */\n drawColor(color: SkColor, blendMode?: BlendMode): void;\n\n /**\n * Fills the current clip with the given color using Src BlendMode.\n * This has the effect of replacing all pixels contained by clip with color.\n * @param color\n */\n clear(color: SkColor): void;\n\n /**\n * Replaces clip with the intersection or difference of the current clip and path,\n * with an aliased or anti-aliased clip edge.\n * @param path\n * @param op\n * @param doAntiAlias\n */\n clipPath(path: SkPath, op: ClipOp, doAntiAlias: boolean): void;\n\n /**\n * Replaces clip with the intersection or difference of the current clip and rect,\n * with an aliased or anti-aliased clip edge.\n * @param rect\n * @param op\n * @param doAntiAlias\n */\n clipRect(rect: SkRect, op: ClipOp, doAntiAlias: boolean): void;\n\n /**\n * Replaces clip with the intersection or difference of the current clip and rrect,\n * with an aliased or anti-aliased clip edge.\n * @param rrect\n * @param op\n * @param doAntiAlias\n */\n clipRRect(rrect: SkRRect, op: ClipOp, doAntiAlias: boolean): void;\n\n /**\n * Replaces current matrix with m premultiplied with the existing matrix.\n * @param m\n */\n concat(m: InputMatrix): void;\n\n /**\n * Draws the given picture using the current clip, current matrix, and the provided paint.\n * @param skp\n */\n drawPicture(skp: SkPicture): void;\n\n /** Read Image pixels\n *\n * @param srcX - x-axis upper left corner of the rectangle to read from\n * @param srcY - y-axis upper left corner of the rectangle to read from\n * @param imageInfo - describes the pixel format and dimensions of the data to read into\n * @return Float32Array or Uint8Array with data or null if the read failed.\n */\n readPixels(\n srcX: number,\n srcY: number,\n imageInfo: ImageInfo\n ): Float32Array | Uint8Array | null;\n}\n"],"mappings":";;;;;;IAgBYA,M;;;WAAAA,M;EAAAA,M,CAAAA,M;EAAAA,M,CAAAA,M;GAAAA,M,sBAAAA,M;;IAKAC,a;;;WAAAA,a;EAAAA,a,CAAAA,a;EAAAA,a,CAAAA,a;GAAAA,a,6BAAAA,a"}
1
+ {"version":3,"names":["ClipOp","SaveLayerFlag"],"sources":["Canvas.ts"],"sourcesContent":["import type { SkPaint } from \"./Paint\";\nimport type { SkRect } from \"./Rect\";\nimport type { SkFont } from \"./Font\";\nimport type { SkPath } from \"./Path\";\nimport type { SkImage, MipmapMode, FilterMode, ImageInfo } from \"./Image\";\nimport type { SkSVG } from \"./SVG\";\nimport type { SkColor } from \"./Color\";\nimport type { InputRRect } from \"./RRect\";\nimport type { BlendMode } from \"./Paint/BlendMode\";\nimport type { SkPoint, PointMode } from \"./Point\";\nimport type { InputMatrix } from \"./Matrix\";\nimport type { SkImageFilter } from \"./ImageFilter\";\nimport type { SkVertices } from \"./Vertices\";\nimport type { SkTextBlob } from \"./TextBlob\";\nimport type { SkPicture } from \"./Picture\";\n\nexport enum ClipOp {\n Difference,\n Intersect,\n}\n\nexport enum SaveLayerFlag {\n SaveLayerInitWithPrevious = 1 << 2,\n SaveLayerF16ColorType = 1 << 4,\n}\n\nexport interface SkCanvas {\n /**\n * Draws the given image with its top-left corner at (left, top) using the current clip,\n * the current matrix, and optionally-provided paint.\n * @param img\n * @param left\n * @param top\n * @param paint\n */\n drawImage: (image: SkImage, x: number, y: number, paint?: SkPaint) => void;\n\n /**\n * Draws sub-rectangle src from provided image, scaled and translated to fill dst rectangle.\n * @param img\n * @param src\n * @param dest\n * @param paint\n * @param fastSample - if false, will filter strictly within src.\n */\n drawImageRect(\n img: SkImage,\n src: SkRect,\n dest: SkRect,\n paint: SkPaint,\n fastSample?: boolean\n ): void;\n\n /**\n * Draws the given image with its top-left corner at (left, top) using the current clip,\n * the current matrix. It will use the cubic sampling options B and C if necessary.\n * @param img\n * @param left\n * @param top\n * @param B - See CubicResampler in SkSamplingOptions.h for more information\n * @param C - See CubicResampler in SkSamplingOptions.h for more information\n * @param paint\n */\n drawImageCubic(\n img: SkImage,\n left: number,\n top: number,\n B: number,\n C: number,\n paint?: SkPaint | null\n ): void;\n\n /**\n * Draws the given image with its top-left corner at (left, top) using the current clip,\n * the current matrix. It will use the provided sampling options if necessary.\n * @param img\n * @param left\n * @param top\n * @param fm - The filter mode.\n * @param mm - The mipmap mode. Note: for settings other than None, the image must have mipmaps\n * calculated with makeCopyWithDefaultMipmaps;\n * @param paint\n */\n drawImageOptions(\n img: SkImage,\n left: number,\n top: number,\n fm: FilterMode,\n mm: MipmapMode,\n paint?: SkPaint | null\n ): void;\n\n /**\n * Draws the provided image stretched proportionally to fit into dst rectangle.\n * The center rectangle divides the image into nine sections: four sides, four corners, and\n * the center.\n * @param img\n * @param center\n * @param dest\n * @param filter - what technique to use when sampling the image\n * @param paint\n */\n drawImageNine(\n img: SkImage,\n center: SkRect,\n dest: SkRect,\n filter: FilterMode,\n paint?: SkPaint | null\n ): void;\n\n /**\n * Draws sub-rectangle src from provided image, scaled and translated to fill dst rectangle.\n * It will use the cubic sampling options B and C if necessary.\n * @param img\n * @param src\n * @param dest\n * @param B - See CubicResampler in SkSamplingOptions.h for more information\n * @param C - See CubicResampler in SkSamplingOptions.h for more information\n * @param paint\n */\n drawImageRectCubic(\n img: SkImage,\n src: SkRect,\n dest: SkRect,\n B: number,\n C: number,\n paint?: SkPaint | null\n ): void;\n\n /**\n * Draws sub-rectangle src from provided image, scaled and translated to fill dst rectangle.\n * It will use the provided sampling options if necessary.\n * @param img\n * @param src\n * @param dest\n * @param fm - The filter mode.\n * @param mm - The mipmap mode. Note: for settings other than None, the image must have mipmaps\n * calculated with makeCopyWithDefaultMipmaps;\n * @param paint\n */\n drawImageRectOptions(\n img: SkImage,\n src: SkRect,\n dest: SkRect,\n fm: FilterMode,\n mm: MipmapMode,\n paint?: SkPaint | null\n ): void;\n\n /** Fills clip with SkPaint paint. SkPaint components, SkShader,\n SkColorFilter, SkImageFilter, and SkBlendMode affect drawing;\n SkMaskFilter and SkPathEffect in paint are ignored.\n\n @param paint graphics state used to fill SkCanvas\n\n example: https://fiddle.skia.org/c/@Canvas_drawPaint\n */\n drawPaint: (paint: SkPaint) => void;\n\n /** Draws line segment from (x0, y0) to (x1, y1) using clip, SkMatrix, and SkPaint paint.\n In paint: SkPaint stroke width describes the line thickness;\n SkPaint::Cap draws the end rounded or square;\n SkPaint::Style is ignored, as if were set to SkPaint::kStroke_Style.\n\n @param x0 start of line segment on x-axis\n @param y0 start of line segment on y-axis\n @param x1 end of line segment on x-axis\n @param y1 end of line segment on y-axis\n @param paint stroke, blend, color, and so on, used to draw\n\n example: https://fiddle.skia.org/c/@Canvas_drawLine\n */\n drawLine: (\n x0: number,\n y0: number,\n x1: number,\n y1: number,\n paint: SkPaint\n ) => void;\n /** Draws SkRect rect using clip, SkMatrix, and SkPaint paint.\n In paint: SkPaint::Style determines if rectangle is stroked or filled;\n if stroked, SkPaint stroke width describes the line thickness, and\n SkPaint::Join draws the corners rounded or square.\n\n @param rect rectangle to draw\n @param paint stroke or fill, blend, color, and so on, used to draw\n\n example: https://fiddle.skia.org/c/@Canvas_drawRect\n */\n drawRect: (rect: SkRect, paint: SkPaint) => void;\n\n /**\n * Draws a circle at (cx, cy) with the given radius.\n * @param cx\n * @param cy\n * @param radius\n * @param paint\n */\n drawCircle(cx: number, cy: number, radius: number, paint: SkPaint): void;\n\n /**\n * Draws the given vertices (a triangle mesh) using the current clip, current matrix, and the\n * provided paint.\n * If paint contains an Shader and vertices does not contain texCoords, the shader\n * is mapped using the vertices' positions.\n * If vertices colors are defined in vertices, and Paint paint contains Shader,\n * BlendMode mode combines vertices colors with Shader.\n * @param verts\n * @param mode\n * @param paint\n */\n drawVertices(verts: SkVertices, mode: BlendMode, paint: SkPaint): void;\n\n /**\n * Draws a cubic patch defined by 12 control points [top, right, bottom, left] with optional\n * colors and shader-coordinates [4] specifed for each corner [top-left, top-right, bottom-right, bottom-left]\n * @param cubics 12 points : 4 connected cubics specifying the boundary of the patch\n * @param colors optional colors interpolated across the patch\n * @param texs optional shader coordinates interpolated across the patch\n * @param mode Specifies how shader and colors blend (if both are specified)\n * @param paint\n */\n drawPatch(\n cubics: readonly SkPoint[],\n colors?: readonly SkColor[] | null,\n texs?: readonly SkPoint[] | null,\n mode?: BlendMode | null,\n paint?: SkPaint\n ): void;\n\n /**\n * Restores state to a previous stack value.\n * @param saveCount\n */\n restoreToCount(saveCount: number): void;\n\n /**\n * Draws the given points using the current clip, current matrix, and the provided paint.\n *\n * See Canvas.h for more on the mode and its interaction with paint.\n * @param mode\n * @param points\n * @param paint\n */\n drawPoints(mode: PointMode, points: SkPoint[], paint: SkPaint): void;\n\n /** Draws arc using clip, SkMatrix, and SkPaint paint.\n\n Arc is part of oval bounded by oval, sweeping from startAngle to startAngle plus\n sweepAngle. startAngle and sweepAngle are in degrees.\n\n startAngle of zero places start point at the right middle edge of oval.\n A positive sweepAngle places arc end point clockwise from start point;\n a negative sweepAngle places arc end point counterclockwise from start point.\n sweepAngle may exceed 360 degrees, a full circle.\n If useCenter is true, draw a wedge that includes lines from oval\n center to arc end points. If useCenter is false, draw arc between end points.\n\n If SkRect oval is empty or sweepAngle is zero, nothing is drawn.\n\n @param oval SkRect bounds of oval containing arc to draw\n @param startAngle angle in degrees where arc begins\n @param sweepAngle sweep angle in degrees; positive is clockwise\n @param useCenter if true, include the center of the oval\n @param paint SkPaint stroke or fill, blend, color, and so on, used to draw\n */\n drawArc: (\n oval: SkRect,\n startAngle: number,\n sweepAngle: number,\n useCenter: boolean,\n paint: SkPaint\n ) => void;\n\n /**\n * Draws the given rectangle with rounded corners using the current clip, current matrix,\n * and the provided paint.\n * @param rrect\n * @param paint\n */\n drawRRect(rrect: InputRRect, paint: SkPaint): void;\n\n /**\n * Draws RRect outer and inner using clip, Matrix, and Paint paint.\n * outer must contain inner or the drawing is undefined.\n * @param outer\n * @param inner\n * @param paint\n */\n drawDRRect(outer: InputRRect, inner: InputRRect, paint: SkPaint): void;\n\n /**\n * Draws an oval bounded by the given rectangle using the current clip, current matrix,\n * and the provided paint.\n * @param oval\n * @param paint\n */\n drawOval(oval: SkRect, paint: SkPaint): void;\n\n /** Draws SkPath path using clip, SkMatrix, and SkPaint paint.\n SkPath contains an array of path contour, each of which may be open or closed.\n\n In paint: SkPaint::Style determines if SkRRect is stroked or filled:\n if filled, SkPath::FillType determines whether path contour describes inside or\n outside of fill; if stroked, SkPaint stroke width describes the line thickness,\n SkPaint::Cap describes line ends, and SkPaint::Join describes how\n corners are drawn.\n\n @param path SkPath to draw\n @param paint stroke, blend, color, and so on, used to draw\n\n example: https://fiddle.skia.org/c/@Canvas_drawPath\n */\n drawPath: (path: SkPath, paint: SkPaint) => void;\n\n /**\n * Draw the given text at the location (x, y) using the provided paint and font. The text will\n * be drawn as is; no shaping, left-to-right, etc.\n * @param str\n * @param x\n * @param y\n * @param paint\n * @param font\n */\n drawText(\n str: string,\n x: number,\n y: number,\n paint: SkPaint,\n font: SkFont\n ): void;\n\n /**\n * Draws the given TextBlob at (x, y) using the current clip, current matrix, and the\n * provided paint. Reminder that the fonts used to draw TextBlob are part of the blob.\n * @param blob\n * @param x\n * @param y\n * @param paint\n */\n drawTextBlob(blob: SkTextBlob, x: number, y: number, paint: SkPaint): void;\n\n /**\n * Draws a run of glyphs, at corresponding positions, in a given font.\n * @param glyphs the array of glyph IDs (Uint16TypedArray)\n * @param positions the array of x,y floats to position each glyph\n * @param x x-coordinate of the origin of the entire run\n * @param y y-coordinate of the origin of the entire run\n * @param font the font that contains the glyphs\n * @param paint\n */\n drawGlyphs(\n glyphs: number[],\n positions: SkPoint[],\n x: number,\n y: number,\n font: SkFont,\n paint: SkPaint\n ): void;\n\n /**\n * Renders the SVG Dom object to the canvas. If width/height are omitted,\n * the SVG will be rendered to fit the canvas.\n */\n drawSvg: (svgDom: SkSVG, width?: number, height?: number) => void;\n /** Saves SkMatrix and clip.\n Calling restore() discards changes to SkMatrix and clip,\n restoring the SkMatrix and clip to their state when save() was called.\n\n SkMatrix may be changed by translate(), scale(), rotate(), skew(), concat(), setMatrix(),\n and resetMatrix(). Clip may be changed by clipRect(), clipRRect(), clipPath(), clipRegion().\n\n Saved SkCanvas state is put on a stack; multiple calls to save() should be balance\n by an equal number of calls to restore().\n\n Call restoreToCount() with result to restore this and subsequent saves.\n\n @return depth of saved stack\n\n example: https://fiddle.skia.org/c/@Canvas_save\n */\n save: () => number;\n\n /**\n * Saves Matrix and clip, and allocates a SkBitmap for subsequent drawing.\n * Calling restore() discards changes to Matrix and clip, and draws the SkBitmap.\n * It returns the height of the stack.\n * See Canvas.h for more.\n * @param paint\n * @param bounds\n * @param backdrop\n * @param flags\n */\n saveLayer(\n paint?: SkPaint,\n bounds?: SkRect | null,\n backdrop?: SkImageFilter | null,\n flags?: SaveLayerFlag\n ): number;\n\n /** Removes changes to SkMatrix and clip since SkCanvas state was\n last saved. The state is removed from the stack.\n\n Does nothing if the stack is empty.\n\n example: https://fiddle.skia.org/c/@AutoCanvasRestore_restore\n\n example: https://fiddle.skia.org/c/@Canvas_restore\n */\n restore: () => void;\n\n /**\n * Rotates the current matrix by the number of degrees.\n * @param rot - angle of rotation in degrees.\n * @param rx\n * @param ry\n */\n rotate(rotationInDegrees: number, rx: number, ry: number): void;\n\n /**\n * Scales the current matrix by sx on the x-axis and sy on the y-axis.\n * @param sx\n * @param sy\n */\n scale(sx: number, sy: number): void;\n\n /**\n * Skews Matrix by sx on the x-axis and sy on the y-axis. A positive value of sx\n * skews the drawing right as y-axis values increase; a positive value of sy skews\n * the drawing down as x-axis values increase.\n * @param sx\n * @param sy\n */\n skew(sx: number, sy: number): void;\n\n /**\n * Translates Matrix by dx along the x-axis and dy along the y-axis.\n * @param dx\n * @param dy\n */\n translate(dx: number, dy: number): void;\n\n /**\n * Fills clip with the given color.\n * @param color\n * @param blendMode - defaults to SrcOver.\n */\n drawColor(color: SkColor, blendMode?: BlendMode): void;\n\n /**\n * Fills the current clip with the given color using Src BlendMode.\n * This has the effect of replacing all pixels contained by clip with color.\n * @param color\n */\n clear(color: SkColor): void;\n\n /**\n * Replaces clip with the intersection or difference of the current clip and path,\n * with an aliased or anti-aliased clip edge.\n * @param path\n * @param op\n * @param doAntiAlias\n */\n clipPath(path: SkPath, op: ClipOp, doAntiAlias: boolean): void;\n\n /**\n * Replaces clip with the intersection or difference of the current clip and rect,\n * with an aliased or anti-aliased clip edge.\n * @param rect\n * @param op\n * @param doAntiAlias\n */\n clipRect(rect: SkRect, op: ClipOp, doAntiAlias: boolean): void;\n\n /**\n * Replaces clip with the intersection or difference of the current clip and rrect,\n * with an aliased or anti-aliased clip edge.\n * @param rrect\n * @param op\n * @param doAntiAlias\n */\n clipRRect(rrect: InputRRect, op: ClipOp, doAntiAlias: boolean): void;\n\n /**\n * Replaces current matrix with m premultiplied with the existing matrix.\n * @param m\n */\n concat(m: InputMatrix): void;\n\n /**\n * Draws the given picture using the current clip, current matrix, and the provided paint.\n * @param skp\n */\n drawPicture(skp: SkPicture): void;\n\n /** Read Image pixels\n *\n * @param srcX - x-axis upper left corner of the rectangle to read from\n * @param srcY - y-axis upper left corner of the rectangle to read from\n * @param imageInfo - describes the pixel format and dimensions of the data to read into\n * @return Float32Array or Uint8Array with data or null if the read failed.\n */\n readPixels(\n srcX: number,\n srcY: number,\n imageInfo: ImageInfo\n ): Float32Array | Uint8Array | null;\n}\n"],"mappings":";;;;;;IAgBYA,M;;;WAAAA,M;EAAAA,M,CAAAA,M;EAAAA,M,CAAAA,M;GAAAA,M,sBAAAA,M;;IAKAC,a;;;WAAAA,a;EAAAA,a,CAAAA,a;EAAAA,a,CAAAA,a;GAAAA,a,6BAAAA,a"}
@@ -4,6 +4,7 @@ type Point = {
4
4
  };
5
5
  type Vec2 = readonly [number, number];
6
6
  type Vec3 = readonly [number, number, number];
7
+ type Vec4 = readonly [number, number, number, number];
7
8
  export type Matrix3 = readonly [
8
9
  number,
9
10
  number,
@@ -51,6 +52,10 @@ export declare const translate: (x: number, y: number, z?: number) => Matrix4;
51
52
  * @worklet
52
53
  */
53
54
  export declare const perspective: (p: number) => Matrix4;
55
+ /**
56
+ * @worklet
57
+ */
58
+ export declare const matrixVecMul4: (m: Matrix4, v: Vec4) => Vec4;
54
59
  /**
55
60
  * @worklet
56
61
  */
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.translate = exports.toMatrix3 = exports.scale = exports.rotateZ = exports.rotateY = exports.rotateX = exports.processTransform3d = exports.pivot = exports.perspective = exports.multiply4 = exports.mapPoint3d = exports.convertToColumnMajor = exports.convertToAffineMatrix = exports.Matrix4 = void 0;
6
+ exports.translate = exports.toMatrix3 = exports.scale = exports.rotateZ = exports.rotateY = exports.rotateX = exports.processTransform3d = exports.pivot = exports.perspective = exports.multiply4 = exports.matrixVecMul4 = exports.mapPoint3d = exports.convertToColumnMajor = exports.convertToAffineMatrix = exports.Matrix4 = void 0;
7
7
 
8
8
  const exhaustiveCheck = a => {
9
9
  "worklet";
@@ -72,18 +72,23 @@ const rotatedUnitSinCos = (axisVec, sinAngle, cosAngle) => {
72
72
  const t = 1 - c;
73
73
  return [t * x * x + c, t * x * y - s * z, t * x * z + s * y, 0, t * x * y + s * z, t * y * y + c, t * y * z - s * x, 0, t * x * z - s * y, t * y * z + s * x, t * z * z + c, 0, 0, 0, 0, 1];
74
74
  };
75
+ /**
76
+ * @worklet
77
+ */
78
+
75
79
 
76
80
  const matrixVecMul4 = (m, v) => {
77
81
  "worklet";
78
82
 
79
- const [vx, vy, vz, vw] = v;
80
- return [vx * m[0] + vy * m[4] + vz * m[8] + vw * m[12], vx * m[1] + vy * m[5] + vz * m[9] + vw * m[13], vx * m[2] + vy * m[6] + vz * m[10] + vw * m[14], vx * m[3] + vy * m[7] + vz * m[11] + vw * m[15]];
83
+ return [m[0] * v[0] + m[1] * v[1] + m[2] * v[2] + m[3] * v[3], m[4] * v[0] + m[5] * v[1] + m[6] * v[2] + m[7] * v[3], m[8] * v[0] + m[9] * v[1] + m[10] * v[2] + m[11] * v[3], m[12] * v[0] + m[13] * v[1] + m[14] * v[2] + m[15] * v[3]];
81
84
  };
82
85
  /**
83
86
  * @worklet
84
87
  */
85
88
 
86
89
 
90
+ exports.matrixVecMul4 = matrixVecMul4;
91
+
87
92
  const mapPoint3d = (m, v) => {
88
93
  "worklet";
89
94
 
@@ -1 +1 @@
1
- {"version":3,"names":["exhaustiveCheck","a","Error","Matrix4","translate","x","y","z","perspective","p","normalizeVec","vec","length","Math","sqrt","rotatedUnitSinCos","axisVec","sinAngle","cosAngle","c","s","t","matrixVecMul4","m","v","vx","vy","vz","vw","mapPoint3d","r","multiply4","b","result","Array","fill","i","j","skewY","angle","tan","skewX","toMatrix3","rotate","axis","value","sin","cos","pivot","scale","sx","sy","sz","m4","rotateAxis","rotateZ","rotateX","rotateY","processTransform3d","transforms","reduce","acc","val","key","Object","keys","transform","convertToColumnMajor","rowMajorMatrix","colMajorMatrix","size","row","col","convertToAffineMatrix","d","tx","ty"],"sources":["Matrix4.ts"],"sourcesContent":["type Point = { x: number; y: number };\ntype Vec2 = readonly [number, number];\ntype Vec3 = readonly [number, number, number];\ntype Vec4 = readonly [number, number, number, number];\n\nexport type Matrix3 = readonly [\n number,\n number,\n number,\n number,\n number,\n number,\n number,\n number,\n number\n];\n\nexport type Matrix4 = readonly [\n number,\n number,\n number,\n number,\n number,\n number,\n number,\n number,\n number,\n number,\n number,\n number,\n number,\n number,\n number,\n number\n];\n\ntype Transform3dName =\n | \"translateX\"\n | \"translateY\"\n | \"translateZ\"\n | \"translate\"\n | \"scale\"\n | \"scaleX\"\n | \"scaleY\"\n | \"skewX\"\n | \"skewY\"\n | \"rotateZ\"\n | \"rotate\"\n | \"perspective\"\n | \"rotateX\"\n | \"rotateY\"\n | \"matrix\";\n\ntype Transformations = {\n [Name in Transform3dName]: Name extends \"matrix\"\n ? Matrix4\n : Name extends \"translate\"\n ? Vec3 | Vec2\n : number;\n};\n\ntype Transform3d =\n | Pick<Transformations, \"translateX\">\n | Pick<Transformations, \"translateY\">\n | Pick<Transformations, \"translateZ\">\n | Pick<Transformations, \"translate\">\n | Pick<Transformations, \"scale\">\n | Pick<Transformations, \"scaleX\">\n | Pick<Transformations, \"scaleY\">\n | Pick<Transformations, \"skewX\">\n | Pick<Transformations, \"skewY\">\n | Pick<Transformations, \"perspective\">\n | Pick<Transformations, \"rotateX\">\n | Pick<Transformations, \"rotateY\">\n | Pick<Transformations, \"rotateZ\">\n | Pick<Transformations, \"rotate\">\n | Pick<Transformations, \"matrix\">;\n\nexport type Transforms3d = Transform3d[];\n\nconst exhaustiveCheck = (a: never): never => {\n \"worklet\";\n throw new Error(`Unexhaustive handling for ${a}`);\n};\n\n/**\n * @worklet\n */\nexport const Matrix4 = (): Matrix4 => {\n \"worklet\";\n return [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];\n};\n\n/**\n * @worklet\n */\nexport const translate = (x: number, y: number, z: number = 0): Matrix4 => {\n \"worklet\";\n return [1, 0, 0, x, 0, 1, 0, y, 0, 0, 1, z, 0, 0, 0, 1];\n};\n\n/**\n * @worklet\n */\nexport const perspective = (p: number): Matrix4 => {\n \"worklet\";\n return [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, -1 / p, 1];\n};\n\nconst normalizeVec = (vec: Vec3): Vec3 => {\n \"worklet\";\n const [x, y, z] = vec;\n const length = Math.sqrt(x * x + y * y + z * z);\n // Check for zero length to avoid division by zero\n if (length === 0) {\n return [0, 0, 0];\n }\n return [x / length, y / length, z / length];\n};\n\nconst rotatedUnitSinCos = (\n axisVec: Vec3,\n sinAngle: number,\n cosAngle: number\n): Matrix4 => {\n \"worklet\";\n const x = axisVec[0];\n const y = axisVec[1];\n const z = axisVec[2];\n const c = cosAngle;\n const s = sinAngle;\n const t = 1 - c;\n return [\n t * x * x + c,\n t * x * y - s * z,\n t * x * z + s * y,\n 0,\n t * x * y + s * z,\n t * y * y + c,\n t * y * z - s * x,\n 0,\n t * x * z - s * y,\n t * y * z + s * x,\n t * z * z + c,\n 0,\n 0,\n 0,\n 0,\n 1,\n ];\n};\n\nconst matrixVecMul4 = (m: Matrix4, v: Vec4) => {\n \"worklet\";\n const [vx, vy, vz, vw] = v;\n return [\n vx * m[0] + vy * m[4] + vz * m[8] + vw * m[12],\n vx * m[1] + vy * m[5] + vz * m[9] + vw * m[13],\n vx * m[2] + vy * m[6] + vz * m[10] + vw * m[14],\n vx * m[3] + vy * m[7] + vz * m[11] + vw * m[15],\n ];\n};\n\n/**\n * @worklet\n */\nexport const mapPoint3d = (m: Matrix4, v: Vec3) => {\n \"worklet\";\n const r = matrixVecMul4(m, [...v, 1]);\n return [r[0] / r[3], r[1] / r[3], r[2] / r[3]] as const;\n};\n\n/**\n * @worklet\n */\nexport const multiply4 = (a: Matrix4, b: Matrix4): Matrix4 => {\n \"worklet\";\n const result = new Array(16).fill(0);\n for (let i = 0; i < 4; i++) {\n for (let j = 0; j < 4; j++) {\n result[i * 4 + j] =\n a[i * 4] * b[j] +\n a[i * 4 + 1] * b[j + 4] +\n a[i * 4 + 2] * b[j + 8] +\n a[i * 4 + 3] * b[j + 12];\n }\n }\n return result as unknown as Matrix4;\n};\n\nconst skewY = (angle: number): Matrix4 => {\n \"worklet\";\n return [1, Math.tan(angle), 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];\n};\n\nconst skewX = (angle: number): Matrix4 => {\n \"worklet\";\n return [1, 0, 0, 0, Math.tan(angle), 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];\n};\n\n/**\n * @worklet\n */\nexport const toMatrix3 = (m: Matrix4) => {\n \"worklet\";\n return [m[0], m[1], m[3], m[4], m[5], m[7], m[12], m[13], m[15]];\n};\n\nconst rotate = (axis: Vec3, value: number) => {\n \"worklet\";\n return rotatedUnitSinCos(\n normalizeVec(axis),\n Math.sin(value),\n Math.cos(value)\n );\n};\n\n/**\n * @worklet\n */\nexport const pivot = (m: Matrix4, p: Point) => {\n \"worklet\";\n return multiply4(translate(p.x, p.y), multiply4(m, translate(-p.x, -p.y)));\n};\n\n/**\n * @worklet\n */\nexport const scale = (\n sx: number,\n sy: number,\n sz: number = 1,\n p?: Point\n): Matrix4 => {\n \"worklet\";\n const m4: Matrix4 = [sx, 0, 0, 0, 0, sy, 0, 0, 0, 0, sz, 0, 0, 0, 0, 1];\n if (p) {\n return pivot(m4, p);\n }\n return m4;\n};\n\nconst rotateAxis = (axis: Vec3, angle: number, p?: Point) => {\n \"worklet\";\n const result = rotate(axis, angle);\n if (p) {\n return pivot(result, p);\n }\n return result;\n};\n\n/**\n * @worklet\n */\nexport const rotateZ = (value: number, p?: Point) => {\n \"worklet\";\n return rotateAxis([0, 0, 1], value, p);\n};\n\n/**\n * @worklet\n */\nexport const rotateX = (value: number, p?: Point) => {\n \"worklet\";\n return rotateAxis([1, 0, 0], value, p);\n};\n\n/**\n * @worklet\n */\nexport const rotateY = (value: number, p?: Point) => {\n \"worklet\";\n return rotateAxis([0, 1, 0], value, p);\n};\n\n/**\n * @worklet\n */\nexport const processTransform3d = (transforms: Transforms3d) => {\n \"worklet\";\n return transforms.reduce((acc, val) => {\n const key = Object.keys(val)[0] as Transform3dName;\n const transform = val as Pick<Transformations, typeof key>;\n if (key === \"translateX\") {\n const value = transform[key];\n return multiply4(acc, translate(value, 0, 0));\n }\n if (key === \"translate\") {\n const [x, y, z = 0] = transform[key];\n return multiply4(acc, translate(x, y, z));\n }\n if (key === \"translateY\") {\n const value = transform[key];\n return multiply4(acc, translate(0, value, 0));\n }\n if (key === \"translateZ\") {\n const value = transform[key];\n return multiply4(acc, translate(0, 0, value));\n }\n if (key === \"scale\") {\n const value = transform[key];\n return multiply4(acc, scale(value, value, 1));\n }\n if (key === \"scaleX\") {\n const value = transform[key];\n return multiply4(acc, scale(value, 1, 1));\n }\n if (key === \"scaleY\") {\n const value = transform[key];\n return multiply4(acc, scale(1, value, 1));\n }\n if (key === \"skewX\") {\n const value = transform[key];\n return multiply4(acc, skewX(value));\n }\n if (key === \"skewY\") {\n const value = transform[key];\n return multiply4(acc, skewY(value));\n }\n if (key === \"rotateX\") {\n const value = transform[key];\n return multiply4(acc, rotate([1, 0, 0], value));\n }\n if (key === \"rotateY\") {\n const value = transform[key];\n return multiply4(acc, rotate([0, 1, 0], value));\n }\n if (key === \"perspective\") {\n const value = transform[key];\n return multiply4(acc, perspective(value));\n }\n if (key === \"rotate\" || key === \"rotateZ\") {\n const value = transform[key];\n return multiply4(acc, rotate([0, 0, 1], value));\n }\n if (key === \"matrix\") {\n const value = transform[key];\n return multiply4(acc, value);\n }\n return exhaustiveCheck(key);\n }, Matrix4());\n};\n\n/**\n * @worklet\n */\nexport const convertToColumnMajor = (rowMajorMatrix: Matrix4) => {\n \"worklet\";\n\n const colMajorMatrix = new Array<number>(16);\n const size = 4;\n for (let row = 0; row < size; row++) {\n for (let col = 0; col < size; col++) {\n colMajorMatrix[col * size + row] = rowMajorMatrix[row * size + col];\n }\n }\n return colMajorMatrix;\n};\n\n/**\n * @worklet\n */\nexport const convertToAffineMatrix = (m4: number[]) => {\n \"worklet\";\n // Extracting the relevant components from the 4x4 matrix\n const a = m4[0]; // Scale X\n const b = m4[1]; // Skew Y\n const c = m4[4]; // Skew X\n const d = m4[5]; // Scale Y\n const tx = m4[12]; // Translate X\n const ty = m4[13]; // Translate Y\n\n // Returning the 6-element affine transformation matrix\n return [a, b, c, d, tx, ty];\n};\n"],"mappings":";;;;;;;AAgFA,MAAMA,eAAe,GAAIC,CAAD,IAAqB;EAC3C;;EACA,MAAM,IAAIC,KAAJ,CAAW,6BAA4BD,CAAE,EAAzC,CAAN;AACD,CAHD;AAKA;AACA;AACA;;;AACO,MAAME,OAAO,GAAG,MAAe;EACpC;;EACA,OAAO,CAAC,CAAD,EAAI,CAAJ,EAAO,CAAP,EAAU,CAAV,EAAa,CAAb,EAAgB,CAAhB,EAAmB,CAAnB,EAAsB,CAAtB,EAAyB,CAAzB,EAA4B,CAA5B,EAA+B,CAA/B,EAAkC,CAAlC,EAAqC,CAArC,EAAwC,CAAxC,EAA2C,CAA3C,EAA8C,CAA9C,CAAP;AACD,CAHM;AAKP;AACA;AACA;;;;;AACO,MAAMC,SAAS,GAAG,UAACC,CAAD,EAAYC,CA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AAC,CAAD,CAAZ,CAHqD,CAGpC;;EACjB,MAAMrB,CAAC,GAAGqB,EAAE,CAAC,CAAD,CAAZ,CAJqD,CAIpC;;EACjB,MAAMlC,CAAC,GAAGkC,EAAE,CAAC,CAAD,CAAZ,CALqD,CAKpC;;EACjB,MAAMqB,CAAC,GAAGrB,EAAE,CAAC,CAAD,CAAZ,CANqD,CAMpC;;EACjB,MAAMsB,EAAE,GAAGtB,EAAE,CAAC,EAAD,CAAb,CAPqD,CAOlC;;EACnB,MAAMuB,EAAE,GAAGvB,EAAE,CAAC,EAAD,CAAb,CARqD,CAQlC;EAEnB;;EACA,OAAO,CAACpD,CAAD,EAAI+B,CAAJ,EAAOb,CAAP,EAAUuD,CAAV,EAAaC,EAAb,EAAiBC,EAAjB,CAAP;AACD,CAZM"}
1
+ {"version":3,"names":["exhaustiveCheck","a","Error","Matrix4","translate","x","y","z","perspective","p","normalizeVec","vec","length","Math","sqrt","rotatedUnitSinCos","axisVec","sinAngle","cosAngle","c","s","t","matrixVecMul4","m","v","mapPoint3d","r","multiply4","b","result","Array","fill","i","j","skewY","angle","tan","skewX","toMatrix3","rotate","axis","value","sin","cos","pivot","scale","sx","sy","sz","m4","rotateAxis","rotateZ","rotateX","rotateY","processTransform3d","transforms","reduce","acc","val","key","Object","keys","transform","convertToColumnMajor","rowMajorMatrix","colMajorMatrix","size","row","col","convertToAffineMatrix","d","tx","ty"],"sources":["Matrix4.ts"],"sourcesContent":["type Point = { x: number; y: number };\ntype Vec2 = readonly [number, number];\ntype Vec3 = readonly [number, number, number];\ntype Vec4 = readonly [number, number, number, number];\n\nexport type Matrix3 = readonly [\n number,\n number,\n number,\n number,\n number,\n number,\n number,\n number,\n number\n];\n\nexport type Matrix4 = readonly [\n number,\n number,\n number,\n number,\n number,\n number,\n number,\n number,\n number,\n number,\n number,\n number,\n number,\n number,\n number,\n number\n];\n\ntype Transform3dName =\n | \"translateX\"\n | \"translateY\"\n | \"translateZ\"\n | \"translate\"\n | \"scale\"\n | \"scaleX\"\n | \"scaleY\"\n | \"skewX\"\n | \"skewY\"\n | \"rotateZ\"\n | \"rotate\"\n | \"perspective\"\n | \"rotateX\"\n | \"rotateY\"\n | \"matrix\";\n\ntype Transformations = {\n [Name in Transform3dName]: Name extends \"matrix\"\n ? Matrix4\n : Name extends \"translate\"\n ? Vec3 | Vec2\n : number;\n};\n\ntype Transform3d =\n | Pick<Transformations, \"translateX\">\n | Pick<Transformations, \"translateY\">\n | Pick<Transformations, \"translateZ\">\n | Pick<Transformations, \"translate\">\n | Pick<Transformations, \"scale\">\n | Pick<Transformations, \"scaleX\">\n | Pick<Transformations, \"scaleY\">\n | Pick<Transformations, \"skewX\">\n | Pick<Transformations, \"skewY\">\n | Pick<Transformations, \"perspective\">\n | Pick<Transformations, \"rotateX\">\n | Pick<Transformations, \"rotateY\">\n | Pick<Transformations, \"rotateZ\">\n | Pick<Transformations, \"rotate\">\n | Pick<Transformations, \"matrix\">;\n\nexport type Transforms3d = Transform3d[];\n\nconst exhaustiveCheck = (a: never): never => {\n \"worklet\";\n throw new Error(`Unexhaustive handling for ${a}`);\n};\n\n/**\n * @worklet\n */\nexport const Matrix4 = (): Matrix4 => {\n \"worklet\";\n return [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];\n};\n\n/**\n * @worklet\n */\nexport const translate = (x: number, y: number, z: number = 0): Matrix4 => {\n \"worklet\";\n return [1, 0, 0, x, 0, 1, 0, y, 0, 0, 1, z, 0, 0, 0, 1];\n};\n\n/**\n * @worklet\n */\nexport const perspective = (p: number): Matrix4 => {\n \"worklet\";\n return [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, -1 / p, 1];\n};\n\nconst normalizeVec = (vec: Vec3): Vec3 => {\n \"worklet\";\n const [x, y, z] = vec;\n const length = Math.sqrt(x * x + y * y + z * z);\n // Check for zero length to avoid division by zero\n if (length === 0) {\n return [0, 0, 0];\n }\n return [x / length, y / length, z / length];\n};\n\nconst rotatedUnitSinCos = (\n axisVec: Vec3,\n sinAngle: number,\n cosAngle: number\n): Matrix4 => {\n \"worklet\";\n const x = axisVec[0];\n const y = axisVec[1];\n const z = axisVec[2];\n const c = cosAngle;\n const s = sinAngle;\n const t = 1 - c;\n return [\n t * x * x + c,\n t * x * y - s * z,\n t * x * z + s * y,\n 0,\n t * x * y + s * z,\n t * y * y + c,\n t * y * z - s * x,\n 0,\n t * x * z - s * y,\n t * y * z + s * x,\n t * z * z + c,\n 0,\n 0,\n 0,\n 0,\n 1,\n ];\n};\n\n/**\n * @worklet\n */\nexport const matrixVecMul4 = (m: Matrix4, v: Vec4): Vec4 => {\n \"worklet\";\n return [\n m[0] * v[0] + m[1] * v[1] + m[2] * v[2] + m[3] * v[3],\n m[4] * v[0] + m[5] * v[1] + m[6] * v[2] + m[7] * v[3],\n m[8] * v[0] + m[9] * v[1] + m[10] * v[2] + m[11] * v[3],\n m[12] * v[0] + m[13] * v[1] + m[14] * v[2] + m[15] * v[3],\n ];\n};\n\n/**\n * @worklet\n */\nexport const mapPoint3d = (m: Matrix4, v: Vec3) => {\n \"worklet\";\n const r = matrixVecMul4(m, [...v, 1]);\n return [r[0] / r[3], r[1] / r[3], r[2] / r[3]] as const;\n};\n\n/**\n * @worklet\n */\nexport const multiply4 = (a: Matrix4, b: Matrix4): Matrix4 => {\n \"worklet\";\n const result = new Array(16).fill(0);\n for (let i = 0; i < 4; i++) {\n for (let j = 0; j < 4; j++) {\n result[i * 4 + j] =\n a[i * 4] * b[j] +\n a[i * 4 + 1] * b[j + 4] +\n a[i * 4 + 2] * b[j + 8] +\n a[i * 4 + 3] * b[j + 12];\n }\n }\n return result as unknown as Matrix4;\n};\n\nconst skewY = (angle: number): Matrix4 => {\n \"worklet\";\n return [1, Math.tan(angle), 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];\n};\n\nconst skewX = (angle: number): Matrix4 => {\n \"worklet\";\n return [1, 0, 0, 0, Math.tan(angle), 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];\n};\n\n/**\n * @worklet\n */\nexport const toMatrix3 = (m: Matrix4) => {\n \"worklet\";\n return [m[0], m[1], m[3], m[4], m[5], m[7], m[12], m[13], m[15]];\n};\n\nconst rotate = (axis: Vec3, value: number) => {\n \"worklet\";\n return rotatedUnitSinCos(\n normalizeVec(axis),\n Math.sin(value),\n Math.cos(value)\n );\n};\n\n/**\n * @worklet\n */\nexport const pivot = (m: Matrix4, p: Point) => {\n \"worklet\";\n return multiply4(translate(p.x, p.y), multiply4(m, translate(-p.x, -p.y)));\n};\n\n/**\n * @worklet\n */\nexport const scale = (\n sx: number,\n sy: number,\n sz: number = 1,\n p?: Point\n): Matrix4 => {\n \"worklet\";\n const m4: Matrix4 = [sx, 0, 0, 0, 0, sy, 0, 0, 0, 0, sz, 0, 0, 0, 0, 1];\n if (p) {\n return pivot(m4, p);\n }\n return m4;\n};\n\nconst rotateAxis = (axis: Vec3, angle: number, p?: Point) => {\n \"worklet\";\n const result = rotate(axis, angle);\n if (p) {\n return pivot(result, p);\n }\n return result;\n};\n\n/**\n * @worklet\n */\nexport const rotateZ = (value: number, p?: Point) => {\n \"worklet\";\n return rotateAxis([0, 0, 1], value, p);\n};\n\n/**\n * @worklet\n */\nexport const rotateX = (value: number, p?: Point) => {\n \"worklet\";\n return rotateAxis([1, 0, 0], value, p);\n};\n\n/**\n * @worklet\n */\nexport const rotateY = (value: number, p?: Point) => {\n \"worklet\";\n return rotateAxis([0, 1, 0], value, p);\n};\n\n/**\n * @worklet\n */\nexport const processTransform3d = (transforms: Transforms3d) => {\n \"worklet\";\n return transforms.reduce((acc, val) => {\n const key = Object.keys(val)[0] as Transform3dName;\n const transform = val as Pick<Transformations, typeof key>;\n if (key === \"translateX\") {\n const value = transform[key];\n return multiply4(acc, translate(value, 0, 0));\n }\n if (key === \"translate\") {\n const [x, y, z = 0] = transform[key];\n return multiply4(acc, translate(x, y, z));\n }\n if (key === \"translateY\") {\n const value = transform[key];\n return multiply4(acc, translate(0, value, 0));\n }\n if (key === \"translateZ\") {\n const value = transform[key];\n return multiply4(acc, translate(0, 0, value));\n }\n if (key === \"scale\") {\n const value = transform[key];\n return multiply4(acc, scale(value, value, 1));\n }\n if (key === \"scaleX\") {\n const value = transform[key];\n return multiply4(acc, scale(value, 1, 1));\n }\n if (key === \"scaleY\") {\n const value = transform[key];\n return multiply4(acc, scale(1, value, 1));\n }\n if (key === \"skewX\") {\n const value = transform[key];\n return multiply4(acc, skewX(value));\n }\n if (key === \"skewY\") {\n const value = transform[key];\n return multiply4(acc, skewY(value));\n }\n if (key === \"rotateX\") {\n const value = transform[key];\n return multiply4(acc, rotate([1, 0, 0], value));\n }\n if (key === \"rotateY\") {\n const value = transform[key];\n return multiply4(acc, rotate([0, 1, 0], value));\n }\n if (key === \"perspective\") {\n const value = transform[key];\n return multiply4(acc, perspective(value));\n }\n if (key === \"rotate\" || key === \"rotateZ\") {\n const value = transform[key];\n return multiply4(acc, rotate([0, 0, 1], value));\n }\n if (key === \"matrix\") {\n const value = transform[key];\n return multiply4(acc, value);\n }\n return exhaustiveCheck(key);\n }, Matrix4());\n};\n\n/**\n * @worklet\n */\nexport const convertToColumnMajor = (rowMajorMatrix: Matrix4) => {\n \"worklet\";\n\n const colMajorMatrix = new Array<number>(16);\n const size = 4;\n for (let row = 0; row < size; row++) {\n for (let col = 0; col < size; col++) {\n colMajorMatrix[col * size + row] = rowMajorMatrix[row * size + col];\n }\n }\n return colMajorMatrix;\n};\n\n/**\n * @worklet\n */\nexport const convertToAffineMatrix = (m4: number[]) => {\n \"worklet\";\n // Extracting the relevant components from the 4x4 matrix\n const a = m4[0]; // Scale X\n const b = m4[1]; // Skew Y\n const c = m4[4]; // Skew X\n const d = m4[5]; // Scale Y\n const tx = m4[12]; // Translate X\n const ty = m4[13]; // Translate Y\n\n // Returning the 6-element affine transformation matrix\n return [a, b, c, d, tx, ty];\n};\n"],"mappings":";;;;;;;AAgFA,MAAMA,eAA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from "../Canvas";
2
2
  import type { SkJSIInstance } from "../JsiInstance";
3
3
  import type { SkRect } from "../Rect";
4
- import type { SkTextDirection } from "./ParagraphStyle";
4
+ import type { TextDirection } from "./ParagraphStyle";
5
5
  export interface SkRectWithDirection {
6
6
  rect: SkRect;
7
- direction: SkTextDirection;
7
+ direction: TextDirection;
8
8
  }
9
9
  export interface SkParagraph extends SkJSIInstance<"Paragraph"> {
10
10
  /**
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["Paragraph.ts"],"sourcesContent":["import type { SkCanvas } from \"../Canvas\";\nimport type { SkJSIInstance } from \"../JsiInstance\";\nimport type { SkRect } from \"../Rect\";\n\nimport type { SkTextDirection } from \"./ParagraphStyle\";\n\nexport interface SkRectWithDirection {\n rect: SkRect;\n direction: SkTextDirection;\n}\n\nexport interface SkParagraph extends SkJSIInstance<\"Paragraph\"> {\n /**\n * Calculates the position of the the glyphs in the paragraph\n * @param width Max width of the paragraph\n */\n layout(width: number): void;\n /**\n * Paints the paragraph to the provded canvas\n * @param canvas Canvas to paint into\n * @param x X coordinate to paint at\n * @param y Y coordinate to paint at\n */\n paint(canvas: SkCanvas, x: number, y: number): void;\n /**\n * Returns the height of the paragraph. This method requires the layout\n * method to have been called first.\n */\n getHeight(): number;\n /**\n * Returns the max width of the paragraph. This method requires the layout\n * method to have been called first.\n */\n getMaxWidth(): number;\n /**\n * Returns the minimum intrinsic width of the paragraph.\n * The minimum intrinsic width is the width beyond which increasing the width of the paragraph\n * does not decrease the height. This is effectively the width at which the paragraph\n * can no longer wrap lines and is forced to overflow.\n * This method requires the layout method to have been called first.\n * @returns {number} The minimum intrinsic width of the paragraph.\n */\n getMinIntrinsicWidth(): number;\n /**\n * Returns the maximum intrinsic width of the paragraph.\n * The maximum intrinsic width is the width at which the paragraph can layout its content without line breaks,\n * meaning it's the width of the widest line or the widest word if the widest line is shorter than that.\n * This width represents the ideal width for the paragraph to display all content in a single line without overflow.\n * This method requires the layout method to have been called first.\n * @returns {number} The maximum intrinsic width of the paragraph.\n */\n getMaxIntrinsicWidth(): number;\n\n /**\n * Returns the width of the longest line in the paragraph.\n * This method requires the layout method to have been called first.\n */\n getLongestLine(): number;\n\n /**\n * Returns the index of the glyph at the given position. This method requires\n * the layout method to have been called first.\n * @param x X coordinate of the position\n * @param y Y coordinate of the position\n */\n getGlyphPositionAtCoordinate(x: number, y: number): number;\n /**\n * Returns the bounding boxes of the glyphs in the given range. This method\n * requires the layout method to have been called first.\n * @param start Start index of the range\n * @param end End index of the range\n */\n getRectsForRange(start: number, end: number): SkRect[];\n /**\n * Returns the bounding boxes for all lines in the paragraph. This method\n * requires the layout method to have been called first.\n */\n getLineMetrics(): Array<SkRect>;\n /**\n * Returns a list of rects with direction info for the placeholders added\n * to the paragraph.\n */\n getRectsForPlaceholders(): SkRectWithDirection[];\n}\n"],"mappings":""}
1
+ {"version":3,"names":[],"sources":["Paragraph.ts"],"sourcesContent":["import type { SkCanvas } from \"../Canvas\";\nimport type { SkJSIInstance } from \"../JsiInstance\";\nimport type { SkRect } from \"../Rect\";\n\nimport type { TextDirection } from \"./ParagraphStyle\";\n\nexport interface SkRectWithDirection {\n rect: SkRect;\n direction: TextDirection;\n}\n\nexport interface SkParagraph extends SkJSIInstance<\"Paragraph\"> {\n /**\n * Calculates the position of the the glyphs in the paragraph\n * @param width Max width of the paragraph\n */\n layout(width: number): void;\n /**\n * Paints the paragraph to the provded canvas\n * @param canvas Canvas to paint into\n * @param x X coordinate to paint at\n * @param y Y coordinate to paint at\n */\n paint(canvas: SkCanvas, x: number, y: number): void;\n /**\n * Returns the height of the paragraph. This method requires the layout\n * method to have been called first.\n */\n getHeight(): number;\n /**\n * Returns the max width of the paragraph. This method requires the layout\n * method to have been called first.\n */\n getMaxWidth(): number;\n /**\n * Returns the minimum intrinsic width of the paragraph.\n * The minimum intrinsic width is the width beyond which increasing the width of the paragraph\n * does not decrease the height. This is effectively the width at which the paragraph\n * can no longer wrap lines and is forced to overflow.\n * This method requires the layout method to have been called first.\n * @returns {number} The minimum intrinsic width of the paragraph.\n */\n getMinIntrinsicWidth(): number;\n /**\n * Returns the maximum intrinsic width of the paragraph.\n * The maximum intrinsic width is the width at which the paragraph can layout its content without line breaks,\n * meaning it's the width of the widest line or the widest word if the widest line is shorter than that.\n * This width represents the ideal width for the paragraph to display all content in a single line without overflow.\n * This method requires the layout method to have been called first.\n * @returns {number} The maximum intrinsic width of the paragraph.\n */\n getMaxIntrinsicWidth(): number;\n\n /**\n * Returns the width of the longest line in the paragraph.\n * This method requires the layout method to have been called first.\n */\n getLongestLine(): number;\n\n /**\n * Returns the index of the glyph at the given position. This method requires\n * the layout method to have been called first.\n * @param x X coordinate of the position\n * @param y Y coordinate of the position\n */\n getGlyphPositionAtCoordinate(x: number, y: number): number;\n /**\n * Returns the bounding boxes of the glyphs in the given range. This method\n * requires the layout method to have been called first.\n * @param start Start index of the range\n * @param end End index of the range\n */\n getRectsForRange(start: number, end: number): SkRect[];\n /**\n * Returns the bounding boxes for all lines in the paragraph. This method\n * requires the layout method to have been called first.\n */\n getLineMetrics(): Array<SkRect>;\n /**\n * Returns a list of rects with direction info for the placeholders added\n * to the paragraph.\n */\n getRectsForPlaceholders(): SkRectWithDirection[];\n}\n"],"mappings":""}
@@ -1,9 +1,9 @@
1
1
  import type { SkTextFontStyle, SkTextStyle } from "./TextStyle";
2
- export declare enum SkTextDirection {
2
+ export declare enum TextDirection {
3
3
  RTL = 0,
4
4
  LTR = 1
5
5
  }
6
- export declare enum SkTextAlign {
6
+ export declare enum TextAlign {
7
7
  Left = 0,
8
8
  Right = 1,
9
9
  Center = 2,
@@ -21,7 +21,7 @@ export interface SkStrutStyle {
21
21
  leading?: number;
22
22
  forceStrutHeight?: boolean;
23
23
  }
24
- export declare enum SkTextHeightBehavior {
24
+ export declare enum TextHeightBehavior {
25
25
  All = 0,
26
26
  DisableFirstAscent = 1,
27
27
  DisableLastDescent = 2,
@@ -34,8 +34,8 @@ export interface SkParagraphStyle {
34
34
  maxLines?: number;
35
35
  replaceTabCharacters?: boolean;
36
36
  strutStyle?: SkStrutStyle;
37
- textAlign?: SkTextAlign;
38
- textDirection?: SkTextDirection;
39
- textHeightBehavior?: SkTextHeightBehavior;
37
+ textAlign?: TextAlign;
38
+ textDirection?: TextDirection;
39
+ textHeightBehavior?: TextHeightBehavior;
40
40
  textStyle?: SkTextStyle;
41
41
  }
@@ -3,34 +3,34 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.SkTextHeightBehavior = exports.SkTextDirection = exports.SkTextAlign = void 0;
7
- let SkTextDirection;
8
- exports.SkTextDirection = SkTextDirection;
6
+ exports.TextHeightBehavior = exports.TextDirection = exports.TextAlign = void 0;
7
+ let TextDirection;
8
+ exports.TextDirection = TextDirection;
9
9
 
10
- (function (SkTextDirection) {
11
- SkTextDirection[SkTextDirection["RTL"] = 0] = "RTL";
12
- SkTextDirection[SkTextDirection["LTR"] = 1] = "LTR";
13
- })(SkTextDirection || (exports.SkTextDirection = SkTextDirection = {}));
10
+ (function (TextDirection) {
11
+ TextDirection[TextDirection["RTL"] = 0] = "RTL";
12
+ TextDirection[TextDirection["LTR"] = 1] = "LTR";
13
+ })(TextDirection || (exports.TextDirection = TextDirection = {}));
14
14
 
15
- let SkTextAlign;
16
- exports.SkTextAlign = SkTextAlign;
15
+ let TextAlign;
16
+ exports.TextAlign = TextAlign;
17
17
 
18
- (function (SkTextAlign) {
19
- SkTextAlign[SkTextAlign["Left"] = 0] = "Left";
20
- SkTextAlign[SkTextAlign["Right"] = 1] = "Right";
21
- SkTextAlign[SkTextAlign["Center"] = 2] = "Center";
22
- SkTextAlign[SkTextAlign["Justify"] = 3] = "Justify";
23
- SkTextAlign[SkTextAlign["Start"] = 4] = "Start";
24
- SkTextAlign[SkTextAlign["End"] = 5] = "End";
25
- })(SkTextAlign || (exports.SkTextAlign = SkTextAlign = {}));
18
+ (function (TextAlign) {
19
+ TextAlign[TextAlign["Left"] = 0] = "Left";
20
+ TextAlign[TextAlign["Right"] = 1] = "Right";
21
+ TextAlign[TextAlign["Center"] = 2] = "Center";
22
+ TextAlign[TextAlign["Justify"] = 3] = "Justify";
23
+ TextAlign[TextAlign["Start"] = 4] = "Start";
24
+ TextAlign[TextAlign["End"] = 5] = "End";
25
+ })(TextAlign || (exports.TextAlign = TextAlign = {}));
26
26
 
27
- let SkTextHeightBehavior;
28
- exports.SkTextHeightBehavior = SkTextHeightBehavior;
27
+ let TextHeightBehavior;
28
+ exports.TextHeightBehavior = TextHeightBehavior;
29
29
 
30
- (function (SkTextHeightBehavior) {
31
- SkTextHeightBehavior[SkTextHeightBehavior["All"] = 0] = "All";
32
- SkTextHeightBehavior[SkTextHeightBehavior["DisableFirstAscent"] = 1] = "DisableFirstAscent";
33
- SkTextHeightBehavior[SkTextHeightBehavior["DisableLastDescent"] = 2] = "DisableLastDescent";
34
- SkTextHeightBehavior[SkTextHeightBehavior["DisableAll"] = 3] = "DisableAll";
35
- })(SkTextHeightBehavior || (exports.SkTextHeightBehavior = SkTextHeightBehavior = {}));
30
+ (function (TextHeightBehavior) {
31
+ TextHeightBehavior[TextHeightBehavior["All"] = 0] = "All";
32
+ TextHeightBehavior[TextHeightBehavior["DisableFirstAscent"] = 1] = "DisableFirstAscent";
33
+ TextHeightBehavior[TextHeightBehavior["DisableLastDescent"] = 2] = "DisableLastDescent";
34
+ TextHeightBehavior[TextHeightBehavior["DisableAll"] = 3] = "DisableAll";
35
+ })(TextHeightBehavior || (exports.TextHeightBehavior = TextHeightBehavior = {}));
36
36
  //# sourceMappingURL=ParagraphStyle.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["SkTextDirection","SkTextAlign","SkTextHeightBehavior"],"sources":["ParagraphStyle.ts"],"sourcesContent":["import type { SkTextFontStyle, SkTextStyle } from \"./TextStyle\";\n\nexport enum SkTextDirection {\n RTL = 0,\n LTR = 1,\n}\nexport enum SkTextAlign {\n Left = 0,\n Right,\n Center,\n Justify,\n Start,\n End,\n}\n\nexport interface SkStrutStyle {\n strutEnabled?: boolean;\n fontFamilies?: string[];\n fontStyle?: SkTextFontStyle;\n fontSize?: number;\n heightMultiplier?: number;\n halfLeading?: boolean;\n leading?: number;\n forceStrutHeight?: boolean;\n}\n\nexport enum SkTextHeightBehavior {\n All = 0x0,\n DisableFirstAscent = 0x1,\n DisableLastDescent = 0x2,\n DisableAll = 0x1 | 0x2,\n}\n\nexport interface SkParagraphStyle {\n disableHinting?: boolean;\n ellipsis?: string;\n heightMultiplier?: number;\n maxLines?: number;\n replaceTabCharacters?: boolean;\n strutStyle?: SkStrutStyle;\n textAlign?: SkTextAlign;\n textDirection?: SkTextDirection;\n textHeightBehavior?: SkTextHeightBehavior;\n textStyle?: SkTextStyle;\n}\n"],"mappings":";;;;;;IAEYA,e;;;WAAAA,e;EAAAA,e,CAAAA,e;EAAAA,e,CAAAA,e;GAAAA,e,+BAAAA,e;;IAIAC,W;;;WAAAA,W;EAAAA,W,CAAAA,W;EAAAA,W,CAAAA,W;EAAAA,W,CAAAA,W;EAAAA,W,CAAAA,W;EAAAA,W,CAAAA,W;EAAAA,W,CAAAA,W;GAAAA,W,2BAAAA,W;;IAoBAC,oB;;;WAAAA,oB;EAAAA,oB,CAAAA,oB;EAAAA,oB,CAAAA,oB;EAAAA,oB,CAAAA,oB;EAAAA,oB,CAAAA,oB;GAAAA,oB,oCAAAA,oB"}
1
+ {"version":3,"names":["TextDirection","TextAlign","TextHeightBehavior"],"sources":["ParagraphStyle.ts"],"sourcesContent":["import type { SkTextFontStyle, SkTextStyle } from \"./TextStyle\";\n\nexport enum TextDirection {\n RTL = 0,\n LTR = 1,\n}\nexport enum TextAlign {\n Left = 0,\n Right,\n Center,\n Justify,\n Start,\n End,\n}\n\nexport interface SkStrutStyle {\n strutEnabled?: boolean;\n fontFamilies?: string[];\n fontStyle?: SkTextFontStyle;\n fontSize?: number;\n heightMultiplier?: number;\n halfLeading?: boolean;\n leading?: number;\n forceStrutHeight?: boolean;\n}\n\nexport enum TextHeightBehavior {\n All = 0x0,\n DisableFirstAscent = 0x1,\n DisableLastDescent = 0x2,\n DisableAll = 0x1 | 0x2,\n}\n\nexport interface SkParagraphStyle {\n disableHinting?: boolean;\n ellipsis?: string;\n heightMultiplier?: number;\n maxLines?: number;\n replaceTabCharacters?: boolean;\n strutStyle?: SkStrutStyle;\n textAlign?: TextAlign;\n textDirection?: TextDirection;\n textHeightBehavior?: TextHeightBehavior;\n textStyle?: SkTextStyle;\n}\n"],"mappings":";;;;;;IAEYA,a;;;WAAAA,a;EAAAA,a,CAAAA,a;EAAAA,a,CAAAA,a;GAAAA,a,6BAAAA,a;;IAIAC,S;;;WAAAA,S;EAAAA,S,CAAAA,S;EAAAA,S,CAAAA,S;EAAAA,S,CAAAA,S;EAAAA,S,CAAAA,S;EAAAA,S,CAAAA,S;EAAAA,S,CAAAA,S;GAAAA,S,yBAAAA,S;;IAoBAC,kB;;;WAAAA,kB;EAAAA,kB,CAAAA,kB;EAAAA,kB,CAAAA,kB;EAAAA,kB,CAAAA,kB;EAAAA,kB,CAAAA,kB;GAAAA,kB,kCAAAA,kB"}
@@ -1,6 +1,6 @@
1
1
  import type { SkRect } from "../Rect";
2
2
  import type { SkPoint } from "../Point";
3
- import type { SkRRect } from "../RRect";
3
+ import type { InputRRect } from "../RRect";
4
4
  import type { StrokeJoin, StrokeCap } from "../Paint";
5
5
  import type { InputMatrix, SkMatrix } from "../Matrix";
6
6
  import type { SkJSIInstance } from "../JsiInstance";
@@ -347,7 +347,7 @@ export interface SkPath extends SkJSIInstance<"Path"> {
347
347
  * @param rrect
348
348
  * @param isCCW
349
349
  */
350
- addRRect(rrect: SkRRect, isCCW?: boolean): SkPath;
350
+ addRRect(rrect: InputRRect, isCCW?: boolean): SkPath;
351
351
  /** Appends src to SkPath, transformed by matrix. Transformed curves may have
352
352
  different verbs, SkPoint, and conic weights.
353
353
 
@@ -1 +1 @@
1
- {"version":3,"names":["FillType","PathOp","PathVerb","isPath","obj","__typename__"],"sources":["Path.ts"],"sourcesContent":["import type { SkRect } from \"../Rect\";\nimport type { SkPoint } from \"../Point\";\nimport type { SkRRect } 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 obj !== null && obj.__typename__ === \"Path\";\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: SkRRect, 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;IAcYA,Q;;;WAAAA,Q;EAAAA,Q,CAAAA,Q;EAAAA,Q,CAAAA,Q;EAAAA,Q,CAAAA,Q;EAAAA,Q,CAAAA,Q;GAAAA,Q,wBAAAA,Q;;IAOAC,M;;;WAAAA,M;EAAAA,M,CAAAA,M;EAAAA,M,CAAAA,M;EAAAA,M,CAAAA,M;EAAAA,M,CAAAA,M;EAAAA,M,CAAAA,M;GAAAA,M,sBAAAA,M;;IAQAC,Q;;;WAAAA,Q;EAAAA,Q,CAAAA,Q;EAAAA,Q,CAAAA,Q;EAAAA,Q,CAAAA,Q;EAAAA,Q,CAAAA,Q;EAAAA,Q,CAAAA,Q;EAAAA,Q,CAAAA,Q;GAAAA,Q,wBAAAA,Q;;AAWL,MAAMC,MAAM,GAAIC,GAAD,IACpBA,GAAG,KAAK,IAAR,IAAgBA,GAAG,CAACC,YAAJ,KAAqB,MADhC"}
1
+ {"version":3,"names":["FillType","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 obj !== null && obj.__typename__ === \"Path\";\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;IAcYA,Q;;;WAAAA,Q;EAAAA,Q,CAAAA,Q;EAAAA,Q,CAAAA,Q;EAAAA,Q,CAAAA,Q;EAAAA,Q,CAAAA,Q;GAAAA,Q,wBAAAA,Q;;IAOAC,M;;;WAAAA,M;EAAAA,M,CAAAA,M;EAAAA,M,CAAAA,M;EAAAA,M,CAAAA,M;EAAAA,M,CAAAA,M;EAAAA,M,CAAAA,M;GAAAA,M,sBAAAA,M;;IAQAC,Q;;;WAAAA,Q;EAAAA,Q,CAAAA,Q;EAAAA,Q,CAAAA,Q;EAAAA,Q,CAAAA,Q;EAAAA,Q,CAAAA,Q;EAAAA,Q,CAAAA,Q;EAAAA,Q,CAAAA,Q;GAAAA,Q,wBAAAA,Q;;AAWL,MAAMC,MAAM,GAAIC,GAAD,IACpBA,GAAG,KAAK,IAAR,IAAgBA,GAAG,CAACC,YAAJ,KAAqB,MADhC"}