@shopify/react-native-skia 1.2.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (96) hide show
  1. package/android/cpp/rnskia-android/RNSkAndroidPlatformContext.h +3 -3
  2. package/cpp/api/JsiNativeBuffer.h +43 -0
  3. package/cpp/api/JsiSkApi.h +3 -3
  4. package/cpp/api/JsiSkImageFactory.h +3 -3
  5. package/cpp/rnskia/RNSkPlatformContext.h +5 -5
  6. package/ios/RNSkia-iOS/RNSkiOSPlatformContext.h +3 -3
  7. package/ios/RNSkia-iOS/RNSkiOSPlatformContext.mm +69 -88
  8. package/ios/RNSkia-iOS/SkiaCVPixelBufferUtils.h +84 -0
  9. package/ios/RNSkia-iOS/SkiaCVPixelBufferUtils.mm +159 -0
  10. package/ios/RNSkia-iOS/SkiaMetalSurfaceFactory.h +2 -1
  11. package/ios/RNSkia-iOS/SkiaMetalSurfaceFactory.mm +30 -6
  12. package/lib/commonjs/skia/types/Image/ImageFactory.d.ts +8 -15
  13. package/lib/commonjs/skia/types/Image/ImageFactory.js +1 -10
  14. package/lib/commonjs/skia/types/Image/ImageFactory.js.map +1 -1
  15. package/lib/commonjs/skia/types/NativeBuffer/NativeBufferFactory.d.ts +18 -0
  16. package/lib/commonjs/skia/types/NativeBuffer/NativeBufferFactory.js +13 -0
  17. package/lib/commonjs/skia/types/NativeBuffer/NativeBufferFactory.js.map +1 -0
  18. package/lib/commonjs/skia/types/NativeBuffer/index.d.ts +1 -0
  19. package/lib/commonjs/skia/types/NativeBuffer/index.js +17 -0
  20. package/lib/commonjs/skia/types/NativeBuffer/index.js.map +1 -0
  21. package/lib/commonjs/skia/types/Skia.d.ts +2 -2
  22. package/lib/commonjs/skia/types/Skia.js.map +1 -1
  23. package/lib/commonjs/skia/types/index.d.ts +1 -1
  24. package/lib/commonjs/skia/types/index.js +4 -4
  25. package/lib/commonjs/skia/types/index.js.map +1 -1
  26. package/lib/commonjs/skia/web/JsiSkImageFactory.d.ts +3 -2
  27. package/lib/commonjs/skia/web/JsiSkImageFactory.js +18 -2
  28. package/lib/commonjs/skia/web/JsiSkImageFactory.js.map +1 -1
  29. package/lib/commonjs/skia/web/JsiSkNativeBufferFactory.d.ts +8 -0
  30. package/lib/commonjs/skia/web/JsiSkNativeBufferFactory.js +29 -0
  31. package/lib/commonjs/skia/web/JsiSkNativeBufferFactory.js.map +1 -0
  32. package/lib/commonjs/skia/web/JsiSkia.js +2 -2
  33. package/lib/commonjs/skia/web/JsiSkia.js.map +1 -1
  34. package/lib/module/skia/types/Image/ImageFactory.d.ts +8 -15
  35. package/lib/module/skia/types/Image/ImageFactory.js +1 -10
  36. package/lib/module/skia/types/Image/ImageFactory.js.map +1 -1
  37. package/lib/module/skia/types/NativeBuffer/NativeBufferFactory.d.ts +18 -0
  38. package/lib/module/skia/types/NativeBuffer/NativeBufferFactory.js +4 -0
  39. package/lib/module/skia/types/NativeBuffer/NativeBufferFactory.js.map +1 -0
  40. package/lib/module/skia/types/NativeBuffer/index.d.ts +1 -0
  41. package/lib/module/skia/types/NativeBuffer/index.js +2 -0
  42. package/lib/module/skia/types/NativeBuffer/index.js.map +1 -0
  43. package/lib/module/skia/types/Skia.d.ts +2 -2
  44. package/lib/module/skia/types/Skia.js.map +1 -1
  45. package/lib/module/skia/types/index.d.ts +1 -1
  46. package/lib/module/skia/types/index.js +1 -1
  47. package/lib/module/skia/types/index.js.map +1 -1
  48. package/lib/module/skia/web/JsiSkImageFactory.d.ts +3 -2
  49. package/lib/module/skia/web/JsiSkImageFactory.js +18 -2
  50. package/lib/module/skia/web/JsiSkImageFactory.js.map +1 -1
  51. package/lib/module/skia/web/JsiSkNativeBufferFactory.d.ts +8 -0
  52. package/lib/module/skia/web/JsiSkNativeBufferFactory.js +22 -0
  53. package/lib/module/skia/web/JsiSkNativeBufferFactory.js.map +1 -0
  54. package/lib/module/skia/web/JsiSkia.js +2 -2
  55. package/lib/module/skia/web/JsiSkia.js.map +1 -1
  56. package/lib/typescript/src/skia/types/Image/ImageFactory.d.ts +8 -15
  57. package/lib/typescript/src/skia/types/NativeBuffer/NativeBufferFactory.d.ts +18 -0
  58. package/lib/typescript/src/skia/types/NativeBuffer/index.d.ts +1 -0
  59. package/lib/typescript/src/skia/types/Skia.d.ts +2 -2
  60. package/lib/typescript/src/skia/types/index.d.ts +1 -1
  61. package/lib/typescript/src/skia/web/JsiSkImageFactory.d.ts +3 -2
  62. package/lib/typescript/src/skia/web/JsiSkNativeBufferFactory.d.ts +8 -0
  63. package/package.json +1 -1
  64. package/src/skia/types/Image/ImageFactory.ts +7 -23
  65. package/src/skia/types/NativeBuffer/NativeBufferFactory.ts +38 -0
  66. package/src/skia/types/NativeBuffer/index.ts +1 -0
  67. package/src/skia/types/Skia.ts +2 -2
  68. package/src/skia/types/index.ts +1 -1
  69. package/src/skia/web/JsiSkImageFactory.ts +28 -6
  70. package/src/skia/web/JsiSkNativeBufferFactory.ts +35 -0
  71. package/src/skia/web/JsiSkia.ts +2 -2
  72. package/cpp/api/JsiPlatformBuffer.h +0 -51
  73. package/lib/commonjs/skia/types/PlatformBuffer/PlatformBufferFactory.d.ts +0 -12
  74. package/lib/commonjs/skia/types/PlatformBuffer/PlatformBufferFactory.js +0 -6
  75. package/lib/commonjs/skia/types/PlatformBuffer/PlatformBufferFactory.js.map +0 -1
  76. package/lib/commonjs/skia/types/PlatformBuffer/index.d.ts +0 -1
  77. package/lib/commonjs/skia/types/PlatformBuffer/index.js +0 -17
  78. package/lib/commonjs/skia/types/PlatformBuffer/index.js.map +0 -1
  79. package/lib/commonjs/skia/web/JsiSkPlatformBufferFactory.d.ts +0 -8
  80. package/lib/commonjs/skia/web/JsiSkPlatformBufferFactory.js +0 -20
  81. package/lib/commonjs/skia/web/JsiSkPlatformBufferFactory.js.map +0 -1
  82. package/lib/module/skia/types/PlatformBuffer/PlatformBufferFactory.d.ts +0 -12
  83. package/lib/module/skia/types/PlatformBuffer/PlatformBufferFactory.js +0 -2
  84. package/lib/module/skia/types/PlatformBuffer/PlatformBufferFactory.js.map +0 -1
  85. package/lib/module/skia/types/PlatformBuffer/index.d.ts +0 -1
  86. package/lib/module/skia/types/PlatformBuffer/index.js +0 -2
  87. package/lib/module/skia/types/PlatformBuffer/index.js.map +0 -1
  88. package/lib/module/skia/web/JsiSkPlatformBufferFactory.d.ts +0 -8
  89. package/lib/module/skia/web/JsiSkPlatformBufferFactory.js +0 -13
  90. package/lib/module/skia/web/JsiSkPlatformBufferFactory.js.map +0 -1
  91. package/lib/typescript/src/skia/types/PlatformBuffer/PlatformBufferFactory.d.ts +0 -12
  92. package/lib/typescript/src/skia/types/PlatformBuffer/index.d.ts +0 -1
  93. package/lib/typescript/src/skia/web/JsiSkPlatformBufferFactory.d.ts +0 -8
  94. package/src/skia/types/PlatformBuffer/PlatformBufferFactory.ts +0 -14
  95. package/src/skia/types/PlatformBuffer/index.ts +0 -1
  96. package/src/skia/web/JsiSkPlatformBufferFactory.ts +0 -22
