@shopify/react-native-skia 1.7.6 → 1.7.7
Sign up to get free protection for your applications and to get access to all the features.
- package/android/cpp/rnskia-android/OpenGLWindowContext.h +8 -1
- package/android/cpp/rnskia-android/RNSkOpenGLCanvasProvider.cpp +4 -4
- package/android/cpp/rnskia-android/RNSkOpenGLCanvasProvider.h +2 -2
- package/android/src/main/java/com/shopify/reactnative/skia/SkiaBaseView.java +13 -0
- package/android/src/main/java/com/shopify/reactnative/skia/SkiaTextureView.java +24 -1
- package/cpp/rnskia/RNSkJsiViewApi.h +0 -3
- package/cpp/rnskia/RNSkView.h +6 -6
- package/ios/RNSkia-iOS/RNSkMetalCanvasProvider.h +2 -2
- package/ios/RNSkia-iOS/RNSkMetalCanvasProvider.mm +2 -2
- package/lib/commonjs/dom/nodes/JsiSkDOM.js.map +1 -1
- package/lib/commonjs/dom/nodes/datatypes/Circle.d.ts +2 -3
- package/lib/commonjs/dom/nodes/datatypes/Circle.js +11 -6
- package/lib/commonjs/dom/nodes/datatypes/Circle.js.map +1 -1
- package/lib/commonjs/dom/nodes/datatypes/Enum.js +1 -0
- package/lib/commonjs/dom/nodes/datatypes/Enum.js.map +1 -1
- package/lib/commonjs/dom/nodes/datatypes/Fitting.js +1 -10
- package/lib/commonjs/dom/nodes/datatypes/Fitting.js.map +1 -1
- package/lib/commonjs/dom/nodes/datatypes/Gradient.js +3 -2
- package/lib/commonjs/dom/nodes/datatypes/Gradient.js.map +1 -1
- package/lib/commonjs/dom/nodes/datatypes/Path.js +4 -1
- package/lib/commonjs/dom/nodes/datatypes/Path.js.map +1 -1
- package/lib/commonjs/dom/nodes/datatypes/Radius.js +1 -0
- package/lib/commonjs/dom/nodes/datatypes/Radius.js.map +1 -1
- package/lib/commonjs/dom/nodes/datatypes/Rect.d.ts +3 -1
- package/lib/commonjs/dom/nodes/datatypes/Rect.js +17 -7
- package/lib/commonjs/dom/nodes/datatypes/Rect.js.map +1 -1
- package/lib/commonjs/dom/nodes/datatypes/Transform.d.ts +2 -1
- package/lib/commonjs/dom/nodes/datatypes/Transform.js +32 -1
- package/lib/commonjs/dom/nodes/datatypes/Transform.js.map +1 -1
- package/lib/commonjs/dom/nodes/drawings/Box.js +4 -5
- package/lib/commonjs/dom/nodes/drawings/Box.js.map +1 -1
- package/lib/commonjs/dom/nodes/drawings/CircleNode.js +1 -1
- package/lib/commonjs/dom/nodes/drawings/CircleNode.js.map +1 -1
- package/lib/commonjs/dom/types/DeclarationContext.d.ts +4 -4
- package/lib/commonjs/dom/types/DeclarationContext.js +8 -2
- package/lib/commonjs/dom/types/DeclarationContext.js.map +1 -1
- package/lib/commonjs/external/reanimated/renderHelpers.d.ts +2 -0
- package/lib/commonjs/external/reanimated/renderHelpers.js +11 -6
- package/lib/commonjs/external/reanimated/renderHelpers.js.map +1 -1
- package/lib/commonjs/renderer/HostConfig.js +8 -4
- package/lib/commonjs/renderer/HostConfig.js.map +1 -1
- package/lib/commonjs/renderer/__tests__/setup.d.ts +2 -3
- package/lib/commonjs/renderer/processors/Animations/Animations.d.ts +1 -2
- package/lib/commonjs/renderer/processors/Animations/Animations.js.map +1 -1
- package/lib/commonjs/renderer/typeddash.js +5 -1
- package/lib/commonjs/renderer/typeddash.js.map +1 -1
- package/lib/commonjs/skia/__tests__/setup.d.ts +0 -3
- package/lib/commonjs/skia/types/Path/Path.js +5 -1
- package/lib/commonjs/skia/types/Path/Path.js.map +1 -1
- package/lib/commonjs/skia/types/Shader/Shader.js +8 -6
- package/lib/commonjs/skia/types/Shader/Shader.js.map +1 -1
- package/lib/commonjs/sksg/Container.d.ts +19 -0
- package/lib/commonjs/sksg/Container.js +102 -0
- package/lib/commonjs/sksg/Container.js.map +1 -0
- package/lib/commonjs/sksg/DrawingContext.d.ts +16 -0
- package/lib/commonjs/sksg/DrawingContext.js +186 -0
- package/lib/commonjs/sksg/DrawingContext.js.map +1 -0
- package/lib/commonjs/sksg/HostConfig.d.ts +19 -0
- package/lib/commonjs/sksg/HostConfig.js +168 -0
- package/lib/commonjs/sksg/HostConfig.js.map +1 -0
- package/lib/commonjs/sksg/Reconciler.d.ts +17 -0
- package/lib/commonjs/sksg/Reconciler.js +54 -0
- package/lib/commonjs/sksg/Reconciler.js.map +1 -0
- package/lib/commonjs/sksg/__tests__/MockDeclaration.d.ts +57 -0
- package/lib/commonjs/sksg/nodes/Node.d.ts +7 -0
- package/lib/commonjs/sksg/nodes/Node.js +6 -0
- package/lib/commonjs/sksg/nodes/Node.js.map +1 -0
- package/lib/commonjs/sksg/nodes/colorFilters.d.ts +7 -0
- package/lib/commonjs/sksg/nodes/colorFilters.js +55 -0
- package/lib/commonjs/sksg/nodes/colorFilters.js.map +1 -0
- package/lib/commonjs/sksg/nodes/context.d.ts +3 -0
- package/lib/commonjs/sksg/nodes/context.js +448 -0
- package/lib/commonjs/sksg/nodes/context.js.map +1 -0
- package/lib/commonjs/sksg/nodes/drawings.d.ts +31 -0
- package/lib/commonjs/sksg/nodes/drawings.js +361 -0
- package/lib/commonjs/sksg/nodes/drawings.js.map +1 -0
- package/lib/commonjs/sksg/nodes/imageFilters.d.ts +14 -0
- package/lib/commonjs/sksg/nodes/imageFilters.js +135 -0
- package/lib/commonjs/sksg/nodes/imageFilters.js.map +1 -0
- package/lib/commonjs/sksg/nodes/index.d.ts +3 -0
- package/lib/commonjs/sksg/nodes/index.js +39 -0
- package/lib/commonjs/sksg/nodes/index.js.map +1 -0
- package/lib/commonjs/sksg/nodes/paint.d.ts +2 -0
- package/lib/commonjs/sksg/nodes/paint.js +80 -0
- package/lib/commonjs/sksg/nodes/paint.js.map +1 -0
- package/lib/commonjs/sksg/nodes/pathEffects.d.ts +8 -0
- package/lib/commonjs/sksg/nodes/pathEffects.js +84 -0
- package/lib/commonjs/sksg/nodes/pathEffects.js.map +1 -0
- package/lib/commonjs/sksg/nodes/shaders.d.ts +10 -0
- package/lib/commonjs/sksg/nodes/shaders.js +156 -0
- package/lib/commonjs/sksg/nodes/shaders.js.map +1 -0
- package/lib/commonjs/sksg/nodes/utils.d.ts +3 -0
- package/lib/commonjs/sksg/nodes/utils.js +25 -0
- package/lib/commonjs/sksg/nodes/utils.js.map +1 -0
- package/lib/commonjs/views/SkiaPictureView.js +0 -2
- package/lib/commonjs/views/SkiaPictureView.js.map +1 -1
- package/lib/commonjs/views/types.d.ts +2 -2
- package/lib/commonjs/views/types.js.map +1 -1
- package/lib/module/dom/nodes/JsiSkDOM.js.map +1 -1
- package/lib/module/dom/nodes/datatypes/Circle.d.ts +2 -3
- package/lib/module/dom/nodes/datatypes/Circle.js +12 -6
- package/lib/module/dom/nodes/datatypes/Circle.js.map +1 -1
- package/lib/module/dom/nodes/datatypes/Enum.js +2 -0
- package/lib/module/dom/nodes/datatypes/Enum.js.map +1 -1
- package/lib/module/dom/nodes/datatypes/Fitting.js +2 -10
- package/lib/module/dom/nodes/datatypes/Fitting.js.map +1 -1
- package/lib/module/dom/nodes/datatypes/Gradient.js +4 -2
- package/lib/module/dom/nodes/datatypes/Gradient.js.map +1 -1
- package/lib/module/dom/nodes/datatypes/Path.js +5 -1
- package/lib/module/dom/nodes/datatypes/Path.js.map +1 -1
- package/lib/module/dom/nodes/datatypes/Radius.js +2 -0
- package/lib/module/dom/nodes/datatypes/Radius.js.map +1 -1
- package/lib/module/dom/nodes/datatypes/Rect.d.ts +3 -1
- package/lib/module/dom/nodes/datatypes/Rect.js +14 -5
- package/lib/module/dom/nodes/datatypes/Rect.js.map +1 -1
- package/lib/module/dom/nodes/datatypes/Transform.d.ts +2 -1
- package/lib/module/dom/nodes/datatypes/Transform.js +31 -0
- package/lib/module/dom/nodes/datatypes/Transform.js.map +1 -1
- package/lib/module/dom/nodes/drawings/Box.js +1 -2
- package/lib/module/dom/nodes/drawings/Box.js.map +1 -1
- package/lib/module/dom/nodes/drawings/CircleNode.js +1 -1
- package/lib/module/dom/nodes/drawings/CircleNode.js.map +1 -1
- package/lib/module/dom/types/DeclarationContext.d.ts +4 -4
- package/lib/module/dom/types/DeclarationContext.js +9 -2
- package/lib/module/dom/types/DeclarationContext.js.map +1 -1
- package/lib/module/external/reanimated/renderHelpers.d.ts +2 -0
- package/lib/module/external/reanimated/renderHelpers.js +8 -4
- package/lib/module/external/reanimated/renderHelpers.js.map +1 -1
- package/lib/module/renderer/HostConfig.js +8 -4
- package/lib/module/renderer/HostConfig.js.map +1 -1
- package/lib/module/renderer/__tests__/setup.d.ts +2 -3
- package/lib/module/renderer/processors/Animations/Animations.d.ts +1 -2
- package/lib/module/renderer/processors/Animations/Animations.js.map +1 -1
- package/lib/module/renderer/typeddash.js +5 -1
- package/lib/module/renderer/typeddash.js.map +1 -1
- package/lib/module/skia/__tests__/setup.d.ts +0 -3
- package/lib/module/skia/types/Path/Path.js +5 -1
- package/lib/module/skia/types/Path/Path.js.map +1 -1
- package/lib/module/skia/types/Shader/Shader.js +9 -6
- package/lib/module/skia/types/Shader/Shader.js.map +1 -1
- package/lib/module/sksg/Container.d.ts +19 -0
- package/lib/module/sksg/Container.js +94 -0
- package/lib/module/sksg/Container.js.map +1 -0
- package/lib/module/sksg/DrawingContext.d.ts +16 -0
- package/lib/module/sksg/DrawingContext.js +180 -0
- package/lib/module/sksg/DrawingContext.js.map +1 -0
- package/lib/module/sksg/HostConfig.d.ts +19 -0
- package/lib/module/sksg/HostConfig.js +161 -0
- package/lib/module/sksg/HostConfig.js.map +1 -0
- package/lib/module/sksg/Reconciler.d.ts +17 -0
- package/lib/module/sksg/Reconciler.js +46 -0
- package/lib/module/sksg/Reconciler.js.map +1 -0
- package/lib/module/sksg/__tests__/MockDeclaration.d.ts +57 -0
- package/lib/module/sksg/nodes/Node.d.ts +7 -0
- package/lib/module/sksg/nodes/Node.js +2 -0
- package/lib/module/sksg/nodes/Node.js.map +1 -0
- package/lib/module/sksg/nodes/colorFilters.d.ts +7 -0
- package/lib/module/sksg/nodes/colorFilters.js +44 -0
- package/lib/module/sksg/nodes/colorFilters.js.map +1 -0
- package/lib/module/sksg/nodes/context.d.ts +3 -0
- package/lib/module/sksg/nodes/context.js +443 -0
- package/lib/module/sksg/nodes/context.js.map +1 -0
- package/lib/module/sksg/nodes/drawings.d.ts +31 -0
- package/lib/module/sksg/nodes/drawings.js +334 -0
- package/lib/module/sksg/nodes/drawings.js.map +1 -0
- package/lib/module/sksg/nodes/imageFilters.d.ts +14 -0
- package/lib/module/sksg/nodes/imageFilters.js +122 -0
- package/lib/module/sksg/nodes/imageFilters.js.map +1 -0
- package/lib/module/sksg/nodes/index.d.ts +3 -0
- package/lib/module/sksg/nodes/index.js +4 -0
- package/lib/module/sksg/nodes/index.js.map +1 -0
- package/lib/module/sksg/nodes/paint.d.ts +2 -0
- package/lib/module/sksg/nodes/paint.js +74 -0
- package/lib/module/sksg/nodes/paint.js.map +1 -0
- package/lib/module/sksg/nodes/pathEffects.d.ts +8 -0
- package/lib/module/sksg/nodes/pathEffects.js +72 -0
- package/lib/module/sksg/nodes/pathEffects.js.map +1 -0
- package/lib/module/sksg/nodes/shaders.d.ts +10 -0
- package/lib/module/sksg/nodes/shaders.js +142 -0
- package/lib/module/sksg/nodes/shaders.js.map +1 -0
- package/lib/module/sksg/nodes/utils.d.ts +3 -0
- package/lib/module/sksg/nodes/utils.js +18 -0
- package/lib/module/sksg/nodes/utils.js.map +1 -0
- package/lib/module/views/SkiaPictureView.js +0 -2
- package/lib/module/views/SkiaPictureView.js.map +1 -1
- package/lib/module/views/types.d.ts +2 -2
- package/lib/module/views/types.js.map +1 -1
- package/lib/typescript/lib/commonjs/dom/nodes/datatypes/Circle.d.ts +1 -1
- package/lib/typescript/lib/commonjs/dom/nodes/datatypes/Rect.d.ts +2 -0
- package/lib/typescript/lib/commonjs/dom/nodes/datatypes/Transform.d.ts +1 -0
- package/lib/typescript/lib/commonjs/external/reanimated/renderHelpers.d.ts +2 -0
- package/lib/typescript/lib/commonjs/renderer/HostConfig.d.ts +3 -1
- package/lib/typescript/lib/commonjs/sksg/Container.d.ts +16 -0
- package/lib/typescript/lib/commonjs/sksg/DrawingContext.d.ts +26 -0
- package/lib/typescript/lib/commonjs/sksg/HostConfig.d.ts +50 -0
- package/lib/typescript/lib/commonjs/sksg/Reconciler.d.ts +16 -0
- package/lib/typescript/lib/commonjs/sksg/nodes/Node.d.ts +1 -0
- package/lib/typescript/lib/commonjs/sksg/nodes/colorFilters.d.ts +7 -0
- package/lib/typescript/lib/commonjs/sksg/nodes/context.d.ts +2 -0
- package/lib/typescript/lib/commonjs/sksg/nodes/drawings.d.ts +23 -0
- package/lib/typescript/lib/commonjs/sksg/nodes/imageFilters.d.ts +10 -0
- package/lib/typescript/lib/commonjs/sksg/nodes/index.d.ts +1 -0
- package/lib/typescript/lib/commonjs/sksg/nodes/paint.d.ts +2 -0
- package/lib/typescript/lib/commonjs/sksg/nodes/pathEffects.d.ts +8 -0
- package/lib/typescript/lib/commonjs/sksg/nodes/shaders.d.ts +10 -0
- package/lib/typescript/lib/commonjs/sksg/nodes/utils.d.ts +3 -0
- package/lib/typescript/lib/module/dom/nodes/datatypes/Circle.d.ts +1 -1
- package/lib/typescript/lib/module/dom/nodes/datatypes/Rect.d.ts +2 -0
- package/lib/typescript/lib/module/dom/nodes/datatypes/Transform.d.ts +1 -0
- package/lib/typescript/lib/module/external/reanimated/renderHelpers.d.ts +2 -0
- package/lib/typescript/lib/module/mock/index.d.ts +4 -1
- package/lib/typescript/lib/module/renderer/HostConfig.d.ts +3 -1
- package/lib/typescript/lib/module/sksg/Container.d.ts +15 -0
- package/lib/typescript/lib/module/sksg/DrawingContext.d.ts +26 -0
- package/lib/typescript/lib/module/sksg/HostConfig.d.ts +49 -0
- package/lib/typescript/lib/module/sksg/Reconciler.d.ts +15 -0
- package/lib/typescript/lib/module/sksg/nodes/colorFilters.d.ts +6 -0
- package/lib/typescript/lib/module/sksg/nodes/context.d.ts +1 -0
- package/lib/typescript/lib/module/sksg/nodes/drawings.d.ts +22 -0
- package/lib/typescript/lib/module/sksg/nodes/imageFilters.d.ts +9 -0
- package/lib/typescript/lib/module/sksg/nodes/index.d.ts +3 -0
- package/lib/typescript/lib/module/sksg/nodes/paint.d.ts +1 -0
- package/lib/typescript/lib/module/sksg/nodes/pathEffects.d.ts +7 -0
- package/lib/typescript/lib/module/sksg/nodes/shaders.d.ts +9 -0
- package/lib/typescript/lib/module/sksg/nodes/utils.d.ts +2 -0
- package/lib/typescript/src/dom/nodes/datatypes/Circle.d.ts +2 -3
- package/lib/typescript/src/dom/nodes/datatypes/Rect.d.ts +3 -1
- package/lib/typescript/src/dom/nodes/datatypes/Transform.d.ts +2 -1
- package/lib/typescript/src/dom/types/DeclarationContext.d.ts +4 -4
- package/lib/typescript/src/external/reanimated/renderHelpers.d.ts +2 -0
- package/lib/typescript/src/renderer/__tests__/setup.d.ts +2 -3
- package/lib/typescript/src/renderer/processors/Animations/Animations.d.ts +1 -2
- package/lib/typescript/src/skia/__tests__/setup.d.ts +0 -3
- package/lib/typescript/src/sksg/Container.d.ts +19 -0
- package/lib/typescript/src/sksg/DrawingContext.d.ts +16 -0
- package/lib/typescript/src/sksg/HostConfig.d.ts +19 -0
- package/lib/typescript/src/sksg/Reconciler.d.ts +17 -0
- package/lib/typescript/src/sksg/__tests__/MockDeclaration.d.ts +57 -0
- package/lib/typescript/src/sksg/nodes/Node.d.ts +7 -0
- package/lib/typescript/src/sksg/nodes/colorFilters.d.ts +7 -0
- package/lib/typescript/src/sksg/nodes/context.d.ts +3 -0
- package/lib/typescript/src/sksg/nodes/drawings.d.ts +31 -0
- package/lib/typescript/src/sksg/nodes/imageFilters.d.ts +14 -0
- package/lib/typescript/src/sksg/nodes/index.d.ts +3 -0
- package/lib/typescript/src/sksg/nodes/paint.d.ts +2 -0
- package/lib/typescript/src/sksg/nodes/pathEffects.d.ts +8 -0
- package/lib/typescript/src/sksg/nodes/shaders.d.ts +10 -0
- package/lib/typescript/src/sksg/nodes/utils.d.ts +3 -0
- package/lib/typescript/src/views/types.d.ts +2 -2
- package/libs/{ios → apple}/libskia.xcframework/Info.plist +15 -0
- package/libs/{ios → apple}/libskia.xcframework/ios-arm64_arm64e/libskia.a +0 -0
- package/libs/{ios → apple}/libskia.xcframework/ios-arm64_arm64e_x86_64-simulator/libskia.a +0 -0
- package/libs/apple/libskia.xcframework/macos-arm64_x86_64/libskia.a +0 -0
- package/libs/{ios → apple}/libskottie.xcframework/Info.plist +20 -5
- package/libs/{ios → apple}/libskottie.xcframework/ios-arm64_arm64e/libskottie.a +0 -0
- package/libs/{ios → apple}/libskottie.xcframework/ios-arm64_arm64e_x86_64-simulator/libskottie.a +0 -0
- package/libs/apple/libskottie.xcframework/macos-arm64_x86_64/libskottie.a +0 -0
- package/libs/{ios → apple}/libskparagraph.xcframework/Info.plist +20 -5
- package/libs/{ios → apple}/libskparagraph.xcframework/ios-arm64_arm64e/libskparagraph.a +0 -0
- package/libs/{ios → apple}/libskparagraph.xcframework/ios-arm64_arm64e_x86_64-simulator/libskparagraph.a +0 -0
- package/libs/apple/libskparagraph.xcframework/macos-arm64_x86_64/libskparagraph.a +0 -0
- package/libs/{ios → apple}/libsksg.xcframework/Info.plist +15 -0
- package/libs/{ios → apple}/libsksg.xcframework/ios-arm64_arm64e/libsksg.a +0 -0
- package/libs/{ios → apple}/libsksg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsksg.a +0 -0
- package/libs/apple/libsksg.xcframework/macos-arm64_x86_64/libsksg.a +0 -0
- package/libs/{ios → apple}/libskshaper.xcframework/Info.plist +20 -5
- package/libs/{ios → apple}/libskshaper.xcframework/ios-arm64_arm64e/libskshaper.a +0 -0
- package/libs/{ios → apple}/libskshaper.xcframework/ios-arm64_arm64e_x86_64-simulator/libskshaper.a +0 -0
- package/libs/apple/libskshaper.xcframework/macos-arm64_x86_64/libskshaper.a +0 -0
- package/libs/{ios → apple}/libskunicode_core.xcframework/Info.plist +18 -3
- package/libs/{ios → apple}/libskunicode_core.xcframework/ios-arm64_arm64e/libskunicode_core.a +0 -0
- package/libs/{ios → apple}/libskunicode_core.xcframework/ios-arm64_arm64e_x86_64-simulator/libskunicode_core.a +0 -0
- package/libs/apple/libskunicode_core.xcframework/macos-arm64_x86_64/libskunicode_core.a +0 -0
- package/libs/{ios → apple}/libskunicode_libgrapheme.xcframework/Info.plist +15 -0
- package/libs/{ios → apple}/libskunicode_libgrapheme.xcframework/ios-arm64_arm64e/libskunicode_libgrapheme.a +0 -0
- package/libs/{ios → apple}/libskunicode_libgrapheme.xcframework/ios-arm64_arm64e_x86_64-simulator/libskunicode_libgrapheme.a +0 -0
- package/libs/apple/libskunicode_libgrapheme.xcframework/macos-arm64_x86_64/libskunicode_libgrapheme.a +0 -0
- package/libs/{ios → apple}/libsvg.xcframework/Info.plist +15 -0
- package/libs/{ios → apple}/libsvg.xcframework/ios-arm64_arm64e/libsvg.a +0 -0
- package/libs/{ios → apple}/libsvg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsvg.a +0 -0
- package/libs/apple/libsvg.xcframework/macos-arm64_x86_64/libsvg.a +0 -0
- package/package.json +3 -3
- package/react-native-skia.podspec +9 -9
- package/src/__tests__/setup.ts +1 -1
- package/src/__tests__/snapshots/sksg/breathe-0.png +0 -0
- package/src/__tests__/snapshots/sksg/breathe.png +0 -0
- package/src/__tests__/snapshots/sksg/simple.png +0 -0
- package/src/__tests__/snapshots/sksg/simple2.png +0 -0
- package/src/dom/nodes/JsiSkDOM.ts +2 -1
- package/src/dom/nodes/datatypes/Circle.ts +7 -5
- package/src/dom/nodes/datatypes/Enum.ts +2 -0
- package/src/dom/nodes/datatypes/Fitting.ts +2 -5
- package/src/dom/nodes/datatypes/Gradient.ts +4 -7
- package/src/dom/nodes/datatypes/Path.ts +5 -2
- package/src/dom/nodes/datatypes/Radius.ts +2 -0
- package/src/dom/nodes/datatypes/Rect.ts +40 -6
- package/src/dom/nodes/datatypes/Transform.ts +29 -1
- package/src/dom/nodes/drawings/Box.ts +1 -29
- package/src/dom/nodes/drawings/CircleNode.ts +1 -1
- package/src/dom/types/DeclarationContext.ts +12 -2
- package/src/external/reanimated/renderHelpers.ts +8 -4
- package/src/renderer/HostConfig.ts +10 -4
- package/src/renderer/__tests__/documentation/shapes/Box.spec.tsx +2 -2
- package/src/renderer/__tests__/setup.tsx +17 -15
- package/src/renderer/processors/Animations/Animations.ts +1 -5
- package/src/renderer/typeddash.ts +4 -2
- package/src/skia/__tests__/setup.ts +1 -51
- package/src/skia/types/Path/Path.ts +4 -2
- package/src/skia/types/Shader/Shader.ts +7 -4
- package/src/sksg/Container.ts +102 -0
- package/src/sksg/DrawingContext.ts +221 -0
- package/src/sksg/HostConfig.ts +287 -0
- package/src/sksg/Reconciler.ts +59 -0
- package/src/sksg/__tests__/Declarations.spec.tsx +235 -0
- package/src/sksg/__tests__/MockDeclaration.ts +140 -0
- package/src/sksg/__tests__/Simple.spec.tsx +148 -0
- package/src/sksg/nodes/Node.ts +8 -0
- package/src/sksg/nodes/colorFilters.ts +60 -0
- package/src/sksg/nodes/context.ts +489 -0
- package/src/sksg/nodes/drawings.ts +393 -0
- package/src/sksg/nodes/imageFilters.ts +183 -0
- package/src/sksg/nodes/index.ts +3 -0
- package/src/sksg/nodes/paint.ts +75 -0
- package/src/sksg/nodes/pathEffects.ts +95 -0
- package/src/sksg/nodes/shaders.ts +203 -0
- package/src/sksg/nodes/utils.ts +23 -0
- package/src/views/SkiaPictureView.tsx +0 -2
- package/src/views/types.ts +2 -2
- package/lib/commonjs/dom/__tests__/Shaders.spec.d.ts +0 -1
- package/lib/commonjs/renderer/__tests__/SkiaDOM.spec.d.ts +0 -1
- package/lib/module/dom/__tests__/Compose.spec.d.ts +0 -1
- package/lib/module/dom/__tests__/Demos.spec.d.ts +0 -1
- package/lib/module/dom/__tests__/DrawingContext.spec.d.ts +0 -1
- package/lib/module/dom/__tests__/Drawings.spec.d.ts +0 -1
- package/lib/module/dom/__tests__/Group.spec.d.ts +0 -1
- package/lib/module/dom/__tests__/Paint.spec.d.ts +0 -1
- package/lib/module/dom/__tests__/RenderNodes.spec.d.ts +0 -1
- package/lib/module/dom/__tests__/Shaders.spec.d.ts +0 -1
- package/lib/module/renderer/__tests__/SkiaDOM.spec.d.ts +0 -1
- package/lib/typescript/src/dom/__tests__/Compose.spec.d.ts +0 -1
- package/lib/typescript/src/dom/__tests__/Demos.spec.d.ts +0 -1
- package/lib/typescript/src/dom/__tests__/DrawingContext.spec.d.ts +0 -1
- package/lib/typescript/src/dom/__tests__/Drawings.spec.d.ts +0 -1
- package/lib/typescript/src/dom/__tests__/Group.spec.d.ts +0 -1
- package/lib/typescript/src/dom/__tests__/Paint.spec.d.ts +0 -1
- package/lib/typescript/src/dom/__tests__/RenderNodes.spec.d.ts +0 -1
- package/lib/typescript/src/dom/__tests__/Shaders.spec.d.ts +0 -1
- package/lib/typescript/src/renderer/__tests__/SkiaDOM.spec.d.ts +0 -1
- package/src/dom/__tests__/Compose.spec.tsx +0 -42
- package/src/dom/__tests__/Demos.spec.tsx +0 -145
- package/src/dom/__tests__/DrawingContext.spec.tsx +0 -99
- package/src/dom/__tests__/Drawings.spec.tsx +0 -95
- package/src/dom/__tests__/Group.spec.tsx +0 -132
- package/src/dom/__tests__/Paint.spec.tsx +0 -100
- package/src/dom/__tests__/RenderNodes.spec.tsx +0 -44
- package/src/dom/__tests__/Shaders.spec.tsx +0 -123
- package/src/renderer/__tests__/SkiaDOM.spec.tsx +0 -46
- /package/lib/commonjs/{dom/__tests__/Compose.spec.d.ts → sksg/__tests__/Declarations.spec.d.ts} +0 -0
- /package/lib/commonjs/{dom/__tests__/Demos.spec.d.ts → sksg/__tests__/Simple.spec.d.ts} +0 -0
- /package/lib/{commonjs/dom/__tests__/DrawingContext.spec.d.ts → module/sksg/__tests__/Declarations.spec.d.ts} +0 -0
- /package/lib/{commonjs/dom/__tests__/Drawings.spec.d.ts → module/sksg/__tests__/Simple.spec.d.ts} +0 -0
- /package/lib/{commonjs/dom/__tests__/Group.spec.d.ts → typescript/lib/module/sksg/nodes/Node.d.ts} +0 -0
- /package/lib/{commonjs/dom/__tests__/Paint.spec.d.ts → typescript/src/sksg/__tests__/Declarations.spec.d.ts} +0 -0
- /package/lib/{commonjs/dom/__tests__/RenderNodes.spec.d.ts → typescript/src/sksg/__tests__/Simple.spec.d.ts} +0 -0
@@ -0,0 +1,334 @@
|
|
1
|
+
"worklet";
|
2
|
+
|
3
|
+
import { deflate, enumKey, fitRects, inflate, NodeType, processCircle, processPath, processRect, processRRect } from "../../dom/nodes";
|
4
|
+
import { saturate } from "../../renderer/processors";
|
5
|
+
import { BlendMode, BlurStyle, ClipOp, FillType, isRRect, PointMode, VertexMode } from "../../skia/types";
|
6
|
+
import { materialize } from "./utils";
|
7
|
+
export const drawLine = (ctx, props) => {
|
8
|
+
const {
|
9
|
+
p1,
|
10
|
+
p2
|
11
|
+
} = props;
|
12
|
+
ctx.canvas.drawLine(p1.x, p1.y, p2.x, p2.y, ctx.paint);
|
13
|
+
};
|
14
|
+
export const drawOval = (ctx, props) => {
|
15
|
+
const rect = processRect(ctx.Skia, props);
|
16
|
+
ctx.canvas.drawOval(rect, ctx.paint);
|
17
|
+
};
|
18
|
+
export const drawBox = (ctx, props, children) => {
|
19
|
+
const {
|
20
|
+
paint,
|
21
|
+
Skia,
|
22
|
+
canvas
|
23
|
+
} = ctx;
|
24
|
+
const {
|
25
|
+
box: defaultBox
|
26
|
+
} = props;
|
27
|
+
const opacity = paint.getAlphaf();
|
28
|
+
const box = isRRect(defaultBox) ? defaultBox : Skia.RRectXY(defaultBox, 0, 0);
|
29
|
+
const shadows = children.map(node => {
|
30
|
+
if (node.type === NodeType.BoxShadow) {
|
31
|
+
return materialize(node.props);
|
32
|
+
}
|
33
|
+
return null;
|
34
|
+
}).filter(n => n !== null);
|
35
|
+
shadows.filter(shadow => !shadow.inner).map(shadow => {
|
36
|
+
const {
|
37
|
+
color = "black",
|
38
|
+
blur,
|
39
|
+
spread = 0,
|
40
|
+
dx = 0,
|
41
|
+
dy = 0
|
42
|
+
} = shadow;
|
43
|
+
const lPaint = Skia.Paint();
|
44
|
+
lPaint.setColor(Skia.Color(color));
|
45
|
+
lPaint.setAlphaf(paint.getAlphaf() * opacity);
|
46
|
+
lPaint.setMaskFilter(Skia.MaskFilter.MakeBlur(BlurStyle.Normal, blur, true));
|
47
|
+
canvas.drawRRect(inflate(Skia, box, spread, spread, dx, dy), lPaint);
|
48
|
+
});
|
49
|
+
canvas.drawRRect(box, paint);
|
50
|
+
shadows.filter(shadow => shadow.inner).map(shadow => {
|
51
|
+
const {
|
52
|
+
color = "black",
|
53
|
+
blur,
|
54
|
+
spread = 0,
|
55
|
+
dx = 0,
|
56
|
+
dy = 0
|
57
|
+
} = shadow;
|
58
|
+
const delta = Skia.Point(10 + Math.abs(dx), 10 + Math.abs(dy));
|
59
|
+
canvas.save();
|
60
|
+
canvas.clipRRect(box, ClipOp.Intersect, false);
|
61
|
+
const lPaint = Skia.Paint();
|
62
|
+
lPaint.setColor(Skia.Color(color));
|
63
|
+
lPaint.setAlphaf(paint.getAlphaf() * opacity);
|
64
|
+
lPaint.setMaskFilter(Skia.MaskFilter.MakeBlur(BlurStyle.Normal, blur, true));
|
65
|
+
const inner = deflate(Skia, box, spread, spread, dx, dy);
|
66
|
+
const outer = inflate(Skia, box, delta.x, delta.y);
|
67
|
+
canvas.drawDRRect(outer, inner, lPaint);
|
68
|
+
canvas.restore();
|
69
|
+
});
|
70
|
+
};
|
71
|
+
export const drawBoxShadow = (_ctx, _props) => {
|
72
|
+
//throw new Error("drawBoxShadow(): not implemented yet");
|
73
|
+
};
|
74
|
+
export const drawImage = (ctx, props) => {
|
75
|
+
const {
|
76
|
+
image
|
77
|
+
} = props;
|
78
|
+
if (image) {
|
79
|
+
var _props$fit;
|
80
|
+
const fit = (_props$fit = props.fit) !== null && _props$fit !== void 0 ? _props$fit : "contain";
|
81
|
+
const rect = processRect(ctx.Skia, props);
|
82
|
+
const {
|
83
|
+
src,
|
84
|
+
dst
|
85
|
+
} = fitRects(fit, {
|
86
|
+
x: 0,
|
87
|
+
y: 0,
|
88
|
+
width: image.width(),
|
89
|
+
height: image.height()
|
90
|
+
}, rect);
|
91
|
+
ctx.canvas.drawImageRect(image, src, dst, ctx.paint);
|
92
|
+
}
|
93
|
+
};
|
94
|
+
export const drawPoints = (ctx, props) => {
|
95
|
+
const {
|
96
|
+
points,
|
97
|
+
mode
|
98
|
+
} = props;
|
99
|
+
ctx.canvas.drawPoints(PointMode[enumKey(mode)], points, ctx.paint);
|
100
|
+
};
|
101
|
+
export const drawVertices = (ctx, props) => {
|
102
|
+
const {
|
103
|
+
mode,
|
104
|
+
textures,
|
105
|
+
colors,
|
106
|
+
indices,
|
107
|
+
blendMode
|
108
|
+
} = props;
|
109
|
+
const vertexMode = mode ? VertexMode[enumKey(mode)] : VertexMode.Triangles;
|
110
|
+
const vertices = ctx.Skia.MakeVertices(vertexMode, props.vertices, textures, colors ? colors.map(c => ctx.Skia.Color(c)) : undefined, indices);
|
111
|
+
const defaultBlendMode = colors ? BlendMode.DstOver : BlendMode.SrcOver;
|
112
|
+
const blend = blendMode ? BlendMode[enumKey(blendMode)] : defaultBlendMode;
|
113
|
+
ctx.canvas.drawVertices(vertices, blend, ctx.paint);
|
114
|
+
};
|
115
|
+
export const drawDiffRect = (ctx, props) => {
|
116
|
+
const {
|
117
|
+
outer,
|
118
|
+
inner
|
119
|
+
} = props;
|
120
|
+
ctx.canvas.drawDRRect(outer, inner, ctx.paint);
|
121
|
+
};
|
122
|
+
export const drawTextPath = (ctx, props) => {
|
123
|
+
const path = processPath(ctx.Skia, props.path);
|
124
|
+
const {
|
125
|
+
font,
|
126
|
+
initialOffset
|
127
|
+
} = props;
|
128
|
+
if (font) {
|
129
|
+
let {
|
130
|
+
text
|
131
|
+
} = props;
|
132
|
+
const ids = font.getGlyphIDs(text);
|
133
|
+
const widths = font.getGlyphWidths(ids);
|
134
|
+
const rsx = [];
|
135
|
+
const meas = ctx.Skia.ContourMeasureIter(path, false, 1);
|
136
|
+
let cont = meas.next();
|
137
|
+
let dist = initialOffset;
|
138
|
+
for (let i = 0; i < text.length && cont; i++) {
|
139
|
+
const width = widths[i];
|
140
|
+
dist += width / 2;
|
141
|
+
if (dist > cont.length()) {
|
142
|
+
// jump to next contour
|
143
|
+
cont = meas.next();
|
144
|
+
if (!cont) {
|
145
|
+
// We have come to the end of the path - terminate the string
|
146
|
+
// right here.
|
147
|
+
text = text.substring(0, i);
|
148
|
+
break;
|
149
|
+
}
|
150
|
+
dist = width / 2;
|
151
|
+
}
|
152
|
+
// Gives us the (x, y) coordinates as well as the cos/sin of the tangent
|
153
|
+
// line at that position.
|
154
|
+
const [p, t] = cont.getPosTan(dist);
|
155
|
+
const adjustedX = p.x - width / 2 * t.x;
|
156
|
+
const adjustedY = p.y - width / 2 * t.y;
|
157
|
+
rsx.push(ctx.Skia.RSXform(t.x, t.y, adjustedX, adjustedY));
|
158
|
+
dist += width / 2;
|
159
|
+
}
|
160
|
+
const derived = ctx.Skia.TextBlob.MakeFromRSXform(text, rsx, font);
|
161
|
+
ctx.canvas.drawTextBlob(derived, 0, 0, ctx.paint);
|
162
|
+
}
|
163
|
+
};
|
164
|
+
export const drawText = (ctx, props) => {
|
165
|
+
const {
|
166
|
+
text,
|
167
|
+
x,
|
168
|
+
y,
|
169
|
+
font
|
170
|
+
} = props;
|
171
|
+
if (font != null) {
|
172
|
+
ctx.canvas.drawText(text, x, y, ctx.paint, font);
|
173
|
+
}
|
174
|
+
};
|
175
|
+
export const drawPatch = (ctx, props) => {
|
176
|
+
const {
|
177
|
+
texture,
|
178
|
+
blendMode,
|
179
|
+
patch
|
180
|
+
} = props;
|
181
|
+
const defaultBlendMode = props.colors ? BlendMode.DstOver : BlendMode.SrcOver;
|
182
|
+
const mode = blendMode ? BlendMode[enumKey(blendMode)] : defaultBlendMode;
|
183
|
+
// Patch requires a path with the following constraints:
|
184
|
+
// M tl
|
185
|
+
// C c1 c2 br
|
186
|
+
// C c1 c2 bl
|
187
|
+
// C c1 c2 tl (the redundant point in the last command is removed)
|
188
|
+
|
189
|
+
const points = [patch[0].pos, patch[0].c2, patch[1].c1, patch[1].pos, patch[1].c2, patch[2].c1, patch[2].pos, patch[2].c2, patch[3].c1, patch[3].pos, patch[3].c2, patch[0].c1];
|
190
|
+
const colors = props.colors ? props.colors.map(c => ctx.Skia.Color(c)) : undefined;
|
191
|
+
ctx.canvas.drawPatch(points, colors, texture, mode, ctx.paint);
|
192
|
+
};
|
193
|
+
export const drawPath = (ctx, props) => {
|
194
|
+
const {
|
195
|
+
start: trimStart,
|
196
|
+
end: trimEnd,
|
197
|
+
fillType,
|
198
|
+
stroke,
|
199
|
+
...pathProps
|
200
|
+
} = props;
|
201
|
+
const start = saturate(trimStart);
|
202
|
+
const end = saturate(trimEnd);
|
203
|
+
const hasStartOffset = start !== 0;
|
204
|
+
const hasEndOffset = end !== 1;
|
205
|
+
const hasStrokeOptions = stroke !== undefined;
|
206
|
+
const hasFillType = !!fillType;
|
207
|
+
const willMutatePath = hasStartOffset || hasEndOffset || hasStrokeOptions || hasFillType;
|
208
|
+
const pristinePath = processPath(ctx.Skia, pathProps.path);
|
209
|
+
const path = willMutatePath ? pristinePath.copy() : pristinePath;
|
210
|
+
if (hasFillType) {
|
211
|
+
path.setFillType(FillType[enumKey(fillType)]);
|
212
|
+
}
|
213
|
+
if (hasStrokeOptions) {
|
214
|
+
path.stroke(stroke);
|
215
|
+
}
|
216
|
+
if (hasStartOffset || hasEndOffset) {
|
217
|
+
path.trim(start, end, false);
|
218
|
+
}
|
219
|
+
ctx.canvas.drawPath(path, ctx.paint);
|
220
|
+
};
|
221
|
+
export const drawRect = (ctx, props) => {
|
222
|
+
const derived = processRect(ctx.Skia, props);
|
223
|
+
ctx.canvas.drawRect(derived, ctx.paint);
|
224
|
+
};
|
225
|
+
export const drawRRect = (ctx, props) => {
|
226
|
+
const derived = processRRect(ctx.Skia, props);
|
227
|
+
ctx.canvas.drawRRect(derived, ctx.paint);
|
228
|
+
};
|
229
|
+
export const drawTextBlob = (ctx, props) => {
|
230
|
+
const {
|
231
|
+
blob,
|
232
|
+
x,
|
233
|
+
y
|
234
|
+
} = props;
|
235
|
+
ctx.canvas.drawTextBlob(blob, x, y, ctx.paint);
|
236
|
+
};
|
237
|
+
export const drawGlyphs = (ctx, props) => {
|
238
|
+
const derived = props.glyphs.reduce((acc, glyph) => {
|
239
|
+
const {
|
240
|
+
id,
|
241
|
+
pos
|
242
|
+
} = glyph;
|
243
|
+
acc.glyphs.push(id);
|
244
|
+
acc.positions.push(pos);
|
245
|
+
return acc;
|
246
|
+
}, {
|
247
|
+
glyphs: [],
|
248
|
+
positions: []
|
249
|
+
});
|
250
|
+
const {
|
251
|
+
glyphs,
|
252
|
+
positions
|
253
|
+
} = derived;
|
254
|
+
const {
|
255
|
+
x,
|
256
|
+
y,
|
257
|
+
font
|
258
|
+
} = props;
|
259
|
+
if (font) {
|
260
|
+
ctx.canvas.drawGlyphs(glyphs, positions, x, y, font, ctx.paint);
|
261
|
+
}
|
262
|
+
};
|
263
|
+
export const drawImageSVG = (ctx, props) => {
|
264
|
+
const {
|
265
|
+
canvas
|
266
|
+
} = ctx;
|
267
|
+
const {
|
268
|
+
svg
|
269
|
+
} = props;
|
270
|
+
const {
|
271
|
+
x,
|
272
|
+
y,
|
273
|
+
width,
|
274
|
+
height
|
275
|
+
} = props.rect ? props.rect : {
|
276
|
+
x: props.x,
|
277
|
+
y: props.y,
|
278
|
+
width: props.width,
|
279
|
+
height: props.height
|
280
|
+
};
|
281
|
+
if (svg === null) {
|
282
|
+
return;
|
283
|
+
}
|
284
|
+
canvas.save();
|
285
|
+
if (x && y) {
|
286
|
+
canvas.translate(x, y);
|
287
|
+
}
|
288
|
+
canvas.drawSvg(svg, width, height);
|
289
|
+
canvas.restore();
|
290
|
+
};
|
291
|
+
export const drawParagraph = (ctx, props) => {
|
292
|
+
const {
|
293
|
+
paragraph,
|
294
|
+
x,
|
295
|
+
y,
|
296
|
+
width
|
297
|
+
} = props;
|
298
|
+
if (paragraph) {
|
299
|
+
paragraph.layout(width);
|
300
|
+
paragraph.paint(ctx.canvas, x, y);
|
301
|
+
}
|
302
|
+
};
|
303
|
+
export const drawPicture = (ctx, props) => {
|
304
|
+
const {
|
305
|
+
picture
|
306
|
+
} = props;
|
307
|
+
ctx.canvas.drawPicture(picture);
|
308
|
+
};
|
309
|
+
export const drawAtlas = (ctx, props) => {
|
310
|
+
const {
|
311
|
+
image,
|
312
|
+
sprites,
|
313
|
+
transforms,
|
314
|
+
colors,
|
315
|
+
blendMode
|
316
|
+
} = props;
|
317
|
+
const blend = blendMode ? BlendMode[enumKey(blendMode)] : undefined;
|
318
|
+
if (image) {
|
319
|
+
ctx.canvas.drawAtlas(image, sprites, transforms, ctx.paint, blend, colors);
|
320
|
+
}
|
321
|
+
};
|
322
|
+
export const drawCircle = (ctx, props) => {
|
323
|
+
const {
|
324
|
+
c
|
325
|
+
} = processCircle(props);
|
326
|
+
const {
|
327
|
+
r
|
328
|
+
} = props;
|
329
|
+
ctx.canvas.drawCircle(c.x, c.y, r, ctx.paint);
|
330
|
+
};
|
331
|
+
export const drawFill = (ctx, _props) => {
|
332
|
+
ctx.canvas.drawPaint(ctx.paint);
|
333
|
+
};
|
334
|
+
//# sourceMappingURL=drawings.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["deflate","enumKey","fitRects","inflate","NodeType","processCircle","processPath","processRect","processRRect","saturate","BlendMode","BlurStyle","ClipOp","FillType","isRRect","PointMode","VertexMode","materialize","drawLine","ctx","props","p1","p2","canvas","x","y","paint","drawOval","rect","Skia","drawBox","children","box","defaultBox","opacity","getAlphaf","RRectXY","shadows","map","node","type","BoxShadow","filter","n","shadow","inner","color","blur","spread","dx","dy","lPaint","Paint","setColor","Color","setAlphaf","setMaskFilter","MaskFilter","MakeBlur","Normal","drawRRect","delta","Point","Math","abs","save","clipRRect","Intersect","outer","drawDRRect","restore","drawBoxShadow","_ctx","_props","drawImage","image","_props$fit","fit","src","dst","width","height","drawImageRect","drawPoints","points","mode","drawVertices","textures","colors","indices","blendMode","vertexMode","Triangles","vertices","MakeVertices","c","undefined","defaultBlendMode","DstOver","SrcOver","blend","drawDiffRect","drawTextPath","path","font","initialOffset","text","ids","getGlyphIDs","widths","getGlyphWidths","rsx","meas","ContourMeasureIter","cont","next","dist","i","length","substring","p","t","getPosTan","adjustedX","adjustedY","push","RSXform","derived","TextBlob","MakeFromRSXform","drawTextBlob","drawText","drawPatch","texture","patch","pos","c2","c1","drawPath","start","trimStart","end","trimEnd","fillType","stroke","pathProps","hasStartOffset","hasEndOffset","hasStrokeOptions","hasFillType","willMutatePath","pristinePath","copy","setFillType","trim","drawRect","blob","drawGlyphs","glyphs","reduce","acc","glyph","id","positions","drawImageSVG","svg","translate","drawSvg","drawParagraph","paragraph","layout","drawPicture","picture","drawAtlas","sprites","transforms","drawCircle","r","drawFill","drawPaint"],"sources":["drawings.ts"],"sourcesContent":["\"worklet\";\n\nimport {\n deflate,\n enumKey,\n fitRects,\n inflate,\n NodeType,\n processCircle,\n processPath,\n processRect,\n processRRect,\n} from \"../../dom/nodes\";\nimport type {\n AtlasProps,\n BoxProps,\n BoxShadowProps,\n CircleProps,\n DiffRectProps,\n DrawingNodeProps,\n GlyphsProps,\n ImageProps,\n ImageSVGProps,\n LineProps,\n OvalProps,\n ParagraphProps,\n PatchProps,\n PathProps,\n PictureProps,\n PointsProps,\n RectProps,\n RoundedRectProps,\n TextBlobProps,\n TextPathProps,\n TextProps,\n VerticesProps,\n} from \"../../dom/types\";\nimport { saturate } from \"../../renderer/processors\";\nimport type {\n SkCanvas,\n SkPaint,\n SkPoint,\n SkRSXform,\n Skia,\n} from \"../../skia/types\";\nimport {\n BlendMode,\n BlurStyle,\n ClipOp,\n FillType,\n isRRect,\n PointMode,\n VertexMode,\n} from \"../../skia/types\";\n\nimport type { Node } from \"./Node\";\nimport { materialize } from \"./utils\";\n\ninterface LocalDrawingContext {\n Skia: Skia;\n canvas: SkCanvas;\n paint: SkPaint;\n}\n\nexport const drawLine = (ctx: LocalDrawingContext, props: LineProps) => {\n const { p1, p2 } = props;\n ctx.canvas.drawLine(p1.x, p1.y, p2.x, p2.y, ctx.paint);\n};\n\nexport const drawOval = (ctx: LocalDrawingContext, props: OvalProps) => {\n const rect = processRect(ctx.Skia, props);\n ctx.canvas.drawOval(rect, ctx.paint);\n};\n\nexport const drawBox = (\n ctx: LocalDrawingContext,\n props: BoxProps,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n children: Node<any>[]\n) => {\n const { paint, Skia, canvas } = ctx;\n const { box: defaultBox } = props;\n const opacity = paint.getAlphaf();\n const box = isRRect(defaultBox) ? defaultBox : Skia.RRectXY(defaultBox, 0, 0);\n const shadows = children\n .map((node) => {\n if (node.type === NodeType.BoxShadow) {\n return materialize(node.props);\n }\n return null;\n })\n .filter((n): n is BoxShadowProps => n !== null);\n shadows\n .filter((shadow) => !shadow.inner)\n .map((shadow) => {\n const { color = \"black\", blur, spread = 0, dx = 0, dy = 0 } = shadow;\n const lPaint = Skia.Paint();\n lPaint.setColor(Skia.Color(color));\n lPaint.setAlphaf(paint.getAlphaf() * opacity);\n lPaint.setMaskFilter(\n Skia.MaskFilter.MakeBlur(BlurStyle.Normal, blur, true)\n );\n canvas.drawRRect(inflate(Skia, box, spread, spread, dx, dy), lPaint);\n });\n\n canvas.drawRRect(box, paint);\n\n shadows\n .filter((shadow) => shadow.inner)\n .map((shadow) => {\n const { color = \"black\", blur, spread = 0, dx = 0, dy = 0 } = shadow;\n const delta = Skia.Point(10 + Math.abs(dx), 10 + Math.abs(dy));\n canvas.save();\n canvas.clipRRect(box, ClipOp.Intersect, false);\n const lPaint = Skia.Paint();\n lPaint.setColor(Skia.Color(color));\n lPaint.setAlphaf(paint.getAlphaf() * opacity);\n\n lPaint.setMaskFilter(\n Skia.MaskFilter.MakeBlur(BlurStyle.Normal, blur, true)\n );\n const inner = deflate(Skia, box, spread, spread, dx, dy);\n const outer = inflate(Skia, box, delta.x, delta.y);\n canvas.drawDRRect(outer, inner, lPaint);\n canvas.restore();\n });\n};\n\nexport const drawBoxShadow = (\n _ctx: LocalDrawingContext,\n _props: BoxShadowProps\n) => {\n //throw new Error(\"drawBoxShadow(): not implemented yet\");\n};\n\nexport const drawImage = (ctx: LocalDrawingContext, props: ImageProps) => {\n const { image } = props;\n if (image) {\n const fit = props.fit ?? \"contain\";\n const rect = processRect(ctx.Skia, props);\n const { src, dst } = fitRects(\n fit,\n {\n x: 0,\n y: 0,\n width: image.width(),\n height: image.height(),\n },\n rect\n );\n ctx.canvas.drawImageRect(image, src, dst, ctx.paint);\n }\n};\n\nexport const drawPoints = (ctx: LocalDrawingContext, props: PointsProps) => {\n const { points, mode } = props;\n ctx.canvas.drawPoints(PointMode[enumKey(mode)], points, ctx.paint);\n};\n\nexport const drawVertices = (\n ctx: LocalDrawingContext,\n props: VerticesProps\n) => {\n const { mode, textures, colors, indices, blendMode } = props;\n const vertexMode = mode ? VertexMode[enumKey(mode)] : VertexMode.Triangles;\n const vertices = ctx.Skia.MakeVertices(\n vertexMode,\n props.vertices,\n textures,\n colors ? colors.map((c) => ctx.Skia.Color(c)) : undefined,\n indices\n );\n const defaultBlendMode = colors ? BlendMode.DstOver : BlendMode.SrcOver;\n const blend = blendMode ? BlendMode[enumKey(blendMode)] : defaultBlendMode;\n\n ctx.canvas.drawVertices(vertices, blend, ctx.paint);\n};\n\nexport const drawDiffRect = (\n ctx: LocalDrawingContext,\n props: DiffRectProps\n) => {\n const { outer, inner } = props;\n ctx.canvas.drawDRRect(outer, inner, ctx.paint);\n};\n\nexport const drawTextPath = (\n ctx: LocalDrawingContext,\n props: TextPathProps\n) => {\n const path = processPath(ctx.Skia, props.path);\n const { font, initialOffset } = props;\n if (font) {\n let { text } = props;\n const ids = font.getGlyphIDs(text);\n const widths = font.getGlyphWidths(ids);\n const rsx: SkRSXform[] = [];\n const meas = ctx.Skia.ContourMeasureIter(path, false, 1);\n let cont = meas.next();\n let dist = initialOffset;\n for (let i = 0; i < text.length && cont; i++) {\n const width = widths[i];\n dist += width / 2;\n if (dist > cont.length()) {\n // jump to next contour\n cont = meas.next();\n if (!cont) {\n // We have come to the end of the path - terminate the string\n // right here.\n text = text.substring(0, i);\n break;\n }\n dist = width / 2;\n }\n // Gives us the (x, y) coordinates as well as the cos/sin of the tangent\n // line at that position.\n const [p, t] = cont.getPosTan(dist);\n const adjustedX = p.x - (width / 2) * t.x;\n const adjustedY = p.y - (width / 2) * t.y;\n rsx.push(ctx.Skia.RSXform(t.x, t.y, adjustedX, adjustedY));\n dist += width / 2;\n }\n const derived = ctx.Skia.TextBlob.MakeFromRSXform(text, rsx, font);\n ctx.canvas.drawTextBlob(derived, 0, 0, ctx.paint);\n }\n};\n\nexport const drawText = (ctx: LocalDrawingContext, props: TextProps) => {\n const { text, x, y, font } = props;\n if (font != null) {\n ctx.canvas.drawText(text, x, y, ctx.paint, font);\n }\n};\n\nexport const drawPatch = (ctx: LocalDrawingContext, props: PatchProps) => {\n const { texture, blendMode, patch } = props;\n const defaultBlendMode = props.colors ? BlendMode.DstOver : BlendMode.SrcOver;\n const mode = blendMode ? BlendMode[enumKey(blendMode)] : defaultBlendMode;\n // Patch requires a path with the following constraints:\n // M tl\n // C c1 c2 br\n // C c1 c2 bl\n // C c1 c2 tl (the redundant point in the last command is removed)\n\n const points = [\n patch[0].pos,\n patch[0].c2,\n patch[1].c1,\n patch[1].pos,\n patch[1].c2,\n patch[2].c1,\n patch[2].pos,\n patch[2].c2,\n patch[3].c1,\n patch[3].pos,\n patch[3].c2,\n patch[0].c1,\n ];\n const colors = props.colors\n ? props.colors.map((c) => ctx.Skia.Color(c))\n : undefined;\n ctx.canvas.drawPatch(points, colors, texture, mode, ctx.paint);\n};\n\nexport const drawPath = (ctx: LocalDrawingContext, props: PathProps) => {\n const {\n start: trimStart,\n end: trimEnd,\n fillType,\n stroke,\n ...pathProps\n } = props;\n const start = saturate(trimStart);\n const end = saturate(trimEnd);\n const hasStartOffset = start !== 0;\n const hasEndOffset = end !== 1;\n const hasStrokeOptions = stroke !== undefined;\n const hasFillType = !!fillType;\n const willMutatePath =\n hasStartOffset || hasEndOffset || hasStrokeOptions || hasFillType;\n const pristinePath = processPath(ctx.Skia, pathProps.path);\n const path = willMutatePath ? pristinePath.copy() : pristinePath;\n if (hasFillType) {\n path.setFillType(FillType[enumKey(fillType)]);\n }\n if (hasStrokeOptions) {\n path.stroke(stroke);\n }\n if (hasStartOffset || hasEndOffset) {\n path.trim(start, end, false);\n }\n ctx.canvas.drawPath(path, ctx.paint);\n};\n\nexport const drawRect = (ctx: LocalDrawingContext, props: RectProps) => {\n const derived = processRect(ctx.Skia, props);\n ctx.canvas.drawRect(derived, ctx.paint);\n};\n\nexport const drawRRect = (\n ctx: LocalDrawingContext,\n props: RoundedRectProps\n) => {\n const derived = processRRect(ctx.Skia, props);\n ctx.canvas.drawRRect(derived, ctx.paint);\n};\n\nexport const drawTextBlob = (\n ctx: LocalDrawingContext,\n props: TextBlobProps\n) => {\n const { blob, x, y } = props;\n ctx.canvas.drawTextBlob(blob, x, y, ctx.paint);\n};\n\ninterface ProcessedGlyphs {\n glyphs: number[];\n positions: SkPoint[];\n}\n\nexport const drawGlyphs = (ctx: LocalDrawingContext, props: GlyphsProps) => {\n const derived = props.glyphs.reduce<ProcessedGlyphs>(\n (acc, glyph) => {\n const { id, pos } = glyph;\n acc.glyphs.push(id);\n acc.positions.push(pos);\n return acc;\n },\n { glyphs: [], positions: [] }\n );\n const { glyphs, positions } = derived;\n const { x, y, font } = props;\n if (font) {\n ctx.canvas.drawGlyphs(glyphs, positions, x, y, font, ctx.paint);\n }\n};\n\nexport const drawImageSVG = (\n ctx: LocalDrawingContext,\n props: ImageSVGProps\n) => {\n const { canvas } = ctx;\n const { svg } = props;\n const { x, y, width, height } = props.rect\n ? props.rect\n : { x: props.x, y: props.y, width: props.width, height: props.height };\n if (svg === null) {\n return;\n }\n canvas.save();\n if (x && y) {\n canvas.translate(x, y);\n }\n canvas.drawSvg(svg, width, height);\n canvas.restore();\n};\n\nexport const drawParagraph = (\n ctx: LocalDrawingContext,\n props: ParagraphProps\n) => {\n const { paragraph, x, y, width } = props;\n if (paragraph) {\n paragraph.layout(width);\n paragraph.paint(ctx.canvas, x, y);\n }\n};\n\nexport const drawPicture = (ctx: LocalDrawingContext, props: PictureProps) => {\n const { picture } = props;\n ctx.canvas.drawPicture(picture);\n};\n\nexport const drawAtlas = (ctx: LocalDrawingContext, props: AtlasProps) => {\n const { image, sprites, transforms, colors, blendMode } = props;\n const blend = blendMode ? BlendMode[enumKey(blendMode)] : undefined;\n if (image) {\n ctx.canvas.drawAtlas(image, sprites, transforms, ctx.paint, blend, colors);\n }\n};\n\nexport const drawCircle = (ctx: LocalDrawingContext, props: CircleProps) => {\n const { c } = processCircle(props);\n const { r } = props;\n ctx.canvas.drawCircle(c.x, c.y, r, ctx.paint);\n};\n\nexport const drawFill = (\n ctx: LocalDrawingContext,\n _props: DrawingNodeProps\n) => {\n ctx.canvas.drawPaint(ctx.paint);\n};\n"],"mappings":"AAAA,SAAS;;AAET,SACEA,OAAO,EACPC,OAAO,EACPC,QAAQ,EACRC,OAAO,EACPC,QAAQ,EACRC,aAAa,EACbC,WAAW,EACXC,WAAW,EACXC,YAAY,QACP,iBAAiB;AAyBxB,SAASC,QAAQ,QAAQ,2BAA2B;AAQpD,SACEC,SAAS,EACTC,SAAS,EACTC,MAAM,EACNC,QAAQ,EACRC,OAAO,EACPC,SAAS,EACTC,UAAU,QACL,kBAAkB;AAGzB,SAASC,WAAW,QAAQ,SAAS;AAQrC,OAAO,MAAMC,QAAQ,GAAGA,CAACC,GAAwB,EAAEC,KAAgB,KAAK;EACtE,MAAM;IAAEC,EAAE;IAAEC;EAAG,CAAC,GAAGF,KAAK;EACxBD,GAAG,CAACI,MAAM,CAACL,QAAQ,CAACG,EAAE,CAACG,CAAC,EAAEH,EAAE,CAACI,CAAC,EAAEH,EAAE,CAACE,CAAC,EAAEF,EAAE,CAACG,CAAC,EAAEN,GAAG,CAACO,KAAK,CAAC;AACxD,CAAC;AAED,OAAO,MAAMC,QAAQ,GAAGA,CAACR,GAAwB,EA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C,CAAC","ignoreList":[]}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import type { BlendImageFilterProps, BlurImageFilterProps, BlurMaskFilterProps, DeclarationContext, DisplacementMapImageFilterProps, DropShadowImageFilterProps, MorphologyImageFilterProps, OffsetImageFilterProps, RuntimeShaderImageFilterProps } from "../../dom/types";
|
2
|
+
import type { SkImageFilter } from "../../skia/types";
|
3
|
+
export declare enum MorphologyOperator {
|
4
|
+
Erode = 0,
|
5
|
+
Dilate = 1
|
6
|
+
}
|
7
|
+
export declare const makeOffsetImageFilter: (ctx: DeclarationContext, props: OffsetImageFilterProps) => SkImageFilter;
|
8
|
+
export declare const declareDisplacementMapImageFilter: (ctx: DeclarationContext, props: DisplacementMapImageFilterProps) => void;
|
9
|
+
export declare const makeBlurImageFilter: (ctx: DeclarationContext, props: BlurImageFilterProps) => SkImageFilter;
|
10
|
+
export declare const makeDropShadowImageFilter: (ctx: DeclarationContext, props: DropShadowImageFilterProps) => SkImageFilter;
|
11
|
+
export declare const makeMorphologyImageFilter: (ctx: DeclarationContext, props: MorphologyImageFilterProps) => SkImageFilter;
|
12
|
+
export declare const makeRuntimeShaderImageFilter: (ctx: DeclarationContext, props: RuntimeShaderImageFilterProps) => SkImageFilter;
|
13
|
+
export declare const declareBlendImageFilter: (ctx: DeclarationContext, props: BlendImageFilterProps) => void;
|
14
|
+
export declare const declareBlurMaskFilter: (ctx: DeclarationContext, props: BlurMaskFilterProps) => void;
|
@@ -0,0 +1,122 @@
|
|
1
|
+
"worklet";
|
2
|
+
|
3
|
+
import { enumKey, processRadius } from "../../dom/nodes";
|
4
|
+
import { BlendMode, BlurStyle, ColorChannel, processUniforms, TileMode } from "../../skia/types";
|
5
|
+
export let MorphologyOperator = /*#__PURE__*/function (MorphologyOperator) {
|
6
|
+
MorphologyOperator[MorphologyOperator["Erode"] = 0] = "Erode";
|
7
|
+
MorphologyOperator[MorphologyOperator["Dilate"] = 1] = "Dilate";
|
8
|
+
return MorphologyOperator;
|
9
|
+
}({});
|
10
|
+
const Black = Float32Array.of(0, 0, 0, 1);
|
11
|
+
const MakeInnerShadow = (Skia, shadowOnly, dx, dy, sigmaX, sigmaY, color, input) => {
|
12
|
+
const sourceGraphic = Skia.ImageFilter.MakeColorFilter(Skia.ColorFilter.MakeBlend(Black, BlendMode.Dst), null);
|
13
|
+
const sourceAlpha = Skia.ImageFilter.MakeColorFilter(Skia.ColorFilter.MakeBlend(Black, BlendMode.SrcIn), null);
|
14
|
+
const f1 = Skia.ImageFilter.MakeColorFilter(Skia.ColorFilter.MakeBlend(color, BlendMode.SrcOut), null);
|
15
|
+
const f2 = Skia.ImageFilter.MakeOffset(dx, dy, f1);
|
16
|
+
const f3 = Skia.ImageFilter.MakeBlur(sigmaX, sigmaY, TileMode.Decal, f2);
|
17
|
+
const f4 = Skia.ImageFilter.MakeBlend(BlendMode.SrcIn, sourceAlpha, f3);
|
18
|
+
if (shadowOnly) {
|
19
|
+
return f4;
|
20
|
+
}
|
21
|
+
return Skia.ImageFilter.MakeCompose(input, Skia.ImageFilter.MakeBlend(BlendMode.SrcOver, sourceGraphic, f4));
|
22
|
+
};
|
23
|
+
const input = ctx => {
|
24
|
+
var _ctx$imageFilters$pop;
|
25
|
+
return (_ctx$imageFilters$pop = ctx.imageFilters.pop()) !== null && _ctx$imageFilters$pop !== void 0 ? _ctx$imageFilters$pop : null;
|
26
|
+
};
|
27
|
+
export const makeOffsetImageFilter = (ctx, props) => {
|
28
|
+
const {
|
29
|
+
x,
|
30
|
+
y
|
31
|
+
} = props;
|
32
|
+
return ctx.Skia.ImageFilter.MakeOffset(x, y, null);
|
33
|
+
};
|
34
|
+
export const declareDisplacementMapImageFilter = (ctx, props) => {
|
35
|
+
const {
|
36
|
+
channelX,
|
37
|
+
channelY,
|
38
|
+
scale
|
39
|
+
} = props;
|
40
|
+
const shader = ctx.shaders.pop();
|
41
|
+
if (!shader) {
|
42
|
+
throw new Error("DisplacementMap expects a shader as child");
|
43
|
+
}
|
44
|
+
const map = ctx.Skia.ImageFilter.MakeShader(shader, null);
|
45
|
+
const imgf = ctx.Skia.ImageFilter.MakeDisplacementMap(ColorChannel[enumKey(channelX)], ColorChannel[enumKey(channelY)], scale, map, input(ctx));
|
46
|
+
ctx.imageFilters.push(imgf);
|
47
|
+
};
|
48
|
+
export const makeBlurImageFilter = (ctx, props) => {
|
49
|
+
const {
|
50
|
+
mode,
|
51
|
+
blur
|
52
|
+
} = props;
|
53
|
+
const sigma = processRadius(ctx.Skia, blur);
|
54
|
+
const imgf = ctx.Skia.ImageFilter.MakeBlur(sigma.x, sigma.y, TileMode[enumKey(mode)], input(ctx));
|
55
|
+
return imgf;
|
56
|
+
};
|
57
|
+
export const makeDropShadowImageFilter = (ctx, props) => {
|
58
|
+
const {
|
59
|
+
dx,
|
60
|
+
dy,
|
61
|
+
blur,
|
62
|
+
shadowOnly,
|
63
|
+
color: cl,
|
64
|
+
inner
|
65
|
+
} = props;
|
66
|
+
const color = ctx.Skia.Color(cl);
|
67
|
+
let factory;
|
68
|
+
if (inner) {
|
69
|
+
factory = MakeInnerShadow.bind(null, ctx.Skia, shadowOnly);
|
70
|
+
} else {
|
71
|
+
factory = shadowOnly ? ctx.Skia.ImageFilter.MakeDropShadowOnly.bind(ctx.Skia.ImageFilter) : ctx.Skia.ImageFilter.MakeDropShadow.bind(ctx.Skia.ImageFilter);
|
72
|
+
}
|
73
|
+
const imgf = factory(dx, dy, blur, blur, color, input(ctx));
|
74
|
+
return imgf;
|
75
|
+
};
|
76
|
+
export const makeMorphologyImageFilter = (ctx, props) => {
|
77
|
+
const {
|
78
|
+
operator
|
79
|
+
} = props;
|
80
|
+
const r = processRadius(ctx.Skia, props.radius);
|
81
|
+
let imgf;
|
82
|
+
if (MorphologyOperator[enumKey(operator)] === MorphologyOperator.Erode) {
|
83
|
+
imgf = ctx.Skia.ImageFilter.MakeErode(r.x, r.y, input(ctx));
|
84
|
+
} else {
|
85
|
+
imgf = ctx.Skia.ImageFilter.MakeDilate(r.x, r.y, input(ctx));
|
86
|
+
}
|
87
|
+
return imgf;
|
88
|
+
};
|
89
|
+
export const makeRuntimeShaderImageFilter = (ctx, props) => {
|
90
|
+
const {
|
91
|
+
source,
|
92
|
+
uniforms
|
93
|
+
} = props;
|
94
|
+
const rtb = ctx.Skia.RuntimeShaderBuilder(source);
|
95
|
+
if (uniforms) {
|
96
|
+
processUniforms(source, uniforms, rtb);
|
97
|
+
}
|
98
|
+
const imgf = ctx.Skia.ImageFilter.MakeRuntimeShader(rtb, null, input(ctx));
|
99
|
+
return imgf;
|
100
|
+
};
|
101
|
+
export const declareBlendImageFilter = (ctx, props) => {
|
102
|
+
const {
|
103
|
+
mode
|
104
|
+
} = props;
|
105
|
+
const a = ctx.imageFilters.pop();
|
106
|
+
const b = ctx.imageFilters.pop();
|
107
|
+
if (!a || !b) {
|
108
|
+
throw new Error("BlendImageFilter requires two image filters");
|
109
|
+
}
|
110
|
+
const imgf = ctx.Skia.ImageFilter.MakeBlend(mode, a, b);
|
111
|
+
ctx.imageFilters.push(imgf);
|
112
|
+
};
|
113
|
+
export const declareBlurMaskFilter = (ctx, props) => {
|
114
|
+
const {
|
115
|
+
blur,
|
116
|
+
style,
|
117
|
+
respectCTM
|
118
|
+
} = props;
|
119
|
+
const mf = ctx.Skia.MaskFilter.MakeBlur(BlurStyle[enumKey(style)], blur, respectCTM);
|
120
|
+
ctx.maskFilters.push(mf);
|
121
|
+
};
|
122
|
+
//# sourceMappingURL=imageFilters.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["enumKey","processRadius","BlendMode","BlurStyle","ColorChannel","processUniforms","TileMode","MorphologyOperator","Black","Float32Array","of","MakeInnerShadow","Skia","shadowOnly","dx","dy","sigmaX","sigmaY","color","input","sourceGraphic","ImageFilter","MakeColorFilter","ColorFilter","MakeBlend","Dst","sourceAlpha","SrcIn","f1","SrcOut","f2","MakeOffset","f3","MakeBlur","Decal","f4","MakeCompose","SrcOver","ctx","_ctx$imageFilters$pop","imageFilters","pop","makeOffsetImageFilter","props","x","y","declareDisplacementMapImageFilter","channelX","channelY","scale","shader","shaders","Error","map","MakeShader","imgf","MakeDisplacementMap","push","makeBlurImageFilter","mode","blur","sigma","makeDropShadowImageFilter","cl","inner","Color","factory","bind","MakeDropShadowOnly","MakeDropShadow","makeMorphologyImageFilter","operator","r","radius","Erode","MakeErode","MakeDilate","makeRuntimeShaderImageFilter","source","uniforms","rtb","RuntimeShaderBuilder","MakeRuntimeShader","declareBlendImageFilter","a","b","declareBlurMaskFilter","style","respectCTM","mf","MaskFilter","maskFilters"],"sources":["imageFilters.ts"],"sourcesContent":["\"worklet\";\n\nimport { enumKey, processRadius } from \"../../dom/nodes\";\nimport type {\n BlendImageFilterProps,\n BlurImageFilterProps,\n BlurMaskFilterProps,\n DeclarationContext,\n DisplacementMapImageFilterProps,\n DropShadowImageFilterProps,\n MorphologyImageFilterProps,\n OffsetImageFilterProps,\n RuntimeShaderImageFilterProps,\n} from \"../../dom/types\";\nimport type { SkColor, Skia, SkImageFilter } from \"../../skia/types\";\nimport {\n BlendMode,\n BlurStyle,\n ColorChannel,\n processUniforms,\n TileMode,\n} from \"../../skia/types\";\n\nexport enum MorphologyOperator {\n Erode,\n Dilate,\n}\n\nconst Black = Float32Array.of(0, 0, 0, 1);\n\nconst MakeInnerShadow = (\n Skia: Skia,\n shadowOnly: boolean | undefined,\n dx: number,\n dy: number,\n sigmaX: number,\n sigmaY: number,\n color: SkColor,\n input: SkImageFilter | null\n) => {\n const sourceGraphic = Skia.ImageFilter.MakeColorFilter(\n Skia.ColorFilter.MakeBlend(Black, BlendMode.Dst),\n null\n );\n const sourceAlpha = Skia.ImageFilter.MakeColorFilter(\n Skia.ColorFilter.MakeBlend(Black, BlendMode.SrcIn),\n null\n );\n const f1 = Skia.ImageFilter.MakeColorFilter(\n Skia.ColorFilter.MakeBlend(color, BlendMode.SrcOut),\n null\n );\n const f2 = Skia.ImageFilter.MakeOffset(dx, dy, f1);\n const f3 = Skia.ImageFilter.MakeBlur(sigmaX, sigmaY, TileMode.Decal, f2);\n const f4 = Skia.ImageFilter.MakeBlend(BlendMode.SrcIn, sourceAlpha, f3);\n if (shadowOnly) {\n return f4;\n }\n return Skia.ImageFilter.MakeCompose(\n input,\n Skia.ImageFilter.MakeBlend(BlendMode.SrcOver, sourceGraphic, f4)\n );\n};\n\nconst input = (ctx: DeclarationContext) => {\n return ctx.imageFilters.pop() ?? null;\n};\n\nexport const makeOffsetImageFilter = (\n ctx: DeclarationContext,\n props: OffsetImageFilterProps\n) => {\n const { x, y } = props;\n return ctx.Skia.ImageFilter.MakeOffset(x, y, null);\n};\n\nexport const declareDisplacementMapImageFilter = (\n ctx: DeclarationContext,\n props: DisplacementMapImageFilterProps\n) => {\n const { channelX, channelY, scale } = props;\n const shader = ctx.shaders.pop();\n if (!shader) {\n throw new Error(\"DisplacementMap expects a shader as child\");\n }\n const map = ctx.Skia.ImageFilter.MakeShader(shader, null);\n const imgf = ctx.Skia.ImageFilter.MakeDisplacementMap(\n ColorChannel[enumKey(channelX)],\n ColorChannel[enumKey(channelY)],\n scale,\n map,\n input(ctx)\n );\n ctx.imageFilters.push(imgf);\n};\n\nexport const makeBlurImageFilter = (\n ctx: DeclarationContext,\n props: BlurImageFilterProps\n) => {\n const { mode, blur } = props;\n const sigma = processRadius(ctx.Skia, blur);\n const imgf = ctx.Skia.ImageFilter.MakeBlur(\n sigma.x,\n sigma.y,\n TileMode[enumKey(mode)],\n input(ctx)\n );\n return imgf;\n};\n\nexport const makeDropShadowImageFilter = (\n ctx: DeclarationContext,\n props: DropShadowImageFilterProps\n) => {\n const { dx, dy, blur, shadowOnly, color: cl, inner } = props;\n const color = ctx.Skia.Color(cl);\n let factory;\n if (inner) {\n factory = MakeInnerShadow.bind(null, ctx.Skia, shadowOnly);\n } else {\n factory = shadowOnly\n ? ctx.Skia.ImageFilter.MakeDropShadowOnly.bind(ctx.Skia.ImageFilter)\n : ctx.Skia.ImageFilter.MakeDropShadow.bind(ctx.Skia.ImageFilter);\n }\n const imgf = factory(dx, dy, blur, blur, color, input(ctx));\n return imgf;\n};\n\nexport const makeMorphologyImageFilter = (\n ctx: DeclarationContext,\n props: MorphologyImageFilterProps\n) => {\n const { operator } = props;\n const r = processRadius(ctx.Skia, props.radius);\n let imgf;\n if (MorphologyOperator[enumKey(operator)] === MorphologyOperator.Erode) {\n imgf = ctx.Skia.ImageFilter.MakeErode(r.x, r.y, input(ctx));\n } else {\n imgf = ctx.Skia.ImageFilter.MakeDilate(r.x, r.y, input(ctx));\n }\n return imgf;\n};\n\nexport const makeRuntimeShaderImageFilter = (\n ctx: DeclarationContext,\n props: RuntimeShaderImageFilterProps\n) => {\n const { source, uniforms } = props;\n const rtb = ctx.Skia.RuntimeShaderBuilder(source);\n if (uniforms) {\n processUniforms(source, uniforms, rtb);\n }\n const imgf = ctx.Skia.ImageFilter.MakeRuntimeShader(rtb, null, input(ctx));\n return imgf;\n};\n\nexport const declareBlendImageFilter = (\n ctx: DeclarationContext,\n props: BlendImageFilterProps\n) => {\n const { mode } = props;\n const a = ctx.imageFilters.pop();\n const b = ctx.imageFilters.pop();\n if (!a || !b) {\n throw new Error(\"BlendImageFilter requires two image filters\");\n }\n const imgf = ctx.Skia.ImageFilter.MakeBlend(mode, a, b);\n ctx.imageFilters.push(imgf);\n};\n\nexport const declareBlurMaskFilter = (\n ctx: DeclarationContext,\n props: BlurMaskFilterProps\n) => {\n const { blur, style, respectCTM } = props;\n const mf = ctx.Skia.MaskFilter.MakeBlur(\n BlurStyle[enumKey(style)],\n blur,\n respectCTM\n );\n ctx.maskFilters.push(mf);\n};\n"],"mappings":"AAAA,SAAS;;AAET,SAASA,OAAO,EAAEC,aAAa,QAAQ,iBAAiB;AAaxD,SACEC,SAAS,EACTC,SAAS,EACTC,YAAY,EACZC,eAAe,EACfC,QAAQ,QACH,kBAAkB;AAEzB,WAAYC,kBAAkB,0BAAlBA,kBAAkB;EAAlBA,kBAAkB,CAAlBA,kBAAkB;EAAlB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AE,IAAI,EAAE7D,KAAK,CAACmB,GAAG,CAAC,CAAC;EAC1E,OAAOiB,IAAI;AACb,CAAC;AAED,OAAO,MAAM4B,uBAAuB,GAAGA,CACrC7C,GAAuB,EACvBK,KAA4B,KACzB;EACH,MAAM;IAAEgB;EAAK,CAAC,GAAGhB,KAAK;EACtB,MAAMyC,CAAC,GAAG9C,GAAG,CAACE,YAAY,CAACC,GAAG,CAAC,CAAC;EAChC,MAAM4C,CAAC,GAAG/C,GAAG,CAACE,YAAY,CAACC,GAAG,CAAC,CAAC;EAChC,IAAI,CAAC2C,CAAC,IAAI,CAACC,CAAC,EAAE;IACZ,MAAM,IAAIjC,KAAK,CAAC,6CAA6C,CAAC;EAChE;EACA,MAAMG,IAAI,GAAGjB,GAAG,CAAC1B,IAAI,CAACS,WAAW,CAACG,SAAS,CAACmC,IAAI,EAAEyB,CAAC,EAAEC,CAAC,CAAC;EACvD/C,GAAG,CAACE,YAAY,CAACiB,IAAI,CAACF,IAAI,CAAC;AAC7B,CAAC;AAED,OAAO,MAAM+B,qBAAqB,GAAGA,CACnChD,GAAuB,EACvBK,KAA0B,KACvB;EACH,MAAM;IAAEiB,IAAI;IAAE2B,KAAK;IAAEC;EAAW,CAAC,GAAG7C,KAAK;EACzC,MAAM8C,EAAE,GAAGnD,GAAG,CAAC1B,IAAI,CAAC8E,UAAU,CAACzD,QAAQ,CACrC9B,SAAS,CAACH,OAAO,CAACuF,KAAK,CAAC,CAAC,EACzB3B,IAAI,EACJ4B,UACF,CAAC;EACDlD,GAAG,CAACqD,WAAW,CAAClC,IAAI,CAACgC,EAAE,CAAC;AAC1B,CAAC","ignoreList":[]}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./Node\";\nexport * from \"./context\";\nexport * from \"./utils\";\n"],"mappings":"AAAA,cAAc,QAAQ;AACtB,cAAc,WAAW;AACzB,cAAc,SAAS","ignoreList":[]}
|
@@ -0,0 +1,74 @@
|
|
1
|
+
"worklet";
|
2
|
+
|
3
|
+
import { enumKey } from "../../dom/nodes";
|
4
|
+
import { BlendMode, PaintStyle, StrokeCap, StrokeJoin } from "../../skia/types";
|
5
|
+
export const declarePaint = (ctx, props) => {
|
6
|
+
const {
|
7
|
+
color,
|
8
|
+
strokeWidth,
|
9
|
+
blendMode,
|
10
|
+
style,
|
11
|
+
strokeJoin,
|
12
|
+
strokeCap,
|
13
|
+
strokeMiter,
|
14
|
+
opacity,
|
15
|
+
antiAlias,
|
16
|
+
dither
|
17
|
+
} = props;
|
18
|
+
const paint = ctx.Skia.Paint();
|
19
|
+
if (color !== undefined) {
|
20
|
+
paint.setColor(ctx.Skia.Color(color));
|
21
|
+
}
|
22
|
+
if (strokeWidth !== undefined) {
|
23
|
+
paint.setStrokeWidth(strokeWidth);
|
24
|
+
}
|
25
|
+
if (blendMode !== undefined) {
|
26
|
+
paint.setBlendMode(BlendMode[enumKey(blendMode)]);
|
27
|
+
}
|
28
|
+
if (style !== undefined) {
|
29
|
+
paint.setStyle(PaintStyle[enumKey(style)]);
|
30
|
+
}
|
31
|
+
if (strokeJoin !== undefined) {
|
32
|
+
paint.setStrokeJoin(StrokeJoin[enumKey(strokeJoin)]);
|
33
|
+
}
|
34
|
+
if (strokeCap !== undefined) {
|
35
|
+
paint.setStrokeCap(StrokeCap[enumKey(strokeCap)]);
|
36
|
+
}
|
37
|
+
if (strokeMiter !== undefined) {
|
38
|
+
paint.setStrokeMiter(strokeMiter);
|
39
|
+
}
|
40
|
+
if (opacity !== undefined) {
|
41
|
+
paint.setAlphaf(opacity);
|
42
|
+
}
|
43
|
+
if (antiAlias !== undefined) {
|
44
|
+
paint.setAntiAlias(antiAlias);
|
45
|
+
}
|
46
|
+
if (dither !== undefined) {
|
47
|
+
paint.setDither(dither);
|
48
|
+
}
|
49
|
+
//ctx.save();
|
50
|
+
|
51
|
+
const colorFilter = ctx.colorFilters.popAllAsOne();
|
52
|
+
const imageFilter = ctx.imageFilters.popAllAsOne();
|
53
|
+
const shader = ctx.shaders.pop();
|
54
|
+
const maskFilter = ctx.maskFilters.pop();
|
55
|
+
const pathEffect = ctx.pathEffects.popAllAsOne();
|
56
|
+
//ctx.restore();
|
57
|
+
if (imageFilter) {
|
58
|
+
paint.setImageFilter(imageFilter);
|
59
|
+
}
|
60
|
+
if (shader) {
|
61
|
+
paint.setShader(shader);
|
62
|
+
}
|
63
|
+
if (pathEffect) {
|
64
|
+
paint.setPathEffect(pathEffect);
|
65
|
+
}
|
66
|
+
if (colorFilter) {
|
67
|
+
paint.setColorFilter(colorFilter);
|
68
|
+
}
|
69
|
+
if (maskFilter) {
|
70
|
+
paint.setMaskFilter(maskFilter);
|
71
|
+
}
|
72
|
+
ctx.paints.push(paint);
|
73
|
+
};
|
74
|
+
//# sourceMappingURL=paint.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["enumKey","BlendMode","PaintStyle","StrokeCap","StrokeJoin","declarePaint","ctx","props","color","strokeWidth","blendMode","style","strokeJoin","strokeCap","strokeMiter","opacity","antiAlias","dither","paint","Skia","Paint","undefined","setColor","Color","setStrokeWidth","setBlendMode","setStyle","setStrokeJoin","setStrokeCap","setStrokeMiter","setAlphaf","setAntiAlias","setDither","colorFilter","colorFilters","popAllAsOne","imageFilter","imageFilters","shader","shaders","pop","maskFilter","maskFilters","pathEffect","pathEffects","setImageFilter","setShader","setPathEffect","setColorFilter","setMaskFilter","paints","push"],"sources":["paint.ts"],"sourcesContent":["\"worklet\";\n\nimport { enumKey } from \"../../dom/nodes\";\nimport type { DeclarationContext, PaintProps } from \"../../dom/types\";\nimport { BlendMode, PaintStyle, StrokeCap, StrokeJoin } from \"../../skia/types\";\n\nexport const declarePaint = (ctx: DeclarationContext, props: PaintProps) => {\n const {\n color,\n strokeWidth,\n blendMode,\n style,\n strokeJoin,\n strokeCap,\n strokeMiter,\n opacity,\n antiAlias,\n dither,\n } = props;\n const paint = ctx.Skia.Paint();\n if (color !== undefined) {\n paint.setColor(ctx.Skia.Color(color));\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 (opacity !== undefined) {\n paint.setAlphaf(opacity);\n }\n if (antiAlias !== undefined) {\n paint.setAntiAlias(antiAlias);\n }\n if (dither !== undefined) {\n paint.setDither(dither);\n }\n //ctx.save();\n\n const colorFilter = ctx.colorFilters.popAllAsOne();\n const imageFilter = ctx.imageFilters.popAllAsOne();\n const shader = ctx.shaders.pop();\n const maskFilter = ctx.maskFilters.pop();\n const pathEffect = ctx.pathEffects.popAllAsOne();\n //ctx.restore();\n if (imageFilter) {\n paint.setImageFilter(imageFilter);\n }\n if (shader) {\n paint.setShader(shader);\n }\n if (pathEffect) {\n paint.setPathEffect(pathEffect);\n }\n if (colorFilter) {\n paint.setColorFilter(colorFilter);\n }\n if (maskFilter) {\n paint.setMaskFilter(maskFilter);\n }\n ctx.paints.push(paint);\n};\n"],"mappings":"AAAA,SAAS;;AAET,SAASA,OAAO,QAAQ,iBAAiB;AAEzC,SAASC,SAAS,EAAEC,UAAU,EAAEC,SAAS,EAAEC,UAAU,QAAQ,kBAAkB;AAE/E,OAAO,MAAMC,YAAY,GAAGA,CAACC,GAAuB,EAAEC,KAAiB,KAAK;EAC1E,MAAM;IACJC,KAAK;IACLC,WAAW;IACXC,SAAS;IACTC,KAAK;IACLC,UAAU;IACVC,SAAS;IACTC,WAAW;IACXC,OAAO;IACPC,SAAS;IACTC;EACF,CAAC,GAAGV,KAAK;EACT,MAAMW,KAAK,GAAGZ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