@shopify/react-native-skia 2.1.0 → 2.2.0
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/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/Convertor.h +16 -0
- package/cpp/api/recorder/ImageFilters.h +20 -0
- package/cpp/api/recorder/Paint.h +4 -0
- package/cpp/api/recorder/RNRecorder.h +6 -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/RNSkPlatformContext.h +1 -1
- package/lib/commonjs/dom/types/Drawings.d.ts +4 -1
- package/lib/commonjs/dom/types/Drawings.js.map +1 -1
- package/lib/commonjs/dom/types/NodeType.d.ts +2 -1
- package/lib/commonjs/dom/types/NodeType.js +2 -0
- package/lib/commonjs/dom/types/NodeType.js.map +1 -1
- package/lib/commonjs/renderer/Canvas.d.ts +2 -1
- package/lib/commonjs/renderer/Canvas.js +2 -0
- package/lib/commonjs/renderer/Canvas.js.map +1 -1
- package/lib/commonjs/renderer/__tests__/e2e/ImageFilter.spec.d.ts +1 -0
- package/lib/commonjs/renderer/components/ImageFilter.d.ts +4 -0
- package/lib/commonjs/renderer/components/ImageFilter.js +13 -0
- package/lib/commonjs/renderer/components/ImageFilter.js.map +1 -0
- package/lib/commonjs/renderer/components/index.d.ts +1 -0
- package/lib/commonjs/renderer/components/index.js +11 -0
- package/lib/commonjs/renderer/components/index.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/Elements.d.ts +2 -1
- package/lib/commonjs/sksg/Elements.js.map +1 -1
- package/lib/commonjs/sksg/Node.d.ts +1 -1
- package/lib/commonjs/sksg/Node.js +1 -1
- package/lib/commonjs/sksg/Node.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 +11 -1
- 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/module/dom/types/Drawings.d.ts +4 -1
- package/lib/module/dom/types/Drawings.js.map +1 -1
- package/lib/module/dom/types/NodeType.d.ts +2 -1
- package/lib/module/dom/types/NodeType.js +2 -0
- package/lib/module/dom/types/NodeType.js.map +1 -1
- package/lib/module/renderer/Canvas.d.ts +2 -1
- package/lib/module/renderer/Canvas.js +2 -0
- package/lib/module/renderer/Canvas.js.map +1 -1
- package/lib/module/renderer/__tests__/e2e/ImageFilter.spec.d.ts +1 -0
- package/lib/module/renderer/components/ImageFilter.d.ts +4 -0
- package/lib/module/renderer/components/ImageFilter.js +5 -0
- package/lib/module/renderer/components/ImageFilter.js.map +1 -0
- package/lib/module/renderer/components/index.d.ts +1 -0
- package/lib/module/renderer/components/index.js +1 -0
- package/lib/module/renderer/components/index.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/Elements.d.ts +2 -1
- package/lib/module/sksg/Elements.js.map +1 -1
- package/lib/module/sksg/Node.d.ts +1 -1
- package/lib/module/sksg/Node.js +1 -1
- package/lib/module/sksg/Node.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 +11 -1
- 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/typescript/lib/commonjs/renderer/Canvas.d.ts +2 -1
- package/lib/typescript/lib/commonjs/renderer/components/ImageFilter.d.ts +2 -0
- package/lib/typescript/lib/commonjs/skia/types/Matrix4.d.ts +1 -0
- package/lib/typescript/lib/module/mock/index.d.ts +2 -0
- package/lib/typescript/lib/module/renderer/Canvas.d.ts +2 -1
- package/lib/typescript/lib/module/renderer/components/ImageFilter.d.ts +2 -0
- package/lib/typescript/lib/module/renderer/components/index.d.ts +1 -0
- package/lib/typescript/lib/module/skia/types/Matrix4.d.ts +1 -0
- package/lib/typescript/src/dom/types/Drawings.d.ts +4 -1
- package/lib/typescript/src/dom/types/NodeType.d.ts +2 -1
- package/lib/typescript/src/renderer/Canvas.d.ts +2 -1
- package/lib/typescript/src/renderer/__tests__/e2e/ImageFilter.spec.d.ts +1 -0
- package/lib/typescript/src/renderer/components/ImageFilter.d.ts +4 -0
- package/lib/typescript/src/renderer/components/index.d.ts +1 -0
- package/lib/typescript/src/skia/types/Matrix4.d.ts +4 -0
- package/lib/typescript/src/sksg/Elements.d.ts +2 -1
- package/lib/typescript/src/sksg/Node.d.ts +1 -1
- package/lib/typescript/src/specs/SkiaPictureViewNativeComponent.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 +5 -0
- package/src/dom/types/NodeType.ts +2 -0
- package/src/renderer/Canvas.tsx +3 -0
- package/src/renderer/__tests__/FitBox.spec.tsx +556 -4
- package/src/renderer/__tests__/e2e/ImageFilter.spec.tsx +99 -0
- 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 +10 -0
- package/src/renderer/components/ImageFilter.tsx +8 -0
- package/src/renderer/components/index.ts +1 -0
- package/src/skia/types/Matrix4.ts +16 -0
- package/src/sksg/Elements.tsx +2 -0
- package/src/sksg/Node.ts +1 -0
- package/src/sksg/Recorder/Player.ts +7 -7
- package/src/sksg/Recorder/commands/ImageFilters.ts +11 -1
- package/src/specs/SkiaPictureViewNativeComponent.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
@@ -119,6 +119,14 @@ const declareRuntimeShaderImageFilter = (ctx, props) => {
|
|
119
119
|
const imgf = ctx.Skia.ImageFilter.MakeRuntimeShader(rtb, null, null);
|
120
120
|
ctx.imageFilters.push(imgf);
|
121
121
|
};
|
122
|
+
const declareImageFilter = (ctx, props) => {
|
123
|
+
"worklet";
|
124
|
+
|
125
|
+
const {
|
126
|
+
filter
|
127
|
+
} = props;
|
128
|
+
ctx.imageFilters.push(filter);
|
129
|
+
};
|
122
130
|
export const composeImageFilters = ctx => {
|
123
131
|
"worklet";
|
124
132
|
|
@@ -152,7 +160,9 @@ const isImageFilter = (command, type) => {
|
|
152
160
|
export const pushImageFilter = (ctx, command) => {
|
153
161
|
"worklet";
|
154
162
|
|
155
|
-
if (isImageFilter(command, NodeType.
|
163
|
+
if (isImageFilter(command, NodeType.ImageFilter)) {
|
164
|
+
declareImageFilter(ctx, command.props);
|
165
|
+
} else if (isImageFilter(command, NodeType.BlurImageFilter)) {
|
156
166
|
declareBlurImageFilter(ctx, command.props);
|
157
167
|
} else if (isImageFilter(command, NodeType.MorphologyImageFilter)) {
|
158
168
|
declareMorphologyImageFilter(ctx, command.props);
|
@@ -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","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 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\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.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.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;AAWzE,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,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AAe,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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EAAEnG,QAAQ,CAAC4G,0BAA0B,CAAC,EAAE;IACtEtC,iCAAiC,CAAC9B,GAAG,EAAE2D,OAAO,CAAC1D,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":[]}
|
@@ -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":[]}
|
@@ -1,11 +1,12 @@
|
|
1
1
|
export const __esModule: boolean;
|
2
2
|
export function useCanvasRef(): any;
|
3
|
-
export function Canvas({ debug, opaque, children, onSize, onLayout: _onLayout, ref, ...viewProps }: {
|
3
|
+
export function Canvas({ debug, opaque, children, onSize, onLayout: _onLayout, colorSpace, ref, ...viewProps }: {
|
4
4
|
[x: string]: any;
|
5
5
|
debug: any;
|
6
6
|
opaque: any;
|
7
7
|
children: any;
|
8
8
|
onSize: any;
|
9
9
|
onLayout: any;
|
10
|
+
colorSpace?: string | undefined;
|
10
11
|
ref: any;
|
11
12
|
}): 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
|
@@ -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[];
|
@@ -506,5 +507,6 @@ export function Mock(CanvasKit: any): {
|
|
506
507
|
Paint: (props: any) => import("react").DOMElement<any, Element>;
|
507
508
|
Blend: (props: any) => import("react").DOMElement<any, Element>;
|
508
509
|
Skottie: (props: any) => import("react").DOMElement<any, Element>;
|
510
|
+
ImageFilter: (props: any) => import("react").DOMElement<any, Element>;
|
509
511
|
Paragraph: (props: any) => import("react").DOMElement<any, Element>;
|
510
512
|
};
|
@@ -1,11 +1,12 @@
|
|
1
1
|
export function useCanvasRef(): React.RefObject<null>;
|
2
|
-
export function Canvas({ debug, opaque, children, onSize, onLayout: _onLayout, ref, ...viewProps }: {
|
2
|
+
export function Canvas({ debug, opaque, children, onSize, onLayout: _onLayout, colorSpace, ref, ...viewProps }: {
|
3
3
|
[x: string]: any;
|
4
4
|
debug: any;
|
5
5
|
opaque: any;
|
6
6
|
children: any;
|
7
7
|
onSize: any;
|
8
8
|
onLayout: any;
|
9
|
+
colorSpace?: string | undefined;
|
9
10
|
ref: any;
|
10
11
|
}): React.CElement<object, React.Component<object, {}, any> & import("react-native").NativeMethods>;
|
11
12
|
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,4 +1,4 @@
|
|
1
|
-
import type { FillType, SkImage, StrokeOpts, Vector, Color, SkPoint, BlendMode, PointMode, VertexMode, SkFont, SkRRect, SkTextBlob, SkPicture, SkSVG, SkPaint, SkRect, SkRSXform, SkColor, SamplingOptions, SkSkottieAnimation } from "../../skia/types";
|
1
|
+
import type { FillType, SkImage, StrokeOpts, Vector, Color, SkPoint, BlendMode, PointMode, VertexMode, SkFont, SkRRect, SkTextBlob, SkPicture, SkSVG, SkPaint, SkRect, SkRSXform, SkColor, SamplingOptions, SkSkottieAnimation, SkImageFilter } from "../../skia/types";
|
2
2
|
import type { CircleDef, Fit, GroupProps, PathDef, RectDef, RRectDef, SkEnum } from "./Common";
|
3
3
|
export interface DrawingNodeProps extends GroupProps {
|
4
4
|
paint?: SkPaint;
|
@@ -115,3 +115,6 @@ export interface BoxShadowProps {
|
|
115
115
|
color?: Color;
|
116
116
|
inner?: boolean;
|
117
117
|
}
|
118
|
+
export interface ImageFilterProps extends GroupProps {
|
119
|
+
filter: SkImageFilter;
|
120
|
+
}
|
@@ -14,6 +14,7 @@ export interface CanvasProps extends ViewProps {
|
|
14
14
|
debug?: boolean;
|
15
15
|
opaque?: boolean;
|
16
16
|
onSize?: SharedValue<SkSize>;
|
17
|
+
colorSpace?: "p3" | "srgb";
|
17
18
|
ref?: React.Ref<CanvasRef>;
|
18
19
|
}
|
19
|
-
export declare const Canvas: ({ debug, opaque, children, onSize, onLayout: _onLayout, ref, ...viewProps }: CanvasProps) => React.JSX.Element;
|
20
|
+
export declare const Canvas: ({ debug, opaque, children, onSize, onLayout: _onLayout, colorSpace, ref, ...viewProps }: CanvasProps) => React.JSX.Element;
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -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,4 +1,4 @@
|
|
1
|
-
import type { FractalNoiseProps, CircleProps, DrawingNodeProps, ImageProps, PaintProps, PathProps, LineProps, OvalProps, DiffRectProps, PointsProps, RectProps, RoundedRectProps, TextProps, VerticesProps, BlurMaskFilterProps, BlendImageFilterProps, BlurImageFilterProps, DisplacementMapImageFilterProps, DropShadowImageFilterProps, OffsetImageFilterProps, RuntimeShaderImageFilterProps, MatrixColorFilterProps, ShaderProps, ImageShaderProps, LinearGradientProps, GroupProps, PatchProps, BlendColorFilterProps, DashPathEffectProps, DiscretePathEffectProps, CornerPathEffectProps, Line2DPathEffectProps, Path1DPathEffectProps, Path2DPathEffectProps, TextPathProps, TextBlobProps, GlyphsProps, TwoPointConicalGradientProps, TurbulenceProps, SweepGradientProps, RadialGradientProps, ColorProps, PictureProps, ImageSVGProps, LerpColorFilterProps, BoxProps, BoxShadowProps, ParagraphProps, AtlasProps, ChildrenProps, MorphologyImageFilterProps, BlendProps, SkottieProps } from "../dom/types";
|
1
|
+
import type { FractalNoiseProps, CircleProps, DrawingNodeProps, ImageProps, PaintProps, PathProps, LineProps, OvalProps, DiffRectProps, PointsProps, RectProps, RoundedRectProps, TextProps, VerticesProps, BlurMaskFilterProps, BlendImageFilterProps, BlurImageFilterProps, DisplacementMapImageFilterProps, DropShadowImageFilterProps, OffsetImageFilterProps, RuntimeShaderImageFilterProps, MatrixColorFilterProps, ShaderProps, ImageShaderProps, LinearGradientProps, GroupProps, PatchProps, BlendColorFilterProps, DashPathEffectProps, DiscretePathEffectProps, CornerPathEffectProps, Line2DPathEffectProps, Path1DPathEffectProps, Path2DPathEffectProps, TextPathProps, TextBlobProps, GlyphsProps, TwoPointConicalGradientProps, TurbulenceProps, SweepGradientProps, RadialGradientProps, ColorProps, PictureProps, ImageSVGProps, LerpColorFilterProps, BoxProps, BoxShadowProps, ParagraphProps, AtlasProps, ChildrenProps, MorphologyImageFilterProps, BlendProps, SkottieProps, ImageFilterProps } from "../dom/types";
|
2
2
|
import type { SkiaProps } from "../renderer";
|
3
3
|
declare module "react" {
|
4
4
|
namespace JSX {
|
@@ -27,6 +27,7 @@ declare module "react" {
|
|
27
27
|
skPicture: SkiaProps<PictureProps>;
|
28
28
|
skImageSVG: SkiaProps<ImageSVGProps>;
|
29
29
|
skBlurMaskFilter: SkiaProps<BlurMaskFilterProps>;
|
30
|
+
skImageFilter: SkiaProps<ImageFilterProps>;
|
30
31
|
skBlendImageFilter: SkiaProps<BlendImageFilterProps>;
|
31
32
|
skBlurImageFilter: SkiaProps<BlurImageFilterProps>;
|
32
33
|
skOffsetImageFilter: SkiaProps<OffsetImageFilterProps>;
|
@@ -6,7 +6,7 @@ export interface Node<Props = unknown> {
|
|
6
6
|
}
|
7
7
|
export declare const isColorFilter: (type: NodeType) => type is NodeType.MatrixColorFilter | NodeType.BlendColorFilter | NodeType.LinearToSRGBGammaColorFilter | NodeType.SRGBToLinearGammaColorFilter | NodeType.LumaColorFilter | NodeType.LerpColorFilter;
|
8
8
|
export declare const isPathEffect: (type: NodeType) => type is NodeType.DiscretePathEffect | NodeType.DashPathEffect | NodeType.Path1DPathEffect | NodeType.Path2DPathEffect | NodeType.CornerPathEffect | NodeType.SumPathEffect | NodeType.Line2DPathEffect;
|
9
|
-
export declare const isImageFilter: (type: NodeType) => type is NodeType.OffsetImageFilter | NodeType.DisplacementMapImageFilter | NodeType.BlurImageFilter | NodeType.DropShadowImageFilter | NodeType.MorphologyImageFilter | NodeType.BlendImageFilter | NodeType.RuntimeShaderImageFilter;
|
9
|
+
export declare const isImageFilter: (type: NodeType) => type is NodeType.OffsetImageFilter | NodeType.DisplacementMapImageFilter | NodeType.BlurImageFilter | NodeType.DropShadowImageFilter | NodeType.MorphologyImageFilter | NodeType.BlendImageFilter | NodeType.RuntimeShaderImageFilter | NodeType.ImageFilter;
|
10
10
|
export declare const isShader: (type: NodeType) => type is NodeType.Shader | NodeType.ImageShader | NodeType.ColorShader | NodeType.Turbulence | NodeType.FractalNoise | NodeType.LinearGradient | NodeType.RadialGradient | NodeType.SweepGradient | NodeType.TwoPointConicalGradient;
|
11
11
|
export declare const sortNodeChildren: (parent: Node) => {
|
12
12
|
colorFilters: Node<unknown>[];
|
@@ -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;
|
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>
|
@@ -8,25 +8,22 @@
|
|
8
8
|
<key>BinaryPath</key>
|
9
9
|
<string>libskia.a</string>
|
10
10
|
<key>LibraryIdentifier</key>
|
11
|
-
<string>ios-
|
11
|
+
<string>ios-arm64_arm64e</string>
|
12
12
|
<key>LibraryPath</key>
|
13
13
|
<string>libskia.a</string>
|
14
14
|
<key>SupportedArchitectures</key>
|
15
15
|
<array>
|
16
16
|
<string>arm64</string>
|
17
17
|
<string>arm64e</string>
|
18
|
-
<string>x86_64</string>
|
19
18
|
</array>
|
20
19
|
<key>SupportedPlatform</key>
|
21
20
|
<string>ios</string>
|
22
|
-
<key>SupportedPlatformVariant</key>
|
23
|
-
<string>simulator</string>
|
24
21
|
</dict>
|
25
22
|
<dict>
|
26
23
|
<key>BinaryPath</key>
|
27
24
|
<string>libskia.a</string>
|
28
25
|
<key>LibraryIdentifier</key>
|
29
|
-
<string>
|
26
|
+
<string>tvos-arm64_arm64e</string>
|
30
27
|
<key>LibraryPath</key>
|
31
28
|
<string>libskia.a</string>
|
32
29
|
<key>SupportedArchitectures</key>
|
@@ -35,37 +32,40 @@
|
|
35
32
|
<string>arm64e</string>
|
36
33
|
</array>
|
37
34
|
<key>SupportedPlatform</key>
|
38
|
-
<string>
|
35
|
+
<string>tvos</string>
|
39
36
|
</dict>
|
40
37
|
<dict>
|
41
38
|
<key>BinaryPath</key>
|
42
39
|
<string>libskia.a</string>
|
43
40
|
<key>LibraryIdentifier</key>
|
44
|
-
<string>
|
41
|
+
<string>macos-arm64_x86_64</string>
|
45
42
|
<key>LibraryPath</key>
|
46
43
|
<string>libskia.a</string>
|
47
44
|
<key>SupportedArchitectures</key>
|
48
45
|
<array>
|
49
46
|
<string>arm64</string>
|
50
|
-
<string>
|
47
|
+
<string>x86_64</string>
|
51
48
|
</array>
|
52
49
|
<key>SupportedPlatform</key>
|
53
|
-
<string>
|
50
|
+
<string>macos</string>
|
54
51
|
</dict>
|
55
52
|
<dict>
|
56
53
|
<key>BinaryPath</key>
|
57
54
|
<string>libskia.a</string>
|
58
55
|
<key>LibraryIdentifier</key>
|
59
|
-
<string>
|
56
|
+
<string>ios-arm64_arm64e_x86_64-simulator</string>
|
60
57
|
<key>LibraryPath</key>
|
61
58
|
<string>libskia.a</string>
|
62
59
|
<key>SupportedArchitectures</key>
|
63
60
|
<array>
|
64
61
|
<string>arm64</string>
|
62
|
+
<string>arm64e</string>
|
65
63
|
<string>x86_64</string>
|
66
64
|
</array>
|
67
65
|
<key>SupportedPlatform</key>
|
68
|
-
<string>
|
66
|
+
<string>ios</string>
|
67
|
+
<key>SupportedPlatformVariant</key>
|
68
|
+
<string>simulator</string>
|
69
69
|
</dict>
|
70
70
|
<dict>
|
71
71
|
<key>BinaryPath</key>
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -8,82 +8,82 @@
|
|
8
8
|
<key>BinaryPath</key>
|
9
9
|
<string>libskottie.a</string>
|
10
10
|
<key>LibraryIdentifier</key>
|
11
|
-
<string>
|
11
|
+
<string>tvos-arm64_arm64e</string>
|
12
12
|
<key>LibraryPath</key>
|
13
13
|
<string>libskottie.a</string>
|
14
14
|
<key>SupportedArchitectures</key>
|
15
15
|
<array>
|
16
16
|
<string>arm64</string>
|
17
|
-
<string>
|
17
|
+
<string>arm64e</string>
|
18
18
|
</array>
|
19
19
|
<key>SupportedPlatform</key>
|
20
|
-
<string>
|
20
|
+
<string>tvos</string>
|
21
21
|
</dict>
|
22
22
|
<dict>
|
23
23
|
<key>BinaryPath</key>
|
24
24
|
<string>libskottie.a</string>
|
25
25
|
<key>LibraryIdentifier</key>
|
26
|
-
<string>
|
26
|
+
<string>tvos-arm64_arm64e_x86_64-simulator</string>
|
27
27
|
<key>LibraryPath</key>
|
28
28
|
<string>libskottie.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
|
-
<string>
|
36
|
+
<string>tvos</string>
|
37
|
+
<key>SupportedPlatformVariant</key>
|
38
|
+
<string>simulator</string>
|
36
39
|
</dict>
|
37
40
|
<dict>
|
38
41
|
<key>BinaryPath</key>
|
39
42
|
<string>libskottie.a</string>
|
40
43
|
<key>LibraryIdentifier</key>
|
41
|
-
<string>
|
44
|
+
<string>macos-arm64_x86_64</string>
|
42
45
|
<key>LibraryPath</key>
|
43
46
|
<string>libskottie.a</string>
|
44
47
|
<key>SupportedArchitectures</key>
|
45
48
|
<array>
|
46
49
|
<string>arm64</string>
|
47
|
-
<string>arm64e</string>
|
48
50
|
<string>x86_64</string>
|
49
51
|
</array>
|
50
52
|
<key>SupportedPlatform</key>
|
51
|
-
<string>
|
52
|
-
<key>SupportedPlatformVariant</key>
|
53
|
-
<string>simulator</string>
|
53
|
+
<string>macos</string>
|
54
54
|
</dict>
|
55
55
|
<dict>
|
56
56
|
<key>BinaryPath</key>
|
57
57
|
<string>libskottie.a</string>
|
58
58
|
<key>LibraryIdentifier</key>
|
59
|
-
<string>ios-
|
59
|
+
<string>ios-arm64_arm64e</string>
|
60
60
|
<key>LibraryPath</key>
|
61
61
|
<string>libskottie.a</string>
|
62
62
|
<key>SupportedArchitectures</key>
|
63
63
|
<array>
|
64
64
|
<string>arm64</string>
|
65
65
|
<string>arm64e</string>
|
66
|
-
<string>x86_64</string>
|
67
66
|
</array>
|
68
67
|
<key>SupportedPlatform</key>
|
69
68
|
<string>ios</string>
|
70
|
-
<key>SupportedPlatformVariant</key>
|
71
|
-
<string>simulator</string>
|
72
69
|
</dict>
|
73
70
|
<dict>
|
74
71
|
<key>BinaryPath</key>
|
75
72
|
<string>libskottie.a</string>
|
76
73
|
<key>LibraryIdentifier</key>
|
77
|
-
<string>
|
74
|
+
<string>ios-arm64_arm64e_x86_64-simulator</string>
|
78
75
|
<key>LibraryPath</key>
|
79
76
|
<string>libskottie.a</string>
|
80
77
|
<key>SupportedArchitectures</key>
|
81
78
|
<array>
|
82
79
|
<string>arm64</string>
|
83
80
|
<string>arm64e</string>
|
81
|
+
<string>x86_64</string>
|
84
82
|
</array>
|
85
83
|
<key>SupportedPlatform</key>
|
86
|
-
<string>
|
84
|
+
<string>ios</string>
|
85
|
+
<key>SupportedPlatformVariant</key>
|
86
|
+
<string>simulator</string>
|
87
87
|
</dict>
|
88
88
|
</array>
|
89
89
|
<key>CFBundlePackageType</key>
|