@shopify/react-native-skia 1.10.1 → 1.11.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (107) hide show
  1. package/android/src/main/java/com/shopify/reactnative/skia/SkiaBaseView.java +0 -13
  2. package/android/src/main/java/com/shopify/reactnative/skia/SkiaTextureView.java +1 -24
  3. package/cpp/api/JsiSkApi.h +3 -0
  4. package/cpp/api/recorder/ColorFilters.h +133 -0
  5. package/cpp/api/recorder/Command.h +58 -0
  6. package/cpp/api/recorder/Convertor.h +1212 -0
  7. package/cpp/api/recorder/DataTypes.h +234 -0
  8. package/cpp/api/recorder/DrawingCtx.h +187 -0
  9. package/cpp/api/recorder/Drawings.h +949 -0
  10. package/cpp/api/recorder/Image.h +108 -0
  11. package/cpp/api/recorder/ImageFilters.h +292 -0
  12. package/cpp/api/recorder/JsiRecorder.h +314 -0
  13. package/cpp/api/recorder/Paint.h +191 -0
  14. package/cpp/api/recorder/PathEffects.h +194 -0
  15. package/cpp/api/recorder/RNRecorder.h +635 -0
  16. package/cpp/api/recorder/Shaders.h +406 -0
  17. package/cpp/rnskia/dom/nodes/JsiAtlasNode.h +3 -2
  18. package/cpp/rnskia/dom/nodes/JsiImageNode.h +3 -2
  19. package/ios/RNSkia-iOS/SkiaCVPixelBufferUtils.mm +4 -8
  20. package/jestSetup.js +8 -0
  21. package/jestSetup.mjs +8 -0
  22. package/lib/commonjs/renderer/components/image/Image.d.ts +1 -1
  23. package/lib/commonjs/renderer/components/image/Image.js +8 -2
  24. package/lib/commonjs/renderer/components/image/Image.js.map +1 -1
  25. package/lib/commonjs/skia/types/Recorder.d.ts +52 -0
  26. package/lib/commonjs/skia/types/Recorder.js +6 -0
  27. package/lib/commonjs/skia/types/Recorder.js.map +1 -0
  28. package/lib/commonjs/skia/types/Skia.d.ts +2 -0
  29. package/lib/commonjs/skia/types/Skia.js.map +1 -1
  30. package/lib/commonjs/skia/types/index.d.ts +1 -0
  31. package/lib/commonjs/skia/types/index.js +11 -0
  32. package/lib/commonjs/skia/types/index.js.map +1 -1
  33. package/lib/commonjs/skia/web/JsiSkia.js +3 -0
  34. package/lib/commonjs/skia/web/JsiSkia.js.map +1 -1
  35. package/lib/commonjs/sksg/Container.d.ts +6 -1
  36. package/lib/commonjs/sksg/Container.js +59 -2
  37. package/lib/commonjs/sksg/Container.js.map +1 -1
  38. package/lib/commonjs/sksg/Recorder/DrawingContext.js +1 -0
  39. package/lib/commonjs/sksg/Recorder/DrawingContext.js.map +1 -1
  40. package/lib/commonjs/sksg/Recorder/ReanimatedRecorder.d.ts +53 -0
  41. package/lib/commonjs/sksg/Recorder/ReanimatedRecorder.js +189 -0
  42. package/lib/commonjs/sksg/Recorder/ReanimatedRecorder.js.map +1 -0
  43. package/lib/commonjs/sksg/Recorder/Recorder.d.ts +2 -2
  44. package/lib/commonjs/sksg/Recorder/Recorder.js.map +1 -1
  45. package/lib/commonjs/sksg/Recorder/Visitor.d.ts +2 -2
  46. package/lib/commonjs/sksg/Recorder/Visitor.js +2 -2
  47. package/lib/commonjs/sksg/Recorder/Visitor.js.map +1 -1
  48. package/lib/module/renderer/components/image/Image.d.ts +1 -1
  49. package/lib/module/renderer/components/image/Image.js +8 -2
  50. package/lib/module/renderer/components/image/Image.js.map +1 -1
  51. package/lib/module/skia/types/Recorder.d.ts +52 -0
  52. package/lib/module/skia/types/Recorder.js +2 -0
  53. package/lib/module/skia/types/Recorder.js.map +1 -0
  54. package/lib/module/skia/types/Skia.d.ts +2 -0
  55. package/lib/module/skia/types/Skia.js.map +1 -1
  56. package/lib/module/skia/types/index.d.ts +1 -0
  57. package/lib/module/skia/types/index.js +1 -0
  58. package/lib/module/skia/types/index.js.map +1 -1
  59. package/lib/module/skia/web/JsiSkia.js +3 -0
  60. package/lib/module/skia/web/JsiSkia.js.map +1 -1
  61. package/lib/module/sksg/Container.d.ts +6 -1
  62. package/lib/module/sksg/Container.js +59 -2
  63. package/lib/module/sksg/Container.js.map +1 -1
  64. package/lib/module/sksg/Recorder/DrawingContext.js +1 -0
  65. package/lib/module/sksg/Recorder/DrawingContext.js.map +1 -1
  66. package/lib/module/sksg/Recorder/ReanimatedRecorder.d.ts +53 -0
  67. package/lib/module/sksg/Recorder/ReanimatedRecorder.js +182 -0
  68. package/lib/module/sksg/Recorder/ReanimatedRecorder.js.map +1 -0
  69. package/lib/module/sksg/Recorder/Recorder.d.ts +2 -2
  70. package/lib/module/sksg/Recorder/Recorder.js.map +1 -1
  71. package/lib/module/sksg/Recorder/Visitor.d.ts +2 -2
  72. package/lib/module/sksg/Recorder/Visitor.js +2 -2
  73. package/lib/module/sksg/Recorder/Visitor.js.map +1 -1
  74. package/lib/typescript/lib/commonjs/renderer/components/image/Image.d.ts +4 -1
  75. package/lib/typescript/lib/commonjs/skia/types/Recorder.d.ts +1 -0
  76. package/lib/typescript/lib/commonjs/skia/web/JsiSkia.d.ts +1 -0
  77. package/lib/typescript/lib/commonjs/sksg/Container.d.ts +5 -1
  78. package/lib/typescript/lib/commonjs/sksg/Reconciler.d.ts +6 -0
  79. package/lib/typescript/lib/commonjs/sksg/Recorder/ReanimatedRecorder.d.ts +47 -0
  80. package/lib/typescript/lib/module/mock/index.d.ts +4 -1
  81. package/lib/typescript/lib/module/renderer/components/image/Image.d.ts +4 -1
  82. package/lib/typescript/lib/module/skia/Skia.web.d.ts +1 -0
  83. package/lib/typescript/lib/module/skia/types/Recorder.d.ts +1 -0
  84. package/lib/typescript/lib/module/skia/types/index.d.ts +1 -0
  85. package/lib/typescript/lib/module/skia/web/JsiSkia.d.ts +1 -0
  86. package/lib/typescript/lib/module/sksg/Container.d.ts +5 -1
  87. package/lib/typescript/lib/module/sksg/Reconciler.d.ts +6 -0
  88. package/lib/typescript/lib/module/sksg/Recorder/ReanimatedRecorder.d.ts +46 -0
  89. package/lib/typescript/src/renderer/components/image/Image.d.ts +1 -1
  90. package/lib/typescript/src/skia/types/Recorder.d.ts +52 -0
  91. package/lib/typescript/src/skia/types/Skia.d.ts +2 -0
  92. package/lib/typescript/src/skia/types/index.d.ts +1 -0
  93. package/lib/typescript/src/sksg/Container.d.ts +6 -1
  94. package/lib/typescript/src/sksg/Recorder/ReanimatedRecorder.d.ts +53 -0
  95. package/lib/typescript/src/sksg/Recorder/Recorder.d.ts +2 -2
  96. package/lib/typescript/src/sksg/Recorder/Visitor.d.ts +2 -2
  97. package/package.json +3 -2
  98. package/src/renderer/components/image/Image.tsx +2 -2
  99. package/src/skia/types/Recorder.ts +91 -0
  100. package/src/skia/types/Skia.ts +2 -0
  101. package/src/skia/types/index.ts +1 -0
  102. package/src/skia/web/JsiSkia.ts +3 -0
  103. package/src/sksg/Container.ts +63 -4
  104. package/src/sksg/Recorder/DrawingContext.ts +1 -0
  105. package/src/sksg/Recorder/ReanimatedRecorder.ts +271 -0
  106. package/src/sksg/Recorder/Recorder.ts +2 -2
  107. package/src/sksg/Recorder/Visitor.ts +17 -12
@@ -2,7 +2,7 @@ import type { SharedValue } from "react-native-reanimated";
2
2
  import { NodeType } from "../../dom/types";
3
3
  import type { BlurMaskFilterProps, CircleProps, CTMProps, ImageProps, PaintProps, PointsProps, PathProps, RectProps, RoundedRectProps, OvalProps, LineProps, PatchProps, VerticesProps, DiffRectProps, TextProps, TextPathProps, TextBlobProps, GlyphsProps, PictureProps, ImageSVGProps, ParagraphProps, AtlasProps, BoxProps, BoxShadowProps } from "../../dom/types";
4
4
  import type { AnimatedProps } from "../../renderer";
5
- import type { SkPaint } from "../../skia/types";
5
+ import type { SkPaint, BaseRecorder } from "../../skia/types";
6
6
  import type { Command } from "./Core";
