@shopify/react-native-skia 1.7.6 → 1.8.0
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.d.ts +3 -7
- package/lib/commonjs/dom/nodes/JsiSkDOM.js +58 -70
- 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 +14 -6
- package/lib/commonjs/dom/nodes/datatypes/Circle.js.map +1 -1
- package/lib/commonjs/dom/nodes/datatypes/Enum.js +5 -1
- package/lib/commonjs/dom/nodes/datatypes/Enum.js.map +1 -1
- package/lib/commonjs/dom/nodes/datatypes/Gradient.js +19 -11
- package/lib/commonjs/dom/nodes/datatypes/Gradient.js.map +1 -1
- package/lib/commonjs/dom/nodes/datatypes/Path.js +7 -1
- package/lib/commonjs/dom/nodes/datatypes/Path.js.map +1 -1
- package/lib/commonjs/dom/nodes/datatypes/Radius.js +2 -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 +27 -3
- 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 +35 -1
- package/lib/commonjs/dom/nodes/datatypes/Transform.js.map +1 -1
- package/lib/commonjs/dom/types/Node.d.ts +2 -5
- package/lib/commonjs/dom/types/Node.js.map +1 -1
- package/lib/commonjs/dom/types/index.d.ts +0 -2
- package/lib/commonjs/dom/types/index.js +0 -22
- package/lib/commonjs/dom/types/index.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/headless/index.js +3 -5
- package/lib/commonjs/headless/index.js.map +1 -1
- package/lib/commonjs/index.d.ts +1 -0
- package/lib/commonjs/index.js +12 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/renderer/Canvas.js +9 -26
- package/lib/commonjs/renderer/Canvas.js.map +1 -1
- package/lib/commonjs/renderer/Canvas.web.d.ts +10 -0
- package/lib/commonjs/renderer/Canvas.web.js +110 -0
- package/lib/commonjs/renderer/Canvas.web.js.map +1 -0
- package/lib/commonjs/renderer/Canvas2.d.ts +10 -0
- package/lib/commonjs/renderer/Canvas2.js +104 -0
- package/lib/commonjs/renderer/Canvas2.js.map +1 -0
- package/lib/commonjs/renderer/Canvas2.web.d.ts +3 -0
- package/lib/commonjs/renderer/Canvas2.web.js +9 -0
- package/lib/commonjs/renderer/Canvas2.web.js.map +1 -0
- package/lib/commonjs/renderer/Container.d.ts +3 -5
- package/lib/commonjs/renderer/Container.js +2 -7
- package/lib/commonjs/renderer/Container.js.map +1 -1
- package/lib/commonjs/renderer/HostComponents.d.ts +3 -6
- package/lib/commonjs/renderer/HostComponents.js +1 -4
- package/lib/commonjs/renderer/HostComponents.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/Offscreen.js +3 -5
- package/lib/commonjs/renderer/Offscreen.js.map +1 -1
- package/lib/commonjs/renderer/Reconciler.d.ts +2 -3
- package/lib/commonjs/renderer/Reconciler.js +2 -2
- package/lib/commonjs/renderer/Reconciler.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 +13 -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/DeclarationContext.d.ts +56 -0
- package/lib/commonjs/sksg/DeclarationContext.js +77 -0
- package/lib/commonjs/sksg/DeclarationContext.js.map +1 -0
- package/lib/commonjs/sksg/DrawingContext.d.ts +13 -0
- package/lib/commonjs/sksg/DrawingContext.js +172 -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 +19 -0
- package/lib/commonjs/sksg/Reconciler.js +61 -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/{renderer/DrawingContext.js → sksg/nodes/Node.js} +1 -1
- package/lib/commonjs/sksg/nodes/Node.js.map +1 -0
- package/lib/commonjs/sksg/nodes/colorFilters.d.ts +10 -0
- package/lib/commonjs/sksg/nodes/colorFilters.js +79 -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 +394 -0
- package/lib/commonjs/sksg/nodes/context.js.map +1 -0
- package/lib/commonjs/sksg/nodes/drawings.d.ts +30 -0
- package/lib/commonjs/sksg/nodes/drawings.js +398 -0
- package/lib/commonjs/sksg/nodes/drawings.js.map +1 -0
- package/lib/commonjs/sksg/nodes/imageFilters.d.ts +17 -0
- package/lib/commonjs/sksg/nodes/imageFilters.js +197 -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 +3 -0
- package/lib/commonjs/sksg/nodes/paint.js +81 -0
- package/lib/commonjs/sksg/nodes/paint.js.map +1 -0
- package/lib/commonjs/sksg/nodes/pathEffects.d.ts +11 -0
- package/lib/commonjs/sksg/nodes/pathEffects.js +111 -0
- package/lib/commonjs/sksg/nodes/pathEffects.js.map +1 -0
- package/lib/commonjs/sksg/nodes/shaders.d.ts +11 -0
- package/lib/commonjs/sksg/nodes/shaders.js +173 -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 +28 -0
- package/lib/commonjs/sksg/nodes/utils.js.map +1 -0
- package/lib/commonjs/views/SkiaDomView.web.d.ts +0 -7
- package/lib/commonjs/views/SkiaDomView.web.js +0 -30
- package/lib/commonjs/views/SkiaDomView.web.js.map +1 -1
- package/lib/commonjs/views/SkiaPictureView.js +0 -2
- package/lib/commonjs/views/SkiaPictureView.js.map +1 -1
- package/lib/commonjs/views/SkiaPictureView.web.d.ts +3 -1
- package/lib/commonjs/views/SkiaPictureView.web.js +10 -0
- package/lib/commonjs/views/SkiaPictureView.web.js.map +1 -1
- package/lib/commonjs/views/types.d.ts +4 -9
- package/lib/commonjs/views/types.js.map +1 -1
- package/lib/module/dom/nodes/JsiSkDOM.d.ts +3 -7
- package/lib/module/dom/nodes/JsiSkDOM.js +58 -70
- 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 +14 -6
- package/lib/module/dom/nodes/datatypes/Circle.js.map +1 -1
- package/lib/module/dom/nodes/datatypes/Enum.js +5 -1
- package/lib/module/dom/nodes/datatypes/Enum.js.map +1 -1
- package/lib/module/dom/nodes/datatypes/Gradient.js +19 -11
- package/lib/module/dom/nodes/datatypes/Gradient.js.map +1 -1
- package/lib/module/dom/nodes/datatypes/Path.js +7 -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 +24 -2
- 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 +33 -0
- package/lib/module/dom/nodes/datatypes/Transform.js.map +1 -1
- package/lib/module/dom/types/Node.d.ts +2 -5
- package/lib/module/dom/types/Node.js.map +1 -1
- package/lib/module/dom/types/index.d.ts +0 -2
- package/lib/module/dom/types/index.js +0 -2
- package/lib/module/dom/types/index.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/headless/index.js +3 -5
- package/lib/module/headless/index.js.map +1 -1
- package/lib/module/index.d.ts +1 -0
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/renderer/Canvas.js +9 -26
- package/lib/module/renderer/Canvas.js.map +1 -1
- package/lib/module/renderer/Canvas.web.d.ts +10 -0
- package/lib/module/renderer/Canvas.web.js +105 -0
- package/lib/module/renderer/Canvas.web.js.map +1 -0
- package/lib/module/renderer/Canvas2.d.ts +10 -0
- package/lib/module/renderer/Canvas2.js +97 -0
- package/lib/module/renderer/Canvas2.js.map +1 -0
- package/lib/module/renderer/Canvas2.web.d.ts +3 -0
- package/lib/module/renderer/Canvas2.web.js +3 -0
- package/lib/module/renderer/Canvas2.web.js.map +1 -0
- package/lib/module/renderer/Container.d.ts +3 -5
- package/lib/module/renderer/Container.js +2 -7
- package/lib/module/renderer/Container.js.map +1 -1
- package/lib/module/renderer/HostComponents.d.ts +3 -6
- package/lib/module/renderer/HostComponents.js +0 -3
- package/lib/module/renderer/HostComponents.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/Offscreen.js +3 -5
- package/lib/module/renderer/Offscreen.js.map +1 -1
- package/lib/module/renderer/Reconciler.d.ts +2 -3
- package/lib/module/renderer/Reconciler.js +2 -2
- package/lib/module/renderer/Reconciler.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 +13 -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/DeclarationContext.d.ts +56 -0
- package/lib/module/sksg/DeclarationContext.js +69 -0
- package/lib/module/sksg/DeclarationContext.js.map +1 -0
- package/lib/module/sksg/DrawingContext.d.ts +13 -0
- package/lib/module/sksg/DrawingContext.js +165 -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 +19 -0
- package/lib/module/sksg/Reconciler.js +53 -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 +10 -0
- package/lib/module/sksg/nodes/colorFilters.js +66 -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 +387 -0
- package/lib/module/sksg/nodes/context.js.map +1 -0
- package/lib/module/sksg/nodes/drawings.d.ts +30 -0
- package/lib/module/sksg/nodes/drawings.js +371 -0
- package/lib/module/sksg/nodes/drawings.js.map +1 -0
- package/lib/module/sksg/nodes/imageFilters.d.ts +17 -0
- package/lib/module/sksg/nodes/imageFilters.js +181 -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 +3 -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 +11 -0
- package/lib/module/sksg/nodes/pathEffects.js +97 -0
- package/lib/module/sksg/nodes/pathEffects.js.map +1 -0
- package/lib/module/sksg/nodes/shaders.d.ts +11 -0
- package/lib/module/sksg/nodes/shaders.js +158 -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 +20 -0
- package/lib/module/sksg/nodes/utils.js.map +1 -0
- package/lib/module/views/SkiaDomView.web.d.ts +0 -7
- package/lib/module/views/SkiaDomView.web.js +1 -24
- package/lib/module/views/SkiaDomView.web.js.map +1 -1
- package/lib/module/views/SkiaPictureView.js +0 -2
- package/lib/module/views/SkiaPictureView.js.map +1 -1
- package/lib/module/views/SkiaPictureView.web.d.ts +3 -1
- package/lib/module/views/SkiaPictureView.web.js +10 -0
- package/lib/module/views/SkiaPictureView.web.js.map +1 -1
- package/lib/module/views/types.d.ts +4 -9
- package/lib/module/views/types.js.map +1 -1
- package/lib/typescript/lib/commonjs/dom/nodes/JsiSkDOM.d.ts +57 -67
- 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/Canvas.web.d.ts +3 -0
- package/lib/typescript/lib/commonjs/renderer/Canvas2.d.ts +3 -0
- package/lib/typescript/lib/commonjs/renderer/{DrawingContext.d.ts → Canvas2.web.d.ts} +1 -0
- package/lib/typescript/lib/commonjs/renderer/Container.d.ts +1 -2
- package/lib/typescript/lib/commonjs/renderer/HostComponents.d.ts +0 -1
- package/lib/typescript/lib/commonjs/renderer/HostConfig.d.ts +3 -1
- package/lib/typescript/lib/commonjs/renderer/Reconciler.d.ts +1 -1
- package/lib/typescript/lib/commonjs/sksg/Container.d.ts +16 -0
- package/lib/typescript/lib/commonjs/sksg/DeclarationContext.d.ts +53 -0
- package/lib/typescript/lib/commonjs/sksg/DrawingContext.d.ts +22 -0
- package/lib/typescript/lib/commonjs/sksg/HostConfig.d.ts +50 -0
- package/lib/typescript/lib/commonjs/sksg/Reconciler.d.ts +18 -0
- package/lib/typescript/lib/commonjs/sksg/nodes/colorFilters.d.ts +8 -0
- package/lib/typescript/lib/commonjs/sksg/nodes/context.d.ts +2 -0
- package/lib/typescript/lib/commonjs/sksg/nodes/drawings.d.ts +22 -0
- package/lib/typescript/lib/commonjs/sksg/nodes/imageFilters.d.ts +12 -0
- package/lib/typescript/lib/commonjs/sksg/nodes/paint.d.ts +2 -0
- package/lib/typescript/lib/commonjs/sksg/nodes/pathEffects.d.ts +9 -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/commonjs/views/SkiaDomView.web.d.ts +0 -5
- package/lib/typescript/lib/commonjs/views/SkiaPictureView.web.d.ts +2 -0
- package/lib/typescript/lib/module/dom/nodes/JsiSkDOM.d.ts +57 -117
- 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/dom/types/index.d.ts +0 -2
- package/lib/typescript/lib/module/external/reanimated/renderHelpers.d.ts +2 -0
- package/lib/typescript/lib/module/index.d.ts +1 -0
- package/lib/typescript/lib/module/mock/index.d.ts +4 -4
- package/lib/typescript/lib/module/renderer/Canvas.web.d.ts +1 -0
- package/lib/typescript/lib/module/renderer/Canvas2.d.ts +1 -0
- package/lib/typescript/lib/module/renderer/Canvas2.web.d.ts +1 -0
- package/lib/typescript/lib/module/renderer/Container.d.ts +3 -4
- package/lib/typescript/lib/module/renderer/HostComponents.d.ts +0 -1
- package/lib/typescript/lib/module/renderer/HostConfig.d.ts +3 -1
- package/lib/typescript/lib/module/renderer/Reconciler.d.ts +2 -2
- package/lib/typescript/lib/module/sksg/Container.d.ts +15 -0
- package/lib/typescript/lib/module/sksg/DeclarationContext.d.ts +52 -0
- package/lib/typescript/lib/module/sksg/DrawingContext.d.ts +21 -0
- package/lib/typescript/lib/module/sksg/HostConfig.d.ts +49 -0
- package/lib/typescript/lib/module/sksg/Reconciler.d.ts +17 -0
- package/lib/typescript/lib/module/sksg/nodes/colorFilters.d.ts +7 -0
- package/lib/typescript/lib/module/sksg/nodes/context.d.ts +1 -0
- package/lib/typescript/lib/module/sksg/nodes/drawings.d.ts +21 -0
- package/lib/typescript/lib/module/sksg/nodes/imageFilters.d.ts +11 -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 +8 -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/lib/module/views/SkiaDomView.web.d.ts +0 -4
- package/lib/typescript/lib/module/views/SkiaPictureView.web.d.ts +2 -0
- package/lib/typescript/src/dom/nodes/JsiSkDOM.d.ts +3 -7
- 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/Node.d.ts +2 -5
- package/lib/typescript/src/dom/types/index.d.ts +0 -2
- package/lib/typescript/src/external/reanimated/renderHelpers.d.ts +2 -0
- package/lib/typescript/src/index.d.ts +1 -0
- package/lib/typescript/src/renderer/Canvas.web.d.ts +10 -0
- package/lib/typescript/src/renderer/Canvas2.d.ts +10 -0
- package/lib/typescript/src/renderer/Canvas2.web.d.ts +3 -0
- package/lib/typescript/src/renderer/Container.d.ts +3 -5
- package/lib/typescript/src/renderer/HostComponents.d.ts +3 -6
- package/lib/typescript/src/renderer/Reconciler.d.ts +2 -3
- 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/DeclarationContext.d.ts +56 -0
- package/lib/typescript/src/sksg/DrawingContext.d.ts +13 -0
- package/lib/typescript/src/sksg/HostConfig.d.ts +19 -0
- package/lib/typescript/src/sksg/Reconciler.d.ts +19 -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 +10 -0
- package/lib/typescript/src/sksg/nodes/context.d.ts +3 -0
- package/lib/typescript/src/sksg/nodes/drawings.d.ts +30 -0
- package/lib/typescript/src/sksg/nodes/imageFilters.d.ts +17 -0
- package/lib/typescript/src/sksg/nodes/index.d.ts +3 -0
- package/lib/typescript/src/sksg/nodes/paint.d.ts +3 -0
- package/lib/typescript/src/sksg/nodes/pathEffects.d.ts +11 -0
- package/lib/typescript/src/sksg/nodes/shaders.d.ts +11 -0
- package/lib/typescript/src/sksg/nodes/utils.d.ts +3 -0
- package/lib/typescript/src/views/SkiaDomView.web.d.ts +0 -7
- package/lib/typescript/src/views/SkiaPictureView.web.d.ts +3 -1
- package/lib/typescript/src/views/types.d.ts +4 -9
- 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 +58 -238
- package/src/dom/nodes/datatypes/Circle.ts +7 -5
- package/src/dom/nodes/datatypes/Enum.ts +4 -2
- package/src/dom/nodes/datatypes/Gradient.ts +14 -14
- package/src/dom/nodes/datatypes/Path.ts +5 -2
- package/src/dom/nodes/datatypes/Radius.ts +1 -0
- package/src/dom/nodes/datatypes/Rect.ts +44 -5
- package/src/dom/nodes/datatypes/Transform.ts +31 -1
- package/src/dom/types/Node.ts +2 -5
- package/src/dom/types/index.ts +0 -2
- package/src/external/reanimated/renderHelpers.ts +8 -4
- package/src/headless/index.ts +3 -5
- package/src/index.ts +1 -0
- package/src/renderer/Canvas.tsx +12 -31
- package/src/renderer/Canvas.web.tsx +134 -0
- package/src/renderer/Canvas2.tsx +128 -0
- package/src/renderer/Canvas2.web.tsx +6 -0
- package/src/renderer/Container.tsx +4 -16
- package/src/renderer/HostComponents.ts +2 -10
- package/src/renderer/HostConfig.ts +10 -4
- package/src/renderer/Offscreen.tsx +3 -6
- package/src/renderer/Reconciler.tsx +1 -5
- 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 +8 -4
- package/src/sksg/Container.ts +102 -0
- package/src/sksg/DeclarationContext.ts +85 -0
- package/src/sksg/DrawingContext.ts +226 -0
- package/src/sksg/HostConfig.ts +287 -0
- package/src/sksg/Reconciler.ts +66 -0
- package/src/sksg/__tests__/Declarations.spec.tsx +235 -0
- package/src/{dom/types/DeclarationContext.ts → sksg/__tests__/MockDeclaration.ts} +54 -21
- package/src/sksg/__tests__/Simple.spec.tsx +148 -0
- package/src/sksg/nodes/Node.ts +8 -0
- package/src/sksg/nodes/colorFilters.ts +79 -0
- package/src/sksg/nodes/context.ts +412 -0
- package/src/sksg/nodes/drawings.ts +405 -0
- package/src/sksg/nodes/imageFilters.ts +235 -0
- package/src/sksg/nodes/index.ts +3 -0
- package/src/sksg/nodes/paint.ts +75 -0
- package/src/sksg/nodes/pathEffects.ts +118 -0
- package/src/sksg/nodes/shaders.ts +210 -0
- package/src/sksg/nodes/utils.ts +23 -0
- package/src/views/SkiaDomView.web.tsx +0 -23
- package/src/views/SkiaPictureView.tsx +0 -2
- package/src/views/SkiaPictureView.web.tsx +10 -1
- package/src/views/types.ts +4 -10
- package/lib/commonjs/dom/__tests__/Shaders.spec.d.ts +0 -1
- package/lib/commonjs/dom/nodes/DrawingNode.d.ts +0 -14
- package/lib/commonjs/dom/nodes/DrawingNode.js +0 -69
- package/lib/commonjs/dom/nodes/DrawingNode.js.map +0 -1
- package/lib/commonjs/dom/nodes/GroupNode.d.ts +0 -7
- package/lib/commonjs/dom/nodes/GroupNode.js +0 -22
- package/lib/commonjs/dom/nodes/GroupNode.js.map +0 -1
- package/lib/commonjs/dom/nodes/LayerNode.d.ts +0 -8
- package/lib/commonjs/dom/nodes/LayerNode.js +0 -39
- package/lib/commonjs/dom/nodes/LayerNode.js.map +0 -1
- package/lib/commonjs/dom/nodes/Node.d.ts +0 -34
- package/lib/commonjs/dom/nodes/Node.js +0 -102
- package/lib/commonjs/dom/nodes/Node.js.map +0 -1
- package/lib/commonjs/dom/nodes/PaintNode.d.ts +0 -8
- package/lib/commonjs/dom/nodes/PaintNode.js +0 -90
- package/lib/commonjs/dom/nodes/PaintNode.js.map +0 -1
- package/lib/commonjs/dom/nodes/RenderNode.d.ts +0 -26
- package/lib/commonjs/dom/nodes/RenderNode.js +0 -132
- package/lib/commonjs/dom/nodes/RenderNode.js.map +0 -1
- package/lib/commonjs/dom/nodes/drawings/AtlasNode.d.ts +0 -8
- package/lib/commonjs/dom/nodes/drawings/AtlasNode.js +0 -36
- package/lib/commonjs/dom/nodes/drawings/AtlasNode.js.map +0 -1
- package/lib/commonjs/dom/nodes/drawings/BackdropFilterNode.d.ts +0 -8
- package/lib/commonjs/dom/nodes/drawings/BackdropFilterNode.js +0 -42
- package/lib/commonjs/dom/nodes/drawings/BackdropFilterNode.js.map +0 -1
- package/lib/commonjs/dom/nodes/drawings/Box.d.ts +0 -15
- package/lib/commonjs/dom/nodes/drawings/Box.js +0 -82
- package/lib/commonjs/dom/nodes/drawings/Box.js.map +0 -1
- package/lib/commonjs/dom/nodes/drawings/CircleNode.d.ts +0 -9
- package/lib/commonjs/dom/nodes/drawings/CircleNode.js +0 -32
- package/lib/commonjs/dom/nodes/drawings/CircleNode.js.map +0 -1
- package/lib/commonjs/dom/nodes/drawings/DiffRectNode.d.ts +0 -8
- package/lib/commonjs/dom/nodes/drawings/DiffRectNode.js +0 -28
- package/lib/commonjs/dom/nodes/drawings/DiffRectNode.js.map +0 -1
- package/lib/commonjs/dom/nodes/drawings/FillNode.d.ts +0 -8
- package/lib/commonjs/dom/nodes/drawings/FillNode.js +0 -24
- package/lib/commonjs/dom/nodes/drawings/FillNode.js.map +0 -1
- package/lib/commonjs/dom/nodes/drawings/ImageNode.d.ts +0 -25
- package/lib/commonjs/dom/nodes/drawings/ImageNode.js +0 -71
- package/lib/commonjs/dom/nodes/drawings/ImageNode.js.map +0 -1
- package/lib/commonjs/dom/nodes/drawings/ImageSVG.d.ts +0 -13
- package/lib/commonjs/dom/nodes/drawings/ImageSVG.js +0 -57
- package/lib/commonjs/dom/nodes/drawings/ImageSVG.js.map +0 -1
- package/lib/commonjs/dom/nodes/drawings/LineNode.d.ts +0 -8
- package/lib/commonjs/dom/nodes/drawings/LineNode.js +0 -28
- package/lib/commonjs/dom/nodes/drawings/LineNode.js.map +0 -1
- package/lib/commonjs/dom/nodes/drawings/OvalNode.d.ts +0 -9
- package/lib/commonjs/dom/nodes/drawings/OvalNode.js +0 -28
- package/lib/commonjs/dom/nodes/drawings/OvalNode.js.map +0 -1
- package/lib/commonjs/dom/nodes/drawings/ParagraphNode.d.ts +0 -8
- package/lib/commonjs/dom/nodes/drawings/ParagraphNode.js +0 -32
- package/lib/commonjs/dom/nodes/drawings/ParagraphNode.js.map +0 -1
- package/lib/commonjs/dom/nodes/drawings/PatchNode.d.ts +0 -18
- package/lib/commonjs/dom/nodes/drawings/PatchNode.js +0 -53
- package/lib/commonjs/dom/nodes/drawings/PatchNode.js.map +0 -1
- package/lib/commonjs/dom/nodes/drawings/PathNode.d.ts +0 -9
- package/lib/commonjs/dom/nodes/drawings/PathNode.js +0 -55
- package/lib/commonjs/dom/nodes/drawings/PathNode.js.map +0 -1
- package/lib/commonjs/dom/nodes/drawings/PictureNode.d.ts +0 -8
- package/lib/commonjs/dom/nodes/drawings/PictureNode.js +0 -26
- package/lib/commonjs/dom/nodes/drawings/PictureNode.js.map +0 -1
- package/lib/commonjs/dom/nodes/drawings/PointsNode.d.ts +0 -8
- package/lib/commonjs/dom/nodes/drawings/PointsNode.js +0 -30
- package/lib/commonjs/dom/nodes/drawings/PointsNode.js.map +0 -1
- package/lib/commonjs/dom/nodes/drawings/RRectNode.d.ts +0 -10
- package/lib/commonjs/dom/nodes/drawings/RRectNode.js +0 -32
- package/lib/commonjs/dom/nodes/drawings/RRectNode.js.map +0 -1
- package/lib/commonjs/dom/nodes/drawings/RectNode.d.ts +0 -9
- package/lib/commonjs/dom/nodes/drawings/RectNode.js +0 -28
- package/lib/commonjs/dom/nodes/drawings/RectNode.js.map +0 -1
- package/lib/commonjs/dom/nodes/drawings/Text.d.ts +0 -30
- package/lib/commonjs/dom/nodes/drawings/Text.js +0 -159
- package/lib/commonjs/dom/nodes/drawings/Text.js.map +0 -1
- package/lib/commonjs/dom/nodes/drawings/VerticesNode.d.ts +0 -9
- package/lib/commonjs/dom/nodes/drawings/VerticesNode.js +0 -43
- package/lib/commonjs/dom/nodes/drawings/VerticesNode.js.map +0 -1
- package/lib/commonjs/dom/nodes/drawings/index.d.ts +0 -18
- package/lib/commonjs/dom/nodes/drawings/index.js +0 -204
- package/lib/commonjs/dom/nodes/drawings/index.js.map +0 -1
- package/lib/commonjs/dom/nodes/paint/BlendNode.d.ts +0 -8
- package/lib/commonjs/dom/nodes/paint/BlendNode.js +0 -37
- package/lib/commonjs/dom/nodes/paint/BlendNode.js.map +0 -1
- package/lib/commonjs/dom/nodes/paint/ColorFilters.d.ts +0 -35
- package/lib/commonjs/dom/nodes/paint/ColorFilters.js +0 -102
- package/lib/commonjs/dom/nodes/paint/ColorFilters.js.map +0 -1
- package/lib/commonjs/dom/nodes/paint/ImageFilters.d.ts +0 -42
- package/lib/commonjs/dom/nodes/paint/ImageFilters.js +0 -183
- package/lib/commonjs/dom/nodes/paint/ImageFilters.js.map +0 -1
- package/lib/commonjs/dom/nodes/paint/MaskFilters.d.ts +0 -8
- package/lib/commonjs/dom/nodes/paint/MaskFilters.js +0 -26
- package/lib/commonjs/dom/nodes/paint/MaskFilters.js.map +0 -1
- package/lib/commonjs/dom/nodes/paint/PathEffects.d.ts +0 -39
- package/lib/commonjs/dom/nodes/paint/PathEffects.js +0 -136
- package/lib/commonjs/dom/nodes/paint/PathEffects.js.map +0 -1
- package/lib/commonjs/dom/nodes/paint/Shaders.d.ts +0 -43
- package/lib/commonjs/dom/nodes/paint/Shaders.js +0 -209
- package/lib/commonjs/dom/nodes/paint/Shaders.js.map +0 -1
- package/lib/commonjs/dom/nodes/paint/index.d.ts +0 -6
- package/lib/commonjs/dom/nodes/paint/index.js +0 -72
- package/lib/commonjs/dom/nodes/paint/index.js.map +0 -1
- package/lib/commonjs/dom/types/DeclarationContext.d.ts +0 -29
- package/lib/commonjs/dom/types/DeclarationContext.js +0 -91
- package/lib/commonjs/dom/types/DeclarationContext.js.map +0 -1
- package/lib/commonjs/dom/types/DrawingContext.d.ts +0 -22
- package/lib/commonjs/dom/types/DrawingContext.js +0 -263
- package/lib/commonjs/dom/types/DrawingContext.js.map +0 -1
- package/lib/commonjs/renderer/DrawingContext.d.ts +0 -7
- package/lib/commonjs/renderer/DrawingContext.js.map +0 -1
- package/lib/commonjs/renderer/__tests__/SkiaDOM.spec.d.ts +0 -1
- package/lib/commonjs/views/SkiaJSDomView.d.ts +0 -38
- package/lib/commonjs/views/SkiaJSDomView.js +0 -131
- package/lib/commonjs/views/SkiaJSDomView.js.map +0 -1
- package/lib/commonjs/views/SkiaJSDomView.web.d.ts +0 -1
- package/lib/commonjs/views/SkiaJSDomView.web.js +0 -13
- package/lib/commonjs/views/SkiaJSDomView.web.js.map +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/dom/nodes/DrawingNode.d.ts +0 -14
- package/lib/module/dom/nodes/DrawingNode.js +0 -62
- package/lib/module/dom/nodes/DrawingNode.js.map +0 -1
- package/lib/module/dom/nodes/GroupNode.d.ts +0 -7
- package/lib/module/dom/nodes/GroupNode.js +0 -15
- package/lib/module/dom/nodes/GroupNode.js.map +0 -1
- package/lib/module/dom/nodes/LayerNode.d.ts +0 -8
- package/lib/module/dom/nodes/LayerNode.js +0 -32
- package/lib/module/dom/nodes/LayerNode.js.map +0 -1
- package/lib/module/dom/nodes/Node.d.ts +0 -34
- package/lib/module/dom/nodes/Node.js +0 -94
- package/lib/module/dom/nodes/Node.js.map +0 -1
- package/lib/module/dom/nodes/PaintNode.d.ts +0 -8
- package/lib/module/dom/nodes/PaintNode.js +0 -83
- package/lib/module/dom/nodes/PaintNode.js.map +0 -1
- package/lib/module/dom/nodes/RenderNode.d.ts +0 -26
- package/lib/module/dom/nodes/RenderNode.js +0 -125
- package/lib/module/dom/nodes/RenderNode.js.map +0 -1
- package/lib/module/dom/nodes/drawings/AtlasNode.d.ts +0 -8
- package/lib/module/dom/nodes/drawings/AtlasNode.js +0 -29
- package/lib/module/dom/nodes/drawings/AtlasNode.js.map +0 -1
- package/lib/module/dom/nodes/drawings/BackdropFilterNode.d.ts +0 -8
- package/lib/module/dom/nodes/drawings/BackdropFilterNode.js +0 -35
- package/lib/module/dom/nodes/drawings/BackdropFilterNode.js.map +0 -1
- package/lib/module/dom/nodes/drawings/Box.d.ts +0 -15
- package/lib/module/dom/nodes/drawings/Box.js +0 -74
- package/lib/module/dom/nodes/drawings/Box.js.map +0 -1
- package/lib/module/dom/nodes/drawings/CircleNode.d.ts +0 -9
- package/lib/module/dom/nodes/drawings/CircleNode.js +0 -25
- package/lib/module/dom/nodes/drawings/CircleNode.js.map +0 -1
- package/lib/module/dom/nodes/drawings/DiffRectNode.d.ts +0 -8
- package/lib/module/dom/nodes/drawings/DiffRectNode.js +0 -21
- package/lib/module/dom/nodes/drawings/DiffRectNode.js.map +0 -1
- package/lib/module/dom/nodes/drawings/FillNode.d.ts +0 -8
- package/lib/module/dom/nodes/drawings/FillNode.js +0 -17
- package/lib/module/dom/nodes/drawings/FillNode.js.map +0 -1
- package/lib/module/dom/nodes/drawings/ImageNode.d.ts +0 -25
- package/lib/module/dom/nodes/drawings/ImageNode.js +0 -64
- package/lib/module/dom/nodes/drawings/ImageNode.js.map +0 -1
- package/lib/module/dom/nodes/drawings/ImageSVG.d.ts +0 -13
- package/lib/module/dom/nodes/drawings/ImageSVG.js +0 -50
- package/lib/module/dom/nodes/drawings/ImageSVG.js.map +0 -1
- package/lib/module/dom/nodes/drawings/LineNode.d.ts +0 -8
- package/lib/module/dom/nodes/drawings/LineNode.js +0 -21
- package/lib/module/dom/nodes/drawings/LineNode.js.map +0 -1
- package/lib/module/dom/nodes/drawings/OvalNode.d.ts +0 -9
- package/lib/module/dom/nodes/drawings/OvalNode.js +0 -21
- package/lib/module/dom/nodes/drawings/OvalNode.js.map +0 -1
- package/lib/module/dom/nodes/drawings/ParagraphNode.d.ts +0 -8
- package/lib/module/dom/nodes/drawings/ParagraphNode.js +0 -25
- package/lib/module/dom/nodes/drawings/ParagraphNode.js.map +0 -1
- package/lib/module/dom/nodes/drawings/PatchNode.d.ts +0 -18
- package/lib/module/dom/nodes/drawings/PatchNode.js +0 -46
- package/lib/module/dom/nodes/drawings/PatchNode.js.map +0 -1
- package/lib/module/dom/nodes/drawings/PathNode.d.ts +0 -9
- package/lib/module/dom/nodes/drawings/PathNode.js +0 -48
- package/lib/module/dom/nodes/drawings/PathNode.js.map +0 -1
- package/lib/module/dom/nodes/drawings/PictureNode.d.ts +0 -8
- package/lib/module/dom/nodes/drawings/PictureNode.js +0 -19
- package/lib/module/dom/nodes/drawings/PictureNode.js.map +0 -1
- package/lib/module/dom/nodes/drawings/PointsNode.d.ts +0 -8
- package/lib/module/dom/nodes/drawings/PointsNode.js +0 -23
- package/lib/module/dom/nodes/drawings/PointsNode.js.map +0 -1
- package/lib/module/dom/nodes/drawings/RRectNode.d.ts +0 -10
- package/lib/module/dom/nodes/drawings/RRectNode.js +0 -25
- package/lib/module/dom/nodes/drawings/RRectNode.js.map +0 -1
- package/lib/module/dom/nodes/drawings/RectNode.d.ts +0 -9
- package/lib/module/dom/nodes/drawings/RectNode.js +0 -21
- package/lib/module/dom/nodes/drawings/RectNode.js.map +0 -1
- package/lib/module/dom/nodes/drawings/Text.d.ts +0 -30
- package/lib/module/dom/nodes/drawings/Text.js +0 -149
- package/lib/module/dom/nodes/drawings/Text.js.map +0 -1
- package/lib/module/dom/nodes/drawings/VerticesNode.d.ts +0 -9
- package/lib/module/dom/nodes/drawings/VerticesNode.js +0 -36
- package/lib/module/dom/nodes/drawings/VerticesNode.js.map +0 -1
- package/lib/module/dom/nodes/drawings/index.d.ts +0 -18
- package/lib/module/dom/nodes/drawings/index.js +0 -19
- package/lib/module/dom/nodes/drawings/index.js.map +0 -1
- package/lib/module/dom/nodes/paint/BlendNode.d.ts +0 -8
- package/lib/module/dom/nodes/paint/BlendNode.js +0 -30
- package/lib/module/dom/nodes/paint/BlendNode.js.map +0 -1
- package/lib/module/dom/nodes/paint/ColorFilters.d.ts +0 -35
- package/lib/module/dom/nodes/paint/ColorFilters.js +0 -89
- package/lib/module/dom/nodes/paint/ColorFilters.js.map +0 -1
- package/lib/module/dom/nodes/paint/ImageFilters.d.ts +0 -42
- package/lib/module/dom/nodes/paint/ImageFilters.js +0 -169
- package/lib/module/dom/nodes/paint/ImageFilters.js.map +0 -1
- package/lib/module/dom/nodes/paint/MaskFilters.d.ts +0 -8
- package/lib/module/dom/nodes/paint/MaskFilters.js +0 -19
- package/lib/module/dom/nodes/paint/MaskFilters.js.map +0 -1
- package/lib/module/dom/nodes/paint/PathEffects.d.ts +0 -39
- package/lib/module/dom/nodes/paint/PathEffects.js +0 -123
- package/lib/module/dom/nodes/paint/PathEffects.js.map +0 -1
- package/lib/module/dom/nodes/paint/Shaders.d.ts +0 -43
- package/lib/module/dom/nodes/paint/Shaders.js +0 -193
- package/lib/module/dom/nodes/paint/Shaders.js.map +0 -1
- package/lib/module/dom/nodes/paint/index.d.ts +0 -6
- package/lib/module/dom/nodes/paint/index.js +0 -7
- package/lib/module/dom/nodes/paint/index.js.map +0 -1
- package/lib/module/dom/types/DeclarationContext.d.ts +0 -29
- package/lib/module/dom/types/DeclarationContext.js +0 -83
- package/lib/module/dom/types/DeclarationContext.js.map +0 -1
- package/lib/module/dom/types/DrawingContext.d.ts +0 -22
- package/lib/module/dom/types/DrawingContext.js +0 -256
- package/lib/module/dom/types/DrawingContext.js.map +0 -1
- package/lib/module/renderer/DrawingContext.d.ts +0 -7
- package/lib/module/renderer/DrawingContext.js +0 -2
- package/lib/module/renderer/DrawingContext.js.map +0 -1
- package/lib/module/renderer/__tests__/SkiaDOM.spec.d.ts +0 -1
- package/lib/module/views/SkiaJSDomView.d.ts +0 -38
- package/lib/module/views/SkiaJSDomView.js +0 -123
- package/lib/module/views/SkiaJSDomView.js.map +0 -1
- package/lib/module/views/SkiaJSDomView.web.d.ts +0 -1
- package/lib/module/views/SkiaJSDomView.web.js +0 -2
- package/lib/module/views/SkiaJSDomView.web.js.map +0 -1
- package/lib/typescript/lib/commonjs/dom/nodes/DrawingNode.d.ts +0 -6
- package/lib/typescript/lib/commonjs/dom/nodes/GroupNode.d.ts +0 -6
- package/lib/typescript/lib/commonjs/dom/nodes/LayerNode.d.ts +0 -6
- package/lib/typescript/lib/commonjs/dom/nodes/Node.d.ts +0 -20
- package/lib/typescript/lib/commonjs/dom/nodes/PaintNode.d.ts +0 -6
- package/lib/typescript/lib/commonjs/dom/nodes/RenderNode.d.ts +0 -16
- package/lib/typescript/lib/commonjs/dom/nodes/drawings/AtlasNode.d.ts +0 -10
- package/lib/typescript/lib/commonjs/dom/nodes/drawings/BackdropFilterNode.d.ts +0 -10
- package/lib/typescript/lib/commonjs/dom/nodes/drawings/Box.d.ts +0 -15
- package/lib/typescript/lib/commonjs/dom/nodes/drawings/CircleNode.d.ts +0 -10
- package/lib/typescript/lib/commonjs/dom/nodes/drawings/DiffRectNode.d.ts +0 -10
- package/lib/typescript/lib/commonjs/dom/nodes/drawings/FillNode.d.ts +0 -10
- package/lib/typescript/lib/commonjs/dom/nodes/drawings/ImageNode.d.ts +0 -13
- package/lib/typescript/lib/commonjs/dom/nodes/drawings/ImageSVG.d.ts +0 -9
- package/lib/typescript/lib/commonjs/dom/nodes/drawings/LineNode.d.ts +0 -10
- package/lib/typescript/lib/commonjs/dom/nodes/drawings/OvalNode.d.ts +0 -10
- package/lib/typescript/lib/commonjs/dom/nodes/drawings/ParagraphNode.d.ts +0 -9
- package/lib/typescript/lib/commonjs/dom/nodes/drawings/PatchNode.d.ts +0 -14
- package/lib/typescript/lib/commonjs/dom/nodes/drawings/PathNode.d.ts +0 -10
- package/lib/typescript/lib/commonjs/dom/nodes/drawings/PictureNode.d.ts +0 -9
- package/lib/typescript/lib/commonjs/dom/nodes/drawings/PointsNode.d.ts +0 -10
- package/lib/typescript/lib/commonjs/dom/nodes/drawings/RRectNode.d.ts +0 -10
- package/lib/typescript/lib/commonjs/dom/nodes/drawings/RectNode.d.ts +0 -10
- package/lib/typescript/lib/commonjs/dom/nodes/drawings/Text.d.ts +0 -34
- package/lib/typescript/lib/commonjs/dom/nodes/drawings/VerticesNode.d.ts +0 -10
- package/lib/typescript/lib/commonjs/dom/nodes/paint/BlendNode.d.ts +0 -6
- package/lib/typescript/lib/commonjs/dom/nodes/paint/ColorFilters.d.ts +0 -29
- package/lib/typescript/lib/commonjs/dom/nodes/paint/ImageFilters.d.ts +0 -35
- package/lib/typescript/lib/commonjs/dom/nodes/paint/MaskFilters.d.ts +0 -6
- package/lib/typescript/lib/commonjs/dom/nodes/paint/PathEffects.d.ts +0 -34
- package/lib/typescript/lib/commonjs/dom/nodes/paint/Shaders.d.ts +0 -40
- package/lib/typescript/lib/commonjs/dom/types/DeclarationContext.d.ts +0 -26
- package/lib/typescript/lib/commonjs/dom/types/DrawingContext.d.ts +0 -13
- package/lib/typescript/lib/commonjs/views/SkiaJSDomView.d.ts +0 -29
- package/lib/typescript/lib/commonjs/views/SkiaJSDomView.web.d.ts +0 -3
- package/lib/typescript/lib/module/dom/nodes/DrawingNode.d.ts +0 -5
- package/lib/typescript/lib/module/dom/nodes/GroupNode.d.ts +0 -5
- package/lib/typescript/lib/module/dom/nodes/LayerNode.d.ts +0 -5
- package/lib/typescript/lib/module/dom/nodes/Node.d.ts +0 -19
- package/lib/typescript/lib/module/dom/nodes/PaintNode.d.ts +0 -5
- package/lib/typescript/lib/module/dom/nodes/RenderNode.d.ts +0 -15
- package/lib/typescript/lib/module/dom/nodes/drawings/AtlasNode.d.ts +0 -9
- package/lib/typescript/lib/module/dom/nodes/drawings/BackdropFilterNode.d.ts +0 -9
- package/lib/typescript/lib/module/dom/nodes/drawings/Box.d.ts +0 -14
- package/lib/typescript/lib/module/dom/nodes/drawings/CircleNode.d.ts +0 -9
- package/lib/typescript/lib/module/dom/nodes/drawings/DiffRectNode.d.ts +0 -9
- package/lib/typescript/lib/module/dom/nodes/drawings/FillNode.d.ts +0 -9
- package/lib/typescript/lib/module/dom/nodes/drawings/ImageNode.d.ts +0 -22
- package/lib/typescript/lib/module/dom/nodes/drawings/ImageSVG.d.ts +0 -8
- package/lib/typescript/lib/module/dom/nodes/drawings/LineNode.d.ts +0 -9
- package/lib/typescript/lib/module/dom/nodes/drawings/OvalNode.d.ts +0 -9
- package/lib/typescript/lib/module/dom/nodes/drawings/ParagraphNode.d.ts +0 -8
- package/lib/typescript/lib/module/dom/nodes/drawings/PatchNode.d.ts +0 -13
- package/lib/typescript/lib/module/dom/nodes/drawings/PathNode.d.ts +0 -9
- package/lib/typescript/lib/module/dom/nodes/drawings/PictureNode.d.ts +0 -8
- package/lib/typescript/lib/module/dom/nodes/drawings/PointsNode.d.ts +0 -9
- package/lib/typescript/lib/module/dom/nodes/drawings/RRectNode.d.ts +0 -9
- package/lib/typescript/lib/module/dom/nodes/drawings/RectNode.d.ts +0 -9
- package/lib/typescript/lib/module/dom/nodes/drawings/Text.d.ts +0 -33
- package/lib/typescript/lib/module/dom/nodes/drawings/VerticesNode.d.ts +0 -9
- package/lib/typescript/lib/module/dom/nodes/drawings/index.d.ts +0 -18
- package/lib/typescript/lib/module/dom/nodes/paint/BlendNode.d.ts +0 -5
- package/lib/typescript/lib/module/dom/nodes/paint/ColorFilters.d.ts +0 -28
- package/lib/typescript/lib/module/dom/nodes/paint/ImageFilters.d.ts +0 -34
- package/lib/typescript/lib/module/dom/nodes/paint/MaskFilters.d.ts +0 -5
- package/lib/typescript/lib/module/dom/nodes/paint/PathEffects.d.ts +0 -33
- package/lib/typescript/lib/module/dom/nodes/paint/Shaders.d.ts +0 -39
- package/lib/typescript/lib/module/dom/nodes/paint/index.d.ts +0 -6
- package/lib/typescript/lib/module/dom/types/DeclarationContext.d.ts +0 -25
- package/lib/typescript/lib/module/dom/types/DrawingContext.d.ts +0 -12
- package/lib/typescript/lib/module/renderer/DrawingContext.d.ts +0 -1
- package/lib/typescript/lib/module/views/SkiaJSDomView.d.ts +0 -26
- package/lib/typescript/lib/module/views/SkiaJSDomView.web.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/dom/nodes/DrawingNode.d.ts +0 -14
- package/lib/typescript/src/dom/nodes/GroupNode.d.ts +0 -7
- package/lib/typescript/src/dom/nodes/LayerNode.d.ts +0 -8
- package/lib/typescript/src/dom/nodes/Node.d.ts +0 -34
- package/lib/typescript/src/dom/nodes/PaintNode.d.ts +0 -8
- package/lib/typescript/src/dom/nodes/RenderNode.d.ts +0 -26
- package/lib/typescript/src/dom/nodes/drawings/AtlasNode.d.ts +0 -8
- package/lib/typescript/src/dom/nodes/drawings/BackdropFilterNode.d.ts +0 -8
- package/lib/typescript/src/dom/nodes/drawings/Box.d.ts +0 -15
- package/lib/typescript/src/dom/nodes/drawings/CircleNode.d.ts +0 -9
- package/lib/typescript/src/dom/nodes/drawings/DiffRectNode.d.ts +0 -8
- package/lib/typescript/src/dom/nodes/drawings/FillNode.d.ts +0 -8
- package/lib/typescript/src/dom/nodes/drawings/ImageNode.d.ts +0 -25
- package/lib/typescript/src/dom/nodes/drawings/ImageSVG.d.ts +0 -13
- package/lib/typescript/src/dom/nodes/drawings/LineNode.d.ts +0 -8
- package/lib/typescript/src/dom/nodes/drawings/OvalNode.d.ts +0 -9
- package/lib/typescript/src/dom/nodes/drawings/ParagraphNode.d.ts +0 -8
- package/lib/typescript/src/dom/nodes/drawings/PatchNode.d.ts +0 -18
- package/lib/typescript/src/dom/nodes/drawings/PathNode.d.ts +0 -9
- package/lib/typescript/src/dom/nodes/drawings/PictureNode.d.ts +0 -8
- package/lib/typescript/src/dom/nodes/drawings/PointsNode.d.ts +0 -8
- package/lib/typescript/src/dom/nodes/drawings/RRectNode.d.ts +0 -10
- package/lib/typescript/src/dom/nodes/drawings/RectNode.d.ts +0 -9
- package/lib/typescript/src/dom/nodes/drawings/Text.d.ts +0 -30
- package/lib/typescript/src/dom/nodes/drawings/VerticesNode.d.ts +0 -9
- package/lib/typescript/src/dom/nodes/drawings/index.d.ts +0 -18
- package/lib/typescript/src/dom/nodes/paint/BlendNode.d.ts +0 -8
- package/lib/typescript/src/dom/nodes/paint/ColorFilters.d.ts +0 -35
- package/lib/typescript/src/dom/nodes/paint/ImageFilters.d.ts +0 -42
- package/lib/typescript/src/dom/nodes/paint/MaskFilters.d.ts +0 -8
- package/lib/typescript/src/dom/nodes/paint/PathEffects.d.ts +0 -39
- package/lib/typescript/src/dom/nodes/paint/Shaders.d.ts +0 -43
- package/lib/typescript/src/dom/nodes/paint/index.d.ts +0 -6
- package/lib/typescript/src/dom/types/DeclarationContext.d.ts +0 -29
- package/lib/typescript/src/dom/types/DrawingContext.d.ts +0 -22
- package/lib/typescript/src/renderer/DrawingContext.d.ts +0 -7
- package/lib/typescript/src/renderer/__tests__/SkiaDOM.spec.d.ts +0 -1
- package/lib/typescript/src/views/SkiaJSDomView.d.ts +0 -38
- package/lib/typescript/src/views/SkiaJSDomView.web.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/dom/nodes/DrawingNode.ts +0 -74
- package/src/dom/nodes/GroupNode.ts +0 -19
- package/src/dom/nodes/LayerNode.ts +0 -37
- package/src/dom/nodes/Node.ts +0 -121
- package/src/dom/nodes/PaintNode.ts +0 -91
- package/src/dom/nodes/RenderNode.ts +0 -172
- package/src/dom/nodes/drawings/AtlasNode.ts +0 -24
- package/src/dom/nodes/drawings/BackdropFilterNode.ts +0 -37
- package/src/dom/nodes/drawings/Box.ts +0 -110
- package/src/dom/nodes/drawings/CircleNode.ts +0 -24
- package/src/dom/nodes/drawings/DiffRectNode.ts +0 -19
- package/src/dom/nodes/drawings/FillNode.ts +0 -18
- package/src/dom/nodes/drawings/ImageNode.ts +0 -49
- package/src/dom/nodes/drawings/ImageSVG.ts +0 -38
- package/src/dom/nodes/drawings/LineNode.ts +0 -19
- package/src/dom/nodes/drawings/OvalNode.ts +0 -23
- package/src/dom/nodes/drawings/ParagraphNode.ts +0 -22
- package/src/dom/nodes/drawings/PatchNode.ts +0 -54
- package/src/dom/nodes/drawings/PathNode.ts +0 -51
- package/src/dom/nodes/drawings/PictureNode.ts +0 -19
- package/src/dom/nodes/drawings/PointsNode.ts +0 -21
- package/src/dom/nodes/drawings/RRectNode.ts +0 -25
- package/src/dom/nodes/drawings/RectNode.ts +0 -23
- package/src/dom/nodes/drawings/Text.ts +0 -145
- package/src/dom/nodes/drawings/VerticesNode.ts +0 -35
- package/src/dom/nodes/drawings/index.ts +0 -18
- package/src/dom/nodes/paint/BlendNode.ts +0 -32
- package/src/dom/nodes/paint/ColorFilters.ts +0 -106
- package/src/dom/nodes/paint/ImageFilters.ts +0 -221
- package/src/dom/nodes/paint/MaskFilters.ts +0 -23
- package/src/dom/nodes/paint/PathEffects.ts +0 -139
- package/src/dom/nodes/paint/Shaders.ts +0 -233
- package/src/dom/nodes/paint/index.ts +0 -6
- package/src/dom/types/DrawingContext.ts +0 -322
- package/src/renderer/DrawingContext.ts +0 -8
- package/src/renderer/__tests__/SkiaDOM.spec.tsx +0 -46
- package/src/views/SkiaJSDomView.tsx +0 -143
- package/src/views/SkiaJSDomView.web.tsx +0 -1
- /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/typescript/lib/commonjs/{dom/nodes/drawings/index.d.ts → sksg/nodes/Node.d.ts} +0 -0
- /package/lib/typescript/lib/commonjs/{dom/nodes/paint → sksg/nodes}/index.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,371 @@
|
|
1
|
+
import { deflate, enumKey, fitRects, inflate, NodeType, processCircle, processPath, processRect, processRRect } from "../../dom/nodes";
|
2
|
+
import { saturate } from "../../renderer/processors";
|
3
|
+
import { BlendMode, BlurStyle, ClipOp, FillType, isRRect, PointMode, VertexMode } from "../../skia/types";
|
4
|
+
import { materialize } from "./utils";
|
5
|
+
export const drawLine = (ctx, props) => {
|
6
|
+
"worklet";
|
7
|
+
|
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
|
+
"worklet";
|
16
|
+
|
17
|
+
const rect = processRect(ctx.Skia, props);
|
18
|
+
ctx.canvas.drawOval(rect, ctx.paint);
|
19
|
+
};
|
20
|
+
export const drawBox = (ctx, props, children) => {
|
21
|
+
"worklet";
|
22
|
+
|
23
|
+
const {
|
24
|
+
paint,
|
25
|
+
Skia,
|
26
|
+
canvas
|
27
|
+
} = ctx;
|
28
|
+
const {
|
29
|
+
box: defaultBox
|
30
|
+
} = props;
|
31
|
+
const opacity = paint.getAlphaf();
|
32
|
+
const box = isRRect(defaultBox) ? defaultBox : Skia.RRectXY(defaultBox, 0, 0);
|
33
|
+
const shadows = children.map(node => {
|
34
|
+
if (node.type === NodeType.BoxShadow) {
|
35
|
+
return materialize(node.props);
|
36
|
+
}
|
37
|
+
return null;
|
38
|
+
}).filter(n => n !== null);
|
39
|
+
shadows.filter(shadow => !shadow.inner).map(shadow => {
|
40
|
+
const {
|
41
|
+
color = "black",
|
42
|
+
blur,
|
43
|
+
spread = 0,
|
44
|
+
dx = 0,
|
45
|
+
dy = 0
|
46
|
+
} = shadow;
|
47
|
+
const lPaint = Skia.Paint();
|
48
|
+
lPaint.setColor(Skia.Color(color));
|
49
|
+
lPaint.setAlphaf(paint.getAlphaf() * opacity);
|
50
|
+
lPaint.setMaskFilter(Skia.MaskFilter.MakeBlur(BlurStyle.Normal, blur, true));
|
51
|
+
canvas.drawRRect(inflate(Skia, box, spread, spread, dx, dy), lPaint);
|
52
|
+
});
|
53
|
+
canvas.drawRRect(box, paint);
|
54
|
+
shadows.filter(shadow => shadow.inner).map(shadow => {
|
55
|
+
const {
|
56
|
+
color = "black",
|
57
|
+
blur,
|
58
|
+
spread = 0,
|
59
|
+
dx = 0,
|
60
|
+
dy = 0
|
61
|
+
} = shadow;
|
62
|
+
const delta = Skia.Point(10 + Math.abs(dx), 10 + Math.abs(dy));
|
63
|
+
canvas.save();
|
64
|
+
canvas.clipRRect(box, ClipOp.Intersect, false);
|
65
|
+
const lPaint = Skia.Paint();
|
66
|
+
lPaint.setColor(Skia.Color(color));
|
67
|
+
lPaint.setAlphaf(paint.getAlphaf() * opacity);
|
68
|
+
lPaint.setMaskFilter(Skia.MaskFilter.MakeBlur(BlurStyle.Normal, blur, true));
|
69
|
+
const inner = deflate(Skia, box, spread, spread, dx, dy);
|
70
|
+
const outer = inflate(Skia, box, delta.x, delta.y);
|
71
|
+
canvas.drawDRRect(outer, inner, lPaint);
|
72
|
+
canvas.restore();
|
73
|
+
});
|
74
|
+
};
|
75
|
+
export const drawImage = (ctx, props) => {
|
76
|
+
"worklet";
|
77
|
+
|
78
|
+
const {
|
79
|
+
image
|
80
|
+
} = props;
|
81
|
+
if (image) {
|
82
|
+
var _props$fit;
|
83
|
+
const fit = (_props$fit = props.fit) !== null && _props$fit !== void 0 ? _props$fit : "contain";
|
84
|
+
const rect = processRect(ctx.Skia, props);
|
85
|
+
const {
|
86
|
+
src,
|
87
|
+
dst
|
88
|
+
} = fitRects(fit, {
|
89
|
+
x: 0,
|
90
|
+
y: 0,
|
91
|
+
width: image.width(),
|
92
|
+
height: image.height()
|
93
|
+
}, rect);
|
94
|
+
ctx.canvas.drawImageRect(image, src, dst, ctx.paint);
|
95
|
+
}
|
96
|
+
};
|
97
|
+
export const drawPoints = (ctx, props) => {
|
98
|
+
"worklet";
|
99
|
+
|
100
|
+
const {
|
101
|
+
points,
|
102
|
+
mode
|
103
|
+
} = props;
|
104
|
+
ctx.canvas.drawPoints(PointMode[enumKey(mode)], points, ctx.paint);
|
105
|
+
};
|
106
|
+
export const drawVertices = (ctx, props) => {
|
107
|
+
"worklet";
|
108
|
+
|
109
|
+
const {
|
110
|
+
mode,
|
111
|
+
textures,
|
112
|
+
colors,
|
113
|
+
indices,
|
114
|
+
blendMode
|
115
|
+
} = props;
|
116
|
+
const vertexMode = mode ? VertexMode[enumKey(mode)] : VertexMode.Triangles;
|
117
|
+
const vertices = ctx.Skia.MakeVertices(vertexMode, props.vertices, textures, colors ? colors.map(c => ctx.Skia.Color(c)) : undefined, indices);
|
118
|
+
const defaultBlendMode = colors ? BlendMode.DstOver : BlendMode.SrcOver;
|
119
|
+
const blend = blendMode ? BlendMode[enumKey(blendMode)] : defaultBlendMode;
|
120
|
+
ctx.canvas.drawVertices(vertices, blend, ctx.paint);
|
121
|
+
};
|
122
|
+
export const drawDiffRect = (ctx, props) => {
|
123
|
+
"worklet";
|
124
|
+
|
125
|
+
const {
|
126
|
+
outer,
|
127
|
+
inner
|
128
|
+
} = props;
|
129
|
+
ctx.canvas.drawDRRect(outer, inner, ctx.paint);
|
130
|
+
};
|
131
|
+
export const drawTextPath = (ctx, props) => {
|
132
|
+
"worklet";
|
133
|
+
|
134
|
+
const path = processPath(ctx.Skia, props.path);
|
135
|
+
const {
|
136
|
+
font,
|
137
|
+
initialOffset
|
138
|
+
} = props;
|
139
|
+
if (font) {
|
140
|
+
let {
|
141
|
+
text
|
142
|
+
} = props;
|
143
|
+
const ids = font.getGlyphIDs(text);
|
144
|
+
const widths = font.getGlyphWidths(ids);
|
145
|
+
const rsx = [];
|
146
|
+
const meas = ctx.Skia.ContourMeasureIter(path, false, 1);
|
147
|
+
let cont = meas.next();
|
148
|
+
let dist = initialOffset;
|
149
|
+
for (let i = 0; i < text.length && cont; i++) {
|
150
|
+
const width = widths[i];
|
151
|
+
dist += width / 2;
|
152
|
+
if (dist > cont.length()) {
|
153
|
+
// jump to next contour
|
154
|
+
cont = meas.next();
|
155
|
+
if (!cont) {
|
156
|
+
// We have come to the end of the path - terminate the string
|
157
|
+
// right here.
|
158
|
+
text = text.substring(0, i);
|
159
|
+
break;
|
160
|
+
}
|
161
|
+
dist = width / 2;
|
162
|
+
}
|
163
|
+
// Gives us the (x, y) coordinates as well as the cos/sin of the tangent
|
164
|
+
// line at that position.
|
165
|
+
const [p, t] = cont.getPosTan(dist);
|
166
|
+
const adjustedX = p.x - width / 2 * t.x;
|
167
|
+
const adjustedY = p.y - width / 2 * t.y;
|
168
|
+
rsx.push(ctx.Skia.RSXform(t.x, t.y, adjustedX, adjustedY));
|
169
|
+
dist += width / 2;
|
170
|
+
}
|
171
|
+
const derived = ctx.Skia.TextBlob.MakeFromRSXform(text, rsx, font);
|
172
|
+
ctx.canvas.drawTextBlob(derived, 0, 0, ctx.paint);
|
173
|
+
}
|
174
|
+
};
|
175
|
+
export const drawText = (ctx, props) => {
|
176
|
+
"worklet";
|
177
|
+
|
178
|
+
const {
|
179
|
+
text,
|
180
|
+
x,
|
181
|
+
y,
|
182
|
+
font
|
183
|
+
} = props;
|
184
|
+
if (font != null) {
|
185
|
+
ctx.canvas.drawText(text, x, y, ctx.paint, font);
|
186
|
+
}
|
187
|
+
};
|
188
|
+
export const drawPatch = (ctx, props) => {
|
189
|
+
"worklet";
|
190
|
+
|
191
|
+
const {
|
192
|
+
texture,
|
193
|
+
blendMode,
|
194
|
+
patch
|
195
|
+
} = props;
|
196
|
+
const defaultBlendMode = props.colors ? BlendMode.DstOver : BlendMode.SrcOver;
|
197
|
+
const mode = blendMode ? BlendMode[enumKey(blendMode)] : defaultBlendMode;
|
198
|
+
// Patch requires a path with the following constraints:
|
199
|
+
// M tl
|
200
|
+
// C c1 c2 br
|
201
|
+
// C c1 c2 bl
|
202
|
+
// C c1 c2 tl (the redundant point in the last command is removed)
|
203
|
+
|
204
|
+
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];
|
205
|
+
const colors = props.colors ? props.colors.map(c => ctx.Skia.Color(c)) : undefined;
|
206
|
+
ctx.canvas.drawPatch(points, colors, texture, mode, ctx.paint);
|
207
|
+
};
|
208
|
+
export const drawPath = (ctx, props) => {
|
209
|
+
"worklet";
|
210
|
+
|
211
|
+
const {
|
212
|
+
start: trimStart,
|
213
|
+
end: trimEnd,
|
214
|
+
fillType,
|
215
|
+
stroke,
|
216
|
+
...pathProps
|
217
|
+
} = props;
|
218
|
+
const start = saturate(trimStart);
|
219
|
+
const end = saturate(trimEnd);
|
220
|
+
const hasStartOffset = start !== 0;
|
221
|
+
const hasEndOffset = end !== 1;
|
222
|
+
const hasStrokeOptions = stroke !== undefined;
|
223
|
+
const hasFillType = !!fillType;
|
224
|
+
const willMutatePath = hasStartOffset || hasEndOffset || hasStrokeOptions || hasFillType;
|
225
|
+
const pristinePath = processPath(ctx.Skia, pathProps.path);
|
226
|
+
const path = willMutatePath ? pristinePath.copy() : pristinePath;
|
227
|
+
if (hasFillType) {
|
228
|
+
path.setFillType(FillType[enumKey(fillType)]);
|
229
|
+
}
|
230
|
+
if (hasStrokeOptions) {
|
231
|
+
path.stroke(stroke);
|
232
|
+
}
|
233
|
+
if (hasStartOffset || hasEndOffset) {
|
234
|
+
path.trim(start, end, false);
|
235
|
+
}
|
236
|
+
ctx.canvas.drawPath(path, ctx.paint);
|
237
|
+
};
|
238
|
+
export const drawRect = (ctx, props) => {
|
239
|
+
"worklet";
|
240
|
+
|
241
|
+
const derived = processRect(ctx.Skia, props);
|
242
|
+
ctx.canvas.drawRect(derived, ctx.paint);
|
243
|
+
};
|
244
|
+
export const drawRRect = (ctx, props) => {
|
245
|
+
"worklet";
|
246
|
+
|
247
|
+
const derived = processRRect(ctx.Skia, props);
|
248
|
+
ctx.canvas.drawRRect(derived, ctx.paint);
|
249
|
+
};
|
250
|
+
export const drawTextBlob = (ctx, props) => {
|
251
|
+
"worklet";
|
252
|
+
|
253
|
+
const {
|
254
|
+
blob,
|
255
|
+
x,
|
256
|
+
y
|
257
|
+
} = props;
|
258
|
+
ctx.canvas.drawTextBlob(blob, x, y, ctx.paint);
|
259
|
+
};
|
260
|
+
export const drawGlyphs = (ctx, props) => {
|
261
|
+
"worklet";
|
262
|
+
|
263
|
+
const derived = props.glyphs.reduce((acc, glyph) => {
|
264
|
+
const {
|
265
|
+
id,
|
266
|
+
pos
|
267
|
+
} = glyph;
|
268
|
+
acc.glyphs.push(id);
|
269
|
+
acc.positions.push(pos);
|
270
|
+
return acc;
|
271
|
+
}, {
|
272
|
+
glyphs: [],
|
273
|
+
positions: []
|
274
|
+
});
|
275
|
+
const {
|
276
|
+
glyphs,
|
277
|
+
positions
|
278
|
+
} = derived;
|
279
|
+
const {
|
280
|
+
x,
|
281
|
+
y,
|
282
|
+
font
|
283
|
+
} = props;
|
284
|
+
if (font) {
|
285
|
+
ctx.canvas.drawGlyphs(glyphs, positions, x, y, font, ctx.paint);
|
286
|
+
}
|
287
|
+
};
|
288
|
+
export const drawImageSVG = (ctx, props) => {
|
289
|
+
"worklet";
|
290
|
+
|
291
|
+
const {
|
292
|
+
canvas
|
293
|
+
} = ctx;
|
294
|
+
const {
|
295
|
+
svg
|
296
|
+
} = props;
|
297
|
+
const {
|
298
|
+
x,
|
299
|
+
y,
|
300
|
+
width,
|
301
|
+
height
|
302
|
+
} = props.rect ? props.rect : {
|
303
|
+
x: props.x,
|
304
|
+
y: props.y,
|
305
|
+
width: props.width,
|
306
|
+
height: props.height
|
307
|
+
};
|
308
|
+
if (svg === null) {
|
309
|
+
return;
|
310
|
+
}
|
311
|
+
canvas.save();
|
312
|
+
if (x && y) {
|
313
|
+
canvas.translate(x, y);
|
314
|
+
}
|
315
|
+
canvas.drawSvg(svg, width, height);
|
316
|
+
canvas.restore();
|
317
|
+
};
|
318
|
+
export const drawParagraph = (ctx, props) => {
|
319
|
+
"worklet";
|
320
|
+
|
321
|
+
const {
|
322
|
+
paragraph,
|
323
|
+
x,
|
324
|
+
y,
|
325
|
+
width
|
326
|
+
} = props;
|
327
|
+
if (paragraph) {
|
328
|
+
paragraph.layout(width);
|
329
|
+
paragraph.paint(ctx.canvas, x, y);
|
330
|
+
}
|
331
|
+
};
|
332
|
+
export const drawPicture = (ctx, props) => {
|
333
|
+
"worklet";
|
334
|
+
|
335
|
+
const {
|
336
|
+
picture
|
337
|
+
} = props;
|
338
|
+
ctx.canvas.drawPicture(picture);
|
339
|
+
};
|
340
|
+
export const drawAtlas = (ctx, props) => {
|
341
|
+
"worklet";
|
342
|
+
|
343
|
+
const {
|
344
|
+
image,
|
345
|
+
sprites,
|
346
|
+
transforms,
|
347
|
+
colors,
|
348
|
+
blendMode
|
349
|
+
} = props;
|
350
|
+
const blend = blendMode ? BlendMode[enumKey(blendMode)] : undefined;
|
351
|
+
if (image) {
|
352
|
+
ctx.canvas.drawAtlas(image, sprites, transforms, ctx.paint, blend, colors);
|
353
|
+
}
|
354
|
+
};
|
355
|
+
export const drawCircle = (ctx, props) => {
|
356
|
+
"worklet";
|
357
|
+
|
358
|
+
const {
|
359
|
+
c
|
360
|
+
} = processCircle(props);
|
361
|
+
const {
|
362
|
+
r
|
363
|
+
} = props;
|
364
|
+
ctx.canvas.drawCircle(c.x, c.y, r, ctx.paint);
|
365
|
+
};
|
366
|
+
export const drawFill = (ctx, _props) => {
|
367
|
+
"worklet";
|
368
|
+
|
369
|
+
ctx.canvas.drawPaint(ctx.paint);
|
370
|
+
};
|
371
|
+
//# 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","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","_props","drawPaint"],"sources":["drawings.ts"],"sourcesContent":["import {\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 \"worklet\";\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 \"worklet\";\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 \"worklet\";\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 drawImage = (ctx: LocalDrawingContext, props: ImageProps) => {\n \"worklet\";\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 \"worklet\";\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 \"worklet\";\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 \"worklet\";\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 \"worklet\";\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 \"worklet\";\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 \"worklet\";\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 \"worklet\";\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 \"worklet\";\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 \"worklet\";\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 \"worklet\";\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 \"worklet\";\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 \"worklet\";\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 \"worklet\";\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 \"worklet\";\n const { picture } = props;\n ctx.canvas.drawPicture(picture);\n};\n\nexport const drawAtlas = (ctx: LocalDrawingContext, props: AtlasProps) => {\n \"worklet\";\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 \"worklet\";\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 \"worklet\";\n ctx.canvas.drawPaint(ctx.paint);\n};\n"],"mappings":"AAAA,SACEA,OAAO,EACPC,OAAO,EACPC,QAAQ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MAAM6E,KAAK,GAAGV,SAAS,GAAG7E,SAAS,CAACT,OAAO,CAACsF,SAAS,CAAC,CAAC,GAAGM,SAAS;EACnE,IAAIrB,KAAK,EAAE;IACTrD,GAAG,CAACI,MAAM,CAACmJ,SAAS,CAAClG,KAAK,EAAEmG,OAAO,EAAEC,UAAU,EAAEzJ,GAAG,CAACO,KAAK,EAAEuE,KAAK,EAAEZ,MAAM,CAAC;EAC5E;AACF,CAAC;AAED,OAAO,MAAMwF,UAAU,GAAGA,CAAC1J,GAAwB,EAAEC,KAAkB,KAAK;EAC1E,SAAS;;EACT,MAAM;IAAEwE;EAAE,CAAC,GAAGvF,aAAa,CAACe,KAAK,CAAC;EAClC,MAAM;IAAE0J;EAAE,CAAC,GAAG1J,KAAK;EACnBD,GAAG,CAACI,MAAM,CAACsJ,UAAU,CAACjF,CAAC,CAACpE,CAAC,EAAEoE,CAAC,CAACnE,CAAC,EAAEqJ,CAAC,EAAE3J,GAAG,CAACO,KAAK,CAAC;AAC/C,CAAC;AAED,OAAO,MAAMqJ,QAAQ,GAAGA,CACtB5J,GAAwB,EACxB6J,MAAwB,KACrB;EACH,SAAS;;EACT7J,GAAG,CAACI,MAAM,CAAC0J,SAAS,CAAC9J,GAAG,CAACO,KAAK,CAAC;AACjC,CAAC","ignoreList":[]}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
import type { BlendImageFilterProps, BlendProps, BlurImageFilterProps, BlurMaskFilterProps, DisplacementMapImageFilterProps, DropShadowImageFilterProps, MorphologyImageFilterProps, OffsetImageFilterProps, RuntimeShaderImageFilterProps } from "../../dom/types";
|
2
|
+
import type { SkImageFilter } from "../../skia/types";
|
3
|
+
import type { DeclarationContext } from "../DeclarationContext";
|
4
|
+
export declare enum MorphologyOperator {
|
5
|
+
Erode = 0,
|
6
|
+
Dilate = 1
|
7
|
+
}
|
8
|
+
export declare const declareBlend: (ctx: DeclarationContext, props: BlendProps) => void;
|
9
|
+
export declare const composeImageFilters: (ctx: DeclarationContext, imgf1: SkImageFilter, processChildren: () => void) => void;
|
10
|
+
export declare const makeOffsetImageFilter: (ctx: DeclarationContext, props: OffsetImageFilterProps) => SkImageFilter;
|
11
|
+
export declare const declareDisplacementMapImageFilter: (ctx: DeclarationContext, props: DisplacementMapImageFilterProps) => void;
|
12
|
+
export declare const makeBlurImageFilter: (ctx: DeclarationContext, props: BlurImageFilterProps) => SkImageFilter;
|
13
|
+
export declare const makeDropShadowImageFilter: (ctx: DeclarationContext, props: DropShadowImageFilterProps) => SkImageFilter;
|
14
|
+
export declare const makeMorphologyImageFilter: (ctx: DeclarationContext, props: MorphologyImageFilterProps) => SkImageFilter;
|
15
|
+
export declare const makeRuntimeShaderImageFilter: (ctx: DeclarationContext, props: RuntimeShaderImageFilterProps) => SkImageFilter;
|
16
|
+
export declare const declareBlendImageFilter: (ctx: DeclarationContext, props: BlendImageFilterProps) => void;
|
17
|
+
export declare const declareBlurMaskFilter: (ctx: DeclarationContext, props: BlurMaskFilterProps) => void;
|
@@ -0,0 +1,181 @@
|
|
1
|
+
import { enumKey, processRadius } from "../../dom/nodes";
|
2
|
+
import { BlendMode, BlurStyle, ColorChannel, processUniforms, TileMode } from "../../skia/types";
|
3
|
+
import { composeDeclarations } from "../DeclarationContext";
|
4
|
+
export let MorphologyOperator = /*#__PURE__*/function (MorphologyOperator) {
|
5
|
+
MorphologyOperator[MorphologyOperator["Erode"] = 0] = "Erode";
|
6
|
+
MorphologyOperator[MorphologyOperator["Dilate"] = 1] = "Dilate";
|
7
|
+
return MorphologyOperator;
|
8
|
+
}({});
|
9
|
+
const Black = Float32Array.of(0, 0, 0, 1);
|
10
|
+
const MakeInnerShadow = (Skia, shadowOnly, dx, dy, sigmaX, sigmaY, color, input) => {
|
11
|
+
"worklet";
|
12
|
+
|
13
|
+
const sourceGraphic = Skia.ImageFilter.MakeColorFilter(Skia.ColorFilter.MakeBlend(Black, BlendMode.Dst), null);
|
14
|
+
const sourceAlpha = Skia.ImageFilter.MakeColorFilter(Skia.ColorFilter.MakeBlend(Black, BlendMode.SrcIn), null);
|
15
|
+
const f1 = Skia.ImageFilter.MakeColorFilter(Skia.ColorFilter.MakeBlend(color, BlendMode.SrcOut), null);
|
16
|
+
const f2 = Skia.ImageFilter.MakeOffset(dx, dy, f1);
|
17
|
+
const f3 = Skia.ImageFilter.MakeBlur(sigmaX, sigmaY, TileMode.Decal, f2);
|
18
|
+
const f4 = Skia.ImageFilter.MakeBlend(BlendMode.SrcIn, sourceAlpha, f3);
|
19
|
+
if (shadowOnly) {
|
20
|
+
return f4;
|
21
|
+
}
|
22
|
+
return Skia.ImageFilter.MakeCompose(input, Skia.ImageFilter.MakeBlend(BlendMode.SrcOver, sourceGraphic, f4));
|
23
|
+
};
|
24
|
+
export const declareBlend = (ctx, props) => {
|
25
|
+
"worklet";
|
26
|
+
|
27
|
+
const {
|
28
|
+
Skia
|
29
|
+
} = ctx;
|
30
|
+
const blend = BlendMode[enumKey(props.mode)];
|
31
|
+
// Blend ImageFilters
|
32
|
+
const imageFilters = ctx.imageFilters.popAll();
|
33
|
+
if (imageFilters.length > 0) {
|
34
|
+
const composer = Skia.ImageFilter.MakeBlend.bind(Skia.ImageFilter, blend);
|
35
|
+
ctx.imageFilters.push(composeDeclarations(imageFilters, composer));
|
36
|
+
}
|
37
|
+
// Blend Shaders
|
38
|
+
const shaders = ctx.shaders.popAll();
|
39
|
+
if (shaders.length > 0) {
|
40
|
+
const composer = Skia.Shader.MakeBlend.bind(Skia.Shader, blend);
|
41
|
+
ctx.shaders.push(composeDeclarations(shaders, composer));
|
42
|
+
}
|
43
|
+
};
|
44
|
+
export const composeImageFilters = (ctx, imgf1, processChildren) => {
|
45
|
+
"worklet";
|
46
|
+
|
47
|
+
const {
|
48
|
+
Skia
|
49
|
+
} = ctx;
|
50
|
+
ctx.imageFilters.save();
|
51
|
+
ctx.colorFilters.save();
|
52
|
+
processChildren();
|
53
|
+
let imgf2 = ctx.imageFilters.popAllAsOne();
|
54
|
+
const cf = ctx.colorFilters.popAllAsOne();
|
55
|
+
ctx.imageFilters.restore();
|
56
|
+
ctx.colorFilters.restore();
|
57
|
+
if (cf) {
|
58
|
+
var _imgf;
|
59
|
+
imgf2 = Skia.ImageFilter.MakeCompose((_imgf = imgf2) !== null && _imgf !== void 0 ? _imgf : null, Skia.ImageFilter.MakeColorFilter(cf, null));
|
60
|
+
}
|
61
|
+
const imgf = imgf2 ? Skia.ImageFilter.MakeCompose(imgf1, imgf2) : imgf1;
|
62
|
+
ctx.imageFilters.push(imgf);
|
63
|
+
};
|
64
|
+
const input = ctx => {
|
65
|
+
"worklet";
|
66
|
+
|
67
|
+
var _ctx$imageFilters$pop;
|
68
|
+
return (_ctx$imageFilters$pop = ctx.imageFilters.pop()) !== null && _ctx$imageFilters$pop !== void 0 ? _ctx$imageFilters$pop : null;
|
69
|
+
};
|
70
|
+
export const makeOffsetImageFilter = (ctx, props) => {
|
71
|
+
"worklet";
|
72
|
+
|
73
|
+
const {
|
74
|
+
x,
|
75
|
+
y
|
76
|
+
} = props;
|
77
|
+
return ctx.Skia.ImageFilter.MakeOffset(x, y, null);
|
78
|
+
};
|
79
|
+
export const declareDisplacementMapImageFilter = (ctx, props) => {
|
80
|
+
"worklet";
|
81
|
+
|
82
|
+
const {
|
83
|
+
channelX,
|
84
|
+
channelY,
|
85
|
+
scale
|
86
|
+
} = props;
|
87
|
+
const shader = ctx.shaders.pop();
|
88
|
+
if (!shader) {
|
89
|
+
throw new Error("DisplacementMap expects a shader as child");
|
90
|
+
}
|
91
|
+
const map = ctx.Skia.ImageFilter.MakeShader(shader, null);
|
92
|
+
const imgf = ctx.Skia.ImageFilter.MakeDisplacementMap(ColorChannel[enumKey(channelX)], ColorChannel[enumKey(channelY)], scale, map, input(ctx));
|
93
|
+
ctx.imageFilters.push(imgf);
|
94
|
+
};
|
95
|
+
export const makeBlurImageFilter = (ctx, props) => {
|
96
|
+
"worklet";
|
97
|
+
|
98
|
+
const {
|
99
|
+
mode,
|
100
|
+
blur
|
101
|
+
} = props;
|
102
|
+
const sigma = processRadius(ctx.Skia, blur);
|
103
|
+
const imgf = ctx.Skia.ImageFilter.MakeBlur(sigma.x, sigma.y, TileMode[enumKey(mode)], input(ctx));
|
104
|
+
return imgf;
|
105
|
+
};
|
106
|
+
export const makeDropShadowImageFilter = (ctx, props) => {
|
107
|
+
"worklet";
|
108
|
+
|
109
|
+
const {
|
110
|
+
dx,
|
111
|
+
dy,
|
112
|
+
blur,
|
113
|
+
shadowOnly,
|
114
|
+
color: cl,
|
115
|
+
inner
|
116
|
+
} = props;
|
117
|
+
const color = ctx.Skia.Color(cl);
|
118
|
+
let factory;
|
119
|
+
if (inner) {
|
120
|
+
factory = MakeInnerShadow.bind(null, ctx.Skia, shadowOnly);
|
121
|
+
} else {
|
122
|
+
factory = shadowOnly ? ctx.Skia.ImageFilter.MakeDropShadowOnly.bind(ctx.Skia.ImageFilter) : ctx.Skia.ImageFilter.MakeDropShadow.bind(ctx.Skia.ImageFilter);
|
123
|
+
}
|
124
|
+
const imgf = factory(dx, dy, blur, blur, color, input(ctx));
|
125
|
+
return imgf;
|
126
|
+
};
|
127
|
+
export const makeMorphologyImageFilter = (ctx, props) => {
|
128
|
+
"worklet";
|
129
|
+
|
130
|
+
const {
|
131
|
+
operator
|
132
|
+
} = props;
|
133
|
+
const r = processRadius(ctx.Skia, props.radius);
|
134
|
+
let imgf;
|
135
|
+
if (MorphologyOperator[enumKey(operator)] === MorphologyOperator.Erode) {
|
136
|
+
imgf = ctx.Skia.ImageFilter.MakeErode(r.x, r.y, input(ctx));
|
137
|
+
} else {
|
138
|
+
imgf = ctx.Skia.ImageFilter.MakeDilate(r.x, r.y, input(ctx));
|
139
|
+
}
|
140
|
+
return imgf;
|
141
|
+
};
|
142
|
+
export const makeRuntimeShaderImageFilter = (ctx, props) => {
|
143
|
+
"worklet";
|
144
|
+
|
145
|
+
const {
|
146
|
+
source,
|
147
|
+
uniforms
|
148
|
+
} = props;
|
149
|
+
const rtb = ctx.Skia.RuntimeShaderBuilder(source);
|
150
|
+
if (uniforms) {
|
151
|
+
processUniforms(source, uniforms, rtb);
|
152
|
+
}
|
153
|
+
const imgf = ctx.Skia.ImageFilter.MakeRuntimeShader(rtb, null, input(ctx));
|
154
|
+
return imgf;
|
155
|
+
};
|
156
|
+
export const declareBlendImageFilter = (ctx, props) => {
|
157
|
+
"worklet";
|
158
|
+
|
159
|
+
const {
|
160
|
+
mode
|
161
|
+
} = props;
|
162
|
+
const a = ctx.imageFilters.pop();
|
163
|
+
const b = ctx.imageFilters.pop();
|
164
|
+
if (!a || !b) {
|
165
|
+
throw new Error("BlendImageFilter requires two image filters");
|
166
|
+
}
|
167
|
+
const imgf = ctx.Skia.ImageFilter.MakeBlend(mode, a, b);
|
168
|
+
ctx.imageFilters.push(imgf);
|
169
|
+
};
|
170
|
+
export const declareBlurMaskFilter = (ctx, props) => {
|
171
|
+
"worklet";
|
172
|
+
|
173
|
+
const {
|
174
|
+
blur,
|
175
|
+
style,
|
176
|
+
respectCTM
|
177
|
+
} = props;
|
178
|
+
const mf = ctx.Skia.MaskFilter.MakeBlur(BlurStyle[enumKey(style)], blur, respectCTM);
|
179
|
+
ctx.maskFilters.push(mf);
|
180
|
+
};
|
181
|
+
//# sourceMappingURL=imageFilters.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["enumKey","processRadius","BlendMode","BlurStyle","ColorChannel","processUniforms","TileMode","composeDeclarations","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","declareBlend","ctx","props","blend","mode","imageFilters","popAll","length","composer","bind","push","shaders","Shader","composeImageFilters","imgf1","processChildren","save","colorFilters","imgf2","popAllAsOne","cf","restore","_imgf","imgf","_ctx$imageFilters$pop","pop","makeOffsetImageFilter","x","y","declareDisplacementMapImageFilter","channelX","channelY","scale","shader","Error","map","MakeShader","MakeDisplacementMap","makeBlurImageFilter","blur","sigma","makeDropShadowImageFilter","cl","inner","Color","factory","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":["import { enumKey, processRadius } from \"../../dom/nodes\";\nimport type {\n BlendImageFilterProps,\n BlendProps,\n BlurImageFilterProps,\n BlurMaskFilterProps,\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\";\nimport type { DeclarationContext } from \"../DeclarationContext\";\nimport { composeDeclarations } from \"../DeclarationContext\";\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 \"worklet\";\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\nexport const declareBlend = (ctx: DeclarationContext, props: BlendProps) => {\n \"worklet\";\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(Skia.ImageFilter, blend);\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};\n\nexport const composeImageFilters = (\n ctx: DeclarationContext,\n imgf1: SkImageFilter,\n processChildren: () => void\n) => {\n \"worklet\";\n const { Skia } = ctx;\n ctx.imageFilters.save();\n ctx.colorFilters.save();\n processChildren();\n let imgf2 = ctx.imageFilters.popAllAsOne();\n const cf = ctx.colorFilters.popAllAsOne();\n ctx.imageFilters.restore();\n ctx.colorFilters.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\nconst input = (ctx: DeclarationContext) => {\n \"worklet\";\n return ctx.imageFilters.pop() ?? null;\n};\n\nexport const makeOffsetImageFilter = (\n ctx: DeclarationContext,\n props: OffsetImageFilterProps\n) => {\n \"worklet\";\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 \"worklet\";\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 \"worklet\";\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 \"worklet\";\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 \"worklet\";\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 \"worklet\";\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 \"worklet\";\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 \"worklet\";\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,SAASA,OAAO,EAAEC,aAAa,QAAQ,iBAAiB;AAaxD,SACEC,SAAS,EACTC,SAAS,EACTC,YAAY,EACZC,eAAe,EACfC,QAAQ,QACH,kBAAkB;AAEzB,SAASC,mBAAmB,QAAQ,uBAAuB;AAE3D,WAAYC,kBAAkB,0BAAlBA,kBAAkB;EAAlBA,kBAAkB,CAAlBA,kBAAkB;EAAlBA,kBAAkB,CAAlBA,kBAAkB;EAAA,OAAlBA,kBAAkB;AAAA;AAK9B,MAAMC,KAAK,GAAGC,YAAY,CAACC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;AAEzC,MAAMC,eAAe,GAAGA,CACtBC,IAAU,EACVC,UAA+B,EAC/BC,EAAU,EACVC,EAAU,EACVC,MAAc,EACdC,MAAc,EACdC,KA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,CAAC,GAAGhE,KAAK;EACzC,MAAMiE,EAAE,GAAGlE,GAAG,CAAC3B,IAAI,CAAC8F,UAAU,CAACzE,QAAQ,CACrC/B,SAAS,CAACH,OAAO,CAACwG,KAAK,CAAC,CAAC,EACzB1B,IAAI,EACJ2B,UACF,CAAC;EACDjE,GAAG,CAACoE,WAAW,CAAC3D,IAAI,CAACyD,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":[]}
|