@shopify/react-native-skia 1.8.0 → 1.8.1
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/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/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/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/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/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/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/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,98 @@
|
|
1
|
+
export const createDrawingContext = (Skia, paintPool, canvas) => {
|
2
|
+
"worklet";
|
3
|
+
|
4
|
+
// State (formerly class fields)
|
5
|
+
const paints = [];
|
6
|
+
const colorFilters = [];
|
7
|
+
const shaders = [];
|
8
|
+
const imageFilters = [];
|
9
|
+
const pathEffects = [];
|
10
|
+
const paintDeclarations = [];
|
11
|
+
let nextPaintIndex = 1;
|
12
|
+
|
13
|
+
// Initialize first paint
|
14
|
+
paintPool[0] = Skia.Paint();
|
15
|
+
paints.push(paintPool[0]);
|
16
|
+
|
17
|
+
// Methods (formerly class methods)
|
18
|
+
const savePaint = () => {
|
19
|
+
// Get next available paint from pool or create new one if needed
|
20
|
+
if (nextPaintIndex >= paintPool.length) {
|
21
|
+
paintPool.push(Skia.Paint());
|
22
|
+
}
|
23
|
+
const nextPaint = paintPool[nextPaintIndex];
|
24
|
+
nextPaint.assign(getCurrentPaint()); // Reuse allocation by copying properties
|
25
|
+
paints.push(nextPaint);
|
26
|
+
nextPaintIndex++;
|
27
|
+
};
|
28
|
+
const saveBackdropFilter = () => {
|
29
|
+
let imageFilter = null;
|
30
|
+
const imgf = imageFilters.pop();
|
31
|
+
if (imgf) {
|
32
|
+
imageFilter = imgf;
|
33
|
+
} else {
|
34
|
+
const cf = colorFilters.pop();
|
35
|
+
if (cf) {
|
36
|
+
imageFilter = Skia.ImageFilter.MakeColorFilter(cf, null);
|
37
|
+
}
|
38
|
+
}
|
39
|
+
canvas.saveLayer(undefined, null, imageFilter);
|
40
|
+
canvas.restore();
|
41
|
+
};
|
42
|
+
|
43
|
+
// Equivalent to the `get paint()` getter in the original class
|
44
|
+
const getCurrentPaint = () => {
|
45
|
+
return paints[paints.length - 1];
|
46
|
+
};
|
47
|
+
const restorePaint = () => {
|
48
|
+
return paints.pop();
|
49
|
+
};
|
50
|
+
const materializePaint = () => {
|
51
|
+
// Color Filters
|
52
|
+
if (colorFilters.length > 0) {
|
53
|
+
getCurrentPaint().setColorFilter(colorFilters.reduceRight((inner, outer) => inner ? Skia.ColorFilter.MakeCompose(outer, inner) : outer));
|
54
|
+
}
|
55
|
+
// Shaders
|
56
|
+
if (shaders.length > 0) {
|
57
|
+
getCurrentPaint().setShader(shaders[shaders.length - 1]);
|
58
|
+
}
|
59
|
+
// Image Filters
|
60
|
+
if (imageFilters.length > 0) {
|
61
|
+
getCurrentPaint().setImageFilter(imageFilters.reduceRight((inner, outer) => inner ? Skia.ImageFilter.MakeCompose(outer, inner) : outer));
|
62
|
+
}
|
63
|
+
// Path Effects
|
64
|
+
if (pathEffects.length > 0) {
|
65
|
+
getCurrentPaint().setPathEffect(pathEffects.reduceRight((inner, outer) => inner ? Skia.PathEffect.MakeCompose(outer, inner) : outer));
|
66
|
+
}
|
67
|
+
|
68
|
+
// Clear arrays
|
69
|
+
colorFilters.length = 0;
|
70
|
+
shaders.length = 0;
|
71
|
+
imageFilters.length = 0;
|
72
|
+
pathEffects.length = 0;
|
73
|
+
};
|
74
|
+
|
75
|
+
// Return an object containing the Skia reference, the canvas, and the methods
|
76
|
+
return {
|
77
|
+
// Public fields
|
78
|
+
Skia,
|
79
|
+
canvas,
|
80
|
+
paints,
|
81
|
+
colorFilters,
|
82
|
+
shaders,
|
83
|
+
imageFilters,
|
84
|
+
pathEffects,
|
85
|
+
paintDeclarations,
|
86
|
+
paintPool,
|
87
|
+
// Public methods
|
88
|
+
savePaint,
|
89
|
+
saveBackdropFilter,
|
90
|
+
get paint() {
|
91
|
+
return paints[paints.length - 1];
|
92
|
+
},
|
93
|
+
// the "getter" for the current paint
|
94
|
+
restorePaint,
|
95
|
+
materializePaint
|
96
|
+
};
|
97
|
+
};
|
98
|
+
//# 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"],"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":"AAUA,OAAO,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,MAAMC,WAA2B,GAAG,EAAE;EACtC,MAAMC,iBAA4B,GAAG,EAAE;EAEvC,IAAIC,cAAc,GAAG,CAAC;;EAEtB;EACAR,SAAS,CAAC,CAAC,CAAC,GAAGD,IAAI,CAACU,KAAK,CAAC,CAAC;EAC3BP,MAAM,CAACQ,IAAI,CAACV,SAAS,CAAC,CAAC,CAAC,CAAC;;EAEzB;EACA,MAAMW,SAAS,GAAGA,CAAA,KAAM;IACtB;IACA,IAAIH,cAAc,IAAIR,SAAS,CAACY,MAAM,EAAE;MACtCZ,SAAS,CAACU,IAAI,CAACX,IAAI,CAACU,KAAK,CAAC,CAAC,CAAC;IAC9B;IAEA,MAAMI,SAAS,GAAGb,SAAS,CAACQ,c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;MACtBG,eAAe,CAAC,CAAC,CAACmB,SAAS,CAAC9B,OAAO,CAACA,OAAO,CAACQ,MAAM,GAAG,CAAC,CAAC,CAAC;IAC1D;IACA;IACA,IAAIP,YAAY,CAACO,MAAM,GAAG,CAAC,EAAE;MAC3BG,eAAe,CAAC,CAAC,CAACoB,cAAc,CAC9B9B,YAAY,CAACwB,WAAW,CAAC,CAACC,KAAK,EAAEC,KAAK,KACpCD,KAAK,GAAG/B,IAAI,CAACsB,WAAW,CAACY,WAAW,CAACF,KAAK,EAAED,KAAK,CAAC,GAAGC,KACvD,CACF,CAAC;IACH;IACA;IACA,IAAIzB,WAAW,CAACM,MAAM,GAAG,CAAC,EAAE;MAC1BG,eAAe,CAAC,CAAC,CAACqB,aAAa,CAC7B9B,WAAW,CAACuB,WAAW,CAAC,CAACC,KAAK,EAAEC,KAAK,KACnCD,KAAK,GAAG/B,IAAI,CAACsC,UAAU,CAACJ,WAAW,CAACF,KAAK,EAAED,KAAK,CAAC,GAAGC,KACtD,CACF,CAAC;IACH;;IAEA;IACA5B,YAAY,CAACS,MAAM,GAAG,CAAC;IACvBR,OAAO,CAACQ,MAAM,GAAG,CAAC;IAClBP,YAAY,CAACO,MAAM,GAAG,CAAC;IACvBN,WAAW,CAACM,MAAM,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","ignoreList":[]}
|
@@ -0,0 +1,120 @@
|
|
1
|
+
import { drawCircle, drawImage, drawOval, drawPath, drawPoints, drawRect, drawRRect, drawLine, drawAtlas, drawParagraph, drawImageSVG, drawPicture, drawGlyphs, drawTextBlob, drawTextPath, drawText, drawDiffRect, drawVertices, drawPatch } from "./commands/Drawing";
|
2
|
+
import { drawBox, isBoxCommand } from "./commands/Box";
|
3
|
+
import { composeColorFilters, isPushColorFilter, pushColorFilter } from "./commands/ColorFilters";
|
4
|
+
import { saveCTM } from "./commands/CTM";
|
5
|
+
import { setBlurMaskFilter, isPushImageFilter, pushImageFilter, composeImageFilters } from "./commands/ImageFilters";
|
6
|
+
import { setPaintProperties } from "./commands/Paint";
|
7
|
+
import { composePathEffects, isPushPathEffect, pushPathEffect } from "./commands/PathEffects";
|
8
|
+
import { isPushShader, pushShader } from "./commands/Shaders";
|
9
|
+
import { CommandType, isCommand, isDrawCommand, materializeProps } from "./Core";
|
10
|
+
const play = (ctx, command) => {
|
11
|
+
"worklet";
|
12
|
+
|
13
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
14
|
+
materializeProps(command);
|
15
|
+
if (isCommand(command, CommandType.SaveBackdropFilter)) {
|
16
|
+
ctx.saveBackdropFilter();
|
17
|
+
} else if (isCommand(command, CommandType.SaveLayer)) {
|
18
|
+
ctx.materializePaint();
|
19
|
+
const paint = ctx.paintDeclarations.pop();
|
20
|
+
ctx.canvas.saveLayer(paint);
|
21
|
+
} else if (isDrawCommand(command, CommandType.SavePaint)) {
|
22
|
+
if (command.props.paint) {
|
23
|
+
ctx.paints.push(command.props.paint);
|
24
|
+
} else {
|
25
|
+
ctx.savePaint();
|
26
|
+
setPaintProperties(ctx.Skia, ctx.paint, command.props);
|
27
|
+
}
|
28
|
+
} else if (isCommand(command, CommandType.RestorePaint)) {
|
29
|
+
ctx.restorePaint();
|
30
|
+
} else if (isCommand(command, CommandType.ComposeColorFilter)) {
|
31
|
+
composeColorFilters(ctx);
|
32
|
+
} else if (isCommand(command, CommandType.RestorePaintDeclaration)) {
|
33
|
+
ctx.materializePaint();
|
34
|
+
const paint = ctx.restorePaint();
|
35
|
+
if (!paint) {
|
36
|
+
throw new Error("No paint declaration to push");
|
37
|
+
}
|
38
|
+
ctx.paintDeclarations.push(paint);
|
39
|
+
} else if (isCommand(command, CommandType.MaterializePaint)) {
|
40
|
+
ctx.materializePaint();
|
41
|
+
} else if (isPushColorFilter(command)) {
|
42
|
+
pushColorFilter(ctx, command);
|
43
|
+
} else if (isPushShader(command)) {
|
44
|
+
pushShader(ctx, command);
|
45
|
+
} else if (isPushImageFilter(command)) {
|
46
|
+
pushImageFilter(ctx, command);
|
47
|
+
} else if (isPushPathEffect(command)) {
|
48
|
+
pushPathEffect(ctx, command);
|
49
|
+
} else if (isCommand(command, CommandType.ComposePathEffect)) {
|
50
|
+
composePathEffects(ctx);
|
51
|
+
} else if (isCommand(command, CommandType.ComposeImageFilter)) {
|
52
|
+
composeImageFilters(ctx);
|
53
|
+
} else if (isDrawCommand(command, CommandType.PushBlurMaskFilter)) {
|
54
|
+
setBlurMaskFilter(ctx, command.props);
|
55
|
+
} else if (isDrawCommand(command, CommandType.SaveCTM)) {
|
56
|
+
saveCTM(ctx, command.props);
|
57
|
+
} else if (isCommand(command, CommandType.RestoreCTM)) {
|
58
|
+
ctx.canvas.restore();
|
59
|
+
} else {
|
60
|
+
const paints = [ctx.paint, ...ctx.paintDeclarations];
|
61
|
+
ctx.paintDeclarations = [];
|
62
|
+
paints.forEach(p => {
|
63
|
+
ctx.paints.push(p);
|
64
|
+
if (isBoxCommand(command)) {
|
65
|
+
drawBox(ctx, command);
|
66
|
+
} else if (isCommand(command, CommandType.DrawPaint)) {
|
67
|
+
ctx.canvas.drawPaint(ctx.paint);
|
68
|
+
} else if (isDrawCommand(command, CommandType.DrawImage)) {
|
69
|
+
drawImage(ctx, command.props);
|
70
|
+
} else if (isDrawCommand(command, CommandType.DrawCircle)) {
|
71
|
+
drawCircle(ctx, command.props);
|
72
|
+
} else if (isDrawCommand(command, CommandType.DrawPoints)) {
|
73
|
+
drawPoints(ctx, command.props);
|
74
|
+
} else if (isDrawCommand(command, CommandType.DrawPath)) {
|
75
|
+
drawPath(ctx, command.props);
|
76
|
+
} else if (isDrawCommand(command, CommandType.DrawRect)) {
|
77
|
+
drawRect(ctx, command.props);
|
78
|
+
} else if (isDrawCommand(command, CommandType.DrawRRect)) {
|
79
|
+
drawRRect(ctx, command.props);
|
80
|
+
} else if (isDrawCommand(command, CommandType.DrawOval)) {
|
81
|
+
drawOval(ctx, command.props);
|
82
|
+
} else if (isDrawCommand(command, CommandType.DrawLine)) {
|
83
|
+
drawLine(ctx, command.props);
|
84
|
+
} else if (isDrawCommand(command, CommandType.DrawPatch)) {
|
85
|
+
drawPatch(ctx, command.props);
|
86
|
+
} else if (isDrawCommand(command, CommandType.DrawVertices)) {
|
87
|
+
drawVertices(ctx, command.props);
|
88
|
+
} else if (isDrawCommand(command, CommandType.DrawDiffRect)) {
|
89
|
+
drawDiffRect(ctx, command.props);
|
90
|
+
} else if (isDrawCommand(command, CommandType.DrawText)) {
|
91
|
+
drawText(ctx, command.props);
|
92
|
+
} else if (isDrawCommand(command, CommandType.DrawTextPath)) {
|
93
|
+
drawTextPath(ctx, command.props);
|
94
|
+
} else if (isDrawCommand(command, CommandType.DrawTextBlob)) {
|
95
|
+
drawTextBlob(ctx, command.props);
|
96
|
+
} else if (isDrawCommand(command, CommandType.DrawGlyphs)) {
|
97
|
+
drawGlyphs(ctx, command.props);
|
98
|
+
} else if (isDrawCommand(command, CommandType.DrawPicture)) {
|
99
|
+
drawPicture(ctx, command.props);
|
100
|
+
} else if (isDrawCommand(command, CommandType.DrawImageSVG)) {
|
101
|
+
drawImageSVG(ctx, command.props);
|
102
|
+
} else if (isDrawCommand(command, CommandType.DrawParagraph)) {
|
103
|
+
drawParagraph(ctx, command.props);
|
104
|
+
} else if (isDrawCommand(command, CommandType.DrawAtlas)) {
|
105
|
+
drawAtlas(ctx, command.props);
|
106
|
+
} else {
|
107
|
+
console.warn(`Unknown command: ${command.type}`);
|
108
|
+
}
|
109
|
+
ctx.paints.pop();
|
110
|
+
});
|
111
|
+
}
|
112
|
+
};
|
113
|
+
export const replay = (ctx, commands) => {
|
114
|
+
"worklet";
|
115
|
+
|
116
|
+
commands.forEach(command => {
|
117
|
+
play(ctx, command);
|
118
|
+
});
|
119
|
+
};
|
120
|
+
//# sourceMappingURL=Player.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["drawCircle","drawImage","drawOval","drawPath","drawPoints","drawRect","drawRRect","drawLine","drawAtlas","drawParagraph","drawImageSVG","drawPicture","drawGlyphs","drawTextBlob","drawTextPath","drawText","drawDiffRect","drawVertices","drawPatch","drawBox","isBoxCommand","composeColorFilters","isPushColorFilter","pushColorFilter","saveCTM","setBlurMaskFilter","isPushImageFilter","pushImageFilter","composeImageFilters","setPaintProperties","composePathEffects","isPushPathEffect","pushPathEffect","isPushShader","pushShader","CommandType","isCommand","isDrawCommand","materializeProps","play","ctx","command","SaveBackdropFilter","saveBackdropFilter","SaveLayer","materializePaint","paint","paintDeclarations","pop","canvas","saveLayer","SavePaint","props","paints","push","savePaint","Skia","RestorePaint","restorePaint","ComposeColorFilter","RestorePaintDeclaration","Error","MaterializePaint","ComposePathEffect","ComposeImageFilter","PushBlurMaskFilter","SaveCTM","RestoreCTM","restore","forEach","p","DrawPaint","drawPaint","DrawImage","DrawCircle","DrawPoints","DrawPath","DrawRect","DrawRRect","DrawOval","DrawLine","DrawPatch","DrawVertices","DrawDiffRect","DrawText","DrawTextPath","DrawTextBlob","DrawGlyphs","DrawPicture","DrawImageSVG","DrawParagraph","DrawAtlas","console","warn","type","replay","commands"],"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,SACEA,UAAU,EACVC,SAAS,EACTC,QAAQ,EACRC,QAAQ,EACRC,UAAU,EACVC,QAAQ,EACRC,SAAS,EACTC,QAAQ,EACRC,SAAS,EACTC,aAAa,EACbC,YAAY,EACZC,WAAW,EACXC,UAAU,EACVC,YAAY,EACZC,YAAY,EACZC,QAAQ,EACRC,YAAY,EACZC,YAAY,EACZC,SAAS,QACJ,oBAAoB;AAC3B,SAASC,OAAO,EAAEC,YAAY,QAAQ,gBAAgB;AACtD,SACEC,mBAAmB,EACnBC,iBAAiB,EACjBC,eAAe,QACV,yBAAyB;AAChC,SAASC,OAAO,QAAQ,gBAAgB;AACxC,SACEC,iBAAiB,EACjBC,iBAAiB,EACjBC,eAAe,EACfC,mBAAmB,QACd,yBAAyB;AAChC,SAASC,kBAAkB,QAAQ,kBAAkB;AACrD,SACEC,kBAAkB,EAClBC,gBAAgB,EAChBC,cAAc,QACT,wBAAwB;AAC/B,SAASC,YAAY,EAAEC,UAAU,QAAQ,oBAAoB;AAC7D,SACEC,WAAW,EACXC,SAAS,EACTC,aAAa,EACbC,gBAAgB,QAEX,QAAQ;AAGf,MAAMC,IAAI,GAAGA,CAACC,GAAmB,EAAEC,OAAgB,KAAK;EACtD,SAAS;;EAET;EACAH,gBAAgB,CAACG,OAA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
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,281 @@
|
|
1
|
+
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; }
|
2
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
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
|
+
import { NodeType } from "../../dom/types";
|
5
|
+
import { isSharedValue } from "../utils";
|
6
|
+
import { isColorFilter, isImageFilter, isPathEffect, isShader } from "../Node";
|
7
|
+
import { CommandType } from "./Core";
|
8
|
+
export class Recorder {
|
9
|
+
constructor() {
|
10
|
+
_defineProperty(this, "commands", []);
|
11
|
+
}
|
12
|
+
processProps(props) {
|
13
|
+
const animatedProps = {};
|
14
|
+
let hasAnimatedProps = false;
|
15
|
+
for (const key in props) {
|
16
|
+
const prop = props[key];
|
17
|
+
if (isSharedValue(prop)) {
|
18
|
+
props[key] = prop.value;
|
19
|
+
animatedProps[key] = prop;
|
20
|
+
hasAnimatedProps = true;
|
21
|
+
}
|
22
|
+
}
|
23
|
+
return {
|
24
|
+
props,
|
25
|
+
animatedProps: hasAnimatedProps ? animatedProps : undefined
|
26
|
+
};
|
27
|
+
}
|
28
|
+
add(command) {
|
29
|
+
if (command.props) {
|
30
|
+
const {
|
31
|
+
animatedProps
|
32
|
+
} = this.processProps(command.props);
|
33
|
+
if (animatedProps) {
|
34
|
+
command.animatedProps = animatedProps;
|
35
|
+
}
|
36
|
+
}
|
37
|
+
this.commands.push(command);
|
38
|
+
}
|
39
|
+
savePaint(props) {
|
40
|
+
this.add({
|
41
|
+
type: CommandType.SavePaint,
|
42
|
+
props
|
43
|
+
});
|
44
|
+
}
|
45
|
+
restorePaint() {
|
46
|
+
this.add({
|
47
|
+
type: CommandType.RestorePaint
|
48
|
+
});
|
49
|
+
}
|
50
|
+
restorePaintDeclaration() {
|
51
|
+
this.add({
|
52
|
+
type: CommandType.RestorePaintDeclaration
|
53
|
+
});
|
54
|
+
}
|
55
|
+
materializePaint() {
|
56
|
+
this.add({
|
57
|
+
type: CommandType.MaterializePaint
|
58
|
+
});
|
59
|
+
}
|
60
|
+
pushPathEffect(pathEffectType, props) {
|
61
|
+
if (!isPathEffect(pathEffectType)) {
|
62
|
+
throw new Error("Invalid color filter type: " + pathEffectType);
|
63
|
+
}
|
64
|
+
this.add({
|
65
|
+
type: CommandType.PushPathEffect,
|
66
|
+
pathEffectType,
|
67
|
+
props
|
68
|
+
});
|
69
|
+
}
|
70
|
+
pushImageFilter(imageFilterType, props) {
|
71
|
+
if (!isImageFilter(imageFilterType)) {
|
72
|
+
throw new Error("Invalid color filter type: " + imageFilterType);
|
73
|
+
}
|
74
|
+
this.add({
|
75
|
+
type: CommandType.PushImageFilter,
|
76
|
+
imageFilterType,
|
77
|
+
props
|
78
|
+
});
|
79
|
+
}
|
80
|
+
pushColorFilter(colorFilterType, props) {
|
81
|
+
if (!isColorFilter(colorFilterType)) {
|
82
|
+
throw new Error("Invalid color filter type: " + colorFilterType);
|
83
|
+
}
|
84
|
+
this.add({
|
85
|
+
type: CommandType.PushColorFilter,
|
86
|
+
colorFilterType,
|
87
|
+
props
|
88
|
+
});
|
89
|
+
}
|
90
|
+
pushShader(shaderType, props) {
|
91
|
+
if (!isShader(shaderType) && !(shaderType === NodeType.Blend)) {
|
92
|
+
throw new Error("Invalid color filter type: " + shaderType);
|
93
|
+
}
|
94
|
+
this.add({
|
95
|
+
type: CommandType.PushShader,
|
96
|
+
shaderType,
|
97
|
+
props
|
98
|
+
});
|
99
|
+
}
|
100
|
+
pushBlurMaskFilter(props) {
|
101
|
+
this.add({
|
102
|
+
type: CommandType.PushBlurMaskFilter,
|
103
|
+
props
|
104
|
+
});
|
105
|
+
}
|
106
|
+
composePathEffect() {
|
107
|
+
this.add({
|
108
|
+
type: CommandType.ComposePathEffect
|
109
|
+
});
|
110
|
+
}
|
111
|
+
composeColorFilter() {
|
112
|
+
this.add({
|
113
|
+
type: CommandType.ComposeColorFilter
|
114
|
+
});
|
115
|
+
}
|
116
|
+
composeImageFilter() {
|
117
|
+
this.add({
|
118
|
+
type: CommandType.ComposeImageFilter
|
119
|
+
});
|
120
|
+
}
|
121
|
+
saveCTM(props) {
|
122
|
+
this.add({
|
123
|
+
type: CommandType.SaveCTM,
|
124
|
+
props
|
125
|
+
});
|
126
|
+
}
|
127
|
+
restoreCTM() {
|
128
|
+
this.add({
|
129
|
+
type: CommandType.RestoreCTM
|
130
|
+
});
|
131
|
+
}
|
132
|
+
drawPaint() {
|
133
|
+
this.add({
|
134
|
+
type: CommandType.DrawPaint
|
135
|
+
});
|
136
|
+
}
|
137
|
+
saveLayer() {
|
138
|
+
this.add({
|
139
|
+
type: CommandType.SaveLayer
|
140
|
+
});
|
141
|
+
}
|
142
|
+
saveBackdropFilter() {
|
143
|
+
this.add({
|
144
|
+
type: CommandType.SaveBackdropFilter
|
145
|
+
});
|
146
|
+
}
|
147
|
+
drawBox(boxProps, shadows) {
|
148
|
+
shadows.forEach(shadow => {
|
149
|
+
if (shadow.props) {
|
150
|
+
if (shadow.props) {
|
151
|
+
const {
|
152
|
+
animatedProps
|
153
|
+
} = this.processProps(shadow.props);
|
154
|
+
if (animatedProps) {
|
155
|
+
shadow.animatedProps = animatedProps;
|
156
|
+
}
|
157
|
+
}
|
158
|
+
}
|
159
|
+
});
|
160
|
+
this.add({
|
161
|
+
type: CommandType.DrawBox,
|
162
|
+
props: boxProps,
|
163
|
+
shadows
|
164
|
+
});
|
165
|
+
}
|
166
|
+
drawImage(props) {
|
167
|
+
this.add({
|
168
|
+
type: CommandType.DrawImage,
|
169
|
+
props
|
170
|
+
});
|
171
|
+
}
|
172
|
+
drawCircle(props) {
|
173
|
+
this.add({
|
174
|
+
type: CommandType.DrawCircle,
|
175
|
+
props
|
176
|
+
});
|
177
|
+
}
|
178
|
+
drawPoints(props) {
|
179
|
+
this.add({
|
180
|
+
type: CommandType.DrawPoints,
|
181
|
+
props
|
182
|
+
});
|
183
|
+
}
|
184
|
+
drawPath(props) {
|
185
|
+
this.add({
|
186
|
+
type: CommandType.DrawPath,
|
187
|
+
props
|
188
|
+
});
|
189
|
+
}
|
190
|
+
drawRect(props) {
|
191
|
+
this.add({
|
192
|
+
type: CommandType.DrawRect,
|
193
|
+
props
|
194
|
+
});
|
195
|
+
}
|
196
|
+
drawRRect(props) {
|
197
|
+
this.add({
|
198
|
+
type: CommandType.DrawRRect,
|
199
|
+
props
|
200
|
+
});
|
201
|
+
}
|
202
|
+
drawOval(props) {
|
203
|
+
this.add({
|
204
|
+
type: CommandType.DrawOval,
|
205
|
+
props
|
206
|
+
});
|
207
|
+
}
|
208
|
+
drawLine(props) {
|
209
|
+
this.add({
|
210
|
+
type: CommandType.DrawLine,
|
211
|
+
props
|
212
|
+
});
|
213
|
+
}
|
214
|
+
drawPatch(props) {
|
215
|
+
this.add({
|
216
|
+
type: CommandType.DrawPatch,
|
217
|
+
props
|
218
|
+
});
|
219
|
+
}
|
220
|
+
drawVertices(props) {
|
221
|
+
this.add({
|
222
|
+
type: CommandType.DrawVertices,
|
223
|
+
props
|
224
|
+
});
|
225
|
+
}
|
226
|
+
drawDiffRect(props) {
|
227
|
+
this.add({
|
228
|
+
type: CommandType.DrawDiffRect,
|
229
|
+
props
|
230
|
+
});
|
231
|
+
}
|
232
|
+
drawText(props) {
|
233
|
+
this.add({
|
234
|
+
type: CommandType.DrawText,
|
235
|
+
props
|
236
|
+
});
|
237
|
+
}
|
238
|
+
drawTextPath(props) {
|
239
|
+
this.add({
|
240
|
+
type: CommandType.DrawTextPath,
|
241
|
+
props
|
242
|
+
});
|
243
|
+
}
|
244
|
+
drawTextBlob(props) {
|
245
|
+
this.add({
|
246
|
+
type: CommandType.DrawTextBlob,
|
247
|
+
props
|
248
|
+
});
|
249
|
+
}
|
250
|
+
drawGlyphs(props) {
|
251
|
+
this.add({
|
252
|
+
type: CommandType.DrawGlyphs,
|
253
|
+
props
|
254
|
+
});
|
255
|
+
}
|
256
|
+
drawPicture(props) {
|
257
|
+
this.add({
|
258
|
+
type: CommandType.DrawPicture,
|
259
|
+
props
|
260
|
+
});
|
261
|
+
}
|
262
|
+
drawImageSVG(props) {
|
263
|
+
this.add({
|
264
|
+
type: CommandType.DrawImageSVG,
|
265
|
+
props
|
266
|
+
});
|
267
|
+
}
|
268
|
+
drawParagraph(props) {
|
269
|
+
this.add({
|
270
|
+
type: CommandType.DrawParagraph,
|
271
|
+
props
|
272
|
+
});
|
273
|
+
}
|
274
|
+
drawAtlas(props) {
|
275
|
+
this.add({
|
276
|
+
type: CommandType.DrawAtlas,
|
277
|
+
props
|
278
|
+
});
|
279
|
+
}
|
280
|
+
}
|
281
|
+
//# sourceMappingURL=Recorder.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["NodeType","isSharedValue","isColorFilter","isImageFilter","isPathEffect","isShader","CommandType","Recorder","constructor","_defineProperty","processProps","props","animatedProps","hasAnimatedProps","key","prop","value","undefined","add","command","commands","push","savePaint","type","SavePaint","restorePaint","RestorePaint","restorePaintDeclaration","RestorePaintDeclaration","materializePaint","MaterializePaint","pushPathEffect","pathEffectType","Error","PushPathEffect","pushImageFilter","imageFilterType","PushImageFilter","pushColorFilter","colorFilterType","PushColorFilter","pushShader","shaderType","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"],"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\";\n\nimport { CommandType } from \"./Core\";\nimport type { Command } from \"./Core\";\n\nexport class Recorder {\n commands: Command[] = [];\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 props[key] = prop.value;\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.commands.push(command);\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,SAASA,QAAQ,QAAQ,iBAAiB;AA4B1C,SAASC,aAAa,QAAQ,UAAU;AACxC,SAASC,aAAa,EAAEC,aAAa,EAAEC,YAAY,EAAEC,QAAQ,QAAQ,SAAS;AAE9E,SAASC,WAAW,QAAQ,QAAQ;AAGpC,OAAO,MAAMC,QA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EjB,WAAW,CAAC4F,UAAU;MAAEvF;IAAM,CAAC,CAAC;EACnD;EAEAwF,WAAWA,CAACxF,KAAkC,EAAE;IAC9C,IAAI,CAACO,GAAG,CAAC;MAAEK,IAAI,EAAEjB,WAAW,CAAC8F,WAAW;MAAEzF;IAAM,CAAC,CAAC;EACpD;EAEA0F,YAAYA,CAAC1F,KAAmC,EAAE;IAChD,IAAI,CAACO,GAAG,CAAC;MAAEK,IAAI,EAAEjB,WAAW,CAACgG,YAAY;MAAE3F;IAAM,CAAC,CAAC;EACrD;EAEA4F,aAAaA,CAAC5F,KAAoC,EAAE;IAClD,IAAI,CAACO,GAAG,CAAC;MAAEK,IAAI,EAAEjB,WAAW,CAACkG,aAAa;MAAE7F;IAAM,CAAC,CAAC;EACtD;EAEA8F,SAASA,CAAC9F,KAAgC,EAAE;IAC1C,IAAI,CAACO,GAAG,CAAC;MAAEK,IAAI,EAAEjB,WAAW,CAACoG,SAAS;MAAE/F;IAAM,CAAC,CAAC;EAClD;AACF","ignoreList":[]}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["createRecording","commands","paintPool"],"sources":["Recording.ts"],"sourcesContent":["import type { SkPaint } from \"../../skia/types\";\n\nimport type { Command } from \"./Core\";\n\nexport interface Recording {\n commands: Command[];\n paintPool: SkPaint[];\n}\n\nexport const createRecording = (commands: Command[]): Recording => ({\n commands,\n paintPool: [],\n});\n"],"mappings":"AASA,OAAO,MAAMA,eAAe,GAAIC,QAAmB,KAAiB;EAClEA,QAAQ;EACRC,SAAS,EAAE;AACb,CAAC,CAAC","ignoreList":[]}
|
@@ -0,0 +1,5 @@
|
|
1
|
+
import type { DrawingNodeProps } from "../../dom/types";
|
2
|
+
import type { Node } from "../Node";
|
3
|
+
import type { Recorder } from "./Recorder";
|
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;
|