7
7
  export interface Recording {
8
8
  commands: Command[];
@@ -11,7 +11,7 @@ export interface Recording {
11
11
  interface AnimationValues {
12
12
  animationValues: Set<SharedValue<unknown>>;
13
13
  }
14
- export declare class Recorder {
14
+ export declare class Recorder implements BaseRecorder {
15
15
  commands: Command[];
16
16
  cursors: Command[][];
17
17
  animationValues: Set<SharedValue<unknown>>;
@@ -1 +1 @@
1
- {"version":3,"names":["_types","require","_utils","_Node","_Core","_defineProperty","e","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","Recorder","constructor","Set","cursors","push","commands","getRecording","paintPool","animationValues","processProps","props","animatedProps","hasAnimatedProps","key","prop","isSharedValue","add","undefined","command","length","saveGroup","children","type","CommandType","Group","restoreGroup","pop","savePaint","SavePaint","restorePaint","RestorePaint","restorePaintDeclaration","RestorePaintDeclaration","materializePaint","MaterializePaint","pushPathEffect","pathEffectType","isPathEffect","Error","PushPathEffect","pushImageFilter","imageFilterType","isImageFilter","PushImageFilter","pushColorFilter","colorFilterType","isColorFilter","PushColorFilter","pushShader","shaderType","isShader","NodeType","Blend","PushShader","pushBlurMaskFilter","PushBlurMaskFilter","composePathEffect","ComposePathEffect","composeColorFilter","ComposeColorFilter","composeImageFilter","ComposeImageFilter","saveCTM","SaveCTM","restoreCTM","RestoreCTM","drawPaint","DrawPaint","saveLayer","SaveLayer","saveBackdropFilter","SaveBackdropFilter","drawBox","boxProps","shadows","forEach","shadow","DrawBox","drawImage","DrawImage","drawCircle","DrawCircle","drawPoints","DrawPoints","drawPath","DrawPath","drawRect","DrawRect","drawRRect","DrawRRect","drawOval","DrawOval","drawLine","DrawLine","drawPatch","DrawPatch","drawVertices","DrawVertices","drawDiffRect","DrawDiffRect","drawText","DrawText","drawTextPath","DrawTextPath","drawTextBlob","DrawTextBlob","drawGlyphs","DrawGlyphs","drawPicture","DrawPicture","drawImageSVG","DrawImageSVG","drawParagraph","DrawParagraph","drawAtlas","DrawAtlas","exports"],"sources":["Recorder.ts"],"sourcesContent":["import type { SharedValue } from \"react-native-reanimated\";\n\nimport { NodeType } from \"../../dom/types\";\nimport type {\n BlurMaskFilterProps,\n CircleProps,\n CTMProps,\n ImageProps,\n PaintProps,\n PointsProps,\n PathProps,\n RectProps,\n RoundedRectProps,\n OvalProps,\n LineProps,\n PatchProps,\n VerticesProps,\n DiffRectProps,\n TextProps,\n TextPathProps,\n TextBlobProps,\n GlyphsProps,\n PictureProps,\n ImageSVGProps,\n ParagraphProps,\n AtlasProps,\n BoxProps,\n BoxShadowProps,\n} from \"../../dom/types\";\nimport type { AnimatedProps } from \"../../renderer\";\nimport { isSharedValue } from \"../utils\";\nimport { isColorFilter, isImageFilter, isPathEffect, isShader } from \"../Node\";\nimport type { SkPaint } from \"../../skia/types\";\n\nimport { CommandType } from \"./Core\";\nimport type { Command } from \"./Core\";\n\nexport interface Recording {\n commands: Command[];\n paintPool: SkPaint[];\n}\n\ninterface AnimationValues {\n animationValues: Set<SharedValue<unknown>>;\n}\n\nexport class Recorder {\n commands: Command[] = [];\n cursors: Command[][] = [];\n animationValues: Set<SharedValue<unknown>> = new Set();\n\n constructor() {\n this.cursors.push(this.commands);\n }\n\n getRecording(): Recording & AnimationValues {\n return {\n commands: this.commands,\n paintPool: [],\n animationValues: this.animationValues,\n };\n }\n\n private processProps(props: Record<string, unknown>) {\n const animatedProps: Record<string, SharedValue<unknown>> = {};\n let hasAnimatedProps = false;\n\n for (const key in props) {\n const prop = props[key];\n if (isSharedValue(prop)) {\n this.animationValues.add(prop);\n animatedProps[key] = prop;\n hasAnimatedProps = true;\n }\n }\n\n return {\n props,\n animatedProps: hasAnimatedProps ? animatedProps : undefined,\n };\n }\n\n private add(command: Command) {\n if (command.props) {\n const { animatedProps } = this.processProps(\n command.props as Record<string, unknown>\n );\n if (animatedProps) {\n command.animatedProps = animatedProps;\n }\n }\n this.cursors[this.cursors.length - 1].push(command);\n }\n\n saveGroup() {\n const children: Command[] = [];\n this.add({ type: CommandType.Group, children });\n this.cursors.push(children);\n }\n\n restoreGroup() {\n this.cursors.pop();\n }\n\n savePaint(props: AnimatedProps<PaintProps>) {\n this.add({ type: CommandType.SavePaint, props });\n }\n\n restorePaint() {\n this.add({ type: CommandType.RestorePaint });\n }\n\n restorePaintDeclaration() {\n this.add({ type: CommandType.RestorePaintDeclaration });\n }\n\n materializePaint() {\n this.add({ type: CommandType.MaterializePaint });\n }\n\n pushPathEffect(pathEffectType: NodeType, props: AnimatedProps<unknown>) {\n if (!isPathEffect(pathEffectType)) {\n throw new Error(\"Invalid color filter type: \" + pathEffectType);\n }\n this.add({\n type: CommandType.PushPathEffect,\n pathEffectType,\n props,\n });\n }\n\n pushImageFilter(imageFilterType: NodeType, props: AnimatedProps<unknown>) {\n if (!isImageFilter(imageFilterType)) {\n throw new Error(\"Invalid color filter type: \" + imageFilterType);\n }\n this.add({\n type: CommandType.PushImageFilter,\n imageFilterType,\n props,\n });\n }\n\n pushColorFilter(colorFilterType: NodeType, props: AnimatedProps<unknown>) {\n if (!isColorFilter(colorFilterType)) {\n throw new Error(\"Invalid color filter type: \" + colorFilterType);\n }\n this.add({\n type: CommandType.PushColorFilter,\n colorFilterType,\n props,\n });\n }\n\n pushShader(shaderType: NodeType, props: AnimatedProps<unknown>) {\n if (!isShader(shaderType) && !(shaderType === NodeType.Blend)) {\n throw new Error(\"Invalid color filter type: \" + shaderType);\n }\n this.add({ type: CommandType.PushShader, shaderType, props });\n }\n\n pushBlurMaskFilter(props: AnimatedProps<BlurMaskFilterProps>) {\n this.add({ type: CommandType.PushBlurMaskFilter, props });\n }\n\n composePathEffect() {\n this.add({ type: CommandType.ComposePathEffect });\n }\n\n composeColorFilter() {\n this.add({ type: CommandType.ComposeColorFilter });\n }\n\n composeImageFilter() {\n this.add({ type: CommandType.ComposeImageFilter });\n }\n\n saveCTM(props: AnimatedProps<CTMProps>) {\n this.add({ type: CommandType.SaveCTM, props });\n }\n\n restoreCTM() {\n this.add({ type: CommandType.RestoreCTM });\n }\n\n drawPaint() {\n this.add({ type: CommandType.DrawPaint });\n }\n\n saveLayer() {\n this.add({ type: CommandType.SaveLayer });\n }\n\n saveBackdropFilter() {\n this.add({ type: CommandType.SaveBackdropFilter });\n }\n\n drawBox(\n boxProps: AnimatedProps<BoxProps>,\n shadows: {\n props: BoxShadowProps;\n animatedProps?: Record<string, SharedValue<unknown>>;\n }[]\n ) {\n shadows.forEach((shadow) => {\n if (shadow.props) {\n if (shadow.props) {\n const { animatedProps } = this.processProps(\n shadow.props as unknown as Record<string, unknown>\n );\n if (animatedProps) {\n shadow.animatedProps = animatedProps;\n }\n }\n }\n });\n this.add({ type: CommandType.DrawBox, props: boxProps, shadows });\n }\n\n drawImage(props: AnimatedProps<ImageProps>) {\n this.add({ type: CommandType.DrawImage, props });\n }\n\n drawCircle(props: AnimatedProps<CircleProps>) {\n this.add({ type: CommandType.DrawCircle, props });\n }\n drawPoints(props: AnimatedProps<PointsProps>) {\n this.add({ type: CommandType.DrawPoints, props });\n }\n\n drawPath(props: AnimatedProps<PathProps>) {\n this.add({ type: CommandType.DrawPath, props });\n }\n\n drawRect(props: AnimatedProps<RectProps>) {\n this.add({ type: CommandType.DrawRect, props });\n }\n\n drawRRect(props: AnimatedProps<RoundedRectProps>) {\n this.add({ type: CommandType.DrawRRect, props });\n }\n\n drawOval(props: AnimatedProps<OvalProps>) {\n this.add({ type: CommandType.DrawOval, props });\n }\n\n drawLine(props: AnimatedProps<LineProps>) {\n this.add({ type: CommandType.DrawLine, props });\n }\n\n drawPatch(props: AnimatedProps<PatchProps>) {\n this.add({ type: CommandType.DrawPatch, props });\n }\n\n drawVertices(props: AnimatedProps<VerticesProps>) {\n this.add({ type: CommandType.DrawVertices, props });\n }\n\n drawDiffRect(props: AnimatedProps<DiffRectProps>) {\n this.add({ type: CommandType.DrawDiffRect, props });\n }\n\n drawText(props: AnimatedProps<TextProps>) {\n this.add({ type: CommandType.DrawText, props });\n }\n\n drawTextPath(props: AnimatedProps<TextPathProps>) {\n this.add({ type: CommandType.DrawTextPath, props });\n }\n\n drawTextBlob(props: AnimatedProps<TextBlobProps>) {\n this.add({ type: CommandType.DrawTextBlob, props });\n }\n\n drawGlyphs(props: AnimatedProps<GlyphsProps>) {\n this.add({ type: CommandType.DrawGlyphs, props });\n }\n\n drawPicture(props: AnimatedProps<PictureProps>) {\n this.add({ type: CommandType.DrawPicture, props });\n }\n\n drawImageSVG(props: AnimatedProps<ImageSVGProps>) {\n this.add({ type: CommandType.DrawImageSVG, props });\n }\n\n drawParagraph(props: AnimatedProps<ParagraphProps>) {\n this.add({ type: CommandType.DrawParagraph, props });\n }\n\n drawAtlas(props: AnimatedProps<AtlasProps>) {\n this.add({ type: CommandType.DrawAtlas, props });\n }\n}\n"],"mappings":";;;;;;AAEA,IAAAA,MAAA,GAAAC,OAAA;AA4BA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AAGA,IAAAG,KAAA,GAAAH,OAAA;AAAqC,SAAAI,gBAAAC,CAAA,EAAAC,CAAA,EAAAC,CAAA,YAAAD,CAAA,GAAAE,cAAA,CAAAF,CAAA,MAAAD,CAAA,GAAAI,MAAA,CAAAC,cAAA,CAAAL,CAAA,EAAAC,CAAA,IAAAK,KAAA,EAAAJ,CAAA,EAAAK,UAAA,MAAAC,YAAA,MAAAC,QAAA,UAAAT,CAAA,CAAAC,CAAA,IAAAC,CAAA,EAAAF,CAAA;AAAA,SAAAG,eAAAD,CAAA,QAAAQ,CAAA,GAAAC,YAAA,CAAAT,CAAA,uCAAAQ,CAAA,GAAAA,CAAA,GAAAA,CAAA;AAAA,SAAAC,aAAAT,CAAA,EAAAD,CAAA,2BAAAC,CAAA,KAAAA,CAAA,SAAAA,CAAA,MAAAF,CAAA,GAAAE,CAAA,CAAAU,MAAA,CAAAC,WAAA,kBAAAb,CAAA,QAAAU,CAAA,GAAAV,CAAA,CAAAc,IAAA,CAAAZ,CAAA,EAAAD,CAAA,uCAAAS,CAAA,SAAAA,CAAA,YAAAK,SAAA,yEAAAd,CAAA,GAAAe,MAAA,GAAAC,MAAA,EAAAf,CAAA;AAY9B,MAAMgB,QAAQ,CAAC;EAKpBC,WAAWA,CAAA,EAAG;IAAApB,eAAA,mBAJQ,EAAE;IAAAA,eAAA,kBACD,EAAE;IAAAA,eAAA,0BACoB,IAAIqB,GAAG,CAAC,CAAC;IAGpD,IAAI,CAACC,OAAO,CAACC,IAAI,CAAC,IAAI,CA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toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","Recorder","constructor","Set","cursors","push","commands","getRecording","paintPool","animationValues","processProps","props","animatedProps","hasAnimatedProps","key","prop","isSharedValue","add","undefined","command","length","saveGroup","children","type","CommandType","Group","restoreGroup","pop","savePaint","SavePaint","restorePaint","RestorePaint","restorePaintDeclaration","RestorePaintDeclaration","materializePaint","MaterializePaint","pushPathEffect","pathEffectType","isPathEffect","Error","PushPathEffect","pushImageFilter","imageFilterType","isImageFilter","PushImageFilter","pushColorFilter","colorFilterType","isColorFilter","PushColorFilter","pushShader","shaderType","isShader","NodeType","Blend","PushShader","pushBlurMaskFilter","PushBlurMaskFilter","composePathEffect","ComposePathEffect","composeColorFilter","ComposeColorFilter","composeImageFilter","ComposeImageFilter","saveCTM","SaveCTM","restoreCTM","RestoreCTM","drawPaint","DrawPaint","saveLayer","SaveLayer","saveBackdropFilter","SaveBackdropFilter","drawBox","boxProps","shadows","forEach","shadow","DrawBox","drawImage","DrawImage","drawCircle","DrawCircle","drawPoints","DrawPoints","drawPath","DrawPath","drawRect","DrawRect","drawRRect","DrawRRect","drawOval","DrawOval","drawLine","DrawLine","drawPatch","DrawPatch","drawVertices","DrawVertices","drawDiffRect","DrawDiffRect","drawText","DrawText","drawTextPath","DrawTextPath","drawTextBlob","DrawTextBlob","drawGlyphs","DrawGlyphs","drawPicture","DrawPicture","drawImageSVG","DrawImageSVG","drawParagraph","DrawParagraph","drawAtlas","DrawAtlas","exports"],"sources":["Recorder.ts"],"sourcesContent":["import type { SharedValue } from \"react-native-reanimated\";\n\nimport { NodeType } from \"../../dom/types\";\nimport type {\n BlurMaskFilterProps,\n CircleProps,\n CTMProps,\n ImageProps,\n PaintProps,\n PointsProps,\n PathProps,\n RectProps,\n RoundedRectProps,\n OvalProps,\n LineProps,\n PatchProps,\n VerticesProps,\n DiffRectProps,\n TextProps,\n TextPathProps,\n TextBlobProps,\n GlyphsProps,\n PictureProps,\n ImageSVGProps,\n ParagraphProps,\n AtlasProps,\n BoxProps,\n BoxShadowProps,\n} from \"../../dom/types\";\nimport type { AnimatedProps } from \"../../renderer\";\nimport { isSharedValue } from \"../utils\";\nimport { isColorFilter, isImageFilter, isPathEffect, isShader } from \"../Node\";\nimport type { SkPaint, BaseRecorder } from \"../../skia/types\";\n\nimport { CommandType } from \"./Core\";\nimport type { Command } from \"./Core\";\n\nexport interface Recording {\n commands: Command[];\n paintPool: SkPaint[];\n}\n\ninterface AnimationValues {\n animationValues: Set<SharedValue<unknown>>;\n}\n\nexport class Recorder implements BaseRecorder {\n commands: Command[] = [];\n cursors: Command[][] = [];\n animationValues: Set<SharedValue<unknown>> = new Set();\n\n constructor() {\n this.cursors.push(this.commands);\n }\n\n getRecording(): Recording & AnimationValues {\n return {\n commands: this.commands,\n paintPool: [],\n animationValues: this.animationValues,\n };\n }\n\n private processProps(props: Record<string, unknown>) {\n const animatedProps: Record<string, SharedValue<unknown>> = {};\n let hasAnimatedProps = false;\n\n for (const key in props) {\n const prop = props[key];\n if (isSharedValue(prop)) {\n this.animationValues.add(prop);\n animatedProps[key] = prop;\n hasAnimatedProps = true;\n }\n }\n\n return {\n props,\n animatedProps: hasAnimatedProps ? animatedProps : undefined,\n };\n }\n\n private add(command: Command) {\n if (command.props) {\n const { animatedProps } = this.processProps(\n command.props as Record<string, unknown>\n );\n if (animatedProps) {\n command.animatedProps = animatedProps;\n }\n }\n this.cursors[this.cursors.length - 1].push(command);\n }\n\n saveGroup() {\n const children: Command[] = [];\n this.add({ type: CommandType.Group, children });\n this.cursors.push(children);\n }\n\n restoreGroup() {\n this.cursors.pop();\n }\n\n savePaint(props: AnimatedProps<PaintProps>) {\n this.add({ type: CommandType.SavePaint, props });\n }\n\n restorePaint() {\n this.add({ type: CommandType.RestorePaint });\n }\n\n restorePaintDeclaration() {\n this.add({ type: CommandType.RestorePaintDeclaration });\n }\n\n materializePaint() {\n this.add({ type: CommandType.MaterializePaint });\n }\n\n pushPathEffect(pathEffectType: NodeType, props: AnimatedProps<unknown>) {\n if (!isPathEffect(pathEffectType)) {\n throw new Error(\"Invalid color filter type: \" + pathEffectType);\n }\n this.add({\n type: CommandType.PushPathEffect,\n pathEffectType,\n props,\n });\n }\n\n pushImageFilter(imageFilterType: NodeType, props: AnimatedProps<unknown>) {\n if (!isImageFilter(imageFilterType)) {\n throw new Error(\"Invalid color filter type: \" + imageFilterType);\n }\n this.add({\n type: CommandType.PushImageFilter,\n imageFilterType,\n props,\n });\n }\n\n pushColorFilter(colorFilterType: NodeType, props: AnimatedProps<unknown>) {\n if (!isColorFilter(colorFilterType)) {\n throw new Error(\"Invalid color filter type: \" + colorFilterType);\n }\n this.add({\n type: CommandType.PushColorFilter,\n colorFilterType,\n props,\n });\n }\n\n pushShader(shaderType: NodeType, props: AnimatedProps<unknown>) {\n if (!isShader(shaderType) && !(shaderType === NodeType.Blend)) {\n throw new Error(\"Invalid color filter type: \" + shaderType);\n }\n this.add({ type: CommandType.PushShader, shaderType, props });\n }\n\n pushBlurMaskFilter(props: AnimatedProps<BlurMaskFilterProps>) {\n this.add({ type: CommandType.PushBlurMaskFilter, props });\n }\n\n composePathEffect() {\n this.add({ type: CommandType.ComposePathEffect });\n }\n\n composeColorFilter() {\n this.add({ type: CommandType.ComposeColorFilter });\n }\n\n composeImageFilter() {\n this.add({ type: CommandType.ComposeImageFilter });\n }\n\n saveCTM(props: AnimatedProps<CTMProps>) {\n this.add({ type: CommandType.SaveCTM, props });\n }\n\n restoreCTM() {\n this.add({ type: CommandType.RestoreCTM });\n }\n\n drawPaint() {\n this.add({ type: CommandType.DrawPaint });\n }\n\n saveLayer() {\n this.add({ type: CommandType.SaveLayer });\n }\n\n saveBackdropFilter() {\n this.add({ type: CommandType.SaveBackdropFilter });\n }\n\n drawBox(\n boxProps: AnimatedProps<BoxProps>,\n shadows: {\n props: BoxShadowProps;\n animatedProps?: Record<string, SharedValue<unknown>>;\n }[]\n ) {\n shadows.forEach((shadow) => {\n if (shadow.props) {\n if (shadow.props) {\n const { animatedProps } = this.processProps(\n shadow.props as unknown as Record<string, unknown>\n );\n if (animatedProps) {\n shadow.animatedProps = animatedProps;\n }\n }\n }\n });\n this.add({ type: CommandType.DrawBox, props: boxProps, shadows });\n }\n\n drawImage(props: AnimatedProps<ImageProps>) {\n this.add({ type: CommandType.DrawImage, props });\n }\n\n drawCircle(props: AnimatedProps<CircleProps>) {\n this.add({ type: CommandType.DrawCircle, props });\n }\n drawPoints(props: AnimatedProps<PointsProps>) {\n this.add({ type: CommandType.DrawPoints, props });\n }\n\n drawPath(props: AnimatedProps<PathProps>) {\n this.add({ type: CommandType.DrawPath, props });\n }\n\n drawRect(props: AnimatedProps<RectProps>) {\n this.add({ type: CommandType.DrawRect, props });\n }\n\n drawRRect(props: AnimatedProps<RoundedRectProps>) {\n this.add({ type: CommandType.DrawRRect, props });\n }\n\n drawOval(props: AnimatedProps<OvalProps>) {\n this.add({ type: CommandType.DrawOval, props });\n }\n\n drawLine(props: AnimatedProps<LineProps>) {\n this.add({ type: CommandType.DrawLine, props });\n }\n\n drawPatch(props: AnimatedProps<PatchProps>) {\n this.add({ type: CommandType.DrawPatch, props });\n }\n\n drawVertices(props: AnimatedProps<VerticesProps>) {\n this.add({ type: CommandType.DrawVertices, props });\n }\n\n drawDiffRect(props: AnimatedProps<DiffRectProps>) {\n this.add({ type: CommandType.DrawDiffRect, props });\n }\n\n drawText(props: AnimatedProps<TextProps>) {\n this.add({ type: CommandType.DrawText, props });\n }\n\n drawTextPath(props: AnimatedProps<TextPathProps>) {\n this.add({ type: CommandType.DrawTextPath, props });\n }\n\n drawTextBlob(props: AnimatedProps<TextBlobProps>) {\n this.add({ type: CommandType.DrawTextBlob, props });\n }\n\n drawGlyphs(props: AnimatedProps<GlyphsProps>) {\n this.add({ type: CommandType.DrawGlyphs, props });\n }\n\n drawPicture(props: AnimatedProps<PictureProps>) {\n this.add({ type: CommandType.DrawPicture, props });\n }\n\n drawImageSVG(props: AnimatedProps<ImageSVGProps>) {\n this.add({ type: CommandType.DrawImageSVG, props });\n }\n\n drawParagraph(props: AnimatedProps<ParagraphProps>) {\n this.add({ type: CommandType.DrawParagraph, props });\n }\n\n drawAtlas(props: AnimatedProps<AtlasProps>) {\n this.add({ type: CommandType.DrawAtlas, props });\n }\n}\n"],"mappings":";;;;;;AAEA,IAAAA,MAAA,GAAAC,OAAA;AA4BA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AAGA,IAAAG,KAAA,GAAAH,OAAA;AAAqC,SAAAI,gBAAAC,CAAA,EAAAC,CAAA,EAAAC,CAAA,YAAAD,CAAA,GAAAE,cAAA,CAAAF,CAAA,MAAAD,CAAA,GAAAI,MAAA,CAAAC,cAAA,CAAAL,CAAA,EAAAC,CAAA,IAAAK,KAAA,EAAAJ,CAAA,EAAAK,UAAA,MAAAC,YAAA,MAAAC,QAAA,UAAAT,CAAA,CAAAC,CAAA,IAAAC,CAAA,EAAAF,CAAA;AAAA,SAAAG,eAAAD,CAAA,QAAAQ,CAAA,GAAAC,YAAA,CAAAT,CAAA,uCAAAQ,CAAA,GAAAA,CAAA,GAAAA,CAAA;AAAA,SAAAC,aAAAT,CAAA,EAAAD,CAAA,2BAAAC,CAAA,KAAAA,CAAA,SAAAA,CAAA,MAAAF,CAAA,GAAAE,CAAA,CAAAU,MAAA,CAAAC,WAAA,kBAAAb,CAAA,QAAAU,CAAA,GAAAV,CAAA,CAAAc,IAAA,CAAAZ,CAAA,EAAAD,CAAA,uCAAAS,CAAA,SAAAA,CAAA,YAAAK,SAAA,yEAAAd,CAAA,GAAAe,MAAA,GAAAC,MAAA,EAAAf,CAAA;AAY9B,MAAMgB,QAAQ,CAAyB;EAK5CC,WAAWA,CAAA,EAAG;IAAApB,eAAA,mBAJQ,EAAE;IAAAA,eAAA,kBACD,EAAE;IAAAA,eAAA,0BACoB,IAAIqB,GAAG,CAAC,CAAC;IAGpD,IAAI,CAACC,OAAO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type { DrawingNodeProps } from "../../dom/types";
2
+ import type { BaseRecorder } from "../../skia/types/Recorder";
2
3
  import type { Node } from "../Node";
3
- import type { Recorder } from "./Recorder";
4
4
  export declare const processPaint: ({ opacity, color, strokeWidth, blendMode, style, strokeJoin, strokeCap, strokeMiter, antiAlias, dither, paint: paintRef, }: DrawingNodeProps) => DrawingNodeProps | null;
5
- export declare const visit: (recorder: Recorder, root: Node[]) => void;
5
+ export declare const visit: (recorder: BaseRecorder, root: Node[]) => void;
@@ -220,10 +220,10 @@ const visitNode = (recorder, node) => {
220
220
  recorder.drawPaint();
221
221
  break;
222
222
  case _types.NodeType.Image:
223
- recorder.drawImage(node.props);
223
+ recorder.drawImage(props);
224
224
  break;
225
225
  case _types.NodeType.Circle:
226
- recorder.drawCircle(node.props);
226
+ recorder.drawCircle(props);
227
227
  break;
228
228
  case _types.NodeType.Points:
229
229
  recorder.drawPoints(props);
@@ -1 +1 @@
1
- {"version":3,"names":["_types","require","_Node","processPaint","opacity","color","strokeWidth","blendMode","style","strokeJoin","strokeCap","strokeMiter","antiAlias","dither","paint","paintRef","undefined","exports","processCTM","clip","invertClip","transform","origin","matrix","layer","ctm","pushColorFilters","recorder","colorFilters","forEach","colorFilter","children","length","pushColorFilter","type","props","needsComposition","NodeType","LerpColorFilter","composeColorFilter","pushPathEffects","pathEffects","pathEffect","pushPathEffect","SumPathEffect","composePathEffect","pushImageFilters","imageFilters","imageFilter","isImageFilter","pushImageFilter","isShader","pushShader","BlendImageFilter","composeImageFilter","pushShaders","shaders","shader","pushMaskFilters","maskFilters","pushBlurMaskFilter","pushPaints","paints","savePaint","sortNodeChildren","restorePaintDeclaration","visitNode","node","Group","saveGroup","drawings","shouldPushPaint","BackdropFilter","saveBackdropFilter","materializePaint","Layer","saveLayer","shouldRestore","saveCTM","Box","shadows","filter","n","BoxShadow","map","drawBox","Fill","drawPaint","Image","drawImage","Circle","drawCircle","Points","drawPoints","Path","drawPath","Rect","drawRect","RRect","drawRRect","Oval","drawOval","Line","drawLine","Patch","drawPatch","Vertices","drawVertices","DiffRect","drawDiffRect","Text","drawText","TextPath","drawTextPath","TextBlob","drawTextBlob","Glyphs","drawGlyphs","Picture","drawPicture","ImageSVG","drawImageSVG","Paragraph","drawParagraph","Atlas","drawAtlas","drawing","restorePaint","restoreCTM","restoreGroup","visit","root"],"sources":["Visitor.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type {\n CTMProps,\n DrawingNodeProps,\n BoxShadowProps,\n} from \"../../dom/types\";\nimport { NodeType } from \"../../dom/types\";\nimport type { Node } from \"../Node\";\nimport { isImageFilter, isShader, sortNodeChildren } from \"../Node\";\n\nimport type { Recorder } from \"./Recorder\";\n\nexport const processPaint = ({\n opacity,\n color,\n strokeWidth,\n blendMode,\n style,\n strokeJoin,\n strokeCap,\n strokeMiter,\n antiAlias,\n dither,\n paint: paintRef,\n}: DrawingNodeProps) => {\n const paint: DrawingNodeProps = {};\n if (opacity !== undefined) {\n paint.opacity = opacity;\n }\n if (color !== undefined) {\n paint.color = color;\n }\n if (strokeWidth !== undefined) {\n paint.strokeWidth = strokeWidth;\n }\n if (blendMode !== undefined) {\n paint.blendMode = blendMode;\n }\n if (style !== undefined) {\n paint.style = style;\n }\n if (strokeJoin !== undefined) {\n paint.strokeJoin = strokeJoin;\n }\n if (strokeCap !== undefined) {\n paint.strokeCap = strokeCap;\n }\n if (strokeMiter !== undefined) {\n paint.strokeMiter = strokeMiter;\n }\n if (antiAlias !== undefined) {\n paint.antiAlias = antiAlias;\n }\n if (dither !== undefined) {\n paint.dither = dither;\n }\n\n if (paintRef !== undefined) {\n paint.paint = paintRef;\n }\n\n if (\n opacity !== undefined ||\n color !== undefined ||\n strokeWidth !== undefined ||\n blendMode !== undefined ||\n style !== undefined ||\n strokeJoin !== undefined ||\n strokeCap !== undefined ||\n strokeMiter !== undefined ||\n antiAlias !== undefined ||\n dither !== undefined ||\n paintRef !== undefined\n ) {\n return paint;\n }\n return null;\n};\n\nconst processCTM = ({\n clip,\n invertClip,\n transform,\n origin,\n matrix,\n layer,\n}: CTMProps) => {\n const ctm: CTMProps = {};\n if (clip) {\n ctm.clip = clip;\n }\n if (invertClip) {\n ctm.invertClip = invertClip;\n }\n if (transform) {\n ctm.transform = transform;\n }\n if (origin) {\n ctm.origin = origin;\n }\n if (matrix) {\n ctm.matrix = matrix;\n }\n if (layer) {\n ctm.layer = layer;\n }\n if (\n clip !== undefined ||\n invertClip !== undefined ||\n transform !== undefined ||\n origin !== undefined ||\n matrix !== undefined ||\n layer !== undefined\n ) {\n return ctm;\n }\n return null;\n};\n\nconst pushColorFilters = (recorder: Recorder, colorFilters: Node<any>[]) => {\n colorFilters.forEach((colorFilter) => {\n if (colorFilter.children.length > 0) {\n pushColorFilters(recorder, colorFilter.children);\n }\n recorder.pushColorFilter(colorFilter.type, colorFilter.props);\n const needsComposition =\n colorFilter.type !== NodeType.LerpColorFilter &&\n colorFilter.children.length > 0;\n if (needsComposition) {\n recorder.composeColorFilter();\n }\n });\n};\n\nconst pushPathEffects = (recorder: Recorder, pathEffects: Node<any>[]) => {\n pathEffects.forEach((pathEffect) => {\n if (pathEffect.children.length > 0) {\n pushPathEffects(recorder, pathEffect.children);\n }\n recorder.pushPathEffect(pathEffect.type, pathEffect.props);\n const needsComposition =\n pathEffect.type !== NodeType.SumPathEffect &&\n pathEffect.children.length > 0;\n if (needsComposition) {\n recorder.composePathEffect();\n }\n });\n};\n\nconst pushImageFilters = (recorder: Recorder, imageFilters: Node<any>[]) => {\n imageFilters.forEach((imageFilter) => {\n if (imageFilter.children.length > 0) {\n pushImageFilters(recorder, imageFilter.children);\n }\n if (isImageFilter(imageFilter.type)) {\n recorder.pushImageFilter(imageFilter.type, imageFilter.props);\n } else if (isShader(imageFilter.type)) {\n recorder.pushShader(imageFilter.type, imageFilter.props);\n }\n const needsComposition =\n imageFilter.type !== NodeType.BlendImageFilter &&\n imageFilter.children.length > 0;\n if (needsComposition) {\n recorder.composeImageFilter();\n }\n });\n};\n\nconst pushShaders = (recorder: Recorder, shaders: Node<any>[]) => {\n shaders.forEach((shader) => {\n if (shader.children.length > 0) {\n pushShaders(recorder, shader.children);\n }\n recorder.pushShader(shader.type, shader.props);\n });\n};\n\nconst pushMaskFilters = (recorder: Recorder, maskFilters: Node<any>[]) => {\n if (maskFilters.length > 0) {\n recorder.pushBlurMaskFilter(maskFilters[maskFilters.length - 1].props);\n }\n};\n\nconst pushPaints = (recorder: Recorder, paints: Node<any>[]) => {\n paints.forEach((paint) => {\n recorder.savePaint(paint.props);\n const { colorFilters, maskFilters, shaders, imageFilters, pathEffects } =\n sortNodeChildren(paint);\n pushColorFilters(recorder, colorFilters);\n pushImageFilters(recorder, imageFilters);\n pushMaskFilters(recorder, maskFilters);\n pushShaders(recorder, shaders);\n pushPathEffects(recorder, pathEffects);\n recorder.restorePaintDeclaration();\n });\n};\n\nconst visitNode = (recorder: Recorder, node: Node<any>) => {\n if (node.type === NodeType.Group) {\n recorder.saveGroup();\n }\n const { props } = node;\n const {\n colorFilters,\n maskFilters,\n drawings,\n shaders,\n imageFilters,\n pathEffects,\n paints,\n } = sortNodeChildren(node);\n const paint = processPaint(props);\n const shouldPushPaint =\n paint ||\n colorFilters.length > 0 ||\n maskFilters.length > 0 ||\n imageFilters.length > 0 ||\n pathEffects.length > 0 ||\n shaders.length > 0;\n if (shouldPushPaint) {\n recorder.savePaint(paint ?? {});\n pushColorFilters(recorder, colorFilters);\n pushImageFilters(recorder, imageFilters);\n pushMaskFilters(recorder, maskFilters);\n pushShaders(recorder, shaders);\n pushPathEffects(recorder, pathEffects);\n // For mixed nodes like BackdropFilters we don't materialize the paint\n if (node.type === NodeType.BackdropFilter) {\n recorder.saveBackdropFilter();\n } else {\n recorder.materializePaint();\n }\n }\n pushPaints(recorder, paints);\n if (node.type === NodeType.Layer) {\n recorder.saveLayer();\n }\n const ctm = processCTM(props);\n const shouldRestore = !!ctm || node.type === NodeType.Layer;\n if (ctm) {\n recorder.saveCTM(ctm);\n }\n switch (node.type) {\n case NodeType.Box:\n const shadows = node.children\n .filter((n) => n.type === NodeType.BoxShadow)\n // eslint-disable-next-line @typescript-eslint/no-shadow\n .map(({ props }) => ({ props } as { props: BoxShadowProps }));\n recorder.drawBox(props, shadows);\n break;\n case NodeType.Fill:\n recorder.drawPaint();\n break;\n case NodeType.Image:\n recorder.drawImage(node.props);\n break;\n case NodeType.Circle:\n recorder.drawCircle(node.props);\n break;\n case NodeType.Points:\n recorder.drawPoints(props);\n break;\n case NodeType.Path:\n recorder.drawPath(props);\n break;\n case NodeType.Rect:\n recorder.drawRect(props);\n break;\n case NodeType.RRect:\n recorder.drawRRect(props);\n break;\n case NodeType.Oval:\n recorder.drawOval(props);\n break;\n case NodeType.Line:\n recorder.drawLine(props);\n break;\n case NodeType.Patch:\n recorder.drawPatch(props);\n break;\n case NodeType.Vertices:\n recorder.drawVertices(props);\n break;\n case NodeType.DiffRect:\n recorder.drawDiffRect(props);\n break;\n case NodeType.Text:\n recorder.drawText(props);\n break;\n case NodeType.TextPath:\n recorder.drawTextPath(props);\n break;\n case NodeType.TextBlob:\n recorder.drawTextBlob(props);\n break;\n case NodeType.Glyphs:\n recorder.drawGlyphs(props);\n break;\n case NodeType.Picture:\n recorder.drawPicture(props);\n break;\n case NodeType.ImageSVG:\n recorder.drawImageSVG(props);\n break;\n case NodeType.Paragraph:\n recorder.drawParagraph(props);\n break;\n case NodeType.Atlas:\n recorder.drawAtlas(props);\n break;\n }\n drawings.forEach((drawing) => {\n visitNode(recorder, drawing);\n });\n if (shouldPushPaint) {\n recorder.restorePaint();\n }\n if (shouldRestore) {\n recorder.restoreCTM();\n }\n if (node.type === NodeType.Group) {\n recorder.restoreGroup();\n }\n};\n\nexport const visit = (recorder: Recorder, root: Node[]) => {\n root.forEach((node) => {\n visitNode(recorder, node);\n });\n};\n"],"mappings":";;;;;;AAMA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,KAAA,GAAAD,OAAA;AARA;;AAYO,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_types","require","_Node","processPaint","opacity","color","strokeWidth","blendMode","style","strokeJoin","strokeCap","strokeMiter","antiAlias","dither","paint","paintRef","undefined","exports","processCTM","clip","invertClip","transform","origin","matrix","layer","ctm","pushColorFilters","recorder","colorFilters","forEach","colorFilter","children","length","pushColorFilter","type","props","needsComposition","NodeType","LerpColorFilter","composeColorFilter","pushPathEffects","pathEffects","pathEffect","pushPathEffect","SumPathEffect","composePathEffect","pushImageFilters","imageFilters","imageFilter","isImageFilter","pushImageFilter","isShader","pushShader","BlendImageFilter","composeImageFilter","pushShaders","shaders","shader","pushMaskFilters","maskFilters","pushBlurMaskFilter","pushPaints","paints","savePaint","sortNodeChildren","restorePaintDeclaration","visitNode","node","Group","saveGroup","drawings","shouldPushPaint","BackdropFilter","saveBackdropFilter","materializePaint","Layer","saveLayer","shouldRestore","saveCTM","Box","shadows","filter","n","BoxShadow","map","drawBox","Fill","drawPaint","Image","drawImage","Circle","drawCircle","Points","drawPoints","Path","drawPath","Rect","drawRect","RRect","drawRRect","Oval","drawOval","Line","drawLine","Patch","drawPatch","Vertices","drawVertices","DiffRect","drawDiffRect","Text","drawText","TextPath","drawTextPath","TextBlob","drawTextBlob","Glyphs","drawGlyphs","Picture","drawPicture","ImageSVG","drawImageSVG","Paragraph","drawParagraph","Atlas","drawAtlas","drawing","restorePaint","restoreCTM","restoreGroup","visit","root"],"sources":["Visitor.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type {\n CTMProps,\n DrawingNodeProps,\n BoxShadowProps,\n} from \"../../dom/types\";\nimport { NodeType } from \"../../dom/types\";\nimport type { BaseRecorder } from \"../../skia/types/Recorder\";\nimport type { Node } from \"../Node\";\nimport { isImageFilter, isShader, sortNodeChildren } from \"../Node\";\n\nexport const processPaint = ({\n opacity,\n color,\n strokeWidth,\n blendMode,\n style,\n strokeJoin,\n strokeCap,\n strokeMiter,\n antiAlias,\n dither,\n paint: paintRef,\n}: DrawingNodeProps) => {\n const paint: DrawingNodeProps = {};\n if (opacity !== undefined) {\n paint.opacity = opacity;\n }\n if (color !== undefined) {\n paint.color = color;\n }\n if (strokeWidth !== undefined) {\n paint.strokeWidth = strokeWidth;\n }\n if (blendMode !== undefined) {\n paint.blendMode = blendMode;\n }\n if (style !== undefined) {\n paint.style = style;\n }\n if (strokeJoin !== undefined) {\n paint.strokeJoin = strokeJoin;\n }\n if (strokeCap !== undefined) {\n paint.strokeCap = strokeCap;\n }\n if (strokeMiter !== undefined) {\n paint.strokeMiter = strokeMiter;\n }\n if (antiAlias !== undefined) {\n paint.antiAlias = antiAlias;\n }\n if (dither !== undefined) {\n paint.dither = dither;\n }\n\n if (paintRef !== undefined) {\n paint.paint = paintRef;\n }\n\n if (\n opacity !== undefined ||\n color !== undefined ||\n strokeWidth !== undefined ||\n blendMode !== undefined ||\n style !== undefined ||\n strokeJoin !== undefined ||\n strokeCap !== undefined ||\n strokeMiter !== undefined ||\n antiAlias !== undefined ||\n dither !== undefined ||\n paintRef !== undefined\n ) {\n return paint;\n }\n return null;\n};\n\nconst processCTM = ({\n clip,\n invertClip,\n transform,\n origin,\n matrix,\n layer,\n}: CTMProps) => {\n const ctm: CTMProps = {};\n if (clip) {\n ctm.clip = clip;\n }\n if (invertClip) {\n ctm.invertClip = invertClip;\n }\n if (transform) {\n ctm.transform = transform;\n }\n if (origin) {\n ctm.origin = origin;\n }\n if (matrix) {\n ctm.matrix = matrix;\n }\n if (layer) {\n ctm.layer = layer;\n }\n if (\n clip !== undefined ||\n invertClip !== undefined ||\n transform !== undefined ||\n origin !== undefined ||\n matrix !== undefined ||\n layer !== undefined\n ) {\n return ctm;\n }\n return null;\n};\n\nconst pushColorFilters = (\n recorder: BaseRecorder,\n colorFilters: Node<any>[]\n) => {\n colorFilters.forEach((colorFilter) => {\n if (colorFilter.children.length > 0) {\n pushColorFilters(recorder, colorFilter.children);\n }\n recorder.pushColorFilter(colorFilter.type, colorFilter.props);\n const needsComposition =\n colorFilter.type !== NodeType.LerpColorFilter &&\n colorFilter.children.length > 0;\n if (needsComposition) {\n recorder.composeColorFilter();\n }\n });\n};\n\nconst pushPathEffects = (recorder: BaseRecorder, pathEffects: Node<any>[]) => {\n pathEffects.forEach((pathEffect) => {\n if (pathEffect.children.length > 0) {\n pushPathEffects(recorder, pathEffect.children);\n }\n recorder.pushPathEffect(pathEffect.type, pathEffect.props);\n const needsComposition =\n pathEffect.type !== NodeType.SumPathEffect &&\n pathEffect.children.length > 0;\n if (needsComposition) {\n recorder.composePathEffect();\n }\n });\n};\n\nconst pushImageFilters = (\n recorder: BaseRecorder,\n imageFilters: Node<any>[]\n) => {\n imageFilters.forEach((imageFilter) => {\n if (imageFilter.children.length > 0) {\n pushImageFilters(recorder, imageFilter.children);\n }\n if (isImageFilter(imageFilter.type)) {\n recorder.pushImageFilter(imageFilter.type, imageFilter.props);\n } else if (isShader(imageFilter.type)) {\n recorder.pushShader(imageFilter.type, imageFilter.props);\n }\n const needsComposition =\n imageFilter.type !== NodeType.BlendImageFilter &&\n imageFilter.children.length > 0;\n if (needsComposition) {\n recorder.composeImageFilter();\n }\n });\n};\n\nconst pushShaders = (recorder: BaseRecorder, shaders: Node<any>[]) => {\n shaders.forEach((shader) => {\n if (shader.children.length > 0) {\n pushShaders(recorder, shader.children);\n }\n recorder.pushShader(shader.type, shader.props);\n });\n};\n\nconst pushMaskFilters = (recorder: BaseRecorder, maskFilters: Node<any>[]) => {\n if (maskFilters.length > 0) {\n recorder.pushBlurMaskFilter(maskFilters[maskFilters.length - 1].props);\n }\n};\n\nconst pushPaints = (recorder: BaseRecorder, paints: Node<any>[]) => {\n paints.forEach((paint) => {\n recorder.savePaint(paint.props);\n const { colorFilters, maskFilters, shaders, imageFilters, pathEffects } =\n sortNodeChildren(paint);\n pushColorFilters(recorder, colorFilters);\n pushImageFilters(recorder, imageFilters);\n pushMaskFilters(recorder, maskFilters);\n pushShaders(recorder, shaders);\n pushPathEffects(recorder, pathEffects);\n recorder.restorePaintDeclaration();\n });\n};\n\nconst visitNode = (recorder: BaseRecorder, node: Node<any>) => {\n if (node.type === NodeType.Group) {\n recorder.saveGroup();\n }\n const { props } = node;\n const {\n colorFilters,\n maskFilters,\n drawings,\n shaders,\n imageFilters,\n pathEffects,\n paints,\n } = sortNodeChildren(node);\n const paint = processPaint(props);\n const shouldPushPaint =\n paint ||\n colorFilters.length > 0 ||\n maskFilters.length > 0 ||\n imageFilters.length > 0 ||\n pathEffects.length > 0 ||\n shaders.length > 0;\n if (shouldPushPaint) {\n recorder.savePaint(paint ?? {});\n pushColorFilters(recorder, colorFilters);\n pushImageFilters(recorder, imageFilters);\n pushMaskFilters(recorder, maskFilters);\n pushShaders(recorder, shaders);\n pushPathEffects(recorder, pathEffects);\n // For mixed nodes like BackdropFilters we don't materialize the paint\n if (node.type === NodeType.BackdropFilter) {\n recorder.saveBackdropFilter();\n } else {\n recorder.materializePaint();\n }\n }\n pushPaints(recorder, paints);\n if (node.type === NodeType.Layer) {\n recorder.saveLayer();\n }\n const ctm = processCTM(props);\n const shouldRestore = !!ctm || node.type === NodeType.Layer;\n if (ctm) {\n recorder.saveCTM(ctm);\n }\n switch (node.type) {\n case NodeType.Box:\n const shadows = node.children\n .filter((n) => n.type === NodeType.BoxShadow)\n // eslint-disable-next-line @typescript-eslint/no-shadow\n .map(({ props }) => ({ props } as { props: BoxShadowProps }));\n recorder.drawBox(props, shadows);\n break;\n case NodeType.Fill:\n recorder.drawPaint();\n break;\n case NodeType.Image:\n recorder.drawImage(props);\n break;\n case NodeType.Circle:\n recorder.drawCircle(props);\n break;\n case NodeType.Points:\n recorder.drawPoints(props);\n break;\n case NodeType.Path:\n recorder.drawPath(props);\n break;\n case NodeType.Rect:\n recorder.drawRect(props);\n break;\n case NodeType.RRect:\n recorder.drawRRect(props);\n break;\n case NodeType.Oval:\n recorder.drawOval(props);\n break;\n case NodeType.Line:\n recorder.drawLine(props);\n break;\n case NodeType.Patch:\n recorder.drawPatch(props);\n break;\n case NodeType.Vertices:\n recorder.drawVertices(props);\n break;\n case NodeType.DiffRect:\n recorder.drawDiffRect(props);\n break;\n case NodeType.Text:\n recorder.drawText(props);\n break;\n case NodeType.TextPath:\n recorder.drawTextPath(props);\n break;\n case NodeType.TextBlob:\n recorder.drawTextBlob(props);\n break;\n case NodeType.Glyphs:\n recorder.drawGlyphs(props);\n break;\n case NodeType.Picture:\n recorder.drawPicture(props);\n break;\n case NodeType.ImageSVG:\n recorder.drawImageSVG(props);\n break;\n case NodeType.Paragraph:\n recorder.drawParagraph(props);\n break;\n case NodeType.Atlas:\n recorder.drawAtlas(props);\n break;\n }\n drawings.forEach((drawing) => {\n visitNode(recorder, drawing);\n });\n if (shouldPushPaint) {\n recorder.restorePaint();\n }\n if (shouldRestore) {\n recorder.restoreCTM();\n }\n if (node.type === NodeType.Group) {\n recorder.restoreGroup();\n }\n};\n\nexport const visit = (recorder: BaseRecorder, root: Node[]) => {\n root.forEach((node) => {\n visitNode(recorder, node);\n });\n};\n"],"mappings":";;;;;;AAMA,IAAAA,MAAA,GAAAC,OAAA;AAGA,IAAAC,KAAA,GAAAD,OAAA;AATA;;AAWO,MAAME,YAAY,GAAGA,CAAC;EAC3BC,OAAO;EACPC,KAAK;EACLC,WAAW;EACXC,SAAS;EACTC,KAAK;EACLC,UAAU;EACVC,SAAS;EACTC,WAAW;EACXC,SAAS;EACTC,MAAM;EACNC,KAAK,EAAEC;AACS,CAAC,KAAK;EACtB,MAAMD,KAAuB,GAAG,CAAC,CAAC;EAClC,IAAIV,OAAO,KAAKY,SAAS,EAAE;IACzBF,KAAK,CAACV,OAAO,GAAGA,OAAO;EACzB;EACA,IAAIC,KAAK,KAAKW,SAAS,EAAE;IACvBF,KAAK,CAACT,KAAK,GAAGA,KAAK;EACrB;EACA,IAAIC,WAAW,KAAKU,SAAS,EAAE;IAC7BF,KAAK,CAACR,WAAW,GAAGA,WAAW;EACjC;EACA,IAAIC,SAAS,KAAKS,SAAS,EAAE;IAC3BF,KAAK,CAACP,SAAS,GAAGA,SAAS;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MACzB;EACJ;EACAmC,QAAQ,CAACzC,OAAO,CAAEiG,OAAO,IAAK;IAC5B5D,SAAS,CAACvC,QAAQ,EAAEmG,OAAO,CAAC;EAC9B,CAAC,CAAC;EACF,IAAIvD,eAAe,EAAE;IACnB5C,QAAQ,CAACoG,YAAY,CAAC,CAAC;EACzB;EACA,IAAIlD,aAAa,EAAE;IACjBlD,QAAQ,CAACqG,UAAU,CAAC,CAAC;EACvB;EACA,IAAI7D,IAAI,CAACjC,IAAI,KAAKG,eAAQ,CAAC+B,KAAK,EAAE;IAChCzC,QAAQ,CAACsG,YAAY,CAAC,CAAC;EACzB;AACF,CAAC;AAEM,MAAMC,KAAK,GAAGA,CAACvG,QAAsB,EAAEwG,IAAY,KAAK;EAC7DA,IAAI,CAACtG,OAAO,CAAEsC,IAAI,IAAK;IACrBD,SAAS,CAACvC,QAAQ,EAAEwC,IAAI,CAAC;EAC3B,CAAC,CAAC;AACJ,CAAC;AAAClD,OAAA,CAAAiH,KAAA,GAAAA,KAAA","ignoreList":[]}
@@ -1,4 +1,4 @@
1
1
  import React from "react";
2
2
  import type { SkiaProps } from "../../processors";
3
3
  import type { ImageProps } from "../../../dom/types";
4
- export declare const Image: (props: SkiaProps<ImageProps>) => React.JSX.Element;
4
+ export declare const Image: ({ fit, ...props }: SkiaProps<ImageProps>) => React.JSX.Element;
@@ -1,5 +1,11 @@
1
+ function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
1
2
  import React from "react";
2
- export const Image = props => {
3
- return /*#__PURE__*/React.createElement("skImage", props);
3
+ export const Image = ({
4
+ fit = "contain",
5
+ ...props
6
+ }) => {
7
+ return /*#__PURE__*/React.createElement("skImage", _extends({
8
+ fit: fit
9
+ }, props));
4
10
  };
5
11
  //# sourceMappingURL=Image.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["React","Image","props","createElement"],"sources":["Image.tsx"],"sourcesContent":["import React from \"react\";\n\nimport type { SkiaProps } from \"../../processors\";\nimport type { ImageProps } from \"../../../dom/types\";\n\nexport const Image = (props: SkiaProps<ImageProps>) => {\n return <skImage {...props} />;\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AAKzB,OAAO,MAAMC,KAAK,GAAIC,KAA4B,IAAK;EACrD,oBAAOF,KAAA,CAAAG,aAAA,YAAaD,KAAQ,CAAC;AAC/B,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["React","Image","fit","props","createElement","_extends"],"sources":["Image.tsx"],"sourcesContent":["import React from \"react\";\n\nimport type { SkiaProps } from \"../../processors\";\nimport type { ImageProps } from \"../../../dom/types\";\n\nexport const Image = ({ fit = \"contain\", ...props }: SkiaProps<ImageProps>) => {\n return <skImage fit={fit} {...props} />;\n};\n"],"mappings":";AAAA,OAAOA,KAAK,MAAM,OAAO;AAKzB,OAAO,MAAMC,KAAK,GAAGA,CAAC;EAAEC,GAAG,GAAG,SAAS;EAAE,GAAGC;AAA6B,CAAC,KAAK;EAC7E,oBAAOH,KAAA,CAAAI,aAAA,YAAAC,QAAA;IAASH,GAAG,EAAEA;EAAI,GAAKC,KAAK,CAAG,CAAC;AACzC,CAAC","ignoreList":[]}
@@ -0,0 +1,52 @@
1
+ import type { SharedValue } from "react-native-reanimated";
2
+ import type { TextProps, AtlasProps, BlurMaskFilterProps, BoxProps, BoxShadowProps, CircleProps, CTMProps, DiffRectProps, GlyphsProps, ImageProps, ImageSVGProps, LineProps, NodeType, OvalProps, PaintProps, ParagraphProps, PatchProps, PathProps, PictureProps, PointsProps, RectProps, RoundedRectProps, TextBlobProps, TextPathProps, VerticesProps } from "../../dom/types";
3
+ import type { AnimatedProps } from "../../renderer/processors/Animations/Animations";
4
+ import type { SkCanvas } from "./Canvas";
5
+ export interface BaseRecorder {
6
+ saveGroup(): void;
7
+ restoreGroup(): void;
8
+ savePaint(props: AnimatedProps<PaintProps>): void;
9
+ restorePaint(): void;
10
+ restorePaintDeclaration(): void;
11
+ materializePaint(): void;
12
+ pushPathEffect(pathEffectType: NodeType, props: AnimatedProps<unknown>): void;
13
+ pushImageFilter(imageFilterType: NodeType, props: AnimatedProps<unknown>): void;
14
+ pushColorFilter(colorFilterType: NodeType, props: AnimatedProps<unknown>): void;
15
+ pushShader(shaderType: NodeType, props: AnimatedProps<unknown>): void;
16
+ pushBlurMaskFilter(props: AnimatedProps<BlurMaskFilterProps>): void;
17
+ composePathEffect(): void;
18
+ composeColorFilter(): void;
19
+ composeImageFilter(): void;
20
+ saveCTM(props: AnimatedProps<CTMProps>): void;
21
+ restoreCTM(): void;
22
+ drawPaint(): void;
23
+ saveLayer(): void;
24
+ saveBackdropFilter(): void;
25
+ drawBox(boxProps: AnimatedProps<BoxProps>, shadows: {
26
+ props: BoxShadowProps;
27
+ animatedProps?: Record<string, SharedValue<unknown>>;
28
+ }[]): void;
29
+ drawImage(props: AnimatedProps<ImageProps>): void;
30
+ drawCircle(props: AnimatedProps<CircleProps>): void;
31
+ drawPoints(props: AnimatedProps<PointsProps>): void;
32
+ drawPath(props: AnimatedProps<PathProps>): void;
33
+ drawRect(props: AnimatedProps<RectProps>): void;
34
+ drawRRect(props: AnimatedProps<RoundedRectProps>): void;
35
+ drawOval(props: AnimatedProps<OvalProps>): void;
36
+ drawLine(props: AnimatedProps<LineProps>): void;
37
+ drawPatch(props: AnimatedProps<PatchProps>): void;
38
+ drawVertices(props: AnimatedProps<VerticesProps>): void;
39
+ drawDiffRect(props: AnimatedProps<DiffRectProps>): void;
40
+ drawText(props: AnimatedProps<TextProps>): void;
41
+ drawTextPath(props: AnimatedProps<TextPathProps>): void;
42
+ drawTextBlob(props: AnimatedProps<TextBlobProps>): void;
43
+ drawGlyphs(props: AnimatedProps<GlyphsProps>): void;
44
+ drawPicture(props: AnimatedProps<PictureProps>): void;
45
+ drawImageSVG(props: AnimatedProps<ImageSVGProps>): void;
46
+ drawParagraph(props: AnimatedProps<ParagraphProps>): void;
47
+ drawAtlas(props: AnimatedProps<AtlasProps>): void;
48
+ }
49
+ export interface JsiRecorder extends BaseRecorder {
50
+ play(canvas: SkCanvas): void;
51
+ applyUpdates(variables: SharedValue<unknown>[]): void;
52
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=Recorder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["Recorder.ts"],"sourcesContent":["import type { SharedValue } from \"react-native-reanimated\";\n\nimport type {\n TextProps,\n AtlasProps,\n BlurMaskFilterProps,\n BoxProps,\n BoxShadowProps,\n CircleProps,\n CTMProps,\n DiffRectProps,\n GlyphsProps,\n ImageProps,\n ImageSVGProps,\n LineProps,\n NodeType,\n OvalProps,\n PaintProps,\n ParagraphProps,\n PatchProps,\n PathProps,\n PictureProps,\n PointsProps,\n RectProps,\n RoundedRectProps,\n TextBlobProps,\n TextPathProps,\n VerticesProps,\n} from \"../../dom/types\";\nimport type { AnimatedProps } from \"../../renderer/processors/Animations/Animations\";\n\nimport type { SkCanvas } from \"./Canvas\";\n\nexport interface BaseRecorder {\n saveGroup(): void;\n restoreGroup(): void;\n savePaint(props: AnimatedProps<PaintProps>): void;\n restorePaint(): void;\n restorePaintDeclaration(): void;\n materializePaint(): void;\n pushPathEffect(pathEffectType: NodeType, props: AnimatedProps<unknown>): void;\n pushImageFilter(\n imageFilterType: NodeType,\n props: AnimatedProps<unknown>\n ): void;\n pushColorFilter(\n colorFilterType: NodeType,\n props: AnimatedProps<unknown>\n ): void;\n pushShader(shaderType: NodeType, props: AnimatedProps<unknown>): void;\n pushBlurMaskFilter(props: AnimatedProps<BlurMaskFilterProps>): void;\n composePathEffect(): void;\n composeColorFilter(): void;\n composeImageFilter(): void;\n saveCTM(props: AnimatedProps<CTMProps>): void;\n restoreCTM(): void;\n drawPaint(): void;\n saveLayer(): void;\n saveBackdropFilter(): void;\n drawBox(\n boxProps: AnimatedProps<BoxProps>,\n shadows: {\n props: BoxShadowProps;\n animatedProps?: Record<string, SharedValue<unknown>>;\n }[]\n ): void;\n drawImage(props: AnimatedProps<ImageProps>): void;\n drawCircle(props: AnimatedProps<CircleProps>): void;\n drawPoints(props: AnimatedProps<PointsProps>): void;\n drawPath(props: AnimatedProps<PathProps>): void;\n drawRect(props: AnimatedProps<RectProps>): void;\n drawRRect(props: AnimatedProps<RoundedRectProps>): void;\n drawOval(props: AnimatedProps<OvalProps>): void;\n drawLine(props: AnimatedProps<LineProps>): void;\n drawPatch(props: AnimatedProps<PatchProps>): void;\n drawVertices(props: AnimatedProps<VerticesProps>): void;\n drawDiffRect(props: AnimatedProps<DiffRectProps>): void;\n drawText(props: AnimatedProps<TextProps>): void;\n drawTextPath(props: AnimatedProps<TextPathProps>): void;\n drawTextBlob(props: AnimatedProps<TextBlobProps>): void;\n drawGlyphs(props: AnimatedProps<GlyphsProps>): void;\n drawPicture(props: AnimatedProps<PictureProps>): void;\n drawImageSVG(props: AnimatedProps<ImageSVGProps>): void;\n drawParagraph(props: AnimatedProps<ParagraphProps>): void;\n drawAtlas(props: AnimatedProps<AtlasProps>): void;\n}\n\nexport interface JsiRecorder extends BaseRecorder {\n play(canvas: SkCanvas): void;\n applyUpdates(variables: SharedValue<unknown>[]): void;\n}\n"],"mappings":"","ignoreList":[]}
@@ -28,6 +28,7 @@ import type { AnimatedImageFactory } from "./AnimatedImage";
28
28
  import type { ParagraphBuilderFactory } from "./Paragraph/ParagraphBuilder";
29
29
  import type { Video } from "./Video";
30
30
  import type { NativeBufferFactory } from "./NativeBuffer";
31
+ import type { JsiRecorder } from "./Recorder";
31
32
  export interface SkiaContext {
32
33
  getSurface(): SkSurface;
33
34
  present(): void;
@@ -80,4 +81,5 @@ export interface Skia {
80
81
  Video: (url: string) => Promise<Video> | Video;
81
82
  Context(surface: bigint, width: number, height: number): SkiaContext;
82
83
  NativeBuffer: NativeBufferFactory;
84
+ Recorder(): JsiRecorder;
83
85
  }
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["Skia.ts"],"sourcesContent":["import type { ImageFilterFactory } from \"./ImageFilter\";\nimport type { PathFactory } from \"./Path\";\nimport type { ColorFilterFactory } from \"./ColorFilter\";\nimport type { SkFont, FontMgrFactory } from \"./Font\";\nimport type { SkTypeface, TypefaceFactory } from \"./Typeface\";\nimport type { ImageFactory } from \"./Image\";\nimport type { MaskFilterFactory } from \"./MaskFilter\";\nimport type { SkPaint } from \"./Paint\";\nimport type { SkHostRect, SkRect } from \"./Rect\";\nimport type { SkRRect } from \"./RRect\";\nimport type {\n RuntimeEffectFactory,\n SkRuntimeEffect,\n SkRuntimeShaderBuilder,\n} from \"./RuntimeEffect\";\nimport type { ShaderFactory } from \"./Shader\";\nimport type { SkMatrix } from \"./Matrix\";\nimport type { PathEffectFactory } from \"./PathEffect\";\nimport type { SkPoint } from \"./Point\";\nimport type { SkVertices, VertexMode } from \"./Vertices/Vertices\";\nimport type { DataFactory } from \"./Data\";\nimport type { SVGFactory } from \"./SVG\";\nimport type { TextBlobFactory } from \"./TextBlob\";\nimport type { SkSurface, SurfaceFactory } from \"./Surface\";\nimport type { SkRSXform } from \"./RSXform\";\nimport type { SkPath } from \"./Path/Path\";\nimport type { SkContourMeasureIter } from \"./ContourMeasure\";\nimport type { PictureFactory, SkPictureRecorder } from \"./Picture\";\nimport type { Color, SkColor } from \"./Color\";\nimport type { TypefaceFontProviderFactory } from \"./Paragraph/TypefaceFontProviderFactory\";\nimport type { AnimatedImageFactory } from \"./AnimatedImage\";\nimport type { ParagraphBuilderFactory } from \"./Paragraph/ParagraphBuilder\";\nimport type { Video } from \"./Video\";\nimport type { NativeBufferFactory } from \"./NativeBuffer\";\n\nexport interface SkiaContext {\n getSurface(): SkSurface;\n present(): void;\n}\n\n/**\n * Declares the interface for the native Skia API\n */\nexport interface Skia {\n Point: (x: number, y: number) => SkPoint;\n XYWHRect: (x: number, y: number, width: number, height: number) => SkHostRect;\n RuntimeShaderBuilder: (rt: SkRuntimeEffect) => SkRuntimeShaderBuilder;\n RRectXY: (rect: SkRect, rx: number, ry: number) => SkRRect;\n RSXform: (scos: number, ssin: number, tx: number, ty: number) => SkRSXform;\n RSXformFromRadians: (\n scale: number,\n radians: number,\n tx: number,\n ty: number,\n px: number,\n py: number\n ) => SkRSXform;\n Color: (color: Color) => SkColor;\n ContourMeasureIter: (\n path: SkPath,\n forceClosed: boolean,\n resScale: number\n ) => SkContourMeasureIter;\n Paint: () => SkPaint;\n PictureRecorder: () => SkPictureRecorder;\n Picture: PictureFactory;\n Path: PathFactory;\n Matrix: (matrix?: readonly number[]) => SkMatrix;\n ColorFilter: ColorFilterFactory;\n Font: (typeface?: SkTypeface, size?: number) => SkFont;\n Typeface: TypefaceFactory;\n TypefaceFontProvider: TypefaceFontProviderFactory;\n FontMgr: FontMgrFactory;\n MaskFilter: MaskFilterFactory;\n RuntimeEffect: RuntimeEffectFactory;\n ImageFilter: ImageFilterFactory;\n Shader: ShaderFactory;\n PathEffect: PathEffectFactory;\n /**\n * Returns an Vertices based on the given positions and optional parameters.\n * See SkVertices.h (especially the Builder) for more details.\n * @param mode\n * @param positions\n * @param textureCoordinates\n * @param colors - either a list of int colors or a flattened color array.\n * @param indices\n * @param isVolatile\n */\n MakeVertices(\n mode: VertexMode,\n positions: SkPoint[],\n textureCoordinates?: SkPoint[] | null,\n colors?: SkColor[],\n indices?: number[] | null,\n isVolatile?: boolean\n ): SkVertices;\n Data: DataFactory;\n Image: ImageFactory;\n AnimatedImage: AnimatedImageFactory;\n SVG: SVGFactory;\n TextBlob: TextBlobFactory;\n Surface: SurfaceFactory;\n ParagraphBuilder: ParagraphBuilderFactory;\n Video: (url: string) => Promise<Video> | Video;\n Context(surface: bigint, width: number, height: number): SkiaContext;\n NativeBuffer: NativeBufferFactory;\n}\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["Skia.ts"],"sourcesContent":["import type { ImageFilterFactory } from \"./ImageFilter\";\nimport type { PathFactory } from \"./Path\";\nimport type { ColorFilterFactory } from \"./ColorFilter\";\nimport type { SkFont, FontMgrFactory } from \"./Font\";\nimport type { SkTypeface, TypefaceFactory } from \"./Typeface\";\nimport type { ImageFactory } from \"./Image\";\nimport type { MaskFilterFactory } from \"./MaskFilter\";\nimport type { SkPaint } from \"./Paint\";\nimport type { SkHostRect, SkRect } from \"./Rect\";\nimport type { SkRRect } from \"./RRect\";\nimport type {\n RuntimeEffectFactory,\n SkRuntimeEffect,\n SkRuntimeShaderBuilder,\n} from \"./RuntimeEffect\";\nimport type { ShaderFactory } from \"./Shader\";\nimport type { SkMatrix } from \"./Matrix\";\nimport type { PathEffectFactory } from \"./PathEffect\";\nimport type { SkPoint } from \"./Point\";\nimport type { SkVertices, VertexMode } from \"./Vertices/Vertices\";\nimport type { DataFactory } from \"./Data\";\nimport type { SVGFactory } from \"./SVG\";\nimport type { TextBlobFactory } from \"./TextBlob\";\nimport type { SkSurface, SurfaceFactory } from \"./Surface\";\nimport type { SkRSXform } from \"./RSXform\";\nimport type { SkPath } from \"./Path/Path\";\nimport type { SkContourMeasureIter } from \"./ContourMeasure\";\nimport type { PictureFactory, SkPictureRecorder } from \"./Picture\";\nimport type { Color, SkColor } from \"./Color\";\nimport type { TypefaceFontProviderFactory } from \"./Paragraph/TypefaceFontProviderFactory\";\nimport type { AnimatedImageFactory } from \"./AnimatedImage\";\nimport type { ParagraphBuilderFactory } from \"./Paragraph/ParagraphBuilder\";\nimport type { Video } from \"./Video\";\nimport type { NativeBufferFactory } from \"./NativeBuffer\";\nimport type { JsiRecorder } from \"./Recorder\";\n\nexport interface SkiaContext {\n getSurface(): SkSurface;\n present(): void;\n}\n\n/**\n * Declares the interface for the native Skia API\n */\nexport interface Skia {\n Point: (x: number, y: number) => SkPoint;\n XYWHRect: (x: number, y: number, width: number, height: number) => SkHostRect;\n RuntimeShaderBuilder: (rt: SkRuntimeEffect) => SkRuntimeShaderBuilder;\n RRectXY: (rect: SkRect, rx: number, ry: number) => SkRRect;\n RSXform: (scos: number, ssin: number, tx: number, ty: number) => SkRSXform;\n RSXformFromRadians: (\n scale: number,\n radians: number,\n tx: number,\n ty: number,\n px: number,\n py: number\n ) => SkRSXform;\n Color: (color: Color) => SkColor;\n ContourMeasureIter: (\n path: SkPath,\n forceClosed: boolean,\n resScale: number\n ) => SkContourMeasureIter;\n Paint: () => SkPaint;\n PictureRecorder: () => SkPictureRecorder;\n Picture: PictureFactory;\n Path: PathFactory;\n Matrix: (matrix?: readonly number[]) => SkMatrix;\n ColorFilter: ColorFilterFactory;\n Font: (typeface?: SkTypeface, size?: number) => SkFont;\n Typeface: TypefaceFactory;\n TypefaceFontProvider: TypefaceFontProviderFactory;\n FontMgr: FontMgrFactory;\n MaskFilter: MaskFilterFactory;\n RuntimeEffect: RuntimeEffectFactory;\n ImageFilter: ImageFilterFactory;\n Shader: ShaderFactory;\n PathEffect: PathEffectFactory;\n /**\n * Returns an Vertices based on the given positions and optional parameters.\n * See SkVertices.h (especially the Builder) for more details.\n * @param mode\n * @param positions\n * @param textureCoordinates\n * @param colors - either a list of int colors or a flattened color array.\n * @param indices\n * @param isVolatile\n */\n MakeVertices(\n mode: VertexMode,\n positions: SkPoint[],\n textureCoordinates?: SkPoint[] | null,\n colors?: SkColor[],\n indices?: number[] | null,\n isVolatile?: boolean\n ): SkVertices;\n Data: DataFactory;\n Image: ImageFactory;\n AnimatedImage: AnimatedImageFactory;\n SVG: SVGFactory;\n TextBlob: TextBlobFactory;\n Surface: SurfaceFactory;\n ParagraphBuilder: ParagraphBuilderFactory;\n Video: (url: string) => Promise<Video> | Video;\n Context(surface: bigint, width: number, height: number): SkiaContext;\n NativeBuffer: NativeBufferFactory;\n Recorder(): JsiRecorder;\n}\n"],"mappings":"","ignoreList":[]}
@@ -30,4 +30,5 @@ export * from "./Size";
30
30
  export * from "./Paragraph";
31
31
  export * from "./Matrix4";
32
32
  export * from "./NativeBuffer";
33
+ export * from "./Recorder";
33
34
  export * from "./Video";
@@ -30,5 +30,6 @@ export * from "./Size";
30
30
  export * from "./Paragraph";
31
31
  export * from "./Matrix4";
32
32
  export * from "./NativeBuffer";
33
+ export * from "./Recorder";
33
34
  export * from "./Video";
34
35
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./Picture\";\nexport * from \"./Data\";\nexport * from \"./SVG\";\nexport * from \"./Surface\";\nexport * from \"./Vertices\";\nexport * from \"./RuntimeEffect\";\nexport * from \"./Shader\";\nexport * from \"./Image\";\nexport * from \"./AnimatedImage\";\nexport * from \"./ColorFilter\";\nexport * from \"./ImageFilter\";\nexport * from \"./Font\";\nexport * from \"./Typeface\";\nexport * from \"./Paint\";\nexport * from \"./Path\";\nexport * from \"./Color\";\nexport * from \"./Canvas\";\nexport * from \"./ContourMeasure\";\nexport * from \"./MaskFilter\";\nexport * from \"./Matrix\";\nexport * from \"./PathEffect\";\nexport * from \"./Point\";\nexport * from \"./Rect\";\nexport * from \"./RRect\";\nexport * from \"./RSXform\";\nexport * from \"./JsiInstance\";\nexport * from \"./Skia\";\nexport * from \"./TextBlob\";\nexport * from \"./Size\";\nexport * from \"./Paragraph\";\nexport * from \"./Matrix4\";\nexport * from \"./NativeBuffer\";\nexport * from \"./Video\";\n"],"mappings":"AAAA,cAAc,WAAW;AACzB,cAAc,QAAQ;AACtB,cAAc,OAAO;AACrB,cAAc,WAAW;AACzB,cAAc,YAAY;AAC1B,cAAc,iBAAiB;AAC/B,cAAc,UAAU;AACxB,cAAc,SAAS;AACvB,cAAc,iBAAiB;AAC/B,cAAc,eAAe;AAC7B,cAAc,eAAe;AAC7B,cAAc,QAAQ;AACtB,cAAc,YAAY;AAC1B,cAAc,SAAS;AACvB,cAAc,QAAQ;AACtB,cAAc,SAAS;AACvB,cAAc,UAAU;AACxB,cAAc,kBAAkB;AAChC,cAAc,cAAc;AAC5B,cAAc,UAAU;AACxB,cAAc,cAAc;AAC5B,cAAc,SAAS;AACvB,cAAc,QAAQ;AACtB,cAAc,SAAS;AACvB,cAAc,WAAW;AACzB,cAAc,eAAe;AAC7B,cAAc,QAAQ;AACtB,cAAc,YAAY;AAC1B,cAAc,QAAQ;AACtB,cAAc,aAAa;AAC3B,cAAc,WAAW;AACzB,cAAc,gBAAgB;AAC9B,cAAc,SAAS","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./Picture\";\nexport * from \"./Data\";\nexport * from \"./SVG\";\nexport * from \"./Surface\";\nexport * from \"./Vertices\";\nexport * from \"./RuntimeEffect\";\nexport * from \"./Shader\";\nexport * from \"./Image\";\nexport * from \"./AnimatedImage\";\nexport * from \"./ColorFilter\";\nexport * from \"./ImageFilter\";\nexport * from \"./Font\";\nexport * from \"./Typeface\";\nexport * from \"./Paint\";\nexport * from \"./Path\";\nexport * from \"./Color\";\nexport * from \"./Canvas\";\nexport * from \"./ContourMeasure\";\nexport * from \"./MaskFilter\";\nexport * from \"./Matrix\";\nexport * from \"./PathEffect\";\nexport * from \"./Point\";\nexport * from \"./Rect\";\nexport * from \"./RRect\";\nexport * from \"./RSXform\";\nexport * from \"./JsiInstance\";\nexport * from \"./Skia\";\nexport * from \"./TextBlob\";\nexport * from \"./Size\";\nexport * from \"./Paragraph\";\nexport * from \"./Matrix4\";\nexport * from \"./NativeBuffer\";\nexport * from \"./Recorder\";\nexport * from \"./Video\";\n"],"mappings":"AAAA,cAAc,WAAW;AACzB,cAAc,QAAQ;AACtB,cAAc,OAAO;AACrB,cAAc,WAAW;AACzB,cAAc,YAAY;AAC1B,cAAc,iBAAiB;AAC/B,cAAc,UAAU;AACxB,cAAc,SAAS;AACvB,cAAc,iBAAiB;AAC/B,cAAc,eAAe;AAC7B,cAAc,eAAe;AAC7B,cAAc,QAAQ;AACtB,cAAc,YAAY;AAC1B,cAAc,SAAS;AACvB,cAAc,QAAQ;AACtB,cAAc,SAAS;AACvB,cAAc,UAAU;AACxB,cAAc,kBAAkB;AAChC,cAAc,cAAc;AAC5B,cAAc,UAAU;AACxB,cAAc,cAAc;AAC5B,cAAc,SAAS;AACvB,cAAc,QAAQ;AACtB,cAAc,SAAS;AACvB,cAAc,WAAW;AACzB,cAAc,eAAe;AAC7B,cAAc,QAAQ;AACtB,cAAc,YAAY;AAC1B,cAAc,QAAQ;AACtB,cAAc,aAAa;AAC3B,cAAc,WAAW;AACzB,cAAc,gBAAgB;AAC9B,cAAc,YAAY;AAC1B,cAAc,SAAS","ignoreList":[]}
@@ -79,6 +79,9 @@ export const JsiSkApi = CanvasKit => ({
79
79
  Video: createVideo.bind(null, CanvasKit),
80
80
  Context: (_surface, _width, _height) => {
81
81
  throw new Error("Not implemented on React Native Web");
82
+ },
83
+ Recorder: () => {
84
+ throw new Error("Not implemented on React Native Web");
82
85
  }
83
86
  });
84
87
  //# sourceMappingURL=JsiSkia.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["JsiSkPoint","JsiSkPaint","JsiSkRect","Color","JsiSkSurfaceFactory","JsiSkRRect","JsiSkRSXform","JsiSkContourMeasureIter","JsiSkPictureRecorder","JsiSkPictureFactory","JsiSkPathFactory","JsiSkMatrix","JsiSkColorFilterFactory","JsiSkTypefaceFactory","JsiSkMaskFilterFactory","JsiSkRuntimeEffectFactory","JsiSkImageFilterFactory","JsiSkShaderFactory","JsiSkPathEffectFactory","JsiSkDataFactory","JsiSkImageFactory","JsiSkSVGFactory","JsiSkTextBlobFactory","JsiSkFont","MakeVertices","JsiSkPath","JsiSkTypeface","JsiSkTypefaceFontProviderFactory","JsiSkFontMgrFactory","JsiSkAnimatedImageFactory","JsiSkParagraphBuilderFactory","JsiSkNativeBufferFactory","createVideo","JsiSkApi","CanvasKit","Point","x","y","Float32Array","of","RuntimeShaderBuilder","_","Error","RRectXY","rect","rx","ry","RSXform","scos","ssin","tx","ty","RSXformFromRadians","scale","r","px","py","s","Math","sin","c","cos","ContourMeasureIter","path","forceClosed","resScale","fromValue","Paint","paint","setAntiAlias","PictureRecorder","Picture","Path","Matrix","matrix","identity","ColorFilter","Font","typeface","size","undefined","Typeface","MaskFilter","RuntimeEffect","ImageFilter","Shader","PathEffect","bind","Data","Image","AnimatedImage","SVG","TextBlob","XYWHRect","width","height","Surface","TypefaceFontProvider","FontMgr","ParagraphBuilder","NativeBuffer","Video","Context","_surface","_width","_height"],"sources":["JsiSkia.ts"],"sourcesContent":["import type { CanvasKit } from \"canvaskit-wasm\";\n\nimport type {\n SkContourMeasureIter,\n Skia,\n SkPath,\n SkRect,\n SkRuntimeEffect,\n SkRuntimeShaderBuilder,\n SkTypeface,\n} from \"../types\";\n\nimport { JsiSkPoint } from \"./JsiSkPoint\";\nimport { JsiSkPaint } from \"./JsiSkPaint\";\nimport { JsiSkRect } from \"./JsiSkRect\";\nimport { Color } from \"./JsiSkColor\";\nimport { JsiSkSurfaceFactory } from \"./JsiSkSurfaceFactory\";\nimport { JsiSkRRect } from \"./JsiSkRRect\";\nimport { JsiSkRSXform } from \"./JsiSkRSXform\";\nimport { JsiSkContourMeasureIter } from \"./JsiSkContourMeasureIter\";\nimport { JsiSkPictureRecorder } from \"./JsiSkPictureRecorder\";\nimport { JsiSkPictureFactory } from \"./JsiSkPictureFactory\";\nimport { JsiSkPathFactory } from \"./JsiSkPathFactory\";\nimport { JsiSkMatrix } from \"./JsiSkMatrix\";\nimport { JsiSkColorFilterFactory } from \"./JsiSkColorFilterFactory\";\nimport { JsiSkTypefaceFactory } from \"./JsiSkTypefaceFactory\";\nimport { JsiSkMaskFilterFactory } from \"./JsiSkMaskFilterFactory\";\nimport { JsiSkRuntimeEffectFactory } from \"./JsiSkRuntimeEffectFactory\";\nimport { JsiSkImageFilterFactory } from \"./JsiSkImageFilterFactory\";\nimport { JsiSkShaderFactory } from \"./JsiSkShaderFactory\";\nimport { JsiSkPathEffectFactory } from \"./JsiSkPathEffectFactory\";\nimport { JsiSkDataFactory } from \"./JsiSkDataFactory\";\nimport { JsiSkImageFactory } from \"./JsiSkImageFactory\";\nimport { JsiSkSVGFactory } from \"./JsiSkSVGFactory\";\nimport { JsiSkTextBlobFactory } from \"./JsiSkTextBlobFactory\";\nimport { JsiSkFont } from \"./JsiSkFont\";\nimport { MakeVertices } from \"./JsiSkVerticesFactory\";\nimport { JsiSkPath } from \"./JsiSkPath\";\nimport { JsiSkTypeface } from \"./JsiSkTypeface\";\nimport { JsiSkTypefaceFontProviderFactory } from \"./JsiSkTypefaceFontProviderFactory\";\nimport { JsiSkFontMgrFactory } from \"./JsiSkFontMgrFactory\";\nimport { JsiSkAnimatedImageFactory } from \"./JsiSkAnimatedImageFactory\";\nimport { JsiSkParagraphBuilderFactory } from \"./JsiSkParagraphBuilderFactory\";\nimport { JsiSkNativeBufferFactory } from \"./JsiSkNativeBufferFactory\";\nimport { createVideo } from \"./JsiVideo\";\n\nexport const JsiSkApi = (CanvasKit: CanvasKit): Skia => ({\n Point: (x: number, y: number) =>\n new JsiSkPoint(CanvasKit, Float32Array.of(x, y)),\n RuntimeShaderBuilder: (_: SkRuntimeEffect): SkRuntimeShaderBuilder => {\n throw new Error(\"Not implemented on React Native Web\");\n },\n RRectXY: (rect: SkRect, rx: number, ry: number) =>\n new JsiSkRRect(CanvasKit, rect, rx, ry),\n RSXform: (scos: number, ssin: number, tx: number, ty: number) =>\n new JsiSkRSXform(CanvasKit, Float32Array.of(scos, ssin, tx, ty)),\n RSXformFromRadians: (\n scale: number,\n r: number,\n tx: number,\n ty: number,\n px: number,\n py: number\n ) => {\n const s = Math.sin(r) * scale;\n const c = Math.cos(r) * scale;\n return new JsiSkRSXform(\n CanvasKit,\n Float32Array.of(c, s, tx - c * px + s * py, ty - s * px - c * py)\n );\n },\n Color,\n ContourMeasureIter: (\n path: SkPath,\n forceClosed: boolean,\n resScale: number\n ): SkContourMeasureIter =>\n new JsiSkContourMeasureIter(\n CanvasKit,\n new CanvasKit.ContourMeasureIter(\n JsiSkPath.fromValue(path),\n forceClosed,\n resScale\n )\n ),\n Paint: () => {\n const paint = new JsiSkPaint(CanvasKit, new CanvasKit.Paint());\n paint.setAntiAlias(true);\n return paint;\n },\n PictureRecorder: () =>\n new JsiSkPictureRecorder(CanvasKit, new CanvasKit.PictureRecorder()),\n Picture: new JsiSkPictureFactory(CanvasKit),\n Path: new JsiSkPathFactory(CanvasKit),\n Matrix: (matrix?: readonly number[]) =>\n new JsiSkMatrix(\n CanvasKit,\n matrix\n ? Float32Array.of(...matrix)\n : Float32Array.of(...CanvasKit.Matrix.identity())\n ),\n ColorFilter: new JsiSkColorFilterFactory(CanvasKit),\n Font: (typeface?: SkTypeface, size?: number) =>\n new JsiSkFont(\n CanvasKit,\n new CanvasKit.Font(\n typeface === undefined ? null : JsiSkTypeface.fromValue(typeface),\n size\n )\n ),\n Typeface: new JsiSkTypefaceFactory(CanvasKit),\n MaskFilter: new JsiSkMaskFilterFactory(CanvasKit),\n RuntimeEffect: new JsiSkRuntimeEffectFactory(CanvasKit),\n ImageFilter: new JsiSkImageFilterFactory(CanvasKit),\n Shader: new JsiSkShaderFactory(CanvasKit),\n PathEffect: new JsiSkPathEffectFactory(CanvasKit),\n MakeVertices: MakeVertices.bind(null, CanvasKit),\n Data: new JsiSkDataFactory(CanvasKit),\n Image: new JsiSkImageFactory(CanvasKit),\n AnimatedImage: new JsiSkAnimatedImageFactory(CanvasKit),\n SVG: new JsiSkSVGFactory(CanvasKit),\n TextBlob: new JsiSkTextBlobFactory(CanvasKit),\n XYWHRect: (x: number, y: number, width: number, height: number) => {\n return new JsiSkRect(CanvasKit, CanvasKit.XYWHRect(x, y, width, height));\n },\n Surface: new JsiSkSurfaceFactory(CanvasKit),\n TypefaceFontProvider: new JsiSkTypefaceFontProviderFactory(CanvasKit),\n FontMgr: new JsiSkFontMgrFactory(CanvasKit),\n ParagraphBuilder: new JsiSkParagraphBuilderFactory(CanvasKit),\n NativeBuffer: new JsiSkNativeBufferFactory(CanvasKit),\n Video: createVideo.bind(null, CanvasKit),\n Context: (_surface: bigint, _width: number, _height: number) => {\n throw new Error(\"Not implemented on React Native Web\");\n },\n});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siSkSurfaceFactory","JsiSkRRect","JsiSkRSXform","JsiSkContourMeasureIter","JsiSkPictureRecorder","JsiSkPictureFactory","JsiSkPathFactory","JsiSkMatrix","JsiSkColorFilterFactory","JsiSkTypefaceFactory","JsiSkMaskFilterFactory","JsiSkRuntimeEffectFactory","JsiSkImageFilterFactory","JsiSkShaderFactory","JsiSkPathEffectFactory","JsiSkDataFactory","JsiSkImageFactory","JsiSkSVGFactory","JsiSkTextBlobFactory","JsiSkFont","MakeVertices","JsiSkPath","JsiSkTypeface","JsiSkTypefaceFontProviderFactory","JsiSkFontMgrFactory","JsiSkAnimatedImageFactory","JsiSkParagraphBuilderFactory","JsiSkNativeBufferFactory","createVideo","JsiSkApi","CanvasKit","Point","x","y","Float32Array","of","RuntimeShaderBuilder","_","Error","RRectXY","rect","rx","ry","RSXform","scos","ssin","tx","ty","RSXformFromRadians","scale","r","px","py","s","Math","sin","c","cos","ContourMeasureIter","path","forceClosed","resScale","fromValue","Paint","paint","setAntiAlias","PictureRecorder","Picture","Path","Matrix","matrix","identity","ColorFilter","Font","typeface","size","undefined","Typeface","MaskFilter","RuntimeEffect","ImageFilter","Shader","PathEffect","bind","Data","Image","AnimatedImage","SVG","TextBlob","XYWHRect","width","height","Surface","TypefaceFontProvider","FontMgr","ParagraphBuilder","NativeBuffer","Video","Context","_surface","_width","_height","Recorder"],"sources":["JsiSkia.ts"],"sourcesContent":["import type { CanvasKit } from \"canvaskit-wasm\";\n\nimport type {\n SkContourMeasureIter,\n Skia,\n SkPath,\n SkRect,\n SkRuntimeEffect,\n SkRuntimeShaderBuilder,\n SkTypeface,\n} from \"../types\";\n\nimport { JsiSkPoint } from \"./JsiSkPoint\";\nimport { JsiSkPaint } from \"./JsiSkPaint\";\nimport { JsiSkRect } from \"./JsiSkRect\";\nimport { Color } from \"./JsiSkColor\";\nimport { JsiSkSurfaceFactory } from \"./JsiSkSurfaceFactory\";\nimport { JsiSkRRect } from \"./JsiSkRRect\";\nimport { JsiSkRSXform } from \"./JsiSkRSXform\";\nimport { JsiSkContourMeasureIter } from \"./JsiSkContourMeasureIter\";\nimport { JsiSkPictureRecorder } from \"./JsiSkPictureRecorder\";\nimport { JsiSkPictureFactory } from \"./JsiSkPictureFactory\";\nimport { JsiSkPathFactory } from \"./JsiSkPathFactory\";\nimport { JsiSkMatrix } from \"./JsiSkMatrix\";\nimport { JsiSkColorFilterFactory } from \"./JsiSkColorFilterFactory\";\nimport { JsiSkTypefaceFactory } from \"./JsiSkTypefaceFactory\";\nimport { JsiSkMaskFilterFactory } from \"./JsiSkMaskFilterFactory\";\nimport { JsiSkRuntimeEffectFactory } from \"./JsiSkRuntimeEffectFactory\";\nimport { JsiSkImageFilterFactory } from \"./JsiSkImageFilterFactory\";\nimport { JsiSkShaderFactory } from \"./JsiSkShaderFactory\";\nimport { JsiSkPathEffectFactory } from \"./JsiSkPathEffectFactory\";\nimport { JsiSkDataFactory } from \"./JsiSkDataFactory\";\nimport { JsiSkImageFactory } from \"./JsiSkImageFactory\";\nimport { JsiSkSVGFactory } from \"./JsiSkSVGFactory\";\nimport { JsiSkTextBlobFactory } from \"./JsiSkTextBlobFactory\";\nimport { JsiSkFont } from \"./JsiSkFont\";\nimport { MakeVertices } from \"./JsiSkVerticesFactory\";\nimport { JsiSkPath } from \"./JsiSkPath\";\nimport { JsiSkTypeface } from \"./JsiSkTypeface\";\nimport { JsiSkTypefaceFontProviderFactory } from \"./JsiSkTypefaceFontProviderFactory\";\nimport { JsiSkFontMgrFactory } from \"./JsiSkFontMgrFactory\";\nimport { JsiSkAnimatedImageFactory } from \"./JsiSkAnimatedImageFactory\";\nimport { JsiSkParagraphBuilderFactory } from \"./JsiSkParagraphBuilderFactory\";\nimport { JsiSkNativeBufferFactory } from \"./JsiSkNativeBufferFactory\";\nimport { createVideo } from \"./JsiVideo\";\n\nexport const JsiSkApi = (CanvasKit: CanvasKit): Skia => ({\n Point: (x: number, y: number) =>\n new JsiSkPoint(CanvasKit, Float32Array.of(x, y)),\n RuntimeShaderBuilder: (_: SkRuntimeEffect): SkRuntimeShaderBuilder => {\n throw new Error(\"Not implemented on React Native Web\");\n },\n RRectXY: (rect: SkRect, rx: number, ry: number) =>\n new JsiSkRRect(CanvasKit, rect, rx, ry),\n RSXform: (scos: number, ssin: number, tx: number, ty: number) =>\n new JsiSkRSXform(CanvasKit, Float32Array.of(scos, ssin, tx, ty)),\n RSXformFromRadians: (\n scale: number,\n r: number,\n tx: number,\n ty: number,\n px: number,\n py: number\n ) => {\n const s = Math.sin(r) * scale;\n const c = Math.cos(r) * scale;\n return new JsiSkRSXform(\n CanvasKit,\n Float32Array.of(c, s, tx - c * px + s * py, ty - s * px - c * py)\n );\n },\n Color,\n ContourMeasureIter: (\n path: SkPath,\n forceClosed: boolean,\n resScale: number\n ): SkContourMeasureIter =>\n new JsiSkContourMeasureIter(\n CanvasKit,\n new CanvasKit.ContourMeasureIter(\n JsiSkPath.fromValue(path),\n forceClosed,\n resScale\n )\n ),\n Paint: () => {\n const paint = new JsiSkPaint(CanvasKit, new CanvasKit.Paint());\n paint.setAntiAlias(true);\n return paint;\n },\n PictureRecorder: () =>\n new JsiSkPictureRecorder(CanvasKit, new CanvasKit.PictureRecorder()),\n Picture: new JsiSkPictureFactory(CanvasKit),\n Path: new JsiSkPathFactory(CanvasKit),\n Matrix: (matrix?: readonly number[]) =>\n new JsiSkMatrix(\n CanvasKit,\n matrix\n ? Float32Array.of(...matrix)\n : Float32Array.of(...CanvasKit.Matrix.identity())\n ),\n ColorFilter: new JsiSkColorFilterFactory(CanvasKit),\n Font: (typeface?: SkTypeface, size?: number) =>\n new JsiSkFont(\n CanvasKit,\n new CanvasKit.Font(\n typeface === undefined ? null : JsiSkTypeface.fromValue(typeface),\n size\n )\n ),\n Typeface: new JsiSkTypefaceFactory(CanvasKit),\n MaskFilter: new JsiSkMaskFilterFactory(CanvasKit),\n RuntimeEffect: new JsiSkRuntimeEffectFactory(CanvasKit),\n ImageFilter: new JsiSkImageFilterFactory(CanvasKit),\n Shader: new JsiSkShaderFactory(CanvasKit),\n PathEffect: new JsiSkPathEffectFactory(CanvasKit),\n MakeVertices: MakeVertices.bind(null, CanvasKit),\n Data: new JsiSkDataFactory(CanvasKit),\n Image: new JsiSkImageFactory(CanvasKit),\n AnimatedImage: new JsiSkAnimatedImageFactory(CanvasKit),\n SVG: new JsiSkSVGFactory(CanvasKit),\n TextBlob: new JsiSkTextBlobFactory(CanvasKit),\n XYWHRect: (x: number, y: number, width: number, height: number) => {\n return new JsiSkRect(CanvasKit, CanvasKit.XYWHRect(x, y, width, height));\n },\n Surface: new JsiSkSurfaceFactory(CanvasKit),\n TypefaceFontProvider: new JsiSkTypefaceFontProviderFactory(CanvasKit),\n FontMgr: new JsiSkFontMgrFactory(CanvasKit),\n ParagraphBuilder: new JsiSkParagraphBuilderFactory(CanvasKit),\n NativeBuffer: new JsiSkNativeBufferFactory(CanvasKit),\n Video: createVideo.bind(null, CanvasKit),\n Context: (_surface: bigint, _width: number, _height: number) => {\n throw new Error(\"Not implemented on React Native Web\");\n },\n Recorder: () => {\n throw new Error(\"Not implemented on React Native Web\");\n },\n});\n"],"mappings":"AAYA,SAASA,UAAU,QAAQ,cAAc;AACzC,SAASC,UAAU,QAAQ,cAAc;AACzC,SAASC,SAAS,QAAQ,aAAa;AACvC,SAASC,KAAK,QAAQ,cAAc;AACpC,SAASC,mBAAmB,QAAQ,uBAAuB;AAC3D,SAASC,UAAU,QAAQ,cAAc;AACzC,SAASC,YAAY,QAAQ,gBAAgB;AAC7C,SAASC,uBAAuB,QAAQ,2BAA2B;AACnE,SAASC,oBAAoB,QAAQ,wBAAwB;AAC7D,SAASC,mBAAmB,QAAQ,uBAAuB;AAC3D,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,WAAW,QAAQ,eAAe;AAC3C,SAASC,uBAAuB,QAAQ,2BAA2B;AACnE,SAASC,oBAAoB,QAAQ,wBAAwB;AAC7D,SAASC,sBAAsB,QAAQ,0BAA0B;AACjE,SAAS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AAI7F,SAAS,CAACgC,SAAS,EAAEA,SAAS,CAAC2D,QAAQ,CAACzD,CAAC,EAAEC,CAAC,EAAEyD,KAAK,EAAEC,MAAM,CAAC,CAAC;EAC1E,CAAC;EACDC,OAAO,EAAE,IAAI5F,mBAAmB,CAAC8B,SAAS,CAAC;EAC3C+D,oBAAoB,EAAE,IAAItE,gCAAgC,CAACO,SAAS,CAAC;EACrEgE,OAAO,EAAE,IAAItE,mBAAmB,CAACM,SAAS,CAAC;EAC3CiE,gBAAgB,EAAE,IAAIrE,4BAA4B,CAACI,SAAS,CAAC;EAC7DkE,YAAY,EAAE,IAAIrE,wBAAwB,CAACG,SAAS,CAAC;EACrDmE,KAAK,EAAErE,WAAW,CAACuD,IAAI,CAAC,IAAI,EAAErD,SAAS,CAAC;EACxCoE,OAAO,EAAEA,CAACC,QAAgB,EAAEC,MAAc,EAAEC,OAAe,KAAK;IAC9D,MAAM,IAAI/D,KAAK,CAAC,qCAAqC,CAAC;EACxD,CAAC;EACDgE,QAAQ,EAAEA,CAAA,KAAM;IACd,MAAM,IAAIhE,KAAK,CAAC,qCAAqC,CAAC;EACxD;AACF,CAAC,CAAC","ignoreList":[]}
@@ -19,5 +19,10 @@ declare class ReanimatedContainer extends Container {
19
19
  constructor(Skia: Skia, nativeId: number);
20
20
  redraw(): void;
21
21
  }
22
- export declare const createContainer: (Skia: Skia, nativeId: number) => StaticContainer | ReanimatedContainer;
22
+ declare class NativeReanimatedContainer extends Container {
23
+ private mapperId;
24
+ constructor(Skia: Skia, nativeId: number);
25
+ redraw(): void;
26
+ }
27
+ export declare const createContainer: (Skia: Skia, nativeId: number) => StaticContainer | ReanimatedContainer | NativeReanimatedContainer;
23
28
  export {};
@@ -3,10 +3,12 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
3
3
  function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
4
4
  import Rea from "../external/reanimated/ReanimatedProxy";
5
5
  import { HAS_REANIMATED_3 } from "../external/reanimated/renderHelpers";
6
+ import { Platform } from "../Platform";
6
7
  import { Recorder } from "./Recorder/Recorder";
7
8
  import { visit } from "./Recorder/Visitor";
8
9
  import { replay } from "./Recorder/Player";
9
10
  import { createDrawingContext } from "./Recorder/DrawingContext";
11
+ import { ReanimatedRecorder } from "./Recorder/ReanimatedRecorder";
10
12
  const drawOnscreen = (Skia, nativeId, recording) => {
11
13
  "worklet";
12
14
 
@@ -23,6 +25,21 @@ const drawOnscreen = (Skia, nativeId, recording) => {
23
25
  rec.dispose();
24
26
  picture.dispose();
25
27
  };
28
+ const nativeDrawOnscreen = (Skia, nativeId, recorder) => {
29
+ "worklet";
30
+
31
+ const rec = Skia.PictureRecorder();
32
+ const canvas = rec.beginRecording();
33
+ //const start = performance.now();
34
+
35
+ recorder.play(canvas);
36
+ const picture = rec.finishRecordingAsPicture();
37
+ //const end = performance.now();
38
+ //console.log("Recording time: ", end - start);
39
+ SkiaViewApi.setJsiProperty(nativeId, "picture", picture);
40
+ rec.dispose();
41
+ picture.dispose();
42
+ };
26
43
  export class Container {
27
44
  constructor(Skia, nativeId) {
28
45
  this.Skia = Skia;
@@ -35,7 +52,6 @@ export class Container {
35
52
  throw new Error("No recording to draw");
36
53
  }
37
54
  const ctx = createDrawingContext(this.Skia, this.recording.paintPool, canvas);
38
- //console.log(this.recording.commands);
39
55
  replay(ctx, this.recording.commands);
40
56
  }
41
57
  }
@@ -95,7 +111,48 @@ class ReanimatedContainer extends Container {
95
111
  })();
96
112
  }
97
113
  }
