@shopify/react-native-skia 2.13.0 → 2.14.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 +2 -0
- package/android/cpp/jni/include/JniSkiaPictureView.h +16 -15
- package/android/cpp/rnskia-android/OpenGLContext.h +1 -1
- package/android/cpp/rnskia-android/gl/Surface.h +1 -1
- package/apple/RNSkApplePlatformContext.h +3 -4
- package/apple/RNSkiaModule.h +11 -3
- package/apple/RNSkiaModule.mm +46 -19
- package/apple/SkiaPictureView.mm +2 -2
- package/apple/SkiaUIView.h +0 -1
- package/apple/SkiaUIView.mm +1 -1
- package/apple/ViewScreenshotService.h +2 -2
- package/apple/ViewScreenshotService.mm +5 -4
- package/cpp/api/JsiSkImage.h +1 -1
- package/cpp/api/JsiSkImageFilter.h +3 -1
- package/cpp/api/JsiSkParagraph.h +2 -1
- package/cpp/api/JsiSkParagraphBuilder.h +1 -1
- package/cpp/api/JsiSkParagraphBuilderFactory.h +1 -1
- package/cpp/api/JsiSkPath.h +11 -435
- package/cpp/api/JsiSkPathBuilder.h +11 -4
- package/cpp/api/JsiSkPictureRecorder.h +2 -1
- package/cpp/api/JsiSkShader.h +3 -1
- package/cpp/api/JsiSkSkottie.h +29 -28
- package/cpp/api/JsiSkStrutStyle.h +1 -1
- package/cpp/api/JsiSkSurfaceFactory.h +41 -0
- package/cpp/api/recorder/Command.h +1 -1
- package/cpp/api/recorder/Convertor.h +153 -132
- package/cpp/api/recorder/DataTypes.h +12 -12
- package/cpp/api/recorder/DrawingCtx.h +1 -1
- package/cpp/api/recorder/ImageFit.h +8 -5
- package/cpp/api/recorder/JsiRecorder.h +14 -31
- package/cpp/api/recorder/Paint.h +3 -3
- package/cpp/api/recorder/RNRecorder.h +56 -0
- package/cpp/api/third_party/base64.cpp +1 -1
- package/cpp/jsi/JSICache.cpp +23 -0
- package/cpp/jsi/JSICache.h +28 -1
- package/cpp/jsi/NativeObject.h +36 -7
- package/cpp/jsi/ViewProperty.cpp +23 -0
- package/cpp/jsi/ViewProperty.h +31 -10
- package/cpp/rnskia/RNDawnContext.h +34 -1
- package/cpp/rnskia/RNSkJsiViewApi.h +69 -2
- package/cpp/rnskia/RNSkPictureView.cpp +58 -0
- package/cpp/rnskia/RNSkPictureView.h +110 -24
- package/lib/commonjs/Platform/IPlatform.js.map +1 -1
- package/lib/commonjs/animation/functions/interpolate.js.map +1 -1
- package/lib/commonjs/animation/functions/interpolatePaths.js +18 -0
- package/lib/commonjs/animation/functions/interpolatePaths.js.map +1 -1
- package/lib/commonjs/skia/core/Image.js.map +1 -1
- package/lib/commonjs/skia/types/NativeBuffer/NativeBufferFactory.js.map +1 -1
- package/lib/commonjs/skia/types/Path/Path.d.ts +2 -336
- package/lib/commonjs/skia/types/Path/Path.js.map +1 -1
- package/lib/commonjs/skia/types/Recorder.d.ts +10 -0
- package/lib/commonjs/skia/types/Recorder.js.map +1 -1
- package/lib/commonjs/skia/types/Shader/Shader.js.map +1 -1
- package/lib/commonjs/skia/types/Surface/SurfaceFactory.d.ts +16 -0
- package/lib/commonjs/skia/types/Surface/SurfaceFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPath.d.ts +4 -38
- package/lib/commonjs/skia/web/JsiSkPath.js +3 -275
- package/lib/commonjs/skia/web/JsiSkPath.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkSurfaceFactory.d.ts +2 -1
- package/lib/commonjs/skia/web/JsiSkSurfaceFactory.js +3 -0
- package/lib/commonjs/skia/web/JsiSkSurfaceFactory.js.map +1 -1
- package/lib/commonjs/sksg/Container.native.d.ts +15 -1
- package/lib/commonjs/sksg/Container.native.js +34 -33
- package/lib/commonjs/sksg/Container.native.js.map +1 -1
- package/lib/commonjs/specs/NativeSkiaModule.web.js +4 -0
- package/lib/commonjs/specs/NativeSkiaModule.web.js.map +1 -1
- package/lib/commonjs/views/types.d.ts +9 -0
- package/lib/commonjs/views/types.js.map +1 -1
- package/lib/module/Platform/IPlatform.js.map +1 -1
- package/lib/module/animation/functions/interpolate.js.map +1 -1
- package/lib/module/animation/functions/interpolatePaths.js +18 -0
- package/lib/module/animation/functions/interpolatePaths.js.map +1 -1
- package/lib/module/skia/core/Image.js.map +1 -1
- package/lib/module/skia/types/NativeBuffer/NativeBufferFactory.js.map +1 -1
- package/lib/module/skia/types/Path/Path.d.ts +2 -336
- package/lib/module/skia/types/Path/Path.js.map +1 -1
- package/lib/module/skia/types/Recorder.d.ts +10 -0
- package/lib/module/skia/types/Recorder.js.map +1 -1
- package/lib/module/skia/types/Shader/Shader.js.map +1 -1
- package/lib/module/skia/types/Surface/SurfaceFactory.d.ts +16 -0
- package/lib/module/skia/types/Surface/SurfaceFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkPath.d.ts +4 -38
- package/lib/module/skia/web/JsiSkPath.js +4 -276
- package/lib/module/skia/web/JsiSkPath.js.map +1 -1
- package/lib/module/skia/web/JsiSkSurfaceFactory.d.ts +2 -1
- package/lib/module/skia/web/JsiSkSurfaceFactory.js +4 -1
- package/lib/module/skia/web/JsiSkSurfaceFactory.js.map +1 -1
- package/lib/module/sksg/Container.native.d.ts +15 -1
- package/lib/module/sksg/Container.native.js +34 -33
- package/lib/module/sksg/Container.native.js.map +1 -1
- package/lib/module/specs/NativeSkiaModule.web.js +4 -0
- package/lib/module/specs/NativeSkiaModule.web.js.map +1 -1
- package/lib/module/views/types.d.ts +9 -0
- package/lib/module/views/types.js.map +1 -1
- package/lib/typescript/lib/commonjs/skia/web/JsiSkPath.d.ts +1 -35
- package/lib/typescript/lib/commonjs/skia/web/JsiSkSurfaceFactory.d.ts +1 -0
- package/lib/typescript/lib/commonjs/sksg/Container.native.d.ts +15 -1
- package/lib/typescript/lib/module/skia/web/JsiSkPath.d.ts +3 -37
- package/lib/typescript/lib/module/skia/web/JsiSkSurfaceFactory.d.ts +1 -0
- package/lib/typescript/lib/module/sksg/Container.native.d.ts +15 -1
- package/lib/typescript/src/skia/types/Path/Path.d.ts +2 -336
- package/lib/typescript/src/skia/types/Recorder.d.ts +10 -0
- package/lib/typescript/src/skia/types/Surface/SurfaceFactory.d.ts +16 -0
- package/lib/typescript/src/skia/web/JsiSkPath.d.ts +4 -38
- package/lib/typescript/src/skia/web/JsiSkSurfaceFactory.d.ts +2 -1
- package/lib/typescript/src/sksg/Container.native.d.ts +15 -1
- package/lib/typescript/src/views/types.d.ts +9 -0
- package/package.json +2 -2
- package/src/Platform/IPlatform.ts +1 -4
- package/src/animation/functions/interpolate.ts +1 -4
- package/src/animation/functions/interpolatePaths.ts +24 -0
- package/src/skia/core/Image.ts +1 -2
- package/src/skia/types/NativeBuffer/NativeBufferFactory.ts +2 -5
- package/src/skia/types/Path/Path.ts +2 -420
- package/src/skia/types/Recorder.ts +10 -0
- package/src/skia/types/Shader/Shader.ts +1 -5
- package/src/skia/types/Surface/SurfaceFactory.ts +17 -0
- package/src/skia/web/JsiSkPath.ts +4 -495
- package/src/skia/web/JsiSkSurfaceFactory.ts +6 -2
- package/src/sksg/Container.native.ts +34 -37
- package/src/specs/NativeSkiaModule.web.ts +4 -0
- package/src/views/types.ts +13 -0
- package/apple/SkiaManager.h +0 -23
- package/apple/SkiaManager.mm +0 -63
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Rea","HAS_REANIMATED_3","HAS_REANIMATED_4","REANIMATED_VERSION_MAJOR","ReanimatedRecorder","Container","StaticContainer","visit","SkiaViewApi","globalThis","
|
|
1
|
+
{"version":3,"names":["Rea","HAS_REANIMATED_3","HAS_REANIMATED_4","REANIMATED_VERSION_MAJOR","ReanimatedRecorder","Container","StaticContainer","visit","SkiaViewApi","globalThis","NativeReanimatedContainer","constructor","Skia","nativeId","_defineProperty","stopMapper","mapperId","unmount","redraw","unmounted","recorder","root","sharedValues","getSharedValues","nativeRecorder","getRecorder","recorderId","getId","setJsiProperty","dispose","length","startMapper","applyUpdates","hasWarnedAboutReanimatedSupport","reanimatedSupportError","createContainer","message","__DEV__","Error","console","error"],"sources":["Container.native.ts"],"sourcesContent":["import Rea from \"../external/reanimated/ReanimatedProxy\";\nimport type { Skia } from \"../skia/types\";\nimport {\n HAS_REANIMATED_3,\n HAS_REANIMATED_4,\n REANIMATED_VERSION_MAJOR,\n} from \"../external/reanimated/renderHelpers\";\n\nimport { ReanimatedRecorder } from \"./Recorder/ReanimatedRecorder\";\nimport { Container, StaticContainer } from \"./StaticContainer\";\nimport { visit } from \"./Recorder/Visitor\";\n\nimport \"../skia/NativeSetup\";\nimport \"../views/api\";\n\n// create local reference for `strictGlobal` option in Worklets\nconst { SkiaViewApi } = globalThis;\n\n/**\n * Records the scene graph on the JS thread and hands the native recorder to\n * the view, which owns it and replays it on every draw. The Reanimated mapper\n * only pushes the shared values into that recorder through the view id: no\n * Skia object is captured by a worklet, so nothing on the UI runtime holds\n * native memory. The JS wrapper is disposed right after the handoff, so the\n * view is the sole owner and the resources referenced by the recording\n * (images, pictures) are released when the view replaces it or is torn down,\n * not when a garbage collector gets around to a wrapper.\n *\n * Unmounting does not clear the view: the native view can outlive the React\n * tree (exit animations, screen transitions) and keeps showing its last frame\n * until it is torn down, which is when the recording is released.\n */\nclass NativeReanimatedContainer extends Container {\n private mapperId: number | null = null;\n\n constructor(\n Skia: Skia,\n private nativeId: number\n ) {\n super(Skia);\n }\n\n private stopMapper() {\n if (this.mapperId !== null) {\n Rea.stopMapper(this.mapperId);\n this.mapperId = null;\n }\n }\n\n unmount() {\n super.unmount();\n this.stopMapper();\n }\n\n redraw() {\n this.stopMapper();\n if (this.unmounted) {\n return;\n }\n const recorder = new ReanimatedRecorder(this.Skia);\n visit(recorder, this.root);\n const sharedValues = recorder.getSharedValues();\n const { nativeId } = this;\n const nativeRecorder = recorder.getRecorder();\n // stopMapper() only takes effect on the UI thread later, so the previous\n // mapper can still fire after the new recording is installed. Tagging the\n // updates with the recording id lets the view ignore them.\n const recorderId = nativeRecorder.getId();\n // The view takes ownership of the recorder and draws the first frame. The\n // wrapper is disposed right away: it would otherwise co-own the recording\n // until the JS garbage collector finalizes it.\n SkiaViewApi.setJsiProperty(nativeId, \"recorder\", nativeRecorder);\n nativeRecorder.dispose();\n if (sharedValues.length > 0) {\n this.mapperId = Rea.startMapper(() => {\n \"worklet\";\n SkiaViewApi.applyUpdates(nativeId, recorderId, sharedValues);\n }, sharedValues);\n }\n }\n}\n\nlet hasWarnedAboutReanimatedSupport = false;\n\nconst reanimatedSupportError = () => {\n if (REANIMATED_VERSION_MAJOR !== null && REANIMATED_VERSION_MAJOR >= 4) {\n return (\n \"React Native Skia requires react-native-worklets >= 0.7.0 for its \" +\n \"Reanimated integration on native platforms. Reanimated 4 is \" +\n \"installed, but react-native-worklets is missing or too old. \" +\n \"Please install or upgrade react-native-worklets.\"\n );\n }\n return (\n \"React Native Skia requires Reanimated 4 (react-native-worklets >= \" +\n \"0.7.0) for its Reanimated integration on native platforms. \" +\n \"Reanimated 3 is not supported anymore: Skia objects cannot be used \" +\n \"inside worklets or shared values with it. \" +\n \"Please upgrade to react-native-reanimated >= 4.0.0.\"\n );\n};\n\nexport const createContainer = (Skia: Skia, nativeId: number) => {\n if (HAS_REANIMATED_4 && nativeId !== -1) {\n return new NativeReanimatedContainer(Skia, nativeId);\n } else {\n if (HAS_REANIMATED_3 && !HAS_REANIMATED_4) {\n const message = reanimatedSupportError();\n if (__DEV__) {\n // Fail loudly in development — a silent fallback to static rendering\n // would only be noticed as frozen animations.\n throw new Error(message);\n }\n if (!hasWarnedAboutReanimatedSupport) {\n hasWarnedAboutReanimatedSupport = true;\n console.error(\n `${message} Falling back to static rendering (animations will not run).`\n );\n }\n }\n return new StaticContainer(Skia, nativeId);\n }\n};\n"],"mappings":";;;AAAA,OAAOA,GAAG,MAAM,wCAAwC;AAExD,SACEC,gBAAgB,EAChBC,gBAAgB,EAChBC,wBAAwB,QACnB,sCAAsC;AAE7C,SAASC,kBAAkB,QAAQ,+BAA+B;AAClE,SAASC,SAAS,EAAEC,eAAe,QAAQ,mBAAmB;A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
|
|
|
51
51
|
// The view may already have unmounted (e.g. a trailing animation frame).
|
|
52
52
|
(_this$views = this.views[`${nativeId}`]) === null || _this$views === void 0 || _this$views.redraw();
|
|
53
53
|
},
|
|
54
|
+
applyUpdates() {
|
|
55
|
+
// Web canvases are driven from JS (see Container.web.ts); there is no
|
|
56
|
+
// view-owned recorder to update.
|
|
57
|
+
},
|
|
54
58
|
makeImageSnapshot(nativeId, rect) {
|
|
55
59
|
const view = this.views[`${nativeId}`];
|
|
56
60
|
if (!view) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["global","SkiaViewApi","views","deferedPictures","unregisteredViews","Set","deferedOnSize","web","registerView","nativeId","view","delete","setPicture","unregisterView","add","setJsiProperty","name","value","id","has","size","getSize","width","height","requestRedraw","_this$views","redraw","makeImageSnapshot","rect","Error","makeImageSnapshotAsync","Promise","resolve","reject","result"],"sources":["NativeSkiaModule.web.ts"],"sourcesContent":["/* eslint-disable import/no-anonymous-default-export */\nimport type { SkPicture, SkRect } from \"../skia/types\";\nimport type { ISkiaViewApi } from \"../views/types\";\nimport type { SkiaPictureViewHandle } from \"../views/SkiaPictureView.web\";\n\nexport type ISkiaViewApiWeb = ISkiaViewApi & {\n views: Record<string, SkiaPictureViewHandle>;\n deferedPictures: Record<string, SkPicture>;\n unregisteredViews: Set<string>;\n registerView(nativeId: string, view: SkiaPictureViewHandle): void;\n unregisterView(nativeId: string): void;\n};\n\nglobal.SkiaViewApi = {\n views: {},\n deferedPictures: {},\n unregisteredViews: new Set<string>(),\n deferedOnSize: {},\n web: true,\n registerView(nativeId: string, view: SkiaPictureViewHandle) {\n this.unregisteredViews.delete(nativeId);\n // Maybe a picture for this view was already set\n if (this.deferedPictures[nativeId]) {\n view.setPicture(this.deferedPictures[nativeId] as SkPicture);\n delete this.deferedPictures[nativeId];\n }\n this.views[nativeId] = view;\n },\n unregisterView(nativeId: string) {\n // Views must be removed on unmount: the handle's closures capture the\n // canvas element, so a stale entry retains the whole detached DOM tree.\n this.unregisteredViews.add(nativeId);\n delete this.views[nativeId];\n delete this.deferedPictures[nativeId];\n },\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n setJsiProperty(nativeId: number, name: string, value: any) {\n if (name === \"picture\") {\n const id = `${nativeId}`;\n if (this.views[id]) {\n this.views[id].setPicture(value);\n } else if (!this.unregisteredViews.has(id)) {\n this.deferedPictures[id] = value;\n }\n // Otherwise the view has unmounted (e.g. a trailing animation frame):\n // drop the picture instead of deferring it for an id that will never\n // register again, which would retain it forever.\n }\n },\n size(nativeId: number) {\n if (this.views[`${nativeId}`]) {\n return this.views[`${nativeId}`].getSize();\n } else {\n return { width: 0, height: 0 };\n }\n },\n requestRedraw(nativeId: number) {\n // The view may already have unmounted (e.g. a trailing animation frame).\n this.views[`${nativeId}`]?.redraw();\n },\n makeImageSnapshot(nativeId: number, rect?: SkRect) {\n const view = this.views[`${nativeId}`];\n if (!view) {\n throw new Error(\n `Cannot make image snapshot: view with nativeID ${nativeId} is not registered (it may have unmounted)`\n );\n }\n return view.makeImageSnapshot(rect);\n },\n makeImageSnapshotAsync(nativeId: number, rect?: SkRect) {\n return new Promise((resolve, reject) => {\n const view = this.views[`${nativeId}`];\n if (!view) {\n reject(\n new Error(\n `Cannot make image snapshot: view with nativeID ${nativeId} is not registered (it may have unmounted)`\n )\n );\n return;\n }\n const result = view.makeImageSnapshot(rect);\n if (result) {\n resolve(result);\n } else {\n reject(new Error(\"Failed to make image snapshot\"));\n }\n });\n },\n} as ISkiaViewApiWeb;\n\n// eslint-disable-next-line import/no-default-export\nexport default {};\n"],"mappings":"AAAA;;AAaAA,MAAM,CAACC,WAAW,GAAG;EACnBC,KAAK,EAAE,CAAC,CAAC;EACTC,eAAe,EAAE,CAAC,CAAC;EACnBC,iBAAiB,EAAE,IAAIC,GAAG,CAAS,CAAC;EACpCC,aAAa,EAAE,CAAC,CAAC;EACjBC,GAAG,EAAE,IAAI;EACTC,YAAYA,CAACC,QAAgB,EAAEC,IAA2B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CAAC;QAAEC,MAAM,EAAE;MAAE,CAAC;IAChC;EACF,CAAC;EACDC,aAAaA,CAACf,QAAgB,EAAE;IAAA,IAAAgB,WAAA;IAC9B;IACA,CAAAA,WAAA,OAAI,CAACvB,KAAK,CAAC,GAAGO,QAAQ,EAAE,CAAC,cAAAgB,WAAA,eAAzBA,WAAA,CAA2BC,MAAM,CAAC,CAAC;EACrC,CAAC;EACDC,iBAAiBA,
|
|
1
|
+
{"version":3,"names":["global","SkiaViewApi","views","deferedPictures","unregisteredViews","Set","deferedOnSize","web","registerView","nativeId","view","delete","setPicture","unregisterView","add","setJsiProperty","name","value","id","has","size","getSize","width","height","requestRedraw","_this$views","redraw","applyUpdates","makeImageSnapshot","rect","Error","makeImageSnapshotAsync","Promise","resolve","reject","result"],"sources":["NativeSkiaModule.web.ts"],"sourcesContent":["/* eslint-disable import/no-anonymous-default-export */\nimport type { SkPicture, SkRect } from \"../skia/types\";\nimport type { ISkiaViewApi } from \"../views/types\";\nimport type { SkiaPictureViewHandle } from \"../views/SkiaPictureView.web\";\n\nexport type ISkiaViewApiWeb = ISkiaViewApi & {\n views: Record<string, SkiaPictureViewHandle>;\n deferedPictures: Record<string, SkPicture>;\n unregisteredViews: Set<string>;\n registerView(nativeId: string, view: SkiaPictureViewHandle): void;\n unregisterView(nativeId: string): void;\n};\n\nglobal.SkiaViewApi = {\n views: {},\n deferedPictures: {},\n unregisteredViews: new Set<string>(),\n deferedOnSize: {},\n web: true,\n registerView(nativeId: string, view: SkiaPictureViewHandle) {\n this.unregisteredViews.delete(nativeId);\n // Maybe a picture for this view was already set\n if (this.deferedPictures[nativeId]) {\n view.setPicture(this.deferedPictures[nativeId] as SkPicture);\n delete this.deferedPictures[nativeId];\n }\n this.views[nativeId] = view;\n },\n unregisterView(nativeId: string) {\n // Views must be removed on unmount: the handle's closures capture the\n // canvas element, so a stale entry retains the whole detached DOM tree.\n this.unregisteredViews.add(nativeId);\n delete this.views[nativeId];\n delete this.deferedPictures[nativeId];\n },\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n setJsiProperty(nativeId: number, name: string, value: any) {\n if (name === \"picture\") {\n const id = `${nativeId}`;\n if (this.views[id]) {\n this.views[id].setPicture(value);\n } else if (!this.unregisteredViews.has(id)) {\n this.deferedPictures[id] = value;\n }\n // Otherwise the view has unmounted (e.g. a trailing animation frame):\n // drop the picture instead of deferring it for an id that will never\n // register again, which would retain it forever.\n }\n },\n size(nativeId: number) {\n if (this.views[`${nativeId}`]) {\n return this.views[`${nativeId}`].getSize();\n } else {\n return { width: 0, height: 0 };\n }\n },\n requestRedraw(nativeId: number) {\n // The view may already have unmounted (e.g. a trailing animation frame).\n this.views[`${nativeId}`]?.redraw();\n },\n applyUpdates() {\n // Web canvases are driven from JS (see Container.web.ts); there is no\n // view-owned recorder to update.\n },\n makeImageSnapshot(nativeId: number, rect?: SkRect) {\n const view = this.views[`${nativeId}`];\n if (!view) {\n throw new Error(\n `Cannot make image snapshot: view with nativeID ${nativeId} is not registered (it may have unmounted)`\n );\n }\n return view.makeImageSnapshot(rect);\n },\n makeImageSnapshotAsync(nativeId: number, rect?: SkRect) {\n return new Promise((resolve, reject) => {\n const view = this.views[`${nativeId}`];\n if (!view) {\n reject(\n new Error(\n `Cannot make image snapshot: view with nativeID ${nativeId} is not registered (it may have unmounted)`\n )\n );\n return;\n }\n const result = view.makeImageSnapshot(rect);\n if (result) {\n resolve(result);\n } else {\n reject(new Error(\"Failed to make image snapshot\"));\n }\n });\n },\n} as ISkiaViewApiWeb;\n\n// eslint-disable-next-line import/no-default-export\nexport default {};\n"],"mappings":"AAAA;;AAaAA,MAAM,CAACC,WAAW,GAAG;EACnBC,KAAK,EAAE,CAAC,CAAC;EACTC,eAAe,EAAE,CAAC,CAAC;EACnBC,iBAAiB,EAAE,IAAIC,GAAG,CAAS,CAAC;EACpCC,aAAa,EAAE,CAAC,CAAC;EACjBC,GAAG,EAAE,IAAI;EACTC,YAAYA,CAACC,QAAgB,EAAEC,IAA2B,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
|
|
2
|
+
import type { SharedValue } from "react-native-reanimated";
|
|
2
3
|
import type { SkImage, SkPicture, SkRect, SkSize } from "../skia/types";
|
|
3
4
|
export type NativeSkiaViewProps = ViewProps & {
|
|
4
5
|
debug?: boolean;
|
|
@@ -22,6 +23,14 @@ export interface ISkiaViewApi {
|
|
|
22
23
|
web?: boolean;
|
|
23
24
|
setJsiProperty: <T>(nativeId: number, name: string, value: T) => void;
|
|
24
25
|
requestRedraw: (nativeId: number) => void;
|
|
26
|
+
/**
|
|
27
|
+
* Reads the shared values into the recording held for the view and
|
|
28
|
+
* schedules a redraw. Native only; called from a worklet on every frame.
|
|
29
|
+
* Until the view registers, the recording is queued for it and kept
|
|
30
|
+
* current all the same. Ignored when the recording `recorderId` is neither
|
|
31
|
+
* held by the view nor queued for it.
|
|
32
|
+
*/
|
|
33
|
+
applyUpdates: (nativeId: number, recorderId: number, values: SharedValue<unknown>[]) => void;
|
|
25
34
|
makeImageSnapshot: (nativeId: number, rect?: SkRect) => SkImage;
|
|
26
35
|
makeImageSnapshotAsync: (nativeId: number, rect?: SkRect) => Promise<SkImage>;
|
|
27
36
|
size: (nativeId: number) => SkSize;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type { ViewProps } from \"react-native\";\n\nimport type { SkImage, SkPicture, SkRect, SkSize } from \"../skia/types\";\n\nexport type NativeSkiaViewProps = ViewProps & {\n debug?: boolean;\n opaque?: boolean;\n};\n\nexport type AndroidSurfaceType = \"SurfaceView\" | \"TextureView\";\n\nexport interface AndroidCanvasProps {\n /**\n * Backing view. Defaults to `SurfaceView` when the canvas is `opaque` and to\n * `TextureView` otherwise; both composite correctly in React Native stacking\n * order without further flags.\n */\n surfaceType?: AndroidSurfaceType;\n /**\n * SurfaceView only: composite above every React Native view in the window,\n * ignoring `zIndex`. Ignored for TextureView. Defaults to false.\n */\n zOrderOnTop?: 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 /**\n * Declares that the canvas covers every pixel of its bounds. On Android an\n * opaque canvas is backed by a `SurfaceView` by default, the cheapest path\n * (see `android.surfaceType`). Defaults to false.\n */\n opaque?: boolean;\n\n /**\n * Renders into a surface with more than 8 bits per channel (16-bit float on\n * iOS, 10-bit on Android) to avoid banding in subtle gradients. On Android\n * the extra precision survives composition only when combined with `opaque`.\n */\n highBitDepth?: boolean;\n\n /** Android-only rendering options. Ignored on iOS and web. */\n android?: AndroidCanvasProps;\n\n // On web, only 16 WebGL contextes are allowed. If the drawing is non-animated, set\n // __destroyWebGLContextAfterRender to true to release the context after each draw.\n __destroyWebGLContextAfterRender?: boolean;\n}\n\nexport interface SkiaPictureViewNativeProps extends SkiaBaseViewProps {\n picture?: SkPicture;\n androidWarmup?: boolean;\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 { SkImage, SkPicture, SkRect, SkSize } from \"../skia/types\";\n\nexport type NativeSkiaViewProps = ViewProps & {\n debug?: boolean;\n opaque?: boolean;\n};\n\nexport type AndroidSurfaceType = \"SurfaceView\" | \"TextureView\";\n\nexport interface AndroidCanvasProps {\n /**\n * Backing view. Defaults to `SurfaceView` when the canvas is `opaque` and to\n * `TextureView` otherwise; both composite correctly in React Native stacking\n * order without further flags.\n */\n surfaceType?: AndroidSurfaceType;\n /**\n * SurfaceView only: composite above every React Native view in the window,\n * ignoring `zIndex`. Ignored for TextureView. Defaults to false.\n */\n zOrderOnTop?: 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 /**\n * Reads the shared values into the recording held for the view and\n * schedules a redraw. Native only; called from a worklet on every frame.\n * Until the view registers, the recording is queued for it and kept\n * current all the same. Ignored when the recording `recorderId` is neither\n * held by the view nor queued for it.\n */\n applyUpdates: (\n nativeId: number,\n recorderId: number,\n values: SharedValue<unknown>[]\n ) => 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 /**\n * Declares that the canvas covers every pixel of its bounds. On Android an\n * opaque canvas is backed by a `SurfaceView` by default, the cheapest path\n * (see `android.surfaceType`). Defaults to false.\n */\n opaque?: boolean;\n\n /**\n * Renders into a surface with more than 8 bits per channel (16-bit float on\n * iOS, 10-bit on Android) to avoid banding in subtle gradients. On Android\n * the extra precision survives composition only when combined with `opaque`.\n */\n highBitDepth?: boolean;\n\n /** Android-only rendering options. Ignored on iOS and web. */\n android?: AndroidCanvasProps;\n\n // On web, only 16 WebGL contextes are allowed. If the drawing is non-animated, set\n // __destroyWebGLContextAfterRender to true to release the context after each draw.\n __destroyWebGLContextAfterRender?: boolean;\n}\n\nexport interface SkiaPictureViewNativeProps extends SkiaBaseViewProps {\n picture?: SkPicture;\n androidWarmup?: boolean;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -6,40 +6,6 @@ export class JsiSkPath extends _Host.HostObject {
|
|
|
6
6
|
constructor(CanvasKit: any, ref: any);
|
|
7
7
|
/** Returns an immutable CK Path snapshot for read-only operations. */
|
|
8
8
|
asPath(): any;
|
|
9
|
-
addPath(src: any, matrix: any, extend?: boolean): this;
|
|
10
|
-
addArc(oval: any, startAngleInDegrees: any, sweepAngleInDegrees: any): this;
|
|
11
|
-
addOval(oval: any, isCCW: any, startIndex: any): this;
|
|
12
|
-
addPoly(points: any, close: any): this;
|
|
13
|
-
addRect(rect: any, isCCW: any): this;
|
|
14
|
-
addRRect(rrect: any, isCCW: any): this;
|
|
15
|
-
addCircle(x: any, y: any, r: any): this;
|
|
16
|
-
moveTo(x: any, y: any): this;
|
|
17
|
-
rMoveTo(x: any, y: any): this;
|
|
18
|
-
lineTo(x: any, y: any): this;
|
|
19
|
-
rLineTo(x: any, y: any): this;
|
|
20
|
-
quadTo(x1: any, y1: any, x2: any, y2: any): this;
|
|
21
|
-
rQuadTo(x1: any, y1: any, x2: any, y2: any): this;
|
|
22
|
-
conicTo(x1: any, y1: any, x2: any, y2: any, w: any): this;
|
|
23
|
-
rConicTo(x1: any, y1: any, x2: any, y2: any, w: any): this;
|
|
24
|
-
cubicTo(cpx1: any, cpy1: any, cpx2: any, cpy2: any, x: any, y: any): this;
|
|
25
|
-
rCubicTo(cpx1: any, cpy1: any, cpx2: any, cpy2: any, x: any, y: any): this;
|
|
26
|
-
close(): this;
|
|
27
|
-
reset(): this;
|
|
28
|
-
rewind(): this;
|
|
29
|
-
arcToOval(oval: any, startAngleInDegrees: any, sweepAngleInDegrees: any, forceMoveTo: any): this;
|
|
30
|
-
arcToRotated(rx: any, ry: any, xAxisRotateInDegrees: any, useSmallArc: any, isCCW: any, x: any, y: any): this;
|
|
31
|
-
rArcTo(rx: any, ry: any, xAxisRotateInDegrees: any, useSmallArc: any, isCCW: any, dx: any, dy: any): this;
|
|
32
|
-
arcToTangent(x1: any, y1: any, x2: any, y2: any, radius: any): this;
|
|
33
|
-
setFillType(fill: any): this;
|
|
34
|
-
setIsVolatile(_volatile: any): this;
|
|
35
|
-
offset(dx: any, dy: any): this;
|
|
36
|
-
transform(m: any): this;
|
|
37
|
-
makeAsWinding(): this | null;
|
|
38
|
-
simplify(): boolean;
|
|
39
|
-
op(path: any, op: any): boolean;
|
|
40
|
-
dash(on: any, off: any, phase: any): boolean;
|
|
41
|
-
stroke(opts: any): this | null;
|
|
42
|
-
trim(start: any, stop: any, isComplement: any): this | null;
|
|
43
9
|
countPoints(): any;
|
|
44
10
|
computeTightBounds(): _JsiSkRect.JsiSkRect;
|
|
45
11
|
contains(x: any, y: any): any;
|
|
@@ -56,7 +22,7 @@ export class JsiSkPath extends _Host.HostObject {
|
|
|
56
22
|
};
|
|
57
23
|
toSVGString(): any;
|
|
58
24
|
isInterpolatable(path2: any): any;
|
|
59
|
-
interpolate(end: any, weight: any
|
|
25
|
+
interpolate(end: any, weight: any): JsiSkPath | null;
|
|
60
26
|
toCmds(): any;
|
|
61
27
|
}
|
|
62
28
|
import _Host = require("./Host");
|
|
@@ -2,6 +2,7 @@ export const __esModule: boolean;
|
|
|
2
2
|
export class JsiSkSurfaceFactory extends _Host.Host {
|
|
3
3
|
Make(width: any, height: any): _JsiSkSurface.JsiSkSurface;
|
|
4
4
|
MakeOffscreen(width: any, height: any): _JsiSkSurface.JsiSkSurface | null;
|
|
5
|
+
MakeFromNativeTexture(_pointer: any): jest.Mock<any, any, any>;
|
|
5
6
|
}
|
|
6
7
|
import _Host = require("./Host");
|
|
7
8
|
import _JsiSkSurface = require("./JsiSkSurface");
|
|
@@ -1,10 +1,24 @@
|
|
|
1
1
|
export const __esModule: boolean;
|
|
2
2
|
export function createContainer(Skia: any, nativeId: any): _StaticContainer.StaticContainer | NativeReanimatedContainer;
|
|
3
3
|
import _StaticContainer = require("./StaticContainer");
|
|
4
|
+
/**
|
|
5
|
+
* Records the scene graph on the JS thread and hands the native recorder to
|
|
6
|
+
* the view, which owns it and replays it on every draw. The Reanimated mapper
|
|
7
|
+
* only pushes the shared values into that recorder through the view id: no
|
|
8
|
+
* Skia object is captured by a worklet, so nothing on the UI runtime holds
|
|
9
|
+
* native memory. The JS wrapper is disposed right after the handoff, so the
|
|
10
|
+
* view is the sole owner and the resources referenced by the recording
|
|
11
|
+
* (images, pictures) are released when the view replaces it or is torn down,
|
|
12
|
+
* not when a garbage collector gets around to a wrapper.
|
|
13
|
+
*
|
|
14
|
+
* Unmounting does not clear the view: the native view can outlive the React
|
|
15
|
+
* tree (exit animations, screen transitions) and keeps showing its last frame
|
|
16
|
+
* until it is torn down, which is when the recording is released.
|
|
17
|
+
*/
|
|
4
18
|
declare class NativeReanimatedContainer extends _StaticContainer.Container {
|
|
5
19
|
constructor(Skia: any, nativeId: any);
|
|
6
20
|
nativeId: any;
|
|
7
|
-
|
|
21
|
+
stopMapper(): void;
|
|
8
22
|
mapperId: any;
|
|
9
23
|
redraw(): void;
|
|
10
24
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export function toMatrix3x3(m: any): any;
|
|
2
2
|
/**
|
|
3
|
-
* SkPath wraps a CK PathBuilder internally, providing
|
|
4
|
-
* methods
|
|
3
|
+
* SkPath wraps a CK PathBuilder internally, providing immutable query
|
|
4
|
+
* methods. Use snapshot() internally to get
|
|
5
5
|
* an immutable CK Path for read-only operations.
|
|
6
6
|
*/
|
|
7
7
|
export class JsiSkPath extends HostObject {
|
|
@@ -10,40 +10,6 @@ export class JsiSkPath extends HostObject {
|
|
|
10
10
|
constructor(CanvasKit: any, ref: any);
|
|
11
11
|
/** Returns an immutable CK Path snapshot for read-only operations. */
|
|
12
12
|
asPath(): any;
|
|
13
|
-
addPath(src: any, matrix: any, extend?: boolean): this;
|
|
14
|
-
addArc(oval: any, startAngleInDegrees: any, sweepAngleInDegrees: any): this;
|
|
15
|
-
addOval(oval: any, isCCW: any, startIndex: any): this;
|
|
16
|
-
addPoly(points: any, close: any): this;
|
|
17
|
-
addRect(rect: any, isCCW: any): this;
|
|
18
|
-
addRRect(rrect: any, isCCW: any): this;
|
|
19
|
-
addCircle(x: any, y: any, r: any): this;
|
|
20
|
-
moveTo(x: any, y: any): this;
|
|
21
|
-
rMoveTo(x: any, y: any): this;
|
|
22
|
-
lineTo(x: any, y: any): this;
|
|
23
|
-
rLineTo(x: any, y: any): this;
|
|
24
|
-
quadTo(x1: any, y1: any, x2: any, y2: any): this;
|
|
25
|
-
rQuadTo(x1: any, y1: any, x2: any, y2: any): this;
|
|
26
|
-
conicTo(x1: any, y1: any, x2: any, y2: any, w: any): this;
|
|
27
|
-
rConicTo(x1: any, y1: any, x2: any, y2: any, w: any): this;
|
|
28
|
-
cubicTo(cpx1: any, cpy1: any, cpx2: any, cpy2: any, x: any, y: any): this;
|
|
29
|
-
rCubicTo(cpx1: any, cpy1: any, cpx2: any, cpy2: any, x: any, y: any): this;
|
|
30
|
-
close(): this;
|
|
31
|
-
reset(): this;
|
|
32
|
-
rewind(): this;
|
|
33
|
-
arcToOval(oval: any, startAngleInDegrees: any, sweepAngleInDegrees: any, forceMoveTo: any): this;
|
|
34
|
-
arcToRotated(rx: any, ry: any, xAxisRotateInDegrees: any, useSmallArc: any, isCCW: any, x: any, y: any): this;
|
|
35
|
-
rArcTo(rx: any, ry: any, xAxisRotateInDegrees: any, useSmallArc: any, isCCW: any, dx: any, dy: any): this;
|
|
36
|
-
arcToTangent(x1: any, y1: any, x2: any, y2: any, radius: any): this;
|
|
37
|
-
setFillType(fill: any): this;
|
|
38
|
-
setIsVolatile(_volatile: any): this;
|
|
39
|
-
offset(dx: any, dy: any): this;
|
|
40
|
-
transform(m: any): this;
|
|
41
|
-
makeAsWinding(): this | null;
|
|
42
|
-
simplify(): boolean;
|
|
43
|
-
op(path: any, op: any): boolean;
|
|
44
|
-
dash(on: any, off: any, phase: any): boolean;
|
|
45
|
-
stroke(opts: any): this | null;
|
|
46
|
-
trim(start: any, stop: any, isComplement: any): this | null;
|
|
47
13
|
countPoints(): any;
|
|
48
14
|
computeTightBounds(): JsiSkRect;
|
|
49
15
|
contains(x: any, y: any): any;
|
|
@@ -60,7 +26,7 @@ export class JsiSkPath extends HostObject {
|
|
|
60
26
|
};
|
|
61
27
|
toSVGString(): any;
|
|
62
28
|
isInterpolatable(path2: any): any;
|
|
63
|
-
interpolate(end: any, weight: any
|
|
29
|
+
interpolate(end: any, weight: any): JsiSkPath | null;
|
|
64
30
|
toCmds(): any;
|
|
65
31
|
}
|
|
66
32
|
import { HostObject } from "./Host";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export class JsiSkSurfaceFactory extends Host {
|
|
2
2
|
Make(width: any, height: any): JsiSkSurface;
|
|
3
3
|
MakeOffscreen(width: any, height: any): JsiSkSurface | null;
|
|
4
|
+
MakeFromNativeTexture(_pointer: any): jest.Mock<any, any, any>;
|
|
4
5
|
}
|
|
5
6
|
import { Host } from "./Host";
|
|
6
7
|
import { JsiSkSurface } from "./JsiSkSurface";
|
|
@@ -1,9 +1,23 @@
|
|
|
1
1
|
export function createContainer(Skia: any, nativeId: any): StaticContainer | NativeReanimatedContainer;
|
|
2
2
|
import { StaticContainer } from "./StaticContainer";
|
|
3
|
+
/**
|
|
4
|
+
* Records the scene graph on the JS thread and hands the native recorder to
|
|
5
|
+
* the view, which owns it and replays it on every draw. The Reanimated mapper
|
|
6
|
+
* only pushes the shared values into that recorder through the view id: no
|
|
7
|
+
* Skia object is captured by a worklet, so nothing on the UI runtime holds
|
|
8
|
+
* native memory. The JS wrapper is disposed right after the handoff, so the
|
|
9
|
+
* view is the sole owner and the resources referenced by the recording
|
|
10
|
+
* (images, pictures) are released when the view replaces it or is torn down,
|
|
11
|
+
* not when a garbage collector gets around to a wrapper.
|
|
12
|
+
*
|
|
13
|
+
* Unmounting does not clear the view: the native view can outlive the React
|
|
14
|
+
* tree (exit animations, screen transitions) and keeps showing its last frame
|
|
15
|
+
* until it is torn down, which is when the recording is released.
|
|
16
|
+
*/
|
|
3
17
|
declare class NativeReanimatedContainer extends Container {
|
|
4
18
|
constructor(Skia: any, nativeId: any);
|
|
5
19
|
nativeId: any;
|
|
6
|
-
|
|
20
|
+
stopMapper(): void;
|
|
7
21
|
mapperId: any;
|
|
8
22
|
redraw(): void;
|
|
9
23
|
}
|