@shopify/react-native-skia 1.8.0 → 1.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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,13 @@
|
|
|
1
|
+
export function processColor(Skia: any, color: any): any;
|
|
2
|
+
export function setPaintProperties(Skia: any, paint: any, { opacity, color, blendMode, strokeWidth, style, strokeJoin, strokeCap, strokeMiter, antiAlias, dither }: {
|
|
3
|
+
opacity: any;
|
|
4
|
+
color: any;
|
|
5
|
+
blendMode: any;
|
|
6
|
+
strokeWidth: any;
|
|
7
|
+
style: any;
|
|
8
|
+
strokeJoin: any;
|
|
9
|
+
strokeCap: any;
|
|
10
|
+
strokeMiter: any;
|
|
11
|
+
antiAlias: any;
|
|
12
|
+
dither: any;
|
|
13
|
+
}): void;
|
|
@@ -38,6 +38,11 @@ export interface TransformProps {
|
|
|
38
38
|
origin?: Vector;
|
|
39
39
|
matrix?: InputMatrix;
|
|
40
40
|
}
|
|
41
|
+
export interface CTMProps extends TransformProps {
|
|
42
|
+
clip?: ClipDef;
|
|
43
|
+
invertClip?: boolean;
|
|
44
|
+
layer?: SkPaint | boolean;
|
|
45
|
+
}
|
|
41
46
|
export interface PaintProps extends ChildrenProps {
|
|
42
47
|
color?: Color;
|
|
43
48
|
strokeWidth?: number;
|
|
@@ -50,8 +55,5 @@ export interface PaintProps extends ChildrenProps {
|
|
|
50
55
|
antiAlias?: boolean;
|
|
51
56
|
dither?: boolean;
|
|
52
57
|
}
|
|
53
|
-
export interface GroupProps extends PaintProps,
|
|
54
|
-
clip?: ClipDef;
|
|
55
|
-
invertClip?: boolean;
|
|
56
|
-
layer?: SkPaint | boolean;
|
|
58
|
+
export interface GroupProps extends PaintProps, CTMProps {
|
|
57
59
|
}
|
|
@@ -13,7 +13,7 @@ export interface RuntimeShaderImageFilterProps extends ChildrenProps {
|
|
|
13
13
|
uniforms?: Uniforms;
|
|
14
14
|
}
|
|
15
15
|
export interface BlendImageFilterProps extends ChildrenProps {
|
|
16
|
-
mode: BlendMode
|
|
16
|
+
mode: SkEnum<typeof BlendMode>;
|
|
17
17
|
}
|
|
18
18
|
export interface MorphologyImageFilterProps extends ChildrenProps {
|
|
19
19
|
operator: "erode" | "dilate";
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { GroupProps } from "./Common";
|
|
2
2
|
import type { NodeType } from "./NodeType";
|
|
3
|
-
import type { DeclarationContext } from "../../sksg/DeclarationContext";
|
|
4
3
|
export interface Node<P> {
|
|
5
4
|
type: NodeType;
|
|
6
5
|
setProps(props: P): void;
|
|
@@ -13,7 +12,6 @@ export interface Node<P> {
|
|
|
13
12
|
}
|
|
14
13
|
export type Invalidate = () => void;
|
|
15
14
|
export interface DeclarationNode<P> extends Node<P> {
|
|
16
|
-
decorate(ctx: DeclarationContext): void;
|
|
17
15
|
setInvalidate(invalidate: Invalidate): void;
|
|
18
16
|
}
|
|
19
17
|
export type RenderNode<P extends GroupProps> = Node<P>;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { Container } from "../../renderer/Container";
|
|
2
2
|
import type { AnimatedProps } from "../../renderer/processors";
|
|
3
3
|
import type { Node } from "../../dom/types";
|
|
4
|
-
export declare let HAS_REANIMATED: boolean;
|
|
5
4
|
export declare let HAS_REANIMATED_3: boolean;
|
|
6
5
|
export declare const unbindReanimatedNode: (node: Node<unknown>) => void;
|
|
7
6
|
export declare function extractReanimatedProps(props: AnimatedProps<any>): AnimatedProps<any, never>[];
|
|
@@ -35,6 +35,7 @@ export interface SkPaint extends SkJSIInstance<"Paint"> {
|
|
|
35
35
|
SkPaint with the result of SkPaint().
|
|
36
36
|
*/
|
|
37
37
|
reset(): void;
|
|
38
|
+
assign(paint: SkPaint): void;
|
|
38
39
|
/**
|
|
39
40
|
* Retrieves the alpha and RGB unpremultiplied. RGB are extended sRGB values
|
|
40
41
|
* (sRGB gamut, and encoded with the sRGB transfer function).
|
|
@@ -5,6 +5,7 @@ export declare class JsiSkPaint extends HostObject<Paint, "Paint"> implements Sk
|
|
|
5
5
|
constructor(CanvasKit: CanvasKit, ref: Paint);
|
|
6
6
|
dispose: () => void;
|
|
7
7
|
copy(): JsiSkPaint;
|
|
8
|
+
assign(paint: JsiSkPaint): void;
|
|
8
9
|
reset(): void;
|
|
9
10
|
getAlphaf(): number;
|
|
10
11
|
getColor(): Float32Array;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { Skia, SkCanvas } from "../skia/types";
|
|
2
|
-
import type { Node } from "./
|
|
2
|
+
import type { Node } from "./Node";
|
|
3
3
|
export declare class Container {
|
|
4
4
|
Skia: Skia;
|
|
5
5
|
private nativeId;
|
|
6
|
-
_root
|
|
6
|
+
private _root;
|
|
7
|
+
private _recording;
|
|
7
8
|
unmounted: boolean;
|
|
8
9
|
private values;
|
|
9
10
|
private mapperId;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { HostConfig } from "react-reconciler";
|
|
2
|
-
import { NodeType } from "../dom/types";
|
|
3
|
-
import type { Node } from "./
|
|
2
|
+
import type { NodeType } from "../dom/types";
|
|
3
|
+
import type { Node } from "./Node";
|
|
4
4
|
import type { Container } from "./Container";
|
|
5
5
|
export declare const debug: (message?: any, ...optionalParams: any[]) => void;
|
|
6
6
|
type Instance = Node;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { NodeType } from "../dom/types";
|
|
2
|
+
export interface Node<Props = unknown> {
|
|
3
|
+
type: NodeType;
|
|
4
|
+
props: Props;
|
|
5
|
+
children: Node[];
|
|
6
|
+
}
|
|
7
|
+
export declare const isColorFilter: (type: NodeType) => type is NodeType.MatrixColorFilter | NodeType.BlendColorFilter | NodeType.LinearToSRGBGammaColorFilter | NodeType.SRGBToLinearGammaColorFilter | NodeType.LumaColorFilter | NodeType.LerpColorFilter;
|
|
8
|
+
export declare const isPathEffect: (type: NodeType) => type is NodeType.DiscretePathEffect | NodeType.DashPathEffect | NodeType.Path1DPathEffect | NodeType.Path2DPathEffect | NodeType.CornerPathEffect | NodeType.SumPathEffect | NodeType.Line2DPathEffect;
|
|
9
|
+
export declare const isImageFilter: (type: NodeType) => type is NodeType.OffsetImageFilter | NodeType.DisplacementMapImageFilter | NodeType.BlurImageFilter | NodeType.DropShadowImageFilter | NodeType.MorphologyImageFilter | NodeType.BlendImageFilter | NodeType.RuntimeShaderImageFilter;
|
|
10
|
+
export declare const isShader: (type: NodeType) => type is NodeType.Shader | NodeType.ImageShader | NodeType.ColorShader | NodeType.Turbulence | NodeType.FractalNoise | NodeType.LinearGradient | NodeType.RadialGradient | NodeType.SweepGradient | NodeType.TwoPointConicalGradient;
|
|
11
|
+
export declare const sortNodeChildren: (parent: Node) => {
|
|
12
|
+
colorFilters: Node<unknown>[];
|
|
13
|
+
drawings: Node<unknown>[];
|
|
14
|
+
maskFilters: Node<unknown>[];
|
|
15
|
+
shaders: Node<unknown>[];
|
|
16
|
+
pathEffects: Node<unknown>[];
|
|
17
|
+
imageFilters: Node<unknown>[];
|
|
18
|
+
paints: Node<unknown>[];
|
|
19
|
+
};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import type { SharedValue } from "react-native-reanimated";
|
|
2
|
+
import type { BlurMaskFilterProps, CircleProps, CTMProps, ImageProps, PointsProps, PathProps, RectProps, RoundedRectProps, OvalProps, LineProps, PatchProps, VerticesProps, DiffRectProps, TextProps, TextPathProps, TextBlobProps, GlyphsProps, PictureProps, ImageSVGProps, ParagraphProps, AtlasProps, DrawingNodeProps } from "../../dom/types";
|
|
3
|
+
export declare enum CommandType {
|
|
4
|
+
SavePaint = 0,
|
|
5
|
+
RestorePaint = 1,
|
|
6
|
+
SaveCTM = 2,
|
|
7
|
+
RestoreCTM = 3,
|
|
8
|
+
PushColorFilter = 4,
|
|
9
|
+
PushBlurMaskFilter = 5,
|
|
10
|
+
PushImageFilter = 6,
|
|
11
|
+
PushPathEffect = 7,
|
|
12
|
+
PushShader = 8,
|
|
13
|
+
ComposeColorFilter = 9,
|
|
14
|
+
ComposeImageFilter = 10,
|
|
15
|
+
ComposePathEffect = 11,
|
|
16
|
+
MaterializePaint = 12,
|
|
17
|
+
SaveBackdropFilter = 13,
|
|
18
|
+
SaveLayer = 14,
|
|
19
|
+
RestorePaintDeclaration = 15,
|
|
20
|
+
DrawBox = 16,
|
|
21
|
+
DrawImage = 17,
|
|
22
|
+
DrawCircle = 18,
|
|
23
|
+
DrawPaint = 19,
|
|
24
|
+
DrawPoints = 20,
|
|
25
|
+
DrawPath = 21,
|
|
26
|
+
DrawRect = 22,
|
|
27
|
+
DrawRRect = 23,
|
|
28
|
+
DrawOval = 24,
|
|
29
|
+
DrawLine = 25,
|
|
30
|
+
DrawPatch = 26,
|
|
31
|
+
DrawVertices = 27,
|
|
32
|
+
DrawDiffRect = 28,
|
|
33
|
+
DrawText = 29,
|
|
34
|
+
DrawTextPath = 30,
|
|
35
|
+
DrawTextBlob = 31,
|
|
36
|
+
DrawGlyphs = 32,
|
|
37
|
+
DrawPicture = 33,
|
|
38
|
+
DrawImageSVG = 34,
|
|
39
|
+
DrawParagraph = 35,
|
|
40
|
+
DrawAtlas = 36
|
|
41
|
+
}
|
|
42
|
+
export type Command<T extends CommandType = CommandType> = {
|
|
43
|
+
type: T;
|
|
44
|
+
[key: string]: unknown;
|
|
45
|
+
};
|
|
46
|
+
export declare const materializeProps: (command: {
|
|
47
|
+
props: Record<string, unknown>;
|
|
48
|
+
animatedProps?: Record<string, SharedValue<unknown>>;
|
|
49
|
+
}) => void;
|
|
50
|
+
export declare const isCommand: <T extends CommandType>(command: Command, type: T) => command is Command<T>;
|
|
51
|
+
interface Props {
|
|
52
|
+
[CommandType.DrawImage]: ImageProps;
|
|
53
|
+
[CommandType.DrawCircle]: CircleProps;
|
|
54
|
+
[CommandType.SaveCTM]: CTMProps;
|
|
55
|
+
[CommandType.SavePaint]: DrawingNodeProps;
|
|
56
|
+
[CommandType.PushBlurMaskFilter]: BlurMaskFilterProps;
|
|
57
|
+
[CommandType.DrawPoints]: PointsProps;
|
|
58
|
+
[CommandType.DrawPath]: PathProps;
|
|
59
|
+
[CommandType.DrawRect]: RectProps;
|
|
60
|
+
[CommandType.DrawRRect]: RoundedRectProps;
|
|
61
|
+
[CommandType.DrawOval]: OvalProps;
|
|
62
|
+
[CommandType.DrawLine]: LineProps;
|
|
63
|
+
[CommandType.DrawPatch]: PatchProps;
|
|
64
|
+
[CommandType.DrawVertices]: VerticesProps;
|
|
65
|
+
[CommandType.DrawDiffRect]: DiffRectProps;
|
|
66
|
+
[CommandType.DrawText]: TextProps;
|
|
67
|
+
[CommandType.DrawTextPath]: TextPathProps;
|
|
68
|
+
[CommandType.DrawTextBlob]: TextBlobProps;
|
|
69
|
+
[CommandType.DrawGlyphs]: GlyphsProps;
|
|
70
|
+
[CommandType.DrawPicture]: PictureProps;
|
|
71
|
+
[CommandType.DrawImageSVG]: ImageSVGProps;
|
|
72
|
+
[CommandType.DrawParagraph]: ParagraphProps;
|
|
73
|
+
[CommandType.DrawAtlas]: AtlasProps;
|
|
74
|
+
}
|
|
75
|
+
interface DrawCommand<T extends CommandType> extends Command<T> {
|
|
76
|
+
props: T extends keyof Props ? Props[T] : never;
|
|
77
|
+
}
|
|
78
|
+
export declare const isDrawCommand: <T extends keyof Props>(command: Command, type: T) => command is DrawCommand<T>;
|
|
79
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Skia, SkCanvas, SkColorFilter, SkPaint, SkShader, SkImageFilter, SkPathEffect } from "../../skia/types";
|
|
2
|
+
export declare const createDrawingContext: (Skia: Skia, paintPool: SkPaint[], canvas: SkCanvas) => {
|
|
3
|
+
Skia: Skia;
|
|
4
|
+
canvas: SkCanvas;
|
|
5
|
+
paints: SkPaint[];
|
|
6
|
+
colorFilters: SkColorFilter[];
|
|
7
|
+
shaders: SkShader[];
|
|
8
|
+
imageFilters: SkImageFilter[];
|
|
9
|
+
pathEffects: SkPathEffect[];
|
|
10
|
+
paintDeclarations: SkPaint[];
|
|
11
|
+
paintPool: SkPaint[];
|
|
12
|
+
savePaint: () => void;
|
|
13
|
+
saveBackdropFilter: () => void;
|
|
14
|
+
readonly paint: SkPaint;
|
|
15
|
+
restorePaint: () => SkPaint | undefined;
|
|
16
|
+
materializePaint: () => void;
|
|
17
|
+
};
|
|
18
|
+
export type DrawingContext = ReturnType<typeof createDrawingContext>;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { SharedValue } from "react-native-reanimated";
|
|
2
|
+
import { NodeType } from "../../dom/types";
|
|
3
|
+
import type { BlurMaskFilterProps, CircleProps, CTMProps, ImageProps, PaintProps, PointsProps, PathProps, RectProps, RoundedRectProps, OvalProps, LineProps, PatchProps, VerticesProps, DiffRectProps, TextProps, TextPathProps, TextBlobProps, GlyphsProps, PictureProps, ImageSVGProps, ParagraphProps, AtlasProps, BoxProps, BoxShadowProps } from "../../dom/types";
|
|
4
|
+
import type { AnimatedProps } from "../../renderer";
|
|
5
|
+
import type { Command } from "./Core";
|
|
6
|
+
export declare class Recorder {
|
|
7
|
+
commands: Command[];
|
|
8
|
+
private processProps;
|
|
9
|
+
private add;
|
|
10
|
+
savePaint(props: AnimatedProps<PaintProps>): void;
|
|
11
|
+
restorePaint(): void;
|
|
12
|
+
restorePaintDeclaration(): void;
|
|
13
|
+
materializePaint(): void;
|
|
14
|
+
pushPathEffect(pathEffectType: NodeType, props: AnimatedProps<unknown>): void;
|
|
15
|
+
pushImageFilter(imageFilterType: NodeType, props: AnimatedProps<unknown>): void;
|
|
16
|
+
pushColorFilter(colorFilterType: NodeType, props: AnimatedProps<unknown>): void;
|
|
17
|
+
pushShader(shaderType: NodeType, props: AnimatedProps<unknown>): void;
|
|
18
|
+
pushBlurMaskFilter(props: AnimatedProps<BlurMaskFilterProps>): void;
|
|
19
|
+
composePathEffect(): void;
|
|
20
|
+
composeColorFilter(): void;
|
|
21
|
+
composeImageFilter(): void;
|
|
22
|
+
saveCTM(props: AnimatedProps<CTMProps>): void;
|
|
23
|
+
restoreCTM(): void;
|
|
24
|
+
drawPaint(): void;
|
|
25
|
+
saveLayer(): void;
|
|
26
|
+
saveBackdropFilter(): void;
|
|
27
|
+
drawBox(boxProps: AnimatedProps<BoxProps>, shadows: {
|
|
28
|
+
props: BoxShadowProps;
|
|
29
|
+
animatedProps?: Record<string, SharedValue<unknown>>;
|
|
30
|
+
}[]): void;
|
|
31
|
+
drawImage(props: AnimatedProps<ImageProps>): void;
|
|
32
|
+
drawCircle(props: AnimatedProps<CircleProps>): void;
|
|
33
|
+
drawPoints(props: AnimatedProps<PointsProps>): void;
|
|
34
|
+
drawPath(props: AnimatedProps<PathProps>): void;
|
|
35
|
+
drawRect(props: AnimatedProps<RectProps>): void;
|
|
36
|
+
drawRRect(props: AnimatedProps<RoundedRectProps>): void;
|
|
37
|
+
drawOval(props: AnimatedProps<OvalProps>): void;
|
|
38
|
+
drawLine(props: AnimatedProps<LineProps>): void;
|
|
39
|
+
drawPatch(props: AnimatedProps<PatchProps>): void;
|
|
40
|
+
drawVertices(props: AnimatedProps<VerticesProps>): void;
|
|
41
|
+
drawDiffRect(props: AnimatedProps<DiffRectProps>): void;
|
|
42
|
+
drawText(props: AnimatedProps<TextProps>): void;
|
|
43
|
+
drawTextPath(props: AnimatedProps<TextPathProps>): void;
|
|
44
|
+
drawTextBlob(props: AnimatedProps<TextBlobProps>): void;
|
|
45
|
+
drawGlyphs(props: AnimatedProps<GlyphsProps>): void;
|
|
46
|
+
drawPicture(props: AnimatedProps<PictureProps>): void;
|
|
47
|
+
drawImageSVG(props: AnimatedProps<ImageSVGProps>): void;
|
|
48
|
+
drawParagraph(props: AnimatedProps<ParagraphProps>): void;
|
|
49
|
+
drawAtlas(props: AnimatedProps<AtlasProps>): void;
|
|
50
|
+
}
|
|
@@ -0,0 +1,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;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { BoxProps, BoxShadowProps } from "../../../dom/types";
|
|
2
|
+
import type { Command } from "../Core";
|
|
3
|
+
import { CommandType } from "../Core";
|
|
4
|
+
import type { DrawingContext } from "../DrawingContext";
|
|
5
|
+
interface BoxCommand extends Command<CommandType.DrawBox> {
|
|
6
|
+
props: BoxProps;
|
|
7
|
+
shadows: {
|
|
8
|
+
props: BoxShadowProps;
|
|
9
|
+
}[];
|
|
10
|
+
}
|
|
11
|
+
export declare const isBoxCommand: (command: Command) => command is BoxCommand;
|
|
12
|
+
export declare const drawBox: (ctx: DrawingContext, command: BoxCommand) => void;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { CommandType } from "../Core";
|
|
2
|
+
import type { Command } from "../Core";
|
|
3
|
+
import type { DrawingContext } from "../DrawingContext";
|
|
4
|
+
export declare const isPushColorFilter: (command: Command) => command is Command<CommandType.PushColorFilter>;
|
|
5
|
+
export declare const composeColorFilters: (ctx: DrawingContext) => void;
|
|
6
|
+
export declare const pushColorFilter: (ctx: DrawingContext, command: Command<CommandType.PushColorFilter>) => void;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { AtlasProps, BoxProps, CircleProps, DiffRectProps, DrawingNodeProps, GlyphsProps, ImageProps, ImageSVGProps, LineProps, OvalProps, ParagraphProps, PatchProps, PathProps, PictureProps, PointsProps, RectProps, RoundedRectProps, TextBlobProps, TextPathProps, TextProps, VerticesProps } from "../../../dom/types";
|
|
2
|
+
import type { Node } from "../../Node";
|
|
3
|
+
import type { DrawingContext } from "../DrawingContext";
|
|
4
|
+
export declare const drawLine: (ctx: DrawingContext, props: LineProps) => void;
|
|
5
|
+
export declare const drawOval: (ctx: DrawingContext, props: OvalProps) => void;
|
|
6
|
+
export declare const drawBox: (ctx: DrawingContext, props: BoxProps, children: Node<any>[]) => void;
|
|
7
|
+
export declare const drawImage: (ctx: DrawingContext, props: ImageProps) => void;
|
|
8
|
+
export declare const drawPoints: (ctx: DrawingContext, props: PointsProps) => void;
|
|
9
|
+
export declare const drawVertices: (ctx: DrawingContext, props: VerticesProps) => void;
|
|
10
|
+
export declare const drawDiffRect: (ctx: DrawingContext, props: DiffRectProps) => void;
|
|
11
|
+
export declare const drawTextPath: (ctx: DrawingContext, props: TextPathProps) => void;
|
|
12
|
+
export declare const drawText: (ctx: DrawingContext, props: TextProps) => void;
|
|
13
|
+
export declare const drawPatch: (ctx: DrawingContext, props: PatchProps) => void;
|
|
14
|
+
export declare const drawPath: (ctx: DrawingContext, props: PathProps) => void;
|
|
15
|
+
export declare const drawRect: (ctx: DrawingContext, props: RectProps) => void;
|
|
16
|
+
export declare const drawRRect: (ctx: DrawingContext, props: RoundedRectProps) => void;
|
|
17
|
+
export declare const drawTextBlob: (ctx: DrawingContext, props: TextBlobProps) => void;
|
|
18
|
+
export declare const drawGlyphs: (ctx: DrawingContext, props: GlyphsProps) => void;
|
|
19
|
+
export declare const drawImageSVG: (ctx: DrawingContext, props: ImageSVGProps) => void;
|
|
20
|
+
export declare const drawParagraph: (ctx: DrawingContext, props: ParagraphProps) => void;
|
|
21
|
+
export declare const drawPicture: (ctx: DrawingContext, props: PictureProps) => void;
|
|
22
|
+
export declare const drawAtlas: (ctx: DrawingContext, props: AtlasProps) => void;
|
|
23
|
+
export declare const drawCircle: (ctx: DrawingContext, props: CircleProps) => void;
|
|
24
|
+
export declare const drawFill: (ctx: DrawingContext, _props: DrawingNodeProps) => void;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { BlurMaskFilterProps } from "../../../dom/types";
|
|
2
|
+
import type { Command } from "../Core";
|
|
3
|
+
import { CommandType } from "../Core";
|
|
4
|
+
import type { DrawingContext } from "../DrawingContext";
|
|
5
|
+
export declare enum MorphologyOperator {
|
|
6
|
+
Erode = 0,
|
|
7
|
+
Dilate = 1
|
|
8
|
+
}
|
|
9
|
+
export declare const composeImageFilters: (ctx: DrawingContext) => void;
|
|
10
|
+
export declare const setBlurMaskFilter: (ctx: DrawingContext, props: BlurMaskFilterProps) => void;
|
|
11
|
+
export declare const isPushImageFilter: (command: Command) => command is Command<CommandType.PushImageFilter>;
|
|
12
|
+
export declare const pushImageFilter: (ctx: DrawingContext, command: Command<CommandType.PushImageFilter>) => void;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { PaintProps } from "../../../dom/types";
|
|
2
|
+
import type { SkPaint, Skia } from "../../../skia/types";
|
|
3
|
+
export declare const processColor: (Skia: Skia, color: number | string | Float32Array | number[]) => Float32Array;
|
|
4
|
+
export declare const setPaintProperties: (Skia: Skia, paint: SkPaint, { opacity, color, blendMode, strokeWidth, style, strokeJoin, strokeCap, strokeMiter, antiAlias, dither, }: PaintProps) => void;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Command } from "../Core";
|
|
2
|
+
import { CommandType } from "../Core";
|
|
3
|
+
import type { DrawingContext } from "../DrawingContext";
|
|
4
|
+
export declare const isPushPathEffect: (command: Command) => command is Command<CommandType.PushPathEffect>;
|
|
5
|
+
export declare const composePathEffects: (ctx: DrawingContext) => void;
|
|
6
|
+
export declare const pushPathEffect: (ctx: DrawingContext, command: Command<CommandType.PushPathEffect>) => void;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Command } from "../Core";
|
|
2
|
+
import { CommandType } from "../Core";
|
|
3
|
+
import type { DrawingContext } from "../DrawingContext";
|
|
4
|
+
export declare const isPushShader: (command: Command) => command is Command<CommandType.PushShader>;
|
|
5
|
+
export declare const pushShader: (ctx: DrawingContext, command: Command<CommandType.PushShader>) => void;
|
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
import type { SharedValue } from "react-native-reanimated";
|
|
2
2
|
export declare const isSharedValue: <T = unknown>(value: unknown) => value is SharedValue<T>;
|
|
3
3
|
export declare const materialize: <T extends object>(props: T) => T;
|
|
4
|
+
type Composer<T> = (outer: T, inner: T) => T;
|
|
5
|
+
export declare const composeDeclarations: <T>(filters: T[], composer: Composer<T>) => T;
|
|
6
|
+
export {};
|
package/package.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"setup-skia-web": "./scripts/setup-canvaskit.js"
|
|
8
8
|
},
|
|
9
9
|
"title": "React Native Skia",
|
|
10
|
-
"version": "1.8.
|
|
10
|
+
"version": "1.8.1",
|
|
11
11
|
"description": "High-performance React Native Graphics using Skia",
|
|
12
12
|
"main": "lib/module/index.js",
|
|
13
13
|
"react-native": "src/index.ts",
|
|
Binary file
|
package/src/dom/types/Common.ts
CHANGED
|
@@ -70,6 +70,12 @@ export interface TransformProps {
|
|
|
70
70
|
matrix?: InputMatrix;
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
+
export interface CTMProps extends TransformProps {
|
|
74
|
+
clip?: ClipDef;
|
|
75
|
+
invertClip?: boolean;
|
|
76
|
+
layer?: SkPaint | boolean;
|
|
77
|
+
}
|
|
78
|
+
|
|
73
79
|
export interface PaintProps extends ChildrenProps {
|
|
74
80
|
color?: Color;
|
|
75
81
|
strokeWidth?: number;
|
|
@@ -83,8 +89,4 @@ export interface PaintProps extends ChildrenProps {
|
|
|
83
89
|
dither?: boolean;
|
|
84
90
|
}
|
|
85
91
|
|
|
86
|
-
export interface GroupProps extends PaintProps,
|
|
87
|
-
clip?: ClipDef;
|
|
88
|
-
invertClip?: boolean;
|
|
89
|
-
layer?: SkPaint | boolean;
|
|
90
|
-
}
|
|
92
|
+
export interface GroupProps extends PaintProps, CTMProps {}
|
|
@@ -24,8 +24,9 @@ export interface RuntimeShaderImageFilterProps extends ChildrenProps {
|
|
|
24
24
|
uniforms?: Uniforms;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
+
// TODO: delete
|
|
27
28
|
export interface BlendImageFilterProps extends ChildrenProps {
|
|
28
|
-
mode: BlendMode
|
|
29
|
+
mode: SkEnum<typeof BlendMode>;
|
|
29
30
|
}
|
|
30
31
|
|
|
31
32
|
export interface MorphologyImageFilterProps extends ChildrenProps {
|
package/src/dom/types/Node.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { GroupProps } from "./Common";
|
|
2
2
|
import type { NodeType } from "./NodeType";
|
|
3
|
-
import type { DeclarationContext } from "../../sksg/DeclarationContext";
|
|
4
3
|
|
|
5
4
|
export interface Node<P> {
|
|
6
5
|
type: NodeType;
|
|
@@ -18,9 +17,6 @@ export interface Node<P> {
|
|
|
18
17
|
export type Invalidate = () => void;
|
|
19
18
|
|
|
20
19
|
export interface DeclarationNode<P> extends Node<P> {
|
|
21
|
-
//declarationType: DeclarationType;
|
|
22
|
-
decorate(ctx: DeclarationContext): void;
|
|
23
|
-
|
|
24
20
|
setInvalidate(invalidate: Invalidate): void;
|
|
25
21
|
}
|
|
26
22
|
|
|
@@ -6,7 +6,6 @@ import type { Node } from "../../dom/types";
|
|
|
6
6
|
|
|
7
7
|
import Rea from "./ReanimatedProxy";
|
|
8
8
|
|
|
9
|
-
export let HAS_REANIMATED = false;
|
|
10
9
|
export let HAS_REANIMATED_3 = false;
|
|
11
10
|
try {
|
|
12
11
|
// This logic is convoluted but necessary
|
|
@@ -16,7 +15,6 @@ try {
|
|
|
16
15
|
const reanimatedVersion =
|
|
17
16
|
require("react-native-reanimated/package.json").version;
|
|
18
17
|
require("react-native-reanimated");
|
|
19
|
-
HAS_REANIMATED = !!reanimatedVersion;
|
|
20
18
|
if (
|
|
21
19
|
reanimatedVersion &&
|
|
22
20
|
(reanimatedVersion >= "3.0.0" || reanimatedVersion.includes("3.0.0-"))
|
|
@@ -24,13 +22,13 @@ try {
|
|
|
24
22
|
HAS_REANIMATED_3 = true;
|
|
25
23
|
}
|
|
26
24
|
} catch (e) {
|
|
27
|
-
|
|
25
|
+
// do nothing
|
|
28
26
|
}
|
|
29
27
|
|
|
30
28
|
const _bindings = new WeakMap<Node<unknown>, unknown>();
|
|
31
29
|
|
|
32
30
|
export const unbindReanimatedNode = (node: Node<unknown>) => {
|
|
33
|
-
if (!
|
|
31
|
+
if (!HAS_REANIMATED_3) {
|
|
34
32
|
return;
|
|
35
33
|
}
|
|
36
34
|
const previousMapperId = _bindings.get(node);
|
|
@@ -40,7 +38,7 @@ export const unbindReanimatedNode = (node: Node<unknown>) => {
|
|
|
40
38
|
};
|
|
41
39
|
|
|
42
40
|
export function extractReanimatedProps(props: AnimatedProps<any>) {
|
|
43
|
-
if (!
|
|
41
|
+
if (!HAS_REANIMATED_3) {
|
|
44
42
|
return [props, {}];
|
|
45
43
|
}
|
|
46
44
|
const reanimatedProps = {} as AnimatedProps<any>;
|
|
@@ -60,50 +58,12 @@ export function extractReanimatedProps(props: AnimatedProps<any>) {
|
|
|
60
58
|
return [otherProps, reanimatedProps];
|
|
61
59
|
}
|
|
62
60
|
|
|
63
|
-
function bindReanimatedProps2(
|
|
64
|
-
container: Container,
|
|
65
|
-
node: Node<any>,
|
|
66
|
-
reanimatedProps: AnimatedProps<any>
|
|
67
|
-
) {
|
|
68
|
-
const sharedValues = Object.values(reanimatedProps);
|
|
69
|
-
const previousMapperId = _bindings.get(node);
|
|
70
|
-
if (previousMapperId !== undefined) {
|
|
71
|
-
Rea.stopMapper(previousMapperId as number);
|
|
72
|
-
}
|
|
73
|
-
if (sharedValues.length > 0) {
|
|
74
|
-
const viewId = container.getNativeId();
|
|
75
|
-
const { SkiaViewApi } = global;
|
|
76
|
-
const updateProps = () => {
|
|
77
|
-
for (const propName in reanimatedProps) {
|
|
78
|
-
node && node.setProp(propName, reanimatedProps[propName].value);
|
|
79
|
-
}
|
|
80
|
-
// On React Native we use the SkiaViewApi to redraw because it can
|
|
81
|
-
// run on the worklet thread (container.redraw can't)
|
|
82
|
-
// if SkiaViewApi is undefined, we are on web and container.redraw()
|
|
83
|
-
// can safely be invoked
|
|
84
|
-
if (SkiaViewApi) {
|
|
85
|
-
SkiaViewApi.requestRedraw(viewId);
|
|
86
|
-
} else {
|
|
87
|
-
container.redraw();
|
|
88
|
-
}
|
|
89
|
-
};
|
|
90
|
-
const mapperId = Rea.startMapper(() => {
|
|
91
|
-
"worklet";
|
|
92
|
-
Rea.runOnJS(updateProps)();
|
|
93
|
-
}, sharedValues);
|
|
94
|
-
_bindings.set(node, mapperId);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
|
|
98
61
|
export function bindReanimatedProps(
|
|
99
62
|
container: Container,
|
|
100
63
|
node: Node<any>,
|
|
101
64
|
reanimatedProps: AnimatedProps<any>
|
|
102
65
|
) {
|
|
103
|
-
if (
|
|
104
|
-
return bindReanimatedProps2(container, node, reanimatedProps);
|
|
105
|
-
}
|
|
106
|
-
if (!HAS_REANIMATED) {
|
|
66
|
+
if (!HAS_REANIMATED_3) {
|
|
107
67
|
return;
|
|
108
68
|
}
|
|
109
69
|
const sharedValues = Object.values(reanimatedProps);
|
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
import { docPath, checkImage, processResult } from "../../../__tests__/setup";
|
|
15
15
|
import { setupSkia } from "../../../skia/__tests__/setup";
|
|
16
16
|
import { fitRects } from "../../../dom/nodes";
|
|
17
|
+
import { BlendMode } from "../../../skia/types";
|
|
17
18
|
|
|
18
19
|
const blackAndWhite = [
|
|
19
20
|
0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0,
|
|
@@ -57,6 +58,20 @@ describe("Color Filters", () => {
|
|
|
57
58
|
);
|
|
58
59
|
checkImage(img, docPath("color-filters/color-blend.png"));
|
|
59
60
|
});
|
|
61
|
+
it("should build the reference result for should use composition", async () => {
|
|
62
|
+
const { surface: ckSurface, Skia, canvas } = setupSkia(wWidth, wHeight);
|
|
63
|
+
const paint = Skia.Paint();
|
|
64
|
+
const outer = Skia.ColorFilter.MakeSRGBToLinearGamma();
|
|
65
|
+
const inner = Skia.ColorFilter.MakeBlend(
|
|
66
|
+
Skia.Color("lightblue"),
|
|
67
|
+
BlendMode.SrcIn
|
|
68
|
+
);
|
|
69
|
+
paint.setColorFilter(Skia.ColorFilter.MakeCompose(outer, inner));
|
|
70
|
+
const r = (surface.width * 3) / 2;
|
|
71
|
+
canvas.drawCircle(r, r, r, paint);
|
|
72
|
+
canvas.drawCircle(r * 2, r, r, paint);
|
|
73
|
+
processResult(ckSurface, docPath("color-filters/composition.png"));
|
|
74
|
+
});
|
|
60
75
|
it("should use composition", async () => {
|
|
61
76
|
const { width } = surface;
|
|
62
77
|
const r = width / 2;
|