114
+ class NativeReanimatedContainer extends Container {
115
+ constructor(Skia, nativeId) {
116
+ super(Skia, nativeId);
117
+ _defineProperty(this, "mapperId", null);
118
+ }
119
+ redraw() {
120
+ if (this.mapperId !== null) {
121
+ Rea.stopMapper(this.mapperId);
122
+ }
123
+ const {
124
+ nativeId,
125
+ Skia
126
+ } = this;
127
+ const recorder = new ReanimatedRecorder(Skia);
128
+ visit(recorder, this.root);
129
+ const sharedValues = recorder.getSharedValues();
130
+ const sharedRecorder = recorder.getRecorder();
131
+ if (sharedValues.length > 0) {
132
+ this.mapperId = Rea.startMapper(() => {
133
+ "worklet";
134
+
135
+ sharedRecorder.applyUpdates(sharedValues);
136
+ nativeDrawOnscreen(Skia, nativeId, sharedRecorder);
137
+ }, sharedValues);
138
+ }
139
+ Rea.runOnUI(() => {
140
+ "worklet";
141
+
142
+ nativeDrawOnscreen(Skia, nativeId, sharedRecorder);
143
+ })();
144
+ }
145
+ }
98
146
  export const createContainer = (Skia, nativeId) => {
99
- return HAS_REANIMATED_3 && nativeId !== -1 ? new ReanimatedContainer(Skia, nativeId) : new StaticContainer(Skia, nativeId);
147
+ const native = Platform.OS !== "web";
148
+ if (HAS_REANIMATED_3 && nativeId !== -1) {
149
+ if (native) {
150
+ return new NativeReanimatedContainer(Skia, nativeId);
151
+ } else {
152
+ return new ReanimatedContainer(Skia, nativeId);
153
+ }
154
+ } else {
155
+ return new StaticContainer(Skia, nativeId);
156
+ }
100
157
  };
101
158
  //# sourceMappingURL=Container.js.map