@shopify/react-native-skia 1.8.0 → 1.8.2
Sign up to get free protection for your applications and to get access to all the features.
- package/cpp/api/JsiSkPaint.h +8 -1
- package/lib/commonjs/dom/types/Common.d.ts +6 -4
- package/lib/commonjs/dom/types/Common.js.map +1 -1
- package/lib/commonjs/dom/types/ImageFilters.d.ts +1 -1
- package/lib/commonjs/dom/types/ImageFilters.js.map +1 -1
- package/lib/commonjs/dom/types/Node.d.ts +0 -2
- package/lib/commonjs/dom/types/Node.js.map +1 -1
- package/lib/commonjs/external/reanimated/index.d.ts +0 -1
- package/lib/commonjs/external/reanimated/index.js +0 -11
- package/lib/commonjs/external/reanimated/index.js.map +1 -1
- package/lib/commonjs/external/reanimated/renderHelpers.d.ts +0 -1
- package/lib/commonjs/external/reanimated/renderHelpers.js +5 -43
- package/lib/commonjs/external/reanimated/renderHelpers.js.map +1 -1
- package/lib/commonjs/external/reanimated/useAnimatedImageValue.js +1 -8
- package/lib/commonjs/external/reanimated/useAnimatedImageValue.js.map +1 -1
- package/lib/commonjs/skia/core/AnimatedImage.d.ts +1 -1
- package/lib/commonjs/skia/core/AnimatedImage.js +1 -1
- package/lib/commonjs/skia/core/AnimatedImage.js.map +1 -1
- package/lib/commonjs/skia/core/Data.d.ts +1 -1
- package/lib/commonjs/skia/core/Data.js +2 -8
- package/lib/commonjs/skia/core/Data.js.map +1 -1
- package/lib/commonjs/skia/types/Paint/Paint.d.ts +1 -0
- package/lib/commonjs/skia/types/Paint/Paint.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPaint.d.ts +1 -0
- package/lib/commonjs/skia/web/JsiSkPaint.js +3 -0
- package/lib/commonjs/skia/web/JsiSkPaint.js.map +1 -1
- package/lib/commonjs/sksg/Container.d.ts +3 -2
- package/lib/commonjs/sksg/Container.js +32 -26
- package/lib/commonjs/sksg/Container.js.map +1 -1
- package/lib/commonjs/sksg/HostConfig.d.ts +2 -2
- package/lib/commonjs/sksg/HostConfig.js +7 -25
- package/lib/commonjs/sksg/HostConfig.js.map +1 -1
- package/lib/commonjs/sksg/Node.d.ts +19 -0
- package/lib/commonjs/sksg/Node.js +78 -0
- package/lib/commonjs/sksg/Node.js.map +1 -0
- package/lib/commonjs/sksg/Reconciler.d.ts +1 -1
- package/lib/commonjs/sksg/Recorder/Core.d.ts +79 -0
- package/lib/commonjs/sksg/Recorder/Core.js +110 -0
- package/lib/commonjs/sksg/Recorder/Core.js.map +1 -0
- package/lib/commonjs/sksg/Recorder/DrawingContext.d.ts +18 -0
- package/lib/commonjs/sksg/Recorder/DrawingContext.js +105 -0
- package/lib/commonjs/sksg/Recorder/DrawingContext.js.map +1 -0
- package/lib/commonjs/sksg/Recorder/Player.d.ts +3 -0
- package/lib/commonjs/sksg/Recorder/Player.js +127 -0
- package/lib/commonjs/sksg/Recorder/Player.js.map +1 -0
- package/lib/commonjs/sksg/Recorder/Recorder.d.ts +50 -0
- package/lib/commonjs/sksg/Recorder/Recorder.js +288 -0
- package/lib/commonjs/sksg/Recorder/Recorder.js.map +1 -0
- package/lib/commonjs/sksg/Recorder/Recording.d.ts +7 -0
- package/lib/commonjs/sksg/Recorder/Recording.js +12 -0
- package/lib/commonjs/sksg/Recorder/Recording.js.map +1 -0
- package/lib/commonjs/sksg/Recorder/Visitor.d.ts +5 -0
- package/lib/commonjs/sksg/Recorder/Visitor.js +293 -0
- package/lib/commonjs/sksg/Recorder/Visitor.js.map +1 -0
- package/lib/commonjs/sksg/Recorder/commands/Box.d.ts +13 -0
- package/lib/commonjs/sksg/Recorder/commands/Box.js +71 -0
- package/lib/commonjs/sksg/Recorder/commands/Box.js.map +1 -0
- package/lib/commonjs/sksg/Recorder/commands/CTM.d.ts +3 -0
- package/lib/commonjs/sksg/Recorder/commands/CTM.js +79 -0
- package/lib/commonjs/sksg/Recorder/commands/CTM.js.map +1 -0
- package/lib/commonjs/sksg/Recorder/commands/ColorFilters.d.ts +6 -0
- package/lib/commonjs/sksg/Recorder/commands/ColorFilters.js +76 -0
- package/lib/commonjs/sksg/Recorder/commands/ColorFilters.js.map +1 -0
- package/lib/commonjs/sksg/Recorder/commands/Drawing.d.ts +24 -0
- package/lib/commonjs/sksg/{nodes/drawings.js → Recorder/commands/Drawing.js} +5 -5
- package/lib/commonjs/sksg/Recorder/commands/Drawing.js.map +1 -0
- package/lib/commonjs/sksg/Recorder/commands/ImageFilters.d.ts +12 -0
- package/lib/commonjs/sksg/Recorder/commands/ImageFilters.js +183 -0
- package/lib/commonjs/sksg/Recorder/commands/ImageFilters.js.map +1 -0
- package/lib/commonjs/sksg/Recorder/commands/Paint.d.ts +4 -0
- package/lib/commonjs/sksg/Recorder/commands/Paint.js +70 -0
- package/lib/commonjs/sksg/Recorder/commands/Paint.js.map +1 -0
- package/lib/commonjs/sksg/Recorder/commands/PathEffects.d.ts +6 -0
- package/lib/commonjs/sksg/Recorder/commands/PathEffects.js +137 -0
- package/lib/commonjs/sksg/Recorder/commands/PathEffects.js.map +1 -0
- package/lib/commonjs/sksg/Recorder/commands/Shaders.d.ts +5 -0
- package/lib/commonjs/sksg/{nodes/shaders.js → Recorder/commands/Shaders.js} +58 -15
- package/lib/commonjs/sksg/Recorder/commands/Shaders.js.map +1 -0
- package/lib/commonjs/sksg/{nodes/utils.d.ts → utils.d.ts} +3 -0
- package/lib/commonjs/sksg/{nodes/utils.js → utils.js} +12 -2
- package/lib/commonjs/sksg/utils.js.map +1 -0
- package/lib/module/dom/types/Common.d.ts +6 -4
- package/lib/module/dom/types/Common.js.map +1 -1
- package/lib/module/dom/types/ImageFilters.d.ts +1 -1
- package/lib/module/dom/types/ImageFilters.js.map +1 -1
- package/lib/module/dom/types/Node.d.ts +0 -2
- package/lib/module/dom/types/Node.js.map +1 -1
- package/lib/module/external/reanimated/index.d.ts +0 -1
- package/lib/module/external/reanimated/index.js +0 -1
- package/lib/module/external/reanimated/index.js.map +1 -1
- package/lib/module/external/reanimated/renderHelpers.d.ts +0 -1
- package/lib/module/external/reanimated/renderHelpers.js +4 -42
- package/lib/module/external/reanimated/renderHelpers.js.map +1 -1
- package/lib/module/external/reanimated/useAnimatedImageValue.js +1 -8
- package/lib/module/external/reanimated/useAnimatedImageValue.js.map +1 -1
- package/lib/module/skia/core/AnimatedImage.d.ts +1 -1
- package/lib/module/skia/core/AnimatedImage.js +1 -1
- package/lib/module/skia/core/AnimatedImage.js.map +1 -1
- package/lib/module/skia/core/Data.d.ts +1 -1
- package/lib/module/skia/core/Data.js +2 -8
- package/lib/module/skia/core/Data.js.map +1 -1
- package/lib/module/skia/types/Paint/Paint.d.ts +1 -0
- package/lib/module/skia/types/Paint/Paint.js.map +1 -1
- package/lib/module/skia/web/JsiSkPaint.d.ts +1 -0
- package/lib/module/skia/web/JsiSkPaint.js +3 -0
- package/lib/module/skia/web/JsiSkPaint.js.map +1 -1
- package/lib/module/sksg/Container.d.ts +3 -2
- package/lib/module/sksg/Container.js +30 -24
- package/lib/module/sksg/Container.js.map +1 -1
- package/lib/module/sksg/HostConfig.d.ts +2 -2
- package/lib/module/sksg/HostConfig.js +7 -25
- package/lib/module/sksg/HostConfig.js.map +1 -1
- package/lib/module/sksg/Node.d.ts +19 -0
- package/lib/module/sksg/Node.js +67 -0
- package/lib/module/sksg/Node.js.map +1 -0
- package/lib/module/sksg/Reconciler.d.ts +1 -1
- package/lib/module/sksg/Recorder/Core.d.ts +79 -0
- package/lib/module/sksg/Recorder/Core.js +101 -0
- package/lib/module/sksg/Recorder/Core.js.map +1 -0
- package/lib/module/sksg/Recorder/DrawingContext.d.ts +18 -0
- package/lib/module/sksg/Recorder/DrawingContext.js +98 -0
- package/lib/module/sksg/Recorder/DrawingContext.js.map +1 -0
- package/lib/module/sksg/Recorder/Player.d.ts +3 -0
- package/lib/module/sksg/Recorder/Player.js +120 -0
- package/lib/module/sksg/Recorder/Player.js.map +1 -0
- package/lib/module/sksg/Recorder/Recorder.d.ts +50 -0
- package/lib/module/sksg/Recorder/Recorder.js +281 -0
- package/lib/module/sksg/Recorder/Recorder.js.map +1 -0
- package/lib/module/sksg/Recorder/Recording.d.ts +7 -0
- package/lib/module/sksg/Recorder/Recording.js +5 -0
- package/lib/module/sksg/Recorder/Recording.js.map +1 -0
- package/lib/module/sksg/Recorder/Visitor.d.ts +5 -0
- package/lib/module/sksg/Recorder/Visitor.js +285 -0
- package/lib/module/sksg/Recorder/Visitor.js.map +1 -0
- package/lib/module/sksg/Recorder/commands/Box.d.ts +13 -0
- package/lib/module/sksg/Recorder/commands/Box.js +63 -0
- package/lib/module/sksg/Recorder/commands/Box.js.map +1 -0
- package/lib/module/sksg/Recorder/commands/CTM.d.ts +3 -0
- package/lib/module/sksg/Recorder/commands/CTM.js +72 -0
- package/lib/module/sksg/Recorder/commands/CTM.js.map +1 -0
- package/lib/module/sksg/Recorder/commands/ColorFilters.d.ts +6 -0
- package/lib/module/sksg/Recorder/commands/ColorFilters.js +67 -0
- package/lib/module/sksg/Recorder/commands/ColorFilters.js.map +1 -0
- package/lib/module/sksg/Recorder/commands/Drawing.d.ts +24 -0
- package/lib/module/sksg/{nodes/drawings.js → Recorder/commands/Drawing.js} +5 -5
- package/lib/module/sksg/Recorder/commands/Drawing.js.map +1 -0
- package/lib/module/sksg/Recorder/commands/ImageFilters.d.ts +12 -0
- package/lib/module/sksg/{nodes/imageFilters.js → Recorder/commands/ImageFilters.js} +87 -95
- package/lib/module/sksg/Recorder/commands/ImageFilters.js.map +1 -0
- package/lib/module/sksg/Recorder/commands/Paint.d.ts +4 -0
- package/lib/module/sksg/Recorder/commands/Paint.js +62 -0
- package/lib/module/sksg/Recorder/commands/Paint.js.map +1 -0
- package/lib/module/sksg/Recorder/commands/PathEffects.d.ts +6 -0
- package/lib/module/sksg/Recorder/commands/PathEffects.js +128 -0
- package/lib/module/sksg/Recorder/commands/PathEffects.js.map +1 -0
- package/lib/module/sksg/Recorder/commands/Shaders.d.ts +5 -0
- package/lib/module/sksg/{nodes/shaders.js → Recorder/commands/Shaders.js} +63 -13
- package/lib/module/sksg/Recorder/commands/Shaders.js.map +1 -0
- package/lib/module/sksg/{nodes/utils.d.ts → utils.d.ts} +3 -0
- package/lib/module/sksg/{nodes/utils.js → utils.js} +10 -1
- package/lib/module/sksg/utils.js.map +1 -0
- package/lib/typescript/lib/commonjs/external/reanimated/renderHelpers.d.ts +0 -1
- package/lib/typescript/lib/commonjs/skia/core/AnimatedImage.d.ts +1 -1
- package/lib/typescript/lib/commonjs/skia/core/Data.d.ts +1 -1
- package/lib/typescript/lib/commonjs/skia/web/JsiSkPaint.d.ts +1 -0
- package/lib/typescript/lib/commonjs/sksg/Container.d.ts +4 -0
- package/lib/typescript/lib/commonjs/sksg/HostConfig.d.ts +1 -3
- package/lib/typescript/lib/commonjs/sksg/Node.d.ts +14 -0
- package/lib/typescript/lib/commonjs/sksg/Recorder/Core.d.ts +5 -0
- package/lib/typescript/lib/commonjs/sksg/Recorder/DrawingContext.d.ts +17 -0
- package/lib/typescript/lib/commonjs/sksg/Recorder/Player.d.ts +2 -0
- package/lib/typescript/lib/commonjs/sksg/Recorder/Recorder.d.ts +45 -0
- package/lib/typescript/lib/commonjs/sksg/Recorder/Recording.d.ts +5 -0
- package/lib/typescript/lib/commonjs/sksg/Recorder/Visitor.d.ts +27 -0
- package/lib/typescript/lib/commonjs/sksg/Recorder/commands/Box.d.ts +3 -0
- package/lib/typescript/lib/commonjs/sksg/Recorder/commands/CTM.d.ts +2 -0
- package/lib/typescript/lib/commonjs/sksg/Recorder/commands/ColorFilters.d.ts +4 -0
- package/lib/typescript/lib/commonjs/sksg/Recorder/commands/ImageFilters.d.ts +6 -0
- package/lib/typescript/lib/commonjs/sksg/Recorder/commands/Paint.d.ts +14 -0
- package/lib/typescript/lib/commonjs/sksg/Recorder/commands/PathEffects.d.ts +4 -0
- package/lib/typescript/lib/commonjs/sksg/Recorder/commands/Shaders.d.ts +3 -0
- package/lib/typescript/lib/commonjs/sksg/{nodes/utils.d.ts → utils.d.ts} +1 -0
- package/lib/typescript/lib/module/external/reanimated/index.d.ts +0 -1
- package/lib/typescript/lib/module/external/reanimated/renderHelpers.d.ts +0 -1
- package/lib/typescript/lib/module/mock/index.d.ts +1 -1
- package/lib/typescript/lib/module/skia/core/AnimatedImage.d.ts +1 -1
- package/lib/typescript/lib/module/skia/core/Data.d.ts +1 -1
- package/lib/typescript/lib/module/skia/web/JsiSkPaint.d.ts +1 -0
- package/lib/typescript/lib/module/sksg/Container.d.ts +4 -0
- package/lib/typescript/lib/module/sksg/HostConfig.d.ts +1 -3
- package/lib/typescript/lib/module/sksg/Node.d.ts +13 -0
- package/lib/typescript/lib/module/sksg/Recorder/Core.d.ts +4 -0
- package/lib/typescript/lib/module/sksg/Recorder/DrawingContext.d.ts +16 -0
- package/lib/typescript/lib/module/sksg/Recorder/Player.d.ts +1 -0
- package/lib/typescript/lib/module/sksg/Recorder/Recorder.d.ts +44 -0
- package/lib/typescript/lib/module/sksg/Recorder/Recording.d.ts +4 -0
- package/lib/typescript/lib/module/sksg/Recorder/Visitor.d.ts +26 -0
- package/lib/typescript/lib/module/sksg/Recorder/commands/Box.d.ts +2 -0
- package/lib/typescript/lib/module/sksg/Recorder/commands/CTM.d.ts +1 -0
- package/lib/typescript/lib/module/sksg/Recorder/commands/ColorFilters.d.ts +3 -0
- package/lib/typescript/lib/module/sksg/Recorder/commands/ImageFilters.d.ts +5 -0
- package/lib/typescript/lib/module/sksg/Recorder/commands/Paint.d.ts +13 -0
- package/lib/typescript/lib/module/sksg/Recorder/commands/PathEffects.d.ts +3 -0
- package/lib/typescript/lib/module/sksg/Recorder/commands/Shaders.d.ts +2 -0
- package/lib/typescript/lib/module/sksg/{nodes/utils.d.ts → utils.d.ts} +1 -0
- package/lib/typescript/src/dom/types/Common.d.ts +6 -4
- package/lib/typescript/src/dom/types/ImageFilters.d.ts +1 -1
- package/lib/typescript/src/dom/types/Node.d.ts +0 -2
- package/lib/typescript/src/external/reanimated/index.d.ts +0 -1
- package/lib/typescript/src/external/reanimated/renderHelpers.d.ts +0 -1
- package/lib/typescript/src/skia/core/AnimatedImage.d.ts +1 -1
- package/lib/typescript/src/skia/core/Data.d.ts +1 -1
- package/lib/typescript/src/skia/types/Paint/Paint.d.ts +1 -0
- package/lib/typescript/src/skia/web/JsiSkPaint.d.ts +1 -0
- package/lib/typescript/src/sksg/Container.d.ts +3 -2
- package/lib/typescript/src/sksg/HostConfig.d.ts +2 -2
- package/lib/typescript/src/sksg/Node.d.ts +19 -0
- package/lib/typescript/src/sksg/Reconciler.d.ts +1 -1
- package/lib/typescript/src/sksg/Recorder/Core.d.ts +79 -0
- package/lib/typescript/src/sksg/Recorder/DrawingContext.d.ts +18 -0
- package/lib/typescript/src/sksg/Recorder/Player.d.ts +3 -0
- package/lib/typescript/src/sksg/Recorder/Recorder.d.ts +50 -0
- package/lib/typescript/src/sksg/Recorder/Recording.d.ts +7 -0
- package/lib/typescript/src/sksg/Recorder/Visitor.d.ts +5 -0
- package/lib/typescript/src/sksg/Recorder/commands/Box.d.ts +13 -0
- package/lib/typescript/src/sksg/Recorder/commands/CTM.d.ts +3 -0
- package/lib/typescript/src/sksg/Recorder/commands/ColorFilters.d.ts +6 -0
- package/lib/typescript/src/sksg/Recorder/commands/Drawing.d.ts +24 -0
- package/lib/typescript/src/sksg/Recorder/commands/ImageFilters.d.ts +12 -0
- package/lib/typescript/src/sksg/Recorder/commands/Paint.d.ts +4 -0
- package/lib/typescript/src/sksg/Recorder/commands/PathEffects.d.ts +6 -0
- package/lib/typescript/src/sksg/Recorder/commands/Shaders.d.ts +5 -0
- package/lib/typescript/src/sksg/{nodes/utils.d.ts → utils.d.ts} +3 -0
- package/package.json +1 -1
- package/src/__tests__/snapshots/image-filter/test-shadow.png +0 -0
- package/src/dom/types/Common.ts +7 -5
- package/src/dom/types/ImageFilters.ts +2 -1
- package/src/dom/types/Node.ts +0 -4
- package/src/external/reanimated/index.ts +0 -1
- package/src/external/reanimated/renderHelpers.ts +4 -44
- package/src/external/reanimated/useAnimatedImageValue.ts +4 -15
- package/src/renderer/__tests__/e2e/ColorFilters.spec.tsx +15 -0
- package/src/renderer/__tests__/e2e/Composition/ColorFilterComposition.spec.tsx +23 -2
- package/src/renderer/__tests__/e2e/ImageFilters.spec.tsx +91 -2
- package/src/renderer/__tests__/setup.tsx +1 -1
- package/src/skia/core/AnimatedImage.ts +2 -3
- package/src/skia/core/Data.ts +3 -9
- package/src/skia/types/Paint/Paint.ts +2 -0
- package/src/skia/web/JsiSkPaint.ts +4 -0
- package/src/sksg/Container.ts +35 -29
- package/src/sksg/HostConfig.ts +5 -50
- package/src/sksg/Node.ts +105 -0
- package/src/sksg/Recorder/Core.ts +171 -0
- package/src/sksg/Recorder/DrawingContext.ts +130 -0
- package/src/sksg/Recorder/Player.ts +160 -0
- package/src/sksg/Recorder/Recorder.ts +259 -0
- package/src/sksg/Recorder/Recording.ts +13 -0
- package/src/sksg/Recorder/Visitor.ts +324 -0
- package/src/sksg/Recorder/commands/Box.ts +63 -0
- package/src/sksg/Recorder/commands/CTM.ts +72 -0
- package/src/sksg/Recorder/commands/ColorFilters.ts +87 -0
- package/src/sksg/{nodes/drawings.ts → Recorder/commands/Drawing.ts} +29 -65
- package/src/sksg/Recorder/commands/ImageFilters.ts +255 -0
- package/src/sksg/Recorder/commands/Paint.ts +77 -0
- package/src/sksg/Recorder/commands/PathEffects.ts +169 -0
- package/src/sksg/{nodes/shaders.ts → Recorder/commands/Shaders.ts} +100 -26
- package/src/sksg/{nodes/utils.ts → utils.ts} +14 -1
- package/lib/commonjs/external/reanimated/useDerivedValueOnJS.d.ts +0 -1
- package/lib/commonjs/external/reanimated/useDerivedValueOnJS.js +0 -24
- package/lib/commonjs/external/reanimated/useDerivedValueOnJS.js.map +0 -1
- package/lib/commonjs/sksg/DeclarationContext.d.ts +0 -56
- package/lib/commonjs/sksg/DeclarationContext.js +0 -77
- package/lib/commonjs/sksg/DeclarationContext.js.map +0 -1
- package/lib/commonjs/sksg/DrawingContext.d.ts +0 -13
- package/lib/commonjs/sksg/DrawingContext.js +0 -172
- package/lib/commonjs/sksg/DrawingContext.js.map +0 -1
- package/lib/commonjs/sksg/__tests__/Declarations.spec.d.ts +0 -1
- package/lib/commonjs/sksg/__tests__/MockDeclaration.d.ts +0 -57
- package/lib/commonjs/sksg/nodes/Node.d.ts +0 -7
- package/lib/commonjs/sksg/nodes/Node.js +0 -6
- package/lib/commonjs/sksg/nodes/Node.js.map +0 -1
- package/lib/commonjs/sksg/nodes/colorFilters.d.ts +0 -10
- package/lib/commonjs/sksg/nodes/colorFilters.js +0 -79
- package/lib/commonjs/sksg/nodes/colorFilters.js.map +0 -1
- package/lib/commonjs/sksg/nodes/context.d.ts +0 -3
- package/lib/commonjs/sksg/nodes/context.js +0 -394
- package/lib/commonjs/sksg/nodes/context.js.map +0 -1
- package/lib/commonjs/sksg/nodes/drawings.d.ts +0 -30
- package/lib/commonjs/sksg/nodes/drawings.js.map +0 -1
- package/lib/commonjs/sksg/nodes/imageFilters.d.ts +0 -17
- package/lib/commonjs/sksg/nodes/imageFilters.js +0 -197
- package/lib/commonjs/sksg/nodes/imageFilters.js.map +0 -1
- package/lib/commonjs/sksg/nodes/index.d.ts +0 -3
- package/lib/commonjs/sksg/nodes/index.js +0 -39
- package/lib/commonjs/sksg/nodes/index.js.map +0 -1
- package/lib/commonjs/sksg/nodes/paint.d.ts +0 -3
- package/lib/commonjs/sksg/nodes/paint.js +0 -81
- package/lib/commonjs/sksg/nodes/paint.js.map +0 -1
- package/lib/commonjs/sksg/nodes/pathEffects.d.ts +0 -11
- package/lib/commonjs/sksg/nodes/pathEffects.js +0 -111
- package/lib/commonjs/sksg/nodes/pathEffects.js.map +0 -1
- package/lib/commonjs/sksg/nodes/shaders.d.ts +0 -11
- package/lib/commonjs/sksg/nodes/shaders.js.map +0 -1
- package/lib/commonjs/sksg/nodes/utils.js.map +0 -1
- package/lib/module/external/reanimated/useDerivedValueOnJS.d.ts +0 -1
- package/lib/module/external/reanimated/useDerivedValueOnJS.js +0 -16
- package/lib/module/external/reanimated/useDerivedValueOnJS.js.map +0 -1
- package/lib/module/sksg/DeclarationContext.d.ts +0 -56
- package/lib/module/sksg/DeclarationContext.js +0 -69
- package/lib/module/sksg/DeclarationContext.js.map +0 -1
- package/lib/module/sksg/DrawingContext.d.ts +0 -13
- package/lib/module/sksg/DrawingContext.js +0 -165
- package/lib/module/sksg/DrawingContext.js.map +0 -1
- package/lib/module/sksg/__tests__/Declarations.spec.d.ts +0 -1
- package/lib/module/sksg/__tests__/MockDeclaration.d.ts +0 -57
- package/lib/module/sksg/nodes/Node.d.ts +0 -7
- package/lib/module/sksg/nodes/Node.js +0 -2
- package/lib/module/sksg/nodes/Node.js.map +0 -1
- package/lib/module/sksg/nodes/colorFilters.d.ts +0 -10
- package/lib/module/sksg/nodes/colorFilters.js +0 -66
- package/lib/module/sksg/nodes/colorFilters.js.map +0 -1
- package/lib/module/sksg/nodes/context.d.ts +0 -3
- package/lib/module/sksg/nodes/context.js +0 -387
- package/lib/module/sksg/nodes/context.js.map +0 -1
- package/lib/module/sksg/nodes/drawings.d.ts +0 -30
- package/lib/module/sksg/nodes/drawings.js.map +0 -1
- package/lib/module/sksg/nodes/imageFilters.d.ts +0 -17
- package/lib/module/sksg/nodes/imageFilters.js.map +0 -1
- package/lib/module/sksg/nodes/index.d.ts +0 -3
- package/lib/module/sksg/nodes/index.js +0 -4
- package/lib/module/sksg/nodes/index.js.map +0 -1
- package/lib/module/sksg/nodes/paint.d.ts +0 -3
- package/lib/module/sksg/nodes/paint.js +0 -74
- package/lib/module/sksg/nodes/paint.js.map +0 -1
- package/lib/module/sksg/nodes/pathEffects.d.ts +0 -11
- package/lib/module/sksg/nodes/pathEffects.js +0 -97
- package/lib/module/sksg/nodes/pathEffects.js.map +0 -1
- package/lib/module/sksg/nodes/shaders.d.ts +0 -11
- package/lib/module/sksg/nodes/shaders.js.map +0 -1
- package/lib/module/sksg/nodes/utils.js.map +0 -1
- package/lib/typescript/lib/commonjs/external/reanimated/useDerivedValueOnJS.d.ts +0 -2
- package/lib/typescript/lib/commonjs/sksg/DeclarationContext.d.ts +0 -53
- package/lib/typescript/lib/commonjs/sksg/DrawingContext.d.ts +0 -22
- package/lib/typescript/lib/commonjs/sksg/nodes/Node.d.ts +0 -1
- package/lib/typescript/lib/commonjs/sksg/nodes/colorFilters.d.ts +0 -8
- package/lib/typescript/lib/commonjs/sksg/nodes/context.d.ts +0 -2
- package/lib/typescript/lib/commonjs/sksg/nodes/imageFilters.d.ts +0 -12
- package/lib/typescript/lib/commonjs/sksg/nodes/index.d.ts +0 -1
- package/lib/typescript/lib/commonjs/sksg/nodes/paint.d.ts +0 -2
- package/lib/typescript/lib/commonjs/sksg/nodes/pathEffects.d.ts +0 -9
- package/lib/typescript/lib/commonjs/sksg/nodes/shaders.d.ts +0 -10
- package/lib/typescript/lib/module/external/reanimated/useDerivedValueOnJS.d.ts +0 -1
- package/lib/typescript/lib/module/sksg/DeclarationContext.d.ts +0 -52
- package/lib/typescript/lib/module/sksg/DrawingContext.d.ts +0 -21
- package/lib/typescript/lib/module/sksg/nodes/Node.d.ts +0 -1
- package/lib/typescript/lib/module/sksg/nodes/colorFilters.d.ts +0 -7
- package/lib/typescript/lib/module/sksg/nodes/context.d.ts +0 -1
- package/lib/typescript/lib/module/sksg/nodes/imageFilters.d.ts +0 -11
- package/lib/typescript/lib/module/sksg/nodes/index.d.ts +0 -3
- package/lib/typescript/lib/module/sksg/nodes/paint.d.ts +0 -1
- package/lib/typescript/lib/module/sksg/nodes/pathEffects.d.ts +0 -8
- package/lib/typescript/lib/module/sksg/nodes/shaders.d.ts +0 -9
- package/lib/typescript/src/external/reanimated/useDerivedValueOnJS.d.ts +0 -1
- package/lib/typescript/src/sksg/DeclarationContext.d.ts +0 -56
- package/lib/typescript/src/sksg/DrawingContext.d.ts +0 -13
- package/lib/typescript/src/sksg/__tests__/Declarations.spec.d.ts +0 -1
- package/lib/typescript/src/sksg/__tests__/MockDeclaration.d.ts +0 -57
- package/lib/typescript/src/sksg/nodes/Node.d.ts +0 -7
- package/lib/typescript/src/sksg/nodes/colorFilters.d.ts +0 -10
- package/lib/typescript/src/sksg/nodes/context.d.ts +0 -3
- package/lib/typescript/src/sksg/nodes/drawings.d.ts +0 -30
- package/lib/typescript/src/sksg/nodes/imageFilters.d.ts +0 -17
- package/lib/typescript/src/sksg/nodes/index.d.ts +0 -3
- package/lib/typescript/src/sksg/nodes/paint.d.ts +0 -3
- package/lib/typescript/src/sksg/nodes/pathEffects.d.ts +0 -11
- package/lib/typescript/src/sksg/nodes/shaders.d.ts +0 -11
- package/src/external/reanimated/useDerivedValueOnJS.ts +0 -20
- package/src/sksg/DeclarationContext.ts +0 -85
- package/src/sksg/DrawingContext.ts +0 -226
- package/src/sksg/__tests__/Declarations.spec.tsx +0 -235
- package/src/sksg/__tests__/MockDeclaration.ts +0 -138
- package/src/sksg/nodes/Node.ts +0 -8
- package/src/sksg/nodes/colorFilters.ts +0 -79
- package/src/sksg/nodes/context.ts +0 -412
- package/src/sksg/nodes/imageFilters.ts +0 -235
- package/src/sksg/nodes/index.ts +0 -3
- package/src/sksg/nodes/paint.ts +0 -75
- package/src/sksg/nodes/pathEffects.ts +0 -118
- /package/lib/typescript/lib/commonjs/sksg/{nodes/drawings.d.ts → Recorder/commands/Drawing.d.ts} +0 -0
- /package/lib/typescript/lib/module/sksg/{nodes/drawings.d.ts → Recorder/commands/Drawing.d.ts} +0 -0
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["CommandType","exports","materializeProps","command","animatedProps","key","props","value","isCommand","type","isDrawCommand"],"sources":["Core.ts"],"sourcesContent":["import type { SharedValue } from \"react-native-reanimated\";\n\nimport type {\n BlurMaskFilterProps,\n CircleProps,\n CTMProps,\n ImageProps,\n PointsProps,\n PathProps,\n RectProps,\n RoundedRectProps,\n OvalProps,\n LineProps,\n PatchProps,\n VerticesProps,\n DiffRectProps,\n TextProps,\n TextPathProps,\n TextBlobProps,\n GlyphsProps,\n PictureProps,\n ImageSVGProps,\n ParagraphProps,\n AtlasProps,\n DrawingNodeProps,\n} from \"../../dom/types\";\n\n// export enum CommandType {\n// // Context\n// SavePaint = \"SavePaint\",\n// RestorePaint = \"RestorePaint\",\n// SaveCTM = \"SaveCTM\",\n// RestoreCTM = \"RestoreCTM\",\n// PushColorFilter = \"PushColorFilter\",\n// PushBlurMaskFilter = \"PushBlurMaskFilter\",\n// PushImageFilter = \"PushImageFilter\",\n// PushPathEffect = \"PushPathEffect\",\n// PushShader = \"PushShader\",\n// ComposeColorFilter = \"ComposeColorFilter\",\n// ComposeImageFilter = \"ComposeImageFilter\",\n// ComposePathEffect = \"ComposePathEffect\",\n// MaterializePaint = \"MaterializePaint\",\n// SaveBackdropFilter = \"SaveBackdropFilter\",\n// SaveLayer = \"SaveLayer\",\n// RestorePaintDeclaration = \"RestorePaintDeclaration\",\n// // Drawing\n// DrawBox = \"DrawBox\",\n// DrawImage = \"DrawImage\",\n// DrawCircle = \"DrawCircle\",\n// DrawPaint = \"DrawPaint\",\n// DrawPoints = \"DrawPoints\",\n// DrawPath = \"DrawPath\",\n// DrawRect = \"DrawRect\",\n// DrawRRect = \"DrawRRect\",\n// DrawOval = \"DrawOval\",\n// DrawLine = \"DrawLine\",\n// DrawPatch = \"DrawPatch\",\n// DrawVertices = \"DrawVertices\",\n// DrawDiffRect = \"DrawDiffRect\",\n// DrawText = \"DrawText\",\n// DrawTextPath = \"DrawTextPath\",\n// DrawTextBlob = \"DrawTextBlob\",\n// DrawGlyphs = \"DrawGlyphs\",\n// DrawPicture = \"DrawPicture\",\n// DrawImageSVG = \"DrawImageSVG\",\n// DrawParagraph = \"DrawParagraph\",\n// DrawAtlas = \"DrawAtlas\",\n// }\nexport enum CommandType {\n // Context\n SavePaint,\n RestorePaint,\n SaveCTM,\n RestoreCTM,\n PushColorFilter,\n PushBlurMaskFilter,\n PushImageFilter,\n PushPathEffect,\n PushShader,\n ComposeColorFilter,\n ComposeImageFilter,\n ComposePathEffect,\n MaterializePaint,\n SaveBackdropFilter,\n SaveLayer,\n RestorePaintDeclaration,\n // Drawing\n DrawBox,\n DrawImage,\n DrawCircle,\n DrawPaint,\n DrawPoints,\n DrawPath,\n DrawRect,\n DrawRRect,\n DrawOval,\n DrawLine,\n DrawPatch,\n DrawVertices,\n DrawDiffRect,\n DrawText,\n DrawTextPath,\n DrawTextBlob,\n DrawGlyphs,\n DrawPicture,\n DrawImageSVG,\n DrawParagraph,\n DrawAtlas,\n}\n\nexport type Command<T extends CommandType = CommandType> = {\n type: T;\n [key: string]: unknown;\n};\n\nexport const materializeProps = (command: {\n props: Record<string, unknown>;\n animatedProps?: Record<string, SharedValue<unknown>>;\n}) => {\n \"worklet\";\n if (command.animatedProps) {\n for (const key in command.animatedProps) {\n command.props[key] = command.animatedProps[key].value;\n }\n }\n};\n\nexport const isCommand = <T extends CommandType>(\n command: Command,\n type: T\n): command is Command<T> => {\n \"worklet\";\n return command.type === type;\n};\n\ninterface Props {\n [CommandType.DrawImage]: ImageProps;\n [CommandType.DrawCircle]: CircleProps;\n [CommandType.SaveCTM]: CTMProps;\n [CommandType.SavePaint]: DrawingNodeProps;\n [CommandType.PushBlurMaskFilter]: BlurMaskFilterProps;\n [CommandType.DrawPoints]: PointsProps;\n [CommandType.DrawPath]: PathProps;\n [CommandType.DrawRect]: RectProps;\n [CommandType.DrawRRect]: RoundedRectProps;\n [CommandType.DrawOval]: OvalProps;\n [CommandType.DrawLine]: LineProps;\n [CommandType.DrawPatch]: PatchProps;\n [CommandType.DrawVertices]: VerticesProps;\n [CommandType.DrawDiffRect]: DiffRectProps;\n [CommandType.DrawText]: TextProps;\n [CommandType.DrawTextPath]: TextPathProps;\n [CommandType.DrawTextBlob]: TextBlobProps;\n [CommandType.DrawGlyphs]: GlyphsProps;\n [CommandType.DrawPicture]: PictureProps;\n [CommandType.DrawImageSVG]: ImageSVGProps;\n [CommandType.DrawParagraph]: ParagraphProps;\n [CommandType.DrawAtlas]: AtlasProps;\n}\n\ninterface DrawCommand<T extends CommandType> extends Command<T> {\n props: T extends keyof Props ? Props[T] : never;\n}\n\nexport const isDrawCommand = <T extends keyof Props>(\n command: Command,\n type: T\n): command is DrawCommand<T> => {\n \"worklet\";\n return command.type === type;\n};\n"],"mappings":";;;;;;AA2BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA,IACYA,WAAW,GAAAC,OAAA,CAAAD,WAAA,0BAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAA,OAAXA,WAAW;AAAA;AA+ChB,MAAME,gBAAgB,GAAIC,OAGhC,IAAK;EACJ,SAAS;;EACT,IAAIA,OAAO,CAACC,aAAa,EAAE;IACzB,KAAK,MAAMC,GAAG,IAAIF,OAAO,CAACC,aAAa,EAAE;MACvCD,OAAO,CAACG,KAAK,CAACD,GAAG,CAAC,GAAGF,OAAO,CAACC,aAAa,CAACC,GAAG,CAAC,CAACE,KAAK;IACvD;EACF;AACF,CAAC;AAACN,OAAA,CAAAC,gBAAA,GAAAA,gBAAA;AAEK,MAAMM,SAAS,GAAGA,CACvBL,OAAgB,EAChBM,IAAO,KACmB;EAC1B,SAAS;;EACT,OAAON,OAAO,CAACM,IAAI,KAAKA,IAAI;AAC9B,CAAC;AAACR,OAAA,CAAAO,SAAA,GAAAA,SAAA;AA+BK,MAAME,aAAa,GAAGA,CAC3BP,OAAgB,EAChBM,IAAO,KACuB;EAC9B,SAAS;;EACT,OAAON,OAAO,CAACM,IAAI,KAAKA,IAAI;AAC9B,CAAC;AAACR,OAAA,CAAAS,aAAA,GAAAA,aAAA","ignoreList":[]}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
import type { Skia, SkCanvas, SkColorFilter, SkPaint, SkShader, SkImageFilter, SkPathEffect } from "../../skia/types";
|
2
|
+
export declare const createDrawingContext: (Skia: Skia, paintPool: SkPaint[], canvas: SkCanvas) => {
|
3
|
+
Skia: Skia;
|
4
|
+
canvas: SkCanvas;
|
5
|
+
paints: SkPaint[];
|
6
|
+
colorFilters: SkColorFilter[];
|
7
|
+
shaders: SkShader[];
|
8
|
+
imageFilters: SkImageFilter[];
|
9
|
+
pathEffects: SkPathEffect[];
|
10
|
+
paintDeclarations: SkPaint[];
|
11
|
+
paintPool: SkPaint[];
|
12
|
+
savePaint: () => void;
|
13
|
+
saveBackdropFilter: () => void;
|
14
|
+
readonly paint: SkPaint;
|
15
|
+
restorePaint: () => SkPaint | undefined;
|
16
|
+
materializePaint: () => void;
|
17
|
+
};
|
18
|
+
export type DrawingContext = ReturnType<typeof createDrawingContext>;
|
@@ -0,0 +1,105 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.createDrawingContext = void 0;
|
7
|
+
const createDrawingContext = (Skia, paintPool, canvas) => {
|
8
|
+
"worklet";
|
9
|
+
|
10
|
+
// State (formerly class fields)
|
11
|
+
const paints = [];
|
12
|
+
const colorFilters = [];
|
13
|
+
const shaders = [];
|
14
|
+
const imageFilters = [];
|
15
|
+
const pathEffects = [];
|
16
|
+
const paintDeclarations = [];
|
17
|
+
let nextPaintIndex = 1;
|
18
|
+
|
19
|
+
// Initialize first paint
|
20
|
+
paintPool[0] = Skia.Paint();
|
21
|
+
paints.push(paintPool[0]);
|
22
|
+
|
23
|
+
// Methods (formerly class methods)
|
24
|
+
const savePaint = () => {
|
25
|
+
// Get next available paint from pool or create new one if needed
|
26
|
+
if (nextPaintIndex >= paintPool.length) {
|
27
|
+
paintPool.push(Skia.Paint());
|
28
|
+
}
|
29
|
+
const nextPaint = paintPool[nextPaintIndex];
|
30
|
+
nextPaint.assign(getCurrentPaint()); // Reuse allocation by copying properties
|
31
|
+
paints.push(nextPaint);
|
32
|
+
nextPaintIndex++;
|
33
|
+
};
|
34
|
+
const saveBackdropFilter = () => {
|
35
|
+
let imageFilter = null;
|
36
|
+
const imgf = imageFilters.pop();
|
37
|
+
if (imgf) {
|
38
|
+
imageFilter = imgf;
|
39
|
+
} else {
|
40
|
+
const cf = colorFilters.pop();
|
41
|
+
if (cf) {
|
42
|
+
imageFilter = Skia.ImageFilter.MakeColorFilter(cf, null);
|
43
|
+
}
|
44
|
+
}
|
45
|
+
canvas.saveLayer(undefined, null, imageFilter);
|
46
|
+
canvas.restore();
|
47
|
+
};
|
48
|
+
|
49
|
+
// Equivalent to the `get paint()` getter in the original class
|
50
|
+
const getCurrentPaint = () => {
|
51
|
+
return paints[paints.length - 1];
|
52
|
+
};
|
53
|
+
const restorePaint = () => {
|
54
|
+
return paints.pop();
|
55
|
+
};
|
56
|
+
const materializePaint = () => {
|
57
|
+
// Color Filters
|
58
|
+
if (colorFilters.length > 0) {
|
59
|
+
getCurrentPaint().setColorFilter(colorFilters.reduceRight((inner, outer) => inner ? Skia.ColorFilter.MakeCompose(outer, inner) : outer));
|
60
|
+
}
|
61
|
+
// Shaders
|
62
|
+
if (shaders.length > 0) {
|
63
|
+
getCurrentPaint().setShader(shaders[shaders.length - 1]);
|
64
|
+
}
|
65
|
+
// Image Filters
|
66
|
+
if (imageFilters.length > 0) {
|
67
|
+
getCurrentPaint().setImageFilter(imageFilters.reduceRight((inner, outer) => inner ? Skia.ImageFilter.MakeCompose(outer, inner) : outer));
|
68
|
+
}
|
69
|
+
// Path Effects
|
70
|
+
if (pathEffects.length > 0) {
|
71
|
+
getCurrentPaint().setPathEffect(pathEffects.reduceRight((inner, outer) => inner ? Skia.PathEffect.MakeCompose(outer, inner) : outer));
|
72
|
+
}
|
73
|
+
|
74
|
+
// Clear arrays
|
75
|
+
colorFilters.length = 0;
|
76
|
+
shaders.length = 0;
|
77
|
+
imageFilters.length = 0;
|
78
|
+
pathEffects.length = 0;
|
79
|
+
};
|
80
|
+
|
81
|
+
// Return an object containing the Skia reference, the canvas, and the methods
|
82
|
+
return {
|
83
|
+
// Public fields
|
84
|
+
Skia,
|
85
|
+
canvas,
|
86
|
+
paints,
|
87
|
+
colorFilters,
|
88
|
+
shaders,
|
89
|
+
imageFilters,
|
90
|
+
pathEffects,
|
91
|
+
paintDeclarations,
|
92
|
+
paintPool,
|
93
|
+
// Public methods
|
94
|
+
savePaint,
|
95
|
+
saveBackdropFilter,
|
96
|
+
get paint() {
|
97
|
+
return paints[paints.length - 1];
|
98
|
+
},
|
99
|
+
// the "getter" for the current paint
|
100
|
+
restorePaint,
|
101
|
+
materializePaint
|
102
|
+
};
|
103
|
+
};
|
104
|
+
exports.createDrawingContext = createDrawingContext;
|
105
|
+
//# sourceMappingURL=DrawingContext.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["createDrawingContext","Skia","paintPool","canvas","paints","colorFilters","shaders","imageFilters","pathEffects","paintDeclarations","nextPaintIndex","Paint","push","savePaint","length","nextPaint","assign","getCurrentPaint","saveBackdropFilter","imageFilter","imgf","pop","cf","ImageFilter","MakeColorFilter","saveLayer","undefined","restore","restorePaint","materializePaint","setColorFilter","reduceRight","inner","outer","ColorFilter","MakeCompose","setShader","setImageFilter","setPathEffect","PathEffect","paint","exports"],"sources":["DrawingContext.ts"],"sourcesContent":["import type {\n Skia,\n SkCanvas,\n SkColorFilter,\n SkPaint,\n SkShader,\n SkImageFilter,\n SkPathEffect,\n} from \"../../skia/types\";\n\nexport const createDrawingContext = (\n Skia: Skia,\n paintPool: SkPaint[],\n canvas: SkCanvas\n) => {\n \"worklet\";\n\n // State (formerly class fields)\n const paints: SkPaint[] = [];\n const colorFilters: SkColorFilter[] = [];\n const shaders: SkShader[] = [];\n const imageFilters: SkImageFilter[] = [];\n const pathEffects: SkPathEffect[] = [];\n const paintDeclarations: SkPaint[] = [];\n\n let nextPaintIndex = 1;\n\n // Initialize first paint\n paintPool[0] = Skia.Paint();\n paints.push(paintPool[0]);\n\n // Methods (formerly class methods)\n const savePaint = () => {\n // Get next available paint from pool or create new one if needed\n if (nextPaintIndex >= paintPool.length) {\n paintPool.push(Skia.Paint());\n }\n\n const nextPaint = paintPool[nextPaintIndex];\n nextPaint.assign(getCurrentPaint()); // Reuse allocation by copying properties\n paints.push(nextPaint);\n nextPaintIndex++;\n };\n\n const saveBackdropFilter = () => {\n let imageFilter: SkImageFilter | null = null;\n const imgf = imageFilters.pop();\n if (imgf) {\n imageFilter = imgf;\n } else {\n const cf = colorFilters.pop();\n if (cf) {\n imageFilter = Skia.ImageFilter.MakeColorFilter(cf, null);\n }\n }\n canvas.saveLayer(undefined, null, imageFilter);\n canvas.restore();\n };\n\n // Equivalent to the `get paint()` getter in the original class\n const getCurrentPaint = () => {\n return paints[paints.length - 1];\n };\n\n const restorePaint = () => {\n return paints.pop();\n };\n\n const materializePaint = () => {\n // Color Filters\n if (colorFilters.length > 0) {\n getCurrentPaint().setColorFilter(\n colorFilters.reduceRight((inner, outer) =>\n inner ? Skia.ColorFilter.MakeCompose(outer, inner) : outer\n )\n );\n }\n // Shaders\n if (shaders.length > 0) {\n getCurrentPaint().setShader(shaders[shaders.length - 1]);\n }\n // Image Filters\n if (imageFilters.length > 0) {\n getCurrentPaint().setImageFilter(\n imageFilters.reduceRight((inner, outer) =>\n inner ? Skia.ImageFilter.MakeCompose(outer, inner) : outer\n )\n );\n }\n // Path Effects\n if (pathEffects.length > 0) {\n getCurrentPaint().setPathEffect(\n pathEffects.reduceRight((inner, outer) =>\n inner ? Skia.PathEffect.MakeCompose(outer, inner) : outer\n )\n );\n }\n\n // Clear arrays\n colorFilters.length = 0;\n shaders.length = 0;\n imageFilters.length = 0;\n pathEffects.length = 0;\n };\n\n // Return an object containing the Skia reference, the canvas, and the methods\n return {\n // Public fields\n Skia,\n canvas,\n paints,\n colorFilters,\n shaders,\n imageFilters,\n pathEffects,\n paintDeclarations,\n paintPool,\n\n // Public methods\n savePaint,\n saveBackdropFilter,\n get paint() {\n return paints[paints.length - 1];\n }, // the \"getter\" for the current paint\n restorePaint,\n materializePaint,\n };\n};\n\nexport type DrawingContext = ReturnType<typeof createDrawingContext>;\n"],"mappings":";;;;;;AAUO,MAAMA,oBAAoB,GAAGA,CAClCC,IAAU,EACVC,SAAoB,EACpBC,MAAgB,KACb;EACH,SAAS;;EAET;EACA,MAAMC,MAAiB,GAAG,EAAE;EAC5B,MAAMC,YAA6B,GAAG,EAAE;EACxC,MAAMC,OAAmB,GAAG,EAAE;EAC9B,MAAMC,YAA6B,GAAG,EAAE;EACxC,MA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AM,GAAG,CAAC;EACxB,CAAC;;EAED;EACA,OAAO;IACL;IACAb,IAAI;IACJE,MAAM;IACNC,MAAM;IACNC,YAAY;IACZC,OAAO;IACPC,YAAY;IACZC,WAAW;IACXC,iBAAiB;IACjBP,SAAS;IAET;IACAW,SAAS;IACTK,kBAAkB;IAClB,IAAIsB,KAAKA,CAAA,EAAG;MACV,OAAOpC,MAAM,CAACA,MAAM,CAACU,MAAM,GAAG,CAAC,CAAC;IAClC,CAAC;IAAE;IACHc,YAAY;IACZC;EACF,CAAC;AACH,CAAC;AAACY,OAAA,CAAAzC,oBAAA,GAAAA,oBAAA","ignoreList":[]}
|
@@ -0,0 +1,127 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.replay = void 0;
|
7
|
+
var _Drawing = require("./commands/Drawing");
|
8
|
+
var _Box = require("./commands/Box");
|
9
|
+
var _ColorFilters = require("./commands/ColorFilters");
|
10
|
+
var _CTM = require("./commands/CTM");
|
11
|
+
var _ImageFilters = require("./commands/ImageFilters");
|
12
|
+
var _Paint = require("./commands/Paint");
|
13
|
+
var _PathEffects = require("./commands/PathEffects");
|
14
|
+
var _Shaders = require("./commands/Shaders");
|
15
|
+
var _Core = require("./Core");
|
16
|
+
const play = (ctx, command) => {
|
17
|
+
"worklet";
|
18
|
+
|
19
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
20
|
+
(0, _Core.materializeProps)(command);
|
21
|
+
if ((0, _Core.isCommand)(command, _Core.CommandType.SaveBackdropFilter)) {
|
22
|
+
ctx.saveBackdropFilter();
|
23
|
+
} else if ((0, _Core.isCommand)(command, _Core.CommandType.SaveLayer)) {
|
24
|
+
ctx.materializePaint();
|
25
|
+
const paint = ctx.paintDeclarations.pop();
|
26
|
+
ctx.canvas.saveLayer(paint);
|
27
|
+
} else if ((0, _Core.isDrawCommand)(command, _Core.CommandType.SavePaint)) {
|
28
|
+
if (command.props.paint) {
|
29
|
+
ctx.paints.push(command.props.paint);
|
30
|
+
} else {
|
31
|
+
ctx.savePaint();
|
32
|
+
(0, _Paint.setPaintProperties)(ctx.Skia, ctx.paint, command.props);
|
33
|
+
}
|
34
|
+
} else if ((0, _Core.isCommand)(command, _Core.CommandType.RestorePaint)) {
|
35
|
+
ctx.restorePaint();
|
36
|
+
} else if ((0, _Core.isCommand)(command, _Core.CommandType.ComposeColorFilter)) {
|
37
|
+
(0, _ColorFilters.composeColorFilters)(ctx);
|
38
|
+
} else if ((0, _Core.isCommand)(command, _Core.CommandType.RestorePaintDeclaration)) {
|
39
|
+
ctx.materializePaint();
|
40
|
+
const paint = ctx.restorePaint();
|
41
|
+
if (!paint) {
|
42
|
+
throw new Error("No paint declaration to push");
|
43
|
+
}
|
44
|
+
ctx.paintDeclarations.push(paint);
|
45
|
+
} else if ((0, _Core.isCommand)(command, _Core.CommandType.MaterializePaint)) {
|
46
|
+
ctx.materializePaint();
|
47
|
+
} else if ((0, _ColorFilters.isPushColorFilter)(command)) {
|
48
|
+
(0, _ColorFilters.pushColorFilter)(ctx, command);
|
49
|
+
} else if ((0, _Shaders.isPushShader)(command)) {
|
50
|
+
(0, _Shaders.pushShader)(ctx, command);
|
51
|
+
} else if ((0, _ImageFilters.isPushImageFilter)(command)) {
|
52
|
+
(0, _ImageFilters.pushImageFilter)(ctx, command);
|
53
|
+
} else if ((0, _PathEffects.isPushPathEffect)(command)) {
|
54
|
+
(0, _PathEffects.pushPathEffect)(ctx, command);
|
55
|
+
} else if ((0, _Core.isCommand)(command, _Core.CommandType.ComposePathEffect)) {
|
56
|
+
(0, _PathEffects.composePathEffects)(ctx);
|
57
|
+
} else if ((0, _Core.isCommand)(command, _Core.CommandType.ComposeImageFilter)) {
|
58
|
+
(0, _ImageFilters.composeImageFilters)(ctx);
|
59
|
+
} else if ((0, _Core.isDrawCommand)(command, _Core.CommandType.PushBlurMaskFilter)) {
|
60
|
+
(0, _ImageFilters.setBlurMaskFilter)(ctx, command.props);
|
61
|
+
} else if ((0, _Core.isDrawCommand)(command, _Core.CommandType.SaveCTM)) {
|
62
|
+
(0, _CTM.saveCTM)(ctx, command.props);
|
63
|
+
} else if ((0, _Core.isCommand)(command, _Core.CommandType.RestoreCTM)) {
|
64
|
+
ctx.canvas.restore();
|
65
|
+
} else {
|
66
|
+
const paints = [ctx.paint, ...ctx.paintDeclarations];
|
67
|
+
ctx.paintDeclarations = [];
|
68
|
+
paints.forEach(p => {
|
69
|
+
ctx.paints.push(p);
|
70
|
+
if ((0, _Box.isBoxCommand)(command)) {
|
71
|
+
(0, _Box.drawBox)(ctx, command);
|
72
|
+
} else if ((0, _Core.isCommand)(command, _Core.CommandType.DrawPaint)) {
|
73
|
+
ctx.canvas.drawPaint(ctx.paint);
|
74
|
+
} else if ((0, _Core.isDrawCommand)(command, _Core.CommandType.DrawImage)) {
|
75
|
+
(0, _Drawing.drawImage)(ctx, command.props);
|
76
|
+
} else if ((0, _Core.isDrawCommand)(command, _Core.CommandType.DrawCircle)) {
|
77
|
+
(0, _Drawing.drawCircle)(ctx, command.props);
|
78
|
+
} else if ((0, _Core.isDrawCommand)(command, _Core.CommandType.DrawPoints)) {
|
79
|
+
(0, _Drawing.drawPoints)(ctx, command.props);
|
80
|
+
} else if ((0, _Core.isDrawCommand)(command, _Core.CommandType.DrawPath)) {
|
81
|
+
(0, _Drawing.drawPath)(ctx, command.props);
|
82
|
+
} else if ((0, _Core.isDrawCommand)(command, _Core.CommandType.DrawRect)) {
|
83
|
+
(0, _Drawing.drawRect)(ctx, command.props);
|
84
|
+
} else if ((0, _Core.isDrawCommand)(command, _Core.CommandType.DrawRRect)) {
|
85
|
+
(0, _Drawing.drawRRect)(ctx, command.props);
|
86
|
+
} else if ((0, _Core.isDrawCommand)(command, _Core.CommandType.DrawOval)) {
|
87
|
+
(0, _Drawing.drawOval)(ctx, command.props);
|
88
|
+
} else if ((0, _Core.isDrawCommand)(command, _Core.CommandType.DrawLine)) {
|
89
|
+
(0, _Drawing.drawLine)(ctx, command.props);
|
90
|
+
} else if ((0, _Core.isDrawCommand)(command, _Core.CommandType.DrawPatch)) {
|
91
|
+
(0, _Drawing.drawPatch)(ctx, command.props);
|
92
|
+
} else if ((0, _Core.isDrawCommand)(command, _Core.CommandType.DrawVertices)) {
|
93
|
+
(0, _Drawing.drawVertices)(ctx, command.props);
|
94
|
+
} else if ((0, _Core.isDrawCommand)(command, _Core.CommandType.DrawDiffRect)) {
|
95
|
+
(0, _Drawing.drawDiffRect)(ctx, command.props);
|
96
|
+
} else if ((0, _Core.isDrawCommand)(command, _Core.CommandType.DrawText)) {
|
97
|
+
(0, _Drawing.drawText)(ctx, command.props);
|
98
|
+
} else if ((0, _Core.isDrawCommand)(command, _Core.CommandType.DrawTextPath)) {
|
99
|
+
(0, _Drawing.drawTextPath)(ctx, command.props);
|
100
|
+
} else if ((0, _Core.isDrawCommand)(command, _Core.CommandType.DrawTextBlob)) {
|
101
|
+
(0, _Drawing.drawTextBlob)(ctx, command.props);
|
102
|
+
} else if ((0, _Core.isDrawCommand)(command, _Core.CommandType.DrawGlyphs)) {
|
103
|
+
(0, _Drawing.drawGlyphs)(ctx, command.props);
|
104
|
+
} else if ((0, _Core.isDrawCommand)(command, _Core.CommandType.DrawPicture)) {
|
105
|
+
(0, _Drawing.drawPicture)(ctx, command.props);
|
106
|
+
} else if ((0, _Core.isDrawCommand)(command, _Core.CommandType.DrawImageSVG)) {
|
107
|
+
(0, _Drawing.drawImageSVG)(ctx, command.props);
|
108
|
+
} else if ((0, _Core.isDrawCommand)(command, _Core.CommandType.DrawParagraph)) {
|
109
|
+
(0, _Drawing.drawParagraph)(ctx, command.props);
|
110
|
+
} else if ((0, _Core.isDrawCommand)(command, _Core.CommandType.DrawAtlas)) {
|
111
|
+
(0, _Drawing.drawAtlas)(ctx, command.props);
|
112
|
+
} else {
|
113
|
+
console.warn(`Unknown command: ${command.type}`);
|
114
|
+
}
|
115
|
+
ctx.paints.pop();
|
116
|
+
});
|
117
|
+
}
|
118
|
+
};
|
119
|
+
const replay = (ctx, commands) => {
|
120
|
+
"worklet";
|
121
|
+
|
122
|
+
commands.forEach(command => {
|
123
|
+
play(ctx, command);
|
124
|
+
});
|
125
|
+
};
|
126
|
+
exports.replay = replay;
|
127
|
+
//# sourceMappingURL=Player.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["_Drawing","require","_Box","_ColorFilters","_CTM","_ImageFilters","_Paint","_PathEffects","_Shaders","_Core","play","ctx","command","materializeProps","isCommand","CommandType","SaveBackdropFilter","saveBackdropFilter","SaveLayer","materializePaint","paint","paintDeclarations","pop","canvas","saveLayer","isDrawCommand","SavePaint","props","paints","push","savePaint","setPaintProperties","Skia","RestorePaint","restorePaint","ComposeColorFilter","composeColorFilters","RestorePaintDeclaration","Error","MaterializePaint","isPushColorFilter","pushColorFilter","isPushShader","pushShader","isPushImageFilter","pushImageFilter","isPushPathEffect","pushPathEffect","ComposePathEffect","composePathEffects","ComposeImageFilter","composeImageFilters","PushBlurMaskFilter","setBlurMaskFilter","SaveCTM","saveCTM","RestoreCTM","restore","forEach","p","isBoxCommand","drawBox","DrawPaint","drawPaint","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","console","warn","type","replay","commands","exports"],"sources":["Player.ts"],"sourcesContent":["import {\n drawCircle,\n drawImage,\n drawOval,\n drawPath,\n drawPoints,\n drawRect,\n drawRRect,\n drawLine,\n drawAtlas,\n drawParagraph,\n drawImageSVG,\n drawPicture,\n drawGlyphs,\n drawTextBlob,\n drawTextPath,\n drawText,\n drawDiffRect,\n drawVertices,\n drawPatch,\n} from \"./commands/Drawing\";\nimport { drawBox, isBoxCommand } from \"./commands/Box\";\nimport {\n composeColorFilters,\n isPushColorFilter,\n pushColorFilter,\n} from \"./commands/ColorFilters\";\nimport { saveCTM } from \"./commands/CTM\";\nimport {\n setBlurMaskFilter,\n isPushImageFilter,\n pushImageFilter,\n composeImageFilters,\n} from \"./commands/ImageFilters\";\nimport { setPaintProperties } from \"./commands/Paint\";\nimport {\n composePathEffects,\n isPushPathEffect,\n pushPathEffect,\n} from \"./commands/PathEffects\";\nimport { isPushShader, pushShader } from \"./commands/Shaders\";\nimport {\n CommandType,\n isCommand,\n isDrawCommand,\n materializeProps,\n type Command,\n} from \"./Core\";\nimport type { DrawingContext } from \"./DrawingContext\";\n\nconst play = (ctx: DrawingContext, command: Command) => {\n \"worklet\";\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n materializeProps(command as any);\n if (isCommand(command, CommandType.SaveBackdropFilter)) {\n ctx.saveBackdropFilter();\n } else if (isCommand(command, CommandType.SaveLayer)) {\n ctx.materializePaint();\n const paint = ctx.paintDeclarations.pop();\n ctx.canvas.saveLayer(paint);\n } else if (isDrawCommand(command, CommandType.SavePaint)) {\n if (command.props.paint) {\n ctx.paints.push(command.props.paint);\n } else {\n ctx.savePaint();\n setPaintProperties(ctx.Skia, ctx.paint, command.props);\n }\n } else if (isCommand(command, CommandType.RestorePaint)) {\n ctx.restorePaint();\n } else if (isCommand(command, CommandType.ComposeColorFilter)) {\n composeColorFilters(ctx);\n } else if (isCommand(command, CommandType.RestorePaintDeclaration)) {\n ctx.materializePaint();\n const paint = ctx.restorePaint();\n if (!paint) {\n throw new Error(\"No paint declaration to push\");\n }\n ctx.paintDeclarations.push(paint);\n } else if (isCommand(command, CommandType.MaterializePaint)) {\n ctx.materializePaint();\n } else if (isPushColorFilter(command)) {\n pushColorFilter(ctx, command);\n } else if (isPushShader(command)) {\n pushShader(ctx, command);\n } else if (isPushImageFilter(command)) {\n pushImageFilter(ctx, command);\n } else if (isPushPathEffect(command)) {\n pushPathEffect(ctx, command);\n } else if (isCommand(command, CommandType.ComposePathEffect)) {\n composePathEffects(ctx);\n } else if (isCommand(command, CommandType.ComposeImageFilter)) {\n composeImageFilters(ctx);\n } else if (isDrawCommand(command, CommandType.PushBlurMaskFilter)) {\n setBlurMaskFilter(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.SaveCTM)) {\n saveCTM(ctx, command.props);\n } else if (isCommand(command, CommandType.RestoreCTM)) {\n ctx.canvas.restore();\n } else {\n const paints = [ctx.paint, ...ctx.paintDeclarations];\n ctx.paintDeclarations = [];\n paints.forEach((p) => {\n ctx.paints.push(p);\n if (isBoxCommand(command)) {\n drawBox(ctx, command);\n } else if (isCommand(command, CommandType.DrawPaint)) {\n ctx.canvas.drawPaint(ctx.paint);\n } else if (isDrawCommand(command, CommandType.DrawImage)) {\n drawImage(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawCircle)) {\n drawCircle(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawPoints)) {\n drawPoints(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawPath)) {\n drawPath(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawRect)) {\n drawRect(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawRRect)) {\n drawRRect(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawOval)) {\n drawOval(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawLine)) {\n drawLine(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawPatch)) {\n drawPatch(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawVertices)) {\n drawVertices(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawDiffRect)) {\n drawDiffRect(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawText)) {\n drawText(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawTextPath)) {\n drawTextPath(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawTextBlob)) {\n drawTextBlob(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawGlyphs)) {\n drawGlyphs(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawPicture)) {\n drawPicture(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawImageSVG)) {\n drawImageSVG(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawParagraph)) {\n drawParagraph(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawAtlas)) {\n drawAtlas(ctx, command.props);\n } else {\n console.warn(`Unknown command: ${command.type}`);\n }\n ctx.paints.pop();\n });\n }\n};\n\nexport const replay = (ctx: DrawingContext, commands: Command[]) => {\n \"worklet\";\n commands.forEach((command) => {\n play(ctx, command);\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAqBA,IAAAC,IAAA,GAAAD,OAAA;AACA,IAAAE,aAAA,GAAAF,OAAA;AAKA,IAAAG,IAAA,GAAAH,OAAA;AACA,IAAAI,aAAA,GAAAJ,OAAA;AAMA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,YAAA,GAAAN,OAAA;AAKA,IAAAO,QAAA,GAAAP,OAAA;AACA,IAAAQ,KAAA,GAAAR,OAAA;AASA,MAAMS,IAAI,GAAGA,CAACC,GAAmB,EAAEC,OAAgB,KAAK;EACtD,SAAS;;EAET;EACA,IAAAC,sBAAgB,EAACD,OAAc,CAAC;EAChC,IAAI,IAAAE,eAAS,EAACF,OAAO,EAAEG,iBAAW,CAACC,kBAAkB,CAAC,EAAE;IACtDL,GAAG,CAACM,kBAAkB,CAAC,CAAC;EAC1B,CAAC,MAAM,IAAI,IAAAH,eAAS,EAACF,OAAO,EAAEG,iBAAW,CAACG,SAAS,CAAC,EAAE;IACpDP,GAAG,CAACQ,gBAAgB,CAAC,CAAC;IACtB,MAAMC,KAAK,GAAGT,GAAG,CAACU,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,EAAE+F,QAAmB,KAAK;EAClE,SAAS;;EACTA,QAAQ,CAAChD,OAAO,CAAE9C,OAAO,IAAK;IAC5BF,IAAI,CAACC,GAAG,EAAEC,OAAO,CAAC;EACpB,CAAC,CAAC;AACJ,CAAC;AAAC+F,OAAA,CAAAF,MAAA,GAAAA,MAAA","ignoreList":[]}
|
@@ -0,0 +1,50 @@
|
|
1
|
+
import type { SharedValue } from "react-native-reanimated";
|
2
|
+
import { NodeType } from "../../dom/types";
|
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
|
+
import type { AnimatedProps } from "../../renderer";
|
5
|
+
import type { Command } from "./Core";
|
6
|
+
export declare class Recorder {
|
7
|
+
commands: Command[];
|
8
|
+
private processProps;
|
9
|
+
private add;
|
10
|
+
savePaint(props: AnimatedProps<PaintProps>): void;
|
11
|
+
restorePaint(): void;
|
12
|
+
restorePaintDeclaration(): void;
|
13
|
+
materializePaint(): void;
|
14
|
+
pushPathEffect(pathEffectType: NodeType, props: AnimatedProps<unknown>): void;
|
15
|
+
pushImageFilter(imageFilterType: NodeType, props: AnimatedProps<unknown>): void;
|
16
|
+
pushColorFilter(colorFilterType: NodeType, props: AnimatedProps<unknown>): void;
|
17
|
+
pushShader(shaderType: NodeType, props: AnimatedProps<unknown>): void;
|
18
|
+
pushBlurMaskFilter(props: AnimatedProps<BlurMaskFilterProps>): void;
|
19
|
+
composePathEffect(): void;
|
20
|
+
composeColorFilter(): void;
|
21
|
+
composeImageFilter(): void;
|
22
|
+
saveCTM(props: AnimatedProps<CTMProps>): void;
|
23
|
+
restoreCTM(): void;
|
24
|
+
drawPaint(): void;
|
25
|
+
saveLayer(): void;
|
26
|
+
saveBackdropFilter(): void;
|
27
|
+
drawBox(boxProps: AnimatedProps<BoxProps>, shadows: {
|
28
|
+
props: BoxShadowProps;
|
29
|
+
animatedProps?: Record<string, SharedValue<unknown>>;
|
30
|
+
}[]): void;
|
31
|
+
drawImage(props: AnimatedProps<ImageProps>): void;
|
32
|
+
drawCircle(props: AnimatedProps<CircleProps>): void;
|
33
|
+
drawPoints(props: AnimatedProps<PointsProps>): void;
|
34
|
+
drawPath(props: AnimatedProps<PathProps>): void;
|
35
|
+
drawRect(props: AnimatedProps<RectProps>): void;
|
36
|
+
drawRRect(props: AnimatedProps<RoundedRectProps>): void;
|
37
|
+
drawOval(props: AnimatedProps<OvalProps>): void;
|
38
|
+
drawLine(props: AnimatedProps<LineProps>): void;
|
39
|
+
drawPatch(props: AnimatedProps<PatchProps>): void;
|
40
|
+
drawVertices(props: AnimatedProps<VerticesProps>): void;
|
41
|
+
drawDiffRect(props: AnimatedProps<DiffRectProps>): void;
|
42
|
+
drawText(props: AnimatedProps<TextProps>): void;
|
43
|
+
drawTextPath(props: AnimatedProps<TextPathProps>): void;
|
44
|
+
drawTextBlob(props: AnimatedProps<TextBlobProps>): void;
|
45
|
+
drawGlyphs(props: AnimatedProps<GlyphsProps>): void;
|
46
|
+
drawPicture(props: AnimatedProps<PictureProps>): void;
|
47
|
+
drawImageSVG(props: AnimatedProps<ImageSVGProps>): void;
|
48
|
+
drawParagraph(props: AnimatedProps<ParagraphProps>): void;
|
49
|
+
drawAtlas(props: AnimatedProps<AtlasProps>): void;
|
50
|
+
}
|
@@ -0,0 +1,288 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.Recorder = void 0;
|
7
|
+
var _types = require("../../dom/types");
|
8
|
+
var _utils = require("../utils");
|
9
|
+
var _Node = require("../Node");
|
10
|
+
var _Core = require("./Core");
|
11
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
12
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
13
|
+
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); }
|
14
|
+
class Recorder {
|
15
|
+
constructor() {
|
16
|
+
_defineProperty(this, "commands", []);
|
17
|
+
}
|
18
|
+
processProps(props) {
|
19
|
+
const animatedProps = {};
|
20
|
+
let hasAnimatedProps = false;
|
21
|
+
for (const key in props) {
|
22
|
+
const prop = props[key];
|
23
|
+
if ((0, _utils.isSharedValue)(prop)) {
|
24
|
+
props[key] = prop.value;
|
25
|
+
animatedProps[key] = prop;
|
26
|
+
hasAnimatedProps = true;
|
27
|
+
}
|
28
|
+
}
|
29
|
+
return {
|
30
|
+
props,
|
31
|
+
animatedProps: hasAnimatedProps ? animatedProps : undefined
|
32
|
+
};
|
33
|
+
}
|
34
|
+
add(command) {
|
35
|
+
if (command.props) {
|
36
|
+
const {
|
37
|
+
animatedProps
|
38
|
+
} = this.processProps(command.props);
|
39
|
+
if (animatedProps) {
|
40
|
+
command.animatedProps = animatedProps;
|
41
|
+
}
|
42
|
+
}
|
43
|
+
this.commands.push(command);
|
44
|
+
}
|
45
|
+
savePaint(props) {
|
46
|
+
this.add({
|
47
|
+
type: _Core.CommandType.SavePaint,
|
48
|
+
props
|
49
|
+
});
|
50
|
+
}
|
51
|
+
restorePaint() {
|
52
|
+
this.add({
|
53
|
+
type: _Core.CommandType.RestorePaint
|
54
|
+
});
|
55
|
+
}
|
56
|
+
restorePaintDeclaration() {
|
57
|
+
this.add({
|
58
|
+
type: _Core.CommandType.RestorePaintDeclaration
|
59
|
+
});
|
60
|
+
}
|
61
|
+
materializePaint() {
|
62
|
+
this.add({
|
63
|
+
type: _Core.CommandType.MaterializePaint
|
64
|
+
});
|
65
|
+
}
|
66
|
+
pushPathEffect(pathEffectType, props) {
|
67
|
+
if (!(0, _Node.isPathEffect)(pathEffectType)) {
|
68
|
+
throw new Error("Invalid color filter type: " + pathEffectType);
|
69
|
+
}
|
70
|
+
this.add({
|
71
|
+
type: _Core.CommandType.PushPathEffect,
|
72
|
+
pathEffectType,
|
73
|
+
props
|
74
|
+
});
|
75
|
+
}
|
76
|
+
pushImageFilter(imageFilterType, props) {
|
77
|
+
if (!(0, _Node.isImageFilter)(imageFilterType)) {
|
78
|
+
throw new Error("Invalid color filter type: " + imageFilterType);
|
79
|
+
}
|
80
|
+
this.add({
|
81
|
+
type: _Core.CommandType.PushImageFilter,
|
82
|
+
imageFilterType,
|
83
|
+
props
|
84
|
+
});
|
85
|
+
}
|
86
|
+
pushColorFilter(colorFilterType, props) {
|
87
|
+
if (!(0, _Node.isColorFilter)(colorFilterType)) {
|
88
|
+
throw new Error("Invalid color filter type: " + colorFilterType);
|
89
|
+
}
|
90
|
+
this.add({
|
91
|
+
type: _Core.CommandType.PushColorFilter,
|
92
|
+
colorFilterType,
|
93
|
+
props
|
94
|
+
});
|
95
|
+
}
|
96
|
+
pushShader(shaderType, props) {
|
97
|
+
if (!(0, _Node.isShader)(shaderType) && !(shaderType === _types.NodeType.Blend)) {
|
98
|
+
throw new Error("Invalid color filter type: " + shaderType);
|
99
|
+
}
|
100
|
+
this.add({
|
101
|
+
type: _Core.CommandType.PushShader,
|
102
|
+
shaderType,
|
103
|
+
props
|
104
|
+
});
|
105
|
+
}
|
106
|
+
pushBlurMaskFilter(props) {
|
107
|
+
this.add({
|
108
|
+
type: _Core.CommandType.PushBlurMaskFilter,
|
109
|
+
props
|
110
|
+
});
|
111
|
+
}
|
112
|
+
composePathEffect() {
|
113
|
+
this.add({
|
114
|
+
type: _Core.CommandType.ComposePathEffect
|
115
|
+
});
|
116
|
+
}
|
117
|
+
composeColorFilter() {
|
118
|
+
this.add({
|
119
|
+
type: _Core.CommandType.ComposeColorFilter
|
120
|
+
});
|
121
|
+
}
|
122
|
+
composeImageFilter() {
|
123
|
+
this.add({
|
124
|
+
type: _Core.CommandType.ComposeImageFilter
|
125
|
+
});
|
126
|
+
}
|
127
|
+
saveCTM(props) {
|
128
|
+
this.add({
|
129
|
+
type: _Core.CommandType.SaveCTM,
|
130
|
+
props
|
131
|
+
});
|
132
|
+
}
|
133
|
+
restoreCTM() {
|
134
|
+
this.add({
|
135
|
+
type: _Core.CommandType.RestoreCTM
|
136
|
+
});
|
137
|
+
}
|
138
|
+
drawPaint() {
|
139
|
+
this.add({
|
140
|
+
type: _Core.CommandType.DrawPaint
|
141
|
+
});
|
142
|
+
}
|
143
|
+
saveLayer() {
|
144
|
+
this.add({
|
145
|
+
type: _Core.CommandType.SaveLayer
|
146
|
+
});
|
147
|
+
}
|
148
|
+
saveBackdropFilter() {
|
149
|
+
this.add({
|
150
|
+
type: _Core.CommandType.SaveBackdropFilter
|
151
|
+
});
|
152
|
+
}
|
153
|
+
drawBox(boxProps, shadows) {
|
154
|
+
shadows.forEach(shadow => {
|
155
|
+
if (shadow.props) {
|
156
|
+
if (shadow.props) {
|
157
|
+
const {
|
158
|
+
animatedProps
|
159
|
+
} = this.processProps(shadow.props);
|
160
|
+
if (animatedProps) {
|
161
|
+
shadow.animatedProps = animatedProps;
|
162
|
+
}
|
163
|
+
}
|
164
|
+
}
|
165
|
+
});
|
166
|
+
this.add({
|
167
|
+
type: _Core.CommandType.DrawBox,
|
168
|
+
props: boxProps,
|
169
|
+
shadows
|
170
|
+
});
|
171
|
+
}
|
172
|
+
drawImage(props) {
|
173
|
+
this.add({
|
174
|
+
type: _Core.CommandType.DrawImage,
|
175
|
+
props
|
176
|
+
});
|
177
|
+
}
|
178
|
+
drawCircle(props) {
|
179
|
+
this.add({
|
180
|
+
type: _Core.CommandType.DrawCircle,
|
181
|
+
props
|
182
|
+
});
|
183
|
+
}
|
184
|
+
drawPoints(props) {
|
185
|
+
this.add({
|
186
|
+
type: _Core.CommandType.DrawPoints,
|
187
|
+
props
|
188
|
+
});
|
189
|
+
}
|
190
|
+
drawPath(props) {
|
191
|
+
this.add({
|
192
|
+
type: _Core.CommandType.DrawPath,
|
193
|
+
props
|
194
|
+
});
|
195
|
+
}
|
196
|
+
drawRect(props) {
|
197
|
+
this.add({
|
198
|
+
type: _Core.CommandType.DrawRect,
|
199
|
+
props
|
200
|
+
});
|
201
|
+
}
|
202
|
+
drawRRect(props) {
|
203
|
+
this.add({
|
204
|
+
type: _Core.CommandType.DrawRRect,
|
205
|
+
props
|
206
|
+
});
|
207
|
+
}
|
208
|
+
drawOval(props) {
|
209
|
+
this.add({
|
210
|
+
type: _Core.CommandType.DrawOval,
|
211
|
+
props
|
212
|
+
});
|
213
|
+
}
|
214
|
+
drawLine(props) {
|
215
|
+
this.add({
|
216
|
+
type: _Core.CommandType.DrawLine,
|
217
|
+
props
|
218
|
+
});
|
219
|
+
}
|
220
|
+
drawPatch(props) {
|
221
|
+
this.add({
|
222
|
+
type: _Core.CommandType.DrawPatch,
|
223
|
+
props
|
224
|
+
});
|
225
|
+
}
|
226
|
+
drawVertices(props) {
|
227
|
+
this.add({
|
228
|
+
type: _Core.CommandType.DrawVertices,
|
229
|
+
props
|
230
|
+
});
|
231
|
+
}
|
232
|
+
drawDiffRect(props) {
|
233
|
+
this.add({
|
234
|
+
type: _Core.CommandType.DrawDiffRect,
|
235
|
+
props
|
236
|
+
});
|
237
|
+
}
|
238
|
+
drawText(props) {
|
239
|
+
this.add({
|
240
|
+
type: _Core.CommandType.DrawText,
|
241
|
+
props
|
242
|
+
});
|
243
|
+
}
|
244
|
+
drawTextPath(props) {
|
245
|
+
this.add({
|
246
|
+
type: _Core.CommandType.DrawTextPath,
|
247
|
+
props
|
248
|
+
});
|
249
|
+
}
|
250
|
+
drawTextBlob(props) {
|
251
|
+
this.add({
|
252
|
+
type: _Core.CommandType.DrawTextBlob,
|
253
|
+
props
|
254
|
+
});
|
255
|
+
}
|
256
|
+
drawGlyphs(props) {
|
257
|
+
this.add({
|
258
|
+
type: _Core.CommandType.DrawGlyphs,
|
259
|
+
props
|
260
|
+
});
|
261
|
+
}
|
262
|
+
drawPicture(props) {
|
263
|
+
this.add({
|
264
|
+
type: _Core.CommandType.DrawPicture,
|
265
|
+
props
|
266
|
+
});
|
267
|
+
}
|
268
|
+
drawImageSVG(props) {
|
269
|
+
this.add({
|
270
|
+
type: _Core.CommandType.DrawImageSVG,
|
271
|
+
props
|
272
|
+
});
|
273
|
+
}
|
274
|
+
drawParagraph(props) {
|
275
|
+
this.add({
|
276
|
+
type: _Core.CommandType.DrawParagraph,
|
277
|
+
props
|
278
|
+
});
|
279
|
+
}
|
280
|
+
drawAtlas(props) {
|
281
|
+
this.add({
|
282
|
+
type: _Core.CommandType.DrawAtlas,
|
283
|
+
props
|
284
|
+
});
|
285
|
+
}
|
286
|
+
}
|
287
|
+
exports.Recorder = Recorder;
|
288
|
+
//# sourceMappingURL=Recorder.js.map
|