@@ -0,0 +1,35 @@
1
+ import type { CanvasKit } from "canvaskit-wasm";
2
+
3
+ import {
4
+ type NativeBuffer,
5
+ type NativeBufferFactory,
6
+ type SkImage,
7
+ } from "../types";
8
+
9
+ import { Host } from "./Host";
10
+
11
+ export class JsiSkNativeBufferFactory
12
+ extends Host
13
+ implements NativeBufferFactory
14
+ {
15
+ constructor(CanvasKit: CanvasKit) {
16
+ super(CanvasKit);
17
+ }
18
+
19
+ MakeFromImage(image: SkImage): NativeBuffer {
20
+ const info = image.getImageInfo();
21
+ const uint8ClampedArray = new Uint8ClampedArray(image.readPixels()!);
22
+ const imageData = new ImageData(uint8ClampedArray, info.width, info.height);
23
+ const canvas = new OffscreenCanvas(info.width, info.height);
24
+ const ctx = canvas.getContext("2d");
25
+ if (!ctx) {
26
+ throw new Error("Failed to get 2d context from canvas");
27
+ }
28
+ ctx.putImageData(imageData, 0, 0);
29
+ return canvas;
30
+ }
31
+
32
+ Release(_platformBuffer: NativeBuffer) {
33
+ // it's a noop on Web
34
+ }
35
+ }
@@ -41,7 +41,7 @@ import { JsiSkTypefaceFontProviderFactory } from "./JsiSkTypefaceFontProviderFac
41
41
  import { JsiSkFontMgrFactory } from "./JsiSkFontMgrFactory";
