@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
@@ -1,56 +0,0 @@
|
|
1
|
-
import type { SkShader, SkPaint, SkImageFilter, SkMaskFilter, SkPathEffect, Skia, SkColorFilter } from "../skia/types";
|
2
|
-
type Composer<T> = (outer: T, inner: T) => T;
|
3
|
-
export declare const composeDeclarations: <T>(filters: T[], composer: Composer<T>) => T;
|
4
|
-
export declare const createDeclarationContext: (Skia: Skia) => {
|
5
|
-
Skia: Skia;
|
6
|
-
paints: {
|
7
|
-
save: () => void;
|
8
|
-
restore: () => void;
|
9
|
-
pop: () => SkPaint | undefined;
|
10
|
-
push: (decl: SkPaint) => void;
|
11
|
-
popAll: () => SkPaint[];
|
12
|
-
popAllAsOne: () => SkPaint | undefined;
|
13
|
-
};
|
14
|
-
maskFilters: {
|
15
|
-
save: () => void;
|
16
|
-
restore: () => void;
|
17
|
-
pop: () => SkMaskFilter | undefined;
|
18
|
-
push: (decl: SkMaskFilter) => void;
|
19
|
-
popAll: () => SkMaskFilter[];
|
20
|
-
popAllAsOne: () => SkMaskFilter | undefined;
|
21
|
-
};
|
22
|
-
shaders: {
|
23
|
-
save: () => void;
|
24
|
-
restore: () => void;
|
25
|
-
pop: () => SkShader | undefined;
|
26
|
-
push: (decl: SkShader) => void;
|
27
|
-
popAll: () => SkShader[];
|
28
|
-
popAllAsOne: () => SkShader | undefined;
|
29
|
-
};
|
30
|
-
pathEffects: {
|
31
|
-
save: () => void;
|
32
|
-
restore: () => void;
|
33
|
-
pop: () => SkPathEffect | undefined;
|
34
|
-
push: (decl: SkPathEffect) => void;
|
35
|
-
popAll: () => SkPathEffect[];
|
36
|
-
popAllAsOne: () => SkPathEffect | undefined;
|
37
|
-
};
|
38
|
-
imageFilters: {
|
39
|
-
save: () => void;
|
40
|
-
restore: () => void;
|
41
|
-
pop: () => SkImageFilter | undefined;
|
42
|
-
push: (decl: SkImageFilter) => void;
|
43
|
-
popAll: () => SkImageFilter[];
|
44
|
-
popAllAsOne: () => SkImageFilter | undefined;
|
45
|
-
};
|
46
|
-
colorFilters: {
|
47
|
-
save: () => void;
|
48
|
-
restore: () => void;
|
49
|
-
pop: () => SkColorFilter | undefined;
|
50
|
-
push: (decl: SkColorFilter) => void;
|
51
|
-
popAll: () => SkColorFilter[];
|
52
|
-
popAllAsOne: () => SkColorFilter | undefined;
|
53
|
-
};
|
54
|
-
};
|
55
|
-
export type DeclarationContext = ReturnType<typeof createDeclarationContext>;
|
56
|
-
export {};
|
@@ -1,69 +0,0 @@
|
|
1
|
-
export const composeDeclarations = (filters, composer) => {
|
2
|
-
"worklet";
|
3
|
-
|
4
|
-
const len = filters.length;
|
5
|
-
if (len <= 1) {
|
6
|
-
return filters[0];
|
7
|
-
}
|
8
|
-
return filters.reduceRight((inner, outer) => inner ? composer(outer, inner) : outer);
|
9
|
-
};
|
10
|
-
const createDeclaration = composer => {
|
11
|
-
"worklet";
|
12
|
-
|
13
|
-
const state = {
|
14
|
-
decls: [],
|
15
|
-
indexes: [0]
|
16
|
-
};
|
17
|
-
return {
|
18
|
-
save: () => {
|
19
|
-
state.indexes.push(state.decls.length);
|
20
|
-
},
|
21
|
-
restore: () => {
|
22
|
-
state.indexes.pop();
|
23
|
-
},
|
24
|
-
pop: () => state.decls.pop(),
|
25
|
-
push: decl => {
|
26
|
-
state.decls.push(decl);
|
27
|
-
},
|
28
|
-
popAll: () => {
|
29
|
-
const idx = state.indexes[state.indexes.length - 1];
|
30
|
-
return state.decls.splice(idx, state.decls.length - idx);
|
31
|
-
},
|
32
|
-
popAllAsOne: () => {
|
33
|
-
if (state.decls.length === 0) {
|
34
|
-
return undefined;
|
35
|
-
}
|
36
|
-
if (!composer) {
|
37
|
-
throw new Error("No composer for this type of declaration");
|
38
|
-
}
|
39
|
-
if (!state.decls.length) {
|
40
|
-
return undefined;
|
41
|
-
}
|
42
|
-
if (!composer) {
|
43
|
-
throw new Error("No composer for this type of declaration");
|
44
|
-
}
|
45
|
-
const idx = state.indexes[state.indexes.length - 1];
|
46
|
-
const decls = state.decls.splice(idx, state.decls.length - idx);
|
47
|
-
return composeDeclarations(decls, composer);
|
48
|
-
}
|
49
|
-
};
|
50
|
-
};
|
51
|
-
export const createDeclarationContext = Skia => {
|
52
|
-
"worklet";
|
53
|
-
|
54
|
-
const composers = {
|
55
|
-
pathEffect: Skia.PathEffect.MakeCompose.bind(Skia.PathEffect),
|
56
|
-
imageFilter: Skia.ImageFilter.MakeCompose.bind(Skia.ImageFilter),
|
57
|
-
colorFilter: Skia.ColorFilter.MakeCompose.bind(Skia.ColorFilter)
|
58
|
-
};
|
59
|
-
return {
|
60
|
-
Skia,
|
61
|
-
paints: createDeclaration(),
|
62
|
-
maskFilters: createDeclaration(),
|
63
|
-
shaders: createDeclaration(),
|
64
|
-
pathEffects: createDeclaration(composers.pathEffect),
|
65
|
-
imageFilters: createDeclaration(composers.imageFilter),
|
66
|
-
colorFilters: createDeclaration(composers.colorFilter)
|
67
|
-
};
|
68
|
-
};
|
69
|
-
//# sourceMappingURL=DeclarationContext.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["composeDeclarations","filters","composer","len","length","reduceRight","inner","outer","createDeclaration","state","decls","indexes","save","push","restore","pop","decl","popAll","idx","splice","popAllAsOne","undefined","Error","createDeclarationContext","Skia","composers","pathEffect","PathEffect","MakeCompose","bind","imageFilter","ImageFilter","colorFilter","ColorFilter","paints","maskFilters","shaders","pathEffects","imageFilters","colorFilters"],"sources":["DeclarationContext.ts"],"sourcesContent":["import type {\n SkShader,\n SkPaint,\n SkImageFilter,\n SkMaskFilter,\n SkPathEffect,\n Skia,\n SkColorFilter,\n} from \"../skia/types\";\n\ntype Composer<T> = (outer: T, inner: T) => T;\n\nexport const composeDeclarations = <T>(filters: T[], composer: Composer<T>) => {\n \"worklet\";\n const len = filters.length;\n if (len <= 1) {\n return filters[0];\n }\n return filters.reduceRight((inner, outer) =>\n inner ? composer(outer, inner) : outer\n );\n};\n\nconst createDeclaration = <T>(composer?: Composer<T>) => {\n \"worklet\";\n const state = {\n decls: [] as T[],\n indexes: [0],\n };\n\n return {\n save: () => {\n state.indexes.push(state.decls.length);\n },\n restore: () => {\n state.indexes.pop();\n },\n pop: () => state.decls.pop(),\n push: (decl: T) => {\n state.decls.push(decl);\n },\n popAll: () => {\n const idx = state.indexes[state.indexes.length - 1];\n return state.decls.splice(idx, state.decls.length - idx);\n },\n popAllAsOne: () => {\n if (state.decls.length === 0) {\n return undefined;\n }\n if (!composer) {\n throw new Error(\"No composer for this type of declaration\");\n }\n if (!state.decls.length) {\n return undefined;\n }\n if (!composer) {\n throw new Error(\"No composer for this type of declaration\");\n }\n\n const idx = state.indexes[state.indexes.length - 1];\n const decls = state.decls.splice(idx, state.decls.length - idx);\n return composeDeclarations(decls, composer);\n },\n };\n};\n\nexport const createDeclarationContext = (Skia: Skia) => {\n \"worklet\";\n const composers = {\n pathEffect: Skia.PathEffect.MakeCompose.bind(Skia.PathEffect),\n imageFilter: Skia.ImageFilter.MakeCompose.bind(Skia.ImageFilter),\n colorFilter: Skia.ColorFilter.MakeCompose.bind(Skia.ColorFilter),\n };\n return {\n Skia,\n paints: createDeclaration<SkPaint>(),\n maskFilters: createDeclaration<SkMaskFilter>(),\n shaders: createDeclaration<SkShader>(),\n pathEffects: createDeclaration<SkPathEffect>(composers.pathEffect),\n imageFilters: createDeclaration<SkImageFilter>(composers.imageFilter),\n colorFilters: createDeclaration<SkColorFilter>(composers.colorFilter),\n };\n};\n\nexport type DeclarationContext = ReturnType<typeof createDeclarationContext>;\n"],"mappings":"AAYA,OAAO,MAAMA,mBAAmB,GAAGA,CAAIC,OAAY,EAAEC,QAAqB,KAAK;EAC7E,SAAS;;EACT,MAAMC,GAAG,GAAGF,OAAO,CAACG,MAAM;EAC1B,IAAID,GAAG,IAAI,CAAC,EAAE;IACZ,OAAOF,OAAO,CAAC,CAAC,CAAC;EACnB;EACA,OAAOA,OAAO,CAACI,WAAW,CAAC,CAACC,KAAK,EAAEC,KAAK,KACtCD,KAAK,GAAGJ,QAAQ,CAACK,KAAK,EAAED,KAAK,CAAC,GAAGC,KACnC,CAAC;AACH,CAAC;AAED,MAAMC,iBAAiB,GAAON,QAAsB,IAAK;EACvD,SAAS;;EACT,MAAMO,KAAK,GAAG;IACZC,KAAK,EAAE,EAAS;IAChBC,OAAO,EAAE,CAAC,CAAC;EACb,CAAC;EAED,OAAO;IACLC,IAAI,EAAEA,CAAA,KAAM;MACVH,KAAK,CAACE,OAAO,CAACE,IAAI,CAACJ,KAAK,CAACC,KAAK,CAACN,MAAM,CAAC;IACxC,CAAC;IACDU,OAAO,EAAEA,CAAA,KAAM;MACbL,KAAK,CAACE,OAAO,CAACI,GAAG,CAAC,CAAC;IACrB,CAAC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ACC,WAAW,CAACC,IAAI,CAACL,IAAI,CAACG,UAAU,CAAC;IAC7DG,WAAW,EAAEN,IAAI,CAACO,WAAW,CAACH,WAAW,CAACC,IAAI,CAACL,IAAI,CAACO,WAAW,CAAC;IAChEC,WAAW,EAAER,IAAI,CAACS,WAAW,CAACL,WAAW,CAACC,IAAI,CAACL,IAAI,CAACS,WAAW;EACjE,CAAC;EACD,OAAO;IACLT,IAAI;IACJU,MAAM,EAAE1B,iBAAiB,CAAU,CAAC;IACpC2B,WAAW,EAAE3B,iBAAiB,CAAe,CAAC;IAC9C4B,OAAO,EAAE5B,iBAAiB,CAAW,CAAC;IACtC6B,WAAW,EAAE7B,iBAAiB,CAAeiB,SAAS,CAACC,UAAU,CAAC;IAClEY,YAAY,EAAE9B,iBAAiB,CAAgBiB,SAAS,CAACK,WAAW,CAAC;IACrES,YAAY,EAAE/B,iBAAiB,CAAgBiB,SAAS,CAACO,WAAW;EACtE,CAAC;AACH,CAAC","ignoreList":[]}
|
@@ -1,13 +0,0 @@
|
|
1
|
-
import type { DrawingNodeProps, GroupProps } from "../dom/types";
|
2
|
-
import type { SkCanvas, Skia, SkPaint } from "../skia/types";
|
3
|
-
import type { DeclarationContext } from "./DeclarationContext";
|
4
|
-
export declare const createDrawingContext: (Skia: Skia, canvas: SkCanvas) => {
|
5
|
-
Skia: Skia;
|
6
|
-
canvas: SkCanvas;
|
7
|
-
save: () => number;
|
8
|
-
restore: () => SkPaint | undefined;
|
9
|
-
getPaint: () => SkPaint;
|
10
|
-
processPaint: ({ opacity, color, strokeWidth, blendMode, style, strokeJoin, strokeCap, strokeMiter, antiAlias, dither, paint: paintProp, }: DrawingNodeProps, declCtx: DeclarationContext) => boolean;
|
11
|
-
processMatrixAndClipping: (props: GroupProps, layer?: boolean | SkPaint) => boolean;
|
12
|
-
};
|
13
|
-
export type DrawingContext = ReturnType<typeof createDrawingContext>;
|
@@ -1,165 +0,0 @@
|
|
1
|
-
import { enumKey, isPathDef, processPath, processTransformProps2 } from "../dom/nodes";
|
2
|
-
import { BlendMode, ClipOp, isRRect, PaintStyle, StrokeCap, StrokeJoin } from "../skia/types";
|
3
|
-
const computeClip = (Skia, clip) => {
|
4
|
-
"worklet";
|
5
|
-
|
6
|
-
if (clip) {
|
7
|
-
if (isPathDef(clip)) {
|
8
|
-
return {
|
9
|
-
clipPath: processPath(Skia, clip)
|
10
|
-
};
|
11
|
-
} else if (isRRect(clip)) {
|
12
|
-
return {
|
13
|
-
clipRRect: clip
|
14
|
-
};
|
15
|
-
} else {
|
16
|
-
return {
|
17
|
-
clipRect: clip
|
18
|
-
};
|
19
|
-
}
|
20
|
-
}
|
21
|
-
return undefined;
|
22
|
-
};
|
23
|
-
const processColor = (Skia, color) => {
|
24
|
-
"worklet";
|
25
|
-
|
26
|
-
if (typeof color === "string" || typeof color === "number") {
|
27
|
-
return Skia.Color(color);
|
28
|
-
} else if (Array.isArray(color) || color instanceof Float32Array) {
|
29
|
-
return color instanceof Float32Array ? color : new Float32Array(color);
|
30
|
-
} else {
|
31
|
-
throw new Error(`Invalid color type: ${typeof color}. Expected number, string, or array.`);
|
32
|
-
}
|
33
|
-
};
|
34
|
-
export const createDrawingContext = (Skia, canvas) => {
|
35
|
-
"worklet";
|
36
|
-
|
37
|
-
const state = {
|
38
|
-
paints: [Skia.Paint()]
|
39
|
-
};
|
40
|
-
const getPaint = () => {
|
41
|
-
return state.paints[state.paints.length - 1];
|
42
|
-
};
|
43
|
-
const processPaint = ({
|
44
|
-
opacity,
|
45
|
-
color,
|
46
|
-
strokeWidth,
|
47
|
-
blendMode,
|
48
|
-
style,
|
49
|
-
strokeJoin,
|
50
|
-
strokeCap,
|
51
|
-
strokeMiter,
|
52
|
-
antiAlias,
|
53
|
-
dither,
|
54
|
-
paint: paintProp
|
55
|
-
}, declCtx) => {
|
56
|
-
if (paintProp) {
|
57
|
-
declCtx.paints.push(paintProp);
|
58
|
-
return true;
|
59
|
-
}
|
60
|
-
let shouldRestore = false;
|
61
|
-
const colorFilter = declCtx.colorFilters.popAllAsOne();
|
62
|
-
const imageFilter = declCtx.imageFilters.popAllAsOne();
|
63
|
-
const shader = declCtx.shaders.pop();
|
64
|
-
const maskFilter = declCtx.maskFilters.pop();
|
65
|
-
const pathEffect = declCtx.pathEffects.popAllAsOne();
|
66
|
-
if (opacity !== undefined || color !== undefined || strokeWidth !== undefined || blendMode !== undefined || style !== undefined || strokeJoin !== undefined || strokeCap !== undefined || strokeMiter !== undefined || antiAlias !== undefined || dither !== undefined || colorFilter !== undefined || imageFilter !== undefined || shader !== undefined || maskFilter !== undefined || pathEffect !== undefined) {
|
67
|
-
if (!shouldRestore) {
|
68
|
-
state.paints.push(getPaint().copy());
|
69
|
-
shouldRestore = true;
|
70
|
-
}
|
71
|
-
}
|
72
|
-
const paint = getPaint();
|
73
|
-
if (opacity !== undefined) {
|
74
|
-
paint.setAlphaf(paint.getAlphaf() * opacity);
|
75
|
-
}
|
76
|
-
if (color !== undefined) {
|
77
|
-
const currentOpacity = paint.getAlphaf();
|
78
|
-
paint.setShader(null);
|
79
|
-
paint.setColor(processColor(Skia, color));
|
80
|
-
paint.setAlphaf(currentOpacity * paint.getAlphaf());
|
81
|
-
}
|
82
|
-
if (strokeWidth !== undefined) {
|
83
|
-
paint.setStrokeWidth(strokeWidth);
|
84
|
-
}
|
85
|
-
if (blendMode !== undefined) {
|
86
|
-
paint.setBlendMode(BlendMode[enumKey(blendMode)]);
|
87
|
-
}
|
88
|
-
if (style !== undefined) {
|
89
|
-
paint.setStyle(PaintStyle[enumKey(style)]);
|
90
|
-
}
|
91
|
-
if (strokeJoin !== undefined) {
|
92
|
-
paint.setStrokeJoin(StrokeJoin[enumKey(strokeJoin)]);
|
93
|
-
}
|
94
|
-
if (strokeCap !== undefined) {
|
95
|
-
paint.setStrokeCap(StrokeCap[enumKey(strokeCap)]);
|
96
|
-
}
|
97
|
-
if (strokeMiter !== undefined) {
|
98
|
-
paint.setStrokeMiter(strokeMiter);
|
99
|
-
}
|
100
|
-
if (antiAlias !== undefined) {
|
101
|
-
paint.setAntiAlias(antiAlias);
|
102
|
-
}
|
103
|
-
if (dither !== undefined) {
|
104
|
-
paint.setDither(dither);
|
105
|
-
}
|
106
|
-
if (colorFilter) {
|
107
|
-
paint.setColorFilter(colorFilter);
|
108
|
-
}
|
109
|
-
if (imageFilter) {
|
110
|
-
paint.setImageFilter(imageFilter);
|
111
|
-
}
|
112
|
-
if (shader) {
|
113
|
-
paint.setShader(shader);
|
114
|
-
}
|
115
|
-
if (maskFilter) {
|
116
|
-
paint.setMaskFilter(maskFilter);
|
117
|
-
}
|
118
|
-
if (pathEffect) {
|
119
|
-
paint.setPathEffect(pathEffect);
|
120
|
-
}
|
121
|
-
return shouldRestore;
|
122
|
-
};
|
123
|
-
const processMatrixAndClipping = (props, layer) => {
|
124
|
-
const hasTransform = props.matrix !== undefined || props.transform !== undefined;
|
125
|
-
const clip = computeClip(Skia, props.clip);
|
126
|
-
const hasClip = clip !== undefined;
|
127
|
-
const op = props.invertClip ? ClipOp.Difference : ClipOp.Intersect;
|
128
|
-
const m3 = processTransformProps2(Skia, props);
|
129
|
-
const shouldSave = hasTransform || hasClip || !!layer;
|
130
|
-
if (shouldSave) {
|
131
|
-
if (layer) {
|
132
|
-
if (typeof layer === "boolean") {
|
133
|
-
canvas.saveLayer();
|
134
|
-
} else {
|
135
|
-
canvas.saveLayer(layer);
|
136
|
-
}
|
137
|
-
} else {
|
138
|
-
canvas.save();
|
139
|
-
}
|
140
|
-
}
|
141
|
-
if (m3) {
|
142
|
-
canvas.concat(m3);
|
143
|
-
}
|
144
|
-
if (clip) {
|
145
|
-
if ("clipRect" in clip) {
|
146
|
-
canvas.clipRect(clip.clipRect, op, true);
|
147
|
-
} else if ("clipRRect" in clip) {
|
148
|
-
canvas.clipRRect(clip.clipRRect, op, true);
|
149
|
-
} else {
|
150
|
-
canvas.clipPath(clip.clipPath, op, true);
|
151
|
-
}
|
152
|
-
}
|
153
|
-
return shouldSave;
|
154
|
-
};
|
155
|
-
return {
|
156
|
-
Skia,
|
157
|
-
canvas,
|
158
|
-
save: () => state.paints.push(getPaint().copy()),
|
159
|
-
restore: () => state.paints.pop(),
|
160
|
-
getPaint,
|
161
|
-
processPaint,
|
162
|
-
processMatrixAndClipping
|
163
|
-
};
|
164
|
-
};
|
165
|
-
//# sourceMappingURL=DrawingContext.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["enumKey","isPathDef","processPath","processTransformProps2","BlendMode","ClipOp","isRRect","PaintStyle","StrokeCap","StrokeJoin","computeClip","Skia","clip","clipPath","clipRRect","clipRect","undefined","processColor","color","Color","Array","isArray","Float32Array","Error","createDrawingContext","canvas","state","paints","Paint","getPaint","length","processPaint","opacity","strokeWidth","blendMode","style","strokeJoin","strokeCap","strokeMiter","antiAlias","dither","paint","paintProp","declCtx","push","shouldRestore","colorFilter","colorFilters","popAllAsOne","imageFilter","imageFilters","shader","shaders","pop","maskFilter","maskFilters","pathEffect","pathEffects","copy","setAlphaf","getAlphaf","currentOpacity","setShader","setColor","setStrokeWidth","setBlendMode","setStyle","setStrokeJoin","setStrokeCap","setStrokeMiter","setAntiAlias","setDither","setColorFilter","setImageFilter","setMaskFilter","setPathEffect","processMatrixAndClipping","props","layer","hasTransform","matrix","transform","hasClip","op","invertClip","Difference","Intersect","m3","shouldSave","saveLayer","save","concat","restore"],"sources":["DrawingContext.ts"],"sourcesContent":["import {\n enumKey,\n isPathDef,\n processPath,\n processTransformProps2,\n} from \"../dom/nodes\";\nimport type { ClipDef, DrawingNodeProps, GroupProps } from \"../dom/types\";\nimport {\n BlendMode,\n ClipOp,\n isRRect,\n PaintStyle,\n StrokeCap,\n StrokeJoin,\n} from \"../skia/types\";\nimport type {\n SkPath,\n SkRect,\n SkRRect,\n SkCanvas,\n Skia,\n SkPaint,\n} from \"../skia/types\";\n\nimport type { DeclarationContext } from \"./DeclarationContext\";\n\nconst computeClip = (\n Skia: Skia,\n clip: ClipDef | undefined\n):\n | undefined\n | { clipPath: SkPath }\n | { clipRect: SkRect }\n | { clipRRect: SkRRect } => {\n \"worklet\";\n if (clip) {\n if (isPathDef(clip)) {\n return { clipPath: processPath(Skia, clip) };\n } else if (isRRect(clip)) {\n return { clipRRect: clip };\n } else {\n return { clipRect: clip };\n }\n }\n return undefined;\n};\n\nconst processColor = (\n Skia: Skia,\n color: number | string | Float32Array | number[]\n) => {\n \"worklet\";\n if (typeof color === \"string\" || typeof color === \"number\") {\n return Skia.Color(color);\n } else if (Array.isArray(color) || color instanceof Float32Array) {\n return color instanceof Float32Array ? color : new Float32Array(color);\n } else {\n throw new Error(\n `Invalid color type: ${typeof color}. Expected number, string, or array.`\n );\n }\n};\n\nexport const createDrawingContext = (Skia: Skia, canvas: SkCanvas) => {\n \"worklet\";\n const state = {\n paints: [Skia.Paint()],\n };\n\n const getPaint = () => {\n return state.paints[state.paints.length - 1];\n };\n\n const processPaint = (\n {\n opacity,\n color,\n strokeWidth,\n blendMode,\n style,\n strokeJoin,\n strokeCap,\n strokeMiter,\n antiAlias,\n dither,\n paint: paintProp,\n }: DrawingNodeProps,\n declCtx: DeclarationContext\n ) => {\n if (paintProp) {\n declCtx.paints.push(paintProp);\n return true;\n }\n let shouldRestore = false;\n const colorFilter = declCtx.colorFilters.popAllAsOne();\n const imageFilter = declCtx.imageFilters.popAllAsOne();\n const shader = declCtx.shaders.pop();\n const maskFilter = declCtx.maskFilters.pop();\n const pathEffect = declCtx.pathEffects.popAllAsOne();\n\n if (\n opacity !== undefined ||\n color !== undefined ||\n strokeWidth !== undefined ||\n blendMode !== undefined ||\n style !== undefined ||\n strokeJoin !== undefined ||\n strokeCap !== undefined ||\n strokeMiter !== undefined ||\n antiAlias !== undefined ||\n dither !== undefined ||\n colorFilter !== undefined ||\n imageFilter !== undefined ||\n shader !== undefined ||\n maskFilter !== undefined ||\n pathEffect !== undefined\n ) {\n if (!shouldRestore) {\n state.paints.push(getPaint().copy());\n shouldRestore = true;\n }\n }\n\n const paint = getPaint();\n if (opacity !== undefined) {\n paint.setAlphaf(paint.getAlphaf() * opacity);\n }\n if (color !== undefined) {\n const currentOpacity = paint.getAlphaf();\n paint.setShader(null);\n paint.setColor(processColor(Skia, color));\n paint.setAlphaf(currentOpacity * paint.getAlphaf());\n }\n if (strokeWidth !== undefined) {\n paint.setStrokeWidth(strokeWidth);\n }\n if (blendMode !== undefined) {\n paint.setBlendMode(BlendMode[enumKey(blendMode)]);\n }\n if (style !== undefined) {\n paint.setStyle(PaintStyle[enumKey(style)]);\n }\n if (strokeJoin !== undefined) {\n paint.setStrokeJoin(StrokeJoin[enumKey(strokeJoin)]);\n }\n if (strokeCap !== undefined) {\n paint.setStrokeCap(StrokeCap[enumKey(strokeCap)]);\n }\n if (strokeMiter !== undefined) {\n paint.setStrokeMiter(strokeMiter);\n }\n if (antiAlias !== undefined) {\n paint.setAntiAlias(antiAlias);\n }\n if (dither !== undefined) {\n paint.setDither(dither);\n }\n if (colorFilter) {\n paint.setColorFilter(colorFilter);\n }\n if (imageFilter) {\n paint.setImageFilter(imageFilter);\n }\n if (shader) {\n paint.setShader(shader);\n }\n if (maskFilter) {\n paint.setMaskFilter(maskFilter);\n }\n if (pathEffect) {\n paint.setPathEffect(pathEffect);\n }\n return shouldRestore;\n };\n\n const processMatrixAndClipping = (\n props: GroupProps,\n layer?: boolean | SkPaint\n ) => {\n const hasTransform =\n props.matrix !== undefined || props.transform !== undefined;\n const clip = computeClip(Skia, props.clip);\n const hasClip = clip !== undefined;\n const op = props.invertClip ? ClipOp.Difference : ClipOp.Intersect;\n const m3 = processTransformProps2(Skia, props);\n const shouldSave = hasTransform || hasClip || !!layer;\n\n if (shouldSave) {\n if (layer) {\n if (typeof layer === \"boolean\") {\n canvas.saveLayer();\n } else {\n canvas.saveLayer(layer);\n }\n } else {\n canvas.save();\n }\n }\n\n if (m3) {\n canvas.concat(m3);\n }\n if (clip) {\n if (\"clipRect\" in clip) {\n canvas.clipRect(clip.clipRect, op, true);\n } else if (\"clipRRect\" in clip) {\n canvas.clipRRect(clip.clipRRect, op, true);\n } else {\n canvas.clipPath(clip.clipPath, op, true);\n }\n }\n return shouldSave;\n };\n\n return {\n Skia,\n canvas,\n save: () => state.paints.push(getPaint().copy()),\n restore: () => state.paints.pop(),\n getPaint,\n processPaint,\n processMatrixAndClipping,\n };\n};\n\nexport type DrawingContext = ReturnType<typeof createDrawingContext>;\n"],"mappings":"AAAA,SACEA,OAAO,EACPC,SAAS,EACTC,WAAW,EACXC,sBAAsB,QACjB,cAAc;AAErB,SACEC,SAAS,EACTC,MAAM,EACNC,OAAO,EACPC,UAAU,EACVC,SAAS,EACTC,UAAU,QACL,eAAe;AAYtB,MAAMC,WAAW,GAAGA,CAClBC,IAAU,EACVC,IAAyB,KAKG;EAC5B,SAAS;;EACT,IAAIA,IAAI,EAAE;IACR,IAAIX,SAAS,CAACW,IAAI,CAAC,EAAE;MACnB,OAAO;QAAEC,QAAQ,EAAEX,WAAW,CAACS,IAAI,EAAEC,IAAI;MAAE,CAAC;IAC9C,CAAC,MAAM,IAAIN,OAAO,CAACM,IAAI,CAAC,EAAE;MACxB,OAAO;QAAEE,SAAS,EAAEF;MAAK,CAAC;IAC5B,CAAC,MAAM;MACL,OAAO;QAAEG,QAAQ,EAAEH;MAAK,CAAC;IAC3B;EACF;EACA,OAAOI,SAAS;AAClB,CAAC;AAED,MAAMC,YAAY,GAAGA,CACnBN,IAAU,EACVO,KAAgD,KAC7C;EACH,SAAS;;EACT,IAAI,OAAOA,KAAK,KAAK,QAAQ,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;IAC1D,OAAOP,IAAI,CAACQ,KAAK,CAACD,KAAK,CAAC;EAC1B,CAAC,MAAM,IAAIE,KAAK,CAACC,OAAO,CAACH,KAAK,CAAC,IAAIA,KAAK,YAAYI,YAAY,EAAE;IAChE,OAAOJ,KAAK,YAAYI,YAAY,GAAGJ,KAAK,GAAG,IAAII,YAAY,CAACJ,KAAK,CAAC;EACxE,CAAC,MAAM;IACL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CAAC,CAAC,CAAC;IAChDkC,OAAO,EAAEA,CAAA,KAAMlE,KAAK,CAACC,MAAM,CAAC0B,GAAG,CAAC,CAAC;IACjCxB,QAAQ;IACRE,YAAY;IACZ6C;EACF,CAAC;AACH,CAAC","ignoreList":[]}
|
@@ -1 +0,0 @@
|
|
1
|
-
export {};
|
@@ -1,57 +0,0 @@
|
|
1
|
-
export declare enum DeclarationType {
|
2
|
-
ColorFilter = 0,
|
3
|
-
ImageFilter = 1,
|
4
|
-
Shader = 2,
|
5
|
-
MaskFilter = 3,
|
6
|
-
PathEffect = 4,
|
7
|
-
Paint = 5
|
8
|
-
}
|
9
|
-
interface Filter {
|
10
|
-
tag: string;
|
11
|
-
}
|
12
|
-
export interface SkColorFilter extends Filter {
|
13
|
-
type: DeclarationType.ColorFilter;
|
14
|
-
}
|
15
|
-
interface SkImageFilter extends Filter {
|
16
|
-
type: DeclarationType.ImageFilter;
|
17
|
-
}
|
18
|
-
interface SkShader extends Filter {
|
19
|
-
type: DeclarationType.Shader;
|
20
|
-
}
|
21
|
-
interface SkMaskFilter extends Filter {
|
22
|
-
type: DeclarationType.MaskFilter;
|
23
|
-
}
|
24
|
-
interface SkPathEffect extends Filter {
|
25
|
-
type: DeclarationType.PathEffect;
|
26
|
-
}
|
27
|
-
interface SkPaint extends Filter {
|
28
|
-
type: DeclarationType.Paint;
|
29
|
-
}
|
30
|
-
type Composer<T> = (outer: T, inner: T) => T;
|
31
|
-
export declare const compose: any;
|
32
|
-
export declare const composeDeclarations: <T>(filters: T[], composer: Composer<T>) => T;
|
33
|
-
declare class Declaration<T extends Filter> {
|
34
|
-
decls: T[];
|
35
|
-
indexes: number[];
|
36
|
-
composer?: Composer<T>;
|
37
|
-
constructor(composer?: Composer<T>);
|
38
|
-
private get index();
|
39
|
-
save(): void;
|
40
|
-
restore(): void;
|
41
|
-
pop(): T | undefined;
|
42
|
-
push(decl: T): void;
|
43
|
-
popAll(): T[];
|
44
|
-
popAllAsOne(): T | undefined;
|
45
|
-
}
|
46
|
-
export declare class DeclarationContext {
|
47
|
-
readonly paints: Declaration<SkPaint>;
|
48
|
-
readonly maskFilters: Declaration<SkMaskFilter>;
|
49
|
-
readonly shaders: Declaration<SkShader>;
|
50
|
-
readonly pathEffects: Declaration<SkPathEffect>;
|
51
|
-
readonly imageFilters: Declaration<SkImageFilter>;
|
52
|
-
readonly colorFilters: Declaration<SkColorFilter>;
|
53
|
-
constructor();
|
54
|
-
save(): void;
|
55
|
-
restore(): void;
|
56
|
-
}
|
57
|
-
export {};
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":[],"sources":["Node.ts"],"sourcesContent":["import type { NodeType } from \"../../dom/types\";\n\nexport interface Node<Props = unknown> {\n type: NodeType;\n isDeclaration: boolean;\n props: Props;\n children: Node[];\n}\n"],"mappings":"","ignoreList":[]}
|
@@ -1,10 +0,0 @@
|
|
1
|
-
import type { BlendColorFilterProps, LerpColorFilterProps, MatrixColorFilterProps } from "../../dom/types";
|
2
|
-
import type { SkColorFilter } from "../../skia/types";
|
3
|
-
import type { DeclarationContext } from "../DeclarationContext";
|
4
|
-
export declare const composeColorFilters: (ctx: DeclarationContext, cf: SkColorFilter, processChildren: () => void) => void;
|
5
|
-
export declare const makeBlendColorFilter: (ctx: DeclarationContext, props: BlendColorFilterProps) => SkColorFilter;
|
6
|
-
export declare const makeSRGBToLinearGammaColorFilter: (ctx: DeclarationContext) => SkColorFilter;
|
7
|
-
export declare const makeLinearToSRGBGammaColorFilter: (ctx: DeclarationContext) => SkColorFilter;
|
8
|
-
export declare const declareLerpColorFilter: (ctx: DeclarationContext, props: LerpColorFilterProps) => void;
|
9
|
-
export declare const makeMatrixColorFilter: (ctx: DeclarationContext, props: MatrixColorFilterProps) => SkColorFilter;
|
10
|
-
export declare const makeLumaColorFilter: (ctx: DeclarationContext) => SkColorFilter;
|
@@ -1,66 +0,0 @@
|
|
1
|
-
import { enumKey } from "../../dom/nodes";
|
2
|
-
import { BlendMode } from "../../skia/types";
|
3
|
-
export const composeColorFilters = (ctx, cf, processChildren) => {
|
4
|
-
"worklet";
|
5
|
-
|
6
|
-
const {
|
7
|
-
Skia
|
8
|
-
} = ctx;
|
9
|
-
ctx.colorFilters.save();
|
10
|
-
processChildren();
|
11
|
-
const cf1 = ctx.colorFilters.popAllAsOne();
|
12
|
-
ctx.colorFilters.restore();
|
13
|
-
ctx.colorFilters.push(cf1 ? Skia.ColorFilter.MakeCompose(cf, cf1) : cf);
|
14
|
-
};
|
15
|
-
export const makeBlendColorFilter = (ctx, props) => {
|
16
|
-
"worklet";
|
17
|
-
|
18
|
-
const {
|
19
|
-
mode
|
20
|
-
} = props;
|
21
|
-
const color = ctx.Skia.Color(props.color);
|
22
|
-
const cf = ctx.Skia.ColorFilter.MakeBlend(color, BlendMode[enumKey(mode)]);
|
23
|
-
return cf;
|
24
|
-
};
|
25
|
-
export const makeSRGBToLinearGammaColorFilter = ctx => {
|
26
|
-
"worklet";
|
27
|
-
|
28
|
-
const cf = ctx.Skia.ColorFilter.MakeSRGBToLinearGamma();
|
29
|
-
return cf;
|
30
|
-
};
|
31
|
-
export const makeLinearToSRGBGammaColorFilter = ctx => {
|
32
|
-
"worklet";
|
33
|
-
|
34
|
-
const cf = ctx.Skia.ColorFilter.MakeLinearToSRGBGamma();
|
35
|
-
return cf;
|
36
|
-
};
|
37
|
-
export const declareLerpColorFilter = (ctx, props) => {
|
38
|
-
"worklet";
|
39
|
-
|
40
|
-
const {
|
41
|
-
t
|
42
|
-
} = props;
|
43
|
-
const second = ctx.colorFilters.pop();
|
44
|
-
const first = ctx.colorFilters.pop();
|
45
|
-
if (!first || !second) {
|
46
|
-
throw new Error("LerpColorFilterNode: missing two color filters as children");
|
47
|
-
}
|
48
|
-
const cf = ctx.Skia.ColorFilter.MakeLerp(t, first, second);
|
49
|
-
ctx.colorFilters.push(cf);
|
50
|
-
};
|
51
|
-
export const makeMatrixColorFilter = (ctx, props) => {
|
52
|
-
"worklet";
|
53
|
-
|
54
|
-
const {
|
55
|
-
matrix
|
56
|
-
} = props;
|
57
|
-
const cf = ctx.Skia.ColorFilter.MakeMatrix(matrix);
|
58
|
-
return cf;
|
59
|
-
};
|
60
|
-
export const makeLumaColorFilter = ctx => {
|
61
|
-
"worklet";
|
62
|
-
|
63
|
-
const cf = ctx.Skia.ColorFilter.MakeLumaColorFilter();
|
64
|
-
return cf;
|
65
|
-
};
|
66
|
-
//# sourceMappingURL=colorFilters.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["enumKey","BlendMode","composeColorFilters","ctx","cf","processChildren","Skia","colorFilters","save","cf1","popAllAsOne","restore","push","ColorFilter","MakeCompose","makeBlendColorFilter","props","mode","color","Color","MakeBlend","makeSRGBToLinearGammaColorFilter","MakeSRGBToLinearGamma","makeLinearToSRGBGammaColorFilter","MakeLinearToSRGBGamma","declareLerpColorFilter","t","second","pop","first","Error","MakeLerp","makeMatrixColorFilter","matrix","MakeMatrix","makeLumaColorFilter","MakeLumaColorFilter"],"sources":["colorFilters.ts"],"sourcesContent":["import { enumKey } from \"../../dom/nodes\";\nimport type {\n BlendColorFilterProps,\n LerpColorFilterProps,\n MatrixColorFilterProps,\n} from \"../../dom/types\";\nimport type { SkColorFilter } from \"../../skia/types\";\nimport { BlendMode } from \"../../skia/types\";\nimport type { DeclarationContext } from \"../DeclarationContext\";\n\nexport const composeColorFilters = (\n ctx: DeclarationContext,\n cf: SkColorFilter,\n processChildren: () => void\n) => {\n \"worklet\";\n const { Skia } = ctx;\n ctx.colorFilters.save();\n processChildren();\n const cf1 = ctx.colorFilters.popAllAsOne();\n ctx.colorFilters.restore();\n ctx.colorFilters.push(cf1 ? Skia.ColorFilter.MakeCompose(cf, cf1) : cf);\n};\n\nexport const makeBlendColorFilter = (\n ctx: DeclarationContext,\n props: BlendColorFilterProps\n) => {\n \"worklet\";\n const { mode } = props;\n const color = ctx.Skia.Color(props.color);\n const cf = ctx.Skia.ColorFilter.MakeBlend(color, BlendMode[enumKey(mode)]);\n return cf;\n};\n\nexport const makeSRGBToLinearGammaColorFilter = (ctx: DeclarationContext) => {\n \"worklet\";\n const cf = ctx.Skia.ColorFilter.MakeSRGBToLinearGamma();\n return cf;\n};\n\nexport const makeLinearToSRGBGammaColorFilter = (ctx: DeclarationContext) => {\n \"worklet\";\n const cf = ctx.Skia.ColorFilter.MakeLinearToSRGBGamma();\n return cf;\n};\n\nexport const declareLerpColorFilter = (\n ctx: DeclarationContext,\n props: LerpColorFilterProps\n) => {\n \"worklet\";\n const { t } = props;\n const second = ctx.colorFilters.pop();\n const first = ctx.colorFilters.pop();\n if (!first || !second) {\n throw new Error(\n \"LerpColorFilterNode: missing two color filters as children\"\n );\n }\n const cf = ctx.Skia.ColorFilter.MakeLerp(t, first, second);\n ctx.colorFilters.push(cf);\n};\n\nexport const makeMatrixColorFilter = (\n ctx: DeclarationContext,\n props: MatrixColorFilterProps\n) => {\n \"worklet\";\n const { matrix } = props;\n const cf = ctx.Skia.ColorFilter.MakeMatrix(matrix);\n return cf;\n};\n\nexport const makeLumaColorFilter = (ctx: DeclarationContext) => {\n \"worklet\";\n const cf = ctx.Skia.ColorFilter.MakeLumaColorFilter();\n return cf;\n};\n"],"mappings":"AAAA,SAASA,OAAO,QAAQ,iBAAiB;AAOzC,SAASC,SAAS,QAAQ,kBAAkB;AAG5C,OAAO,MAAMC,mBAAmB,GAAGA,CACjCC,GAAuB,EACvBC,EAAiB,EACjBC,eAA2B,KACxB;EACH,SAAS;;EACT,MAAM;IAAEC;EAAK,CAAC,GAAGH,GAAG;EACpBA,GAAG,CAACI,YAAY,CAACC,IAAI,CAAC,CAAC;EACvBH,eAAe,CAAC,CAAC;EACjB,MAAMI,GAAG,GAAGN,GAAG,CAACI,YAAY,CAACG,WAAW,CAAC,CAAC;EAC1CP,GAAG,CAACI,YAAY,CAACI,OAAO,CAAC,CAAC;EAC1BR,GAAG,CAACI,YAAY,CAACK,IAAI,CAACH,GAAG,GAAGH,IAAI,CAACO,WAAW,CAACC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