@shopify/react-native-skia 1.0.6 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- package/android/CMakeLists.txt +1 -0
- package/android/build.gradle +1 -0
- package/android/cpp/rnskia-android/AHardwareBufferUtils.cpp +31 -0
- package/android/cpp/rnskia-android/AHardwareBufferUtils.h +13 -0
- package/android/cpp/rnskia-android/RNSkAndroidPlatformContext.h +75 -0
- package/android/cpp/rnskia-android/SkiaOpenGLSurfaceFactory.cpp +29 -11
- package/android/cpp/rnskia-android/SkiaOpenGLSurfaceFactory.h +1 -2
- package/android/src/main/java/com/shopify/reactnative/skia/ViewScreenshotService.java +3 -2
- package/cpp/api/JsiPlatformBuffer.h +51 -0
- package/cpp/api/JsiSkApi.h +4 -0
- package/cpp/api/JsiSkImage.h +1 -1
- package/cpp/api/JsiSkImageFactory.h +15 -2
- package/cpp/api/JsiSkSurface.h +9 -1
- package/cpp/rnskia/RNSkJsiViewApi.h +48 -0
- package/cpp/rnskia/RNSkPlatformContext.h +13 -0
- package/ios/RNSkia-iOS/RNSkiOSPlatformContext.h +6 -0
- package/ios/RNSkia-iOS/RNSkiOSPlatformContext.mm +115 -0
- package/ios/RNSkia-iOS/SkiaMetalSurfaceFactory.h +4 -0
- package/ios/RNSkia-iOS/SkiaMetalSurfaceFactory.mm +12 -0
- package/lib/commonjs/external/reanimated/textures.js +11 -2
- package/lib/commonjs/external/reanimated/textures.js.map +1 -1
- package/lib/commonjs/external/reanimated/useAnimatedImageValue.d.ts +2 -1
- package/lib/commonjs/external/reanimated/useAnimatedImageValue.js +8 -4
- package/lib/commonjs/external/reanimated/useAnimatedImageValue.js.map +1 -1
- package/lib/commonjs/mock/index.js +1 -0
- package/lib/commonjs/mock/index.js.map +1 -1
- package/lib/commonjs/renderer/Offscreen.d.ts +2 -2
- package/lib/commonjs/renderer/Offscreen.js +2 -2
- package/lib/commonjs/renderer/Offscreen.js.map +1 -1
- package/lib/commonjs/skia/types/Image/ImageFactory.d.ts +14 -0
- package/lib/commonjs/skia/types/Image/ImageFactory.js.map +1 -1
- package/lib/commonjs/skia/types/PlatformBuffer/PlatformBufferFactory.d.ts +12 -0
- package/lib/commonjs/skia/types/PlatformBuffer/PlatformBufferFactory.js +6 -0
- package/lib/commonjs/skia/types/PlatformBuffer/PlatformBufferFactory.js.map +1 -0
- package/lib/commonjs/skia/types/PlatformBuffer/index.d.ts +1 -0
- package/lib/commonjs/skia/types/PlatformBuffer/index.js +17 -0
- package/lib/commonjs/skia/types/PlatformBuffer/index.js.map +1 -0
- package/lib/commonjs/skia/types/Skia.d.ts +2 -0
- package/lib/commonjs/skia/types/Skia.js.map +1 -1
- package/lib/commonjs/skia/types/Surface/Surface.d.ts +8 -0
- package/lib/commonjs/skia/types/Surface/Surface.js.map +1 -1
- package/lib/commonjs/skia/types/index.d.ts +1 -0
- package/lib/commonjs/skia/types/index.js +11 -0
- package/lib/commonjs/skia/types/index.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkImage.d.ts +1 -2
- package/lib/commonjs/skia/web/JsiSkImage.js +5 -12
- package/lib/commonjs/skia/web/JsiSkImage.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkImageFactory.d.ts +2 -2
- package/lib/commonjs/skia/web/JsiSkImageFactory.js +3 -0
- package/lib/commonjs/skia/web/JsiSkImageFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPlatformBufferFactory.d.ts +8 -0
- package/lib/commonjs/skia/web/JsiSkPlatformBufferFactory.js +20 -0
- package/lib/commonjs/skia/web/JsiSkPlatformBufferFactory.js.map +1 -0
- package/lib/commonjs/skia/web/JsiSkSurface.d.ts +3 -2
- package/lib/commonjs/skia/web/JsiSkSurface.js +8 -6
- package/lib/commonjs/skia/web/JsiSkSurface.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkSurfaceFactory.d.ts +1 -1
- package/lib/commonjs/skia/web/JsiSkSurfaceFactory.js +2 -17
- package/lib/commonjs/skia/web/JsiSkSurfaceFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkia.js +3 -1
- package/lib/commonjs/skia/web/JsiSkia.js.map +1 -1
- package/lib/commonjs/views/SkiaDomView.d.ts +6 -0
- package/lib/commonjs/views/SkiaDomView.js +10 -0
- package/lib/commonjs/views/SkiaDomView.js.map +1 -1
- package/lib/commonjs/views/types.d.ts +1 -0
- package/lib/commonjs/views/types.js.map +1 -1
- package/lib/module/external/reanimated/textures.js +11 -2
- package/lib/module/external/reanimated/textures.js.map +1 -1
- package/lib/module/external/reanimated/useAnimatedImageValue.d.ts +2 -1
- package/lib/module/external/reanimated/useAnimatedImageValue.js +8 -4
- package/lib/module/external/reanimated/useAnimatedImageValue.js.map +1 -1
- package/lib/module/mock/index.js +1 -0
- package/lib/module/mock/index.js.map +1 -1
- package/lib/module/renderer/Offscreen.d.ts +2 -2
- package/lib/module/renderer/Offscreen.js +2 -2
- package/lib/module/renderer/Offscreen.js.map +1 -1
- package/lib/module/skia/types/Image/ImageFactory.d.ts +14 -0
- package/lib/module/skia/types/Image/ImageFactory.js.map +1 -1
- package/lib/module/skia/types/PlatformBuffer/PlatformBufferFactory.d.ts +12 -0
- package/lib/module/skia/types/PlatformBuffer/PlatformBufferFactory.js +2 -0
- package/lib/module/skia/types/PlatformBuffer/PlatformBufferFactory.js.map +1 -0
- package/lib/module/skia/types/PlatformBuffer/index.d.ts +1 -0
- package/lib/module/skia/types/PlatformBuffer/index.js +2 -0
- package/lib/module/skia/types/PlatformBuffer/index.js.map +1 -0
- package/lib/module/skia/types/Skia.d.ts +2 -0
- package/lib/module/skia/types/Skia.js.map +1 -1
- package/lib/module/skia/types/Surface/Surface.d.ts +8 -0
- package/lib/module/skia/types/Surface/Surface.js.map +1 -1
- package/lib/module/skia/types/index.d.ts +1 -0
- package/lib/module/skia/types/index.js +1 -0
- package/lib/module/skia/types/index.js.map +1 -1
- package/lib/module/skia/web/JsiSkImage.d.ts +1 -2
- package/lib/module/skia/web/JsiSkImage.js +5 -12
- package/lib/module/skia/web/JsiSkImage.js.map +1 -1
- package/lib/module/skia/web/JsiSkImageFactory.d.ts +2 -2
- package/lib/module/skia/web/JsiSkImageFactory.js +3 -0
- package/lib/module/skia/web/JsiSkImageFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkPlatformBufferFactory.d.ts +8 -0
- package/lib/module/skia/web/JsiSkPlatformBufferFactory.js +13 -0
- package/lib/module/skia/web/JsiSkPlatformBufferFactory.js.map +1 -0
- package/lib/module/skia/web/JsiSkSurface.d.ts +3 -2
- package/lib/module/skia/web/JsiSkSurface.js +8 -6
- package/lib/module/skia/web/JsiSkSurface.js.map +1 -1
- package/lib/module/skia/web/JsiSkSurfaceFactory.d.ts +1 -1
- package/lib/module/skia/web/JsiSkSurfaceFactory.js +2 -17
- package/lib/module/skia/web/JsiSkSurfaceFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkia.js +3 -1
- package/lib/module/skia/web/JsiSkia.js.map +1 -1
- package/lib/module/views/SkiaDomView.d.ts +6 -0
- package/lib/module/views/SkiaDomView.js +10 -0
- package/lib/module/views/SkiaDomView.js.map +1 -1
- package/lib/module/views/types.d.ts +1 -0
- package/lib/module/views/types.js.map +1 -1
- package/lib/typescript/src/external/reanimated/useAnimatedImageValue.d.ts +2 -1
- package/lib/typescript/src/renderer/Offscreen.d.ts +2 -2
- package/lib/typescript/src/skia/types/Image/ImageFactory.d.ts +14 -0
- package/lib/typescript/src/skia/types/PlatformBuffer/PlatformBufferFactory.d.ts +12 -0
- package/lib/typescript/src/skia/types/PlatformBuffer/index.d.ts +1 -0
- package/lib/typescript/src/skia/types/Skia.d.ts +2 -0
- package/lib/typescript/src/skia/types/Surface/Surface.d.ts +8 -0
- package/lib/typescript/src/skia/types/index.d.ts +1 -0
- package/lib/typescript/src/skia/web/JsiSkImage.d.ts +1 -2
- package/lib/typescript/src/skia/web/JsiSkImageFactory.d.ts +2 -2
- package/lib/typescript/src/skia/web/JsiSkPlatformBufferFactory.d.ts +8 -0
- package/lib/typescript/src/skia/web/JsiSkSurface.d.ts +3 -2
- package/lib/typescript/src/skia/web/JsiSkSurfaceFactory.d.ts +1 -1
- package/lib/typescript/src/views/SkiaDomView.d.ts +6 -0
- package/lib/typescript/src/views/types.d.ts +1 -0
- package/package.json +1 -1
- package/src/external/reanimated/textures.tsx +8 -2
- package/src/external/reanimated/useAnimatedImageValue.ts +12 -6
- package/src/mock/index.ts +1 -0
- package/src/renderer/Offscreen.tsx +3 -3
- package/src/skia/types/Image/ImageFactory.ts +15 -0
- package/src/skia/types/PlatformBuffer/PlatformBufferFactory.ts +14 -0
- package/src/skia/types/PlatformBuffer/index.ts +1 -0
- package/src/skia/types/Skia.ts +2 -1
- package/src/skia/types/Surface/Surface.ts +10 -0
- package/src/skia/types/index.ts +1 -0
- package/src/skia/web/JsiSkImage.ts +5 -22
- package/src/skia/web/JsiSkImageFactory.ts +13 -2
- package/src/skia/web/JsiSkPlatformBufferFactory.ts +22 -0
- package/src/skia/web/JsiSkSurface.ts +10 -9
- package/src/skia/web/JsiSkSurfaceFactory.ts +4 -20
- package/src/skia/web/JsiSkia.ts +2 -0
- package/src/views/SkiaDomView.tsx +10 -0
- package/src/views/types.ts +1 -0
- package/cpp/skia/include/third_party/vulkan/LICENSE +0 -29
- package/cpp/skia/modules/skcms/README.chromium +0 -6
- package/cpp/skia/readme.txt +0 -1
@@ -14,9 +14,18 @@ const createTexture = (texture, picture, size) => {
|
|
14
14
|
texture.value = (0, _Offscreen.drawAsImageFromPicture)(picture, size);
|
15
15
|
};
|
16
16
|
const useTexture = (element, size) => {
|
17
|
+
const {
|
18
|
+
width,
|
19
|
+
height
|
20
|
+
} = size;
|
17
21
|
const picture = (0, _react.useMemo)(() => {
|
18
|
-
return (0, _Offscreen.drawAsPicture)(element
|
19
|
-
|
22
|
+
return (0, _Offscreen.drawAsPicture)(element, {
|
23
|
+
x: 0,
|
24
|
+
y: 0,
|
25
|
+
width,
|
26
|
+
height
|
27
|
+
});
|
28
|
+
}, [element, width, height]);
|
20
29
|
return usePictureAsTexture(picture, size);
|
21
30
|
};
|
22
31
|
exports.useTexture = useTexture;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_react","require","_Offscreen","_skia","_moduleWrapper","createTexture","texture","picture","size","value","drawAsImageFromPicture","useTexture","element","useMemo","drawAsPicture","usePictureAsTexture","exports","useTextureAsValue","console","warn","useTextureValueFromPicture","useSharedValue","useEffect","runOnUI","useImageAsTexture","source","image","useImage","
|
1
|
+
{"version":3,"names":["_react","require","_Offscreen","_skia","_moduleWrapper","createTexture","texture","picture","size","value","drawAsImageFromPicture","useTexture","element","width","height","useMemo","drawAsPicture","x","y","usePictureAsTexture","exports","useTextureAsValue","console","warn","useTextureValueFromPicture","useSharedValue","useEffect","runOnUI","useImageAsTexture","source","image","useImage","recorder","Skia","PictureRecorder","canvas","beginRecording","drawImage","finishRecordingAsPicture"],"sources":["textures.tsx"],"sourcesContent":["import { useEffect, useMemo } from \"react\";\nimport type { ReactElement } from \"react\";\nimport type { SharedValue } from \"react-native-reanimated\";\n\nimport type {\n DataSourceParam,\n SkImage,\n SkPicture,\n SkSize,\n} from \"../../skia/types\";\nimport {\n drawAsImageFromPicture,\n drawAsPicture,\n} from \"../../renderer/Offscreen\";\nimport { Skia, useImage } from \"../../skia\";\n\nimport { runOnUI, useSharedValue } from \"./moduleWrapper\";\n\nconst createTexture = (\n texture: SharedValue<SkImage | null>,\n picture: SkPicture,\n size: SkSize\n) => {\n \"worklet\";\n texture.value = drawAsImageFromPicture(picture, size);\n};\n\nexport const useTexture = (element: ReactElement, size: SkSize) => {\n const { width, height } = size;\n const picture = useMemo(() => {\n return drawAsPicture(element, {\n x: 0,\n y: 0,\n width,\n height,\n });\n }, [element, width, height]);\n return usePictureAsTexture(picture, size);\n};\n\nexport const useTextureAsValue = (element: ReactElement, size: SkSize) => {\n console.warn(\"useTextureAsValue has been renamed to use useTexture\");\n return useTexture(element, size);\n};\n\nexport const useTextureValueFromPicture = (\n picture: SkPicture | null,\n size: SkSize\n) => {\n console.warn(\n \"useTextureValueFromPicture has been renamed to use usePictureAsTexture\"\n );\n return usePictureAsTexture(picture, size);\n};\n\nexport const usePictureAsTexture = (\n picture: SkPicture | null,\n size: SkSize\n) => {\n const texture = useSharedValue<SkImage | null>(null);\n useEffect(() => {\n if (picture !== null) {\n runOnUI(createTexture)(texture, picture, size);\n }\n }, [texture, picture, size]);\n return texture;\n};\n\nexport const useImageAsTexture = (source: DataSourceParam) => {\n const image = useImage(source);\n const size = useMemo(() => {\n if (image) {\n return { width: image.width(), height: image.height() };\n }\n return { width: 0, height: 0 };\n }, [image]);\n const picture = useMemo(() => {\n if (image) {\n const recorder = Skia.PictureRecorder();\n const canvas = recorder.beginRecording({\n x: 0,\n y: 0,\n width: size.width,\n height: size.height,\n });\n canvas.drawImage(image, 0, 0);\n return recorder.finishRecordingAsPicture();\n } else {\n return null;\n }\n }, [size, image]);\n return usePictureAsTexture(picture, size);\n};\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAUA,IAAAC,UAAA,GAAAD,OAAA;AAIA,IAAAE,KAAA,GAAAF,OAAA;AAEA,IAAAG,cAAA,GAAAH,OAAA;AAEA,MAAMI,aAAa,GAAGA,CACpBC,OAAoC,EACpCC,OAAkB,EAClBC,IAAY,KACT;EACH,SAAS;;EACTF,OAAO,CAACG,KAAK,GAAG,IAAAC,iCAAsB,EAACH,OAAO,EAAEC,IAAI,CAAC;AACvD,CAAC;AAEM,MAAMG,UAAU,GAAGA,CAACC,OAAqB,EAAEJ,IAAY,KAAK;EACjE,MAAM;IAAEK,KAAK;IAAEC;EAAO,CAAC,GAAGN,IAAI;EAC9B,MAAMD,OAAO,GAAG,IAAAQ,cAAO,EAAC,MAAM;IAC5B,OAAO,IAAAC,wBAAa,EAACJ,OAAO,EAAE;MAC5BK,CAAC,EAAE,CAAC;MACJC,CAAC,EAAE,CAAC;MACJL,KAAK;MACLC;IACF,CAAC,CAAC;EACJ,CAAC,EAAE,CAACF,OAAO,EAAEC,KAA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,MAAM,EAAEgB,KAAK,CAAChB,MAAM,CAAC;MAAE,CAAC;IACzD;IACA,OAAO;MAAED,KAAK,EAAE,CAAC;MAAEC,MAAM,EAAE;IAAE,CAAC;EAChC,CAAC,EAAE,CAACgB,KAAK,CAAC,CAAC;EACX,MAAMvB,OAAO,GAAG,IAAAQ,cAAO,EAAC,MAAM;IAC5B,IAAIe,KAAK,EAAE;MACT,MAAME,QAAQ,GAAGC,UAAI,CAACC,eAAe,CAAC,CAAC;MACvC,MAAMC,MAAM,GAAGH,QAAQ,CAACI,cAAc,CAAC;QACrCnB,CAAC,EAAE,CAAC;QACJC,CAAC,EAAE,CAAC;QACJL,KAAK,EAAEL,IAAI,CAACK,KAAK;QACjBC,MAAM,EAAEN,IAAI,CAACM;MACf,CAAC,CAAC;MACFqB,MAAM,CAACE,SAAS,CAACP,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC;MAC7B,OAAOE,QAAQ,CAACM,wBAAwB,CAAC,CAAC;IAC5C,CAAC,MAAM;MACL,OAAO,IAAI;IACb;EACF,CAAC,EAAE,CAAC9B,IAAI,EAAEsB,KAAK,CAAC,CAAC;EACjB,OAAOX,mBAAmB,CAACZ,OAAO,EAAEC,IAAI,CAAC;AAC3C,CAAC;AAACY,OAAA,CAAAQ,iBAAA,GAAAA,iBAAA"}
|
@@ -1,2 +1,3 @@
|
|
1
|
+
import { type SharedValue } from "react-native-reanimated";
|
1
2
|
import type { DataSourceParam, SkImage } from "../../skia/types";
|
2
|
-
export declare const useAnimatedImageValue: (source: DataSourceParam) =>
|
3
|
+
export declare const useAnimatedImageValue: (source: DataSourceParam, paused?: SharedValue<boolean>) => SharedValue<SkImage | null>;
|
@@ -8,10 +8,12 @@ var _react = require("react");
|
|
8
8
|
var _AnimatedImage = require("../../skia/core/AnimatedImage");
|
9
9
|
var _moduleWrapper = require("./moduleWrapper");
|
10
10
|
const DEFAULT_FRAME_DURATION = 60;
|
11
|
-
const useAnimatedImageValue = source => {
|
11
|
+
const useAnimatedImageValue = (source, paused) => {
|
12
12
|
(0, _moduleWrapper.throwOnMissingReanimated)();
|
13
|
+
const defaultPaused = (0, _moduleWrapper.useSharedValue)(false);
|
14
|
+
const isPaused = paused !== null && paused !== void 0 ? paused : defaultPaused;
|
13
15
|
const currentFrame = (0, _moduleWrapper.useSharedValue)(null);
|
14
|
-
const lastTimestamp = (0, _moduleWrapper.useSharedValue)(
|
16
|
+
const lastTimestamp = (0, _moduleWrapper.useSharedValue)(-1);
|
15
17
|
const animatedImage = (0, _AnimatedImage.useAnimatedImage)(source, err => {
|
16
18
|
console.error(err);
|
17
19
|
throw new Error(`Could not load animated image - got '${err.message}'`);
|
@@ -22,6 +24,9 @@ const useAnimatedImageValue = source => {
|
|
22
24
|
currentFrame.value = null;
|
23
25
|
return;
|
24
26
|
}
|
27
|
+
if (isPaused.value && lastTimestamp.value !== -1) {
|
28
|
+
return;
|
29
|
+
}
|
25
30
|
const {
|
26
31
|
timestamp
|
27
32
|
} = frameInfo;
|
@@ -41,8 +46,7 @@ const useAnimatedImageValue = source => {
|
|
41
46
|
|
42
47
|
// Update the last timestamp
|
43
48
|
lastTimestamp.value = timestamp;
|
44
|
-
|
45
|
-
}, true);
|
49
|
+
});
|
46
50
|
(0, _react.useEffect)(() => {
|
47
51
|
return () => {
|
48
52
|
animatedImage === null || animatedImage === void 0 || animatedImage.dispose();
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_react","require","_AnimatedImage","_moduleWrapper","DEFAULT_FRAME_DURATION","useAnimatedImageValue","source","throwOnMissingReanimated","
|
1
|
+
{"version":3,"names":["_react","require","_AnimatedImage","_moduleWrapper","DEFAULT_FRAME_DURATION","useAnimatedImageValue","source","paused","throwOnMissingReanimated","defaultPaused","useSharedValue","isPaused","currentFrame","lastTimestamp","animatedImage","useAnimatedImage","err","console","error","Error","message","frameDuration","currentFrameDuration","useFrameCallback","frameInfo","value","timestamp","elapsed","decodeNextFrame","dispose","getCurrentFrame","useEffect","exports"],"sources":["useAnimatedImageValue.ts"],"sourcesContent":["import { useEffect } from \"react\";\nimport { type FrameInfo, type SharedValue } from \"react-native-reanimated\";\n\nimport { useAnimatedImage } from \"../../skia/core/AnimatedImage\";\nimport type { DataSourceParam, SkImage } from \"../../skia/types\";\n\nimport {\n throwOnMissingReanimated,\n useFrameCallback,\n useSharedValue,\n} from \"./moduleWrapper\";\n\nconst DEFAULT_FRAME_DURATION = 60;\n\nexport const useAnimatedImageValue = (\n source: DataSourceParam,\n paused?: SharedValue<boolean>\n) => {\n throwOnMissingReanimated();\n const defaultPaused = useSharedValue(false);\n const isPaused = paused ?? defaultPaused;\n const currentFrame = useSharedValue<null | SkImage>(null);\n const lastTimestamp = useSharedValue(-1);\n const animatedImage = useAnimatedImage(\n source,\n (err) => {\n console.error(err);\n throw new Error(`Could not load animated image - got '${err.message}'`);\n },\n false\n );\n const frameDuration =\n animatedImage?.currentFrameDuration() || DEFAULT_FRAME_DURATION;\n\n useFrameCallback((frameInfo: FrameInfo) => {\n if (!animatedImage) {\n currentFrame.value = null;\n return;\n }\n if (isPaused.value && lastTimestamp.value !== -1) {\n return;\n }\n const { timestamp } = frameInfo;\n const elapsed = timestamp - lastTimestamp.value;\n\n // Check if it's time to switch frames based on GIF frame duration\n if (elapsed < frameDuration) {\n return;\n }\n\n // Update the current frame\n animatedImage.decodeNextFrame();\n if (currentFrame.value) {\n currentFrame.value.dispose();\n }\n currentFrame.value = animatedImage.getCurrentFrame();\n\n // Update the last timestamp\n lastTimestamp.value = timestamp;\n });\n useEffect(() => {\n return () => {\n animatedImage?.dispose();\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n return currentFrame;\n};\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAGA,IAAAC,cAAA,GAAAD,OAAA;AAGA,IAAAE,cAAA,GAAAF,OAAA;AAMA,MAAMG,sBAAsB,GAAG,EAAE;AAE1B,MAAMC,qBAAqB,GAAGA,CACnCC,MAAuB,EACv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ACY,KAAK,GAAGC,SAAS;EACjC,CAAC,CAAC;EACF,IAAAK,gBAAS,EAAC,MAAM;IACd,OAAO,MAAM;MACXjB,aAAa,aAAbA,aAAa,eAAbA,aAAa,CAAEe,OAAO,CAAC,CAAC;IAC1B,CAAC;IACD;EACF,CAAC,EAAE,EAAE,CAAC;EACN,OAAOjB,YAAY;AACrB,CAAC;AAACoB,OAAA,CAAA3B,qBAAA,GAAAA,qBAAA"}
|
@@ -37,6 +37,7 @@ const Mock = CanvasKit => {
|
|
37
37
|
// Reanimated hooks
|
38
38
|
useClock: NoopSharedValue,
|
39
39
|
usePathInterpolation: NoopSharedValue,
|
40
|
+
useImageAsTexture: NoopSharedValue,
|
40
41
|
useTextureValue: NoopSharedValue,
|
41
42
|
useTextureValueFromPicture: NoopSharedValue,
|
42
43
|
useRSXformBuffer: NoopSharedValue,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_web","require","Noop","undefined","NoopValue","current","NoopSharedValue","value","Mock","CanvasKit","global","SkiaApi","JsiSkApi","Skia","Canvas","useValue","useComputedValue","useTouchHandler","useTiming","useLoop","useSpring","useClockValue","useValueEffect","useClock","usePathInterpolation","useTextureValue","useTextureValueFromPicture","useRSXformBuffer","usePointBuffer","useColorBuffer","useRectBuffer","useBuffer","useRawData","useData","useFont","Font","useFonts","useTypeface","useImage","useSVG","exports"],"sources":["index.ts"],"sourcesContent":["import type { CanvasKit } from \"canvaskit-wasm\";\n\nimport { JsiSkApi } from \"../skia/web\";\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst Noop: () => any = () => undefined;\nconst NoopValue = () => ({ current: 0 });\nconst NoopSharedValue = () => ({ value: 0 });\n\nexport const Mock = (CanvasKit: CanvasKit) => {\n global.SkiaApi = JsiSkApi(CanvasKit);\n const Skia = global.SkiaApi;\n return {\n Skia,\n ...require(\"../renderer/components\"),\n ...require(\"../skia\"),\n ...require(\"../animation\"),\n ...require(\"../dom/types\"),\n ...require(\"../dom/nodes\"),\n // We could use the real Canvas if we mock the SkiaView component for node\n Canvas: Noop,\n // Skia Animations\n useValue: NoopValue,\n useComputedValue: NoopValue,\n useTouchHandler: Noop,\n useTiming: NoopValue,\n useLoop: NoopValue,\n useSpring: NoopValue,\n useClockValue: NoopValue,\n useValueEffect: Noop,\n // Reanimated hooks\n useClock: NoopSharedValue,\n usePathInterpolation: NoopSharedValue,\n useTextureValue: NoopSharedValue,\n useTextureValueFromPicture: NoopSharedValue,\n useRSXformBuffer: NoopSharedValue,\n usePointBuffer: NoopSharedValue,\n useColorBuffer: NoopSharedValue,\n useRectBuffer: NoopSharedValue,\n useBuffer: NoopSharedValue,\n useRawData: Noop,\n useData: Noop,\n useFont: () => Skia.Font(undefined, 0),\n useFonts: Noop,\n useTypeface: () => null,\n useImage: () => null,\n useSVG: () => null,\n };\n};\n"],"mappings":";;;;;;AAEA,IAAAA,IAAA,GAAAC,OAAA;AAEA;AACA,MAAMC,IAAe,GAAGA,CAAA,KAAMC,SAAS;AACvC,MAAMC,SAAS,GAAGA,CAAA,MAAO;EAAEC,OAAO,EAAE;AAAE,CAAC,CAAC;AACxC,MAAMC,eAAe,GAAGA,CAAA,MAAO;EAAEC,KAAK,EAAE;AAAE,CAAC,CAAC;AAErC,MAAMC,IAAI,GAAIC,SAAoB,IAAK;EAC5CC,MAAM,CAACC,OAAO,GAAG,IAAAC,aAAQ,EAACH,SAAS,CAAC;EACpC,MAAMI,IAAI,GAAGH,MAAM,CAACC,OAAO;EAC3B,OAAO;IACLE,IAAI;IACJ,GAAGZ,OAAO,CAAC,wBAAwB,CAAC;IACpC,GAAGA,OAAO,CAAC,SAAS,CAAC;IACrB,GAAGA,OAAO,CAAC,cAAc,CAAC;IAC1B,GAAGA,OAAO,CAAC,cAAc,CAAC;IAC1B,GAAGA,OAAO,CAAC,cAAc,CAAC;IAC1B;IACAa,MAAM,EAAEZ,IAAI;IACZ;IACAa,QAAQ,EAAEX,SAAS;IACnBY,gBAAgB,EAAEZ,SAAS;IAC3Ba,eAAe,EAAEf,IAAI;IACrBgB,SAAS,EAAEd,SAAS;IACpBe,OAAO,EAAEf,SAAS;IAClBgB,SAAS,EAAEhB,SAAS;IACpBiB,aAAa,EAAEjB,SAAS;IACxBkB,cAAc,EAAEpB,IAAI;IACpB;IACAqB,QAAQ,EAAEjB,eAAe;IACzBkB,oBAAoB,EAAElB,eAAe;IACrCmB,
|
1
|
+
{"version":3,"names":["_web","require","Noop","undefined","NoopValue","current","NoopSharedValue","value","Mock","CanvasKit","global","SkiaApi","JsiSkApi","Skia","Canvas","useValue","useComputedValue","useTouchHandler","useTiming","useLoop","useSpring","useClockValue","useValueEffect","useClock","usePathInterpolation","useImageAsTexture","useTextureValue","useTextureValueFromPicture","useRSXformBuffer","usePointBuffer","useColorBuffer","useRectBuffer","useBuffer","useRawData","useData","useFont","Font","useFonts","useTypeface","useImage","useSVG","exports"],"sources":["index.ts"],"sourcesContent":["import type { CanvasKit } from \"canvaskit-wasm\";\n\nimport { JsiSkApi } from \"../skia/web\";\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst Noop: () => any = () => undefined;\nconst NoopValue = () => ({ current: 0 });\nconst NoopSharedValue = () => ({ value: 0 });\n\nexport const Mock = (CanvasKit: CanvasKit) => {\n global.SkiaApi = JsiSkApi(CanvasKit);\n const Skia = global.SkiaApi;\n return {\n Skia,\n ...require(\"../renderer/components\"),\n ...require(\"../skia\"),\n ...require(\"../animation\"),\n ...require(\"../dom/types\"),\n ...require(\"../dom/nodes\"),\n // We could use the real Canvas if we mock the SkiaView component for node\n Canvas: Noop,\n // Skia Animations\n useValue: NoopValue,\n useComputedValue: NoopValue,\n useTouchHandler: Noop,\n useTiming: NoopValue,\n useLoop: NoopValue,\n useSpring: NoopValue,\n useClockValue: NoopValue,\n useValueEffect: Noop,\n // Reanimated hooks\n useClock: NoopSharedValue,\n usePathInterpolation: NoopSharedValue,\n useImageAsTexture: NoopSharedValue,\n useTextureValue: NoopSharedValue,\n useTextureValueFromPicture: NoopSharedValue,\n useRSXformBuffer: NoopSharedValue,\n usePointBuffer: NoopSharedValue,\n useColorBuffer: NoopSharedValue,\n useRectBuffer: NoopSharedValue,\n useBuffer: NoopSharedValue,\n useRawData: Noop,\n useData: Noop,\n useFont: () => Skia.Font(undefined, 0),\n useFonts: Noop,\n useTypeface: () => null,\n useImage: () => null,\n useSVG: () => null,\n };\n};\n"],"mappings":";;;;;;AAEA,IAAAA,IAAA,GAAAC,OAAA;AAEA;AACA,MAAMC,IAAe,GAAGA,CAAA,KAAMC,SAAS;AACvC,MAAMC,SAAS,GAAGA,CAAA,MAAO;EAAEC,OAAO,EAAE;AAAE,CAAC,CAAC;AACxC,MAAMC,eAAe,GAAGA,CAAA,MAAO;EAAEC,KAAK,EAAE;AAAE,CAAC,CAAC;AAErC,MAAMC,IAAI,GAAIC,SAAoB,IAAK;EAC5CC,MAAM,CAACC,OAAO,GAAG,IAAAC,aAAQ,EAACH,SAAS,CAAC;EACpC,MAAMI,IAAI,GAAGH,MAAM,CAACC,OAAO;EAC3B,OAAO;IACLE,IAAI;IACJ,GAAGZ,OAAO,CAAC,wBAAwB,CAAC;IACpC,GAAGA,OAAO,CAAC,SAAS,CAAC;IACrB,GAAGA,OAAO,CAAC,cAAc,CAAC;IAC1B,GAAGA,OAAO,CAAC,cAAc,CAAC;IAC1B,GAAGA,OAAO,CAAC,cAAc,CAAC;IAC1B;IACAa,MAAM,EAAEZ,IAAI;IACZ;IACAa,QAAQ,EAAEX,SAAS;IACnBY,gBAAgB,EAAEZ,SAAS;IAC3Ba,eAAe,EAAEf,IAAI;IACrBgB,SAAS,EAAEd,SAAS;IACpBe,OAAO,EAAEf,SAAS;IAClBgB,SAAS,EAAEhB,SAAS;IACpBiB,aAAa,EAAEjB,SAAS;IACxBkB,cAAc,EAAEpB,IAAI;IACpB;IACAqB,QAAQ,EAAEjB,eAAe;IACzBkB,oBAAoB,EAAElB,eAAe;IACrCmB,iBAAiB,EAAEnB,eAAe;IAClCoB,eAAe,EAAEpB,eAAe;IAChCqB,0BAA0B,EAAErB,eAAe;IAC3CsB,gBAAgB,EAAEtB,eAAe;IACjCuB,cAAc,EAAEvB,eAAe;IAC/BwB,cAAc,EAAExB,eAAe;IAC/ByB,aAAa,EAAEzB,eAAe;IAC9B0B,SAAS,EAAE1B,eAAe;IAC1B2B,UAAU,EAAE/B,IAAI;IAChBgC,OAAO,EAAEhC,IAAI;IACbiC,OAAO,EAAEA,CAAA,KAAMtB,IAAI,CAACuB,IAAI,CAACjC,SAAS,EAAE,CAAC,CAAC;IACtCkC,QAAQ,EAAEnC,IAAI;IACdoC,WAAW,EAAEA,CAAA,KAAM,IAAI;IACvBC,QAAQ,EAAEA,CAAA,KAAM,IAAI;IACpBC,MAAM,EAAEA,CAAA,KAAM;EAChB,CAAC;AACH,CAAC;AAACC,OAAA,CAAAjC,IAAA,GAAAA,IAAA"}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import type { ReactElement } from "react";
|
2
|
-
import type { SkPicture, SkSize } from "../skia/types";
|
2
|
+
import type { SkPicture, SkRect, SkSize } from "../skia/types";
|
3
3
|
export declare const isOnMainThread: () => boolean;
|
4
|
-
export declare const drawAsPicture: (element: ReactElement) => SkPicture;
|
4
|
+
export declare const drawAsPicture: (element: ReactElement, bounds?: SkRect) => SkPicture;
|
5
5
|
export declare const drawAsImage: (element: ReactElement, size: SkSize) => import("../skia").SkImage;
|
6
6
|
export declare const drawAsImageFromPicture: (picture: SkPicture, size: SkSize) => import("../skia").SkImage;
|
@@ -15,9 +15,9 @@ const isOnMainThread = () => {
|
|
15
15
|
return typeof _WORKLET !== "undefined" && _WORKLET === true || _Platform.Platform.OS === "web";
|
16
16
|
};
|
17
17
|
exports.isOnMainThread = isOnMainThread;
|
18
|
-
const drawAsPicture = element => {
|
18
|
+
const drawAsPicture = (element, bounds) => {
|
19
19
|
const recorder = _skia.Skia.PictureRecorder();
|
20
|
-
const canvas = recorder.beginRecording();
|
20
|
+
const canvas = recorder.beginRecording(bounds);
|
21
21
|
const root = new _Reconciler.SkiaRoot(_skia.Skia, false);
|
22
22
|
root.render(element);
|
23
23
|
const ctx = new _types.JsiDrawingContext(_skia.Skia, canvas);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_types","require","_skia","_Platform","_Reconciler","isOnMainThread","_WORKLET","Platform","OS","exports","drawAsPicture","element","recorder","Skia","PictureRecorder","canvas","beginRecording","root","SkiaRoot","render","ctx","JsiDrawingContext","dom","picture","finishRecordingAsPicture","unmount","drawAsImage","size","drawAsImageFromPicture","pd","surface","Surface","MakeOffscreen","width","height","getCanvas","scale","drawPicture","flush","image","makeImageSnapshot","makeNonTextureImage"],"sources":["Offscreen.tsx"],"sourcesContent":["import type { ReactElement } from \"react\";\n\nimport { JsiDrawingContext } from \"../dom/types\";\nimport type { SkPicture, SkSize } from \"../skia/types\";\nimport { Skia } from \"../skia\";\nimport { Platform } from \"../Platform\";\n\nimport { SkiaRoot } from \"./Reconciler\";\n\n// We call it main thread because on web main is JS thread\nexport const isOnMainThread = () => {\n \"worklet\";\n return (\n (typeof _WORKLET !== \"undefined\" && _WORKLET === true) ||\n Platform.OS === \"web\"\n );\n};\n\nexport const drawAsPicture = (element: ReactElement) => {\n const recorder = Skia.PictureRecorder();\n const canvas = recorder.beginRecording();\n const root = new SkiaRoot(Skia, false);\n root.render(element);\n const ctx = new JsiDrawingContext(Skia, canvas);\n root.dom.render(ctx);\n const picture = recorder.finishRecordingAsPicture();\n root.unmount();\n return picture;\n};\n\nexport const drawAsImage = (element: ReactElement, size: SkSize) => {\n return drawAsImageFromPicture(drawAsPicture(element), size);\n};\n\n// TODO: We're not sure yet why PixelRatio is not needed here.\nconst pd = 1;\nexport const drawAsImageFromPicture = (picture: SkPicture, size: SkSize) => {\n \"worklet\";\n const surface = Skia.Surface.MakeOffscreen(\n size.width * pd,\n size.height * pd\n )!;\n const canvas = surface.getCanvas();\n canvas.scale(pd, pd);\n canvas.drawPicture(picture);\n surface.flush();\n const image = surface.makeImageSnapshot();\n // If we are not on the main thread or if we are on Web, we need to make the image non-texture.\n if (!isOnMainThread() || Platform.OS === \"web\") {\n return image.makeNonTextureImage();\n } else {\n return image;\n }\n};\n"],"mappings":";;;;;;AAEA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AAEA,IAAAG,WAAA,GAAAH,OAAA;AAEA;AACO,MAAMI,cAAc,GAAGA,CAAA,KAAM;EAClC,SAAS;;EACT,OACG,OAAOC,QAAQ,KAAK,WAAW,IAAIA,QAAQ,KAAK,IAAI,IACrDC,kBAAQ,CAACC,EAAE,KAAK,KAAK;AAEzB,CAAC;AAACC,OAAA,CAAAJ,cAAA,GAAAA,cAAA;AAEK,MAAMK,aAAa,
|
1
|
+
{"version":3,"names":["_types","require","_skia","_Platform","_Reconciler","isOnMainThread","_WORKLET","Platform","OS","exports","drawAsPicture","element","bounds","recorder","Skia","PictureRecorder","canvas","beginRecording","root","SkiaRoot","render","ctx","JsiDrawingContext","dom","picture","finishRecordingAsPicture","unmount","drawAsImage","size","drawAsImageFromPicture","pd","surface","Surface","MakeOffscreen","width","height","getCanvas","scale","drawPicture","flush","image","makeImageSnapshot","makeNonTextureImage"],"sources":["Offscreen.tsx"],"sourcesContent":["import type { ReactElement } from \"react\";\n\nimport { JsiDrawingContext } from \"../dom/types\";\nimport type { SkPicture, SkRect, SkSize } from \"../skia/types\";\nimport { Skia } from \"../skia\";\nimport { Platform } from \"../Platform\";\n\nimport { SkiaRoot } from \"./Reconciler\";\n\n// We call it main thread because on web main is JS thread\nexport const isOnMainThread = () => {\n \"worklet\";\n return (\n (typeof _WORKLET !== \"undefined\" && _WORKLET === true) ||\n Platform.OS === \"web\"\n );\n};\n\nexport const drawAsPicture = (element: ReactElement, bounds?: SkRect) => {\n const recorder = Skia.PictureRecorder();\n const canvas = recorder.beginRecording(bounds);\n const root = new SkiaRoot(Skia, false);\n root.render(element);\n const ctx = new JsiDrawingContext(Skia, canvas);\n root.dom.render(ctx);\n const picture = recorder.finishRecordingAsPicture();\n root.unmount();\n return picture;\n};\n\nexport const drawAsImage = (element: ReactElement, size: SkSize) => {\n return drawAsImageFromPicture(drawAsPicture(element), size);\n};\n\n// TODO: We're not sure yet why PixelRatio is not needed here.\nconst pd = 1;\nexport const drawAsImageFromPicture = (picture: SkPicture, size: SkSize) => {\n \"worklet\";\n const surface = Skia.Surface.MakeOffscreen(\n size.width * pd,\n size.height * pd\n )!;\n const canvas = surface.getCanvas();\n canvas.scale(pd, pd);\n canvas.drawPicture(picture);\n surface.flush();\n const image = surface.makeImageSnapshot();\n // If we are not on the main thread or if we are on Web, we need to make the image non-texture.\n if (!isOnMainThread() || Platform.OS === \"web\") {\n return image.makeNonTextureImage();\n } else {\n return image;\n }\n};\n"],"mappings":";;;;;;AAEA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AAEA,IAAAG,WAAA,GAAAH,OAAA;AAEA;AACO,MAAMI,cAAc,GAAGA,CAAA,KAAM;EAClC,SAAS;;EACT,OACG,OAAOC,QAAQ,KAAK,WAAW,IAAIA,QAAQ,KAAK,IAAI,IACrDC,kBAAQ,CAACC,EAAE,KAAK,KAAK;AAEzB,CAAC;AAACC,OAAA,CAAAJ,cAAA,GAAAA,cAAA;AAEK,MAAMK,aAAa,GAAGA,CAACC,OAAqB,EAAEC,MAAe,KAAK;EACvE,MAAMC,QAAQ,GAAGC,UAAI,CAACC,eAAe,CAAC,CAAC;EACvC,MAAMC,MAAM,GAAGH,QAAQ,CAACI,cAAc,CAACL,MAAM,CAAC;EAC9C,MAAMM,IAAI,GAAG,IAAIC,oBAAQ,CAACL,UAAI,EAAE,KAAK,CAAC;EACtCI,IAAI,CAACE,MAAM,CAACT,OAAO,CAAC;EACpB,MAAMU,GAAG,GAAG,IAAIC,wBAAiB,CAACR,UAAI,EAAEE,MAAM,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|
*/
|
54
54
|
MakeImageFromEncoded: (encoded: SkData) => SkImage | null;
|
55
|
+
/**
|
56
|
+
* Return an Image backed by the given native platform buffer.
|
57
|
+
* The platform buffer must be a valid owning reference.
|
58
|
+
*
|
59
|
+
* This API is used by [react-native-vision-camera](https://github.com/mrousavy/react-native-vision-camera)
|
60
|
+
* to render a Skia Camera preview.
|
61
|
+
*
|
62
|
+
* - On Android; This is an `AHardwareBuffer*`
|
63
|
+
* - On iOS, this is a `CMSampleBufferRef`
|
64
|
+
* @param platformBuffer A strong `uintptr_t` pointer to the native platform buffer
|
65
|
+
* @throws Throws an error if the Image could not be created, for example when the given
|
66
|
+
* platform buffer is invalid.
|
67
|
+
*/
|
68
|
+
MakeImageFromPlatformBuffer: (platformBuffer: bigint) => SkImage;
|
55
69
|
/**
|
56
70
|
* Returns an image that will be a screenshot of the view represented by
|
57
71
|
* the view tag
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["AlphaType","exports","ColorType"],"sources":["ImageFactory.ts"],"sourcesContent":["import type { SkData } from \"../Data\";\n\nimport type { SkImage } from \"./Image\";\n\nexport enum AlphaType {\n Unknown,\n Opaque,\n Premul,\n Unpremul,\n}\n\nexport enum ColorType {\n Unknown, // uninitialized\n Alpha_8, // pixel with alpha in 8-bit byte\n RGB_565, // pixel with 5 bits red, 6 bits green, 5 bits blue, in 16-bit word\n ARGB_4444, // pixel with 4 bits for alpha, red, green, blue; in 16-bit word\n RGBA_8888, // pixel with 8 bits for red, green, blue, alpha; in 32-bit word\n RGB_888x, // pixel with 8 bits each for red, green, blue; in 32-bit word\n BGRA_8888, // pixel with 8 bits for blue, green, red, alpha; in 32-bit word\n RGBA_1010102, // 10 bits for red, green, blue; 2 bits for alpha; in 32-bit word\n BGRA_1010102, // 10 bits for blue, green, red; 2 bits for alpha; in 32-bit word\n RGB_101010x, // pixel with 10 bits each for red, green, blue; in 32-bit word\n BGR_101010x, // pixel with 10 bits each for blue, green, red; in 32-bit word\n BGR_101010x_XR, // pixel with 10 bits each for blue, green, red; in 32-bit word, extended range\n RGBA_10x6, // pixel with 10 used bits (most significant) followed by 6 unused\n Gray_8, // pixel with grayscale level in 8-bit byte\n RGBA_F16Norm, // pixel with half floats in [0,1] for red, green, blue, alpha; in 64-bit word\n RGBA_F16, // pixel with half floats for red, green, blue, alpha; in 64-bit word\n RGBA_F32, // pixel using C float for red, green, blue, alpha; in 128-bit word\n\n // The following 6 colortypes are just for reading from - not for rendering to\n R8G8_unorm, // pixel with a uint8_t for red and green\n\n A16_float, // pixel with a half float for alpha\n R16G16_float, // pixel with a half float for red and green\n\n A16_unorm, // pixel with a little endian uint16_t for alpha\n R16G16_unorm, // pixel with a little endian uint16_t for red and green\n R16G16B16A16_unorm, // pixel with a little endian uint16_t for red, green, blue, and alpha\n\n SRGBA_8888,\n R8_unorm,\n\n // The `kN32_SkColorType` is platform dependent in the original enum,\n // and TypeScript doesn't support conditional compilation natively.\n // You might need to handle it differently based on your use case.\n N32_SkColorType, // either BGRA_8888 or RGBA_8888 based on the platform\n}\n\nexport interface ImageInfo {\n alphaType: AlphaType;\n // TODO: add support for color space\n // colorSpace: ColorSpace;\n colorType: ColorType;\n height: number;\n width: number;\n}\n\nexport interface ImageFactory {\n /**\n * Return an Image backed by the encoded data, but attempt to defer decoding until the image\n * is actually used/drawn. This deferral allows the system to cache the result, either on the\n * CPU or on the GPU, depending on where the image is drawn.\n * This decoding uses the codecs that have been compiled into CanvasKit. If the bytes are\n * invalid (or an unrecognized codec), null will be returned. See Image.h for more details.\n * @param data - Data object with bytes of data\n * @returns If the encoded format is not supported, or subset is outside of the bounds of the decoded\n * image, nullptr is returned.\n */\n MakeImageFromEncoded: (encoded: SkData) => SkImage | null;\n\n /**\n * Returns an image that will be a screenshot of the view represented by\n * the view tag\n * @param viewTag - The tag of the view to make an image from.\n * @returns Returns a valid SkImage, if the view tag is invalid, nullptr is returned.\n */\n MakeImageFromViewTag: (viewTag: number) => Promise<SkImage | null>;\n\n /**\n * Returns an image with the given pixel data and format.\n * Note that we will always make a copy of the pixel data, because of inconsistencies in\n * behavior between GPU and CPU (i.e. the pixel data will be turned into a GPU texture and\n * not modifiable after creation).\n *\n * @param info\n * @param data - bytes representing the pixel data.\n * @param bytesPerRow\n */\n MakeImage(info: ImageInfo, data: SkData, bytesPerRow: number): SkImage | null;\n}\n"],"mappings":";;;;;;IAIYA,SAAS,GAAAC,OAAA,CAAAD,SAAA,0BAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAAA,OAATA,SAAS;AAAA;AAAA,IAOTE,SAAS,GAAAD,OAAA,CAAAC,SAAA,0BAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAAA,OAATA,SAAS;AAAA,OAmCF"}
|
1
|
+
{"version":3,"names":["AlphaType","exports","ColorType"],"sources":["ImageFactory.ts"],"sourcesContent":["import type { SkData } from \"../Data\";\n\nimport type { SkImage } from \"./Image\";\n\nexport enum AlphaType {\n Unknown,\n Opaque,\n Premul,\n Unpremul,\n}\n\nexport enum ColorType {\n Unknown, // uninitialized\n Alpha_8, // pixel with alpha in 8-bit byte\n RGB_565, // pixel with 5 bits red, 6 bits green, 5 bits blue, in 16-bit word\n ARGB_4444, // pixel with 4 bits for alpha, red, green, blue; in 16-bit word\n RGBA_8888, // pixel with 8 bits for red, green, blue, alpha; in 32-bit word\n RGB_888x, // pixel with 8 bits each for red, green, blue; in 32-bit word\n BGRA_8888, // pixel with 8 bits for blue, green, red, alpha; in 32-bit word\n RGBA_1010102, // 10 bits for red, green, blue; 2 bits for alpha; in 32-bit word\n BGRA_1010102, // 10 bits for blue, green, red; 2 bits for alpha; in 32-bit word\n RGB_101010x, // pixel with 10 bits each for red, green, blue; in 32-bit word\n BGR_101010x, // pixel with 10 bits each for blue, green, red; in 32-bit word\n BGR_101010x_XR, // pixel with 10 bits each for blue, green, red; in 32-bit word, extended range\n RGBA_10x6, // pixel with 10 used bits (most significant) followed by 6 unused\n Gray_8, // pixel with grayscale level in 8-bit byte\n RGBA_F16Norm, // pixel with half floats in [0,1] for red, green, blue, alpha; in 64-bit word\n RGBA_F16, // pixel with half floats for red, green, blue, alpha; in 64-bit word\n RGBA_F32, // pixel using C float for red, green, blue, alpha; in 128-bit word\n\n // The following 6 colortypes are just for reading from - not for rendering to\n R8G8_unorm, // pixel with a uint8_t for red and green\n\n A16_float, // pixel with a half float for alpha\n R16G16_float, // pixel with a half float for red and green\n\n A16_unorm, // pixel with a little endian uint16_t for alpha\n R16G16_unorm, // pixel with a little endian uint16_t for red and green\n R16G16B16A16_unorm, // pixel with a little endian uint16_t for red, green, blue, and alpha\n\n SRGBA_8888,\n R8_unorm,\n\n // The `kN32_SkColorType` is platform dependent in the original enum,\n // and TypeScript doesn't support conditional compilation natively.\n // You might need to handle it differently based on your use case.\n N32_SkColorType, // either BGRA_8888 or RGBA_8888 based on the platform\n}\n\nexport interface ImageInfo {\n alphaType: AlphaType;\n // TODO: add support for color space\n // colorSpace: ColorSpace;\n colorType: ColorType;\n height: number;\n width: number;\n}\n\nexport interface ImageFactory {\n /**\n * Return an Image backed by the encoded data, but attempt to defer decoding until the image\n * is actually used/drawn. This deferral allows the system to cache the result, either on the\n * CPU or on the GPU, depending on where the image is drawn.\n * This decoding uses the codecs that have been compiled into CanvasKit. If the bytes are\n * invalid (or an unrecognized codec), null will be returned. See Image.h for more details.\n * @param data - Data object with bytes of data\n * @returns If the encoded format is not supported, or subset is outside of the bounds of the decoded\n * image, nullptr is returned.\n */\n MakeImageFromEncoded: (encoded: SkData) => SkImage | null;\n\n /**\n * Return an Image backed by the given native platform buffer.\n * The platform buffer must be a valid owning reference.\n *\n * This API is used by [react-native-vision-camera](https://github.com/mrousavy/react-native-vision-camera)\n * to render a Skia Camera preview.\n *\n * - On Android; This is an `AHardwareBuffer*`\n * - On iOS, this is a `CMSampleBufferRef`\n * @param platformBuffer A strong `uintptr_t` pointer to the native platform buffer\n * @throws Throws an error if the Image could not be created, for example when the given\n * platform buffer is invalid.\n */\n MakeImageFromPlatformBuffer: (platformBuffer: bigint) => SkImage;\n\n /**\n * Returns an image that will be a screenshot of the view represented by\n * the view tag\n * @param viewTag - The tag of the view to make an image from.\n * @returns Returns a valid SkImage, if the view tag is invalid, nullptr is returned.\n */\n MakeImageFromViewTag: (viewTag: number) => Promise<SkImage | null>;\n\n /**\n * Returns an image with the given pixel data and format.\n * Note that we will always make a copy of the pixel data, because of inconsistencies in\n * behavior between GPU and CPU (i.e. the pixel data will be turned into a GPU texture and\n * not modifiable after creation).\n *\n * @param info\n * @param data - bytes representing the pixel data.\n * @param bytesPerRow\n */\n MakeImage(info: ImageInfo, data: SkData, bytesPerRow: number): SkImage | null;\n}\n"],"mappings":";;;;;;IAIYA,SAAS,GAAAC,OAAA,CAAAD,SAAA,0BAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAAA,OAATA,SAAS;AAAA;AAAA,IAOTE,SAAS,GAAAD,OAAA,CAAAC,SAAA,0BAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAAA,OAATA,SAAS;AAAA,OAmCF"}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import type { SkImage } from "../Image";
|
2
|
+
export type PlatformBuffer = bigint;
|
3
|
+
export interface PlatformBufferFactory {
|
4
|
+
/**
|
5
|
+
* Copy pixels to a platform buffer. (for testing purposes)
|
6
|
+
*/
|
7
|
+
MakeFromImage: (image: SkImage) => PlatformBuffer;
|
8
|
+
/**
|
9
|
+
* Release a platform buffer that was created with `MakeFromImage`.
|
10
|
+
*/
|
11
|
+
Release: (platformBuffer: PlatformBuffer) => void;
|
12
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":[],"sources":["PlatformBufferFactory.ts"],"sourcesContent":["import type { SkImage } from \"../Image\";\n\nexport type PlatformBuffer = bigint;\n\nexport interface PlatformBufferFactory {\n /**\n * Copy pixels to a platform buffer. (for testing purposes)\n */\n MakeFromImage: (image: SkImage) => PlatformBuffer;\n /**\n * Release a platform buffer that was created with `MakeFromImage`.\n */\n Release: (platformBuffer: PlatformBuffer) => void;\n}\n"],"mappings":""}
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from "./PlatformBufferFactory";
|
@@ -0,0 +1,17 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
var _PlatformBufferFactory = require("./PlatformBufferFactory");
|
7
|
+
Object.keys(_PlatformBufferFactory).forEach(function (key) {
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
9
|
+
if (key in exports && exports[key] === _PlatformBufferFactory[key]) return;
|
10
|
+
Object.defineProperty(exports, key, {
|
11
|
+
enumerable: true,
|
12
|
+
get: function () {
|
13
|
+
return _PlatformBufferFactory[key];
|
14
|
+
}
|
15
|
+
});
|
16
|
+
});
|
17
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["_PlatformBufferFactory","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get"],"sources":["index.ts"],"sourcesContent":["export * from \"./PlatformBufferFactory\";\n"],"mappings":";;;;;AAAA,IAAAA,sBAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,sBAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,sBAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,sBAAA,CAAAK,GAAA;IAAA;EAAA;AAAA"}
|
@@ -26,6 +26,7 @@ import type { Color, SkColor } from "./Color";
|
|
26
26
|
import type { TypefaceFontProviderFactory } from "./Paragraph/TypefaceFontProviderFactory";
|
27
27
|
import type { AnimatedImageFactory } from "./AnimatedImage";
|
28
28
|
import type { ParagraphBuilderFactory } from "./Paragraph/ParagraphBuilder";
|
29
|
+
import type { PlatformBufferFactory } from "./PlatformBuffer";
|
29
30
|
/**
|
30
31
|
* Declares the interface for the native Skia API
|
31
32
|
*/
|
@@ -71,4 +72,5 @@ export interface Skia {
|
|
71
72
|
TextBlob: TextBlobFactory;
|
72
73
|
Surface: SurfaceFactory;
|
73
74
|
ParagraphBuilder: ParagraphBuilderFactory;
|
75
|
+
PlatformBuffer: PlatformBufferFactory;
|
74
76
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":[],"sources":["Skia.ts"],"sourcesContent":["import type { ImageFilterFactory } from \"./ImageFilter\";\nimport type { PathFactory } from \"./Path\";\nimport type { ColorFilterFactory } from \"./ColorFilter\";\nimport type { SkFont, FontMgrFactory } from \"./Font\";\nimport type { SkTypeface, TypefaceFactory } from \"./Typeface\";\nimport type { ImageFactory } from \"./Image\";\nimport type { MaskFilterFactory } from \"./MaskFilter\";\nimport type { SkPaint } from \"./Paint\";\nimport type { SkHostRect, SkRect } from \"./Rect\";\nimport type { SkRRect } from \"./RRect\";\nimport type {\n RuntimeEffectFactory,\n SkRuntimeEffect,\n SkRuntimeShaderBuilder,\n} from \"./RuntimeEffect\";\nimport type { ShaderFactory } from \"./Shader\";\nimport type { SkMatrix } from \"./Matrix\";\nimport type { PathEffectFactory } from \"./PathEffect\";\nimport type { SkPoint } from \"./Point\";\nimport type { SkVertices, VertexMode } from \"./Vertices/Vertices\";\nimport type { DataFactory } from \"./Data\";\nimport type { SVGFactory } from \"./SVG\";\nimport type { TextBlobFactory } from \"./TextBlob\";\nimport type { SurfaceFactory } from \"./Surface\";\nimport type { SkRSXform } from \"./RSXform\";\nimport type { SkPath } from \"./Path/Path\";\nimport type { SkContourMeasureIter } from \"./ContourMeasure\";\nimport type { PictureFactory, SkPictureRecorder } from \"./Picture\";\nimport type { Color, SkColor } from \"./Color\";\nimport type { TypefaceFontProviderFactory } from \"./Paragraph/TypefaceFontProviderFactory\";\nimport type { AnimatedImageFactory } from \"./AnimatedImage\";\nimport type { ParagraphBuilderFactory } from \"./Paragraph/ParagraphBuilder\";\n\n/**\n * Declares the interface for the native Skia API\n */\nexport interface Skia {\n Point: (x: number, y: number) => SkPoint;\n XYWHRect: (x: number, y: number, width: number, height: number) => SkHostRect;\n RuntimeShaderBuilder: (rt: SkRuntimeEffect) => SkRuntimeShaderBuilder;\n RRectXY: (rect: SkRect, rx: number, ry: number) => SkRRect;\n RSXform: (scos: number, ssin: number, tx: number, ty: number) => SkRSXform;\n RSXformFromRadians: (\n scale: number,\n radians: number,\n tx: number,\n ty: number,\n px: number,\n py: number\n ) => SkRSXform;\n Color: (color: Color) => SkColor;\n ContourMeasureIter: (\n path: SkPath,\n forceClosed: boolean,\n resScale: number\n ) => SkContourMeasureIter;\n Paint: () => SkPaint;\n PictureRecorder: () => SkPictureRecorder;\n Picture: PictureFactory;\n Path: PathFactory;\n Matrix: (matrix?: readonly number[]) => SkMatrix;\n ColorFilter: ColorFilterFactory;\n Font: (typeface?: SkTypeface, size?: number) => SkFont;\n Typeface: TypefaceFactory;\n TypefaceFontProvider: TypefaceFontProviderFactory;\n FontMgr: FontMgrFactory;\n MaskFilter: MaskFilterFactory;\n RuntimeEffect: RuntimeEffectFactory;\n ImageFilter: ImageFilterFactory;\n Shader: ShaderFactory;\n PathEffect: PathEffectFactory;\n /**\n * Returns an Vertices based on the given positions and optional parameters.\n * See SkVertices.h (especially the Builder) for more details.\n * @param mode\n * @param positions\n * @param textureCoordinates\n * @param colors - either a list of int colors or a flattened color array.\n * @param indices\n * @param isVolatile\n */\n MakeVertices(\n mode: VertexMode,\n positions: SkPoint[],\n textureCoordinates?: SkPoint[] | null,\n colors?: SkColor[],\n indices?: number[] | null,\n isVolatile?: boolean\n ): SkVertices;\n Data: DataFactory;\n Image: ImageFactory;\n AnimatedImage: AnimatedImageFactory;\n SVG: SVGFactory;\n TextBlob: TextBlobFactory;\n Surface: SurfaceFactory;\n
|
1
|
+
{"version":3,"names":[],"sources":["Skia.ts"],"sourcesContent":["import type { ImageFilterFactory } from \"./ImageFilter\";\nimport type { PathFactory } from \"./Path\";\nimport type { ColorFilterFactory } from \"./ColorFilter\";\nimport type { SkFont, FontMgrFactory } from \"./Font\";\nimport type { SkTypeface, TypefaceFactory } from \"./Typeface\";\nimport type { ImageFactory } from \"./Image\";\nimport type { MaskFilterFactory } from \"./MaskFilter\";\nimport type { SkPaint } from \"./Paint\";\nimport type { SkHostRect, SkRect } from \"./Rect\";\nimport type { SkRRect } from \"./RRect\";\nimport type {\n RuntimeEffectFactory,\n SkRuntimeEffect,\n SkRuntimeShaderBuilder,\n} from \"./RuntimeEffect\";\nimport type { ShaderFactory } from \"./Shader\";\nimport type { SkMatrix } from \"./Matrix\";\nimport type { PathEffectFactory } from \"./PathEffect\";\nimport type { SkPoint } from \"./Point\";\nimport type { SkVertices, VertexMode } from \"./Vertices/Vertices\";\nimport type { DataFactory } from \"./Data\";\nimport type { SVGFactory } from \"./SVG\";\nimport type { TextBlobFactory } from \"./TextBlob\";\nimport type { SurfaceFactory } from \"./Surface\";\nimport type { SkRSXform } from \"./RSXform\";\nimport type { SkPath } from \"./Path/Path\";\nimport type { SkContourMeasureIter } from \"./ContourMeasure\";\nimport type { PictureFactory, SkPictureRecorder } from \"./Picture\";\nimport type { Color, SkColor } from \"./Color\";\nimport type { TypefaceFontProviderFactory } from \"./Paragraph/TypefaceFontProviderFactory\";\nimport type { AnimatedImageFactory } from \"./AnimatedImage\";\nimport type { ParagraphBuilderFactory } from \"./Paragraph/ParagraphBuilder\";\nimport type { PlatformBufferFactory } from \"./PlatformBuffer\";\n\n/**\n * Declares the interface for the native Skia API\n */\nexport interface Skia {\n Point: (x: number, y: number) => SkPoint;\n XYWHRect: (x: number, y: number, width: number, height: number) => SkHostRect;\n RuntimeShaderBuilder: (rt: SkRuntimeEffect) => SkRuntimeShaderBuilder;\n RRectXY: (rect: SkRect, rx: number, ry: number) => SkRRect;\n RSXform: (scos: number, ssin: number, tx: number, ty: number) => SkRSXform;\n RSXformFromRadians: (\n scale: number,\n radians: number,\n tx: number,\n ty: number,\n px: number,\n py: number\n ) => SkRSXform;\n Color: (color: Color) => SkColor;\n ContourMeasureIter: (\n path: SkPath,\n forceClosed: boolean,\n resScale: number\n ) => SkContourMeasureIter;\n Paint: () => SkPaint;\n PictureRecorder: () => SkPictureRecorder;\n Picture: PictureFactory;\n Path: PathFactory;\n Matrix: (matrix?: readonly number[]) => SkMatrix;\n ColorFilter: ColorFilterFactory;\n Font: (typeface?: SkTypeface, size?: number) => SkFont;\n Typeface: TypefaceFactory;\n TypefaceFontProvider: TypefaceFontProviderFactory;\n FontMgr: FontMgrFactory;\n MaskFilter: MaskFilterFactory;\n RuntimeEffect: RuntimeEffectFactory;\n ImageFilter: ImageFilterFactory;\n Shader: ShaderFactory;\n PathEffect: PathEffectFactory;\n /**\n * Returns an Vertices based on the given positions and optional parameters.\n * See SkVertices.h (especially the Builder) for more details.\n * @param mode\n * @param positions\n * @param textureCoordinates\n * @param colors - either a list of int colors or a flattened color array.\n * @param indices\n * @param isVolatile\n */\n MakeVertices(\n mode: VertexMode,\n positions: SkPoint[],\n textureCoordinates?: SkPoint[] | null,\n colors?: SkColor[],\n indices?: number[] | null,\n isVolatile?: boolean\n ): SkVertices;\n Data: DataFactory;\n Image: ImageFactory;\n AnimatedImage: AnimatedImageFactory;\n SVG: SVGFactory;\n TextBlob: TextBlobFactory;\n Surface: SurfaceFactory;\n ParagraphBuilder: ParagraphBuilderFactory;\n PlatformBuffer: PlatformBufferFactory;\n}\n"],"mappings":""}
|
@@ -26,4 +26,12 @@ export interface SkSurface extends SkJSIInstance<"Surface"> {
|
|
26
26
|
* Make sure any queued draws are sent to the screen or the GPU.
|
27
27
|
*/
|
28
28
|
flush(): void;
|
29
|
+
/**
|
30
|
+
* Returns the possibly scaled width of the surface.
|
31
|
+
*/
|
32
|
+
width(): number;
|
33
|
+
/**
|
34
|
+
* Returns the possibly scaled height of the surface.
|
35
|
+
*/
|
36
|
+
height(): number;
|
29
37
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":[],"sources":["Surface.ts"],"sourcesContent":["import type { SkImage } from \"../Image\";\nimport type { SkCanvas } from \"../Canvas\";\nimport type { SkJSIInstance } from \"../JsiInstance\";\nimport type { SkRect } from \"../Rect\";\n\nexport interface SkSurface extends SkJSIInstance<\"Surface\"> {\n /** Returns Canvas that draws into the surface. Subsequent calls return the\n same Canvas. Canvas returned is managed and owned by Surface, and is\n deleted when Surface is deleted.\n\n @return drawing Canvas for Surface\n\n example: https://fiddle.skia.org/c/@Surface_getCanvas\n */\n getCanvas(): SkCanvas;\n\n /** Returns Image capturing Surface contents. Subsequent drawing to\n Surface contents are not captured.\n\n @param bounds A rectangle specifying the subset of the surface that\n is of interest.\n @return Image initialized with Surface contents\n\n example: https://fiddle.skia.org/c/@Surface_makeImageSnapshot\n */\n makeImageSnapshot(bounds?: SkRect): SkImage;\n\n /**\n * Make sure any queued draws are sent to the screen or the GPU.\n */\n flush(): void;\n}\n"],"mappings":""}
|
1
|
+
{"version":3,"names":[],"sources":["Surface.ts"],"sourcesContent":["import type { SkImage } from \"../Image\";\nimport type { SkCanvas } from \"../Canvas\";\nimport type { SkJSIInstance } from \"../JsiInstance\";\nimport type { SkRect } from \"../Rect\";\n\nexport interface SkSurface extends SkJSIInstance<\"Surface\"> {\n /** Returns Canvas that draws into the surface. Subsequent calls return the\n same Canvas. Canvas returned is managed and owned by Surface, and is\n deleted when Surface is deleted.\n\n @return drawing Canvas for Surface\n\n example: https://fiddle.skia.org/c/@Surface_getCanvas\n */\n getCanvas(): SkCanvas;\n\n /** Returns Image capturing Surface contents. Subsequent drawing to\n Surface contents are not captured.\n\n @param bounds A rectangle specifying the subset of the surface that\n is of interest.\n @return Image initialized with Surface contents\n\n example: https://fiddle.skia.org/c/@Surface_makeImageSnapshot\n */\n makeImageSnapshot(bounds?: SkRect): SkImage;\n\n /**\n * Make sure any queued draws are sent to the screen or the GPU.\n */\n flush(): void;\n\n /**\n * Returns the possibly scaled width of the surface.\n */\n width(): number;\n\n /**\n * Returns the possibly scaled height of the surface.\n */\n height(): number;\n}\n"],"mappings":""}
|
@@ -344,4 +344,15 @@ Object.keys(_Matrix2).forEach(function (key) {
|
|
344
344
|
}
|
345
345
|
});
|
346
346
|
});
|
347
|
+
var _PlatformBuffer = require("./PlatformBuffer");
|
348
|
+
Object.keys(_PlatformBuffer).forEach(function (key) {
|
349
|
+
if (key === "default" || key === "__esModule") return;
|
350
|
+
if (key in exports && exports[key] === _PlatformBuffer[key]) return;
|
351
|
+
Object.defineProperty(exports, key, {
|
352
|
+
enumerable: true,
|
353
|
+
get: function () {
|
354
|
+
return _PlatformBuffer[key];
|
355
|
+
}
|
356
|
+
});
|
357
|
+
});
|
347
358
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_Picture","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_Data","_SVG","_Surface","_Vertices","_RuntimeEffect","_Shader","_Image","_AnimatedImage","_ColorFilter","_ImageFilter","_Font","_Typeface","_Paint","_Path","_Color","_Canvas","_ContourMeasure","_MaskFilter","_Matrix","_PathEffect","_Point","_Rect","_RRect","_RSXform","_JsiInstance","_Skia","_TextBlob","_Size","_Paragraph","_Matrix2"],"sources":["index.ts"],"sourcesContent":["export * from \"./Picture\";\nexport * from \"./Data\";\nexport * from \"./SVG\";\nexport * from \"./Surface\";\nexport * from \"./Vertices\";\nexport * from \"./RuntimeEffect\";\nexport * from \"./Shader\";\nexport * from \"./Image\";\nexport * from \"./AnimatedImage\";\nexport * from \"./ColorFilter\";\nexport * from \"./ImageFilter\";\nexport * from \"./Font\";\nexport * from \"./Typeface\";\nexport * from \"./Paint\";\nexport * from \"./Path\";\nexport * from \"./Color\";\nexport * from \"./Canvas\";\nexport * from \"./ContourMeasure\";\nexport * from \"./MaskFilter\";\nexport * from \"./Matrix\";\nexport * from \"./PathEffect\";\nexport * from \"./Point\";\nexport * from \"./Rect\";\nexport * from \"./RRect\";\nexport * from \"./RSXform\";\nexport * from \"./JsiInstance\";\nexport * from \"./Skia\";\nexport * from \"./TextBlob\";\nexport * from \"./Size\";\nexport * from \"./Paragraph\";\nexport * from \"./Matrix4\";\n"],"mappings":";;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,QAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,QAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,QAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,KAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,KAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,KAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,KAAA,CAAAL,GAAA;IAAA;EAAA;AAAA;AACA,IAAAM,IAAA,GAAAV,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAQ,IAAA,EAAAP,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAM,IAAA,CAAAN,GAAA;E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AAiC,UAAA,CAAAjC,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAA6B,UAAA,CAAAjC,GAAA;IAAA;EAAA;AAAA;AACA,IAAAkC,QAAA,GAAAtC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAoC,QAAA,EAAAnC,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAkC,QAAA,CAAAlC,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAA8B,QAAA,CAAAlC,GAAA;IAAA;EAAA;AAAA"}
|
1
|
+
{"version":3,"names":["_Picture","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_Data","_SVG","_Surface","_Vertices","_RuntimeEffect","_Shader","_Image","_AnimatedImage","_ColorFilter","_ImageFilter","_Font","_Typeface","_Paint","_Path","_Color","_Canvas","_ContourMeasure","_MaskFilter","_Matrix","_PathEffect","_Point","_Rect","_RRect","_RSXform","_JsiInstance","_Skia","_TextBlob","_Size","_Paragraph","_Matrix2","_PlatformBuffer"],"sources":["index.ts"],"sourcesContent":["export * from \"./Picture\";\nexport * from \"./Data\";\nexport * from \"./SVG\";\nexport * from \"./Surface\";\nexport * from \"./Vertices\";\nexport * from \"./RuntimeEffect\";\nexport * from \"./Shader\";\nexport * from \"./Image\";\nexport * from \"./AnimatedImage\";\nexport * from \"./ColorFilter\";\nexport * from \"./ImageFilter\";\nexport * from \"./Font\";\nexport * from \"./Typeface\";\nexport * from \"./Paint\";\nexport * from \"./Path\";\nexport * from \"./Color\";\nexport * from \"./Canvas\";\nexport * from \"./ContourMeasure\";\nexport * from \"./MaskFilter\";\nexport * from \"./Matrix\";\nexport * from \"./PathEffect\";\nexport * from \"./Point\";\nexport * from \"./Rect\";\nexport * from \"./RRect\";\nexport * from \"./RSXform\";\nexport * from \"./JsiInstance\";\nexport * from \"./Skia\";\nexport * from \"./TextBlob\";\nexport * from \"./Size\";\nexport * from \"./Paragraph\";\nexport * from \"./Matrix4\";\nexport * from \"./PlatformBuffer\";\n"],"mappings":";;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,QAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,QAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,QAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,KAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,KAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,KAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,KAAA,CAAAL,GAAA;IAAA;EAAA;AAAA;AACA,IAAAM,IAAA,GAAAV,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAQ,IAAA,EAAAP,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAM,IAAA,CAAAN,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;I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EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAA6B,UAAA,CAAAjC,GAAA;IAAA;EAAA;AAAA;AACA,IAAAkC,QAAA,GAAAtC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAoC,QAAA,EAAAnC,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAkC,QAAA,CAAAlC,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAA8B,QAAA,CAAAlC,GAAA;IAAA;EAAA;AAAA;AACA,IAAAmC,eAAA,GAAAvC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAqC,eAAA,EAAApC,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAmC,eAAA,CAAAnC,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAA+B,eAAA,CAAAnC,GAAA;IAAA;EAAA;AAAA"}
|
@@ -3,8 +3,7 @@ import type { FilterMode, MipmapMode, SkImage, SkMatrix, SkShader, TileMode, Ima
|
|
3
3
|
import { HostObject } from "./Host";
|
4
4
|
export declare const toBase64String: (bytes: Uint8Array) => string;
|
5
5
|
export declare class JsiSkImage extends HostObject<Image, "Image"> implements SkImage {
|
6
|
-
|
7
|
-
constructor(CanvasKit: CanvasKit, ref: Image, releaseCtx?: (() => void) | undefined);
|
6
|
+
constructor(CanvasKit: CanvasKit, ref: Image);
|
8
7
|
height(): number;
|
9
8
|
width(): number;
|
10
9
|
getImageInfo(): ImageInfo;
|
@@ -38,14 +38,10 @@ const toBase64String = bytes => {
|
|
38
38
|
};
|
39
39
|
exports.toBase64String = toBase64String;
|
40
40
|
class JsiSkImage extends _Host.HostObject {
|
41
|
-
constructor(CanvasKit, ref
|
41
|
+
constructor(CanvasKit, ref) {
|
42
42
|
super(CanvasKit, ref, "Image");
|
43
|
-
this.releaseCtx = releaseCtx;
|
44
43
|
_defineProperty(this, "dispose", () => {
|
45
44
|
this.ref.delete();
|
46
|
-
if (this.releaseCtx) {
|
47
|
-
this.releaseCtx();
|
48
|
-
}
|
49
45
|
});
|
50
46
|
}
|
51
47
|
height() {
|
@@ -103,25 +99,22 @@ class JsiSkImage extends _Host.HostObject {
|
|
103
99
|
return this.ref.readPixels(srcX !== null && srcX !== void 0 ? srcX : 0, srcY !== null && srcY !== void 0 ? srcY : 0, pxInfo);
|
104
100
|
}
|
105
101
|
makeNonTextureImage() {
|
102
|
+
// if the image is already a non-texture image, this is a no-op
|
106
103
|
const partialInfo = this.ref.getImageInfo();
|
107
104
|
const colorSpace = this.ref.getColorSpace();
|
108
105
|
const info = {
|
109
106
|
...partialInfo,
|
110
107
|
colorSpace
|
111
108
|
};
|
112
|
-
|
113
|
-
const pixelPtr = this.CanvasKit.Malloc(Uint8Array, pixelLen);
|
114
|
-
const pixels = this.ref.readPixels(0, 0, info, pixelPtr, info.width * 4);
|
109
|
+
const pixels = this.ref.readPixels(0, 0, info);
|
115
110
|
if (!pixels) {
|
116
|
-
throw new Error("Could not
|
111
|
+
throw new Error("Could not read pixels from image");
|
117
112
|
}
|
118
113
|
const img = this.CanvasKit.MakeImage(info, pixels, info.width * 4);
|
119
114
|
if (!img) {
|
120
115
|
throw new Error("Could not create image from bytes");
|
121
116
|
}
|
122
|
-
return new JsiSkImage(this.CanvasKit, img
|
123
|
-
this.CanvasKit.Free(pixelPtr);
|
124
|
-
});
|
117
|
+
return new JsiSkImage(this.CanvasKit, img);
|
125
118
|
}
|
126
119
|
}
|
127
120
|
exports.JsiSkImage = JsiSkImage;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_Host","require","_JsiSkMatrix","_JsiSkShader","_defineProperty","obj","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","String","r","e","Symbol","toPrimitive","call","TypeError","Number","toBase64String","bytes","Buffer","from","toString","CHUNK_SIZE","index","length","result","slice","Math","min","fromCharCode","apply","btoa","exports","JsiSkImage","HostObject","constructor","CanvasKit","ref","releaseCtx","delete","height","width","getImageInfo","info","colorType","alphaType","makeShaderOptions","tx","ty","fm","mm","localMatrix","JsiSkShader","getEnum","TileMode","FilterMode","MipmapMode","JsiSkMatrix","fromValue","undefined","makeShaderCubic","B","C","encodeToBytes","fmt","quality","ImageFormat","Error","encodeToBase64","readPixels","srcX","srcY","imageInfo","_imageInfo$width","_imageInfo$height","pxInfo","colorSpace","ColorSpace","SRGB","AlphaType","ColorType","makeNonTextureImage","partialInfo","getColorSpace","pixelLen","pixelPtr","Malloc","Uint8Array","pixels","img","MakeImage","Free"],"sources":["JsiSkImage.ts"],"sourcesContent":["import type {\n CanvasKit,\n ImageInfo as CKImageInfo,\n Image,\n} from \"canvaskit-wasm\";\n\nimport type {\n FilterMode,\n MipmapMode,\n SkImage,\n SkMatrix,\n SkShader,\n TileMode,\n ImageFormat,\n ImageInfo,\n} from \"../types\";\n\nimport { getEnum, HostObject } from \"./Host\";\nimport { JsiSkMatrix } from \"./JsiSkMatrix\";\nimport { JsiSkShader } from \"./JsiSkShader\";\n\n// https://github.com/google/skia/blob/1f193df9b393d50da39570dab77a0bb5d28ec8ef/modules/canvaskit/htmlcanvas/util.js\nexport const toBase64String = (bytes: Uint8Array) => {\n if (typeof Buffer !== \"undefined\") {\n // Are we on node?\n return Buffer.from(bytes).toString(\"base64\");\n } else {\n // From https://stackoverflow.com/a/25644409\n // because the naive solution of\n // btoa(String.fromCharCode.apply(null, bytes));\n // would occasionally throw \"Maximum call stack size exceeded\"\n var CHUNK_SIZE = 0x8000; //arbitrary number\n var index = 0;\n var { length } = bytes;\n var result = \"\";\n var slice;\n while (index < length) {\n slice = bytes.slice(index, Math.min(index + CHUNK_SIZE, length));\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n result += String.fromCharCode.apply(null, slice as any);\n index += CHUNK_SIZE;\n }\n return btoa(result);\n }\n};\n\nexport class JsiSkImage extends HostObject<Image, \"Image\"> implements SkImage {\n constructor(\n CanvasKit: CanvasKit,\n ref: Image,\n private releaseCtx?: () => void\n ) {\n super(CanvasKit, ref, \"Image\");\n }\n\n height() {\n return this.ref.height();\n }\n\n width() {\n return this.ref.width();\n }\n\n getImageInfo(): ImageInfo {\n const info = this.ref.getImageInfo();\n return {\n width: info.width,\n height: info.height,\n colorType: info.colorType.value,\n alphaType: info.alphaType.value,\n };\n }\n\n makeShaderOptions(\n tx: TileMode,\n ty: TileMode,\n fm: FilterMode,\n mm: MipmapMode,\n localMatrix?: SkMatrix\n ): SkShader {\n return new JsiSkShader(\n this.CanvasKit,\n this.ref.makeShaderOptions(\n getEnum(this.CanvasKit.TileMode, tx),\n getEnum(this.CanvasKit.TileMode, ty),\n getEnum(this.CanvasKit.FilterMode, fm),\n getEnum(this.CanvasKit.MipmapMode, mm),\n localMatrix ? JsiSkMatrix.fromValue(localMatrix) : undefined\n )\n );\n }\n\n makeShaderCubic(\n tx: TileMode,\n ty: TileMode,\n B: number,\n C: number,\n localMatrix?: SkMatrix\n ): SkShader {\n return new JsiSkShader(\n this.CanvasKit,\n this.ref.makeShaderCubic(\n getEnum(this.CanvasKit.TileMode, tx),\n getEnum(this.CanvasKit.TileMode, ty),\n B,\n C,\n localMatrix ? JsiSkMatrix.fromValue(localMatrix) : undefined\n )\n );\n }\n\n encodeToBytes(fmt?: ImageFormat, quality?: number) {\n let result: Uint8Array | null;\n if (fmt && quality) {\n result = this.ref.encodeToBytes(\n getEnum(this.CanvasKit.ImageFormat, fmt),\n quality\n );\n } else if (fmt) {\n result = this.ref.encodeToBytes(getEnum(this.CanvasKit.ImageFormat, fmt));\n } else {\n result = this.ref.encodeToBytes();\n }\n if (!result) {\n throw new Error(\"encodeToBytes failed\");\n }\n return result;\n }\n\n encodeToBase64(fmt?: ImageFormat, quality?: number) {\n const bytes = this.encodeToBytes(fmt, quality);\n return toBase64String(bytes);\n }\n\n // TODO: this is leaking on Web\n // Add signature with allocated buffer\n readPixels(srcX?: number, srcY?: number, imageInfo?: ImageInfo) {\n const info = this.getImageInfo();\n const pxInfo: CKImageInfo = {\n colorSpace: this.CanvasKit.ColorSpace.SRGB,\n width: imageInfo?.width ?? info.width,\n height: imageInfo?.height ?? info.height,\n alphaType: getEnum(\n this.CanvasKit.AlphaType,\n (imageInfo ?? info).alphaType\n ),\n colorType: getEnum(\n this.CanvasKit.ColorType,\n (imageInfo ?? info).colorType\n ),\n };\n return this.ref.readPixels(srcX ?? 0, srcY ?? 0, pxInfo);\n }\n\n dispose = () => {\n this.ref.delete();\n if (this.releaseCtx) {\n this.releaseCtx();\n }\n };\n\n makeNonTextureImage(): SkImage {\n const partialInfo = this.ref.getImageInfo();\n const colorSpace = this.ref.getColorSpace();\n const info = {\n ...partialInfo,\n colorSpace,\n };\n\n var pixelLen = info.width * info.height * 4;\n const pixelPtr = this.CanvasKit.Malloc(Uint8Array, pixelLen);\n const pixels = this.ref.readPixels(\n 0,\n 0,\n info,\n pixelPtr,\n info.width * 4\n ) as Uint8Array | null;\n if (!pixels) {\n throw new Error(\"Could not create image from bytes\");\n }\n const img = this.CanvasKit.MakeImage(info, pixels, info.width * 4);\n if (!img) {\n throw new Error(\"Could not create image from bytes\");\n }\n return new JsiSkImage(this.CanvasKit, img, () => {\n this.CanvasKit.Free(pixelPtr);\n });\n }\n}\n"],"mappings":";;;;;;AAiBA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AAA4C,SAAAG,gBAAAC,GAAA,EAAAC,GAAA,EAAAC,KAAA,IAAAD,GAAA,GAAAE,cAAA,CAAA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","_JsiSkMatrix","_JsiSkShader","_defineProperty","obj","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","String","r","e","Symbol","toPrimitive","call","TypeError","Number","toBase64String","bytes","Buffer","from","toString","CHUNK_SIZE","index","length","result","slice","Math","min","fromCharCode","apply","btoa","exports","JsiSkImage","HostObject","constructor","CanvasKit","ref","delete","height","width","getImageInfo","info","colorType","alphaType","makeShaderOptions","tx","ty","fm","mm","localMatrix","JsiSkShader","getEnum","TileMode","FilterMode","MipmapMode","JsiSkMatrix","fromValue","undefined","makeShaderCubic","B","C","encodeToBytes","fmt","quality","ImageFormat","Error","encodeToBase64","readPixels","srcX","srcY","imageInfo","_imageInfo$width","_imageInfo$height","pxInfo","colorSpace","ColorSpace","SRGB","AlphaType","ColorType","makeNonTextureImage","partialInfo","getColorSpace","pixels","img","MakeImage"],"sources":["JsiSkImage.ts"],"sourcesContent":["import type {\n CanvasKit,\n ImageInfo as CKImageInfo,\n Image,\n} from \"canvaskit-wasm\";\n\nimport type {\n FilterMode,\n MipmapMode,\n SkImage,\n SkMatrix,\n SkShader,\n TileMode,\n ImageFormat,\n ImageInfo,\n} from \"../types\";\n\nimport { getEnum, HostObject } from \"./Host\";\nimport { JsiSkMatrix } from \"./JsiSkMatrix\";\nimport { JsiSkShader } from \"./JsiSkShader\";\n\n// https://github.com/google/skia/blob/1f193df9b393d50da39570dab77a0bb5d28ec8ef/modules/canvaskit/htmlcanvas/util.js\nexport const toBase64String = (bytes: Uint8Array) => {\n if (typeof Buffer !== \"undefined\") {\n // Are we on node?\n return Buffer.from(bytes).toString(\"base64\");\n } else {\n // From https://stackoverflow.com/a/25644409\n // because the naive solution of\n // btoa(String.fromCharCode.apply(null, bytes));\n // would occasionally throw \"Maximum call stack size exceeded\"\n var CHUNK_SIZE = 0x8000; //arbitrary number\n var index = 0;\n var { length } = bytes;\n var result = \"\";\n var slice;\n while (index < length) {\n slice = bytes.slice(index, Math.min(index + CHUNK_SIZE, length));\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n result += String.fromCharCode.apply(null, slice as any);\n index += CHUNK_SIZE;\n }\n return btoa(result);\n }\n};\n\nexport class JsiSkImage extends HostObject<Image, \"Image\"> implements SkImage {\n constructor(CanvasKit: CanvasKit, ref: Image) {\n super(CanvasKit, ref, \"Image\");\n }\n\n height() {\n return this.ref.height();\n }\n\n width() {\n return this.ref.width();\n }\n\n getImageInfo(): ImageInfo {\n const info = this.ref.getImageInfo();\n return {\n width: info.width,\n height: info.height,\n colorType: info.colorType.value,\n alphaType: info.alphaType.value,\n };\n }\n\n makeShaderOptions(\n tx: TileMode,\n ty: TileMode,\n fm: FilterMode,\n mm: MipmapMode,\n localMatrix?: SkMatrix\n ): SkShader {\n return new JsiSkShader(\n this.CanvasKit,\n this.ref.makeShaderOptions(\n getEnum(this.CanvasKit.TileMode, tx),\n getEnum(this.CanvasKit.TileMode, ty),\n getEnum(this.CanvasKit.FilterMode, fm),\n getEnum(this.CanvasKit.MipmapMode, mm),\n localMatrix ? JsiSkMatrix.fromValue(localMatrix) : undefined\n )\n );\n }\n\n makeShaderCubic(\n tx: TileMode,\n ty: TileMode,\n B: number,\n C: number,\n localMatrix?: SkMatrix\n ): SkShader {\n return new JsiSkShader(\n this.CanvasKit,\n this.ref.makeShaderCubic(\n getEnum(this.CanvasKit.TileMode, tx),\n getEnum(this.CanvasKit.TileMode, ty),\n B,\n C,\n localMatrix ? JsiSkMatrix.fromValue(localMatrix) : undefined\n )\n );\n }\n\n encodeToBytes(fmt?: ImageFormat, quality?: number) {\n let result: Uint8Array | null;\n if (fmt && quality) {\n result = this.ref.encodeToBytes(\n getEnum(this.CanvasKit.ImageFormat, fmt),\n quality\n );\n } else if (fmt) {\n result = this.ref.encodeToBytes(getEnum(this.CanvasKit.ImageFormat, fmt));\n } else {\n result = this.ref.encodeToBytes();\n }\n if (!result) {\n throw new Error(\"encodeToBytes failed\");\n }\n return result;\n }\n\n encodeToBase64(fmt?: ImageFormat, quality?: number) {\n const bytes = this.encodeToBytes(fmt, quality);\n return toBase64String(bytes);\n }\n\n // TODO: this is leaking on Web\n // Add signature with allocated buffer\n readPixels(srcX?: number, srcY?: number, imageInfo?: ImageInfo) {\n const info = this.getImageInfo();\n const pxInfo: CKImageInfo = {\n colorSpace: this.CanvasKit.ColorSpace.SRGB,\n width: imageInfo?.width ?? info.width,\n height: imageInfo?.height ?? info.height,\n alphaType: getEnum(\n this.CanvasKit.AlphaType,\n (imageInfo ?? info).alphaType\n ),\n colorType: getEnum(\n this.CanvasKit.ColorType,\n (imageInfo ?? info).colorType\n ),\n };\n return this.ref.readPixels(srcX ?? 0, srcY ?? 0, pxInfo);\n }\n\n dispose = () => {\n this.ref.delete();\n };\n\n makeNonTextureImage(): SkImage {\n // if the image is already a non-texture image, this is a no-op\n const partialInfo = this.ref.getImageInfo();\n const colorSpace = this.ref.getColorSpace();\n const info = {\n ...partialInfo,\n colorSpace,\n };\n const pixels = this.ref.readPixels(0, 0, info) as Uint8Array | null;\n if (!pixels) {\n throw new Error(\"Could not read pixels from image\");\n }\n const img = this.CanvasKit.MakeImage(info, pixels, info.width * 4);\n if (!img) {\n throw new Error(\"Could not create image from bytes\");\n }\n return new JsiSkImage(this.CanvasKit, img);\n }\n}\n"],"mappings":";;;;;;AAiBA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AAA4C,SAAAG,gBAAAC,GAAA,EAAAC,GAAA,EAAAC,KAAA,IAAAD,GAAA,GAAAE,cAAA,CAAAF,GAAA,OAAAA,GAAA,IAAAD,GAAA,IAAAI,MAAA,CAAAC,cAAA,CAAAL,GAAA,EAAAC,GAAA,IAAAC,KAAA,EAAAA,KAAA,EAAAI,UAAA,QAAAC,YAAA,QAAAC,QAAA,oBAAAR,GAAA,CAAAC,GAAA,IAAAC,KAAA,WAAAF,GAAA;AAAA,SAAAG,eAAAM,CAAA,QAAAC,CAAA,G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AMQ,MAAM,GAAG,IAAI,CAAC9C,GAAG,CAAC+B,UAAU,CAAC,CAAC,EAAE,CAAC,EAAE1B,IAAI,CAAsB;IACnE,IAAI,CAACyC,MAAM,EAAE;MACX,MAAM,IAAIjB,KAAK,CAAC,kCAAkC,CAAC;IACrD;IACA,MAAMkB,GAAG,GAAG,IAAI,CAAChD,SAAS,CAACiD,SAAS,CAAC3C,IAAI,EAAEyC,MAAM,EAAEzC,IAAI,CAACF,KAAK,GAAG,CAAC,CAAC;IAClE,IAAI,CAAC4C,GAAG,EAAE;MACR,MAAM,IAAIlB,KAAK,CAAC,mCAAmC,CAAC;IACtD;IACA,OAAO,IAAIjC,UAAU,CAAC,IAAI,CAACG,SAAS,EAAEgD,GAAG,CAAC;EAC5C;AACF;AAACpD,OAAA,CAAAC,UAAA,GAAAA,UAAA"}
|
@@ -1,11 +1,11 @@
|
|
1
1
|
import type { CanvasKit } from "canvaskit-wasm";
|
2
|
-
import type { SkData, ImageInfo, SkImage } from "../types";
|
3
|
-
import type { ImageFactory } from "../types/Image/ImageFactory";
|
2
|
+
import type { SkData, ImageInfo, SkImage, PlatformBuffer, ImageFactory } from "../types";
|
4
3
|
import { Host } from "./Host";
|
5
4
|
import { JsiSkImage } from "./JsiSkImage";
|
6
5
|
export declare class JsiSkImageFactory extends Host implements ImageFactory {
|
7
6
|
constructor(CanvasKit: CanvasKit);
|
8
7
|
MakeImageFromViewTag(viewTag: number): Promise<SkImage | null>;
|
8
|
+
MakeImageFromPlatformBuffer(_platformBuffer: PlatformBuffer): SkImage;
|
9
9
|
MakeImageFromEncoded(encoded: SkData): JsiSkImage | null;
|
10
10
|
MakeImage(info: ImageInfo, data: SkData, bytesPerRow: number): JsiSkImage | null;
|
11
11
|
}
|
@@ -17,6 +17,9 @@ class JsiSkImageFactory extends _Host.Host {
|
|
17
17
|
console.log(view);
|
18
18
|
return Promise.resolve(null);
|
19
19
|
}
|
20
|
+
MakeImageFromPlatformBuffer(_platformBuffer) {
|
21
|
+
throw new Error("MakeImageFromPlatformBuffer() is only available on iOS and Android!");
|
22
|
+
}
|
20
23
|
MakeImageFromEncoded(encoded) {
|
21
24
|
const image = this.CanvasKit.MakeImageFromEncoded(_JsiSkData.JsiSkData.fromValue(encoded));
|
22
25
|
if (image === null) {
|