42
42
  import { JsiSkAnimatedImageFactory } from "./JsiSkAnimatedImageFactory";
43
43
  import { JsiSkParagraphBuilderFactory } from "./JsiSkParagraphBuilderFactory";
44
- import { JsiSkPlatformBufferFactory } from "./JsiSkPlatformBufferFactory";
44
+ import { JsiSkNativeBufferFactory } from "./JsiSkNativeBufferFactory";
45
45
 
46
46
  export const JsiSkApi = (CanvasKit: CanvasKit): Skia => ({
47
47
  Point: (x: number, y: number) =>
@@ -126,5 +126,5 @@ export const JsiSkApi = (CanvasKit: CanvasKit): Skia => ({
126
126
  TypefaceFontProvider: new JsiSkTypefaceFontProviderFactory(CanvasKit),
127
127
  FontMgr: new JsiSkFontMgrFactory(CanvasKit),
128
128
  ParagraphBuilder: new JsiSkParagraphBuilderFactory(CanvasKit),
129
- PlatformBuffer: new JsiSkPlatformBufferFactory(CanvasKit),
129
+ NativeBuffer: new JsiSkNativeBufferFactory(CanvasKit),
130
130
  });
@@ -1,51 +0,0 @@
1
- #pragma once
2
-
3
- #include <memory>
4
- #include <utility>
5
-
6
- #include <jsi/jsi.h>
7
-
8
- #include "JsiSkImage.h"
9
-
10
- namespace RNSkia {
11
-
12
- namespace jsi = facebook::jsi;
13
-
14
- /**
15
- Implementation of the ParagraphBuilderFactory for making ParagraphBuilder JSI
16
- object
17
- */
18
- class JsiPlatformBufferFactory : public JsiSkHostObject {
19
- public:
20
- JSI_HOST_FUNCTION(MakeFromImage) {
21
- auto image = JsiSkImage::fromValue(runtime, arguments[0]);
22
- image->makeNonTextureImage();
23
-
24
- uint64_t pointer = getContext()->makePlatformBuffer(image);
25
- jsi::HostFunctionType deleteFunc =
26
- [=](jsi::Runtime &runtime, const jsi::Value &thisArg,
27
- const jsi::Value *args, size_t count) -> jsi::Value {
28
- getContext()->releasePlatformBuffer(pointer);
29
- return jsi::Value::undefined();
30
- };
31
- return jsi::BigInt::fromUint64(runtime, pointer);
32
- }
33
-
34
- JSI_HOST_FUNCTION(Release) {
35
-
36
- jsi::BigInt pointer = arguments[0].asBigInt(runtime);
37
- const uintptr_t platformBufferPointer = pointer.asUint64(runtime);
38
-
39
- getContext()->releasePlatformBuffer(platformBufferPointer);
40
- return jsi::Value::undefined();
41
- }
42
-
43
- JSI_EXPORT_FUNCTIONS(JSI_EXPORT_FUNC(JsiPlatformBufferFactory, Release),
44
- JSI_EXPORT_FUNC(JsiPlatformBufferFactory, MakeFromImage))
45
-
46
- explicit JsiPlatformBufferFactory(
47
- std::shared_ptr<RNSkPlatformContext> context)
48
- : JsiSkHostObject(std::move(context)) {}
49
- };
50
-
51
- } // namespace RNSkia
@@ -1,12 +0,0 @@
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
- }
@@ -1,6 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- //# sourceMappingURL=PlatformBufferFactory.js.map
@@ -1 +0,0 @@
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":""}
@@ -1 +0,0 @@
1
- export * from "./PlatformBufferFactory";
@@ -1,17 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,8 +0,0 @@
1
- import type { CanvasKit } from "canvaskit-wasm";
2
- import type { PlatformBuffer, PlatformBufferFactory, SkImage } from "../types";
3
- import { Host } from "./Host";
4
- export declare class JsiSkPlatformBufferFactory extends Host implements PlatformBufferFactory {
5
- constructor(CanvasKit: CanvasKit);
6
- MakeFromImage(_image: SkImage): PlatformBuffer;
7
- Release(_platformBuffer: PlatformBuffer): void;
8
- }
@@ -1,20 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.JsiSkPlatformBufferFactory = void 0;
7
- var _Host = require("./Host");
8
- class JsiSkPlatformBufferFactory extends _Host.Host {
9
- constructor(CanvasKit) {
10
- super(CanvasKit);
11
- }
12
- MakeFromImage(_image) {
13
- throw new _Host.NotImplementedOnRNWeb();
14
- }
15
- Release(_platformBuffer) {
16
- throw new _Host.NotImplementedOnRNWeb();
17
- }
18
- }
19
- exports.JsiSkPlatformBufferFactory = JsiSkPlatformBufferFactory;
20
- //# sourceMappingURL=JsiSkPlatformBufferFactory.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_Host","require","JsiSkPlatformBufferFactory","Host","constructor","CanvasKit","MakeFromImage","_image","NotImplementedOnRNWeb","Release","_platformBuffer","exports"],"sources":["JsiSkPlatformBufferFactory.ts"],"sourcesContent":["import type { CanvasKit } from \"canvaskit-wasm\";\n\nimport type { PlatformBuffer, PlatformBufferFactory, SkImage } from \"../types\";\n\nimport { Host, NotImplementedOnRNWeb } from \"./Host\";\n\nexport class JsiSkPlatformBufferFactory\n extends Host\n implements PlatformBufferFactory\n{\n constructor(CanvasKit: CanvasKit) {\n super(CanvasKit);\n }\n\n MakeFromImage(_image: SkImage): PlatformBuffer {\n throw new NotImplementedOnRNWeb();\n }\n\n Release(_platformBuffer: PlatformBuffer) {\n throw new NotImplementedOnRNWeb();\n }\n}\n"],"mappings":";;;;;;AAIA,IAAAA,KAAA,GAAAC,OAAA;AAEO,MAAMC,0BAA0B,SAC7BC,UAAI,CAEd;EACEC,WAAWA,CAACC,SAAoB,EAAE;IAChC,KAAK,CAACA,SAAS,CAAC;EAClB;EAEAC,aAAaA,CAACC,MAAe,EAAkB;IAC7C,MAAM,IAAIC,2BAAqB,CAAC,CAAC;EACnC;EAEAC,OAAOA,CAACC,eAA+B,EAAE;IACvC,MAAM,IAAIF,2BAAqB,CAAC,CAAC;EACnC;AACF;AAACG,OAAA,CAAAT,0BAAA,GAAAA,0BAAA"}
@@ -1,12 +0,0 @@
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
- }
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=PlatformBufferFactory.js.map
@@ -1 +0,0 @@
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":""}
@@ -1 +0,0 @@
1
- export * from "./PlatformBufferFactory";
@@ -1,2 +0,0 @@
1
- export * from "./PlatformBufferFactory";
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./PlatformBufferFactory\";\n"],"mappings":"AAAA,cAAc,yBAAyB"}
@@ -1,8 +0,0 @@
1
- import type { CanvasKit } from "canvaskit-wasm";
2
- import type { PlatformBuffer, PlatformBufferFactory, SkImage } from "../types";
3
- import { Host } from "./Host";
4
- export declare class JsiSkPlatformBufferFactory extends Host implements PlatformBufferFactory {
5
- constructor(CanvasKit: CanvasKit);
6
- MakeFromImage(_image: SkImage): PlatformBuffer;
7
- Release(_platformBuffer: PlatformBuffer): void;
8
- }
@@ -1,13 +0,0 @@
1
- import { Host, NotImplementedOnRNWeb } from "./Host";
2
- export class JsiSkPlatformBufferFactory extends Host {
3
- constructor(CanvasKit) {
4
- super(CanvasKit);
5
- }
6
- MakeFromImage(_image) {
7
- throw new NotImplementedOnRNWeb();
8
- }
9
- Release(_platformBuffer) {
10
- throw new NotImplementedOnRNWeb();
11
- }
12
- }
13
- //# sourceMappingURL=JsiSkPlatformBufferFactory.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["Host","NotImplementedOnRNWeb","JsiSkPlatformBufferFactory","constructor","CanvasKit","MakeFromImage","_image","Release","_platformBuffer"],"sources":["JsiSkPlatformBufferFactory.ts"],"sourcesContent":["import type { CanvasKit } from \"canvaskit-wasm\";\n\nimport type { PlatformBuffer, PlatformBufferFactory, SkImage } from \"../types\";\n\nimport { Host, NotImplementedOnRNWeb } from \"./Host\";\n\nexport class JsiSkPlatformBufferFactory\n extends Host\n implements PlatformBufferFactory\n{\n constructor(CanvasKit: CanvasKit) {\n super(CanvasKit);\n }\n\n MakeFromImage(_image: SkImage): PlatformBuffer {\n throw new NotImplementedOnRNWeb();\n }\n\n Release(_platformBuffer: PlatformBuffer) {\n throw new NotImplementedOnRNWeb();\n }\n}\n"],"mappings":"AAIA,SAASA,IAAI,EAAEC,qBAAqB,QAAQ,QAAQ;AAEpD,OAAO,MAAMC,0BAA0B,SAC7BF,IAAI,CAEd;EACEG,WAAWA,CAACC,SAAoB,EAAE;IAChC,KAAK,CAACA,SAAS,CAAC;EAClB;EAEAC,aAAaA,CAACC,MAAe,EAAkB;IAC7C,MAAM,IAAIL,qBAAqB,CAAC,CAAC;EACnC;EAEAM,OAAOA,CAACC,eAA+B,EAAE;IACvC,MAAM,IAAIP,qBAAqB,CAAC,CAAC;EACnC;AACF"}
@@ -1,12 +0,0 @@
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
- }
@@ -1 +0,0 @@
1
- export * from "./PlatformBufferFactory";
@@ -1,8 +0,0 @@
1
- import type { CanvasKit } from "canvaskit-wasm";
2
- import type { PlatformBuffer, PlatformBufferFactory, SkImage } from "../types";
3
- import { Host } from "./Host";
4
- export declare class JsiSkPlatformBufferFactory extends Host implements PlatformBufferFactory {
5
- constructor(CanvasKit: CanvasKit);
6
- MakeFromImage(_image: SkImage): PlatformBuffer;
7
- Release(_platformBuffer: PlatformBuffer): void;
8
- }
@@ -1,14 +0,0 @@
1
- import type { SkImage } from "../Image";
2
-
3
- export type PlatformBuffer = bigint;
4
-
5
- export interface PlatformBufferFactory {
6
- /**
7
- * Copy pixels to a platform buffer. (for testing purposes)
8
- */
9
- MakeFromImage: (image: SkImage) => PlatformBuffer;
10
- /**
11
- * Release a platform buffer that was created with `MakeFromImage`.
12
- */
13
- Release: (platformBuffer: PlatformBuffer) => void;
14
- }
@@ -1 +0,0 @@
1
- export * from "./PlatformBufferFactory";
@@ -1,22 +0,0 @@
1
- import type { CanvasKit } from "canvaskit-wasm";
2
-
3
- import type { PlatformBuffer, PlatformBufferFactory, SkImage } from "../types";
4
-
5
- import { Host, NotImplementedOnRNWeb } from "./Host";
6
-
7
- export class JsiSkPlatformBufferFactory
8
- extends Host
9
- implements PlatformBufferFactory
10
- {
11
- constructor(CanvasKit: CanvasKit) {
12
- super(CanvasKit);
13
- }
14
-
15
- MakeFromImage(_image: SkImage): PlatformBuffer {
16
- throw new NotImplementedOnRNWeb();
17
- }
18
-
19
- Release(_platformBuffer: PlatformBuffer) {
20
- throw new NotImplementedOnRNWeb();
21
- }
22
- }