@shopify/react-native-skia 2.1.1 → 2.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/CMakeLists.txt +1 -1
- package/android/cpp/rnskia-android/OpenGLWindowContext.h +1 -1
- package/android/cpp/rnskia-android/RNSkAndroidPlatformContext.h +1 -1
- package/android/cpp/rnskia-android/RNSkAndroidVideo.cpp +1 -1
- package/android/cpp/rnskia-android/RNSkOpenGLCanvasProvider.cpp +1 -1
- package/android/cpp/rnskia-android/RNSkOpenGLCanvasProvider.h +1 -1
- package/android/src/main/java/com/shopify/reactnative/skia/SkiaPictureViewManager.java +6 -0
- package/android/src/paper/java/com/facebook/react/viewmanagers/SkiaPictureViewManagerInterface.java +1 -0
- package/apple/MetalContext.h +2 -2
- package/apple/MetalWindowContext.h +2 -2
- package/apple/MetalWindowContext.mm +7 -4
- package/apple/RNSkApplePlatformContext.mm +1 -1
- package/apple/RNSkAppleView.h +7 -1
- package/apple/RNSkMetalCanvasProvider.h +4 -1
- package/apple/RNSkMetalCanvasProvider.mm +9 -4
- package/apple/SkiaPictureView.mm +4 -0
- package/apple/SkiaUIView.h +1 -0
- package/apple/SkiaUIView.mm +9 -0
- package/cpp/api/JsiSkImage.h +1 -1
- package/cpp/api/JsiSkSurface.h +1 -1
- package/cpp/api/JsiSkiaContext.h +1 -1
- package/cpp/api/recorder/ImageFilters.h +3 -3
- package/cpp/api/recorder/Paint.h +4 -0
- package/cpp/rnskia/{DawnContext.h → RNDawnContext.h} +3 -3
- package/cpp/rnskia/{DawnWindowContext.cpp → RNDawnWindowContext.cpp} +3 -3
- package/cpp/rnskia/{DawnWindowContext.h → RNDawnWindowContext.h} +2 -2
- package/cpp/rnskia/RNSkJsiViewApi.h +36 -1
- package/cpp/rnskia/RNSkPlatformContext.h +1 -1
- package/cpp/rnskia/RNSkView.h +10 -0
- package/lib/commonjs/dom/types/Drawings.d.ts +1 -1
- package/lib/commonjs/dom/types/Drawings.js.map +1 -1
- package/lib/commonjs/renderer/Canvas.d.ts +12 -4
- package/lib/commonjs/renderer/Canvas.js +49 -25
- package/lib/commonjs/renderer/Canvas.js.map +1 -1
- package/lib/commonjs/renderer/components/ImageFilter.js.map +1 -1
- package/lib/commonjs/skia/types/Matrix4.d.ts +4 -0
- package/lib/commonjs/skia/types/Matrix4.js +18 -1
- package/lib/commonjs/skia/types/Matrix4.js.map +1 -1
- package/lib/commonjs/sksg/Container.d.ts +13 -7
- package/lib/commonjs/sksg/Container.js +44 -18
- package/lib/commonjs/sksg/Container.js.map +1 -1
- package/lib/commonjs/sksg/Reconciler.d.ts +3 -2
- package/lib/commonjs/sksg/Reconciler.js +2 -2
- package/lib/commonjs/sksg/Reconciler.js.map +1 -1
- package/lib/commonjs/sksg/Recorder/Player.js +9 -3
- package/lib/commonjs/sksg/Recorder/Player.js.map +1 -1
- package/lib/commonjs/sksg/Recorder/commands/ImageFilters.js +2 -2
- package/lib/commonjs/sksg/Recorder/commands/ImageFilters.js.map +1 -1
- package/lib/commonjs/specs/SkiaPictureViewNativeComponent.d.ts +1 -0
- package/lib/commonjs/specs/SkiaPictureViewNativeComponent.js.map +1 -1
- package/lib/commonjs/views/types.d.ts +1 -0
- package/lib/commonjs/views/types.js.map +1 -1
- package/lib/module/dom/types/Drawings.d.ts +1 -1
- package/lib/module/dom/types/Drawings.js.map +1 -1
- package/lib/module/renderer/Canvas.d.ts +12 -4
- package/lib/module/renderer/Canvas.js +48 -25
- package/lib/module/renderer/Canvas.js.map +1 -1
- package/lib/module/renderer/components/ImageFilter.js.map +1 -1
- package/lib/module/skia/types/Matrix4.d.ts +4 -0
- package/lib/module/skia/types/Matrix4.js +16 -0
- package/lib/module/skia/types/Matrix4.js.map +1 -1
- package/lib/module/sksg/Container.d.ts +13 -7
- package/lib/module/sksg/Container.js +44 -18
- package/lib/module/sksg/Container.js.map +1 -1
- package/lib/module/sksg/Reconciler.d.ts +3 -2
- package/lib/module/sksg/Reconciler.js +2 -2
- package/lib/module/sksg/Reconciler.js.map +1 -1
- package/lib/module/sksg/Recorder/Player.js +9 -3
- package/lib/module/sksg/Recorder/Player.js.map +1 -1
- package/lib/module/sksg/Recorder/commands/ImageFilters.js +2 -2
- package/lib/module/sksg/Recorder/commands/ImageFilters.js.map +1 -1
- package/lib/module/specs/SkiaPictureViewNativeComponent.d.ts +1 -0
- package/lib/module/specs/SkiaPictureViewNativeComponent.js.map +1 -1
- package/lib/module/views/types.d.ts +1 -0
- package/lib/module/views/types.js.map +1 -1
- package/lib/typescript/lib/commonjs/renderer/Canvas.d.ts +8 -2
- package/lib/typescript/lib/commonjs/skia/types/Matrix4.d.ts +1 -0
- package/lib/typescript/lib/commonjs/sksg/Container.d.ts +11 -3
- package/lib/typescript/lib/commonjs/sksg/Reconciler.d.ts +7 -4
- package/lib/typescript/lib/module/mock/index.d.ts +1 -0
- package/lib/typescript/lib/module/renderer/Canvas.d.ts +11 -2
- package/lib/typescript/lib/module/skia/types/Matrix4.d.ts +1 -0
- package/lib/typescript/lib/module/sksg/Container.d.ts +11 -3
- package/lib/typescript/lib/module/sksg/Reconciler.d.ts +7 -4
- package/lib/typescript/src/dom/types/Drawings.d.ts +1 -1
- package/lib/typescript/src/renderer/Canvas.d.ts +12 -4
- package/lib/typescript/src/skia/types/Matrix4.d.ts +4 -0
- package/lib/typescript/src/sksg/Container.d.ts +13 -7
- package/lib/typescript/src/sksg/Reconciler.d.ts +3 -2
- package/lib/typescript/src/specs/SkiaPictureViewNativeComponent.d.ts +1 -0
- package/lib/typescript/src/views/types.d.ts +1 -0
- package/libs/android/arm64-v8a/libskia.a +0 -0
- package/libs/android/armeabi-v7a/libskia.a +0 -0
- package/libs/android/x86/libskia.a +0 -0
- package/libs/android/x86_64/libskia.a +0 -0
- package/libs/apple/libpathops.xcframework/Info.plist +15 -15
- package/libs/apple/libskia.xcframework/Info.plist +11 -11
- package/libs/apple/libskia.xcframework/ios-arm64_arm64e/libskia.a +0 -0
- package/libs/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/apple/libskia.xcframework/tvos-arm64_arm64e/libskia.a +0 -0
- package/libs/apple/libskia.xcframework/tvos-arm64_arm64e_x86_64-simulator/libskia.a +0 -0
- package/libs/apple/libskottie.xcframework/Info.plist +16 -16
- package/libs/apple/libskparagraph.xcframework/Info.plist +8 -8
- package/libs/apple/libsksg.xcframework/Info.plist +6 -6
- package/libs/apple/libskshaper.xcframework/Info.plist +10 -10
- package/libs/apple/libskunicode_core.xcframework/Info.plist +10 -10
- package/libs/apple/libskunicode_libgrapheme.xcframework/Info.plist +14 -14
- package/libs/apple/libsvg.xcframework/Info.plist +15 -15
- package/package.json +1 -1
- package/react-native-skia.podspec +5 -5
- package/src/dom/types/Drawings.ts +1 -1
- package/src/renderer/Canvas.tsx +53 -30
- package/src/renderer/__tests__/FitBox.spec.tsx +556 -4
- package/src/renderer/__tests__/e2e/ImageFilter.spec.tsx +4 -4
- package/src/renderer/__tests__/e2e/Paint.spec.tsx +18 -0
- package/src/renderer/__tests__/e2e/Skottie.spec.tsx +24 -1
- package/src/renderer/__tests__/setup.tsx +2 -0
- package/src/renderer/components/ImageFilter.tsx +1 -1
- package/src/skia/types/Matrix4.ts +16 -0
- package/src/sksg/Container.ts +73 -20
- package/src/sksg/Reconciler.ts +5 -3
- package/src/sksg/Recorder/Player.ts +7 -7
- package/src/sksg/Recorder/commands/ImageFilters.ts +3 -6
- package/src/specs/SkiaPictureViewNativeComponent.ts +1 -0
- package/src/views/types.ts +1 -0
- /package/cpp/rnskia/{DawnUtils.h → RNDawnUtils.h} +0 -0
- /package/cpp/rnskia/{ImageProvider.h → RNImageProvider.h} +0 -0
- /package/cpp/rnskia/{WindowContext.h → RNWindowContext.h} +0 -0
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["enumKey","processColor","processRadius","NodeType","BlendMode","BlurStyle","ColorChannel","processUniforms","TileMode","composeDeclarations","CommandType","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","declareBlurImageFilter","ctx","props","mode","blur","sigma","imgf","x","y","imageFilters","push","declareMorphologyImageFilter","operator","r","radius","Erode","MakeErode","MakeDilate","declareOffsetImageFilter","declareDropShadowImageFilter","cl","inner","factory","bind","MakeDropShadowOnly","MakeDropShadow","declareBlendImageFilter","blend","splice","length","composer","declareDisplacementMapImageFilter","channelX","channelY","scale","shader","shaders","pop","Error","map","MakeShader","MakeDisplacementMap","declareRuntimeShaderImageFilter","source","uniforms","rtb","RuntimeShaderBuilder","MakeRuntimeShader","declareImageFilter","imageFilter","composeImageFilters","outer","setBlurMaskFilter","style","respectCTM","mf","MaskFilter","paint","setMaskFilter","isPushImageFilter","command","type","PushImageFilter","isImageFilter","imageFilterType","pushImageFilter","BlurImageFilter","MorphologyImageFilter","BlendImageFilter","DisplacementMapImageFilter","DropShadowImageFilter","OffsetImageFilter","RuntimeShaderImageFilter"],"sources":["ImageFilters.ts"],"sourcesContent":["import { enumKey, processColor, processRadius } from \"../../../dom/nodes\";\nimport type {\n BlendImageFilterProps,\n BlurImageFilterProps,\n BlurMaskFilterProps,\n DisplacementMapImageFilterProps,\n DropShadowImageFilterProps,\n ImageFilterProps,\n MorphologyImageFilterProps,\n OffsetImageFilterProps,\n RuntimeShaderImageFilterProps,\n} from \"../../../dom/types\";\nimport { NodeType } from \"../../../dom/types\";\nimport type { SkColor, SkImageFilter, Skia } from \"../../../skia/types\";\nimport {\n BlendMode,\n BlurStyle,\n ColorChannel,\n processUniforms,\n TileMode,\n} from \"../../../skia/types\";\nimport { composeDeclarations } from \"../../utils\";\nimport type { Command } from \"../Core\";\nimport { CommandType } from \"../Core\";\nimport type { DrawingContext } from \"../DrawingContext\";\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\nconst declareBlurImageFilter = (\n ctx: DrawingContext,\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 null\n );\n ctx.imageFilters.push(imgf);\n};\n\nconst declareMorphologyImageFilter = (\n ctx: DrawingContext,\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, null);\n } else {\n imgf = ctx.Skia.ImageFilter.MakeDilate(r.x, r.y, null);\n }\n ctx.imageFilters.push(imgf);\n};\n\nconst declareOffsetImageFilter = (\n ctx: DrawingContext,\n props: OffsetImageFilterProps\n) => {\n \"worklet\";\n const { x, y } = props;\n const imgf = ctx.Skia.ImageFilter.MakeOffset(x, y, null);\n ctx.imageFilters.push(imgf);\n};\n\nconst declareDropShadowImageFilter = (\n ctx: DrawingContext,\n props: DropShadowImageFilterProps\n) => {\n \"worklet\";\n const { dx, dy, blur, shadowOnly, color: cl, inner } = props;\n const color = processColor(ctx.Skia, 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, null);\n ctx.imageFilters.push(imgf);\n};\n\nconst declareBlendImageFilter = (\n ctx: DrawingContext,\n props: BlendImageFilterProps\n) => {\n \"worklet\";\n const blend = BlendMode[enumKey(props.mode)];\n // Blend ImageFilters\n const imageFilters = ctx.imageFilters.splice(0, ctx.imageFilters.length);\n const composer = ctx.Skia.ImageFilter.MakeBlend.bind(\n ctx.Skia.ImageFilter,\n blend\n );\n ctx.imageFilters.push(composeDeclarations(imageFilters, composer));\n};\n\nconst declareDisplacementMapImageFilter = (\n ctx: DrawingContext,\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);\n const imgf = ctx.Skia.ImageFilter.MakeDisplacementMap(\n ColorChannel[enumKey(channelX)],\n ColorChannel[enumKey(channelY)],\n scale,\n map,\n null\n );\n ctx.imageFilters.push(imgf);\n};\n\nconst declareRuntimeShaderImageFilter = (\n ctx: DrawingContext,\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, null);\n ctx.imageFilters.push(imgf);\n};\n\nconst declareImageFilter = (\n ctx: DrawingContext,\n props: ImageFilterProps\n) => {\n \"worklet\";\n const { imageFilter } = props;\n ctx.imageFilters.push(imageFilter);\n};\n\nexport const composeImageFilters = (ctx: DrawingContext) => {\n \"worklet\";\n if (ctx.imageFilters.length > 1) {\n const outer = ctx.imageFilters.pop()!;\n const inner = ctx.imageFilters.pop()!;\n ctx.imageFilters.push(ctx.Skia.ImageFilter.MakeCompose(outer, inner));\n }\n};\n\nexport const setBlurMaskFilter = (\n ctx: DrawingContext,\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.paint.setMaskFilter(mf);\n};\n\nexport const isPushImageFilter = (\n command: Command\n): command is Command<CommandType.PushImageFilter> => {\n \"worklet\";\n return command.type === CommandType.PushImageFilter;\n};\n\ntype Props = {\n [NodeType.ImageFilter]: ImageFilterProps;\n [NodeType.OffsetImageFilter]: OffsetImageFilterProps;\n [NodeType.DisplacementMapImageFilter]: DisplacementMapImageFilterProps;\n [NodeType.BlurImageFilter]: BlurImageFilterProps;\n [NodeType.DropShadowImageFilter]: DropShadowImageFilterProps;\n [NodeType.MorphologyImageFilter]: MorphologyImageFilterProps;\n [NodeType.BlendImageFilter]: BlendImageFilterProps;\n [NodeType.RuntimeShaderImageFilter]: RuntimeShaderImageFilterProps;\n};\n\ninterface PushImageFilter<T extends keyof Props>\n extends Command<CommandType.PushImageFilter> {\n imageFilterType: T;\n props: Props[T];\n}\n\nconst isImageFilter = <T extends keyof Props>(\n command: Command<CommandType.PushImageFilter>,\n type: T\n): command is PushImageFilter<T> => {\n \"worklet\";\n return command.imageFilterType === type;\n};\n\nexport const pushImageFilter = (\n ctx: DrawingContext,\n command: Command<CommandType.PushImageFilter>\n) => {\n \"worklet\";\n if (isImageFilter(command, NodeType.ImageFilter)) {\n declareImageFilter(ctx, command.props);\n } else if (isImageFilter(command, NodeType.BlurImageFilter)) {\n declareBlurImageFilter(ctx, command.props);\n } else if (isImageFilter(command, NodeType.MorphologyImageFilter)) {\n declareMorphologyImageFilter(ctx, command.props);\n } else if (isImageFilter(command, NodeType.BlendImageFilter)) {\n declareBlendImageFilter(ctx, command.props);\n } else if (isImageFilter(command, NodeType.DisplacementMapImageFilter)) {\n declareDisplacementMapImageFilter(ctx, command.props);\n } else if (isImageFilter(command, NodeType.DropShadowImageFilter)) {\n declareDropShadowImageFilter(ctx, command.props);\n } else if (isImageFilter(command, NodeType.OffsetImageFilter)) {\n declareOffsetImageFilter(ctx, command.props);\n } else if (isImageFilter(command, NodeType.RuntimeShaderImageFilter)) {\n declareRuntimeShaderImageFilter(ctx, command.props);\n } else {\n throw new Error(\"Invalid image filter type: \" + command.imageFilterType);\n }\n};\n"],"mappings":"AAAA,SAASA,OAAO,EAAEC,YAAY,EAAEC,aAAa,QAAQ,oBAAoB;AAYzE,SAASC,QAAQ,QAAQ,oBAAoB;AAE7C,SACEC,SAAS,EACTC,SAAS,EACTC,YAAY,EACZC,eAAe,EACfC,QAAQ,QACH,qBAAqB;AAC5B,SAASC,mBAAmB,QAAQ,aAAa;AAEjD,SAASC,WAAW,QAAQ,SAAS;AAGrC,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,eA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AC1D,KAAK,CAAC;EACvD,CAAC,MAAM,IAAI6D,aAAa,CAACH,OAAO,EAAEnG,QAAQ,CAAC6G,qBAAqB,CAAC,EAAE;IACjEnD,4BAA4B,CAAClB,GAAG,EAAE2D,OAAO,CAAC1D,KAAK,CAAC;EAClD,CAAC,MAAM,IAAI6D,aAAa,CAACH,OAAO,EAAEnG,QAAQ,CAAC8G,iBAAiB,CAAC,EAAE;IAC7DrD,wBAAwB,CAACjB,GAAG,EAAE2D,OAAO,CAAC1D,KAAK,CAAC;EAC9C,CAAC,MAAM,IAAI6D,aAAa,CAACH,OAAO,EAAEnG,QAAQ,CAAC+G,wBAAwB,CAAC,EAAE;IACpE9B,+BAA+B,CAACzC,GAAG,EAAE2D,OAAO,CAAC1D,KAAK,CAAC;EACrD,CAAC,MAAM;IACL,MAAM,IAAIoC,KAAK,CAAC,6BAA6B,GAAGsB,OAAO,CAACI,eAAe,CAAC;EAC1E;AACF,CAAC","ignoreList":[]}
|
1
|
+
{"version":3,"names":["enumKey","processColor","processRadius","NodeType","BlendMode","BlurStyle","ColorChannel","processUniforms","TileMode","composeDeclarations","CommandType","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","declareBlurImageFilter","ctx","props","mode","blur","sigma","imgf","x","y","imageFilters","push","declareMorphologyImageFilter","operator","r","radius","Erode","MakeErode","MakeDilate","declareOffsetImageFilter","declareDropShadowImageFilter","cl","inner","factory","bind","MakeDropShadowOnly","MakeDropShadow","declareBlendImageFilter","blend","splice","length","composer","declareDisplacementMapImageFilter","channelX","channelY","scale","shader","shaders","pop","Error","map","MakeShader","MakeDisplacementMap","declareRuntimeShaderImageFilter","source","uniforms","rtb","RuntimeShaderBuilder","MakeRuntimeShader","declareImageFilter","filter","composeImageFilters","outer","setBlurMaskFilter","style","respectCTM","mf","MaskFilter","paint","setMaskFilter","isPushImageFilter","command","type","PushImageFilter","isImageFilter","imageFilterType","pushImageFilter","BlurImageFilter","MorphologyImageFilter","BlendImageFilter","DisplacementMapImageFilter","DropShadowImageFilter","OffsetImageFilter","RuntimeShaderImageFilter"],"sources":["ImageFilters.ts"],"sourcesContent":["import { enumKey, processColor, processRadius } from \"../../../dom/nodes\";\nimport type {\n BlendImageFilterProps,\n BlurImageFilterProps,\n BlurMaskFilterProps,\n DisplacementMapImageFilterProps,\n DropShadowImageFilterProps,\n ImageFilterProps,\n MorphologyImageFilterProps,\n OffsetImageFilterProps,\n RuntimeShaderImageFilterProps,\n} from \"../../../dom/types\";\nimport { NodeType } from \"../../../dom/types\";\nimport type { SkColor, SkImageFilter, Skia } from \"../../../skia/types\";\nimport {\n BlendMode,\n BlurStyle,\n ColorChannel,\n processUniforms,\n TileMode,\n} from \"../../../skia/types\";\nimport { composeDeclarations } from \"../../utils\";\nimport type { Command } from \"../Core\";\nimport { CommandType } from \"../Core\";\nimport type { DrawingContext } from \"../DrawingContext\";\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\nconst declareBlurImageFilter = (\n ctx: DrawingContext,\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 null\n );\n ctx.imageFilters.push(imgf);\n};\n\nconst declareMorphologyImageFilter = (\n ctx: DrawingContext,\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, null);\n } else {\n imgf = ctx.Skia.ImageFilter.MakeDilate(r.x, r.y, null);\n }\n ctx.imageFilters.push(imgf);\n};\n\nconst declareOffsetImageFilter = (\n ctx: DrawingContext,\n props: OffsetImageFilterProps\n) => {\n \"worklet\";\n const { x, y } = props;\n const imgf = ctx.Skia.ImageFilter.MakeOffset(x, y, null);\n ctx.imageFilters.push(imgf);\n};\n\nconst declareDropShadowImageFilter = (\n ctx: DrawingContext,\n props: DropShadowImageFilterProps\n) => {\n \"worklet\";\n const { dx, dy, blur, shadowOnly, color: cl, inner } = props;\n const color = processColor(ctx.Skia, 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, null);\n ctx.imageFilters.push(imgf);\n};\n\nconst declareBlendImageFilter = (\n ctx: DrawingContext,\n props: BlendImageFilterProps\n) => {\n \"worklet\";\n const blend = BlendMode[enumKey(props.mode)];\n // Blend ImageFilters\n const imageFilters = ctx.imageFilters.splice(0, ctx.imageFilters.length);\n const composer = ctx.Skia.ImageFilter.MakeBlend.bind(\n ctx.Skia.ImageFilter,\n blend\n );\n ctx.imageFilters.push(composeDeclarations(imageFilters, composer));\n};\n\nconst declareDisplacementMapImageFilter = (\n ctx: DrawingContext,\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);\n const imgf = ctx.Skia.ImageFilter.MakeDisplacementMap(\n ColorChannel[enumKey(channelX)],\n ColorChannel[enumKey(channelY)],\n scale,\n map,\n null\n );\n ctx.imageFilters.push(imgf);\n};\n\nconst declareRuntimeShaderImageFilter = (\n ctx: DrawingContext,\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, null);\n ctx.imageFilters.push(imgf);\n};\n\nconst declareImageFilter = (ctx: DrawingContext, props: ImageFilterProps) => {\n \"worklet\";\n const { filter } = props;\n ctx.imageFilters.push(filter);\n};\n\nexport const composeImageFilters = (ctx: DrawingContext) => {\n \"worklet\";\n if (ctx.imageFilters.length > 1) {\n const outer = ctx.imageFilters.pop()!;\n const inner = ctx.imageFilters.pop()!;\n ctx.imageFilters.push(ctx.Skia.ImageFilter.MakeCompose(outer, inner));\n }\n};\n\nexport const setBlurMaskFilter = (\n ctx: DrawingContext,\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.paint.setMaskFilter(mf);\n};\n\nexport const isPushImageFilter = (\n command: Command\n): command is Command<CommandType.PushImageFilter> => {\n \"worklet\";\n return command.type === CommandType.PushImageFilter;\n};\n\ntype Props = {\n [NodeType.ImageFilter]: ImageFilterProps;\n [NodeType.OffsetImageFilter]: OffsetImageFilterProps;\n [NodeType.DisplacementMapImageFilter]: DisplacementMapImageFilterProps;\n [NodeType.BlurImageFilter]: BlurImageFilterProps;\n [NodeType.DropShadowImageFilter]: DropShadowImageFilterProps;\n [NodeType.MorphologyImageFilter]: MorphologyImageFilterProps;\n [NodeType.BlendImageFilter]: BlendImageFilterProps;\n [NodeType.RuntimeShaderImageFilter]: RuntimeShaderImageFilterProps;\n};\n\ninterface PushImageFilter<T extends keyof Props>\n extends Command<CommandType.PushImageFilter> {\n imageFilterType: T;\n props: Props[T];\n}\n\nconst isImageFilter = <T extends keyof Props>(\n command: Command<CommandType.PushImageFilter>,\n type: T\n): command is PushImageFilter<T> => {\n \"worklet\";\n return command.imageFilterType === type;\n};\n\nexport const pushImageFilter = (\n ctx: DrawingContext,\n command: Command<CommandType.PushImageFilter>\n) => {\n \"worklet\";\n if (isImageFilter(command, NodeType.ImageFilter)) {\n declareImageFilter(ctx, command.props);\n } else if (isImageFilter(command, NodeType.BlurImageFilter)) {\n declareBlurImageFilter(ctx, command.props);\n } else if (isImageFilter(command, NodeType.MorphologyImageFilter)) {\n declareMorphologyImageFilter(ctx, command.props);\n } else if (isImageFilter(command, NodeType.BlendImageFilter)) {\n declareBlendImageFilter(ctx, command.props);\n } else if (isImageFilter(command, NodeType.DisplacementMapImageFilter)) {\n declareDisplacementMapImageFilter(ctx, command.props);\n } else if (isImageFilter(command, NodeType.DropShadowImageFilter)) {\n declareDropShadowImageFilter(ctx, command.props);\n } else if (isImageFilter(command, NodeType.OffsetImageFilter)) {\n declareOffsetImageFilter(ctx, command.props);\n } else if (isImageFilter(command, NodeType.RuntimeShaderImageFilter)) {\n declareRuntimeShaderImageFilter(ctx, command.props);\n } else {\n throw new Error(\"Invalid image filter type: \" + command.imageFilterType);\n }\n};\n"],"mappings":"AAAA,SAASA,OAAO,EAAEC,YAAY,EAAEC,aAAa,QAAQ,oBAAoB;AAYzE,SAASC,QAAQ,QAAQ,oBAAoB;AAE7C,SACEC,SAAS,EACTC,SAAS,EACTC,YAAY,EACZC,eAAe,EACfC,QAAQ,QACH,qBAAqB;AAC5B,SAASC,mBAAmB,QAAQ,aAAa;AAEjD,SAASC,WAAW,QAAQ,SAAS;AAGrC,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,KAAc,EACdC,KAA2B,KACxB;EACH,SAAS;;EACT,MAAMC,aAAa,GAAGR,IAAI,CAACS,WAAW,CAACC,eAAe,CACpDV,IAAI,CAACW,WAAW,CAACC,SAAS,CAAChB,KAAK,EAAER,SAAS,CAACyB,GAAG,CAAC,EAChD,IACF,CAAC;EACD,MAAMC,WAAW,GAAGd,IAAI,CAACS,WAAW,CAACC,eAAe,CAClDV,IAAI,CAACW,WAAW,CAACC,SAAS,CAAChB,KAAK,EAAER,SAAS,CAAC2B,KAAK,CAAC,EAClD,IACF,CAAC;EACD,MAAMC,EAAE,GAAGhB,IAAI,CAACS,WAAW,CAACC,eAAe,CACzCV,IAAI,CAACW,WAAW,CAACC,SAAS,CAACN,KAAK,EAAElB,SAAS,CAAC6B,MAAM,CAAC,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E;AACF,CAAC","ignoreList":[]}
|
@@ -2,6 +2,7 @@ import type { ViewProps } from "react-native";
|
|
2
2
|
export interface NativeProps extends ViewProps {
|
3
3
|
debug?: boolean;
|
4
4
|
opaque?: boolean;
|
5
|
+
colorSpace?: string;
|
5
6
|
}
|
6
7
|
declare const _default: import("react-native/Libraries/Utilities/codegenNativeComponent").NativeComponentType<NativeProps>;
|
7
8
|
export default _default;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["codegenNativeComponent"],"sources":["SkiaPictureViewNativeComponent.ts"],"sourcesContent":["import codegenNativeComponent from \"react-native/Libraries/Utilities/codegenNativeComponent\";\nimport type { ViewProps } from \"react-native\";\n\nexport interface NativeProps extends ViewProps {\n debug?: boolean;\n opaque?: boolean;\n}\n\n// eslint-disable-next-line import/no-default-export\nexport default codegenNativeComponent<NativeProps>(\"SkiaPictureView\");\n"],"mappings":"AAAA,OAAOA,sBAAsB,MAAM,yDAAyD;
|
1
|
+
{"version":3,"names":["codegenNativeComponent"],"sources":["SkiaPictureViewNativeComponent.ts"],"sourcesContent":["import codegenNativeComponent from \"react-native/Libraries/Utilities/codegenNativeComponent\";\nimport type { ViewProps } from \"react-native\";\n\nexport interface NativeProps extends ViewProps {\n debug?: boolean;\n opaque?: boolean;\n colorSpace?: string;\n}\n\n// eslint-disable-next-line import/no-default-export\nexport default codegenNativeComponent<NativeProps>(\"SkiaPictureView\");\n"],"mappings":"AAAA,OAAOA,sBAAsB,MAAM,yDAAyD;AAS5F;AACA,eAAeA,sBAAsB,CAAc,iBAAiB,CAAC","ignoreList":[]}
|
@@ -12,6 +12,7 @@ export interface ISkiaViewApi {
|
|
12
12
|
requestRedraw: (nativeId: number) => void;
|
13
13
|
makeImageSnapshot: (nativeId: number, rect?: SkRect) => SkImage;
|
14
14
|
makeImageSnapshotAsync: (nativeId: number, rect?: SkRect) => Promise<SkImage>;
|
15
|
+
size: (nativeId: number) => SkSize;
|
15
16
|
}
|
16
17
|
export interface SkiaBaseViewProps extends ViewProps {
|
17
18
|
/**
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type { ViewProps } from \"react-native\";\nimport type { SharedValue } from \"react-native-reanimated\";\n\nimport type { Node } from \"../dom/types\";\nimport type { SkImage, SkPicture, SkRect, SkSize } from \"../skia/types\";\n\nexport type NativeSkiaViewProps = ViewProps & {\n debug?: boolean;\n opaque?: boolean;\n};\n\nexport interface ISkiaViewApi {\n web?: boolean;\n setJsiProperty: <T>(nativeId: number, name: string, value: T) => void;\n requestRedraw: (nativeId: number) => void;\n makeImageSnapshot: (nativeId: number, rect?: SkRect) => SkImage;\n makeImageSnapshotAsync: (nativeId: number, rect?: SkRect) => Promise<SkImage>;\n}\n\nexport interface SkiaBaseViewProps extends ViewProps {\n /**\n * When set to true the view will display information about the\n * average time it takes to render.\n */\n debug?: boolean;\n /**\n * Pass an animated value to the onSize property to get updates when\n * the Skia view is resized.\n */\n onSize?: SharedValue<SkSize>;\n\n opaque?: boolean;\n}\n\nexport interface SkiaPictureViewNativeProps extends SkiaBaseViewProps {\n picture?: SkPicture;\n}\n\nexport interface SkiaDomViewNativeProps extends SkiaBaseViewProps {\n root?: Node<unknown>;\n}\n"],"mappings":"","ignoreList":[]}
|
1
|
+
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type { ViewProps } from \"react-native\";\nimport type { SharedValue } from \"react-native-reanimated\";\n\nimport type { Node } from \"../dom/types\";\nimport type { SkImage, SkPicture, SkRect, SkSize } from \"../skia/types\";\n\nexport type NativeSkiaViewProps = ViewProps & {\n debug?: boolean;\n opaque?: boolean;\n};\n\nexport interface ISkiaViewApi {\n web?: boolean;\n setJsiProperty: <T>(nativeId: number, name: string, value: T) => void;\n requestRedraw: (nativeId: number) => void;\n makeImageSnapshot: (nativeId: number, rect?: SkRect) => SkImage;\n makeImageSnapshotAsync: (nativeId: number, rect?: SkRect) => Promise<SkImage>;\n size: (nativeId: number) => SkSize;\n}\n\nexport interface SkiaBaseViewProps extends ViewProps {\n /**\n * When set to true the view will display information about the\n * average time it takes to render.\n */\n debug?: boolean;\n /**\n * Pass an animated value to the onSize property to get updates when\n * the Skia view is resized.\n */\n onSize?: SharedValue<SkSize>;\n\n opaque?: boolean;\n}\n\nexport interface SkiaPictureViewNativeProps extends SkiaBaseViewProps {\n picture?: SkPicture;\n}\n\nexport interface SkiaDomViewNativeProps extends SkiaBaseViewProps {\n root?: Node<unknown>;\n}\n"],"mappings":"","ignoreList":[]}
|
@@ -1,11 +1,17 @@
|
|
1
1
|
export const __esModule: boolean;
|
2
|
+
export const isFabric: boolean;
|
2
3
|
export function useCanvasRef(): any;
|
3
|
-
export function
|
4
|
+
export function useCanvasSize(): {
|
5
|
+
ref: any;
|
6
|
+
size: any;
|
7
|
+
};
|
8
|
+
export function Canvas({ debug, opaque, children, onSize, colorSpace, ref, onLayout, ...viewProps }: {
|
4
9
|
[x: string]: any;
|
5
10
|
debug: any;
|
6
11
|
opaque: any;
|
7
12
|
children: any;
|
8
13
|
onSize: any;
|
9
|
-
|
14
|
+
colorSpace?: string | undefined;
|
10
15
|
ref: any;
|
16
|
+
onLayout: any;
|
11
17
|
}): any;
|
@@ -28,6 +28,7 @@ export function rotateX(value: any, p: any): any[];
|
|
28
28
|
export function rotateY(value: any, p: any): any[];
|
29
29
|
export function processTransform3d(transforms: any): any;
|
30
30
|
export function convertToColumnMajor(rowMajorMatrix: any): any[];
|
31
|
+
export function convertToColumnMajor3(rowMajorMatrix: any): any[];
|
31
32
|
export function convertToAffineMatrix(m4: any): any[];
|
32
33
|
/**
|
33
34
|
* Inverts a 4x4 matrix
|
@@ -1,8 +1,7 @@
|
|
1
1
|
export const __esModule: boolean;
|
2
2
|
export class Container {
|
3
|
-
constructor(Skia: any
|
3
|
+
constructor(Skia: any);
|
4
4
|
Skia: any;
|
5
|
-
nativeId: any;
|
6
5
|
set root(value: any);
|
7
6
|
get root(): any;
|
8
7
|
_root: any;
|
@@ -11,12 +10,18 @@ export class Container {
|
|
11
10
|
unmount(): void;
|
12
11
|
drawOnCanvas(canvas: any): void;
|
13
12
|
}
|
14
|
-
export function createContainer(Skia: any, nativeId: any): NativeReanimatedContainer | ReanimatedContainer | StaticContainer;
|
13
|
+
export function createContainer(Skia: any, nativeId: any, onSize: any): NativeReanimatedContainer | ReanimatedContainer | StaticContainer;
|
15
14
|
declare class NativeReanimatedContainer extends Container {
|
15
|
+
constructor(Skia: any, nativeId: any, onSize: any);
|
16
|
+
nativeId: any;
|
17
|
+
onSize: any;
|
16
18
|
redraw(): void;
|
17
19
|
mapperId: any;
|
18
20
|
}
|
19
21
|
declare class ReanimatedContainer extends Container {
|
22
|
+
constructor(Skia: any, nativeId: any, onSize: any);
|
23
|
+
nativeId: any;
|
24
|
+
onSize: any;
|
20
25
|
redraw(): void;
|
21
26
|
recording: {
|
22
27
|
commands: any;
|
@@ -25,6 +30,9 @@ declare class ReanimatedContainer extends Container {
|
|
25
30
|
mapperId: any;
|
26
31
|
}
|
27
32
|
declare class StaticContainer extends Container {
|
33
|
+
constructor(Skia: any, nativeId: any, onSize: any);
|
34
|
+
nativeId: any;
|
35
|
+
onSize: any;
|
28
36
|
redraw(): void;
|
29
37
|
recording: {
|
30
38
|
commands: any;
|
@@ -1,12 +1,13 @@
|
|
1
1
|
export const __esModule: boolean;
|
2
2
|
export class SkiaSGRoot {
|
3
|
-
constructor(Skia: any, nativeId
|
3
|
+
constructor(Skia: any, nativeId: number | undefined, onSize: any);
|
4
4
|
Skia: any;
|
5
5
|
container: {
|
6
|
+
nativeId: any;
|
7
|
+
onSize: any;
|
6
8
|
redraw(): void;
|
7
9
|
mapperId: any;
|
8
10
|
Skia: any;
|
9
|
-
nativeId: any;
|
10
11
|
root: any;
|
11
12
|
_root: any;
|
12
13
|
mount(): void;
|
@@ -14,6 +15,8 @@ export class SkiaSGRoot {
|
|
14
15
|
unmount(): void;
|
15
16
|
drawOnCanvas(canvas: any): void;
|
16
17
|
} | {
|
18
|
+
nativeId: any;
|
19
|
+
onSize: any;
|
17
20
|
redraw(): void;
|
18
21
|
recording: {
|
19
22
|
commands: any;
|
@@ -21,7 +24,6 @@ export class SkiaSGRoot {
|
|
21
24
|
} | undefined;
|
22
25
|
mapperId: any;
|
23
26
|
Skia: any;
|
24
|
-
nativeId: any;
|
25
27
|
root: any;
|
26
28
|
_root: any;
|
27
29
|
mount(): void;
|
@@ -29,6 +31,8 @@ export class SkiaSGRoot {
|
|
29
31
|
unmount(): void;
|
30
32
|
drawOnCanvas(canvas: any): void;
|
31
33
|
} | {
|
34
|
+
nativeId: any;
|
35
|
+
onSize: any;
|
32
36
|
redraw(): void;
|
33
37
|
recording: {
|
34
38
|
commands: any;
|
@@ -36,7 +40,6 @@ export class SkiaSGRoot {
|
|
36
40
|
animationValues: any;
|
37
41
|
} | undefined;
|
38
42
|
Skia: any;
|
39
|
-
nativeId: any;
|
40
43
|
root: any;
|
41
44
|
_root: any;
|
42
45
|
mount(): void;
|
@@ -273,6 +273,7 @@ export function Mock(CanvasKit: any): {
|
|
273
273
|
rotateY: (value: any, p: any) => any[];
|
274
274
|
processTransform3d: (transforms: any) => any;
|
275
275
|
convertToColumnMajor: (rowMajorMatrix: any) => any[];
|
276
|
+
convertToColumnMajor3: (rowMajorMatrix: any) => any[];
|
276
277
|
convertToAffineMatrix: (m4: any) => any[];
|
277
278
|
invert4: (m: any) => number[];
|
278
279
|
setupCamera: (area: any, zscale: any, cam: any) => any[];
|
@@ -1,11 +1,20 @@
|
|
1
1
|
export function useCanvasRef(): React.RefObject<null>;
|
2
|
-
export function
|
2
|
+
export function useCanvasSize(): {
|
3
|
+
ref: React.RefObject<null>;
|
4
|
+
size: {
|
5
|
+
width: number;
|
6
|
+
height: number;
|
7
|
+
};
|
8
|
+
};
|
9
|
+
export const isFabric: boolean;
|
10
|
+
export function Canvas({ debug, opaque, children, onSize, colorSpace, ref, onLayout, ...viewProps }: {
|
3
11
|
[x: string]: any;
|
4
12
|
debug: any;
|
5
13
|
opaque: any;
|
6
14
|
children: any;
|
7
15
|
onSize: any;
|
8
|
-
|
16
|
+
colorSpace?: string | undefined;
|
9
17
|
ref: any;
|
18
|
+
onLayout: any;
|
10
19
|
}): React.CElement<object, React.Component<object, {}, any> & import("react-native").NativeMethods>;
|
11
20
|
import React from "react";
|
@@ -12,6 +12,7 @@ export function rotateX(value: any, p: any): any[];
|
|
12
12
|
export function rotateY(value: any, p: any): any[];
|
13
13
|
export function processTransform3d(transforms: any): any;
|
14
14
|
export function convertToColumnMajor(rowMajorMatrix: any): any[];
|
15
|
+
export function convertToColumnMajor3(rowMajorMatrix: any): any[];
|
15
16
|
export function convertToAffineMatrix(m4: any): any[];
|
16
17
|
export function invert4(m: any): number[];
|
17
18
|
export function setupCamera(area: any, zscale: any, cam: any): any[];
|
@@ -1,7 +1,6 @@
|
|
1
1
|
export class Container {
|
2
|
-
constructor(Skia: any
|
2
|
+
constructor(Skia: any);
|
3
3
|
Skia: any;
|
4
|
-
nativeId: any;
|
5
4
|
set root(value: any);
|
6
5
|
get root(): any;
|
7
6
|
_root: any;
|
@@ -10,8 +9,11 @@ export class Container {
|
|
10
9
|
unmount(): void;
|
11
10
|
drawOnCanvas(canvas: any): void;
|
12
11
|
}
|
13
|
-
export function createContainer(Skia: any, nativeId: any): StaticContainer | ReanimatedContainer | NativeReanimatedContainer;
|
12
|
+
export function createContainer(Skia: any, nativeId: any, onSize: any): StaticContainer | ReanimatedContainer | NativeReanimatedContainer;
|
14
13
|
declare class StaticContainer extends Container {
|
14
|
+
constructor(Skia: any, nativeId: any, onSize: any);
|
15
|
+
nativeId: any;
|
16
|
+
onSize: any;
|
15
17
|
redraw(): void;
|
16
18
|
recording: {
|
17
19
|
commands: any;
|
@@ -20,6 +22,9 @@ declare class StaticContainer extends Container {
|
|
20
22
|
} | undefined;
|
21
23
|
}
|
22
24
|
declare class ReanimatedContainer extends Container {
|
25
|
+
constructor(Skia: any, nativeId: any, onSize: any);
|
26
|
+
nativeId: any;
|
27
|
+
onSize: any;
|
23
28
|
redraw(): void;
|
24
29
|
recording: {
|
25
30
|
commands: any;
|
@@ -28,6 +33,9 @@ declare class ReanimatedContainer extends Container {
|
|
28
33
|
mapperId: any;
|
29
34
|
}
|
30
35
|
declare class NativeReanimatedContainer extends Container {
|
36
|
+
constructor(Skia: any, nativeId: any, onSize: any);
|
37
|
+
nativeId: any;
|
38
|
+
onSize: any;
|
31
39
|
redraw(): void;
|
32
40
|
mapperId: any;
|
33
41
|
}
|
@@ -1,7 +1,9 @@
|
|
1
1
|
export class SkiaSGRoot {
|
2
|
-
constructor(Skia: any, nativeId
|
2
|
+
constructor(Skia: any, nativeId: number | undefined, onSize: any);
|
3
3
|
Skia: any;
|
4
4
|
container: {
|
5
|
+
nativeId: any;
|
6
|
+
onSize: any;
|
5
7
|
redraw(): void;
|
6
8
|
recording: {
|
7
9
|
commands: any;
|
@@ -9,7 +11,6 @@ export class SkiaSGRoot {
|
|
9
11
|
animationValues: any;
|
10
12
|
} | undefined;
|
11
13
|
Skia: any;
|
12
|
-
nativeId: any;
|
13
14
|
root: any;
|
14
15
|
_root: any;
|
15
16
|
mount(): void;
|
@@ -17,6 +18,8 @@ export class SkiaSGRoot {
|
|
17
18
|
unmount(): void;
|
18
19
|
drawOnCanvas(canvas: any): void;
|
19
20
|
} | {
|
21
|
+
nativeId: any;
|
22
|
+
onSize: any;
|
20
23
|
redraw(): void;
|
21
24
|
recording: {
|
22
25
|
commands: any;
|
@@ -24,7 +27,6 @@ export class SkiaSGRoot {
|
|
24
27
|
} | undefined;
|
25
28
|
mapperId: any;
|
26
29
|
Skia: any;
|
27
|
-
nativeId: any;
|
28
30
|
root: any;
|
29
31
|
_root: any;
|
30
32
|
mount(): void;
|
@@ -32,10 +34,11 @@ export class SkiaSGRoot {
|
|
32
34
|
unmount(): void;
|
33
35
|
drawOnCanvas(canvas: any): void;
|
34
36
|
} | {
|
37
|
+
nativeId: any;
|
38
|
+
onSize: any;
|
35
39
|
redraw(): void;
|
36
40
|
mapperId: any;
|
37
41
|
Skia: any;
|
38
|
-
nativeId: any;
|
39
42
|
root: any;
|
40
43
|
_root: any;
|
41
44
|
mount(): void;
|
@@ -1,19 +1,27 @@
|
|
1
1
|
import type { FC } from "react";
|
2
2
|
import React from "react";
|
3
|
-
import type { ViewProps } from "react-native";
|
4
|
-
import type
|
3
|
+
import type { MeasureInWindowOnSuccessCallback, MeasureOnSuccessCallback, ViewProps } from "react-native";
|
4
|
+
import { type SharedValue } from "react-native-reanimated";
|
5
5
|
import type { SkImage, SkRect, SkSize } from "../skia/types";
|
6
6
|
export interface CanvasRef extends FC<CanvasProps> {
|
7
7
|
makeImageSnapshot(rect?: SkRect): SkImage;
|
8
8
|
makeImageSnapshotAsync(rect?: SkRect): Promise<SkImage>;
|
9
9
|
redraw(): void;
|
10
10
|
getNativeId(): number;
|
11
|
+
measure(callback: MeasureOnSuccessCallback): void;
|
12
|
+
measureInWindow(callback: MeasureInWindowOnSuccessCallback): void;
|
11
13
|
}
|
12
14
|
export declare const useCanvasRef: () => React.RefObject<CanvasRef | null>;
|
13
|
-
export
|
15
|
+
export declare const useCanvasSize: () => {
|
16
|
+
ref: React.RefObject<CanvasRef | null>;
|
17
|
+
size: SkSize;
|
18
|
+
};
|
19
|
+
export declare const isFabric: boolean;
|
20
|
+
export interface CanvasProps extends Omit<ViewProps, "onLayout"> {
|
14
21
|
debug?: boolean;
|
15
22
|
opaque?: boolean;
|
16
23
|
onSize?: SharedValue<SkSize>;
|
24
|
+
colorSpace?: "p3" | "srgb";
|
17
25
|
ref?: React.Ref<CanvasRef>;
|
18
26
|
}
|
19
|
-
export declare const Canvas: ({ debug, opaque, children, onSize,
|
27
|
+
export declare const Canvas: ({ debug, opaque, children, onSize, colorSpace, ref, onLayout, ...viewProps }: CanvasProps) => React.JSX.Element;
|
@@ -96,6 +96,10 @@ export declare const processTransform3d: (transforms: Transforms3d) => Matrix4;
|
|
96
96
|
* @worklet
|
97
97
|
*/
|
98
98
|
export declare const convertToColumnMajor: (rowMajorMatrix: Matrix4) => Matrix4;
|
99
|
+
/**
|
100
|
+
* @worklet
|
101
|
+
*/
|
102
|
+
export declare const convertToColumnMajor3: (rowMajorMatrix: Matrix3 | number[]) => Matrix3;
|
99
103
|
/**
|
100
104
|
* @worklet
|
101
105
|
*/
|
@@ -1,14 +1,14 @@
|
|
1
|
-
import type {
|
1
|
+
import type { SharedValue } from "react-native-reanimated";
|
2
|
+
import type { Skia, SkCanvas, SkSize } from "../skia/types";
|
2
3
|
import type { Node } from "./Node";
|
3
4
|
import type { Recording } from "./Recorder/Recorder";
|
4
5
|
import "../views/api";
|
5
6
|
export declare abstract class Container {
|
6
7
|
protected Skia: Skia;
|
7
|
-
protected nativeId: number;
|
8
8
|
private _root;
|
9
9
|
protected recording: Recording | null;
|
10
10
|
protected unmounted: boolean;
|
11
|
-
constructor(Skia: Skia
|
11
|
+
constructor(Skia: Skia);
|
12
12
|
get root(): Node[];
|
13
13
|
set root(value: Node[]);
|
14
14
|
mount(): void;
|
@@ -17,18 +17,24 @@ export declare abstract class Container {
|
|
17
17
|
abstract redraw(): void;
|
18
18
|
}
|
19
19
|
declare class StaticContainer extends Container {
|
20
|
-
|
20
|
+
private nativeId;
|
21
|
+
private onSize?;
|
22
|
+
constructor(Skia: Skia, nativeId: number, onSize?: SharedValue<SkSize> | undefined);
|
21
23
|
redraw(): void;
|
22
24
|
}
|
23
25
|
declare class ReanimatedContainer extends Container {
|
26
|
+
private nativeId;
|
27
|
+
private onSize?;
|
24
28
|
private mapperId;
|
25
|
-
constructor(Skia: Skia, nativeId: number);
|
29
|
+
constructor(Skia: Skia, nativeId: number, onSize?: SharedValue<SkSize> | undefined);
|
26
30
|
redraw(): void;
|
27
31
|
}
|
28
32
|
declare class NativeReanimatedContainer extends Container {
|
33
|
+
private nativeId;
|
34
|
+
private onSize?;
|
29
35
|
private mapperId;
|
30
|
-
constructor(Skia: Skia, nativeId: number);
|
36
|
+
constructor(Skia: Skia, nativeId: number, onSize?: SharedValue<SkSize> | undefined);
|
31
37
|
redraw(): void;
|
32
38
|
}
|
33
|
-
export declare const createContainer: (Skia: Skia, nativeId: number) => StaticContainer | ReanimatedContainer | NativeReanimatedContainer;
|
39
|
+
export declare const createContainer: (Skia: Skia, nativeId: number, onSize?: SharedValue<SkSize>) => StaticContainer | ReanimatedContainer | NativeReanimatedContainer;
|
34
40
|
export {};
|
@@ -1,12 +1,13 @@
|
|
1
1
|
import type { ReactNode } from "react";
|
2
|
-
import type {
|
2
|
+
import type { SharedValue } from "react-native-reanimated";
|
3
|
+
import type { SkCanvas, Skia, SkSize } from "../skia/types";
|
3
4
|
import { NodeType } from "../dom/types";
|
4
5
|
import "./Elements";
|
5
6
|
export declare class SkiaSGRoot {
|
6
7
|
Skia: Skia;
|
7
8
|
private root;
|
8
9
|
private container;
|
9
|
-
constructor(Skia: Skia, nativeId?: number);
|
10
|
+
constructor(Skia: Skia, nativeId?: number, onSize?: SharedValue<SkSize>);
|
10
11
|
get sg(): {
|
11
12
|
type: NodeType;
|
12
13
|
props: {};
|
@@ -2,6 +2,7 @@ import type { ViewProps } from "react-native";
|
|
2
2
|
export interface NativeProps extends ViewProps {
|
3
3
|
debug?: boolean;
|
4
4
|
opaque?: boolean;
|
5
|
+
colorSpace?: string;
|
5
6
|
}
|
6
7
|
declare const _default: import("react-native/Libraries/Utilities/codegenNativeComponent").NativeComponentType<NativeProps>;
|
7
8
|
export default _default;
|
@@ -12,6 +12,7 @@ export interface ISkiaViewApi {
|
|
12
12
|
requestRedraw: (nativeId: number) => void;
|
13
13
|
makeImageSnapshot: (nativeId: number, rect?: SkRect) => SkImage;
|
14
14
|
makeImageSnapshotAsync: (nativeId: number, rect?: SkRect) => Promise<SkImage>;
|
15
|
+
size: (nativeId: number) => SkSize;
|
15
16
|
}
|
16
17
|
export interface SkiaBaseViewProps extends ViewProps {
|
17
18
|
/**
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -8,7 +8,7 @@
|
|
8
8
|
<key>BinaryPath</key>
|
9
9
|
<string>libpathops.a</string>
|
10
10
|
<key>LibraryIdentifier</key>
|
11
|
-
<string>
|
11
|
+
<string>ios-arm64_arm64e</string>
|
12
12
|
<key>LibraryPath</key>
|
13
13
|
<string>libpathops.a</string>
|
14
14
|
<key>SupportedArchitectures</key>
|
@@ -17,73 +17,73 @@
|
|
17
17
|
<string>arm64e</string>
|
18
18
|
</array>
|
19
19
|
<key>SupportedPlatform</key>
|
20
|
-
<string>
|
20
|
+
<string>ios</string>
|
21
21
|
</dict>
|
22
22
|
<dict>
|
23
23
|
<key>BinaryPath</key>
|
24
24
|
<string>libpathops.a</string>
|
25
25
|
<key>LibraryIdentifier</key>
|
26
|
-
<string>ios-
|
26
|
+
<string>ios-arm64_arm64e_x86_64-simulator</string>
|
27
27
|
<key>LibraryPath</key>
|
28
28
|
<string>libpathops.a</string>
|
29
29
|
<key>SupportedArchitectures</key>
|
30
30
|
<array>
|
31
31
|
<string>arm64</string>
|
32
32
|
<string>arm64e</string>
|
33
|
+
<string>x86_64</string>
|
33
34
|
</array>
|
34
35
|
<key>SupportedPlatform</key>
|
35
36
|
<string>ios</string>
|
37
|
+
<key>SupportedPlatformVariant</key>
|
38
|
+
<string>simulator</string>
|
36
39
|
</dict>
|
37
40
|
<dict>
|
38
41
|
<key>BinaryPath</key>
|
39
42
|
<string>libpathops.a</string>
|
40
43
|
<key>LibraryIdentifier</key>
|
41
|
-
<string>
|
44
|
+
<string>tvos-arm64_arm64e_x86_64-simulator</string>
|
42
45
|
<key>LibraryPath</key>
|
43
46
|
<string>libpathops.a</string>
|
44
47
|
<key>SupportedArchitectures</key>
|
45
48
|
<array>
|
46
49
|
<string>arm64</string>
|
50
|
+
<string>arm64e</string>
|
47
51
|
<string>x86_64</string>
|
48
52
|
</array>
|
49
53
|
<key>SupportedPlatform</key>
|
50
|
-
<string>
|
54
|
+
<string>tvos</string>
|
55
|
+
<key>SupportedPlatformVariant</key>
|
56
|
+
<string>simulator</string>
|
51
57
|
</dict>
|
52
58
|
<dict>
|
53
59
|
<key>BinaryPath</key>
|
54
60
|
<string>libpathops.a</string>
|
55
61
|
<key>LibraryIdentifier</key>
|
56
|
-
<string>
|
62
|
+
<string>macos-arm64_x86_64</string>
|
57
63
|
<key>LibraryPath</key>
|
58
64
|
<string>libpathops.a</string>
|
59
65
|
<key>SupportedArchitectures</key>
|
60
66
|
<array>
|
61
67
|
<string>arm64</string>
|
62
|
-
<string>arm64e</string>
|
63
68
|
<string>x86_64</string>
|
64
69
|
</array>
|
65
70
|
<key>SupportedPlatform</key>
|
66
|
-
<string>
|
67
|
-
<key>SupportedPlatformVariant</key>
|
68
|
-
<string>simulator</string>
|
71
|
+
<string>macos</string>
|
69
72
|
</dict>
|
70
73
|
<dict>
|
71
74
|
<key>BinaryPath</key>
|
72
75
|
<string>libpathops.a</string>
|
73
76
|
<key>LibraryIdentifier</key>
|
74
|
-
<string>
|
77
|
+
<string>tvos-arm64_arm64e</string>
|
75
78
|
<key>LibraryPath</key>
|
76
79
|
<string>libpathops.a</string>
|
77
80
|
<key>SupportedArchitectures</key>
|
78
81
|
<array>
|
79
82
|
<string>arm64</string>
|
80
83
|
<string>arm64e</string>
|
81
|
-
<string>x86_64</string>
|
82
84
|
</array>
|
83
85
|
<key>SupportedPlatform</key>
|
84
|
-
<string>
|
85
|
-
<key>SupportedPlatformVariant</key>
|
86
|
-
<string>simulator</string>
|
86
|
+
<string>tvos</string>
|
87
87
|
</dict>
|
88
88
|
</array>
|
89
89
|
<key>CFBundlePackageType</key>
|