@shopify/react-native-skia 0.1.141 → 0.1.145
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/cpp/rnskia-android/RNSkDrawViewImpl.cpp +2 -2
- package/android/cpp/rnskia-android/RNSkDrawViewImpl.h +1 -1
- package/android/cpp/rnskia-android/SkiaOpenGLRenderer.cpp +15 -16
- package/android/cpp/rnskia-android/SkiaOpenGLRenderer.h +2 -2
- package/android/src/main/java/com/shopify/reactnative/skia/SkiaDrawView.java +69 -27
- package/cpp/api/JsiSkPaint.h +6 -0
- package/cpp/api/JsiSkPathFactory.h +1 -1
- package/cpp/api/JsiSkPicture.h +7 -1
- package/cpp/rnskia/RNSkDrawView.cpp +66 -66
- package/cpp/rnskia/RNSkDrawView.h +22 -6
- package/cpp/rnskia/RNSkJsiViewApi.h +2 -2
- package/cpp/rnskia/values/RNSkComputedValue.h +10 -7
- package/cpp/rnskia/values/RNSkReadonlyValue.h +21 -2
- package/cpp/rnskia/values/RNSkValue.h +1 -0
- package/ios/RNSkia-iOS/RNSkDrawViewImpl.h +1 -1
- package/ios/RNSkia-iOS/RNSkDrawViewImpl.mm +2 -2
- package/ios/RNSkia-iOS/SkiaDrawView.mm +4 -0
- package/lib/commonjs/mock/index.js +3 -1
- package/lib/commonjs/mock/index.js.map +1 -1
- package/lib/commonjs/renderer/Canvas.js +17 -7
- package/lib/commonjs/renderer/Canvas.js.map +1 -1
- package/lib/commonjs/renderer/DependencyManager.js +144 -36
- package/lib/commonjs/renderer/DependencyManager.js.map +1 -1
- package/lib/commonjs/renderer/HostConfig.js +1 -1
- package/lib/commonjs/renderer/HostConfig.js.map +1 -1
- package/lib/commonjs/renderer/components/Blend.js +20 -5
- package/lib/commonjs/renderer/components/Blend.js.map +1 -1
- package/lib/commonjs/renderer/components/backdrop/BackdropFilter.js.map +1 -1
- package/lib/commonjs/renderer/components/imageFilters/Morphology.js +1 -1
- package/lib/commonjs/renderer/components/imageFilters/Morphology.js.map +1 -1
- package/lib/commonjs/renderer/components/imageFilters/Shadow.js +1 -1
- package/lib/commonjs/renderer/components/imageFilters/Shadow.js.map +1 -1
- package/lib/commonjs/renderer/nodes/Declaration.js +2 -3
- package/lib/commonjs/renderer/nodes/Declaration.js.map +1 -1
- package/lib/commonjs/renderer/nodes/Drawing.js +3 -7
- package/lib/commonjs/renderer/nodes/Drawing.js.map +1 -1
- package/lib/commonjs/renderer/nodes/Node.js +9 -7
- package/lib/commonjs/renderer/nodes/Node.js.map +1 -1
- package/lib/commonjs/renderer/processors/Animations/Animations.js +14 -20
- package/lib/commonjs/renderer/processors/Animations/Animations.js.map +1 -1
- package/lib/commonjs/skia/core/Data.js +10 -22
- package/lib/commonjs/skia/core/Data.js.map +1 -1
- package/lib/commonjs/skia/core/Font.js +2 -3
- package/lib/commonjs/skia/core/Font.js.map +1 -1
- package/lib/commonjs/skia/core/Image.js.map +1 -1
- package/lib/commonjs/skia/core/SVG.js.map +1 -1
- package/lib/commonjs/skia/core/Typeface.js.map +1 -1
- package/lib/commonjs/skia/types/Data/Data.js +5 -0
- package/lib/commonjs/skia/types/Data/Data.js.map +1 -1
- package/lib/commonjs/skia/types/Paint/Paint.js.map +1 -1
- package/lib/commonjs/skia/web/Host.js +12 -21
- package/lib/commonjs/skia/web/Host.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkCanvas.js +50 -28
- package/lib/commonjs/skia/web/JsiSkCanvas.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkColorFilterFactory.js +4 -4
- package/lib/commonjs/skia/web/JsiSkColorFilterFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkFont.js +7 -3
- package/lib/commonjs/skia/web/JsiSkFont.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkImage.js +4 -2
- package/lib/commonjs/skia/web/JsiSkImage.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkImageFactory.js +4 -2
- package/lib/commonjs/skia/web/JsiSkImageFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkImageFilterFactory.js +61 -19
- package/lib/commonjs/skia/web/JsiSkImageFilterFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkMatrix.js +1 -1
- package/lib/commonjs/skia/web/JsiSkMatrix.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPaint.js +19 -6
- package/lib/commonjs/skia/web/JsiSkPaint.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPath.js +16 -60
- package/lib/commonjs/skia/web/JsiSkPath.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPathEffectFactory.js +7 -3
- package/lib/commonjs/skia/web/JsiSkPathEffectFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPathFactory.js +1 -1
- package/lib/commonjs/skia/web/JsiSkPathFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPicture.js +5 -1
- package/lib/commonjs/skia/web/JsiSkPicture.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPictureRecorder.js +3 -1
- package/lib/commonjs/skia/web/JsiSkPictureRecorder.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPoint.js +9 -1
- package/lib/commonjs/skia/web/JsiSkPoint.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkRRect.js +9 -1
- package/lib/commonjs/skia/web/JsiSkRRect.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkRSXform.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkRect.js +3 -3
- package/lib/commonjs/skia/web/JsiSkRect.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkRuntimeEffect.js +4 -2
- package/lib/commonjs/skia/web/JsiSkRuntimeEffect.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkShaderFactory.js +10 -6
- package/lib/commonjs/skia/web/JsiSkShaderFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkSurface.js +3 -1
- package/lib/commonjs/skia/web/JsiSkSurface.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkTextBlobFactory.js +8 -4
- package/lib/commonjs/skia/web/JsiSkTextBlobFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkTypefaceFactory.js +1 -1
- package/lib/commonjs/skia/web/JsiSkTypefaceFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkia.js +12 -6
- package/lib/commonjs/skia/web/JsiSkia.js.map +1 -1
- package/lib/commonjs/values/hooks/useComputedValue.js +6 -2
- package/lib/commonjs/values/hooks/useComputedValue.js.map +1 -1
- package/lib/commonjs/values/index.js +13 -0
- package/lib/commonjs/values/index.js.map +1 -1
- package/lib/commonjs/values/selector.js +24 -0
- package/lib/commonjs/values/selector.js.map +1 -0
- package/lib/commonjs/values/web/RNSkComputedValue.js +8 -0
- package/lib/commonjs/values/web/RNSkComputedValue.js.map +1 -1
- package/lib/commonjs/values/web/RNSkReadonlyValue.js +4 -0
- package/lib/commonjs/values/web/RNSkReadonlyValue.js.map +1 -1
- package/lib/module/mock/index.js +2 -1
- package/lib/module/mock/index.js.map +1 -1
- package/lib/module/renderer/Canvas.js +17 -6
- package/lib/module/renderer/Canvas.js.map +1 -1
- package/lib/module/renderer/DependencyManager.js +141 -34
- package/lib/module/renderer/DependencyManager.js.map +1 -1
- package/lib/module/renderer/HostConfig.js +1 -1
- package/lib/module/renderer/HostConfig.js.map +1 -1
- package/lib/module/renderer/components/Blend.js +21 -5
- package/lib/module/renderer/components/Blend.js.map +1 -1
- package/lib/module/renderer/components/backdrop/BackdropFilter.js.map +1 -1
- package/lib/module/renderer/components/imageFilters/Morphology.js +1 -1
- package/lib/module/renderer/components/imageFilters/Morphology.js.map +1 -1
- package/lib/module/renderer/components/imageFilters/Shadow.js +1 -1
- package/lib/module/renderer/components/imageFilters/Shadow.js.map +1 -1
- package/lib/module/renderer/nodes/Declaration.js +3 -4
- package/lib/module/renderer/nodes/Declaration.js.map +1 -1
- package/lib/module/renderer/nodes/Drawing.js +3 -6
- package/lib/module/renderer/nodes/Drawing.js.map +1 -1
- package/lib/module/renderer/nodes/Node.js +9 -7
- package/lib/module/renderer/nodes/Node.js.map +1 -1
- package/lib/module/renderer/processors/Animations/Animations.js +9 -15
- package/lib/module/renderer/processors/Animations/Animations.js.map +1 -1
- package/lib/module/skia/core/Data.js +10 -20
- package/lib/module/skia/core/Data.js.map +1 -1
- package/lib/module/skia/core/Font.js +2 -3
- package/lib/module/skia/core/Font.js.map +1 -1
- package/lib/module/skia/core/Image.js.map +1 -1
- package/lib/module/skia/core/SVG.js.map +1 -1
- package/lib/module/skia/core/Typeface.js.map +1 -1
- package/lib/module/skia/types/Data/Data.js +1 -1
- package/lib/module/skia/types/Data/Data.js.map +1 -1
- package/lib/module/skia/types/Paint/Paint.js.map +1 -1
- package/lib/module/skia/web/Host.js +9 -9
- package/lib/module/skia/web/Host.js.map +1 -1
- package/lib/module/skia/web/JsiSkCanvas.js +40 -29
- package/lib/module/skia/web/JsiSkCanvas.js.map +1 -1
- package/lib/module/skia/web/JsiSkColorFilterFactory.js +5 -5
- package/lib/module/skia/web/JsiSkColorFilterFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkFont.js +6 -4
- package/lib/module/skia/web/JsiSkFont.js.map +1 -1
- package/lib/module/skia/web/JsiSkImage.js +4 -3
- package/lib/module/skia/web/JsiSkImage.js.map +1 -1
- package/lib/module/skia/web/JsiSkImageFactory.js +4 -3
- package/lib/module/skia/web/JsiSkImageFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkImageFilterFactory.js +61 -20
- package/lib/module/skia/web/JsiSkImageFilterFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkMatrix.js +2 -2
- package/lib/module/skia/web/JsiSkMatrix.js.map +1 -1
- package/lib/module/skia/web/JsiSkPaint.js +15 -7
- package/lib/module/skia/web/JsiSkPaint.js.map +1 -1
- package/lib/module/skia/web/JsiSkPath.js +15 -62
- package/lib/module/skia/web/JsiSkPath.js.map +1 -1
- package/lib/module/skia/web/JsiSkPathEffectFactory.js +6 -4
- package/lib/module/skia/web/JsiSkPathEffectFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkPathFactory.js +2 -2
- package/lib/module/skia/web/JsiSkPathFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkPicture.js +4 -2
- package/lib/module/skia/web/JsiSkPicture.js.map +1 -1
- package/lib/module/skia/web/JsiSkPictureRecorder.js +3 -2
- package/lib/module/skia/web/JsiSkPictureRecorder.js.map +1 -1
- package/lib/module/skia/web/JsiSkPoint.js +10 -2
- package/lib/module/skia/web/JsiSkPoint.js.map +1 -1
- package/lib/module/skia/web/JsiSkRRect.js +10 -2
- package/lib/module/skia/web/JsiSkRRect.js.map +1 -1
- package/lib/module/skia/web/JsiSkRSXform.js.map +1 -1
- package/lib/module/skia/web/JsiSkRect.js +4 -4
- package/lib/module/skia/web/JsiSkRect.js.map +1 -1
- package/lib/module/skia/web/JsiSkRuntimeEffect.js +4 -3
- package/lib/module/skia/web/JsiSkRuntimeEffect.js.map +1 -1
- package/lib/module/skia/web/JsiSkShaderFactory.js +9 -7
- package/lib/module/skia/web/JsiSkShaderFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkSurface.js +3 -2
- package/lib/module/skia/web/JsiSkSurface.js.map +1 -1
- package/lib/module/skia/web/JsiSkTextBlobFactory.js +7 -5
- package/lib/module/skia/web/JsiSkTextBlobFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkTypefaceFactory.js +2 -2
- package/lib/module/skia/web/JsiSkTypefaceFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkia.js +10 -5
- package/lib/module/skia/web/JsiSkia.js.map +1 -1
- package/lib/module/values/hooks/useComputedValue.js +7 -3
- package/lib/module/values/hooks/useComputedValue.js.map +1 -1
- package/lib/module/values/index.js +1 -0
- package/lib/module/values/index.js.map +1 -1
- package/lib/module/values/selector.js +15 -0
- package/lib/module/values/selector.js.map +1 -0
- package/lib/module/values/web/RNSkComputedValue.js +8 -0
- package/lib/module/values/web/RNSkComputedValue.js.map +1 -1
- package/lib/module/values/web/RNSkReadonlyValue.js +4 -0
- package/lib/module/values/web/RNSkReadonlyValue.js.map +1 -1
- package/lib/typescript/src/renderer/Canvas.d.ts +1 -1
- package/lib/typescript/src/renderer/DependencyManager.d.ts +40 -14
- package/lib/typescript/src/renderer/nodes/Declaration.d.ts +2 -2
- package/lib/typescript/src/renderer/nodes/Drawing.d.ts +2 -2
- package/lib/typescript/src/renderer/nodes/Node.d.ts +3 -2
- package/lib/typescript/src/renderer/processors/Animations/Animations.d.ts +7 -3
- package/lib/typescript/src/skia/core/Data.d.ts +3 -5
- package/lib/typescript/src/skia/core/Font.d.ts +2 -2
- package/lib/typescript/src/skia/core/Image.d.ts +2 -2
- package/lib/typescript/src/skia/core/SVG.d.ts +2 -2
- package/lib/typescript/src/skia/core/Typeface.d.ts +2 -2
- package/lib/typescript/src/skia/types/Data/Data.d.ts +10 -3
- package/lib/typescript/src/skia/types/Paint/Paint.d.ts +5 -0
- package/lib/typescript/src/skia/types/Picture/Picture.d.ts +2 -1
- package/lib/typescript/src/skia/web/Host.d.ts +6 -8
- package/lib/typescript/src/skia/web/JsiSkImageFilterFactory.d.ts +8 -8
- package/lib/typescript/src/skia/web/JsiSkPaint.d.ts +1 -0
- package/lib/typescript/src/skia/web/JsiSkPoint.d.ts +3 -2
- package/lib/typescript/src/skia/web/JsiSkRRect.d.ts +3 -2
- package/lib/typescript/src/skia/web/JsiSkRSXform.d.ts +1 -2
- package/lib/typescript/src/skia/web/JsiSkRect.d.ts +3 -3
- package/lib/typescript/src/skia/web/JsiSkTextBlobFactory.d.ts +2 -1
- package/lib/typescript/src/values/index.d.ts +1 -0
- package/lib/typescript/src/values/selector.d.ts +14 -0
- package/lib/typescript/src/values/types.d.ts +4 -0
- package/lib/typescript/src/values/web/RNSkComputedValue.d.ts +1 -0
- package/lib/typescript/src/values/web/RNSkReadonlyValue.d.ts +1 -0
- package/libs/ios/libskia.xcframework/Info.plist +5 -5
- package/libs/ios/libskia.xcframework/ios-arm64_arm64e/libskia.a +0 -0
- package/libs/ios/libskia.xcframework/ios-arm64_arm64e_x86_64-simulator/libskia.a +0 -0
- package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e/libskshaper.a +0 -0
- package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e_x86_64-simulator/libskshaper.a +0 -0
- package/libs/ios/libsvg.xcframework/ios-arm64_arm64e/libsvg.a +0 -0
- package/libs/ios/libsvg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsvg.a +0 -0
- package/package.json +3 -3
- package/src/mock/index.ts +2 -1
- package/src/renderer/Canvas.tsx +19 -7
- package/src/renderer/DependencyManager.tsx +171 -37
- package/src/renderer/HostConfig.ts +1 -1
- package/src/renderer/components/Blend.tsx +25 -5
- package/src/renderer/components/backdrop/BackdropFilter.tsx +1 -1
- package/src/renderer/components/imageFilters/Morphology.tsx +2 -2
- package/src/renderer/components/imageFilters/Shadow.tsx +2 -2
- package/src/renderer/nodes/Declaration.tsx +6 -8
- package/src/renderer/nodes/Drawing.tsx +5 -7
- package/src/renderer/nodes/Node.ts +11 -9
- package/src/renderer/processors/Animations/Animations.ts +23 -14
- package/src/skia/core/Data.ts +20 -51
- package/src/skia/core/Font.ts +4 -5
- package/src/skia/core/Image.ts +2 -2
- package/src/skia/core/SVG.ts +2 -2
- package/src/skia/core/Typeface.ts +2 -2
- package/src/skia/types/Data/Data.ts +11 -1
- package/src/skia/types/Paint/Paint.ts +6 -0
- package/src/skia/types/Picture/Picture.ts +2 -1
- package/src/skia/web/Host.ts +12 -22
- package/src/skia/web/JsiSkCanvas.ts +99 -56
- package/src/skia/web/JsiSkColorFilterFactory.ts +15 -5
- package/src/skia/web/JsiSkFont.ts +11 -4
- package/src/skia/web/JsiSkImage.ts +4 -3
- package/src/skia/web/JsiSkImageFactory.ts +6 -3
- package/src/skia/web/JsiSkImageFilterFactory.ts +124 -52
- package/src/skia/web/JsiSkMatrix.ts +4 -2
- package/src/skia/web/JsiSkPaint.ts +15 -7
- package/src/skia/web/JsiSkPath.ts +30 -56
- package/src/skia/web/JsiSkPathEffectFactory.ts +10 -5
- package/src/skia/web/JsiSkPathFactory.ts +3 -3
- package/src/skia/web/JsiSkPicture.ts +5 -3
- package/src/skia/web/JsiSkPictureRecorder.ts +3 -2
- package/src/skia/web/JsiSkPoint.ts +12 -2
- package/src/skia/web/JsiSkRRect.ts +16 -2
- package/src/skia/web/JsiSkRSXform.ts +1 -1
- package/src/skia/web/JsiSkRect.ts +4 -7
- package/src/skia/web/JsiSkRuntimeEffect.ts +9 -4
- package/src/skia/web/JsiSkShaderFactory.ts +24 -15
- package/src/skia/web/JsiSkSurface.ts +7 -2
- package/src/skia/web/JsiSkTextBlobFactory.ts +14 -8
- package/src/skia/web/JsiSkTypefaceFactory.tsx +4 -2
- package/src/skia/web/JsiSkia.ts +17 -5
- package/src/values/hooks/useComputedValue.ts +6 -3
- package/src/values/index.ts +1 -0
- package/src/values/selector.ts +24 -0
- package/src/values/types.ts +4 -0
- package/src/values/web/RNSkComputedValue.ts +6 -0
- package/src/values/web/RNSkReadonlyValue.ts +4 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Skia } from "../Skia";
|
|
2
|
-
import type {
|
|
2
|
+
import type { DataSourceParam } from "../types";
|
|
3
3
|
|
|
4
4
|
import { useRawData } from "./Data";
|
|
5
5
|
|
|
@@ -9,6 +9,6 @@ const tfFactory = Skia.Typeface.MakeFreeTypeFaceFromData.bind(Skia.Typeface);
|
|
|
9
9
|
* Returns a Skia Typeface object
|
|
10
10
|
* */
|
|
11
11
|
export const useTypeface = (
|
|
12
|
-
source:
|
|
12
|
+
source: DataSourceParam,
|
|
13
13
|
onError?: (err: Error) => void
|
|
14
14
|
) => useRawData(source, tfFactory, onError);
|
|
@@ -2,4 +2,14 @@ import type { SkJSIInstance } from "../JsiInstance";
|
|
|
2
2
|
|
|
3
3
|
export type SkData = SkJSIInstance<"Data">;
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
type RNModule = number;
|
|
6
|
+
type ESModule = {
|
|
7
|
+
__esModule: true;
|
|
8
|
+
default: string;
|
|
9
|
+
};
|
|
10
|
+
export type DataModule = RNModule | ESModule;
|
|
11
|
+
export type DataSource = DataModule | string | Uint8Array;
|
|
12
|
+
export type DataSourceParam = DataSource | null | undefined;
|
|
13
|
+
|
|
14
|
+
export const isRNModule = (mod: DataModule): mod is RNModule =>
|
|
15
|
+
typeof mod === "number";
|
|
@@ -34,6 +34,12 @@ export interface SkPaint extends SkJSIInstance<"Paint"> {
|
|
|
34
34
|
*/
|
|
35
35
|
copy(): SkPaint;
|
|
36
36
|
|
|
37
|
+
/**
|
|
38
|
+
* Sets all SkPaint contents to their initial values. This is equivalent to replacing
|
|
39
|
+
SkPaint with the result of SkPaint().
|
|
40
|
+
*/
|
|
41
|
+
reset(): void;
|
|
42
|
+
|
|
37
43
|
/**
|
|
38
44
|
* Retrieves the alpha and RGB unpremultiplied. RGB are extended sRGB values
|
|
39
45
|
* (sRGB gamut, and encoded with the sRGB transfer function).
|
|
@@ -3,8 +3,9 @@ import type { TileMode } from "../ImageFilter";
|
|
|
3
3
|
import type { SkRect } from "../Rect";
|
|
4
4
|
import type { SkShader } from "../Shader";
|
|
5
5
|
import type { SkMatrix } from "../Matrix";
|
|
6
|
+
import type { SkJSIInstance } from "../JsiInstance";
|
|
6
7
|
|
|
7
|
-
export interface SkPicture {
|
|
8
|
+
export interface SkPicture extends SkJSIInstance<"Picture"> {
|
|
8
9
|
/**
|
|
9
10
|
* Returns a new shader that will draw with this picture.
|
|
10
11
|
*
|
package/src/skia/web/Host.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
/* eslint-disable no-nested-ternary */
|
|
2
1
|
import type { CanvasKit, EmbindEnumEntity } from "canvaskit-wasm";
|
|
3
2
|
|
|
4
3
|
import type { SkJSIInstance } from "../types";
|
|
5
4
|
|
|
6
5
|
export class NotImplementedOnRNWeb extends Error {
|
|
7
|
-
constructor() {
|
|
8
|
-
super("Not implemented on React Native Web");
|
|
6
|
+
constructor(msg?: string) {
|
|
7
|
+
super(msg ?? "Not implemented on React Native Web");
|
|
9
8
|
}
|
|
10
9
|
}
|
|
11
10
|
|
|
@@ -17,12 +16,12 @@ export abstract class Host {
|
|
|
17
16
|
}
|
|
18
17
|
}
|
|
19
18
|
|
|
20
|
-
export abstract class
|
|
19
|
+
export abstract class BaseHostObject<T, N extends string>
|
|
21
20
|
extends Host
|
|
22
21
|
implements SkJSIInstance<N>
|
|
23
22
|
{
|
|
24
23
|
readonly __typename__: N;
|
|
25
|
-
|
|
24
|
+
ref: T;
|
|
26
25
|
|
|
27
26
|
constructor(CanvasKit: CanvasKit, ref: T, typename: N) {
|
|
28
27
|
super(CanvasKit);
|
|
@@ -31,23 +30,14 @@ export abstract class HostObject<T, N extends string>
|
|
|
31
30
|
}
|
|
32
31
|
}
|
|
33
32
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
value:
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
export const toUndefinedableValue = <T>(
|
|
43
|
-
value: NonNullish | undefined
|
|
44
|
-
): T | undefined => (value === undefined ? undefined : toValue(value));
|
|
45
|
-
|
|
46
|
-
export const toNullableValue = <T>(value: NonNullish | null): T | null =>
|
|
47
|
-
value === null ? null : toValue(value);
|
|
48
|
-
|
|
49
|
-
export const toValue = <T>(value: NonNullish): T =>
|
|
50
|
-
(value as HostObject<T, string>).ref;
|
|
33
|
+
export abstract class HostObject<T, N extends string> extends BaseHostObject<
|
|
34
|
+
T,
|
|
35
|
+
N
|
|
36
|
+
> {
|
|
37
|
+
static fromValue<T>(value: SkJSIInstance<string>) {
|
|
38
|
+
return (value as HostObject<T, string>).ref;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
51
41
|
|
|
52
42
|
export const ckEnum = (value: number): EmbindEnumEntity => ({ value });
|
|
53
43
|
export const optEnum = (
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Canvas,
|
|
1
|
+
import type { Canvas, CanvasKit } from "canvaskit-wasm";
|
|
2
2
|
|
|
3
3
|
import type {
|
|
4
4
|
BlendMode,
|
|
@@ -24,14 +24,19 @@ import type {
|
|
|
24
24
|
SkVertices,
|
|
25
25
|
} from "../types";
|
|
26
26
|
|
|
27
|
-
import {
|
|
28
|
-
|
|
29
|
-
HostObject,
|
|
30
|
-
toValue,
|
|
31
|
-
toUndefinedableValue,
|
|
32
|
-
toOptionalValue,
|
|
33
|
-
} from "./Host";
|
|
27
|
+
import { ckEnum, HostObject } from "./Host";
|
|
28
|
+
import { JsiSkPaint } from "./JsiSkPaint";
|
|
34
29
|
import { JsiSkRect } from "./JsiSkRect";
|
|
30
|
+
import { JsiSkRRect } from "./JsiSkRRect";
|
|
31
|
+
import { JsiSkImage } from "./JsiSkImage";
|
|
32
|
+
import { JsiSkVertices } from "./JsiSkVertices";
|
|
33
|
+
import { JsiSkPath } from "./JsiSkPath";
|
|
34
|
+
import { JsiSkFont } from "./JsiSkFont";
|
|
35
|
+
import { JsiSkTextBlob } from "./JsiSkTextBlob";
|
|
36
|
+
import { JsiSkPicture } from "./JsiSkPicture";
|
|
37
|
+
import { JsiSkMatrix } from "./JsiSkMatrix";
|
|
38
|
+
import { JsiSkImageFilter } from "./JsiSkImageFilter";
|
|
39
|
+
import { JsiSkPoint } from "./JsiSkPoint";
|
|
35
40
|
|
|
36
41
|
export class JsiSkCanvas
|
|
37
42
|
extends HostObject<Canvas, "Canvas">
|
|
@@ -43,13 +48,18 @@ export class JsiSkCanvas
|
|
|
43
48
|
|
|
44
49
|
drawRect(rect: SkRect, paint: SkPaint) {
|
|
45
50
|
this.ref.drawRect(
|
|
46
|
-
JsiSkRect.fromValue(this.CanvasKit, rect)
|
|
47
|
-
|
|
51
|
+
JsiSkRect.fromValue(this.CanvasKit, rect),
|
|
52
|
+
JsiSkPaint.fromValue(paint)
|
|
48
53
|
);
|
|
49
54
|
}
|
|
50
55
|
|
|
51
56
|
drawImage(image: SkImage, x: number, y: number, paint?: SkPaint) {
|
|
52
|
-
this.ref.drawImage(
|
|
57
|
+
this.ref.drawImage(
|
|
58
|
+
JsiSkImage.fromValue(image),
|
|
59
|
+
x,
|
|
60
|
+
y,
|
|
61
|
+
paint ? JsiSkPaint.fromValue(paint) : paint
|
|
62
|
+
);
|
|
53
63
|
}
|
|
54
64
|
|
|
55
65
|
drawImageRect(
|
|
@@ -60,10 +70,10 @@ export class JsiSkCanvas
|
|
|
60
70
|
fastSample?: boolean
|
|
61
71
|
) {
|
|
62
72
|
this.ref.drawImageRect(
|
|
63
|
-
|
|
64
|
-
JsiSkRect.fromValue(this.CanvasKit, src)
|
|
65
|
-
JsiSkRect.fromValue(this.CanvasKit, dest)
|
|
66
|
-
|
|
73
|
+
JsiSkImage.fromValue(img),
|
|
74
|
+
JsiSkRect.fromValue(this.CanvasKit, src),
|
|
75
|
+
JsiSkRect.fromValue(this.CanvasKit, dest),
|
|
76
|
+
JsiSkPaint.fromValue(paint),
|
|
67
77
|
fastSample
|
|
68
78
|
);
|
|
69
79
|
}
|
|
@@ -77,12 +87,12 @@ export class JsiSkCanvas
|
|
|
77
87
|
paint?: SkPaint | null
|
|
78
88
|
) {
|
|
79
89
|
this.ref.drawImageCubic(
|
|
80
|
-
|
|
90
|
+
JsiSkImage.fromValue(img),
|
|
81
91
|
left,
|
|
82
92
|
top,
|
|
83
93
|
B,
|
|
84
94
|
C,
|
|
85
|
-
|
|
95
|
+
paint ? JsiSkPaint.fromValue(paint) : paint
|
|
86
96
|
);
|
|
87
97
|
}
|
|
88
98
|
|
|
@@ -95,12 +105,12 @@ export class JsiSkCanvas
|
|
|
95
105
|
paint?: SkPaint | null
|
|
96
106
|
) {
|
|
97
107
|
this.ref.drawImageOptions(
|
|
98
|
-
|
|
108
|
+
JsiSkImage.fromValue(img),
|
|
99
109
|
left,
|
|
100
110
|
top,
|
|
101
111
|
ckEnum(fm),
|
|
102
112
|
ckEnum(mm),
|
|
103
|
-
|
|
113
|
+
paint ? JsiSkPaint.fromValue(paint) : paint
|
|
104
114
|
);
|
|
105
115
|
}
|
|
106
116
|
|
|
@@ -112,11 +122,11 @@ export class JsiSkCanvas
|
|
|
112
122
|
paint?: SkPaint | null
|
|
113
123
|
) {
|
|
114
124
|
this.ref.drawImageNine(
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
125
|
+
JsiSkImage.fromValue(img),
|
|
126
|
+
Array.from(JsiSkRect.fromValue(this.CanvasKit, center)),
|
|
127
|
+
JsiSkRect.fromValue(this.CanvasKit, dest),
|
|
118
128
|
ckEnum(filter),
|
|
119
|
-
|
|
129
|
+
paint ? JsiSkPaint.fromValue(paint) : paint
|
|
120
130
|
);
|
|
121
131
|
}
|
|
122
132
|
|
|
@@ -129,12 +139,12 @@ export class JsiSkCanvas
|
|
|
129
139
|
paint?: SkPaint | null
|
|
130
140
|
) {
|
|
131
141
|
this.ref.drawImageRectCubic(
|
|
132
|
-
|
|
133
|
-
JsiSkRect.fromValue(this.CanvasKit, src)
|
|
134
|
-
JsiSkRect.fromValue(this.CanvasKit, dest)
|
|
142
|
+
JsiSkImage.fromValue(img),
|
|
143
|
+
JsiSkRect.fromValue(this.CanvasKit, src),
|
|
144
|
+
JsiSkRect.fromValue(this.CanvasKit, dest),
|
|
135
145
|
B,
|
|
136
146
|
C,
|
|
137
|
-
|
|
147
|
+
paint ? JsiSkPaint.fromValue(paint) : paint
|
|
138
148
|
);
|
|
139
149
|
}
|
|
140
150
|
|
|
@@ -147,29 +157,33 @@ export class JsiSkCanvas
|
|
|
147
157
|
paint?: SkPaint | null
|
|
148
158
|
) {
|
|
149
159
|
this.ref.drawImageRectOptions(
|
|
150
|
-
|
|
151
|
-
JsiSkRect.fromValue(this.CanvasKit, src)
|
|
152
|
-
JsiSkRect.fromValue(this.CanvasKit, dest)
|
|
160
|
+
JsiSkImage.fromValue(img),
|
|
161
|
+
JsiSkRect.fromValue(this.CanvasKit, src),
|
|
162
|
+
JsiSkRect.fromValue(this.CanvasKit, dest),
|
|
153
163
|
ckEnum(fm),
|
|
154
164
|
ckEnum(mm),
|
|
155
|
-
|
|
165
|
+
paint ? JsiSkPaint.fromValue(paint) : paint
|
|
156
166
|
);
|
|
157
167
|
}
|
|
158
168
|
|
|
159
169
|
drawPaint(paint: SkPaint) {
|
|
160
|
-
this.ref.drawPaint(
|
|
170
|
+
this.ref.drawPaint(JsiSkPaint.fromValue(paint));
|
|
161
171
|
}
|
|
162
172
|
|
|
163
173
|
drawLine(x0: number, y0: number, x1: number, y1: number, paint: SkPaint) {
|
|
164
|
-
this.ref.drawLine(x0, y0, x1, y1,
|
|
174
|
+
this.ref.drawLine(x0, y0, x1, y1, JsiSkPaint.fromValue(paint));
|
|
165
175
|
}
|
|
166
176
|
|
|
167
177
|
drawCircle(cx: number, cy: number, radius: number, paint: SkPaint) {
|
|
168
|
-
this.ref.drawCircle(cx, cy, radius,
|
|
178
|
+
this.ref.drawCircle(cx, cy, radius, JsiSkPaint.fromValue(paint));
|
|
169
179
|
}
|
|
170
180
|
|
|
171
181
|
drawVertices(verts: SkVertices, mode: BlendMode, paint: SkPaint) {
|
|
172
|
-
this.ref.drawVertices(
|
|
182
|
+
this.ref.drawVertices(
|
|
183
|
+
JsiSkVertices.fromValue(verts),
|
|
184
|
+
ckEnum(mode),
|
|
185
|
+
JsiSkPaint.fromValue(paint)
|
|
186
|
+
);
|
|
173
187
|
}
|
|
174
188
|
|
|
175
189
|
drawPatch(
|
|
@@ -182,9 +196,9 @@ export class JsiSkCanvas
|
|
|
182
196
|
this.ref.drawPatch(
|
|
183
197
|
cubics.map(({ x, y }) => [x, y]).flat(),
|
|
184
198
|
colors,
|
|
185
|
-
|
|
199
|
+
texs ? texs.flatMap((p) => Array.from(JsiSkPoint.fromValue(p))) : texs,
|
|
186
200
|
mode ? ckEnum(mode) : null,
|
|
187
|
-
|
|
201
|
+
paint ? JsiSkPaint.fromValue(paint) : undefined
|
|
188
202
|
);
|
|
189
203
|
}
|
|
190
204
|
|
|
@@ -196,7 +210,7 @@ export class JsiSkCanvas
|
|
|
196
210
|
this.ref.drawPoints(
|
|
197
211
|
ckEnum(mode),
|
|
198
212
|
points.map(({ x, y }) => [x, y]).flat(),
|
|
199
|
-
|
|
213
|
+
JsiSkPaint.fromValue(paint)
|
|
200
214
|
);
|
|
201
215
|
}
|
|
202
216
|
|
|
@@ -208,36 +222,57 @@ export class JsiSkCanvas
|
|
|
208
222
|
paint: SkPaint
|
|
209
223
|
) {
|
|
210
224
|
this.ref.drawArc(
|
|
211
|
-
|
|
225
|
+
JsiSkRect.fromValue(this.CanvasKit, oval),
|
|
212
226
|
startAngle,
|
|
213
227
|
sweepAngle,
|
|
214
228
|
useCenter,
|
|
215
|
-
|
|
229
|
+
JsiSkPaint.fromValue(paint)
|
|
216
230
|
);
|
|
217
231
|
}
|
|
218
232
|
|
|
219
233
|
drawRRect(rrect: SkRRect, paint: SkPaint) {
|
|
220
|
-
this.ref.drawRRect(
|
|
234
|
+
this.ref.drawRRect(
|
|
235
|
+
JsiSkRRect.fromValue(this.CanvasKit, rrect),
|
|
236
|
+
JsiSkPaint.fromValue(paint)
|
|
237
|
+
);
|
|
221
238
|
}
|
|
222
239
|
|
|
223
240
|
drawDRRect(outer: SkRRect, inner: SkRRect, paint: SkPaint) {
|
|
224
|
-
this.ref.drawDRRect(
|
|
241
|
+
this.ref.drawDRRect(
|
|
242
|
+
JsiSkRRect.fromValue(this.CanvasKit, outer),
|
|
243
|
+
JsiSkRRect.fromValue(this.CanvasKit, inner),
|
|
244
|
+
JsiSkPaint.fromValue(paint)
|
|
245
|
+
);
|
|
225
246
|
}
|
|
226
247
|
|
|
227
248
|
drawOval(oval: SkRect, paint: SkPaint) {
|
|
228
|
-
this.ref.drawOval(
|
|
249
|
+
this.ref.drawOval(
|
|
250
|
+
JsiSkRect.fromValue(this.CanvasKit, oval),
|
|
251
|
+
JsiSkPaint.fromValue(paint)
|
|
252
|
+
);
|
|
229
253
|
}
|
|
230
254
|
|
|
231
255
|
drawPath(path: SkPath, paint: SkPaint) {
|
|
232
|
-
this.ref.drawPath(
|
|
256
|
+
this.ref.drawPath(JsiSkPath.fromValue(path), JsiSkPaint.fromValue(paint));
|
|
233
257
|
}
|
|
234
258
|
|
|
235
259
|
drawText(str: string, x: number, y: number, paint: SkPaint, font: SkFont) {
|
|
236
|
-
this.ref.drawText(
|
|
260
|
+
this.ref.drawText(
|
|
261
|
+
str,
|
|
262
|
+
x,
|
|
263
|
+
y,
|
|
264
|
+
JsiSkPaint.fromValue(paint),
|
|
265
|
+
JsiSkFont.fromValue(font)
|
|
266
|
+
);
|
|
237
267
|
}
|
|
238
268
|
|
|
239
269
|
drawTextBlob(blob: SkTextBlob, x: number, y: number, paint: SkPaint) {
|
|
240
|
-
this.ref.drawTextBlob(
|
|
270
|
+
this.ref.drawTextBlob(
|
|
271
|
+
JsiSkTextBlob.fromValue(blob),
|
|
272
|
+
x,
|
|
273
|
+
y,
|
|
274
|
+
JsiSkPaint.fromValue(paint)
|
|
275
|
+
);
|
|
241
276
|
}
|
|
242
277
|
|
|
243
278
|
drawGlyphs(
|
|
@@ -253,8 +288,8 @@ export class JsiSkCanvas
|
|
|
253
288
|
positions.map((p) => [p.x, p.y]).flat(),
|
|
254
289
|
x,
|
|
255
290
|
y,
|
|
256
|
-
|
|
257
|
-
|
|
291
|
+
JsiSkFont.fromValue(font),
|
|
292
|
+
JsiSkPaint.fromValue(paint)
|
|
258
293
|
);
|
|
259
294
|
}
|
|
260
295
|
|
|
@@ -273,9 +308,9 @@ export class JsiSkCanvas
|
|
|
273
308
|
flags?: SaveLayerFlag
|
|
274
309
|
) {
|
|
275
310
|
return this.ref.saveLayer(
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
311
|
+
paint ? JsiSkPaint.fromValue(paint) : undefined,
|
|
312
|
+
bounds ? JsiSkRect.fromValue(this.CanvasKit, bounds) : bounds,
|
|
313
|
+
backdrop ? JsiSkImageFilter.fromValue(backdrop) : backdrop,
|
|
279
314
|
flags
|
|
280
315
|
);
|
|
281
316
|
}
|
|
@@ -309,22 +344,30 @@ export class JsiSkCanvas
|
|
|
309
344
|
}
|
|
310
345
|
|
|
311
346
|
clipPath(path: SkPath, op: ClipOp, doAntiAlias: boolean) {
|
|
312
|
-
this.ref.clipPath(
|
|
347
|
+
this.ref.clipPath(JsiSkPath.fromValue(path), ckEnum(op), doAntiAlias);
|
|
313
348
|
}
|
|
314
349
|
|
|
315
350
|
clipRect(rect: SkRect, op: ClipOp, doAntiAlias: boolean) {
|
|
316
|
-
this.ref.clipRect(
|
|
351
|
+
this.ref.clipRect(
|
|
352
|
+
JsiSkRect.fromValue(this.CanvasKit, rect),
|
|
353
|
+
ckEnum(op),
|
|
354
|
+
doAntiAlias
|
|
355
|
+
);
|
|
317
356
|
}
|
|
318
357
|
|
|
319
358
|
clipRRect(rrect: SkRRect, op: ClipOp, doAntiAlias: boolean) {
|
|
320
|
-
this.ref.clipRRect(
|
|
359
|
+
this.ref.clipRRect(
|
|
360
|
+
JsiSkRRect.fromValue(this.CanvasKit, rrect),
|
|
361
|
+
ckEnum(op),
|
|
362
|
+
doAntiAlias
|
|
363
|
+
);
|
|
321
364
|
}
|
|
322
365
|
|
|
323
366
|
concat(m: SkMatrix) {
|
|
324
|
-
this.ref.concat(
|
|
367
|
+
this.ref.concat(JsiSkMatrix.fromValue(m));
|
|
325
368
|
}
|
|
326
369
|
|
|
327
370
|
drawPicture(skp: SkPicture) {
|
|
328
|
-
this.ref.drawPicture(
|
|
371
|
+
this.ref.drawPicture(JsiSkPicture.fromValue(skp));
|
|
329
372
|
}
|
|
330
373
|
}
|
|
@@ -8,7 +8,7 @@ import type {
|
|
|
8
8
|
BlendMode,
|
|
9
9
|
} from "../types";
|
|
10
10
|
|
|
11
|
-
import { ckEnum, Host
|
|
11
|
+
import { ckEnum, Host } from "./Host";
|
|
12
12
|
import { JsiSkColorFilter } from "./JsiSkColorFilter";
|
|
13
13
|
|
|
14
14
|
export class JsiSkColorFilterFactory
|
|
@@ -29,21 +29,28 @@ export class JsiSkColorFilterFactory
|
|
|
29
29
|
MakeBlend(color: SkColor, mode: BlendMode) {
|
|
30
30
|
return new JsiSkColorFilter(
|
|
31
31
|
this.CanvasKit,
|
|
32
|
-
this.CanvasKit.ColorFilter.MakeBlend(
|
|
32
|
+
this.CanvasKit.ColorFilter.MakeBlend(color, ckEnum(mode))
|
|
33
33
|
);
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
MakeCompose(outer: SkColorFilter, inner: SkColorFilter) {
|
|
37
37
|
return new JsiSkColorFilter(
|
|
38
38
|
this.CanvasKit,
|
|
39
|
-
this.CanvasKit.ColorFilter.MakeCompose(
|
|
39
|
+
this.CanvasKit.ColorFilter.MakeCompose(
|
|
40
|
+
JsiSkColorFilter.fromValue(outer),
|
|
41
|
+
JsiSkColorFilter.fromValue(inner)
|
|
42
|
+
)
|
|
40
43
|
);
|
|
41
44
|
}
|
|
42
45
|
|
|
43
46
|
MakeLerp(t: number, dst: SkColorFilter, src: SkColorFilter) {
|
|
44
47
|
return new JsiSkColorFilter(
|
|
45
48
|
this.CanvasKit,
|
|
46
|
-
this.CanvasKit.ColorFilter.MakeLerp(
|
|
49
|
+
this.CanvasKit.ColorFilter.MakeLerp(
|
|
50
|
+
t,
|
|
51
|
+
JsiSkColorFilter.fromValue(dst),
|
|
52
|
+
JsiSkColorFilter.fromValue(src)
|
|
53
|
+
)
|
|
47
54
|
);
|
|
48
55
|
}
|
|
49
56
|
|
|
@@ -62,6 +69,9 @@ export class JsiSkColorFilterFactory
|
|
|
62
69
|
}
|
|
63
70
|
|
|
64
71
|
MakeLumaColorFilter(): SkColorFilter {
|
|
65
|
-
|
|
72
|
+
return new JsiSkColorFilter(
|
|
73
|
+
this.CanvasKit,
|
|
74
|
+
this.CanvasKit.ColorFilter.MakeLuma()
|
|
75
|
+
);
|
|
66
76
|
}
|
|
67
77
|
}
|
|
@@ -9,7 +9,9 @@ import type {
|
|
|
9
9
|
SkTypeface,
|
|
10
10
|
} from "../types";
|
|
11
11
|
|
|
12
|
-
import { HostObject,
|
|
12
|
+
import { HostObject, ckEnum } from "./Host";
|
|
13
|
+
import { JsiSkPaint } from "./JsiSkPaint";
|
|
14
|
+
import { JsiSkPoint } from "./JsiSkPoint";
|
|
13
15
|
import { JsiSkRect } from "./JsiSkRect";
|
|
14
16
|
import { JsiSkTypeface } from "./JsiSkTypeface";
|
|
15
17
|
|
|
@@ -43,7 +45,12 @@ export class JsiSkFont extends HostObject<Font, "Font"> implements SkFont {
|
|
|
43
45
|
|
|
44
46
|
// TODO: Fix return value in the C++ implementation, it return float32
|
|
45
47
|
getGlyphWidths(glyphs: number[], paint?: SkPaint | null) {
|
|
46
|
-
return [
|
|
48
|
+
return [
|
|
49
|
+
...this.ref.getGlyphWidths(
|
|
50
|
+
glyphs,
|
|
51
|
+
paint ? JsiSkPaint.fromValue(paint) : null
|
|
52
|
+
),
|
|
53
|
+
];
|
|
47
54
|
}
|
|
48
55
|
|
|
49
56
|
getGlyphIntercepts(
|
|
@@ -55,7 +62,7 @@ export class JsiSkFont extends HostObject<Font, "Font"> implements SkFont {
|
|
|
55
62
|
return [
|
|
56
63
|
...this.ref.getGlyphIntercepts(
|
|
57
64
|
glyphs,
|
|
58
|
-
positions.map((p) =>
|
|
65
|
+
positions.map((p) => Array.from(JsiSkPoint.fromValue(p))).flat(),
|
|
59
66
|
top,
|
|
60
67
|
bottom
|
|
61
68
|
),
|
|
@@ -120,6 +127,6 @@ export class JsiSkFont extends HostObject<Font, "Font"> implements SkFont {
|
|
|
120
127
|
}
|
|
121
128
|
|
|
122
129
|
setTypeface(face: SkTypeface | null) {
|
|
123
|
-
this.ref.setTypeface(face ?
|
|
130
|
+
this.ref.setTypeface(face ? JsiSkTypeface.fromValue(face) : null);
|
|
124
131
|
}
|
|
125
132
|
}
|
|
@@ -11,7 +11,8 @@ import type {
|
|
|
11
11
|
TileMode,
|
|
12
12
|
} from "../types";
|
|
13
13
|
|
|
14
|
-
import { ckEnum, HostObject
|
|
14
|
+
import { ckEnum, HostObject } from "./Host";
|
|
15
|
+
import { JsiSkMatrix } from "./JsiSkMatrix";
|
|
15
16
|
import { JsiSkShader } from "./JsiSkShader";
|
|
16
17
|
|
|
17
18
|
export class JsiSkImage extends HostObject<Image, "Image"> implements SkImage {
|
|
@@ -41,7 +42,7 @@ export class JsiSkImage extends HostObject<Image, "Image"> implements SkImage {
|
|
|
41
42
|
ckEnum(ty),
|
|
42
43
|
ckEnum(fm),
|
|
43
44
|
ckEnum(mm),
|
|
44
|
-
localMatrix ?
|
|
45
|
+
localMatrix ? JsiSkMatrix.fromValue(localMatrix) : undefined
|
|
45
46
|
)
|
|
46
47
|
);
|
|
47
48
|
}
|
|
@@ -60,7 +61,7 @@ export class JsiSkImage extends HostObject<Image, "Image"> implements SkImage {
|
|
|
60
61
|
ckEnum(ty),
|
|
61
62
|
B,
|
|
62
63
|
C,
|
|
63
|
-
localMatrix ?
|
|
64
|
+
localMatrix ? JsiSkMatrix.fromValue(localMatrix) : undefined
|
|
64
65
|
)
|
|
65
66
|
);
|
|
66
67
|
}
|
|
@@ -3,8 +3,9 @@ import type { CanvasKit } from "canvaskit-wasm";
|
|
|
3
3
|
import type { SkData, ImageInfo } from "../types";
|
|
4
4
|
import type { ImageFactory } from "../types/Image/ImageFactory";
|
|
5
5
|
|
|
6
|
-
import { Host,
|
|
6
|
+
import { Host, ckEnum } from "./Host";
|
|
7
7
|
import { JsiSkImage } from "./JsiSkImage";
|
|
8
|
+
import { JsiSkData } from "./JsiSkData";
|
|
8
9
|
|
|
9
10
|
export class JsiSkImageFactory extends Host implements ImageFactory {
|
|
10
11
|
constructor(CanvasKit: CanvasKit) {
|
|
@@ -12,7 +13,9 @@ export class JsiSkImageFactory extends Host implements ImageFactory {
|
|
|
12
13
|
}
|
|
13
14
|
|
|
14
15
|
MakeImageFromEncoded(encoded: SkData) {
|
|
15
|
-
const image = this.CanvasKit.MakeImageFromEncoded(
|
|
16
|
+
const image = this.CanvasKit.MakeImageFromEncoded(
|
|
17
|
+
JsiSkData.fromValue(encoded)
|
|
18
|
+
);
|
|
16
19
|
if (image === null) {
|
|
17
20
|
return null;
|
|
18
21
|
}
|
|
@@ -29,7 +32,7 @@ export class JsiSkImageFactory extends Host implements ImageFactory {
|
|
|
29
32
|
height: info.height,
|
|
30
33
|
width: info.width,
|
|
31
34
|
},
|
|
32
|
-
|
|
35
|
+
JsiSkData.fromValue(data),
|
|
33
36
|
bytesPerRow
|
|
34
37
|
);
|
|
35
38
|
if (image === null) {
|