@shopify/react-native-skia 0.1.172 → 0.1.173
Sign up to get free protection for your applications and to get access to all the features.
- package/android/CMakeLists.txt +1 -0
- package/android/cpp/rnskia-android/RNSkAndroidPlatformContext.h +5 -0
- package/android/cpp/rnskia-android/SkiaOpenGLRenderer.cpp +106 -5
- package/android/cpp/rnskia-android/SkiaOpenGLRenderer.h +3 -1
- package/cpp/api/JsiSkSurface.h +7 -1
- package/cpp/api/JsiSkSurfaceFactory.h +15 -2
- package/cpp/rnskia/RNSkDomView.cpp +2 -4
- package/cpp/rnskia/RNSkJsView.cpp +3 -0
- package/cpp/rnskia/RNSkPictureView.h +3 -0
- package/cpp/rnskia/RNSkPlatformContext.h +9 -0
- package/cpp/rnskia/dom/JsiDomApi.h +1 -0
- package/cpp/rnskia/dom/base/ConcatablePaint.cpp +117 -0
- package/cpp/rnskia/dom/base/ConcatablePaint.h +49 -0
- package/cpp/rnskia/dom/base/Declaration.h +88 -0
- package/cpp/rnskia/dom/base/DeclarationContext.h +79 -0
- package/cpp/rnskia/dom/base/DerivedNodeProp.h +25 -9
- package/cpp/rnskia/dom/base/DrawingContext.cpp +32 -186
- package/cpp/rnskia/dom/base/DrawingContext.h +45 -64
- package/cpp/rnskia/dom/base/JsiDomDeclarationNode.h +35 -106
- package/cpp/rnskia/dom/base/JsiDomDrawingNode.h +28 -9
- package/cpp/rnskia/dom/base/JsiDomNode.h +46 -17
- package/cpp/rnskia/dom/base/JsiDomRenderNode.h +81 -67
- package/cpp/rnskia/dom/base/NodeProp.h +12 -2
- package/cpp/rnskia/dom/base/NodePropsContainer.h +15 -16
- package/cpp/rnskia/dom/nodes/JsiBackdropFilterNode.h +22 -11
- package/cpp/rnskia/dom/nodes/JsiBlendNode.h +43 -59
- package/cpp/rnskia/dom/nodes/JsiBlurMaskNode.h +16 -17
- package/cpp/rnskia/dom/nodes/JsiBoxShadowNode.h +6 -5
- package/cpp/rnskia/dom/nodes/JsiColorFilterNodes.h +45 -69
- package/cpp/rnskia/dom/nodes/JsiGroupNode.h +1 -1
- package/cpp/rnskia/dom/nodes/JsiImageFilterNodes.h +121 -161
- package/cpp/rnskia/dom/nodes/JsiImageNode.h +1 -0
- package/cpp/rnskia/dom/nodes/JsiLayerNode.h +28 -18
- package/cpp/rnskia/dom/nodes/JsiPaintNode.h +82 -45
- package/cpp/rnskia/dom/nodes/JsiPathEffectNodes.h +68 -101
- package/cpp/rnskia/dom/nodes/JsiPathNode.h +3 -2
- package/cpp/rnskia/dom/nodes/JsiShaderNodes.h +150 -207
- package/cpp/rnskia/dom/props/BezierProps.h +4 -2
- package/cpp/rnskia/dom/props/BlendModeProp.h +4 -2
- package/cpp/rnskia/dom/props/BoxShadowProps.h +8 -10
- package/cpp/rnskia/dom/props/CircleProp.h +6 -5
- package/cpp/rnskia/dom/props/ClipProp.h +6 -4
- package/cpp/rnskia/dom/props/ColorProp.h +8 -4
- package/cpp/rnskia/dom/props/DrawingProp.h +5 -3
- package/cpp/rnskia/dom/props/FontProp.h +4 -2
- package/cpp/rnskia/dom/props/GlyphsProp.h +4 -2
- package/cpp/rnskia/dom/props/ImageProps.h +9 -6
- package/cpp/rnskia/dom/props/LayerProp.h +6 -4
- package/cpp/rnskia/dom/props/MatrixProp.h +4 -2
- package/cpp/rnskia/dom/props/NumbersProp.h +8 -4
- package/cpp/rnskia/dom/props/PaintProps.h +55 -92
- package/cpp/rnskia/dom/props/PathProp.h +4 -2
- package/cpp/rnskia/dom/props/PictureProp.h +4 -2
- package/cpp/rnskia/dom/props/PointProp.h +4 -2
- package/cpp/rnskia/dom/props/PointsProp.h +8 -4
- package/cpp/rnskia/dom/props/RRectProp.h +23 -16
- package/cpp/rnskia/dom/props/RadiusProp.h +4 -2
- package/cpp/rnskia/dom/props/RectProp.h +18 -12
- package/cpp/rnskia/dom/props/StrokeProps.h +8 -4
- package/cpp/rnskia/dom/props/SvgProp.h +4 -2
- package/cpp/rnskia/dom/props/TextBlobProp.h +10 -8
- package/cpp/rnskia/dom/props/TileModeProp.h +4 -2
- package/cpp/rnskia/dom/props/TransformProp.h +4 -2
- package/cpp/rnskia/dom/props/TransformsProps.h +5 -7
- package/cpp/rnskia/dom/props/UniformsProp.h +4 -2
- package/cpp/rnskia/dom/props/VertexModeProp.h +4 -2
- package/cpp/rnskia/dom/props/VerticesProps.h +7 -11
- package/ios/RNSkia-iOS/DisplayLink.mm +22 -24
- package/ios/RNSkia-iOS/RNSkMetalCanvasProvider.mm +53 -50
- package/ios/RNSkia-iOS/RNSkiOSPlatformContext.h +2 -0
- package/ios/RNSkia-iOS/RNSkiOSPlatformContext.mm +38 -25
- package/ios/RNSkia-iOS/SkiaDomViewManager.mm +17 -17
- package/ios/RNSkia-iOS/SkiaDrawViewManager.mm +17 -17
- package/ios/RNSkia-iOS/SkiaManager.mm +12 -10
- package/ios/RNSkia-iOS/SkiaMetalRenderer.h +5 -0
- package/ios/RNSkia-iOS/SkiaMetalRenderer.mm +53 -0
- package/ios/RNSkia-iOS/SkiaPictureViewManager.mm +17 -17
- package/ios/RNSkia-iOS/SkiaUIView.mm +63 -53
- package/ios/RNSkiaModule.mm +5 -7
- package/lib/commonjs/dom/nodes/DrawingNode.js +5 -1
- package/lib/commonjs/dom/nodes/DrawingNode.js.map +1 -1
- package/lib/commonjs/dom/nodes/JsiSkDOM.d.ts +33 -34
- package/lib/commonjs/dom/nodes/LayerNode.js +13 -6
- package/lib/commonjs/dom/nodes/LayerNode.js.map +1 -1
- package/lib/commonjs/dom/nodes/Node.d.ts +6 -11
- package/lib/commonjs/dom/nodes/Node.js +8 -26
- package/lib/commonjs/dom/nodes/Node.js.map +1 -1
- package/lib/commonjs/dom/nodes/PaintContext.js.map +1 -1
- package/lib/commonjs/dom/nodes/PaintNode.d.ts +3 -3
- package/lib/commonjs/dom/nodes/PaintNode.js +32 -15
- package/lib/commonjs/dom/nodes/PaintNode.js.map +1 -1
- package/lib/commonjs/dom/nodes/RenderNode.d.ts +2 -3
- package/lib/commonjs/dom/nodes/RenderNode.js +19 -187
- package/lib/commonjs/dom/nodes/RenderNode.js.map +1 -1
- package/lib/commonjs/dom/nodes/drawings/BackdropFilterNode.d.ts +1 -1
- package/lib/commonjs/dom/nodes/drawings/BackdropFilterNode.js +25 -7
- package/lib/commonjs/dom/nodes/drawings/BackdropFilterNode.js.map +1 -1
- package/lib/commonjs/dom/nodes/drawings/Box.d.ts +3 -1
- package/lib/commonjs/dom/nodes/drawings/Box.js +3 -0
- package/lib/commonjs/dom/nodes/drawings/Box.js.map +1 -1
- package/lib/commonjs/dom/nodes/paint/BlendNode.d.ts +3 -7
- package/lib/commonjs/dom/nodes/paint/BlendNode.js +16 -47
- package/lib/commonjs/dom/nodes/paint/BlendNode.js.map +1 -1
- package/lib/commonjs/dom/nodes/paint/ColorFilters.d.ts +10 -11
- package/lib/commonjs/dom/nodes/paint/ColorFilters.js +29 -43
- package/lib/commonjs/dom/nodes/paint/ColorFilters.js.map +1 -1
- package/lib/commonjs/dom/nodes/paint/ImageFilters.d.ts +11 -11
- package/lib/commonjs/dom/nodes/paint/ImageFilters.js +45 -42
- package/lib/commonjs/dom/nodes/paint/ImageFilters.js.map +1 -1
- package/lib/commonjs/dom/nodes/paint/MaskFilters.d.ts +3 -3
- package/lib/commonjs/dom/nodes/paint/MaskFilters.js +3 -2
- package/lib/commonjs/dom/nodes/paint/MaskFilters.js.map +1 -1
- package/lib/commonjs/dom/nodes/paint/PathEffects.d.ts +15 -18
- package/lib/commonjs/dom/nodes/paint/PathEffects.js +30 -72
- package/lib/commonjs/dom/nodes/paint/PathEffects.js.map +1 -1
- package/lib/commonjs/dom/nodes/paint/Shaders.d.ts +11 -12
- package/lib/commonjs/dom/nodes/paint/Shaders.js +28 -18
- package/lib/commonjs/dom/nodes/paint/Shaders.js.map +1 -1
- package/lib/commonjs/dom/types/DeclarationContext.d.ts +29 -0
- package/lib/commonjs/dom/types/DeclarationContext.js +118 -0
- package/lib/commonjs/dom/types/DeclarationContext.js.map +1 -0
- package/lib/commonjs/dom/types/DrawingContext.d.ts +18 -1
- package/lib/commonjs/dom/types/DrawingContext.js +330 -0
- package/lib/commonjs/dom/types/DrawingContext.js.map +1 -1
- package/lib/commonjs/dom/types/Node.d.ts +4 -10
- package/lib/commonjs/dom/types/Node.js.map +1 -1
- package/lib/commonjs/dom/types/SkDOM.d.ts +22 -23
- package/lib/commonjs/dom/types/SkDOM.js.map +1 -1
- package/lib/commonjs/dom/types/index.d.ts +1 -0
- package/lib/commonjs/dom/types/index.js +13 -0
- package/lib/commonjs/dom/types/index.js.map +1 -1
- package/lib/commonjs/index.d.ts +1 -0
- package/lib/commonjs/index.js +13 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/renderer/Canvas.js +3 -3
- package/lib/commonjs/renderer/Canvas.js.map +1 -1
- package/lib/commonjs/renderer/DrawingContext.d.ts +4 -3
- package/lib/commonjs/renderer/DrawingContext.js.map +1 -1
- package/lib/commonjs/renderer/HostComponents.d.ts +35 -35
- package/lib/commonjs/renderer/HostComponents.js.map +1 -1
- package/lib/commonjs/renderer/HostConfig.js +1 -0
- package/lib/commonjs/renderer/HostConfig.js.map +1 -1
- package/lib/commonjs/renderer/Offscreen.d.ts +2 -0
- package/lib/commonjs/renderer/Offscreen.js +31 -0
- package/lib/commonjs/renderer/Offscreen.js.map +1 -0
- package/lib/commonjs/renderer/Reconciler.js +0 -1
- package/lib/commonjs/renderer/Reconciler.js.map +1 -1
- package/lib/commonjs/skia/types/Surface/Surface.d.ts +4 -0
- package/lib/commonjs/skia/types/Surface/Surface.js.map +1 -1
- package/lib/commonjs/skia/types/Surface/SurfaceFactory.d.ts +6 -0
- package/lib/commonjs/skia/types/Surface/SurfaceFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkSurface.d.ts +1 -0
- package/lib/commonjs/skia/web/JsiSkSurface.js +4 -0
- package/lib/commonjs/skia/web/JsiSkSurface.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkSurfaceFactory.d.ts +2 -1
- package/lib/commonjs/skia/web/JsiSkSurfaceFactory.js +21 -1
- package/lib/commonjs/skia/web/JsiSkSurfaceFactory.js.map +1 -1
- package/lib/commonjs/views/SkiaBaseWebView.js +6 -4
- package/lib/commonjs/views/SkiaBaseWebView.js.map +1 -1
- package/lib/commonjs/views/SkiaDomView.web.js +3 -14
- package/lib/commonjs/views/SkiaDomView.web.js.map +1 -1
- package/lib/commonjs/views/SkiaPictureView.web.js +0 -7
- package/lib/commonjs/views/SkiaPictureView.web.js.map +1 -1
- package/lib/commonjs/views/SkiaView.web.js +0 -7
- package/lib/commonjs/views/SkiaView.web.js.map +1 -1
- package/lib/module/dom/nodes/DrawingNode.js +5 -1
- package/lib/module/dom/nodes/DrawingNode.js.map +1 -1
- package/lib/module/dom/nodes/JsiSkDOM.d.ts +33 -34
- package/lib/module/dom/nodes/LayerNode.js +13 -7
- package/lib/module/dom/nodes/LayerNode.js.map +1 -1
- package/lib/module/dom/nodes/Node.d.ts +6 -11
- package/lib/module/dom/nodes/Node.js +8 -25
- package/lib/module/dom/nodes/Node.js.map +1 -1
- package/lib/module/dom/nodes/PaintContext.js.map +1 -1
- package/lib/module/dom/nodes/PaintNode.d.ts +3 -3
- package/lib/module/dom/nodes/PaintNode.js +32 -15
- package/lib/module/dom/nodes/PaintNode.js.map +1 -1
- package/lib/module/dom/nodes/RenderNode.d.ts +2 -3
- package/lib/module/dom/nodes/RenderNode.js +20 -187
- package/lib/module/dom/nodes/RenderNode.js.map +1 -1
- package/lib/module/dom/nodes/drawings/BackdropFilterNode.d.ts +1 -1
- package/lib/module/dom/nodes/drawings/BackdropFilterNode.js +23 -4
- package/lib/module/dom/nodes/drawings/BackdropFilterNode.js.map +1 -1
- package/lib/module/dom/nodes/drawings/Box.d.ts +3 -1
- package/lib/module/dom/nodes/drawings/Box.js +3 -0
- package/lib/module/dom/nodes/drawings/Box.js.map +1 -1
- package/lib/module/dom/nodes/paint/BlendNode.d.ts +3 -7
- package/lib/module/dom/nodes/paint/BlendNode.js +15 -46
- package/lib/module/dom/nodes/paint/BlendNode.js.map +1 -1
- package/lib/module/dom/nodes/paint/ColorFilters.d.ts +10 -11
- package/lib/module/dom/nodes/paint/ColorFilters.js +29 -43
- package/lib/module/dom/nodes/paint/ColorFilters.js.map +1 -1
- package/lib/module/dom/nodes/paint/ImageFilters.d.ts +11 -11
- package/lib/module/dom/nodes/paint/ImageFilters.js +48 -41
- package/lib/module/dom/nodes/paint/ImageFilters.js.map +1 -1
- package/lib/module/dom/nodes/paint/MaskFilters.d.ts +3 -3
- package/lib/module/dom/nodes/paint/MaskFilters.js +3 -2
- package/lib/module/dom/nodes/paint/MaskFilters.js.map +1 -1
- package/lib/module/dom/nodes/paint/PathEffects.d.ts +15 -18
- package/lib/module/dom/nodes/paint/PathEffects.js +29 -72
- package/lib/module/dom/nodes/paint/PathEffects.js.map +1 -1
- package/lib/module/dom/nodes/paint/Shaders.d.ts +11 -12
- package/lib/module/dom/nodes/paint/Shaders.js +28 -18
- package/lib/module/dom/nodes/paint/Shaders.js.map +1 -1
- package/lib/module/dom/types/DeclarationContext.d.ts +29 -0
- package/lib/module/dom/types/DeclarationContext.js +107 -0
- package/lib/module/dom/types/DeclarationContext.js.map +1 -0
- package/lib/module/dom/types/DrawingContext.d.ts +18 -1
- package/lib/module/dom/types/DrawingContext.js +322 -1
- package/lib/module/dom/types/DrawingContext.js.map +1 -1
- package/lib/module/dom/types/Node.d.ts +4 -10
- package/lib/module/dom/types/Node.js.map +1 -1
- package/lib/module/dom/types/SkDOM.d.ts +22 -23
- package/lib/module/dom/types/SkDOM.js.map +1 -1
- package/lib/module/dom/types/index.d.ts +1 -0
- package/lib/module/dom/types/index.js +1 -0
- package/lib/module/dom/types/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 +3 -3
- package/lib/module/renderer/Canvas.js.map +1 -1
- package/lib/module/renderer/DrawingContext.d.ts +4 -3
- package/lib/module/renderer/DrawingContext.js.map +1 -1
- package/lib/module/renderer/HostComponents.d.ts +35 -35
- package/lib/module/renderer/HostComponents.js.map +1 -1
- package/lib/module/renderer/HostConfig.js +1 -0
- package/lib/module/renderer/HostConfig.js.map +1 -1
- package/lib/module/renderer/Offscreen.d.ts +2 -0
- package/lib/module/renderer/Offscreen.js +19 -0
- package/lib/module/renderer/Offscreen.js.map +1 -0
- package/lib/module/renderer/Reconciler.js +0 -1
- package/lib/module/renderer/Reconciler.js.map +1 -1
- package/lib/module/skia/types/Surface/Surface.d.ts +4 -0
- package/lib/module/skia/types/Surface/Surface.js.map +1 -1
- package/lib/module/skia/types/Surface/SurfaceFactory.d.ts +6 -0
- package/lib/module/skia/types/Surface/SurfaceFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkSurface.d.ts +1 -0
- package/lib/module/skia/web/JsiSkSurface.js +4 -0
- package/lib/module/skia/web/JsiSkSurface.js.map +1 -1
- package/lib/module/skia/web/JsiSkSurfaceFactory.d.ts +2 -1
- package/lib/module/skia/web/JsiSkSurfaceFactory.js +21 -1
- package/lib/module/skia/web/JsiSkSurfaceFactory.js.map +1 -1
- package/lib/module/views/SkiaBaseWebView.js +6 -4
- package/lib/module/views/SkiaBaseWebView.js.map +1 -1
- package/lib/module/views/SkiaDomView.web.js +2 -11
- package/lib/module/views/SkiaDomView.web.js.map +1 -1
- package/lib/module/views/SkiaPictureView.web.js +0 -5
- package/lib/module/views/SkiaPictureView.web.js.map +1 -1
- package/lib/module/views/SkiaView.web.js +0 -5
- package/lib/module/views/SkiaView.web.js.map +1 -1
- package/lib/typescript/src/dom/nodes/JsiSkDOM.d.ts +33 -34
- package/lib/typescript/src/dom/nodes/Node.d.ts +6 -11
- package/lib/typescript/src/dom/nodes/PaintNode.d.ts +3 -3
- package/lib/typescript/src/dom/nodes/RenderNode.d.ts +2 -3
- package/lib/typescript/src/dom/nodes/drawings/BackdropFilterNode.d.ts +1 -1
- package/lib/typescript/src/dom/nodes/drawings/Box.d.ts +3 -1
- package/lib/typescript/src/dom/nodes/paint/BlendNode.d.ts +3 -7
- package/lib/typescript/src/dom/nodes/paint/ColorFilters.d.ts +10 -11
- package/lib/typescript/src/dom/nodes/paint/ImageFilters.d.ts +11 -11
- package/lib/typescript/src/dom/nodes/paint/MaskFilters.d.ts +3 -3
- package/lib/typescript/src/dom/nodes/paint/PathEffects.d.ts +15 -18
- package/lib/typescript/src/dom/nodes/paint/Shaders.d.ts +11 -12
- package/lib/typescript/src/dom/types/DeclarationContext.d.ts +29 -0
- package/lib/typescript/src/dom/types/DrawingContext.d.ts +18 -1
- package/lib/typescript/src/dom/types/Node.d.ts +4 -10
- package/lib/typescript/src/dom/types/SkDOM.d.ts +22 -23
- package/lib/typescript/src/dom/types/index.d.ts +1 -0
- package/lib/typescript/src/index.d.ts +1 -0
- package/lib/typescript/src/renderer/DrawingContext.d.ts +4 -3
- package/lib/typescript/src/renderer/HostComponents.d.ts +35 -35
- package/lib/typescript/src/renderer/Offscreen.d.ts +2 -0
- package/lib/typescript/src/skia/types/Surface/Surface.d.ts +4 -0
- package/lib/typescript/src/skia/types/Surface/SurfaceFactory.d.ts +6 -0
- package/lib/typescript/src/skia/web/JsiSkSurface.d.ts +1 -0
- package/lib/typescript/src/skia/web/JsiSkSurfaceFactory.d.ts +2 -1
- package/package.json +1 -1
- package/src/dom/nodes/DrawingNode.ts +5 -1
- package/src/dom/nodes/LayerNode.ts +13 -11
- package/src/dom/nodes/Node.ts +18 -41
- package/src/dom/nodes/PaintContext.ts +1 -0
- package/src/dom/nodes/PaintNode.ts +28 -18
- package/src/dom/nodes/RenderNode.ts +25 -183
- package/src/dom/nodes/drawings/BackdropFilterNode.ts +18 -11
- package/src/dom/nodes/drawings/Box.ts +6 -4
- package/src/dom/nodes/paint/BlendNode.ts +16 -63
- package/src/dom/nodes/paint/ColorFilters.ts +32 -55
- package/src/dom/nodes/paint/ImageFilters.ts +58 -53
- package/src/dom/nodes/paint/MaskFilters.ts +5 -7
- package/src/dom/nodes/paint/PathEffects.ts +37 -90
- package/src/dom/nodes/paint/Shaders.ts +31 -29
- package/src/dom/types/DeclarationContext.ts +105 -0
- package/src/dom/types/DrawingContext.ts +304 -1
- package/src/dom/types/Node.ts +4 -20
- package/src/dom/types/SkDOM.ts +22 -43
- package/src/dom/types/index.ts +1 -0
- package/src/index.ts +1 -0
- package/src/renderer/Canvas.tsx +3 -3
- package/src/renderer/DrawingContext.ts +4 -5
- package/src/renderer/HostComponents.ts +34 -53
- package/src/renderer/HostConfig.ts +1 -0
- package/src/renderer/Offscreen.tsx +24 -0
- package/src/renderer/Reconciler.tsx +0 -1
- package/src/skia/types/Surface/Surface.ts +5 -0
- package/src/skia/types/Surface/SurfaceFactory.ts +7 -0
- package/src/skia/web/JsiSkSurface.ts +4 -0
- package/src/skia/web/JsiSkSurfaceFactory.ts +21 -2
- package/src/views/SkiaBaseWebView.tsx +6 -2
- package/src/views/SkiaDomView.web.tsx +2 -13
- package/src/views/SkiaPictureView.web.tsx +0 -7
- package/src/views/SkiaView.web.tsx +0 -7
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["inflate","Skia","box","dx","dy","tx","ty","RRectXY","XYWHRect","rect","x","y","width","height","rx","ry","deflate","BoxShadowNode","JsiDeclarationNode","constructor","ctx","props","DeclarationType","Unknown","NodeType","BoxShadow","materialize","BoxNode","JsiRenderNode","Box","renderNode","canvas","paint","defaultBox","opacity","getAlphaf","isRRect","shadows","_children","map","node","filter","n","shadow","inner","color","blur","spread","lPaint","Paint","setColor","Color","setAlphaf","setMaskFilter","MaskFilter","MakeBlur","BlurStyle","Normal","drawRRect","delta","Point","Math","abs","save","clipRRect","ClipOp","Intersect","outer","drawDRRect","restore"],"sources":["Box.ts"],"sourcesContent":["import type { SkRRect, Skia } from \"../../../skia/types\";\nimport { BlurStyle, ClipOp, isRRect } from \"../../../skia/types\";\nimport type { DrawingContext } from \"../../types\";\nimport { DeclarationType, NodeType } from \"../../types\";\nimport type { BoxShadowProps, BoxProps } from \"../../types/Drawings\";\nimport type { NodeContext } from \"../Node\";\nimport { JsiDeclarationNode } from \"../Node\";\nimport { JsiRenderNode } from \"../RenderNode\";\n\nconst inflate = (\n Skia: Skia,\n box: SkRRect,\n dx: number,\n dy: number,\n tx = 0,\n ty = 0\n) =>\n Skia.RRectXY(\n Skia.XYWHRect(\n box.rect.x - dx + tx,\n box.rect.y - dy + ty,\n box.rect.width + 2 * dx,\n box.rect.height + 2 * dy\n ),\n box.rx + dx,\n box.ry + dy\n );\n\nconst deflate = (\n Skia: Skia,\n box: SkRRect,\n dx: number,\n dy: number,\n tx = 0,\n ty = 0\n) => inflate(Skia, box, -dx, -dy, tx, ty);\n\nexport class BoxShadowNode extends JsiDeclarationNode
|
1
|
+
{"version":3,"names":["inflate","Skia","box","dx","dy","tx","ty","RRectXY","XYWHRect","rect","x","y","width","height","rx","ry","deflate","BoxShadowNode","JsiDeclarationNode","constructor","ctx","props","DeclarationType","Unknown","NodeType","BoxShadow","decorate","_ctx","materialize","BoxNode","JsiRenderNode","Box","renderNode","canvas","paint","defaultBox","opacity","getAlphaf","isRRect","shadows","_children","map","node","filter","n","shadow","inner","color","blur","spread","lPaint","Paint","setColor","Color","setAlphaf","setMaskFilter","MaskFilter","MakeBlur","BlurStyle","Normal","drawRRect","delta","Point","Math","abs","save","clipRRect","ClipOp","Intersect","outer","drawDRRect","restore"],"sources":["Box.ts"],"sourcesContent":["import type { SkRRect, Skia } from \"../../../skia/types\";\nimport { BlurStyle, ClipOp, isRRect } from \"../../../skia/types\";\nimport type { DrawingContext } from \"../../types\";\nimport { DeclarationType, NodeType } from \"../../types\";\nimport type { BoxShadowProps, BoxProps } from \"../../types/Drawings\";\nimport type { NodeContext } from \"../Node\";\nimport { JsiDeclarationNode } from \"../Node\";\nimport { JsiRenderNode } from \"../RenderNode\";\nimport type { DeclarationContext } from \"../../types/DeclarationContext\";\n\nconst inflate = (\n Skia: Skia,\n box: SkRRect,\n dx: number,\n dy: number,\n tx = 0,\n ty = 0\n) =>\n Skia.RRectXY(\n Skia.XYWHRect(\n box.rect.x - dx + tx,\n box.rect.y - dy + ty,\n box.rect.width + 2 * dx,\n box.rect.height + 2 * dy\n ),\n box.rx + dx,\n box.ry + dy\n );\n\nconst deflate = (\n Skia: Skia,\n box: SkRRect,\n dx: number,\n dy: number,\n tx = 0,\n ty = 0\n) => inflate(Skia, box, -dx, -dy, tx, ty);\n\nexport class BoxShadowNode extends JsiDeclarationNode<BoxShadowProps> {\n constructor(ctx: NodeContext, props: BoxShadowProps) {\n super(ctx, DeclarationType.Unknown, NodeType.BoxShadow, props);\n }\n\n decorate(_ctx: DeclarationContext) {\n // do nothing\n }\n\n materialize() {\n return this.props;\n }\n}\n\nexport class BoxNode extends JsiRenderNode<BoxProps> {\n constructor(ctx: NodeContext, props: BoxProps) {\n super(ctx, NodeType.Box, props);\n }\n\n renderNode({ canvas, paint }: DrawingContext) {\n const { box: defaultBox } = this.props;\n const opacity = paint.getAlphaf();\n const box = isRRect(defaultBox)\n ? defaultBox\n : this.Skia.RRectXY(defaultBox, 0, 0);\n const shadows = this._children\n .map((node) => {\n if (node instanceof BoxShadowNode) {\n return node.materialize();\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 = this.Skia.Paint();\n lPaint.setColor(this.Skia.Color(color));\n lPaint.setAlphaf(paint.getAlphaf() * opacity);\n lPaint.setMaskFilter(\n this.Skia.MaskFilter.MakeBlur(BlurStyle.Normal, blur, true)\n );\n canvas.drawRRect(\n inflate(this.Skia, box, spread, spread, dx, dy),\n lPaint\n );\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 = this.Skia.Point(10 + Math.abs(dx), 10 + Math.abs(dy));\n canvas.save();\n canvas.clipRRect(box, ClipOp.Intersect, false);\n const lPaint = this.Skia.Paint();\n lPaint.setColor(this.Skia.Color(color));\n lPaint.setAlphaf(paint.getAlphaf() * opacity);\n\n lPaint.setMaskFilter(\n this.Skia.MaskFilter.MakeBlur(BlurStyle.Normal, blur, true)\n );\n const inner = deflate(this.Skia, box, spread, spread, dx, dy);\n const outer = inflate(this.Skia, box, delta.x, delta.y);\n canvas.drawDRRect(outer, inner, lPaint);\n canvas.restore();\n });\n }\n}\n"],"mappings":";;;;;;;AACA;;AAEA;;AAGA;;AACA;;AAGA,MAAMA,OAAO,GAAG,UACdC,IADc,EAEdC,GAFc,EAGdC,EAHc,EAIdC,EAJc;EAAA,IAKdC,EALc,uEAKT,CALS;EAAA,IAMdC,EANc,uEAMT,CANS;EAAA,OAQdL,IAAI,CAACM,OAAL,CACEN,IAAI,CAACO,QAAL,CACEN,GAAG,CAACO,IAAJ,CAASC,CAAT,GAAaP,EAAb,GAAkBE,EADpB,EAEEH,GAAG,CAACO,IAAJ,CAASE,CAAT,GAAaP,EAAb,GAAkBE,EAFpB,EAGEJ,GAAG,CAACO,IAAJ,CAASG,KAAT,GAAiB,IAAIT,EAHvB,EAIED,GAAG,CAACO,IAAJ,CAASI,MAAT,GAAkB,IAAIT,EAJxB,CADF,EAOEF,GAAG,CAACY,EAAJ,GAASX,EAPX,EAQED,GAAG,CAACa,EAAJ,GAASX,EARX,CARc;AAAA,CAAhB;;AAmBA,MAAMY,OAAO,GAAG,UACdf,IADc,EAEdC,GAFc,EAGdC,EAHc,EAIdC,EAJc;EAAA,IAKdC,EALc,uEAKT,CALS;EAAA,IAMdC,EANc,uEAMT,CANS;EAAA,OAOXN,OAAO,CAACC,IAAD,EAAOC,GAAP,EAAY,CAACC,EAAb,EAAiB,CAACC,EAAlB,EAAsBC,EAAtB,EAA0BC,EAA1B,CAPI;AAAA,CAAhB;;AASO,MAAMW,aAAN,SAA4BC,wBAA5B,CAA+D;EACpEC,WAAW,CAACC,GAAD,EAAmBC,K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AG,MAAM,CAACI,SAAP,CAAiBpB,KAAK,CAACG,SAAN,KAAoBD,OAArC;MAEAc,MAAM,CAACK,aAAP,CACE,KAAKtD,IAAL,CAAUuD,UAAV,CAAqBC,QAArB,CAA8BC,gBAAA,CAAUC,MAAxC,EAAgDX,IAAhD,EAAsD,IAAtD,CADF;MAGA,MAAMF,KAAK,GAAG9B,OAAO,CAAC,KAAKf,IAAN,EAAYC,GAAZ,EAAiB+C,MAAjB,EAAyBA,MAAzB,EAAiC9C,EAAjC,EAAqCC,EAArC,CAArB;MACA,MAAMiE,KAAK,GAAGrE,OAAO,CAAC,KAAKC,IAAN,EAAYC,GAAZ,EAAiB2D,KAAK,CAACnD,CAAvB,EAA0BmD,KAAK,CAAClD,CAAhC,CAArB;MACAsB,MAAM,CAACqC,UAAP,CAAkBD,KAAlB,EAAyBvB,KAAzB,EAAgCI,MAAhC;MACAjB,MAAM,CAACsC,OAAP;IACD,CAlBH;EAmBD;;AAxDkD"}
|
@@ -1,12 +1,8 @@
|
|
1
1
|
import type { BlendProps } from "../../types/ImageFilters";
|
2
|
-
import type { SkShader, SkImageFilter } from "../../../skia/types";
|
3
2
|
import type { NodeContext } from "../Node";
|
4
3
|
import { JsiDeclarationNode } from "../Node";
|
5
|
-
import type {
|
6
|
-
export declare class BlendNode extends JsiDeclarationNode<BlendProps
|
4
|
+
import type { DeclarationContext } from "../../types/DeclarationContext";
|
5
|
+
export declare class BlendNode extends JsiDeclarationNode<BlendProps> {
|
7
6
|
constructor(ctx: NodeContext, props: BlendProps);
|
8
|
-
|
9
|
-
addChild(child: Node<unknown>): void;
|
10
|
-
insertChildBefore(child: Node<unknown>, before: Node<unknown>): void;
|
11
|
-
materialize(): SkImageFilter | SkShader;
|
7
|
+
decorate(ctx: DeclarationContext): void;
|
12
8
|
}
|
@@ -13,66 +13,35 @@ var _Node = require("../Node");
|
|
13
13
|
|
14
14
|
var _datatypes = require("../datatypes");
|
15
15
|
|
16
|
-
var
|
17
|
-
|
18
|
-
var _Shaders = require("./Shaders");
|
16
|
+
var _DeclarationContext = require("../../types/DeclarationContext");
|
19
17
|
|
20
18
|
class BlendNode extends _Node.JsiDeclarationNode {
|
21
19
|
constructor(ctx, props) {
|
22
20
|
super(ctx, _NodeType.DeclarationType.ImageFilter, _NodeType.NodeType.Blend, props);
|
23
21
|
}
|
24
22
|
|
25
|
-
|
26
|
-
|
27
|
-
if (child.declarationType === _NodeType.DeclarationType.ImageFilter) {
|
28
|
-
this.declarationType = _NodeType.DeclarationType.ImageFilter;
|
29
|
-
} else {
|
30
|
-
this.declarationType = _NodeType.DeclarationType.Shader;
|
31
|
-
}
|
32
|
-
}
|
33
|
-
}
|
34
|
-
|
35
|
-
addChild(child) {
|
36
|
-
if (!(child instanceof _Node.JsiDeclarationNode) || child.declarationType !== _NodeType.DeclarationType.Shader && child.declarationType !== _NodeType.DeclarationType.ImageFilter) {
|
37
|
-
throw new Error(`Cannot add child of type ${child.type} to ${this.type}`);
|
38
|
-
}
|
39
|
-
|
40
|
-
this.checkChild(child);
|
41
|
-
super.addChild(child);
|
42
|
-
}
|
43
|
-
|
44
|
-
insertChildBefore(child, before) {
|
45
|
-
if (!(child instanceof _ImageFilters.ImageFilterDeclaration) || !(child instanceof _Shaders.ShaderDeclaration)) {
|
46
|
-
throw new Error(`Cannot add child of type ${child.type} to ${this.type}`);
|
47
|
-
}
|
48
|
-
|
49
|
-
this.checkChild(child);
|
50
|
-
super.insertChildBefore(child, before);
|
51
|
-
}
|
52
|
-
|
53
|
-
materialize() {
|
23
|
+
decorate(ctx) {
|
24
|
+
this.decorateChildren(ctx);
|
54
25
|
const {
|
55
26
|
Skia
|
56
27
|
} = this;
|
57
28
|
|
58
|
-
const blend = _types.BlendMode[(0, _datatypes.enumKey)(this.props.mode)];
|
29
|
+
const blend = _types.BlendMode[(0, _datatypes.enumKey)(this.props.mode)]; // Blend ImageFilters
|
30
|
+
|
31
|
+
|
32
|
+
const imageFilters = ctx.imageFilters.popAll();
|
33
|
+
|
34
|
+
if (imageFilters.length > 0) {
|
35
|
+
const composer = Skia.ImageFilter.MakeBlend.bind(Skia.ImageFilter, blend);
|
36
|
+
ctx.imageFilters.push((0, _DeclarationContext.composeDeclarations)(imageFilters, composer));
|
37
|
+
} // Blend Shaders
|
59
38
|
|
60
|
-
if (this.declarationType === _NodeType.DeclarationType.ImageFilter) {
|
61
|
-
return this._children.reverse().reduce((inner, outer) => {
|
62
|
-
if (inner === null) {
|
63
|
-
return outer.materialize();
|
64
|
-
}
|
65
39
|
|
66
|
-
|
67
|
-
}, null);
|
68
|
-
} else {
|
69
|
-
return this._children.reverse().reduce((inner, outer) => {
|
70
|
-
if (inner === null) {
|
71
|
-
return outer.materialize();
|
72
|
-
}
|
40
|
+
const shaders = ctx.shaders.popAll();
|
73
41
|
|
74
|
-
|
75
|
-
|
42
|
+
if (shaders.length > 0) {
|
43
|
+
const composer = Skia.Shader.MakeBlend.bind(Skia.Shader, blend);
|
44
|
+
ctx.shaders.push((0, _DeclarationContext.composeDeclarations)(shaders, composer));
|
76
45
|
}
|
77
46
|
}
|
78
47
|
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["BlendNode","JsiDeclarationNode","constructor","ctx","props","DeclarationType","ImageFilter","NodeType","Blend","
|
1
|
+
{"version":3,"names":["BlendNode","JsiDeclarationNode","constructor","ctx","props","DeclarationType","ImageFilter","NodeType","Blend","decorate","decorateChildren","Skia","blend","BlendMode","enumKey","mode","imageFilters","popAll","length","composer","MakeBlend","bind","push","composeDeclarations","shaders","Shader"],"sources":["BlendNode.ts"],"sourcesContent":["import type { BlendProps } from \"../../types/ImageFilters\";\nimport { BlendMode } from \"../../../skia/types\";\nimport { DeclarationType, NodeType } from \"../../types/NodeType\";\nimport type { NodeContext } from \"../Node\";\nimport { JsiDeclarationNode } from \"../Node\";\nimport { enumKey } from \"../datatypes\";\nimport type { DeclarationContext } from \"../../types/DeclarationContext\";\nimport { composeDeclarations } from \"../../types/DeclarationContext\";\n\nexport class BlendNode extends JsiDeclarationNode<BlendProps> {\n constructor(ctx: NodeContext, props: BlendProps) {\n super(ctx, DeclarationType.ImageFilter, NodeType.Blend, props);\n }\n\n decorate(ctx: DeclarationContext) {\n this.decorateChildren(ctx);\n const { Skia } = this;\n const blend = BlendMode[enumKey(this.props.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}\n"],"mappings":";;;;;;;AACA;;AACA;;AAEA;;AACA;;AAEA;;AAEO,MAAMA,SAAN,SAAwBC,wBAAxB,CAAuD;EAC5DC,WAAW,CAACC,GAAD,EAAmBC,KAAnB,EAAsC;IAC/C,MAAMD,GAAN,EAAWE,yBAAA,CAAgBC,WAA3B,EAAwCC,kBAAA,CAASC,KAAjD,EAAwDJ,KAAxD;EACD;;EAEDK,QAAQ,CAACN,GAAD,EAA0B;IAChC,KAAKO,gBAAL,CAAsBP,GAAtB;IACA,MAAM;MAAEQ;IAAF,IAAW,IAAjB;;IACA,MAAMC,KAAK,GAAGC,gBAAA,CAAU,IAAAC,kBAAA,EAAQ,KAAKV,KAAL,CAAWW,IAAnB,CAAV,CAAd,CAHgC,CAIhC;;;IACA,MAAMC,YAAY,GAAGb,GAAG,CAACa,YAAJ,CAAiBC,MAAjB,EAArB;;IACA,IAAID,YAAY,CAACE,MAAb,GAAsB,CAA1B,EAA6B;MAC3B,MAAMC,QAAQ,GAAGR,IAAI,CAACL,WAAL,CAAiBc,SAAjB,CAA2BC,IAA3B,CAAgCV,IAAI,CAACL,WAArC,EAAkDM,KAAlD,CAAjB;MACAT,GAAG,CAACa,YAAJ,CAAiBM,IAAjB,CAAsB,IAAAC,uCAAA,EAAoBP,YAApB,EAAkCG,QAAlC,CAAtB;IACD,CAT+B,CAUhC;;;IACA,MAAMK,OAAO,GAAGrB,GAAG,CAACqB,OAAJ,CAAYP,MAAZ,EAAhB;;IACA,IAAIO,OAAO,CAACN,MAAR,GAAiB,CAArB,EAAwB;MACtB,MAAMC,QAAQ,GAAGR,IAAI,CAACc,MAAL,CAAYL,SAAZ,CAAsBC,IAAtB,CAA2BV,IAAI,CAACc,MAAhC,EAAwCb,KAAxC,CAAjB;MACAT,GAAG,CAACqB,OAAJ,CAAYF,IAAZ,CAAiB,IAAAC,uCAAA,EAAoBC,OAApB,EAA6BL,QAA7B,CAAjB;IACD;EACF;;AArB2D"}
|
@@ -1,36 +1,35 @@
|
|
1
1
|
import type { SkColorFilter } from "../../../skia/types";
|
2
2
|
import type { NodeContext } from "../Node";
|
3
3
|
import { JsiDeclarationNode } from "../Node";
|
4
|
-
import type { BlendColorFilterProps, MatrixColorFilterProps
|
4
|
+
import type { BlendColorFilterProps, MatrixColorFilterProps } from "../../types";
|
5
5
|
import { NodeType } from "../../types";
|
6
6
|
import type { LerpColorFilterProps } from "../../types/ColorFilters";
|
7
|
-
|
7
|
+
import type { DeclarationContext } from "../../types/DeclarationContext";
|
8
|
+
export declare abstract class ColorFilterDeclaration<P> extends JsiDeclarationNode<P> {
|
8
9
|
constructor(ctx: NodeContext, type: NodeType, props: P);
|
9
|
-
|
10
|
-
insertChildBefore(child: Node<unknown>, before: Node<unknown>): void;
|
11
|
-
compose(filter: SkColorFilter): SkColorFilter;
|
10
|
+
protected composeAndPush(ctx: DeclarationContext, cf1: SkColorFilter): void;
|
12
11
|
}
|
13
12
|
export declare class MatrixColorFilterNode extends ColorFilterDeclaration<MatrixColorFilterProps> {
|
14
13
|
constructor(ctx: NodeContext, props: MatrixColorFilterProps);
|
15
|
-
|
14
|
+
decorate(ctx: DeclarationContext): void;
|
16
15
|
}
|
17
16
|
export declare class BlendColorFilterNode extends ColorFilterDeclaration<BlendColorFilterProps> {
|
18
17
|
constructor(ctx: NodeContext, props: BlendColorFilterProps);
|
19
|
-
|
18
|
+
decorate(ctx: DeclarationContext): void;
|
20
19
|
}
|
21
20
|
export declare class LinearToSRGBGammaColorFilterNode extends ColorFilterDeclaration<null> {
|
22
21
|
constructor(ctx: NodeContext);
|
23
|
-
|
22
|
+
decorate(ctx: DeclarationContext): void;
|
24
23
|
}
|
25
24
|
export declare class SRGBToLinearGammaColorFilterNode extends ColorFilterDeclaration<null> {
|
26
25
|
constructor(ctx: NodeContext);
|
27
|
-
|
26
|
+
decorate(ctx: DeclarationContext): void;
|
28
27
|
}
|
29
28
|
export declare class LumaColorFilterNode extends ColorFilterDeclaration<null> {
|
30
29
|
constructor(ctx: NodeContext);
|
31
|
-
|
30
|
+
decorate(ctx: DeclarationContext): void;
|
32
31
|
}
|
33
32
|
export declare class LerpColorFilterNode extends ColorFilterDeclaration<LerpColorFilterProps> {
|
34
33
|
constructor(ctx: NodeContext, props: LerpColorFilterProps);
|
35
|
-
|
34
|
+
decorate(ctx: DeclarationContext): void;
|
36
35
|
}
|
@@ -18,36 +18,13 @@ class ColorFilterDeclaration extends _Node.JsiDeclarationNode {
|
|
18
18
|
super(ctx, _types2.DeclarationType.ColorFilter, type, props);
|
19
19
|
}
|
20
20
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
insertChildBefore(child, before) {
|
30
|
-
if (!(child instanceof ColorFilterDeclaration)) {
|
31
|
-
throw new Error(`Cannot add child of type ${child.type} to ${this.type}`);
|
32
|
-
}
|
33
|
-
|
34
|
-
super.insertChildBefore(child, before);
|
35
|
-
}
|
36
|
-
|
37
|
-
compose(filter) {
|
38
|
-
const children = this._children;
|
39
|
-
|
40
|
-
if (this._children.length === 0) {
|
41
|
-
return filter;
|
42
|
-
} else {
|
43
|
-
return this.Skia.ColorFilter.MakeCompose(filter, children.reduce((acc, child) => {
|
44
|
-
if (acc === null) {
|
45
|
-
return child.materialize();
|
46
|
-
}
|
47
|
-
|
48
|
-
return this.Skia.ColorFilter.MakeCompose(acc, child.materialize());
|
49
|
-
}, null));
|
50
|
-
}
|
21
|
+
composeAndPush(ctx, cf1) {
|
22
|
+
ctx.save();
|
23
|
+
this.decorateChildren(ctx);
|
24
|
+
const cf2 = ctx.colorFilters.popAllAsOne();
|
25
|
+
ctx.restore();
|
26
|
+
const cf = cf2 ? this.Skia.ColorFilter.MakeCompose(cf1, cf2) : cf1;
|
27
|
+
ctx.colorFilters.push(cf);
|
51
28
|
}
|
52
29
|
|
53
30
|
}
|
@@ -59,12 +36,12 @@ class MatrixColorFilterNode extends ColorFilterDeclaration {
|
|
59
36
|
super(ctx, _types2.NodeType.MatrixColorFilter, props);
|
60
37
|
}
|
61
38
|
|
62
|
-
|
39
|
+
decorate(ctx) {
|
63
40
|
const {
|
64
41
|
matrix
|
65
42
|
} = this.props;
|
66
43
|
const cf = this.Skia.ColorFilter.MakeMatrix(matrix);
|
67
|
-
|
44
|
+
this.composeAndPush(ctx, cf);
|
68
45
|
}
|
69
46
|
|
70
47
|
}
|
@@ -76,13 +53,13 @@ class BlendColorFilterNode extends ColorFilterDeclaration {
|
|
76
53
|
super(ctx, _types2.NodeType.BlendColorFilter, props);
|
77
54
|
}
|
78
55
|
|
79
|
-
|
56
|
+
decorate(ctx) {
|
80
57
|
const {
|
81
58
|
mode
|
82
59
|
} = this.props;
|
83
60
|
const color = this.Skia.Color(this.props.color);
|
84
61
|
const cf = this.Skia.ColorFilter.MakeBlend(color, _types.BlendMode[(0, _Enum.enumKey)(mode)]);
|
85
|
-
|
62
|
+
this.composeAndPush(ctx, cf);
|
86
63
|
}
|
87
64
|
|
88
65
|
}
|
@@ -94,9 +71,9 @@ class LinearToSRGBGammaColorFilterNode extends ColorFilterDeclaration {
|
|
94
71
|
super(ctx, _types2.NodeType.LinearToSRGBGammaColorFilter, null);
|
95
72
|
}
|
96
73
|
|
97
|
-
|
74
|
+
decorate(ctx) {
|
98
75
|
const cf = this.Skia.ColorFilter.MakeLinearToSRGBGamma();
|
99
|
-
|
76
|
+
this.composeAndPush(ctx, cf);
|
100
77
|
}
|
101
78
|
|
102
79
|
}
|
@@ -108,9 +85,9 @@ class SRGBToLinearGammaColorFilterNode extends ColorFilterDeclaration {
|
|
108
85
|
super(ctx, _types2.NodeType.SRGBToLinearGammaColorFilter, null);
|
109
86
|
}
|
110
87
|
|
111
|
-
|
88
|
+
decorate(ctx) {
|
112
89
|
const cf = this.Skia.ColorFilter.MakeSRGBToLinearGamma();
|
113
|
-
|
90
|
+
this.composeAndPush(ctx, cf);
|
114
91
|
}
|
115
92
|
|
116
93
|
}
|
@@ -122,9 +99,9 @@ class LumaColorFilterNode extends ColorFilterDeclaration {
|
|
122
99
|
super(ctx, _types2.NodeType.LumaColorFilter, null);
|
123
100
|
}
|
124
101
|
|
125
|
-
|
102
|
+
decorate(ctx) {
|
126
103
|
const cf = this.Skia.ColorFilter.MakeLumaColorFilter();
|
127
|
-
|
104
|
+
this.composeAndPush(ctx, cf);
|
128
105
|
}
|
129
106
|
|
130
107
|
}
|
@@ -136,12 +113,21 @@ class LerpColorFilterNode extends ColorFilterDeclaration {
|
|
136
113
|
super(ctx, _types2.NodeType.LerpColorFilter, props);
|
137
114
|
}
|
138
115
|
|
139
|
-
|
116
|
+
decorate(ctx) {
|
117
|
+
ctx.save();
|
118
|
+
this.decorateChildren(ctx);
|
140
119
|
const {
|
141
120
|
t
|
142
121
|
} = this.props;
|
143
|
-
const
|
144
|
-
|
122
|
+
const second = ctx.colorFilters.pop();
|
123
|
+
const first = ctx.colorFilters.pop();
|
124
|
+
ctx.restore();
|
125
|
+
|
126
|
+
if (!first || !second) {
|
127
|
+
throw new Error("LerpColorFilterNode: missing two color filters as children");
|
128
|
+
}
|
129
|
+
|
130
|
+
ctx.colorFilters.push(this.Skia.ColorFilter.MakeLerp(t, first, second));
|
145
131
|
}
|
146
132
|
|
147
133
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["ColorFilterDeclaration","JsiDeclarationNode","constructor","ctx","type","props","DeclarationType","ColorFilter","
|
1
|
+
{"version":3,"names":["ColorFilterDeclaration","JsiDeclarationNode","constructor","ctx","type","props","DeclarationType","ColorFilter","composeAndPush","cf1","save","decorateChildren","cf2","colorFilters","popAllAsOne","restore","cf","Skia","MakeCompose","push","MatrixColorFilterNode","NodeType","MatrixColorFilter","decorate","matrix","MakeMatrix","BlendColorFilterNode","BlendColorFilter","mode","color","Color","MakeBlend","BlendMode","enumKey","LinearToSRGBGammaColorFilterNode","LinearToSRGBGammaColorFilter","MakeLinearToSRGBGamma","SRGBToLinearGammaColorFilterNode","SRGBToLinearGammaColorFilter","MakeSRGBToLinearGamma","LumaColorFilterNode","LumaColorFilter","MakeLumaColorFilter","LerpColorFilterNode","LerpColorFilter","t","second","pop","first","Error","MakeLerp"],"sources":["ColorFilters.ts"],"sourcesContent":["import type { SkColorFilter } from \"../../../skia/types\";\nimport { BlendMode } from \"../../../skia/types\";\nimport type { NodeContext } from \"../Node\";\nimport { JsiDeclarationNode } from \"../Node\";\nimport type {\n BlendColorFilterProps,\n MatrixColorFilterProps,\n} from \"../../types\";\nimport { DeclarationType, NodeType } from \"../../types\";\nimport { enumKey } from \"../datatypes/Enum\";\nimport type { LerpColorFilterProps } from \"../../types/ColorFilters\";\nimport type { DeclarationContext } from \"../../types/DeclarationContext\";\n\nexport abstract class ColorFilterDeclaration<P> extends JsiDeclarationNode<P> {\n constructor(ctx: NodeContext, type: NodeType, props: P) {\n super(ctx, DeclarationType.ColorFilter, type, props);\n }\n\n protected composeAndPush(ctx: DeclarationContext, cf1: SkColorFilter) {\n ctx.save();\n this.decorateChildren(ctx);\n const cf2 = ctx.colorFilters.popAllAsOne();\n ctx.restore();\n const cf = cf2 ? this.Skia.ColorFilter.MakeCompose(cf1, cf2) : cf1;\n ctx.colorFilters.push(cf);\n }\n}\n\nexport class MatrixColorFilterNode extends ColorFilterDeclaration<MatrixColorFilterProps> {\n constructor(ctx: NodeContext, props: MatrixColorFilterProps) {\n super(ctx, NodeType.MatrixColorFilter, props);\n }\n\n decorate(ctx: DeclarationContext) {\n const { matrix } = this.props;\n const cf = this.Skia.ColorFilter.MakeMatrix(matrix);\n this.composeAndPush(ctx, cf);\n }\n}\n\nexport class BlendColorFilterNode extends ColorFilterDeclaration<BlendColorFilterProps> {\n constructor(ctx: NodeContext, props: BlendColorFilterProps) {\n super(ctx, NodeType.BlendColorFilter, props);\n }\n\n decorate(ctx: DeclarationContext) {\n const { mode } = this.props;\n const color = this.Skia.Color(this.props.color);\n const cf = this.Skia.ColorFilter.MakeBlend(color, BlendMode[enumKey(mode)]);\n this.composeAndPush(ctx, cf);\n }\n}\n\nexport class LinearToSRGBGammaColorFilterNode extends ColorFilterDeclaration<null> {\n constructor(ctx: NodeContext) {\n super(ctx, NodeType.LinearToSRGBGammaColorFilter, null);\n }\n\n decorate(ctx: DeclarationContext) {\n const cf = this.Skia.ColorFilter.MakeLinearToSRGBGamma();\n this.composeAndPush(ctx, cf);\n }\n}\n\nexport class SRGBToLinearGammaColorFilterNode extends ColorFilterDeclaration<null> {\n constructor(ctx: NodeContext) {\n super(ctx, NodeType.SRGBToLinearGammaColorFilter, null);\n }\n\n decorate(ctx: DeclarationContext) {\n const cf = this.Skia.ColorFilter.MakeSRGBToLinearGamma();\n this.composeAndPush(ctx, cf);\n }\n}\n\nexport class LumaColorFilterNode extends ColorFilterDeclaration<null> {\n constructor(ctx: NodeContext) {\n super(ctx, NodeType.LumaColorFilter, null);\n }\n\n decorate(ctx: DeclarationContext) {\n const cf = this.Skia.ColorFilter.MakeLumaColorFilter();\n this.composeAndPush(ctx, cf);\n }\n}\n\nexport class LerpColorFilterNode extends ColorFilterDeclaration<LerpColorFilterProps> {\n constructor(ctx: NodeContext, props: LerpColorFilterProps) {\n super(ctx, NodeType.LerpColorFilter, props);\n }\n\n decorate(ctx: DeclarationContext) {\n ctx.save();\n this.decorateChildren(ctx);\n const { t } = this.props;\n const second = ctx.colorFilters.pop();\n const first = ctx.colorFilters.pop();\n ctx.restore();\n if (!first || !second) {\n throw new Error(\n \"LerpColorFilterNode: missing two color filters as children\"\n );\n }\n ctx.colorFilters.push(this.Skia.ColorFilter.MakeLerp(t, first, second));\n }\n}\n"],"mappings":";;;;;;;AACA;;AAEA;;AAKA;;AACA;;AAIO,MAAeA,sBAAf,SAAiDC,wBAAjD,CAAuE;EAC5EC,WAAW,CAACC,GAAD,EAAmBC,IAAnB,EAAmCC,KAAnC,EAA6C;IACtD,MAAMF,GAAN,EAAWG,uBAAA,CAAgBC,WAA3B,EAAwCH,IAAxC,EAA8CC,KAA9C;EACD;;EAESG,cAAc,CAACL,GAAD,EAA0BM,GAA1B,EAA8C;IACpEN,GAAG,CAACO,IAAJ;IACA,KAAKC,gBAAL,CAAsBR,GAAtB;IACA,MAAMS,GAAG,GAAGT,GAAG,CAACU,YAAJ,CAAiBC,WAAjB,EAAZ;IACAX,GAAG,CAACY,OAAJ;IACA,MAAMC,EAAE,GAAGJ,GAAG,GAAG,KAAKK,IAAL,CAAUV,WAAV,CAAsBW,WAAtB,CAAkCT,GAAlC,EAAuCG,GAAvC,CAAH,GAAiDH,GAA/D;IACAN,GAAG,CAACU,YAAJ,CAAiBM,IAAjB,CAAsBH,EAAtB;EACD;;AAZ2E;;;;AAevE,MAAMI,qBAAN,SAAoCpB,sBAApC,CAAmF;EACxFE,WAAW,CAACC,GAAD,EAAmBE,KAAnB,EAAkD;IAC3D,MAAMF,GAAN,EAAWkB,gBAAA,CAASC,iBAApB,EAAuCjB,KAAvC;EACD;;EAEDkB,QAAQ,CAACpB,GAAD,EAA0B;IAChC,MAAM;MAAEqB;IAAF,IAAa,KAAKnB,KAAxB;IACA,MAAMW,EAAE,GAAG,KAAKC,IAAL,CAAUV,WAAV,CAAsBkB,UAAtB,CAAiCD,MAAjC,CAAX;IACA,KAAKhB,cAAL,CAAoBL,GAApB,EAAyB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;AARgF;;;;AAW5E,MAAMwB,mBAAN,SAAkCxC,sBAAlC,CAA+D;EACpEE,WAAW,CAACC,GAAD,EAAmB;IAC5B,MAAMA,GAAN,EAAWkB,gBAAA,CAASoB,eAApB,EAAqC,IAArC;EACD;;EAEDlB,QAAQ,CAACpB,GAAD,EAA0B;IAChC,MAAMa,EAAE,GAAG,KAAKC,IAAL,CAAUV,WAAV,CAAsBmC,mBAAtB,EAAX;IACA,KAAKlC,cAAL,CAAoBL,GAApB,EAAyBa,EAAzB;EACD;;AARmE;;;;AAW/D,MAAM2B,mBAAN,SAAkC3C,sBAAlC,CAA+E;EACpFE,WAAW,CAACC,GAAD,EAAmBE,KAAnB,EAAgD;IACzD,MAAMF,GAAN,EAAWkB,gBAAA,CAASuB,eAApB,EAAqCvC,KAArC;EACD;;EAEDkB,QAAQ,CAACpB,GAAD,EAA0B;IAChCA,GAAG,CAACO,IAAJ;IACA,KAAKC,gBAAL,CAAsBR,GAAtB;IACA,MAAM;MAAE0C;IAAF,IAAQ,KAAKxC,KAAnB;IACA,MAAMyC,MAAM,GAAG3C,GAAG,CAACU,YAAJ,CAAiBkC,GAAjB,EAAf;IACA,MAAMC,KAAK,GAAG7C,GAAG,CAACU,YAAJ,CAAiBkC,GAAjB,EAAd;IACA5C,GAAG,CAACY,OAAJ;;IACA,IAAI,CAACiC,KAAD,IAAU,CAACF,MAAf,EAAuB;MACrB,MAAM,IAAIG,KAAJ,CACJ,4DADI,CAAN;IAGD;;IACD9C,GAAG,CAACU,YAAJ,CAAiBM,IAAjB,CAAsB,KAAKF,IAAL,CAAUV,WAAV,CAAsB2C,QAAtB,CAA+BL,CAA/B,EAAkCG,KAAlC,EAAyCF,MAAzC,CAAtB;EACD;;AAlBmF"}
|
@@ -1,28 +1,28 @@
|
|
1
1
|
import type { SkImageFilter } from "../../../skia/types";
|
2
|
-
import type { BlendImageFilterProps, BlurImageFilterProps, DisplacementMapImageFilterProps, DropShadowImageFilterProps, MorphologyImageFilterProps, OffsetImageFilterProps, RuntimeShaderImageFilterProps } from "../../types";
|
2
|
+
import type { BlendImageFilterProps, BlurImageFilterProps, DeclarationContext, DisplacementMapImageFilterProps, DropShadowImageFilterProps, MorphologyImageFilterProps, OffsetImageFilterProps, RuntimeShaderImageFilterProps } from "../../types";
|
3
3
|
import { NodeType } from "../../types";
|
4
4
|
import type { NodeContext } from "../Node";
|
5
5
|
import { JsiDeclarationNode } from "../Node";
|
6
|
-
export declare abstract class ImageFilterDeclaration<P
|
6
|
+
export declare abstract class ImageFilterDeclaration<P> extends JsiDeclarationNode<P> {
|
7
7
|
constructor(ctx: NodeContext, type: NodeType, props: P);
|
8
|
-
|
9
|
-
|
8
|
+
protected input(ctx: DeclarationContext): SkImageFilter | null;
|
9
|
+
protected composeAndPush(ctx: DeclarationContext, imgf1: SkImageFilter): void;
|
10
10
|
}
|
11
11
|
export declare class OffsetImageFilterNode extends ImageFilterDeclaration<OffsetImageFilterProps> {
|
12
12
|
constructor(ctx: NodeContext, props: OffsetImageFilterProps);
|
13
|
-
|
13
|
+
decorate(ctx: DeclarationContext): void;
|
14
14
|
}
|
15
15
|
export declare class DisplacementMapImageFilterNode extends ImageFilterDeclaration<DisplacementMapImageFilterProps> {
|
16
16
|
constructor(ctx: NodeContext, props: DisplacementMapImageFilterProps);
|
17
|
-
|
17
|
+
decorate(ctx: DeclarationContext): void;
|
18
18
|
}
|
19
19
|
export declare class BlurImageFilterNode extends ImageFilterDeclaration<BlurImageFilterProps> {
|
20
20
|
constructor(ctx: NodeContext, props: BlurImageFilterProps);
|
21
|
-
|
21
|
+
decorate(ctx: DeclarationContext): void;
|
22
22
|
}
|
23
23
|
export declare class DropShadowImageFilterNode extends ImageFilterDeclaration<DropShadowImageFilterProps> {
|
24
24
|
constructor(ctx: NodeContext, props: DropShadowImageFilterProps);
|
25
|
-
|
25
|
+
decorate(ctx: DeclarationContext): void;
|
26
26
|
}
|
27
27
|
export declare enum MorphologyOperator {
|
28
28
|
Erode = 0,
|
@@ -30,13 +30,13 @@ export declare enum MorphologyOperator {
|
|
30
30
|
}
|
31
31
|
export declare class MorphologyImageFilterNode extends ImageFilterDeclaration<MorphologyImageFilterProps> {
|
32
32
|
constructor(ctx: NodeContext, props: MorphologyImageFilterProps);
|
33
|
-
|
33
|
+
decorate(ctx: DeclarationContext): void;
|
34
34
|
}
|
35
35
|
export declare class BlendImageFilterNode extends ImageFilterDeclaration<BlendImageFilterProps> {
|
36
36
|
constructor(ctx: NodeContext, props: BlendImageFilterProps);
|
37
|
-
|
37
|
+
decorate(ctx: DeclarationContext): void;
|
38
38
|
}
|
39
39
|
export declare class RuntimeShaderImageFilterNode extends ImageFilterDeclaration<RuntimeShaderImageFilterProps> {
|
40
40
|
constructor(ctx: NodeContext, props: RuntimeShaderImageFilterProps);
|
41
|
-
|
41
|
+
decorate(ctx: DeclarationContext): void;
|
42
42
|
}
|