@shopify/react-native-skia 1.5.10 → 1.7.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/cpp/jni/include/JniSkiaBaseView.h +6 -5
- package/android/cpp/jni/include/JniSkiaDomView.h +6 -4
- package/android/cpp/jni/include/JniSkiaManager.h +2 -2
- package/android/cpp/jni/include/JniSkiaPictureView.h +6 -4
- package/android/cpp/rnskia-android/MainThreadDispatcher.h +3 -0
- package/android/cpp/rnskia-android/OpenGLContext.h +44 -9
- package/android/cpp/rnskia-android/OpenGLWindowContext.cpp +0 -1
- package/android/cpp/rnskia-android/OpenGLWindowContext.h +2 -2
- package/android/cpp/rnskia-android/RNSkAndroidPlatformContext.h +61 -3
- package/android/cpp/rnskia-android/RNSkAndroidView.h +10 -13
- package/android/cpp/rnskia-android/RNSkOpenGLCanvasProvider.cpp +42 -36
- package/android/cpp/rnskia-android/RNSkOpenGLCanvasProvider.h +2 -2
- package/android/cpp/rnskia-android/gl/Display.h +2 -0
- package/android/src/main/java/com/shopify/reactnative/skia/SkiaAHBView.java +113 -0
- package/android/src/main/java/com/shopify/reactnative/skia/SkiaBaseView.java +45 -54
- package/android/src/main/java/com/shopify/reactnative/skia/SkiaBaseViewManager.java +5 -0
- package/android/src/main/java/com/shopify/reactnative/skia/SkiaDomView.java +2 -2
- package/android/src/main/java/com/shopify/reactnative/skia/SkiaPictureView.java +2 -2
- package/android/src/main/java/com/shopify/reactnative/skia/SkiaSurfaceView.java +42 -0
- package/android/src/main/java/com/shopify/reactnative/skia/SkiaTextureView.java +90 -0
- package/android/src/main/java/com/shopify/reactnative/skia/SkiaViewAPI.java +16 -0
- package/android/src/paper/java/com/facebook/react/viewmanagers/SkiaDomViewManagerDelegate.java +3 -0
- package/android/src/paper/java/com/facebook/react/viewmanagers/SkiaDomViewManagerInterface.java +1 -0
- package/android/src/paper/java/com/facebook/react/viewmanagers/SkiaPictureViewManagerDelegate.java +3 -1
- package/android/src/paper/java/com/facebook/react/viewmanagers/SkiaPictureViewManagerInterface.java +1 -0
- package/cpp/api/JsiSkContourMeasure.h +1 -5
- package/cpp/api/JsiSkImage.h +11 -0
- package/cpp/api/JsiSkImageFactory.h +14 -0
- package/cpp/api/JsiSkPicture.h +2 -0
- package/cpp/api/JsiSkSurface.h +7 -0
- package/cpp/api/JsiTextureInfo.h +53 -0
- package/cpp/jsi/ViewProperty.h +48 -0
- package/cpp/rnskia/RNSkDomView.cpp +0 -20
- package/cpp/rnskia/RNSkDomView.h +4 -9
- package/cpp/rnskia/RNSkJsiViewApi.h +3 -3
- package/cpp/rnskia/RNSkPictureView.h +11 -28
- package/cpp/rnskia/RNSkPlatformContext.h +18 -12
- package/cpp/rnskia/RNSkView.h +5 -29
- package/ios/RNSkia-iOS/MetalContext.h +101 -15
- package/ios/RNSkia-iOS/MetalContext.mm +9 -8
- package/ios/RNSkia-iOS/MetalWindowContext.h +39 -0
- package/ios/RNSkia-iOS/MetalWindowContext.mm +60 -0
- package/ios/RNSkia-iOS/RNSkiOSPlatformContext.h +13 -25
- package/ios/RNSkia-iOS/RNSkiOSPlatformContext.mm +88 -2
- package/ios/RNSkia-iOS/SkiaCVPixelBufferUtils.mm +9 -2
- package/ios/RNSkia-iOS/SkiaDomViewManager.mm +5 -0
- package/ios/RNSkia-iOS/SkiaManager.mm +1 -2
- package/ios/RNSkia-iOS/SkiaPictureView.mm +1 -0
- package/ios/RNSkia-iOS/SkiaPictureViewManager.mm +5 -0
- package/ios/RNSkia-iOS/SkiaUIView.h +1 -0
- package/ios/RNSkia-iOS/SkiaUIView.mm +21 -14
- package/lib/commonjs/skia/types/Image/ColorType.d.ts +21 -0
- package/lib/commonjs/skia/types/Image/ColorType.js +29 -0
- package/lib/commonjs/skia/types/Image/ColorType.js.map +1 -0
- package/lib/commonjs/skia/types/Image/ColorType.web.d.ts +19 -0
- package/lib/commonjs/skia/types/Image/ColorType.web.js +27 -0
- package/lib/commonjs/skia/types/Image/ColorType.web.js.map +1 -0
- package/lib/commonjs/skia/types/Image/Image.d.ts +10 -0
- package/lib/commonjs/skia/types/Image/Image.js.map +1 -1
- package/lib/commonjs/skia/types/Image/ImageFactory.d.ts +19 -19
- package/lib/commonjs/skia/types/Image/ImageFactory.js +1 -21
- package/lib/commonjs/skia/types/Image/ImageFactory.js.map +1 -1
- package/lib/commonjs/skia/types/Image/index.d.ts +1 -0
- package/lib/commonjs/skia/types/Image/index.js +11 -0
- package/lib/commonjs/skia/types/Image/index.js.map +1 -1
- package/lib/commonjs/skia/types/Matrix4.d.ts +6 -0
- package/lib/commonjs/skia/types/Matrix4.js +69 -1
- package/lib/commonjs/skia/types/Matrix4.js.map +1 -1
- package/lib/commonjs/skia/types/Surface/Surface.d.ts +11 -0
- package/lib/commonjs/skia/types/Surface/Surface.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkImage.d.ts +1 -0
- package/lib/commonjs/skia/web/JsiSkImage.js +4 -0
- package/lib/commonjs/skia/web/JsiSkImage.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkImageFactory.d.ts +1 -0
- package/lib/commonjs/skia/web/JsiSkImageFactory.js +3 -0
- package/lib/commonjs/skia/web/JsiSkImageFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkSurface.d.ts +1 -0
- package/lib/commonjs/skia/web/JsiSkSurface.js +4 -0
- package/lib/commonjs/skia/web/JsiSkSurface.js.map +1 -1
- package/lib/commonjs/specs/SkiaPictureViewNativeComponent.d.ts +1 -0
- package/lib/commonjs/specs/SkiaPictureViewNativeComponent.js.map +1 -1
- package/lib/commonjs/views/SkiaDomView.js +3 -1
- package/lib/commonjs/views/SkiaDomView.js.map +1 -1
- package/lib/commonjs/views/SkiaPictureView.js +5 -1
- package/lib/commonjs/views/SkiaPictureView.js.map +1 -1
- package/lib/commonjs/views/types.d.ts +2 -0
- package/lib/commonjs/views/types.js.map +1 -1
- package/lib/module/skia/types/Image/ColorType.d.ts +21 -0
- package/lib/module/skia/types/Image/ColorType.js +23 -0
- package/lib/module/skia/types/Image/ColorType.js.map +1 -0
- package/lib/module/skia/types/Image/ColorType.web.d.ts +19 -0
- package/lib/module/skia/types/Image/ColorType.web.js +21 -0
- package/lib/module/skia/types/Image/ColorType.web.js.map +1 -0
- package/lib/module/skia/types/Image/Image.d.ts +10 -0
- package/lib/module/skia/types/Image/Image.js.map +1 -1
- package/lib/module/skia/types/Image/ImageFactory.d.ts +19 -19
- package/lib/module/skia/types/Image/ImageFactory.js +0 -20
- package/lib/module/skia/types/Image/ImageFactory.js.map +1 -1
- package/lib/module/skia/types/Image/index.d.ts +1 -0
- package/lib/module/skia/types/Image/index.js +1 -0
- package/lib/module/skia/types/Image/index.js.map +1 -1
- package/lib/module/skia/types/Matrix4.d.ts +6 -0
- package/lib/module/skia/types/Matrix4.js +67 -0
- package/lib/module/skia/types/Matrix4.js.map +1 -1
- package/lib/module/skia/types/Surface/Surface.d.ts +11 -0
- package/lib/module/skia/types/Surface/Surface.js.map +1 -1
- package/lib/module/skia/web/JsiSkImage.d.ts +1 -0
- package/lib/module/skia/web/JsiSkImage.js +4 -0
- package/lib/module/skia/web/JsiSkImage.js.map +1 -1
- package/lib/module/skia/web/JsiSkImageFactory.d.ts +1 -0
- package/lib/module/skia/web/JsiSkImageFactory.js +3 -0
- package/lib/module/skia/web/JsiSkImageFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkSurface.d.ts +1 -0
- package/lib/module/skia/web/JsiSkSurface.js +4 -0
- package/lib/module/skia/web/JsiSkSurface.js.map +1 -1
- package/lib/module/specs/SkiaPictureViewNativeComponent.d.ts +1 -0
- package/lib/module/specs/SkiaPictureViewNativeComponent.js.map +1 -1
- package/lib/module/views/SkiaDomView.js +3 -1
- package/lib/module/views/SkiaDomView.js.map +1 -1
- package/lib/module/views/SkiaPictureView.js +5 -1
- package/lib/module/views/SkiaPictureView.js.map +1 -1
- package/lib/module/views/types.d.ts +2 -0
- package/lib/module/views/types.js.map +1 -1
- package/lib/typescript/lib/commonjs/skia/types/Image/ColorType.d.ts +2 -0
- package/lib/typescript/lib/commonjs/skia/types/Image/ColorType.web.d.ts +2 -0
- package/lib/typescript/lib/commonjs/skia/types/Image/ImageFactory.d.ts +0 -1
- package/lib/typescript/lib/commonjs/skia/types/Matrix4.d.ts +6 -0
- package/lib/typescript/lib/commonjs/skia/web/JsiSkImage.d.ts +1 -0
- package/lib/typescript/lib/commonjs/skia/web/JsiSkImageFactory.d.ts +1 -0
- package/lib/typescript/lib/commonjs/skia/web/JsiSkSurface.d.ts +1 -0
- package/lib/typescript/lib/module/mock/index.d.ts +1 -0
- package/lib/typescript/lib/module/skia/types/Image/ColorType.d.ts +1 -0
- package/lib/typescript/lib/module/skia/types/Image/ColorType.web.d.ts +1 -0
- package/lib/typescript/lib/module/skia/types/Image/ImageFactory.d.ts +0 -1
- package/lib/typescript/lib/module/skia/types/Image/index.d.ts +1 -0
- package/lib/typescript/lib/module/skia/types/Matrix4.d.ts +1 -0
- package/lib/typescript/lib/module/skia/web/JsiSkImage.d.ts +1 -0
- package/lib/typescript/lib/module/skia/web/JsiSkImageFactory.d.ts +1 -0
- package/lib/typescript/lib/module/skia/web/JsiSkSurface.d.ts +1 -0
- package/lib/typescript/src/skia/types/Image/ColorType.d.ts +21 -0
- package/lib/typescript/src/skia/types/Image/ColorType.web.d.ts +19 -0
- package/lib/typescript/src/skia/types/Image/Image.d.ts +10 -0
- package/lib/typescript/src/skia/types/Image/ImageFactory.d.ts +19 -19
- package/lib/typescript/src/skia/types/Image/index.d.ts +1 -0
- package/lib/typescript/src/skia/types/Matrix4.d.ts +6 -0
- package/lib/typescript/src/skia/types/Surface/Surface.d.ts +11 -0
- package/lib/typescript/src/skia/web/JsiSkImage.d.ts +1 -0
- package/lib/typescript/src/skia/web/JsiSkImageFactory.d.ts +1 -0
- package/lib/typescript/src/skia/web/JsiSkSurface.d.ts +1 -0
- package/lib/typescript/src/specs/SkiaPictureViewNativeComponent.d.ts +1 -0
- package/lib/typescript/src/views/types.d.ts +2 -0
- package/package.json +1 -1
- package/src/renderer/__tests__/e2e/Matrix4.spec.tsx +93 -0
- package/src/skia/__tests__/Enums.spec.ts +2 -2
- package/src/skia/types/Image/ColorType.ts +21 -0
- package/src/skia/types/Image/ColorType.web.ts +19 -0
- package/src/skia/types/Image/Image.ts +11 -0
- package/src/skia/types/Image/ImageFactory.ts +25 -20
- package/src/skia/types/Image/index.ts +1 -0
- package/src/skia/types/Matrix4.ts +101 -0
- package/src/skia/types/Surface/Surface.ts +12 -0
- package/src/skia/web/JsiSkImage.ts +5 -0
- package/src/skia/web/JsiSkImageFactory.ts +4 -0
- package/src/skia/web/JsiSkSurface.ts +5 -0
- package/src/specs/SkiaPictureViewNativeComponent.ts +1 -0
- package/src/views/SkiaDomView.tsx +2 -1
- package/src/views/SkiaPictureView.tsx +4 -1
- package/src/views/types.ts +3 -0
- package/cpp/jsi/JsiValueWrapper.h +0 -164
- package/ios/RNSkia-iOS/SkiaMetalSurfaceFactory.h +0 -128
- package/ios/RNSkia-iOS/SkiaMetalSurfaceFactory.mm +0 -92
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["CanvasKitWebGLBuffer","isNativeBufferWeb","Host","getEnum","JsiSkImage","JsiSkData","JsiSkImageFactory","constructor","CanvasKit","MakeImageFromViewTag","viewTag","view","console","log","Promise","resolve","MakeImageFromNativeBuffer","buffer","surface","image","Error","img","HTMLImageElement","HTMLVideoElement","ImageBitmap","MakeLazyImageFromTextureSource","toImage","MakeImageFromCanvasImageSource","makeImageFromTextureSource","updateTextureFromSource","MakeImageFromEncoded","encoded","fromValue","MakeImage","info","data","bytesPerRow","alphaType","AlphaType","colorSpace","ColorSpace","SRGB","colorType","ColorType","height","width"],"sources":["JsiSkImageFactory.ts"],"sourcesContent":["import type { CanvasKit, Image } from \"canvaskit-wasm\";\n\nimport { CanvasKitWebGLBuffer, isNativeBufferWeb } from \"../types\";\nimport type {\n SkData,\n ImageInfo,\n SkImage,\n NativeBuffer,\n ImageFactory,\n} from \"../types\";\n\nimport { Host, getEnum } from \"./Host\";\nimport { JsiSkImage } from \"./JsiSkImage\";\nimport { JsiSkData } from \"./JsiSkData\";\nimport type { JsiSkSurface } from \"./JsiSkSurface\";\nimport type { CanvasKitWebGLBufferImpl } from \"./CanvasKitWebGLBufferImpl\";\n\nexport class JsiSkImageFactory extends Host implements ImageFactory {\n constructor(CanvasKit: CanvasKit) {\n super(CanvasKit);\n }\n\n MakeImageFromViewTag(viewTag: number): Promise<SkImage | null> {\n const view = viewTag as unknown as HTMLElement;\n // TODO: Implement screenshot from view in React JS\n console.log(view);\n return Promise.resolve(null);\n }\n\n MakeImageFromNativeBuffer(\n buffer: NativeBuffer,\n surface?: JsiSkSurface,\n image?: JsiSkImage\n ) {\n if (!isNativeBufferWeb(buffer)) {\n throw new Error(\"Invalid NativeBuffer\");\n }\n if (!surface) {\n let img: Image;\n if (\n buffer instanceof HTMLImageElement ||\n buffer instanceof HTMLVideoElement ||\n buffer instanceof ImageBitmap\n ) {\n img = this.CanvasKit.MakeLazyImageFromTextureSource(buffer);\n } else if (buffer instanceof CanvasKitWebGLBuffer) {\n img = (\n buffer as CanvasKitWebGLBuffer as CanvasKitWebGLBufferImpl\n ).toImage();\n } else {\n img = this.CanvasKit.MakeImageFromCanvasImageSource(buffer);\n }\n return new JsiSkImage(this.CanvasKit, img);\n } else if (!image) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const img = (surface as any).makeImageFromTextureSource(buffer) as Image;\n return new JsiSkImage(this.CanvasKit, img);\n } else {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const img = (surface as any).updateTextureFromSource(\n image,\n buffer\n ) as Image;\n return new JsiSkImage(this.CanvasKit, img);\n }\n }\n\n MakeImageFromEncoded(encoded: SkData) {\n const image = this.CanvasKit.MakeImageFromEncoded(\n JsiSkData.fromValue(encoded)\n );\n if (image === null) {\n return null;\n }\n return new JsiSkImage(this.CanvasKit, image);\n }\n\n MakeImage(info: ImageInfo, data: SkData, bytesPerRow: number) {\n // see toSkImageInfo() from canvaskit\n const image = this.CanvasKit.MakeImage(\n {\n alphaType: getEnum(this.CanvasKit.AlphaType, info.alphaType),\n colorSpace: this.CanvasKit.ColorSpace.SRGB,\n colorType: getEnum(this.CanvasKit.ColorType, info.colorType),\n height: info.height,\n width: info.width,\n },\n JsiSkData.fromValue(data),\n bytesPerRow\n );\n if (image === null) {\n return null;\n }\n return new JsiSkImage(this.CanvasKit, image);\n }\n}\n"],"mappings":"AAEA,SAASA,oBAAoB,EAAEC,iBAAiB,QAAQ,UAAU;AASlE,SAASC,IAAI,EAAEC,OAAO,QAAQ,QAAQ;AACtC,SAASC,UAAU,QAAQ,cAAc;AACzC,SAASC,SAAS,QAAQ,aAAa;AAIvC,OAAO,MAAMC,iBAAiB,SAASJ,IAAI,CAAyB;EAClEK,WAAWA,CAACC,SAAoB,EAAE;IAChC,KAAK,CAACA,SAAS,CAAC;EAClB;EAEAC,oBAAoBA,CAACC,OAAe,EAA2B;IAC7D,MAAMC,IAAI,GAAGD,OAAiC;IAC9C;IACAE,OAAO,CAACC,GAAG,CAACF,IAAI,CAAC;IACjB,OAAOG,OAAO,CAACC,OAAO,CAAC,IAAI,CAAC;EAC9B;EAEAC,yBAAyBA,CACvBC,MAAoB,EACpBC,OAAsB,EACtBC,KAAkB,EAClB;IACA,IAAI,CAAClB,iBAAiB,CAACgB,MAAM,CAAC,EAAE;MAC9B,MAAM,IAAIG,KAAK,CAAC,sBAAsB,CAAC;IACzC;IACA,IAAI,CAACF,OAAO,EAAE;MACZ,IAAIG,GAAU;MACd,IACEJ,MAAM,YAAYK,gBAAgB,IAClCL,MAAM,YAAYM,gBAAgB,IAClCN,MAAM,YAAYO,WAAW,EAC7B;QACAH,GAAG,GAAG,IAAI,CAACb,SAAS,CAACiB,8BAA8B,CAACR,MAAM,CAAC;MAC7D,CAAC,MAAM,IAAIA,MAAM,YAAYjB,oBAAoB,EAAE;QACjDqB,GAAG,GACDJ,MAAM,CACNS,OAAO,CAAC,CAAC;MACb,CAAC,MAAM;QACLL,GAAG,GAAG,IAAI,CAACb,SAAS,CAACmB,8BAA8B,CAACV,MAAM,CAAC;MAC7D;MACA,OAAO,IAAIb,UAAU,CAAC,IAAI,CAACI,SAAS,EAAEa,GAAG,CAAC;IAC5C,CAAC,MAAM,IAAI,CAACF,KAAK,EAAE;MACjB;MACA,MAAME,GAAG,GAAIH,OAAO,CAASU,0BAA0B,CAACX,MAAM,CAAU;MACxE,OAAO,IAAIb,UAAU,CAAC,IAAI,CAACI,SAAS,EAAEa,GAAG,CAAC;IAC5C,CAAC,MAAM;MACL;MACA,MAAMA,GAAG,GAAIH,OAAO,CAASW,uBAAuB,CAClDV,KAAK,EACLF,MACF,CAAU;MACV,OAAO,IAAIb,UAAU,CAAC,IAAI,CAACI,SAAS,EAAEa,GAAG,CAAC;IAC5C;EACF;EAEAS,oBAAoBA,CAACC,OAAe,EAAE;IACpC,MAAMZ,KAAK,GAAG,IAAI,CAACX,SAAS,CAACsB,oBAAoB,CAC/CzB,SAAS,CAAC2B,SAAS,CAACD,OAAO,CAC7B,CAAC;IACD,IAAIZ,KAAK,KAAK,IAAI,EAAE;MAClB,OAAO,IAAI;IACb;IACA,OAAO,IAAIf,UAAU,CAAC,IAAI,CAACI,SAAS,EAAEW,KAAK,CAAC;EAC9C;EAEAc,SAASA,CAACC,IAAe,EAAEC,IAAY,EAAEC,WAAmB,EAAE;IAC5D;IACA,
|
|
1
|
+
{"version":3,"names":["CanvasKitWebGLBuffer","isNativeBufferWeb","Host","getEnum","JsiSkImage","JsiSkData","JsiSkImageFactory","constructor","CanvasKit","MakeImageFromViewTag","viewTag","view","console","log","Promise","resolve","MakeImageFromNativeBuffer","buffer","surface","image","Error","img","HTMLImageElement","HTMLVideoElement","ImageBitmap","MakeLazyImageFromTextureSource","toImage","MakeImageFromCanvasImageSource","makeImageFromTextureSource","updateTextureFromSource","MakeImageFromEncoded","encoded","fromValue","MakeImageFromNativeTextureUnstable","MakeImage","info","data","bytesPerRow","alphaType","AlphaType","colorSpace","ColorSpace","SRGB","colorType","ColorType","height","width"],"sources":["JsiSkImageFactory.ts"],"sourcesContent":["import type { CanvasKit, Image } from \"canvaskit-wasm\";\n\nimport { CanvasKitWebGLBuffer, isNativeBufferWeb } from \"../types\";\nimport type {\n SkData,\n ImageInfo,\n SkImage,\n NativeBuffer,\n ImageFactory,\n} from \"../types\";\n\nimport { Host, getEnum } from \"./Host\";\nimport { JsiSkImage } from \"./JsiSkImage\";\nimport { JsiSkData } from \"./JsiSkData\";\nimport type { JsiSkSurface } from \"./JsiSkSurface\";\nimport type { CanvasKitWebGLBufferImpl } from \"./CanvasKitWebGLBufferImpl\";\n\nexport class JsiSkImageFactory extends Host implements ImageFactory {\n constructor(CanvasKit: CanvasKit) {\n super(CanvasKit);\n }\n\n MakeImageFromViewTag(viewTag: number): Promise<SkImage | null> {\n const view = viewTag as unknown as HTMLElement;\n // TODO: Implement screenshot from view in React JS\n console.log(view);\n return Promise.resolve(null);\n }\n\n MakeImageFromNativeBuffer(\n buffer: NativeBuffer,\n surface?: JsiSkSurface,\n image?: JsiSkImage\n ) {\n if (!isNativeBufferWeb(buffer)) {\n throw new Error(\"Invalid NativeBuffer\");\n }\n if (!surface) {\n let img: Image;\n if (\n buffer instanceof HTMLImageElement ||\n buffer instanceof HTMLVideoElement ||\n buffer instanceof ImageBitmap\n ) {\n img = this.CanvasKit.MakeLazyImageFromTextureSource(buffer);\n } else if (buffer instanceof CanvasKitWebGLBuffer) {\n img = (\n buffer as CanvasKitWebGLBuffer as CanvasKitWebGLBufferImpl\n ).toImage();\n } else {\n img = this.CanvasKit.MakeImageFromCanvasImageSource(buffer);\n }\n return new JsiSkImage(this.CanvasKit, img);\n } else if (!image) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const img = (surface as any).makeImageFromTextureSource(buffer) as Image;\n return new JsiSkImage(this.CanvasKit, img);\n } else {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const img = (surface as any).updateTextureFromSource(\n image,\n buffer\n ) as Image;\n return new JsiSkImage(this.CanvasKit, img);\n }\n }\n\n MakeImageFromEncoded(encoded: SkData) {\n const image = this.CanvasKit.MakeImageFromEncoded(\n JsiSkData.fromValue(encoded)\n );\n if (image === null) {\n return null;\n }\n return new JsiSkImage(this.CanvasKit, image);\n }\n\n MakeImageFromNativeTextureUnstable(): SkImage {\n throw new Error(\"MakeImageFromNativeTexture is not implemented on web\");\n }\n\n MakeImage(info: ImageInfo, data: SkData, bytesPerRow: number) {\n // see toSkImageInfo() from canvaskit\n const image = this.CanvasKit.MakeImage(\n {\n alphaType: getEnum(this.CanvasKit.AlphaType, info.alphaType),\n colorSpace: this.CanvasKit.ColorSpace.SRGB,\n colorType: getEnum(this.CanvasKit.ColorType, info.colorType),\n height: info.height,\n width: info.width,\n },\n JsiSkData.fromValue(data),\n bytesPerRow\n );\n if (image === null) {\n return null;\n }\n return new JsiSkImage(this.CanvasKit, image);\n }\n}\n"],"mappings":"AAEA,SAASA,oBAAoB,EAAEC,iBAAiB,QAAQ,UAAU;AASlE,SAASC,IAAI,EAAEC,OAAO,QAAQ,QAAQ;AACtC,SAASC,UAAU,QAAQ,cAAc;AACzC,SAASC,SAAS,QAAQ,aAAa;AAIvC,OAAO,MAAMC,iBAAiB,SAASJ,IAAI,CAAyB;EAClEK,WAAWA,CAACC,SAAoB,EAAE;IAChC,KAAK,CAACA,SAAS,CAAC;EAClB;EAEAC,oBAAoBA,CAACC,OAAe,EAA2B;IAC7D,MAAMC,IAAI,GAAGD,OAAiC;IAC9C;IACAE,OAAO,CAACC,GAAG,CAACF,IAAI,CAAC;IACjB,OAAOG,OAAO,CAACC,OAAO,CAAC,IAAI,CAAC;EAC9B;EAEAC,yBAAyBA,CACvBC,MAAoB,EACpBC,OAAsB,EACtBC,KAAkB,EAClB;IACA,IAAI,CAAClB,iBAAiB,CAACgB,MAAM,CAAC,EAAE;MAC9B,MAAM,IAAIG,KAAK,CAA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EAEAc,SAASA,CAACC,IAAe,EAAEC,IAAY,EAAEC,WAAmB,EAAE;IAC5D;IACA,MAAMlB,KAAK,GAAG,IAAI,CAACX,SAAS,CAAC0B,SAAS,CACpC;MACEI,SAAS,EAAEnC,OAAO,CAAC,IAAI,CAACK,SAAS,CAAC+B,SAAS,EAAEJ,IAAI,CAACG,SAAS,CAAC;MAC5DE,UAAU,EAAE,IAAI,CAAChC,SAAS,CAACiC,UAAU,CAACC,IAAI;MAC1CC,SAAS,EAAExC,OAAO,CAAC,IAAI,CAACK,SAAS,CAACoC,SAAS,EAAET,IAAI,CAACQ,SAAS,CAAC;MAC5DE,MAAM,EAAEV,IAAI,CAACU,MAAM;MACnBC,KAAK,EAAEX,IAAI,CAACW;IACd,CAAC,EACDzC,SAAS,CAAC2B,SAAS,CAACI,IAAI,CAAC,EACzBC,WACF,CAAC;IACD,IAAIlB,KAAK,KAAK,IAAI,EAAE;MAClB,OAAO,IAAI;IACb;IACA,OAAO,IAAIf,UAAU,CAAC,IAAI,CAACI,SAAS,EAAEW,KAAK,CAAC;EAC9C;AACF","ignoreList":[]}
|
|
@@ -28,5 +28,9 @@ export class JsiSkSurface extends HostObject {
|
|
|
28
28
|
const image = this.ref.makeImageSnapshot(bounds ? Array.from(JsiSkRect.fromValue(this.CanvasKit, bounds)) : undefined);
|
|
29
29
|
return new JsiSkImage(this.CanvasKit, image);
|
|
30
30
|
}
|
|
31
|
+
getNativeTextureUnstable() {
|
|
32
|
+
console.warn("getBackendTexture is not implemented on Web");
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
31
35
|
}
|
|
32
36
|
//# sourceMappingURL=JsiSkSurface.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["HostObject","JsiSkCanvas","JsiSkImage","JsiSkRect","JsiSkSurface","constructor","CanvasKit","ref","_defineProperty","dispose","flush","width","height","getCanvas","makeImageSnapshot","bounds","image","Array","from","fromValue","undefined"],"sources":["JsiSkSurface.ts"],"sourcesContent":["import type { CanvasKit, Surface } from \"canvaskit-wasm\";\n\nimport type { SkCanvas, SkImage, SkRect, SkSurface } from \"../types\";\n\nimport { HostObject } from \"./Host\";\nimport { JsiSkCanvas } from \"./JsiSkCanvas\";\nimport { JsiSkImage } from \"./JsiSkImage\";\nimport { JsiSkRect } from \"./JsiSkRect\";\n\nexport class JsiSkSurface\n extends HostObject<Surface, \"Surface\">\n implements SkSurface\n{\n constructor(CanvasKit: CanvasKit, ref: Surface) {\n super(CanvasKit, ref, \"Surface\");\n }\n\n dispose = () => {\n this.ref.dispose();\n };\n\n flush() {\n this.ref.flush();\n }\n\n width() {\n return this.ref.width();\n }\n\n height() {\n return this.ref.height();\n }\n\n getCanvas(): SkCanvas {\n return new JsiSkCanvas(this.CanvasKit, this.ref.getCanvas());\n }\n\n makeImageSnapshot(bounds?: SkRect): SkImage {\n const image = this.ref.makeImageSnapshot(\n bounds\n ? Array.from(JsiSkRect.fromValue(this.CanvasKit, bounds))\n : undefined\n );\n return new JsiSkImage(this.CanvasKit, image);\n }\n}\n"],"mappings":";;;AAIA,SAASA,UAAU,QAAQ,QAAQ;AACnC,SAASC,WAAW,QAAQ,eAAe;AAC3C,SAASC,UAAU,QAAQ,cAAc;AACzC,SAASC,SAAS,QAAQ,aAAa;AAEvC,OAAO,MAAMC,YAAY,SACfJ,UAAU,CAEpB;EACEK,WAAWA,CAACC,SAAoB,EAAEC,GAAY,EAAE;IAC9C,KAAK,CAACD,SAAS,EAAEC,GAAG,EAAE,SAAS,CAAC;IAACC,eAAA,kBAGzB,MAAM;MACd,IAAI,CAACD,GAAG,CAACE,OAAO,CAAC,CAAC;IACpB,CAAC;EAJD;EAMAC,KAAKA,CAAA,EAAG;IACN,IAAI,CAACH,GAAG,CAACG,KAAK,CAAC,CAAC;EAClB;EAEAC,KAAKA,CAAA,EAAG;IACN,OAAO,IAAI,CAACJ,GAAG,CAACI,KAAK,CAAC,CAAC;EACzB;EAEAC,MAAMA,CAAA,EAAG;IACP,OAAO,IAAI,CAACL,GAAG,CAACK,MAAM,CAAC,CAAC;EAC1B;EAEAC,SAASA,CAAA,EAAa;IACpB,OAAO,IAAIZ,WAAW,CAAC,IAAI,CAACK,SAAS,EAAE,IAAI,CAACC,GAAG,CAACM,SAAS,CAAC,CAAC,CAAC;EAC9D;EAEAC,iBAAiBA,CAACC,MAAe,EAAW;IAC1C,MAAMC,KAAK,GAAG,IAAI,CAACT,GAAG,CAACO,iBAAiB,CACtCC,MAAM,GACFE,KAAK,CAACC,IAAI,CAACf,SAAS,CAACgB,SAAS,CAAC,IAAI,CAACb,SAAS,EAAES,MAAM,CAAC,CAAC,GACvDK,SACN,CAAC;IACD,OAAO,IAAIlB,UAAU,CAAC,IAAI,CAACI,SAAS,EAAEU,KAAK,CAAC;EAC9C;AACF","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["HostObject","JsiSkCanvas","JsiSkImage","JsiSkRect","JsiSkSurface","constructor","CanvasKit","ref","_defineProperty","dispose","flush","width","height","getCanvas","makeImageSnapshot","bounds","image","Array","from","fromValue","undefined","getNativeTextureUnstable","console","warn"],"sources":["JsiSkSurface.ts"],"sourcesContent":["import type { CanvasKit, Surface } from \"canvaskit-wasm\";\n\nimport type { SkCanvas, SkImage, SkRect, SkSurface } from \"../types\";\n\nimport { HostObject } from \"./Host\";\nimport { JsiSkCanvas } from \"./JsiSkCanvas\";\nimport { JsiSkImage } from \"./JsiSkImage\";\nimport { JsiSkRect } from \"./JsiSkRect\";\n\nexport class JsiSkSurface\n extends HostObject<Surface, \"Surface\">\n implements SkSurface\n{\n constructor(CanvasKit: CanvasKit, ref: Surface) {\n super(CanvasKit, ref, \"Surface\");\n }\n\n dispose = () => {\n this.ref.dispose();\n };\n\n flush() {\n this.ref.flush();\n }\n\n width() {\n return this.ref.width();\n }\n\n height() {\n return this.ref.height();\n }\n\n getCanvas(): SkCanvas {\n return new JsiSkCanvas(this.CanvasKit, this.ref.getCanvas());\n }\n\n makeImageSnapshot(bounds?: SkRect): SkImage {\n const image = this.ref.makeImageSnapshot(\n bounds\n ? Array.from(JsiSkRect.fromValue(this.CanvasKit, bounds))\n : undefined\n );\n return new JsiSkImage(this.CanvasKit, image);\n }\n\n getNativeTextureUnstable(): unknown {\n console.warn(\"getBackendTexture is not implemented on Web\");\n return null;\n }\n}\n"],"mappings":";;;AAIA,SAASA,UAAU,QAAQ,QAAQ;AACnC,SAASC,WAAW,QAAQ,eAAe;AAC3C,SAASC,UAAU,QAAQ,cAAc;AACzC,SAASC,SAAS,QAAQ,aAAa;AAEvC,OAAO,MAAMC,YAAY,SACfJ,UAAU,CAEpB;EACEK,WAAWA,CAACC,SAAoB,EAAEC,GAAY,EAAE;IAC9C,KAAK,CAACD,SAAS,EAAEC,GAAG,EAAE,SAAS,CAAC;IAACC,eAAA,kBAGzB,MAAM;MACd,IAAI,CAACD,GAAG,CAACE,OAAO,CAAC,CAAC;IACpB,CAAC;EAJD;EAMAC,KAAKA,CAAA,EAAG;IACN,IAAI,CAACH,GAAG,CAACG,KAAK,CAAC,CAAC;EAClB;EAEAC,KAAKA,CAAA,EAAG;IACN,OAAO,IAAI,CAACJ,GAAG,CAACI,KAAK,CAAC,CAAC;EACzB;EAEAC,MAAMA,CAAA,EAAG;IACP,OAAO,IAAI,CAACL,GAAG,CAACK,MAAM,CAAC,CAAC;EAC1B;EAEAC,SAASA,CAAA,EAAa;IACpB,OAAO,IAAIZ,WAAW,CAAC,IAAI,CAACK,SAAS,EAAE,IAAI,CAACC,GAAG,CAACM,SAAS,CAAC,CAAC,CAAC;EAC9D;EAEAC,iBAAiBA,CAACC,MAAe,EAAW;IAC1C,MAAMC,KAAK,GAAG,IAAI,CAACT,GAAG,CAACO,iBAAiB,CACtCC,MAAM,GACFE,KAAK,CAACC,IAAI,CAACf,SAAS,CAACgB,SAAS,CAAC,IAAI,CAACb,SAAS,EAAES,MAAM,CAAC,CAAC,GACvDK,SACN,CAAC;IACD,OAAO,IAAIlB,UAAU,CAAC,IAAI,CAACI,SAAS,EAAEU,KAAK,CAAC;EAC9C;EAEAK,wBAAwBA,CAAA,EAAY;IAClCC,OAAO,CAACC,IAAI,CAAC,6CAA6C,CAAC;IAC3D,OAAO,IAAI;EACb;AACF","ignoreList":[]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ViewProps } from "react-native";
|
|
2
2
|
export interface NativeProps extends ViewProps {
|
|
3
3
|
debug?: boolean;
|
|
4
|
+
opaque?: boolean;
|
|
4
5
|
}
|
|
5
6
|
declare const _default: import("react-native/Libraries/Utilities/codegenNativeComponent").NativeComponentType<NativeProps>;
|
|
6
7
|
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}\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}\n\n// eslint-disable-next-line import/no-default-export\nexport default codegenNativeComponent<NativeProps>(\"SkiaPictureView\");\n"],"mappings":"AAAA,OAAOA,sBAAsB,MAAM,yDAAyD;AAQ5F;AACA,eAAeA,sBAAsB,CAAc,iBAAiB,CAAC","ignoreList":[]}
|
|
@@ -90,12 +90,14 @@ export class SkiaDomView extends React.Component {
|
|
|
90
90
|
render() {
|
|
91
91
|
const {
|
|
92
92
|
debug = false,
|
|
93
|
+
opaque = false,
|
|
93
94
|
...viewProps
|
|
94
95
|
} = this.props;
|
|
95
96
|
return /*#__PURE__*/React.createElement(NativeSkiaDomView, _extends({
|
|
96
97
|
collapsable: false,
|
|
97
98
|
nativeID: `${this._nativeId}`,
|
|
98
|
-
debug: debug
|
|
99
|
+
debug: debug,
|
|
100
|
+
opaque: opaque
|
|
99
101
|
}, viewProps));
|
|
100
102
|
}
|
|
101
103
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","Platform","SkiaDomViewNativeComponent","SkiaViewApi","SkiaViewNativeId","NativeSkiaDomView","OS","SkiaDomView","Component","constructor","props","_defineProperty","_nativeId","current","root","onSize","assertSkiaViewApi","setJsiProperty","tick","nativeId","componentDidUpdate","prevProps","componentWillUnmount","requestId","cancelAnimationFrame","redraw","mode","requestAnimationFrame","bind","makeImageSnapshot","rect","makeImageSnapshotAsync","requestRedraw","render","debug","viewProps","createElement","_extends","collapsable","nativeID","Error"],"sources":["SkiaDomView.tsx"],"sourcesContent":["import React from \"react\";\nimport type { HostComponent } from \"react-native\";\n\nimport type { SkRect } from \"../skia/types\";\nimport { Platform } from \"../Platform\";\nimport SkiaDomViewNativeComponent from \"../specs/SkiaDomViewNativeComponent\";\n\nimport { SkiaViewApi } from \"./api\";\nimport type { SkiaDomViewNativeProps } from \"./types\";\nimport { SkiaViewNativeId } from \"./SkiaViewNativeId\";\n\nconst NativeSkiaDomView: HostComponent<SkiaDomViewNativeProps> =\n Platform.OS !== \"web\"\n ? SkiaDomViewNativeComponent\n : // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (null as any);\n\ninterface SkiaDomViewProps extends SkiaDomViewNativeProps {\n mode?: \"default\" | \"continuous\";\n}\n\nexport class SkiaDomView extends React.Component<SkiaDomViewProps> {\n constructor(props: SkiaDomViewProps) {\n super(props);\n this._nativeId = SkiaViewNativeId.current++;\n const { root, onSize } = props;\n if (root) {\n assertSkiaViewApi();\n SkiaViewApi.setJsiProperty(this._nativeId, \"root\", root);\n }\n if (onSize) {\n assertSkiaViewApi();\n SkiaViewApi.setJsiProperty(this._nativeId, \"onSize\", onSize);\n }\n this.tick();\n }\n\n private _nativeId: number;\n private requestId = 0;\n\n public get nativeId() {\n return this._nativeId;\n }\n\n componentDidUpdate(prevProps: SkiaDomViewProps) {\n const { root, onSize } = this.props;\n if (root !== prevProps.root) {\n assertSkiaViewApi();\n SkiaViewApi.setJsiProperty(this._nativeId, \"root\", root);\n }\n if (onSize !== prevProps.onSize) {\n assertSkiaViewApi();\n SkiaViewApi.setJsiProperty(this._nativeId, \"onSize\", onSize);\n }\n this.tick();\n }\n\n componentWillUnmount(): void {\n if (this.requestId) {\n cancelAnimationFrame(this.requestId);\n }\n }\n\n private tick() {\n this.redraw();\n if (this.props.mode === \"continuous\") {\n this.requestId = requestAnimationFrame(this.tick.bind(this));\n }\n }\n\n /**\n * Creates a snapshot from the canvas in the surface\n * @param rect Rect to use as bounds. Optional.\n * @returns An Image object.\n */\n public makeImageSnapshot(rect?: SkRect) {\n assertSkiaViewApi();\n return SkiaViewApi.makeImageSnapshot(this._nativeId, rect);\n }\n\n /**\n * Creates a snapshot from the canvas in the surface\n * @param rect Rect to use as bounds. Optional.\n * @returns An Image object.\n */\n public makeImageSnapshotAsync(rect?: SkRect) {\n assertSkiaViewApi();\n return SkiaViewApi.makeImageSnapshotAsync(this._nativeId, rect);\n }\n\n /**\n * Sends a redraw request to the native SkiaView.\n */\n public redraw() {\n assertSkiaViewApi();\n SkiaViewApi.requestRedraw(this._nativeId);\n }\n\n render() {\n const { debug = false, ...viewProps } = this.props;\n return (\n <NativeSkiaDomView\n collapsable={false}\n nativeID={`${this._nativeId}`}\n debug={debug}\n {...viewProps}\n />\n );\n }\n}\n\nconst assertSkiaViewApi = () => {\n if (\n SkiaViewApi === null ||\n SkiaViewApi.setJsiProperty === null ||\n SkiaViewApi.requestRedraw === null ||\n SkiaViewApi.makeImageSnapshot === null\n ) {\n throw Error(\"Skia View Api was not found.\");\n }\n};\n"],"mappings":";;;;AAAA,OAA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ACN,MAAM,EAAE;MAC/BC,iBAAiB,CAAC,CAAC;MACnBb,WAAW,CAACc,cAAc,CAAC,IAAI,CAACL,SAAS,EAAE,QAAQ,EAAEG,MAAM,CAAC;IAC9D;IACA,IAAI,CAACG,IAAI,CAAC,CAAC;EACb;EAEAI,oBAAoBA,CAAA,EAAS;IAC3B,IAAI,IAAI,CAACC,SAAS,EAAE;MAClBC,oBAAoB,CAAC,IAAI,CAACD,SAAS,CAAC;IACtC;EACF;EAEQL,IAAIA,CAAA,EAAG;IACb,IAAI,CAACO,MAAM,CAAC,CAAC;IACb,IAAI,IAAI,CAACf,KAAK,CAACgB,IAAI,KAAK,YAAY,EAAE;MACpC,IAAI,CAACH,SAAS,GAAGI,qBAAqB,CAAC,IAAI,CAACT,IAAI,CAACU,IAAI,CAAC,IAAI,CAAC,CAAC;IAC9D;EACF;;EAEA;AACF;AACA;AACA;AACA;EACSC,iBAAiBA,CAACC,IAAa,EAAE;IACtCd,iBAAiB,CAAC,CAAC;IACnB,OAAOb,WAAW,CAAC0B,iBAAiB,CAAC,IAAI,CAACjB,SAAS,EAAEkB,IAAI,CAAC;EAC5D;;EAEA;AACF;AACA;AACA;AACA;EACSC,sBAAsBA,CAACD,IAAa,EAAE;IAC3Cd,iBAAiB,CAAC,CAAC;IACnB,OAAOb,WAAW,CAAC4B,sBAAsB,CAAC,IAAI,CAACnB,SAAS,EAAEkB,IAAI,CAAC;EACjE;;EAEA;AACF;AACA;EACSL,MAAMA,CAAA,EAAG;IACdT,iBAAiB,CAAC,CAAC;IACnBb,WAAW,CAAC6B,aAAa,CAAC,IAAI,CAACpB,SAAS,CAAC;EAC3C;EAEAqB,MAAMA,CAAA,EAAG;IACP,MAAM;MAAEC,KAAK,GAAG,KAAK;MAAE,GAAGC;IAAU,CAAC,GAAG,IAAI,
|
|
1
|
+
{"version":3,"names":["React","Platform","SkiaDomViewNativeComponent","SkiaViewApi","SkiaViewNativeId","NativeSkiaDomView","OS","SkiaDomView","Component","constructor","props","_defineProperty","_nativeId","current","root","onSize","assertSkiaViewApi","setJsiProperty","tick","nativeId","componentDidUpdate","prevProps","componentWillUnmount","requestId","cancelAnimationFrame","redraw","mode","requestAnimationFrame","bind","makeImageSnapshot","rect","makeImageSnapshotAsync","requestRedraw","render","debug","opaque","viewProps","createElement","_extends","collapsable","nativeID","Error"],"sources":["SkiaDomView.tsx"],"sourcesContent":["import React from \"react\";\nimport type { HostComponent } from \"react-native\";\n\nimport type { SkRect } from \"../skia/types\";\nimport { Platform } from \"../Platform\";\nimport SkiaDomViewNativeComponent from \"../specs/SkiaDomViewNativeComponent\";\n\nimport { SkiaViewApi } from \"./api\";\nimport type { SkiaDomViewNativeProps } from \"./types\";\nimport { SkiaViewNativeId } from \"./SkiaViewNativeId\";\n\nconst NativeSkiaDomView: HostComponent<SkiaDomViewNativeProps> =\n Platform.OS !== \"web\"\n ? SkiaDomViewNativeComponent\n : // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (null as any);\n\ninterface SkiaDomViewProps extends SkiaDomViewNativeProps {\n mode?: \"default\" | \"continuous\";\n}\n\nexport class SkiaDomView extends React.Component<SkiaDomViewProps> {\n constructor(props: SkiaDomViewProps) {\n super(props);\n this._nativeId = SkiaViewNativeId.current++;\n const { root, onSize } = props;\n if (root) {\n assertSkiaViewApi();\n SkiaViewApi.setJsiProperty(this._nativeId, \"root\", root);\n }\n if (onSize) {\n assertSkiaViewApi();\n SkiaViewApi.setJsiProperty(this._nativeId, \"onSize\", onSize);\n }\n this.tick();\n }\n\n private _nativeId: number;\n private requestId = 0;\n\n public get nativeId() {\n return this._nativeId;\n }\n\n componentDidUpdate(prevProps: SkiaDomViewProps) {\n const { root, onSize } = this.props;\n if (root !== prevProps.root) {\n assertSkiaViewApi();\n SkiaViewApi.setJsiProperty(this._nativeId, \"root\", root);\n }\n if (onSize !== prevProps.onSize) {\n assertSkiaViewApi();\n SkiaViewApi.setJsiProperty(this._nativeId, \"onSize\", onSize);\n }\n this.tick();\n }\n\n componentWillUnmount(): void {\n if (this.requestId) {\n cancelAnimationFrame(this.requestId);\n }\n }\n\n private tick() {\n this.redraw();\n if (this.props.mode === \"continuous\") {\n this.requestId = requestAnimationFrame(this.tick.bind(this));\n }\n }\n\n /**\n * Creates a snapshot from the canvas in the surface\n * @param rect Rect to use as bounds. Optional.\n * @returns An Image object.\n */\n public makeImageSnapshot(rect?: SkRect) {\n assertSkiaViewApi();\n return SkiaViewApi.makeImageSnapshot(this._nativeId, rect);\n }\n\n /**\n * Creates a snapshot from the canvas in the surface\n * @param rect Rect to use as bounds. Optional.\n * @returns An Image object.\n */\n public makeImageSnapshotAsync(rect?: SkRect) {\n assertSkiaViewApi();\n return SkiaViewApi.makeImageSnapshotAsync(this._nativeId, rect);\n }\n\n /**\n * Sends a redraw request to the native SkiaView.\n */\n public redraw() {\n assertSkiaViewApi();\n SkiaViewApi.requestRedraw(this._nativeId);\n }\n\n render() {\n const { debug = false, opaque = false, ...viewProps } = this.props;\n return (\n <NativeSkiaDomView\n collapsable={false}\n nativeID={`${this._nativeId}`}\n debug={debug}\n opaque={opaque}\n {...viewProps}\n />\n );\n }\n}\n\nconst assertSkiaViewApi = () => {\n if (\n SkiaViewApi === null ||\n SkiaViewApi.setJsiProperty === null ||\n SkiaViewApi.requestRedraw === null ||\n SkiaViewApi.makeImageSnapshot === null\n ) {\n throw Error(\"Skia View Api was not found.\");\n }\n};\n"],"mappings":";;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AAIzB,SAASC,QAAQ,QAAQ,aAAa;AACtC,OAAOC,0BAA0B,MAAM,qCAAqC;AAE5E,SAASC,WAAW,QAAQ,OAAO;AAEnC,SAASC,gBAAgB,QAAQ,oBAAoB;AAErD,MAAMC,iBAAwD,GAC5DJ,QAAQ,CAACK,EAAE,KAAK,KAAK,GACjBJ,0BAA0B;AAC1B;AACC,IAAY;AAMnB,OAAO,MAAMK,WAAW,SAASP,KAAK,CAACQ,SAAS,CAAmB;EACjEC,WAAWA,CAACC,KAAuB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,IAAI,EACtC;IACA,MAAMY,KAAK,CAAC,8BAA8B,CAAC;EAC7C;AACF,CAAC","ignoreList":[]}
|
|
@@ -31,6 +31,7 @@ export class SkiaPictureView extends React.Component {
|
|
|
31
31
|
return this._nativeId;
|
|
32
32
|
}
|
|
33
33
|
componentDidUpdate(prevProps) {
|
|
34
|
+
console.log("componentDidUpdate");
|
|
34
35
|
const {
|
|
35
36
|
picture,
|
|
36
37
|
onSize
|
|
@@ -72,18 +73,21 @@ export class SkiaPictureView extends React.Component {
|
|
|
72
73
|
*/
|
|
73
74
|
redraw() {
|
|
74
75
|
assertSkiaViewApi();
|
|
76
|
+
console.log("Request redraw: ", this._nativeId);
|
|
75
77
|
SkiaViewApi.requestRedraw(this._nativeId);
|
|
76
78
|
}
|
|
77
79
|
render() {
|
|
78
80
|
const {
|
|
79
81
|
mode,
|
|
80
82
|
debug = false,
|
|
83
|
+
opaque = false,
|
|
81
84
|
...viewProps
|
|
82
85
|
} = this.props;
|
|
83
86
|
return /*#__PURE__*/React.createElement(NativeSkiaPictureView, _extends({
|
|
84
87
|
collapsable: false,
|
|
85
88
|
nativeID: `${this._nativeId}`,
|
|
86
|
-
debug: debug
|
|
89
|
+
debug: debug,
|
|
90
|
+
opaque: opaque
|
|
87
91
|
}, viewProps));
|
|
88
92
|
}
|
|
89
93
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","SkiaPictureViewNativeComponent","SkiaViewApi","SkiaViewNativeId","NativeSkiaPictureView","SkiaPictureView","Component","constructor","props","_defineProperty","_nativeId","current","picture","onSize","assertSkiaViewApi","setJsiProperty","tick","nativeId","componentDidUpdate","prevProps","componentWillUnmount","requestId","cancelAnimationFrame","redraw","mode","requestAnimationFrame","bind","makeImageSnapshot","rect","requestRedraw","render","debug","viewProps","createElement","_extends","collapsable","nativeID","Error"],"sources":["SkiaPictureView.tsx"],"sourcesContent":["import React from \"react\";\n\nimport type { SkRect } from \"../skia/types\";\nimport SkiaPictureViewNativeComponent from \"../specs/SkiaPictureViewNativeComponent\";\n\nimport { SkiaViewApi } from \"./api\";\nimport type { SkiaPictureViewNativeProps } from \"./types\";\nimport { SkiaViewNativeId } from \"./SkiaViewNativeId\";\n\nconst NativeSkiaPictureView = SkiaPictureViewNativeComponent;\n\ninterface SkiaPictureViewProps extends SkiaPictureViewNativeProps {\n mode?: \"default\" | \"continuous\";\n}\n\nexport class SkiaPictureView extends React.Component<SkiaPictureViewProps> {\n private requestId = 0;\n\n constructor(props: SkiaPictureViewProps) {\n super(props);\n this._nativeId = SkiaViewNativeId.current++;\n const { picture, onSize } = props;\n if (picture) {\n assertSkiaViewApi();\n SkiaViewApi.setJsiProperty(this._nativeId, \"picture\", picture);\n }\n if (onSize) {\n assertSkiaViewApi();\n SkiaViewApi.setJsiProperty(this._nativeId, \"onSize\", onSize);\n }\n this.tick();\n }\n\n private _nativeId: number;\n\n public get nativeId() {\n return this._nativeId;\n }\n\n componentDidUpdate(prevProps: SkiaPictureViewProps) {\n const { picture, onSize } = this.props;\n if (picture !== prevProps.picture) {\n assertSkiaViewApi();\n SkiaViewApi.setJsiProperty(this._nativeId, \"picture\", picture);\n }\n if (onSize !== prevProps.onSize) {\n assertSkiaViewApi();\n SkiaViewApi.setJsiProperty(this._nativeId, \"onSize\", onSize);\n }\n this.tick();\n }\n\n componentWillUnmount() {\n if (this.requestId) {\n cancelAnimationFrame(this.requestId);\n }\n }\n\n private tick() {\n this.redraw();\n if (this.props.mode === \"continuous\") {\n this.requestId = requestAnimationFrame(this.tick.bind(this));\n }\n }\n\n /**\n * Creates a snapshot from the canvas in the surface\n * @param rect Rect to use as bounds. Optional.\n * @returns An Image object.\n */\n public makeImageSnapshot(rect?: SkRect) {\n assertSkiaViewApi();\n return SkiaViewApi.makeImageSnapshot(this._nativeId, rect);\n }\n\n /**\n * Sends a redraw request to the native SkiaView.\n */\n public redraw() {\n assertSkiaViewApi();\n SkiaViewApi.requestRedraw(this._nativeId);\n }\n\n render() {\n const { mode, debug = false, ...viewProps } = this.props;\n return (\n <NativeSkiaPictureView\n collapsable={false}\n nativeID={`${this._nativeId}`}\n debug={debug}\n {...viewProps}\n />\n );\n }\n}\n\nconst assertSkiaViewApi = () => {\n if (\n SkiaViewApi === null ||\n SkiaViewApi.setJsiProperty === null ||\n SkiaViewApi.requestRedraw === null ||\n SkiaViewApi.makeImageSnapshot === null\n ) {\n throw Error(\"Skia View Api was not found.\");\n }\n};\n"],"mappings":";;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AAGzB,OAAOC,8BAA8B,MAAM,yCAAyC;AAEpF,SAASC,WAAW,QAAQ,OAAO;AAEnC,SAASC,gBAAgB,QAAQ,oBAAoB;AAErD,MAAMC,qBAAqB,GAAGH,8BAA8B;AAM5D,OAAO,MAAMI,eAAe,SAASL,KAAK,CAACM,SAAS,CAAuB;EAGzEC,WAAWA,CAACC,KAA2B,EAAE;IACvC,KAAK,CAACA,KAAK,CAAC;IAACC,eAAA,oBAHK,CAAC;IAAAA,eAAA;IAInB,IAAI,CAACC,SAAS,GAAGP,gBAAgB,CAACQ,OAAO,EAAE;IAC3C,MAAM;MAAEC,OAAO;MAAEC;IAAO,CAAC,GAAGL,KAAK;IACjC,IAAII,OAAO,EAAE;MACXE,iBAAiB,CAAC,CAAC;MACnBZ,WAAW,CAACa,cAAc,CAAC,IAAI,CAACL,SAAS,EAAE,SAAS,EAAEE,OAAO,CAAC;IAChE;IACA,IAAIC,MAAM,EAAE;MACVC,iBAAiB,CAAC,CAAC;MACnBZ,WAAW,CAACa,cAAc,CAAC,IAAI,CAACL,SAAS,EAAE,QAAQ,EAAEG,MAAM,CAAC;IAC9D;IACA,IAAI,CAACG,IAAI,CAAC,CAAC;EACb;EAIA,IAAWC,QAAQA,CAAA,EAAG;IACpB,OAAO,IAAI,CAACP,SAAS;EACvB;EAEAQ,kBAAkBA,CAACC,SAA+B,EAAE;
|
|
1
|
+
{"version":3,"names":["React","SkiaPictureViewNativeComponent","SkiaViewApi","SkiaViewNativeId","NativeSkiaPictureView","SkiaPictureView","Component","constructor","props","_defineProperty","_nativeId","current","picture","onSize","assertSkiaViewApi","setJsiProperty","tick","nativeId","componentDidUpdate","prevProps","console","log","componentWillUnmount","requestId","cancelAnimationFrame","redraw","mode","requestAnimationFrame","bind","makeImageSnapshot","rect","requestRedraw","render","debug","opaque","viewProps","createElement","_extends","collapsable","nativeID","Error"],"sources":["SkiaPictureView.tsx"],"sourcesContent":["import React from \"react\";\n\nimport type { SkRect } from \"../skia/types\";\nimport SkiaPictureViewNativeComponent from \"../specs/SkiaPictureViewNativeComponent\";\n\nimport { SkiaViewApi } from \"./api\";\nimport type { SkiaPictureViewNativeProps } from \"./types\";\nimport { SkiaViewNativeId } from \"./SkiaViewNativeId\";\n\nconst NativeSkiaPictureView = SkiaPictureViewNativeComponent;\n\ninterface SkiaPictureViewProps extends SkiaPictureViewNativeProps {\n mode?: \"default\" | \"continuous\";\n}\n\nexport class SkiaPictureView extends React.Component<SkiaPictureViewProps> {\n private requestId = 0;\n\n constructor(props: SkiaPictureViewProps) {\n super(props);\n this._nativeId = SkiaViewNativeId.current++;\n const { picture, onSize } = props;\n if (picture) {\n assertSkiaViewApi();\n SkiaViewApi.setJsiProperty(this._nativeId, \"picture\", picture);\n }\n if (onSize) {\n assertSkiaViewApi();\n SkiaViewApi.setJsiProperty(this._nativeId, \"onSize\", onSize);\n }\n this.tick();\n }\n\n private _nativeId: number;\n\n public get nativeId() {\n return this._nativeId;\n }\n\n componentDidUpdate(prevProps: SkiaPictureViewProps) {\n console.log(\"componentDidUpdate\");\n const { picture, onSize } = this.props;\n if (picture !== prevProps.picture) {\n assertSkiaViewApi();\n SkiaViewApi.setJsiProperty(this._nativeId, \"picture\", picture);\n }\n if (onSize !== prevProps.onSize) {\n assertSkiaViewApi();\n SkiaViewApi.setJsiProperty(this._nativeId, \"onSize\", onSize);\n }\n this.tick();\n }\n\n componentWillUnmount() {\n if (this.requestId) {\n cancelAnimationFrame(this.requestId);\n }\n }\n\n private tick() {\n this.redraw();\n if (this.props.mode === \"continuous\") {\n this.requestId = requestAnimationFrame(this.tick.bind(this));\n }\n }\n\n /**\n * Creates a snapshot from the canvas in the surface\n * @param rect Rect to use as bounds. Optional.\n * @returns An Image object.\n */\n public makeImageSnapshot(rect?: SkRect) {\n assertSkiaViewApi();\n return SkiaViewApi.makeImageSnapshot(this._nativeId, rect);\n }\n\n /**\n * Sends a redraw request to the native SkiaView.\n */\n public redraw() {\n assertSkiaViewApi();\n console.log(\"Request redraw: \", this._nativeId);\n SkiaViewApi.requestRedraw(this._nativeId);\n }\n\n render() {\n const { mode, debug = false, opaque = false, ...viewProps } = this.props;\n return (\n <NativeSkiaPictureView\n collapsable={false}\n nativeID={`${this._nativeId}`}\n debug={debug}\n opaque={opaque}\n {...viewProps}\n />\n );\n }\n}\n\nconst assertSkiaViewApi = () => {\n if (\n SkiaViewApi === null ||\n SkiaViewApi.setJsiProperty === null ||\n SkiaViewApi.requestRedraw === null ||\n SkiaViewApi.makeImageSnapshot === null\n ) {\n throw Error(\"Skia View Api was not found.\");\n }\n};\n"],"mappings":";;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AAGzB,OAAOC,8BAA8B,MAAM,yCAAyC;AAEpF,SAASC,WAAW,QAAQ,OAAO;AAEnC,SAASC,gBAAgB,QAAQ,oBAAoB;AAErD,MAAMC,qBAAqB,GAAGH,8BAA8B;AAM5D,OAAO,MAAMI,eAAe,SAASL,KAAK,CAACM,SAAS,CAAuB;EAGzEC,WAAWA,CAACC,KAA2B,EAAE;IACvC,KAAK,CAACA,KAAK,CAAC;IAACC,eAAA,oBAHK,CAAC;IAAAA,eAAA;IAInB,IAAI,CAACC,SAAS,GAAGP,gBAAgB,CAACQ,OAAO,EAAE;IAC3C,MAAM;MAAEC,OAAO;MAAEC;IAAO,CAAC,GAAGL,KAAK;IACjC,IAAII,OAAO,EAAE;MACXE,iBAAiB,CAAC,CAAC;MACnBZ,WAAW,CAACa,cAAc,CAAC,IAAI,C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AAE;IACtChB,iBAAiB,CAAC,CAAC;IACnB,OAAOZ,WAAW,CAAC2B,iBAAiB,CAAC,IAAI,CAACnB,SAAS,EAAEoB,IAAI,CAAC;EAC5D;;EAEA;AACF;AACA;EACSL,MAAMA,CAAA,EAAG;IACdX,iBAAiB,CAAC,CAAC;IACnBM,OAAO,CAACC,GAAG,CAAC,kBAAkB,EAAE,IAAI,CAACX,SAAS,CAAC;IAC/CR,WAAW,CAAC6B,aAAa,CAAC,IAAI,CAACrB,SAAS,CAAC;EAC3C;EAEAsB,MAAMA,CAAA,EAAG;IACP,MAAM;MAAEN,IAAI;MAAEO,KAAK,GAAG,KAAK;MAAEC,MAAM,GAAG,KAAK;MAAE,GAAGC;IAAU,CAAC,GAAG,IAAI,CAAC3B,KAAK;IACxE,oBACER,KAAA,CAAAoC,aAAA,CAAChC,qBAAqB,EAAAiC,QAAA;MACpBC,WAAW,EAAE,KAAM;MACnBC,QAAQ,EAAE,GAAG,IAAI,CAAC7B,SAAS,EAAG;MAC9BuB,KAAK,EAAEA,KAAM;MACbC,MAAM,EAAEA;IAAO,GACXC,SAAS,CACd,CAAC;EAEN;AACF;AAEA,MAAMrB,iBAAiB,GAAGA,CAAA,KAAM;EAC9B,IACEZ,WAAW,KAAK,IAAI,IACpBA,WAAW,CAACa,cAAc,KAAK,IAAI,IACnCb,WAAW,CAAC6B,aAAa,KAAK,IAAI,IAClC7B,WAAW,CAAC2B,iBAAiB,KAAK,IAAI,EACtC;IACA,MAAMW,KAAK,CAAC,8BAA8B,CAAC;EAC7C;AACF,CAAC","ignoreList":[]}
|
|
@@ -4,6 +4,7 @@ import type { SkImage, SkPicture, SkRect, SkSize } from "../skia/types";
|
|
|
4
4
|
import type { SharedValueType } from "../renderer/processors/Animations/Animations";
|
|
5
5
|
export type NativeSkiaViewProps = ViewProps & {
|
|
6
6
|
debug?: boolean;
|
|
7
|
+
opaque?: boolean;
|
|
7
8
|
};
|
|
8
9
|
export interface DrawingInfo {
|
|
9
10
|
width: number;
|
|
@@ -27,6 +28,7 @@ export interface SkiaBaseViewProps extends ViewProps {
|
|
|
27
28
|
* the Skia view is resized.
|
|
28
29
|
*/
|
|
29
30
|
onSize?: SharedValueType<SkSize>;
|
|
31
|
+
opaque?: boolean;
|
|
30
32
|
}
|
|
31
33
|
export interface SkiaPictureViewNativeProps extends SkiaBaseViewProps {
|
|
32
34
|
picture?: SkPicture;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type { ViewProps } from \"react-native\";\n\nimport type { GroupProps, RenderNode } from \"../dom/types\";\nimport type { SkImage, SkPicture, SkRect, SkSize } from \"../skia/types\";\nimport type { SharedValueType } from \"../renderer/processors/Animations/Animations\";\n\nexport type NativeSkiaViewProps = ViewProps & {\n debug?: boolean;\n};\n\nexport interface DrawingInfo {\n width: number;\n height: number;\n timestamp: number;\n}\n\nexport interface ISkiaViewApi {\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?: SharedValueType<SkSize>;\n}\n\nexport interface SkiaPictureViewNativeProps extends SkiaBaseViewProps {\n picture?: SkPicture;\n}\n\nexport interface SkiaDomViewNativeProps extends SkiaBaseViewProps {\n root?: RenderNode<GroupProps>;\n}\n"],"mappings":"","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type { ViewProps } from \"react-native\";\n\nimport type { GroupProps, RenderNode } from \"../dom/types\";\nimport type { SkImage, SkPicture, SkRect, SkSize } from \"../skia/types\";\nimport type { SharedValueType } from \"../renderer/processors/Animations/Animations\";\n\nexport type NativeSkiaViewProps = ViewProps & {\n debug?: boolean;\n opaque?: boolean;\n};\n\nexport interface DrawingInfo {\n width: number;\n height: number;\n timestamp: number;\n}\n\nexport interface ISkiaViewApi {\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?: SharedValueType<SkSize>;\n\n opaque?: boolean;\n}\n\nexport interface SkiaPictureViewNativeProps extends SkiaBaseViewProps {\n picture?: SkPicture;\n}\n\nexport interface SkiaDomViewNativeProps extends SkiaBaseViewProps {\n root?: RenderNode<GroupProps>;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -29,3 +29,9 @@ 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
31
|
export function convertToAffineMatrix(m4: any): any[];
|
|
32
|
+
/**
|
|
33
|
+
* Inverts a 4x4 matrix
|
|
34
|
+
* @worklet
|
|
35
|
+
* @returns The inverted matrix, or the identity matrix if the input is not invertible
|
|
36
|
+
*/
|
|
37
|
+
export function invert4(m: any): number[];
|
|
@@ -16,6 +16,7 @@ export class JsiSkImage extends _Host.HostObject {
|
|
|
16
16
|
encodeToBase64(fmt: any, quality: any): string;
|
|
17
17
|
readPixels(srcX: any, srcY: any, imageInfo: any): any;
|
|
18
18
|
makeNonTextureImage(): JsiSkImage;
|
|
19
|
+
getNativeTextureUnstable(): null;
|
|
19
20
|
}
|
|
20
21
|
import _Host = require("./Host");
|
|
21
22
|
import _JsiSkShader = require("./JsiSkShader");
|
|
@@ -3,6 +3,7 @@ export class JsiSkImageFactory extends _Host.Host {
|
|
|
3
3
|
MakeImageFromViewTag(viewTag: any): Promise<null>;
|
|
4
4
|
MakeImageFromNativeBuffer(buffer: any, surface: any, image: any): _JsiSkImage.JsiSkImage;
|
|
5
5
|
MakeImageFromEncoded(encoded: any): _JsiSkImage.JsiSkImage | null;
|
|
6
|
+
MakeImageFromNativeTextureUnstable(): void;
|
|
6
7
|
MakeImage(info: any, data: any, bytesPerRow: any): _JsiSkImage.JsiSkImage | null;
|
|
7
8
|
}
|
|
8
9
|
import _Host = require("./Host");
|
|
@@ -6,6 +6,7 @@ export class JsiSkSurface extends _Host.HostObject {
|
|
|
6
6
|
height(): any;
|
|
7
7
|
getCanvas(): _JsiSkCanvas.JsiSkCanvas;
|
|
8
8
|
makeImageSnapshot(bounds: any): _JsiSkImage.JsiSkImage;
|
|
9
|
+
getNativeTextureUnstable(): null;
|
|
9
10
|
}
|
|
10
11
|
import _Host = require("./Host");
|
|
11
12
|
import _JsiSkCanvas = require("./JsiSkCanvas");
|
|
@@ -254,6 +254,7 @@ export function Mock(CanvasKit: any): {
|
|
|
254
254
|
processTransform3d: (transforms: any) => any;
|
|
255
255
|
convertToColumnMajor: (rowMajorMatrix: any) => any[];
|
|
256
256
|
convertToAffineMatrix: (m4: any) => any[];
|
|
257
|
+
invert4: (m: any) => number[];
|
|
257
258
|
CanvasKitWebGLBuffer: typeof import("../skia").CanvasKitWebGLBuffer;
|
|
258
259
|
isNativeBufferAddr: (buffer: any) => buffer is BigInt;
|
|
259
260
|
isNativeBufferWeb: (buffer: any) => boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export let ColorType: {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export let ColorTypeCanvasKit: {};
|
|
@@ -13,3 +13,4 @@ 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
15
|
export function convertToAffineMatrix(m4: any): any[];
|
|
16
|
+
export function invert4(m: any): number[];
|
|
@@ -15,6 +15,7 @@ export class JsiSkImage extends HostObject {
|
|
|
15
15
|
encodeToBase64(fmt: any, quality: any): string;
|
|
16
16
|
readPixels(srcX: any, srcY: any, imageInfo: any): any;
|
|
17
17
|
makeNonTextureImage(): JsiSkImage;
|
|
18
|
+
getNativeTextureUnstable(): null;
|
|
18
19
|
}
|
|
19
20
|
import { HostObject } from "./Host";
|
|
20
21
|
import { JsiSkShader } from "./JsiSkShader";
|
|
@@ -2,6 +2,7 @@ export class JsiSkImageFactory extends Host {
|
|
|
2
2
|
MakeImageFromViewTag(viewTag: any): Promise<null>;
|
|
3
3
|
MakeImageFromNativeBuffer(buffer: any, surface: any, image: any): JsiSkImage;
|
|
4
4
|
MakeImageFromEncoded(encoded: any): JsiSkImage | null;
|
|
5
|
+
MakeImageFromNativeTextureUnstable(): void;
|
|
5
6
|
MakeImage(info: any, data: any, bytesPerRow: any): JsiSkImage | null;
|
|
6
7
|
}
|
|
7
8
|
import { Host } from "./Host";
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export declare enum ColorType {
|
|
2
|
+
Unknown = 0,// uninitialized
|
|
3
|
+
Alpha_8 = 1,// pixel with alpha in 8-bit byte
|
|
4
|
+
RGB_565 = 2,// pixel with 5 bits red, 6 bits green, 5 bits blue, in 16-bit word
|
|
5
|
+
ARGB_4444 = 3,// pixel with 4 bits for alpha, red, green, blue; in 16-bit word
|
|
6
|
+
RGBA_8888 = 4,// pixel with 8 bits for red, green, blue, alpha; in 32-bit word
|
|
7
|
+
RGB_888x = 5,// pixel with 8 bits each for red, green, blue; in 32-bit word
|
|
8
|
+
BGRA_8888 = 6,// pixel with 8 bits for blue, green, red, alpha; in 32-bit word
|
|
9
|
+
RGBA_1010102 = 7,// 10 bits for red, green, blue; 2 bits for alpha; in 32-bit word
|
|
10
|
+
BGRA_1010102 = 8,// 10 bits for blue, green, red; 2 bits for alpha; in 32-bit word
|
|
11
|
+
RGB_101010x = 9,// pixel with 10 bits each for red, green, blue; in 32-bit word
|
|
12
|
+
BGR_101010x = 10,// pixel with 10 bits each for blue, green, red; in 32-bit word
|
|
13
|
+
BGR_101010x_XR = 11,// pixel with 10 bits each for blue, green, red; in 32-bit word, extended range
|
|
14
|
+
BGRA_10101010_XR = 12,// pixel with 10 bits each for blue, green, red, alpha; in 64-bit word, extended range
|
|
15
|
+
RGBA_10x6 = 13,// pixel with 10 used bits (most significant) followed by 6 unused
|
|
16
|
+
Gray_8 = 14,// pixel with grayscale level in 8-bit byte
|
|
17
|
+
RGBA_F16Norm = 15,// pixel with half floats in [0,1] for red, green, blue, alpha; in 64-bit word
|
|
18
|
+
RGBA_F16 = 16,// pixel with half floats for red, green, blue, alpha; in 64-bit word
|
|
19
|
+
RGB_F16F16F16x = 17,// pixel with half floats for red, green, blue; in 64-bit word
|
|
20
|
+
RGBA_F32 = 18
|
|
21
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export declare enum ColorTypeCanvasKit {
|
|
2
|
+
Unknown = 0,// uninitialized
|
|
3
|
+
Alpha_8 = 1,// pixel with alpha in 8-bit byte
|
|
4
|
+
RGB_565 = 2,// pixel with 5 bits red, 6 bits green, 5 bits blue, in 16-bit word
|
|
5
|
+
ARGB_4444 = 3,// pixel with 4 bits for alpha, red, green, blue; in 16-bit word
|
|
6
|
+
RGBA_8888 = 4,// pixel with 8 bits for red, green, blue, alpha; in 32-bit word
|
|
7
|
+
RGB_888x = 5,// pixel with 8 bits each for red, green, blue; in 32-bit word
|
|
8
|
+
BGRA_8888 = 6,// pixel with 8 bits for blue, green, red, alpha; in 32-bit word
|
|
9
|
+
RGBA_1010102 = 7,// 10 bits for red, green, blue; 2 bits for alpha; in 32-bit word
|
|
10
|
+
BGRA_1010102 = 8,// 10 bits for blue, green, red; 2 bits for alpha; in 32-bit word
|
|
11
|
+
RGB_101010x = 9,// pixel with 10 bits each for red, green, blue; in 32-bit word
|
|
12
|
+
BGR_101010x = 10,// pixel with 10 bits each for blue, green, red; in 32-bit word
|
|
13
|
+
BGR_101010x_XR = 11,// pixel with 10 bits each for blue, green, red; in 32-bit word, extended range
|
|
14
|
+
RGBA_10x6 = 12,// pixel with 10 used bits (most significant) followed by 6 unused
|
|
15
|
+
Gray_8 = 13,// pixel with grayscale level in 8-bit byte
|
|
16
|
+
RGBA_F16Norm = 14,// pixel with half floats in [0,1] for red, green, blue, alpha; in 64-bit word
|
|
17
|
+
RGBA_F16 = 15,// pixel with half floats for red, green, blue, alpha; in 64-bit word
|
|
18
|
+
RGBA_F32 = 16
|
|
19
|
+
}
|
|
@@ -38,6 +38,16 @@ export interface SkImage extends SkJSIInstance<"Image"> {
|
|
|
38
38
|
* Returns the ImageInfo describing the image.
|
|
39
39
|
*/
|
|
40
40
|
getImageInfo(): ImageInfo;
|
|
41
|
+
/**
|
|
42
|
+
* Returns the backend texture of the image.
|
|
43
|
+
* The returned object can be used to create a Skia Image object.
|
|
44
|
+
* The returned object is backend specific and should be used with caution.
|
|
45
|
+
* It is the caller's responsibility to ensure that the texture is not used after the image is deleted.
|
|
46
|
+
* The returned object may be null if the image does not have a backend texture.
|
|
47
|
+
*
|
|
48
|
+
* @return backend texture of the image or null
|
|
49
|
+
*/
|
|
50
|
+
getNativeTextureUnstable(): unknown;
|
|
41
51
|
/**
|
|
42
52
|
* Returns this image as a shader with the specified tiling. It will use cubic sampling.
|
|
43
53
|
* @param tx - tile mode in the x direction.
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { SkData } from "../Data";
|
|
2
2
|
import type { NativeBuffer } from "../NativeBuffer";
|
|
3
|
+
import type { ColorType } from "./ColorType";
|
|
3
4
|
import type { SkImage } from "./Image";
|
|
4
5
|
export declare enum AlphaType {
|
|
5
6
|
Unknown = 0,
|
|
@@ -7,25 +8,6 @@ export declare enum AlphaType {
|
|
|
7
8
|
Premul = 2,
|
|
8
9
|
Unpremul = 3
|
|
9
10
|
}
|
|
10
|
-
export declare enum ColorType {
|
|
11
|
-
Unknown = 0,// uninitialized
|
|
12
|
-
Alpha_8 = 1,// pixel with alpha in 8-bit byte
|
|
13
|
-
RGB_565 = 2,// pixel with 5 bits red, 6 bits green, 5 bits blue, in 16-bit word
|
|
14
|
-
ARGB_4444 = 3,// pixel with 4 bits for alpha, red, green, blue; in 16-bit word
|
|
15
|
-
RGBA_8888 = 4,// pixel with 8 bits for red, green, blue, alpha; in 32-bit word
|
|
16
|
-
RGB_888x = 5,// pixel with 8 bits each for red, green, blue; in 32-bit word
|
|
17
|
-
BGRA_8888 = 6,// pixel with 8 bits for blue, green, red, alpha; in 32-bit word
|
|
18
|
-
RGBA_1010102 = 7,// 10 bits for red, green, blue; 2 bits for alpha; in 32-bit word
|
|
19
|
-
BGRA_1010102 = 8,// 10 bits for blue, green, red; 2 bits for alpha; in 32-bit word
|
|
20
|
-
RGB_101010x = 9,// pixel with 10 bits each for red, green, blue; in 32-bit word
|
|
21
|
-
BGR_101010x = 10,// pixel with 10 bits each for blue, green, red; in 32-bit word
|
|
22
|
-
BGR_101010x_XR = 11,// pixel with 10 bits each for blue, green, red; in 32-bit word, extended range
|
|
23
|
-
RGBA_10x6 = 12,// pixel with 10 used bits (most significant) followed by 6 unused
|
|
24
|
-
Gray_8 = 13,// pixel with grayscale level in 8-bit byte
|
|
25
|
-
RGBA_F16Norm = 14,// pixel with half floats in [0,1] for red, green, blue, alpha; in 64-bit word
|
|
26
|
-
RGBA_F16 = 15,// pixel with half floats for red, green, blue, alpha; in 64-bit word
|
|
27
|
-
RGBA_F32 = 16
|
|
28
|
-
}
|
|
29
11
|
export interface ImageInfo {
|
|
30
12
|
alphaType: AlphaType;
|
|
31
13
|
colorType: ColorType;
|
|
@@ -59,6 +41,24 @@ export interface ImageFactory {
|
|
|
59
41
|
* native buffer is invalid.
|
|
60
42
|
*/
|
|
61
43
|
MakeImageFromNativeBuffer: (nativeBuffer: NativeBuffer) => SkImage;
|
|
44
|
+
/**
|
|
45
|
+
*
|
|
46
|
+
* Return an Image backed by a given native texture.
|
|
47
|
+
*
|
|
48
|
+
* The native texture must be a valid owning reference.
|
|
49
|
+
*
|
|
50
|
+
* This API might be used to integrate with other libraries using gpu textures,
|
|
51
|
+
* or to transfer images between different threads.
|
|
52
|
+
*
|
|
53
|
+
* @param texture A native texture handle
|
|
54
|
+
* @param width The width of the texture
|
|
55
|
+
* @param height The height of the texture
|
|
56
|
+
* @param mipmapped Whether the texture is mipmapped
|
|
57
|
+
* @throws Throws an error if the Image could not be created, for example when the given native texture is invalid.
|
|
58
|
+
*
|
|
59
|
+
* @returns Returns a valid SkImage, if the texture is invalid, an error is thrown.
|
|
60
|
+
*/
|
|
61
|
+
MakeImageFromNativeTextureUnstable: (texture: unknown, width: number, height: number, mipmapped?: boolean) => SkImage;
|
|
62
62
|
/**
|
|
63
63
|
* Returns an image that will be a screenshot of the view represented by
|
|
64
64
|
* the view tag
|
|
@@ -100,4 +100,10 @@ export declare const convertToColumnMajor: (rowMajorMatrix: Matrix4) => Matrix4;
|
|
|
100
100
|
* @worklet
|
|
101
101
|
*/
|
|
102
102
|
export declare const convertToAffineMatrix: (m4: Matrix4) => number[];
|
|
103
|
+
/**
|
|
104
|
+
* Inverts a 4x4 matrix
|
|
105
|
+
* @worklet
|
|
106
|
+
* @returns The inverted matrix, or the identity matrix if the input is not invertible
|
|
107
|
+
*/
|
|
108
|
+
export declare const invert4: (m: Matrix4) => Matrix4;
|
|
103
109
|
export {};
|
|
@@ -12,6 +12,17 @@ export interface SkSurface extends SkJSIInstance<"Surface"> {
|
|
|
12
12
|
example: https://fiddle.skia.org/c/@Surface_getCanvas
|
|
13
13
|
*/
|
|
14
14
|
getCanvas(): SkCanvas;
|
|
15
|
+
/**
|
|
16
|
+
* Returns the backend texture of the surface.
|
|
17
|
+
* The returned object can be used to create a Skia Image object.
|
|
18
|
+
* The returned object is backend specific and should be used with caution.
|
|
19
|
+
* It is the caller's responsibility to ensure that the texture is not used after the surface is deleted
|
|
20
|
+
* or draw operations are performed on the surface.
|
|
21
|
+
* The returned object may be null if the surface does not have a backend texture.
|
|
22
|
+
*
|
|
23
|
+
* @return backend texture of the surface or null
|
|
24
|
+
*/
|
|
25
|
+
getNativeTextureUnstable(): unknown;
|
|
15
26
|
/** Returns Image capturing Surface contents. Subsequent drawing to
|
|
16
27
|
Surface contents are not captured.
|
|
17
28
|
|
|
@@ -14,4 +14,5 @@ export declare class JsiSkImage extends HostObject<Image, "Image"> implements Sk
|
|
|
14
14
|
readPixels(srcX?: number, srcY?: number, imageInfo?: ImageInfo): Float32Array | Uint8Array | null;
|
|
15
15
|
dispose: () => void;
|
|
16
16
|
makeNonTextureImage(): SkImage;
|
|
17
|
+
getNativeTextureUnstable(): unknown;
|
|
17
18
|
}
|
|
@@ -8,5 +8,6 @@ export declare class JsiSkImageFactory extends Host implements ImageFactory {
|
|
|
8
8
|
MakeImageFromViewTag(viewTag: number): Promise<SkImage | null>;
|
|
9
9
|
MakeImageFromNativeBuffer(buffer: NativeBuffer, surface?: JsiSkSurface, image?: JsiSkImage): JsiSkImage;
|
|
10
10
|
MakeImageFromEncoded(encoded: SkData): JsiSkImage | null;
|
|
11
|
+
MakeImageFromNativeTextureUnstable(): SkImage;
|
|
11
12
|
MakeImage(info: ImageInfo, data: SkData, bytesPerRow: number): JsiSkImage | null;
|
|
12
13
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ViewProps } from "react-native";
|
|
2
2
|
export interface NativeProps extends ViewProps {
|
|
3
3
|
debug?: boolean;
|
|
4
|
+
opaque?: boolean;
|
|
4
5
|
}
|
|
5
6
|
declare const _default: import("react-native/Libraries/Utilities/codegenNativeComponent").NativeComponentType<NativeProps>;
|
|
6
7
|
export default _default;
|
|
@@ -4,6 +4,7 @@ import type { SkImage, SkPicture, SkRect, SkSize } from "../skia/types";
|
|
|
4
4
|
import type { SharedValueType } from "../renderer/processors/Animations/Animations";
|
|
5
5
|
export type NativeSkiaViewProps = ViewProps & {
|
|
6
6
|
debug?: boolean;
|
|
7
|
+
opaque?: boolean;
|
|
7
8
|
};
|
|
8
9
|
export interface DrawingInfo {
|
|
9
10
|
width: number;
|
|
@@ -27,6 +28,7 @@ export interface SkiaBaseViewProps extends ViewProps {
|
|
|
27
28
|
* the Skia view is resized.
|
|
28
29
|
*/
|
|
29
30
|
onSize?: SharedValueType<SkSize>;
|
|
31
|
+
opaque?: boolean;
|
|
30
32
|
}
|
|
31
33
|
export interface SkiaPictureViewNativeProps extends SkiaBaseViewProps {
|
|
32
34
|
picture?: SkPicture;
|
package/package.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"setup-skia-web": "./scripts/setup-canvaskit.js"
|
|
8
8
|
},
|
|
9
9
|
"title": "React Native Skia",
|
|
10
|
-
"version": "1.
|
|
10
|
+
"version": "1.7.0",
|
|
11
11
|
"description": "High-performance React Native Graphics using Skia",
|
|
12
12
|
"main": "lib/module/index.js",
|
|
13
13
|
"react-native": "src/index.ts",
|