@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,44 @@
|
|
1
|
+
"worklet";
|
2
|
+
|
3
|
+
import { enumKey } from "../../dom/nodes";
|
4
|
+
import { BlendMode } from "../../skia/types";
|
5
|
+
export const makeBlendColorFilter = (ctx, props) => {
|
6
|
+
const {
|
7
|
+
mode
|
8
|
+
} = props;
|
9
|
+
const color = ctx.Skia.Color(props.color);
|
10
|
+
const cf = ctx.Skia.ColorFilter.MakeBlend(color, BlendMode[enumKey(mode)]);
|
11
|
+
return cf;
|
12
|
+
};
|
13
|
+
export const makeSRGBToLinearGammaColorFilter = ctx => {
|
14
|
+
const cf = ctx.Skia.ColorFilter.MakeSRGBToLinearGamma();
|
15
|
+
return cf;
|
16
|
+
};
|
17
|
+
export const makeLinearToSRGBGammaColorFilter = ctx => {
|
18
|
+
const cf = ctx.Skia.ColorFilter.MakeLinearToSRGBGamma();
|
19
|
+
return cf;
|
20
|
+
};
|
21
|
+
export const declareLerpColorFilter = (ctx, props) => {
|
22
|
+
const {
|
23
|
+
t
|
24
|
+
} = props;
|
25
|
+
const second = ctx.colorFilters.pop();
|
26
|
+
const first = ctx.colorFilters.pop();
|
27
|
+
if (!first || !second) {
|
28
|
+
throw new Error("LerpColorFilterNode: missing two color filters as children");
|
29
|
+
}
|
30
|
+
const cf = ctx.Skia.ColorFilter.MakeLerp(t, first, second);
|
31
|
+
ctx.colorFilters.push(cf);
|
32
|
+
};
|
33
|
+
export const makeMatrixColorFilter = (ctx, props) => {
|
34
|
+
const {
|
35
|
+
matrix
|
36
|
+
} = props;
|
37
|
+
const cf = ctx.Skia.ColorFilter.MakeMatrix(matrix);
|
38
|
+
return cf;
|
39
|
+
};
|
40
|
+
export const makeLumaColorFilter = ctx => {
|
41
|
+
const cf = ctx.Skia.ColorFilter.MakeLumaColorFilter();
|
42
|
+
return cf;
|
43
|
+
};
|
44
|
+
//# sourceMappingURL=colorFilters.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["enumKey","BlendMode","makeBlendColorFilter","ctx","props","mode","color","Skia","Color","cf","ColorFilter","MakeBlend","makeSRGBToLinearGammaColorFilter","MakeSRGBToLinearGamma","makeLinearToSRGBGammaColorFilter","MakeLinearToSRGBGamma","declareLerpColorFilter","t","second","colorFilters","pop","first","Error","MakeLerp","push","makeMatrixColorFilter","matrix","MakeMatrix","makeLumaColorFilter","MakeLumaColorFilter"],"sources":["colorFilters.ts"],"sourcesContent":["\"worklet\";\n\nimport { enumKey } from \"../../dom/nodes\";\nimport type {\n BlendColorFilterProps,\n DeclarationContext,\n LerpColorFilterProps,\n MatrixColorFilterProps,\n} from \"../../dom/types\";\nimport { BlendMode } from \"../../skia/types\";\n\nexport const makeBlendColorFilter = (\n ctx: DeclarationContext,\n props: BlendColorFilterProps\n) => {\n const { mode } = props;\n const color = ctx.Skia.Color(props.color);\n const cf = ctx.Skia.ColorFilter.MakeBlend(color, BlendMode[enumKey(mode)]);\n return cf;\n};\n\nexport const makeSRGBToLinearGammaColorFilter = (ctx: DeclarationContext) => {\n const cf = ctx.Skia.ColorFilter.MakeSRGBToLinearGamma();\n return cf;\n};\n\nexport const makeLinearToSRGBGammaColorFilter = (ctx: DeclarationContext) => {\n const cf = ctx.Skia.ColorFilter.MakeLinearToSRGBGamma();\n return cf;\n};\n\nexport const declareLerpColorFilter = (\n ctx: DeclarationContext,\n props: LerpColorFilterProps\n) => {\n const { t } = props;\n const second = ctx.colorFilters.pop();\n const first = ctx.colorFilters.pop();\n if (!first || !second) {\n throw new Error(\n \"LerpColorFilterNode: missing two color filters as children\"\n );\n }\n const cf = ctx.Skia.ColorFilter.MakeLerp(t, first, second);\n ctx.colorFilters.push(cf);\n};\n\nexport const makeMatrixColorFilter = (\n ctx: DeclarationContext,\n props: MatrixColorFilterProps\n) => {\n const { matrix } = props;\n const cf = ctx.Skia.ColorFilter.MakeMatrix(matrix);\n return cf;\n};\n\nexport const makeLumaColorFilter = (ctx: DeclarationContext) => {\n const cf = ctx.Skia.ColorFilter.MakeLumaColorFilter();\n return cf;\n};\n"],"mappings":"AAAA,SAAS;;AAET,SAASA,OAAO,QAAQ,iBAAiB;AAOzC,SAASC,SAAS,QAAQ,kBAAkB;AAE5C,OAAO,MAAMC,oBAAoB,GAAGA,CAClCC,GAAuB,EACvBC,KAA4B,KACzB;EACH,MAAM;IAAEC;EAAK,CAAC,GAAGD,KAAK;EACtB,MAAME,KAAK,GAAGH,GAAG,CAACI,IAAI,CAACC,KAAK,CAACJ,KAAK,CAACE,KAAK,CAAC;EACzC,MAAMG,EAAE,GAAGN,GAAG,CAACI,IAAI,CAACG,WAAW,CAACC,SAAS,CAACL,KAAK,EAAEL,SAAS,CAACD,OAAO,CAACK,IAAI,CAAC,CAAC,CAAC;EAC1E,OAAOI,EAAE;AACX,CAAC;AAED,OAAO,MAAMG,gCAAgC,GAAIT,GAAuB,IAAK;EAC3E,MAAMM,EAAE,GAAGN,GAAG,CAACI,IAAI,CAACG,WAAW,CAACG,qBAAqB,CAAC,CAAC;EACvD,OAAOJ,EAAE;AACX,CAAC;AAED,OAAO,MAAMK,gCAAgC,GAAIX,GAAuB,IAAK;EAC3E,MAAMM,EAAE,GAAGN,GAAG,CAACI,IAAI,CAACG,WAAW,CAACK,qBAAqB,CAAC,CAAC;EACvD,OAAON,EAAE;AACX,CAAC;AAED,OAAO,MAAMO,sBAAsB,GAAGA,CACpCb,GAAuB,EACvBC,KAA2B,KACxB;EACH,MAAM;IAAEa;EAAE,CAAC,GAAGb,KAAK;EACnB,MAAMc,MAAM,GAAGf,GAAG,CAACgB,YAAY,CAACC,GAAG,CAAC,CAAC;EACrC,MAAMC,KAAK,GAAGlB,GAAG,CAACgB,YAAY,CAACC,GAAG,CAAC,CAAC;EACpC,IAAI,CAACC,KAAK,IAAI,CAACH,MAAM,EAAE;IACrB,MAAM,IAAII,KAAK,CACb,4DACF,CAAC;EACH;EACA,MAAMb,EAAE,GAAGN,GAAG,CAACI,IAAI,CAACG,WAAW,CAACa,QAAQ,CAACN,CAAC,EAAEI,KAAK,EAAEH,MAAM,CAAC;EAC1Df,GAAG,CAACgB,YAAY,CAACK,IAAI,CAACf,EAAE,CAAC;AAC3B,CAAC;AAED,OAAO,MAAMgB,qBAAqB,GAAGA,CACnCtB,GAAuB,EACvBC,KAA6B,KAC1B;EACH,MAAM;IAAEsB;EAAO,CAAC,GAAGtB,KAAK;EACxB,MAAMK,EAAE,GAAGN,GAAG,CAACI,IAAI,CAACG,WAAW,CAACiB,UAAU,CAACD,MAAM,CAAC;EAClD,OAAOjB,EAAE;AACX,CAAC;AAED,OAAO,MAAMmB,mBAAmB,GAAIzB,GAAuB,IAAK;EAC9D,MAAMM,EAAE,GAAGN,GAAG,CAACI,IAAI,CAACG,WAAW,CAACmB,mBAAmB,CAAC,CAAC;EACrD,OAAOpB,EAAE;AACX,CAAC","ignoreList":[]}
|
@@ -0,0 +1,443 @@
|
|
1
|
+
"worklet";
|
2
|
+
|
3
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
4
|
+
import { composeDeclarations, NodeType } from "../../dom/types";
|
5
|
+
import { BlendMode } from "../../skia/types";
|
6
|
+
import { enumKey } from "../../dom/nodes";
|
7
|
+
import { drawAtlas, drawBox, drawBoxShadow, drawCircle, drawDiffRect, drawFill, drawGlyphs, drawImage, drawImageSVG, drawLine, drawOval, drawParagraph, drawPatch, drawPath, drawPicture, drawPoints, drawRect, drawRRect, drawText, drawTextBlob, drawTextPath, drawVertices } from "./drawings";
|
8
|
+
import { declareLerpColorFilter, makeBlendColorFilter, makeLinearToSRGBGammaColorFilter, makeLumaColorFilter, makeMatrixColorFilter, makeSRGBToLinearGammaColorFilter } from "./colorFilters";
|
9
|
+
import { declareBlendImageFilter, declareBlurMaskFilter, declareDisplacementMapImageFilter, makeBlurImageFilter, makeDropShadowImageFilter, makeMorphologyImageFilter, makeOffsetImageFilter, makeRuntimeShaderImageFilter } from "./imageFilters";
|
10
|
+
import { materialize } from "./utils";
|
11
|
+
import { declareColorShader, declareFractalNoiseShader, declareImageShader, declareLinearGradientShader, declareRadialGradientShader, declareShader, declareSweepGradientShader, declareTurbulenceShader, declareTwoPointConicalGradientShader } from "./shaders";
|
12
|
+
import { declarePaint } from "./paint";
|
13
|
+
import { declareSumPathEffect, makeCornerPathEffect, makeDashPathEffect, makeDiscretePathEffect, makeLine2DPathEffect, makePath1DPathEffect, makePath2DPathEffect } from "./pathEffects";
|
14
|
+
function composeColorFilters(ctx, cf, processChildren) {
|
15
|
+
const {
|
16
|
+
Skia
|
17
|
+
} = ctx;
|
18
|
+
ctx.save();
|
19
|
+
processChildren();
|
20
|
+
const cf1 = ctx.colorFilters.popAllAsOne();
|
21
|
+
ctx.restore();
|
22
|
+
ctx.colorFilters.push(cf1 ? Skia.ColorFilter.MakeCompose(cf, cf1) : cf);
|
23
|
+
}
|
24
|
+
function composePathEffects(ctx, pe, processChildren) {
|
25
|
+
const {
|
26
|
+
Skia
|
27
|
+
} = ctx;
|
28
|
+
ctx.save();
|
29
|
+
processChildren();
|
30
|
+
const pe1 = ctx.pathEffects.popAllAsOne();
|
31
|
+
ctx.restore();
|
32
|
+
ctx.pathEffects.push(pe1 ? Skia.PathEffect.MakeCompose(pe, pe1) : pe);
|
33
|
+
}
|
34
|
+
function composeImageFilters(ctx, imgf1, processChildren) {
|
35
|
+
const {
|
36
|
+
Skia
|
37
|
+
} = ctx;
|
38
|
+
ctx.save();
|
39
|
+
processChildren();
|
40
|
+
let imgf2 = ctx.imageFilters.popAllAsOne();
|
41
|
+
const cf = ctx.colorFilters.popAllAsOne();
|
42
|
+
ctx.restore();
|
43
|
+
if (cf) {
|
44
|
+
var _imgf;
|
45
|
+
imgf2 = Skia.ImageFilter.MakeCompose((_imgf = imgf2) !== null && _imgf !== void 0 ? _imgf : null, Skia.ImageFilter.MakeColorFilter(cf, null));
|
46
|
+
}
|
47
|
+
const imgf = imgf2 ? Skia.ImageFilter.MakeCompose(imgf1, imgf2) : imgf1;
|
48
|
+
ctx.imageFilters.push(imgf);
|
49
|
+
}
|
50
|
+
function processDeclarations(ctx, node) {
|
51
|
+
const processChildren = () => node.children.forEach(child => processDeclarations(ctx, child));
|
52
|
+
const {
|
53
|
+
type
|
54
|
+
} = node;
|
55
|
+
const props = materialize(node.props);
|
56
|
+
switch (type) {
|
57
|
+
// Mask Filter
|
58
|
+
case NodeType.BlurMaskFilter:
|
59
|
+
{
|
60
|
+
declareBlurMaskFilter(ctx, props);
|
61
|
+
break;
|
62
|
+
}
|
63
|
+
// Color Filters
|
64
|
+
case NodeType.LerpColorFilter:
|
65
|
+
{
|
66
|
+
node.children.forEach(child => processDeclarations(ctx, child));
|
67
|
+
declareLerpColorFilter(ctx, props);
|
68
|
+
break;
|
69
|
+
}
|
70
|
+
case NodeType.Blend:
|
71
|
+
{
|
72
|
+
node.children.forEach(child => processDeclarations(ctx, child));
|
73
|
+
const {
|
74
|
+
Skia
|
75
|
+
} = ctx;
|
76
|
+
const blend = BlendMode[enumKey(props.mode)];
|
77
|
+
// Blend ImageFilters
|
78
|
+
const imageFilters = ctx.imageFilters.popAll();
|
79
|
+
if (imageFilters.length > 0) {
|
80
|
+
const composer = Skia.ImageFilter.MakeBlend.bind(Skia.ImageFilter, blend);
|
81
|
+
ctx.imageFilters.push(composeDeclarations(imageFilters, composer));
|
82
|
+
}
|
83
|
+
// Blend Shaders
|
84
|
+
const shaders = ctx.shaders.popAll();
|
85
|
+
if (shaders.length > 0) {
|
86
|
+
const composer = Skia.Shader.MakeBlend.bind(Skia.Shader, blend);
|
87
|
+
ctx.shaders.push(composeDeclarations(shaders, composer));
|
88
|
+
}
|
89
|
+
break;
|
90
|
+
}
|
91
|
+
case NodeType.BlendColorFilter:
|
92
|
+
{
|
93
|
+
const cf = makeBlendColorFilter(ctx, props);
|
94
|
+
composeColorFilters(ctx, cf, processChildren);
|
95
|
+
break;
|
96
|
+
}
|
97
|
+
case NodeType.SRGBToLinearGammaColorFilter:
|
98
|
+
{
|
99
|
+
const cf = makeSRGBToLinearGammaColorFilter(ctx);
|
100
|
+
composeColorFilters(ctx, cf, processChildren);
|
101
|
+
break;
|
102
|
+
}
|
103
|
+
case NodeType.LinearToSRGBGammaColorFilter:
|
104
|
+
{
|
105
|
+
const cf = makeLinearToSRGBGammaColorFilter(ctx);
|
106
|
+
composeColorFilters(ctx, cf, processChildren);
|
107
|
+
break;
|
108
|
+
}
|
109
|
+
case NodeType.MatrixColorFilter:
|
110
|
+
{
|
111
|
+
const cf = makeMatrixColorFilter(ctx, props);
|
112
|
+
composeColorFilters(ctx, cf, processChildren);
|
113
|
+
break;
|
114
|
+
}
|
115
|
+
case NodeType.LumaColorFilter:
|
116
|
+
{
|
117
|
+
const cf = makeLumaColorFilter(ctx);
|
118
|
+
composeColorFilters(ctx, cf, processChildren);
|
119
|
+
break;
|
120
|
+
}
|
121
|
+
// Shaders
|
122
|
+
case NodeType.Shader:
|
123
|
+
{
|
124
|
+
node.children.forEach(child => processDeclarations(ctx, child));
|
125
|
+
declareShader(ctx, props);
|
126
|
+
break;
|
127
|
+
}
|
128
|
+
case NodeType.ImageShader:
|
129
|
+
{
|
130
|
+
declareImageShader(ctx, props);
|
131
|
+
break;
|
132
|
+
}
|
133
|
+
case NodeType.ColorShader:
|
134
|
+
{
|
135
|
+
declareColorShader(ctx, props);
|
136
|
+
break;
|
137
|
+
}
|
138
|
+
case NodeType.Turbulence:
|
139
|
+
{
|
140
|
+
declareTurbulenceShader(ctx, props);
|
141
|
+
break;
|
142
|
+
}
|
143
|
+
case NodeType.FractalNoise:
|
144
|
+
{
|
145
|
+
declareFractalNoiseShader(ctx, props);
|
146
|
+
break;
|
147
|
+
}
|
148
|
+
case NodeType.LinearGradient:
|
149
|
+
{
|
150
|
+
declareLinearGradientShader(ctx, props);
|
151
|
+
break;
|
152
|
+
}
|
153
|
+
case NodeType.RadialGradient:
|
154
|
+
{
|
155
|
+
declareRadialGradientShader(ctx, props);
|
156
|
+
break;
|
157
|
+
}
|
158
|
+
case NodeType.SweepGradient:
|
159
|
+
{
|
160
|
+
declareSweepGradientShader(ctx, props);
|
161
|
+
break;
|
162
|
+
}
|
163
|
+
case NodeType.TwoPointConicalGradient:
|
164
|
+
{
|
165
|
+
declareTwoPointConicalGradientShader(ctx, props);
|
166
|
+
break;
|
167
|
+
}
|
168
|
+
// Image Filters
|
169
|
+
case NodeType.BlurImageFilter:
|
170
|
+
{
|
171
|
+
const imgf = makeBlurImageFilter(ctx, props);
|
172
|
+
composeImageFilters(ctx, imgf, processChildren);
|
173
|
+
break;
|
174
|
+
}
|
175
|
+
case NodeType.OffsetImageFilter:
|
176
|
+
{
|
177
|
+
const imgf = makeOffsetImageFilter(ctx, props);
|
178
|
+
composeImageFilters(ctx, imgf, processChildren);
|
179
|
+
break;
|
180
|
+
}
|
181
|
+
case NodeType.DisplacementMapImageFilter:
|
182
|
+
{
|
183
|
+
node.children.forEach(child => processDeclarations(ctx, child));
|
184
|
+
declareDisplacementMapImageFilter(ctx, props);
|
185
|
+
break;
|
186
|
+
}
|
187
|
+
case NodeType.DropShadowImageFilter:
|
188
|
+
{
|
189
|
+
const imgf = makeDropShadowImageFilter(ctx, props);
|
190
|
+
composeImageFilters(ctx, imgf, processChildren);
|
191
|
+
break;
|
192
|
+
}
|
193
|
+
case NodeType.MorphologyImageFilter:
|
194
|
+
{
|
195
|
+
const imgf = makeMorphologyImageFilter(ctx, props);
|
196
|
+
composeImageFilters(ctx, imgf, processChildren);
|
197
|
+
break;
|
198
|
+
}
|
199
|
+
case NodeType.BlendImageFilter:
|
200
|
+
{
|
201
|
+
node.children.forEach(child => processDeclarations(ctx, child));
|
202
|
+
declareBlendImageFilter(ctx, props);
|
203
|
+
break;
|
204
|
+
}
|
205
|
+
case NodeType.RuntimeShaderImageFilter:
|
206
|
+
{
|
207
|
+
const imgf = makeRuntimeShaderImageFilter(ctx, props);
|
208
|
+
composeImageFilters(ctx, imgf, processChildren);
|
209
|
+
break;
|
210
|
+
}
|
211
|
+
// Path Effects
|
212
|
+
case NodeType.SumPathEffect:
|
213
|
+
{
|
214
|
+
node.children.forEach(child => processDeclarations(ctx, child));
|
215
|
+
declareSumPathEffect(ctx);
|
216
|
+
break;
|
217
|
+
}
|
218
|
+
case NodeType.CornerPathEffect:
|
219
|
+
{
|
220
|
+
const pf = makeCornerPathEffect(ctx, props);
|
221
|
+
composePathEffects(ctx, pf, processChildren);
|
222
|
+
break;
|
223
|
+
}
|
224
|
+
case NodeType.Path1DPathEffect:
|
225
|
+
{
|
226
|
+
const pf = makePath1DPathEffect(ctx, props);
|
227
|
+
composePathEffects(ctx, pf, processChildren);
|
228
|
+
break;
|
229
|
+
}
|
230
|
+
case NodeType.Path2DPathEffect:
|
231
|
+
{
|
232
|
+
const pf = makePath2DPathEffect(ctx, props);
|
233
|
+
composePathEffects(ctx, pf, processChildren);
|
234
|
+
break;
|
235
|
+
}
|
236
|
+
case NodeType.Line2DPathEffect:
|
237
|
+
{
|
238
|
+
const pf = makeLine2DPathEffect(ctx, props);
|
239
|
+
composePathEffects(ctx, pf, processChildren);
|
240
|
+
break;
|
241
|
+
}
|
242
|
+
case NodeType.DashPathEffect:
|
243
|
+
{
|
244
|
+
const pf = makeDashPathEffect(ctx, props);
|
245
|
+
composePathEffects(ctx, pf, processChildren);
|
246
|
+
break;
|
247
|
+
}
|
248
|
+
case NodeType.DiscretePathEffect:
|
249
|
+
{
|
250
|
+
const pf = makeDiscretePathEffect(ctx, props);
|
251
|
+
composePathEffects(ctx, pf, processChildren);
|
252
|
+
break;
|
253
|
+
}
|
254
|
+
// Paint
|
255
|
+
case NodeType.Paint:
|
256
|
+
node.children.forEach(child => processDeclarations(ctx, child));
|
257
|
+
declarePaint(ctx, props);
|
258
|
+
break;
|
259
|
+
default:
|
260
|
+
console.log("Unknown declaration node: ", type);
|
261
|
+
}
|
262
|
+
}
|
263
|
+
const preProcessContext = (ctx, props, node) => {
|
264
|
+
const shouldRestoreMatrix = ctx.processMatrixAndClipping(props, props.layer);
|
265
|
+
ctx.declCtx.save();
|
266
|
+
node.children.forEach(child => {
|
267
|
+
if (child.isDeclaration) {
|
268
|
+
processDeclarations(ctx.declCtx, child);
|
269
|
+
}
|
270
|
+
});
|
271
|
+
const shouldRestorePaint = ctx.processPaint(props);
|
272
|
+
ctx.declCtx.restore();
|
273
|
+
return {
|
274
|
+
shouldRestoreMatrix,
|
275
|
+
shouldRestorePaint
|
276
|
+
};
|
277
|
+
};
|
278
|
+
const postProcessContext = (ctx, {
|
279
|
+
shouldRestoreMatrix,
|
280
|
+
shouldRestorePaint
|
281
|
+
}) => {
|
282
|
+
if (shouldRestoreMatrix) {
|
283
|
+
ctx.canvas.restore();
|
284
|
+
}
|
285
|
+
if (shouldRestorePaint) {
|
286
|
+
ctx.restore();
|
287
|
+
}
|
288
|
+
};
|
289
|
+
const drawBackdropFilter = (ctx, node) => {
|
290
|
+
const {
|
291
|
+
canvas,
|
292
|
+
Skia
|
293
|
+
} = ctx;
|
294
|
+
const child = node.children[0];
|
295
|
+
let imageFilter = null;
|
296
|
+
if (child.isDeclaration) {
|
297
|
+
ctx.declCtx.save();
|
298
|
+
processDeclarations(ctx.declCtx, child);
|
299
|
+
const imgf = ctx.declCtx.imageFilters.pop();
|
300
|
+
if (imgf) {
|
301
|
+
imageFilter = imgf;
|
302
|
+
} else {
|
303
|
+
const cf = ctx.declCtx.colorFilters.pop();
|
304
|
+
if (cf) {
|
305
|
+
imageFilter = Skia.ImageFilter.MakeColorFilter(cf, null);
|
306
|
+
}
|
307
|
+
}
|
308
|
+
ctx.declCtx.restore();
|
309
|
+
}
|
310
|
+
canvas.saveLayer(undefined, null, imageFilter);
|
311
|
+
canvas.restore();
|
312
|
+
};
|
313
|
+
export function draw(ctx, node) {
|
314
|
+
// Special mixed nodes
|
315
|
+
if (node.type === NodeType.BackdropFilter) {
|
316
|
+
drawBackdropFilter(ctx, node);
|
317
|
+
return;
|
318
|
+
}
|
319
|
+
if (node.type === NodeType.Layer) {
|
320
|
+
let hasLayer = false;
|
321
|
+
const [layer, ...children] = node.children;
|
322
|
+
if (layer.isDeclaration) {
|
323
|
+
const {
|
324
|
+
declCtx
|
325
|
+
} = ctx;
|
326
|
+
declCtx.save();
|
327
|
+
processDeclarations(ctx.declCtx, layer);
|
328
|
+
const paint = declCtx.paints.pop();
|
329
|
+
declCtx.restore();
|
330
|
+
if (paint) {
|
331
|
+
hasLayer = true;
|
332
|
+
ctx.canvas.saveLayer(paint);
|
333
|
+
}
|
334
|
+
}
|
335
|
+
children.map(child => {
|
336
|
+
if (!child.isDeclaration) {
|
337
|
+
draw(ctx, child);
|
338
|
+
}
|
339
|
+
});
|
340
|
+
if (hasLayer) {
|
341
|
+
ctx.canvas.restore();
|
342
|
+
}
|
343
|
+
return;
|
344
|
+
}
|
345
|
+
const {
|
346
|
+
type,
|
347
|
+
props: rawProps,
|
348
|
+
children
|
349
|
+
} = node;
|
350
|
+
// Regular nodes
|
351
|
+
const props = materialize(rawProps);
|
352
|
+
const result = preProcessContext(ctx, props, node);
|
353
|
+
const paints = ctx.getLocalPaints();
|
354
|
+
paints.forEach(paint => {
|
355
|
+
const lctx = {
|
356
|
+
paint,
|
357
|
+
Skia: ctx.Skia,
|
358
|
+
canvas: ctx.canvas
|
359
|
+
};
|
360
|
+
switch (type) {
|
361
|
+
case NodeType.Box:
|
362
|
+
drawBox(lctx, props, node.children);
|
363
|
+
break;
|
364
|
+
case NodeType.BoxShadow:
|
365
|
+
drawBoxShadow(lctx, props);
|
366
|
+
break;
|
367
|
+
case NodeType.Image:
|
368
|
+
drawImage(lctx, props);
|
369
|
+
break;
|
370
|
+
case NodeType.Points:
|
371
|
+
drawPoints(lctx, props);
|
372
|
+
break;
|
373
|
+
case NodeType.Path:
|
374
|
+
drawPath(lctx, props);
|
375
|
+
break;
|
376
|
+
case NodeType.Rect:
|
377
|
+
drawRect(lctx, props);
|
378
|
+
break;
|
379
|
+
case NodeType.RRect:
|
380
|
+
drawRRect(lctx, props);
|
381
|
+
break;
|
382
|
+
case NodeType.Oval:
|
383
|
+
drawOval(lctx, props);
|
384
|
+
break;
|
385
|
+
case NodeType.Line:
|
386
|
+
drawLine(lctx, props);
|
387
|
+
break;
|
388
|
+
case NodeType.Patch:
|
389
|
+
drawPatch(lctx, props);
|
390
|
+
break;
|
391
|
+
case NodeType.Vertices:
|
392
|
+
drawVertices(lctx, props);
|
393
|
+
break;
|
394
|
+
case NodeType.DiffRect:
|
395
|
+
drawDiffRect(lctx, props);
|
396
|
+
break;
|
397
|
+
case NodeType.Text:
|
398
|
+
drawText(lctx, props);
|
399
|
+
break;
|
400
|
+
case NodeType.TextPath:
|
401
|
+
drawTextPath(lctx, props);
|
402
|
+
break;
|
403
|
+
case NodeType.TextBlob:
|
404
|
+
drawTextBlob(lctx, props);
|
405
|
+
break;
|
406
|
+
case NodeType.Glyphs:
|
407
|
+
drawGlyphs(lctx, props);
|
408
|
+
break;
|
409
|
+
case NodeType.Picture:
|
410
|
+
drawPicture(lctx, props);
|
411
|
+
break;
|
412
|
+
case NodeType.ImageSVG:
|
413
|
+
drawImageSVG(lctx, props);
|
414
|
+
break;
|
415
|
+
case NodeType.Paragraph:
|
416
|
+
drawParagraph(lctx, props);
|
417
|
+
break;
|
418
|
+
case NodeType.Atlas:
|
419
|
+
drawAtlas(lctx, props);
|
420
|
+
break;
|
421
|
+
case NodeType.Circle:
|
422
|
+
drawCircle(lctx, props);
|
423
|
+
break;
|
424
|
+
case NodeType.Fill:
|
425
|
+
drawFill(lctx, props);
|
426
|
+
break;
|
427
|
+
case NodeType.Group:
|
428
|
+
// TODO: do nothing
|
429
|
+
break;
|
430
|
+
default:
|
431
|
+
if (!node.isDeclaration) {
|
432
|
+
console.warn(`Unsupported node type: ${type}`);
|
433
|
+
}
|
434
|
+
}
|
435
|
+
});
|
436
|
+
children.forEach(child => {
|
437
|
+
if (!child.isDeclaration) {
|
438
|
+
draw(ctx, child);
|
439
|
+
}
|
440
|
+
});
|
441
|
+
postProcessContext(ctx, result);
|
442
|
+
}
|
443
|
+
//# sourceMappingURL=context.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["composeDeclarations","NodeType","BlendMode","enumKey","drawAtlas","drawBox","drawBoxShadow","drawCircle","drawDiffRect","drawFill","drawGlyphs","drawImage","drawImageSVG","drawLine","drawOval","drawParagraph","drawPatch","drawPath","drawPicture","drawPoints","drawRect","drawRRect","drawText","drawTextBlob","drawTextPath","drawVertices","declareLerpColorFilter","makeBlendColorFilter","makeLinearToSRGBGammaColorFilter","makeLumaColorFilter","makeMatrixColorFilter","makeSRGBToLinearGammaColorFilter","declareBlendImageFilter","declareBlurMaskFilter","declareDisplacementMapImageFilter","makeBlurImageFilter","makeDropShadowImageFilter","makeMorphologyImageFilter","makeOffsetImageFilter","makeRuntimeShaderImageFilter","materialize","declareColorShader","declareFractalNoiseShader","declareImageShader","declareLinearGradientShader","declareRadialGradientShader","declareShader","declareSweepGradientShader","declareTurbulenceShader","declareTwoPointConicalGradientShader","declarePaint","declareSumPathEffect","makeCornerPathEffect","makeDashPathEffect","makeDiscretePathEffect","makeLine2DPathEffect","makePath1DPathEffect","makePath2DPathEffect","composeColorFilters","ctx","cf","processChildren","Skia","save","cf1","colorFilters","popAllAsOne","restore","push","ColorFilter","MakeCompose","composePathEffects","pe","pe1","pathEffects","PathEffect","composeImageFilters","imgf1","imgf2","imageFilters","_imgf","ImageFilter","MakeColorFilter","imgf","processDeclarations","node","children","forEach","child","type","props","BlurMaskFilter","LerpColorFilter","Blend","blend","mode","popAll","length","composer","MakeBlend","bind","shaders","Shader","BlendColorFilter","SRGBToLinearGammaColorFilter","LinearToSRGBGammaColorFilter","MatrixColorFilter","LumaColorFilter","ImageShader","ColorShader","Turbulence","FractalNoise","LinearGradient","RadialGradient","SweepGradient","TwoPointConicalGradient","BlurImageFilter","OffsetImageFilter","DisplacementMapImageFilter","DropShadowImageFilter","MorphologyImageFilter","BlendImageFilter","RuntimeShaderImageFilter","SumPathEffect","CornerPathEffect","pf","Path1DPathEffect","Path2DPathEffect","Line2DPathEffect","DashPathEffect","DiscretePathEffect","Paint","console","log","preProcessContext","shouldRestoreMatrix","processMatrixAndClipping","layer","declCtx","isDeclaration","shouldRestorePaint","processPaint","postProcessContext","canvas","drawBackdropFilter","imageFilter","pop","saveLayer","undefined","draw","BackdropFilter","Layer","hasLayer","paint","paints","map","rawProps","result","getLocalPaints","lctx","Box","BoxShadow","Image","Points","Path","Rect","RRect","Oval","Line","Patch","Vertices","DiffRect","Text","TextPath","TextBlob","Glyphs","Picture","ImageSVG","Paragraph","Atlas","Circle","Fill","Group","warn"],"sources":["context.ts"],"sourcesContent":["\"worklet\";\n/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { composeDeclarations, NodeType } from \"../../dom/types\";\nimport type {\n BlendProps,\n DeclarationContext,\n DrawingNodeProps,\n} from \"../../dom/types\";\nimport type { DrawingContext } from \"../DrawingContext\";\nimport { BlendMode } from \"../../skia/types\";\nimport type {\n SkPathEffect,\n SkColorFilter,\n SkImageFilter,\n} from \"../../skia/types\";\nimport { enumKey } from \"../../dom/nodes\";\n\nimport type { Node } from \"./Node\";\nimport {\n drawAtlas,\n drawBox,\n drawBoxShadow,\n drawCircle,\n drawDiffRect,\n drawFill,\n drawGlyphs,\n drawImage,\n drawImageSVG,\n drawLine,\n drawOval,\n drawParagraph,\n drawPatch,\n drawPath,\n drawPicture,\n drawPoints,\n drawRect,\n drawRRect,\n drawText,\n drawTextBlob,\n drawTextPath,\n drawVertices,\n} from \"./drawings\";\nimport {\n declareLerpColorFilter,\n makeBlendColorFilter,\n makeLinearToSRGBGammaColorFilter,\n makeLumaColorFilter,\n makeMatrixColorFilter,\n makeSRGBToLinearGammaColorFilter,\n} from \"./colorFilters\";\nimport {\n declareBlendImageFilter,\n declareBlurMaskFilter,\n declareDisplacementMapImageFilter,\n makeBlurImageFilter,\n makeDropShadowImageFilter,\n makeMorphologyImageFilter,\n makeOffsetImageFilter,\n makeRuntimeShaderImageFilter,\n} from \"./imageFilters\";\nimport { materialize } from \"./utils\";\nimport {\n declareColorShader,\n declareFractalNoiseShader,\n declareImageShader,\n declareLinearGradientShader,\n declareRadialGradientShader,\n declareShader,\n declareSweepGradientShader,\n declareTurbulenceShader,\n declareTwoPointConicalGradientShader,\n} from \"./shaders\";\nimport { declarePaint } from \"./paint\";\nimport {\n declareSumPathEffect,\n makeCornerPathEffect,\n makeDashPathEffect,\n makeDiscretePathEffect,\n makeLine2DPathEffect,\n makePath1DPathEffect,\n makePath2DPathEffect,\n} from \"./pathEffects\";\n\ninterface ContextProcessingResult {\n shouldRestoreMatrix: boolean;\n shouldRestorePaint: boolean;\n}\n\nfunction composeColorFilters(\n ctx: DeclarationContext,\n cf: SkColorFilter,\n processChildren: () => void\n) {\n const { Skia } = ctx;\n ctx.save();\n processChildren();\n const cf1 = ctx.colorFilters.popAllAsOne();\n ctx.restore();\n ctx.colorFilters.push(cf1 ? Skia.ColorFilter.MakeCompose(cf, cf1) : cf);\n}\n\nfunction composePathEffects(\n ctx: DeclarationContext,\n pe: SkPathEffect,\n processChildren: () => void\n) {\n const { Skia } = ctx;\n ctx.save();\n processChildren();\n const pe1 = ctx.pathEffects.popAllAsOne();\n ctx.restore();\n ctx.pathEffects.push(pe1 ? Skia.PathEffect.MakeCompose(pe, pe1) : pe);\n}\n\nfunction composeImageFilters(\n ctx: DeclarationContext,\n imgf1: SkImageFilter,\n processChildren: () => void\n) {\n const { Skia } = ctx;\n ctx.save();\n processChildren();\n let imgf2 = ctx.imageFilters.popAllAsOne();\n const cf = ctx.colorFilters.popAllAsOne();\n ctx.restore();\n if (cf) {\n imgf2 = Skia.ImageFilter.MakeCompose(\n imgf2 ?? null,\n Skia.ImageFilter.MakeColorFilter(cf, null)\n );\n }\n const imgf = imgf2 ? Skia.ImageFilter.MakeCompose(imgf1, imgf2) : imgf1;\n ctx.imageFilters.push(imgf);\n}\n\nfunction processDeclarations(ctx: DeclarationContext, node: Node<any>) {\n const processChildren = () =>\n node.children.forEach((child) => processDeclarations(ctx, child));\n const { type } = node;\n const props = materialize(node.props);\n switch (type) {\n // Mask Filter\n case NodeType.BlurMaskFilter: {\n declareBlurMaskFilter(ctx, props);\n break;\n }\n // Color Filters\n case NodeType.LerpColorFilter: {\n node.children.forEach((child) => processDeclarations(ctx, child));\n declareLerpColorFilter(ctx, props);\n break;\n }\n case NodeType.Blend: {\n node.children.forEach((child) => processDeclarations(ctx, child));\n const { Skia } = ctx;\n const blend = BlendMode[enumKey(props.mode as BlendProps[\"mode\"])];\n // Blend ImageFilters\n const imageFilters = ctx.imageFilters.popAll();\n if (imageFilters.length > 0) {\n const composer = Skia.ImageFilter.MakeBlend.bind(\n Skia.ImageFilter,\n blend\n );\n ctx.imageFilters.push(composeDeclarations(imageFilters, composer));\n }\n // Blend Shaders\n const shaders = ctx.shaders.popAll();\n if (shaders.length > 0) {\n const composer = Skia.Shader.MakeBlend.bind(Skia.Shader, blend);\n ctx.shaders.push(composeDeclarations(shaders, composer));\n }\n break;\n }\n case NodeType.BlendColorFilter: {\n const cf = makeBlendColorFilter(ctx, props);\n composeColorFilters(ctx, cf, processChildren);\n break;\n }\n case NodeType.SRGBToLinearGammaColorFilter: {\n const cf = makeSRGBToLinearGammaColorFilter(ctx);\n composeColorFilters(ctx, cf, processChildren);\n break;\n }\n case NodeType.LinearToSRGBGammaColorFilter: {\n const cf = makeLinearToSRGBGammaColorFilter(ctx);\n composeColorFilters(ctx, cf, processChildren);\n break;\n }\n case NodeType.MatrixColorFilter: {\n const cf = makeMatrixColorFilter(ctx, props);\n composeColorFilters(ctx, cf, processChildren);\n break;\n }\n case NodeType.LumaColorFilter: {\n const cf = makeLumaColorFilter(ctx);\n composeColorFilters(ctx, cf, processChildren);\n break;\n }\n // Shaders\n case NodeType.Shader: {\n node.children.forEach((child) => processDeclarations(ctx, child));\n declareShader(ctx, props);\n break;\n }\n case NodeType.ImageShader: {\n declareImageShader(ctx, props);\n break;\n }\n case NodeType.ColorShader: {\n declareColorShader(ctx, props);\n break;\n }\n case NodeType.Turbulence: {\n declareTurbulenceShader(ctx, props);\n break;\n }\n case NodeType.FractalNoise: {\n declareFractalNoiseShader(ctx, props);\n break;\n }\n case NodeType.LinearGradient: {\n declareLinearGradientShader(ctx, props);\n break;\n }\n case NodeType.RadialGradient: {\n declareRadialGradientShader(ctx, props);\n break;\n }\n case NodeType.SweepGradient: {\n declareSweepGradientShader(ctx, props);\n break;\n }\n case NodeType.TwoPointConicalGradient: {\n declareTwoPointConicalGradientShader(ctx, props);\n break;\n }\n // Image Filters\n case NodeType.BlurImageFilter: {\n const imgf = makeBlurImageFilter(ctx, props);\n composeImageFilters(ctx, imgf, processChildren);\n break;\n }\n case NodeType.OffsetImageFilter: {\n const imgf = makeOffsetImageFilter(ctx, props);\n composeImageFilters(ctx, imgf, processChildren);\n break;\n }\n case NodeType.DisplacementMapImageFilter: {\n node.children.forEach((child) => processDeclarations(ctx, child));\n declareDisplacementMapImageFilter(ctx, props);\n break;\n }\n case NodeType.DropShadowImageFilter: {\n const imgf = makeDropShadowImageFilter(ctx, props);\n composeImageFilters(ctx, imgf, processChildren);\n break;\n }\n case NodeType.MorphologyImageFilter: {\n const imgf = makeMorphologyImageFilter(ctx, props);\n composeImageFilters(ctx, imgf, processChildren);\n break;\n }\n case NodeType.BlendImageFilter: {\n node.children.forEach((child) => processDeclarations(ctx, child));\n declareBlendImageFilter(ctx, props);\n break;\n }\n case NodeType.RuntimeShaderImageFilter: {\n const imgf = makeRuntimeShaderImageFilter(ctx, props);\n composeImageFilters(ctx, imgf, processChildren);\n break;\n }\n // Path Effects\n case NodeType.SumPathEffect: {\n node.children.forEach((child) => processDeclarations(ctx, child));\n declareSumPathEffect(ctx);\n break;\n }\n case NodeType.CornerPathEffect: {\n const pf = makeCornerPathEffect(ctx, props);\n composePathEffects(ctx, pf, processChildren);\n break;\n }\n case NodeType.Path1DPathEffect: {\n const pf = makePath1DPathEffect(ctx, props);\n composePathEffects(ctx, pf, processChildren);\n break;\n }\n case NodeType.Path2DPathEffect: {\n const pf = makePath2DPathEffect(ctx, props);\n composePathEffects(ctx, pf, processChildren);\n break;\n }\n case NodeType.Line2DPathEffect: {\n const pf = makeLine2DPathEffect(ctx, props);\n composePathEffects(ctx, pf, processChildren);\n break;\n }\n case NodeType.DashPathEffect: {\n const pf = makeDashPathEffect(ctx, props);\n composePathEffects(ctx, pf, processChildren);\n break;\n }\n case NodeType.DiscretePathEffect: {\n const pf = makeDiscretePathEffect(ctx, props);\n composePathEffects(ctx, pf, processChildren);\n break;\n }\n // Paint\n case NodeType.Paint:\n node.children.forEach((child) => processDeclarations(ctx, child));\n declarePaint(ctx, props);\n break;\n default:\n console.log(\"Unknown declaration node: \", type);\n }\n}\n\nconst preProcessContext = (\n ctx: DrawingContext,\n props: DrawingNodeProps,\n node: Node<any>\n) => {\n const shouldRestoreMatrix = ctx.processMatrixAndClipping(props, props.layer);\n ctx.declCtx.save();\n node.children.forEach((child) => {\n if (child.isDeclaration) {\n processDeclarations(ctx.declCtx, child);\n }\n });\n const shouldRestorePaint = ctx.processPaint(props);\n ctx.declCtx.restore();\n return { shouldRestoreMatrix, shouldRestorePaint };\n};\n\nconst postProcessContext = (\n ctx: DrawingContext,\n { shouldRestoreMatrix, shouldRestorePaint }: ContextProcessingResult\n) => {\n if (shouldRestoreMatrix) {\n ctx.canvas.restore();\n }\n if (shouldRestorePaint) {\n ctx.restore();\n }\n};\n\nconst drawBackdropFilter = (ctx: DrawingContext, node: Node) => {\n const { canvas, Skia } = ctx;\n const child = node.children[0];\n let imageFilter: SkImageFilter | null = null;\n if (child.isDeclaration) {\n ctx.declCtx.save();\n processDeclarations(ctx.declCtx, child);\n const imgf = ctx.declCtx.imageFilters.pop();\n if (imgf) {\n imageFilter = imgf;\n } else {\n const cf = ctx.declCtx.colorFilters.pop();\n if (cf) {\n imageFilter = Skia.ImageFilter.MakeColorFilter(cf, null);\n }\n }\n ctx.declCtx.restore();\n }\n canvas.saveLayer(undefined, null, imageFilter);\n canvas.restore();\n};\n\nexport function draw(ctx: DrawingContext, node: Node<any>) {\n // Special mixed nodes\n if (node.type === NodeType.BackdropFilter) {\n drawBackdropFilter(ctx, node);\n return;\n }\n if (node.type === NodeType.Layer) {\n let hasLayer = false;\n const [layer, ...children] = node.children;\n if (layer.isDeclaration) {\n const { declCtx } = ctx;\n declCtx.save();\n processDeclarations(ctx.declCtx, layer);\n const paint = declCtx.paints.pop();\n declCtx.restore();\n if (paint) {\n hasLayer = true;\n ctx.canvas.saveLayer(paint);\n }\n }\n children.map((child) => {\n if (!child.isDeclaration) {\n draw(ctx, child);\n }\n });\n if (hasLayer) {\n ctx.canvas.restore();\n }\n return;\n }\n const { type, props: rawProps, children } = node;\n // Regular nodes\n const props = materialize(rawProps);\n const result = preProcessContext(ctx, props, node);\n const paints = ctx.getLocalPaints();\n paints.forEach((paint) => {\n const lctx = { paint, Skia: ctx.Skia, canvas: ctx.canvas };\n switch (type) {\n case NodeType.Box:\n drawBox(lctx, props, node.children);\n break;\n case NodeType.BoxShadow:\n drawBoxShadow(lctx, props);\n break;\n case NodeType.Image:\n drawImage(lctx, props);\n break;\n case NodeType.Points:\n drawPoints(lctx, props);\n break;\n case NodeType.Path:\n drawPath(lctx, props);\n break;\n case NodeType.Rect:\n drawRect(lctx, props);\n break;\n case NodeType.RRect:\n drawRRect(lctx, props);\n break;\n case NodeType.Oval:\n drawOval(lctx, props);\n break;\n case NodeType.Line:\n drawLine(lctx, props);\n break;\n case NodeType.Patch:\n drawPatch(lctx, props);\n break;\n case NodeType.Vertices:\n drawVertices(lctx, props);\n break;\n case NodeType.DiffRect:\n drawDiffRect(lctx, props);\n break;\n case NodeType.Text:\n drawText(lctx, props);\n break;\n case NodeType.TextPath:\n drawTextPath(lctx, props);\n break;\n case NodeType.TextBlob:\n drawTextBlob(lctx, props);\n break;\n case NodeType.Glyphs:\n drawGlyphs(lctx, props);\n break;\n case NodeType.Picture:\n drawPicture(lctx, props);\n break;\n case NodeType.ImageSVG:\n drawImageSVG(lctx, props);\n break;\n case NodeType.Paragraph:\n drawParagraph(lctx, props);\n break;\n case NodeType.Atlas:\n drawAtlas(lctx, props);\n break;\n case NodeType.Circle:\n drawCircle(lctx, props);\n break;\n case NodeType.Fill:\n drawFill(lctx, props);\n break;\n case NodeType.Group:\n // TODO: do nothing\n break;\n default:\n if (!node.isDeclaration) {\n console.warn(`Unsupported node type: ${type}`);\n }\n }\n });\n children.forEach((child) => {\n if (!child.isDeclaration) {\n draw(ctx, child);\n }\n });\n postProcessContext(ctx, result);\n}\n"],"mappings":"AAAA,SAAS;;AACT;AACA,SAASA,mBAAmB,EAAEC,QAAQ,QAAQ,iBAAiB;AAO/D,SAASC,SAAS,QAAQ,kBAAkB;AAM5C,SAASC,OAAO,QAAQ,iBAAiB;AAGzC,SACEC,SAAS,EACTC,OAAO,EACPC,aAAa,EACbC,UAAU,EACVC,YAAY,EACZC,QAAQ,EACRC,UAAU,EACVC,SAAS,EACTC,YAAY,EACZC,QAAQ,EACRC,QAAQ,EACRC,aAAa,EACbC,SAAS,EACTC,QAAQ,EACRC,WAAW,EACXC,UAAU,EACVC,QAAQ,EACRC,SAAS,EACTC,QAAQ,EACRC,YAAY,EACZC,YAAY,EACZC,YAAY,QACP,YAAY;AACnB,SACEC,sBAAsB,EACtBC,oBAAoB,EACpBC,gCAAgC,EAChCC,mBAAmB,EACnBC,qBAAqB,EACrBC,gCAAgC,QAC3B,gBAAgB;AACvB,SACEC,uBAAuB,EACvBC,qBAAqB,EACrBC,iCAAiC,EACjCC,mBAAmB,EACnBC,yBAAyB,EACzBC,yBAAyB,EACzBC,qBAAqB,EACrBC,4BAA4B,QACvB,gBAAgB;AACvB,SAASC,WAAW,QAAQ,SAAS;AACrC,SACEC,kBAAkB,EAClBC,yBAAyB,EACzBC,kBAAkB,EAClBC,2BAA2B,EAC3BC,2BAA2B,EAC3BC,aAAa,EACbC,0BAA0B,EAC1BC,uBAAuB,EACvBC,oCAAoC,QAC/B,WAAW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mL,MAAM;QAClB7K,UAAU,CAACwJ,IAAI,EAAErE,KAAK,CAAC;QACvB;MACF,KAAKzF,QAAQ,CAACoL,IAAI;QAChB5K,QAAQ,CAACsJ,IAAI,EAAErE,KAAK,CAAC;QACrB;MACF,KAAKzF,QAAQ,CAACqL,KAAK;QACjB;QACA;MACF;QACE,IAAI,CAACjG,IAAI,CAACsD,aAAa,EAAE;UACvBP,OAAO,CAACmD,IAAI,CAAC,0BAA0B9F,IAAI,EAAE,CAAC;QAChD;IACJ;EACF,CAAC,CAAC;EACFH,QAAQ,CAACC,OAAO,CAAEC,KAAK,IAAK;IAC1B,IAAI,CAACA,KAAK,CAACmD,aAAa,EAAE;MACxBU,IAAI,CAAC1F,GAAG,EAAE6B,KAAK,CAAC;IAClB;EACF,CAAC,CAAC;EACFsD,kBAAkB,CAACnF,GAAG,EAAEkG,MAAM,CAAC;AACjC","ignoreList":[]}
|
@@ -0,0 +1,31 @@
|
|
1
|
+
import type { AtlasProps, BoxProps, BoxShadowProps, 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 { SkCanvas, SkPaint, Skia } from "../../skia/types";
|
3
|
+
import type { Node } from "./Node";
|
4
|
+
interface LocalDrawingContext {
|
5
|
+
Skia: Skia;
|
6
|
+
canvas: SkCanvas;
|
7
|
+
paint: SkPaint;
|
8
|
+
}
|
9
|
+
export declare const drawLine: (ctx: LocalDrawingContext, props: LineProps) => void;
|
10
|
+
export declare const drawOval: (ctx: LocalDrawingContext, props: OvalProps) => void;
|
11
|
+
export declare const drawBox: (ctx: LocalDrawingContext, props: BoxProps, children: Node<any>[]) => void;
|
12
|
+
export declare const drawBoxShadow: (_ctx: LocalDrawingContext, _props: BoxShadowProps) => void;
|
13
|
+
export declare const drawImage: (ctx: LocalDrawingContext, props: ImageProps) => void;
|
14
|
+
export declare const drawPoints: (ctx: LocalDrawingContext, props: PointsProps) => void;
|
15
|
+
export declare const drawVertices: (ctx: LocalDrawingContext, props: VerticesProps) => void;
|
16
|
+
export declare const drawDiffRect: (ctx: LocalDrawingContext, props: DiffRectProps) => void;
|
17
|
+
export declare const drawTextPath: (ctx: LocalDrawingContext, props: TextPathProps) => void;
|
18
|
+
export declare const drawText: (ctx: LocalDrawingContext, props: TextProps) => void;
|
19
|
+
export declare const drawPatch: (ctx: LocalDrawingContext, props: PatchProps) => void;
|
20
|
+
export declare const drawPath: (ctx: LocalDrawingContext, props: PathProps) => void;
|
21
|
+
export declare const drawRect: (ctx: LocalDrawingContext, props: RectProps) => void;
|
22
|
+
export declare const drawRRect: (ctx: LocalDrawingContext, props: RoundedRectProps) => void;
|
23
|
+
export declare const drawTextBlob: (ctx: LocalDrawingContext, props: TextBlobProps) => void;
|
24
|
+
export declare const drawGlyphs: (ctx: LocalDrawingContext, props: GlyphsProps) => void;
|
25
|
+
export declare const drawImageSVG: (ctx: LocalDrawingContext, props: ImageSVGProps) => void;
|
26
|
+
export declare const drawParagraph: (ctx: LocalDrawingContext, props: ParagraphProps) => void;
|
27
|
+
export declare const drawPicture: (ctx: LocalDrawingContext, props: PictureProps) => void;
|
28
|
+
export declare const drawAtlas: (ctx: LocalDrawingContext, props: AtlasProps) => void;
|
29
|
+
export declare const drawCircle: (ctx: LocalDrawingContext, props: CircleProps) => void;
|
30
|
+
export declare const drawFill: (ctx: LocalDrawingContext, _props: DrawingNodeProps) => void;
|
31
|
+
export {};
|