@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,4 +1,4 @@
|
|
|
1
|
-
import type { CanvasKit } from "canvaskit-wasm";
|
|
1
|
+
import type { CanvasKit, ImageFilter } from "canvaskit-wasm";
|
|
2
2
|
|
|
3
3
|
import type {
|
|
4
4
|
ColorChannel,
|
|
@@ -13,8 +13,9 @@ import type {
|
|
|
13
13
|
TileMode,
|
|
14
14
|
} from "../types";
|
|
15
15
|
|
|
16
|
-
import { Host, NotImplementedOnRNWeb, ckEnum
|
|
16
|
+
import { Host, NotImplementedOnRNWeb, ckEnum } from "./Host";
|
|
17
17
|
import { JsiSkImageFilter } from "./JsiSkImageFilter";
|
|
18
|
+
import { JsiSkColorFilter } from "./JsiSkColorFilter";
|
|
18
19
|
|
|
19
20
|
export class JsiSkImageFilterFactory
|
|
20
21
|
extends Host
|
|
@@ -24,26 +25,37 @@ export class JsiSkImageFilterFactory
|
|
|
24
25
|
super(CanvasKit);
|
|
25
26
|
}
|
|
26
27
|
|
|
27
|
-
MakeOffset(
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
throw new NotImplementedOnRNWeb();
|
|
28
|
+
MakeOffset(dx: number, dy: number, input: SkImageFilter | null) {
|
|
29
|
+
const inputFilter =
|
|
30
|
+
input === null ? null : JsiSkImageFilter.fromValue<ImageFilter>(input);
|
|
31
|
+
const filter = this.CanvasKit.ImageFilter.MakeOffset(dx, dy, inputFilter);
|
|
32
|
+
return new JsiSkImageFilter(this.CanvasKit, filter);
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
MakeDisplacementMap(
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
36
|
+
channelX: ColorChannel,
|
|
37
|
+
channelY: ColorChannel,
|
|
38
|
+
scale: number,
|
|
39
|
+
in1: SkImageFilter,
|
|
40
|
+
input: SkImageFilter | null
|
|
41
41
|
): SkImageFilter {
|
|
42
|
-
|
|
42
|
+
const inputFilter =
|
|
43
|
+
input === null ? null : JsiSkImageFilter.fromValue<ImageFilter>(input);
|
|
44
|
+
const filter = this.CanvasKit.ImageFilter.MakeDisplacementMap(
|
|
45
|
+
ckEnum(channelX),
|
|
46
|
+
ckEnum(channelY),
|
|
47
|
+
scale,
|
|
48
|
+
JsiSkImageFilter.fromValue(in1),
|
|
49
|
+
inputFilter
|
|
50
|
+
);
|
|
51
|
+
return new JsiSkImageFilter(this.CanvasKit, filter);
|
|
43
52
|
}
|
|
44
53
|
|
|
45
|
-
MakeShader(
|
|
46
|
-
|
|
54
|
+
MakeShader(shader: SkShader, _input: SkImageFilter | null): SkImageFilter {
|
|
55
|
+
const filter = this.CanvasKit.ImageFilter.MakeShader(
|
|
56
|
+
JsiSkImageFilter.fromValue(shader)
|
|
57
|
+
);
|
|
58
|
+
return new JsiSkImageFilter(this.CanvasKit, filter);
|
|
47
59
|
}
|
|
48
60
|
|
|
49
61
|
MakeBlur(
|
|
@@ -58,7 +70,7 @@ export class JsiSkImageFilterFactory
|
|
|
58
70
|
sigmaX,
|
|
59
71
|
sigmaY,
|
|
60
72
|
ckEnum(mode),
|
|
61
|
-
input === null ? null :
|
|
73
|
+
input === null ? null : JsiSkImageFilter.fromValue(input)
|
|
62
74
|
)
|
|
63
75
|
);
|
|
64
76
|
}
|
|
@@ -67,8 +79,8 @@ export class JsiSkImageFilterFactory
|
|
|
67
79
|
return new JsiSkImageFilter(
|
|
68
80
|
this.CanvasKit,
|
|
69
81
|
this.CanvasKit.ImageFilter.MakeColorFilter(
|
|
70
|
-
|
|
71
|
-
input === null ? null :
|
|
82
|
+
JsiSkColorFilter.fromValue(cf),
|
|
83
|
+
input === null ? null : JsiSkImageFilter.fromValue(input)
|
|
72
84
|
)
|
|
73
85
|
);
|
|
74
86
|
}
|
|
@@ -77,61 +89,121 @@ export class JsiSkImageFilterFactory
|
|
|
77
89
|
return new JsiSkImageFilter(
|
|
78
90
|
this.CanvasKit,
|
|
79
91
|
this.CanvasKit.ImageFilter.MakeCompose(
|
|
80
|
-
outer === null ? null :
|
|
81
|
-
inner === null ? null :
|
|
92
|
+
outer === null ? null : JsiSkImageFilter.fromValue(outer),
|
|
93
|
+
inner === null ? null : JsiSkImageFilter.fromValue(inner)
|
|
82
94
|
)
|
|
83
95
|
);
|
|
84
96
|
}
|
|
85
97
|
|
|
86
98
|
MakeDropShadow(
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
99
|
+
dx: number,
|
|
100
|
+
dy: number,
|
|
101
|
+
sigmaX: number,
|
|
102
|
+
sigmaY: number,
|
|
103
|
+
color: SkColor,
|
|
104
|
+
input: SkImageFilter | null,
|
|
105
|
+
cropRect?: SkRect
|
|
94
106
|
): SkImageFilter {
|
|
95
|
-
|
|
107
|
+
const inputFilter =
|
|
108
|
+
input === null ? null : JsiSkImageFilter.fromValue<ImageFilter>(input);
|
|
109
|
+
if (cropRect) {
|
|
110
|
+
throw new NotImplementedOnRNWeb(
|
|
111
|
+
"The cropRect argument is not yet supported on React Native Web."
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
const filter = this.CanvasKit.ImageFilter.MakeDropShadow(
|
|
115
|
+
dx,
|
|
116
|
+
dy,
|
|
117
|
+
sigmaX,
|
|
118
|
+
sigmaY,
|
|
119
|
+
color,
|
|
120
|
+
inputFilter
|
|
121
|
+
);
|
|
122
|
+
return new JsiSkImageFilter(this.CanvasKit, filter);
|
|
96
123
|
}
|
|
97
124
|
|
|
98
125
|
MakeDropShadowOnly(
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
126
|
+
dx: number,
|
|
127
|
+
dy: number,
|
|
128
|
+
sigmaX: number,
|
|
129
|
+
sigmaY: number,
|
|
130
|
+
color: SkColor,
|
|
131
|
+
input: SkImageFilter | null,
|
|
132
|
+
cropRect?: SkRect
|
|
106
133
|
): SkImageFilter {
|
|
107
|
-
|
|
134
|
+
const inputFilter =
|
|
135
|
+
input === null ? null : JsiSkImageFilter.fromValue<ImageFilter>(input);
|
|
136
|
+
if (cropRect) {
|
|
137
|
+
throw new NotImplementedOnRNWeb(
|
|
138
|
+
"The cropRect argument is not yet supported on React Native Web."
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
const filter = this.CanvasKit.ImageFilter.MakeDropShadowOnly(
|
|
142
|
+
dx,
|
|
143
|
+
dy,
|
|
144
|
+
sigmaX,
|
|
145
|
+
sigmaY,
|
|
146
|
+
color,
|
|
147
|
+
inputFilter
|
|
148
|
+
);
|
|
149
|
+
return new JsiSkImageFilter(this.CanvasKit, filter);
|
|
108
150
|
}
|
|
109
151
|
|
|
110
152
|
MakeErode(
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
153
|
+
rx: number,
|
|
154
|
+
ry: number,
|
|
155
|
+
input: SkImageFilter | null,
|
|
156
|
+
cropRect?: SkRect
|
|
115
157
|
): SkImageFilter {
|
|
116
|
-
|
|
158
|
+
const inputFilter =
|
|
159
|
+
input === null ? null : JsiSkImageFilter.fromValue<ImageFilter>(input);
|
|
160
|
+
if (cropRect) {
|
|
161
|
+
throw new NotImplementedOnRNWeb(
|
|
162
|
+
"The cropRect argument is not yet supported on React Native Web."
|
|
163
|
+
);
|
|
164
|
+
}
|
|
165
|
+
const filter = this.CanvasKit.ImageFilter.MakeErode(rx, ry, inputFilter);
|
|
166
|
+
return new JsiSkImageFilter(this.CanvasKit, filter);
|
|
117
167
|
}
|
|
118
168
|
|
|
119
169
|
MakeDilate(
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
170
|
+
rx: number,
|
|
171
|
+
ry: number,
|
|
172
|
+
input: SkImageFilter | null,
|
|
173
|
+
cropRect?: SkRect
|
|
124
174
|
): SkImageFilter {
|
|
125
|
-
|
|
175
|
+
const inputFilter =
|
|
176
|
+
input === null ? null : JsiSkImageFilter.fromValue<ImageFilter>(input);
|
|
177
|
+
if (cropRect) {
|
|
178
|
+
throw new NotImplementedOnRNWeb(
|
|
179
|
+
"The cropRect argument is not yet supported on React Native Web."
|
|
180
|
+
);
|
|
181
|
+
}
|
|
182
|
+
const filter = this.CanvasKit.ImageFilter.MakeDilate(rx, ry, inputFilter);
|
|
183
|
+
return new JsiSkImageFilter(this.CanvasKit, filter);
|
|
126
184
|
}
|
|
127
185
|
|
|
128
186
|
MakeBlend(
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
187
|
+
mode: BlendMode,
|
|
188
|
+
background: SkImageFilter,
|
|
189
|
+
foreground: SkImageFilter | null,
|
|
190
|
+
cropRect?: SkRect
|
|
133
191
|
): SkImageFilter {
|
|
134
|
-
|
|
192
|
+
const inputFilter =
|
|
193
|
+
foreground === null
|
|
194
|
+
? null
|
|
195
|
+
: JsiSkImageFilter.fromValue<ImageFilter>(foreground);
|
|
196
|
+
if (cropRect) {
|
|
197
|
+
throw new NotImplementedOnRNWeb(
|
|
198
|
+
"The cropRect argument is not yet supported on React Native Web."
|
|
199
|
+
);
|
|
200
|
+
}
|
|
201
|
+
const filter = this.CanvasKit.ImageFilter.MakeBlend(
|
|
202
|
+
ckEnum(mode),
|
|
203
|
+
JsiSkImageFilter.fromValue(background),
|
|
204
|
+
inputFilter
|
|
205
|
+
);
|
|
206
|
+
return new JsiSkImageFilter(this.CanvasKit, filter);
|
|
135
207
|
}
|
|
136
208
|
|
|
137
209
|
MakeRuntimeShader(
|
|
@@ -2,7 +2,7 @@ import type { CanvasKit, Matrix3x3 } from "canvaskit-wasm";
|
|
|
2
2
|
|
|
3
3
|
import type { SkMatrix } from "../types";
|
|
4
4
|
|
|
5
|
-
import { HostObject
|
|
5
|
+
import { HostObject } from "./Host";
|
|
6
6
|
|
|
7
7
|
export class JsiSkMatrix
|
|
8
8
|
extends HostObject<Matrix3x3, "Matrix">
|
|
@@ -13,7 +13,9 @@ export class JsiSkMatrix
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
concat(matrix: SkMatrix) {
|
|
16
|
-
this.ref.set(
|
|
16
|
+
this.ref.set(
|
|
17
|
+
this.CanvasKit.Matrix.multiply(this.ref, JsiSkMatrix.fromValue(matrix))
|
|
18
|
+
);
|
|
17
19
|
}
|
|
18
20
|
|
|
19
21
|
translate(x: number, y: number) {
|
|
@@ -14,11 +14,15 @@ import type {
|
|
|
14
14
|
SkPathEffect,
|
|
15
15
|
} from "../types";
|
|
16
16
|
|
|
17
|
-
import { HostObject,
|
|
17
|
+
import { HostObject, ckEnum } from "./Host";
|
|
18
|
+
import { JsiSkColorFilter } from "./JsiSkColorFilter";
|
|
19
|
+
import { JsiSkImageFilter } from "./JsiSkImageFilter";
|
|
20
|
+
import { JsiSkMaskFilter } from "./JsiSkMaskFilter";
|
|
21
|
+
import { JsiSkPathEffect } from "./JsiSkPathEffect";
|
|
22
|
+
import { JsiSkShader } from "./JsiSkShader";
|
|
18
23
|
|
|
19
24
|
export class JsiSkPaint extends HostObject<Paint, "Paint"> implements SkPaint {
|
|
20
25
|
constructor(CanvasKit: CanvasKit, ref: Paint) {
|
|
21
|
-
ref.setAntiAlias(true);
|
|
22
26
|
super(CanvasKit, ref, "Paint");
|
|
23
27
|
}
|
|
24
28
|
|
|
@@ -26,6 +30,10 @@ export class JsiSkPaint extends HostObject<Paint, "Paint"> implements SkPaint {
|
|
|
26
30
|
return new JsiSkPaint(this.CanvasKit, this.ref.copy());
|
|
27
31
|
}
|
|
28
32
|
|
|
33
|
+
reset() {
|
|
34
|
+
this.ref = new this.CanvasKit.Paint();
|
|
35
|
+
}
|
|
36
|
+
|
|
29
37
|
getColor() {
|
|
30
38
|
return this.ref.getColor();
|
|
31
39
|
}
|
|
@@ -63,23 +71,23 @@ export class JsiSkPaint extends HostObject<Paint, "Paint"> implements SkPaint {
|
|
|
63
71
|
}
|
|
64
72
|
|
|
65
73
|
setColorFilter(filter: SkColorFilter | null) {
|
|
66
|
-
this.ref.setColorFilter(
|
|
74
|
+
this.ref.setColorFilter(filter ? JsiSkColorFilter.fromValue(filter) : null);
|
|
67
75
|
}
|
|
68
76
|
|
|
69
77
|
setImageFilter(filter: SkImageFilter | null) {
|
|
70
|
-
this.ref.setImageFilter(
|
|
78
|
+
this.ref.setImageFilter(filter ? JsiSkImageFilter.fromValue(filter) : null);
|
|
71
79
|
}
|
|
72
80
|
|
|
73
81
|
setMaskFilter(filter: SkMaskFilter | null) {
|
|
74
|
-
this.ref.setMaskFilter(
|
|
82
|
+
this.ref.setMaskFilter(filter ? JsiSkMaskFilter.fromValue(filter) : null);
|
|
75
83
|
}
|
|
76
84
|
|
|
77
85
|
setPathEffect(effect: SkPathEffect | null) {
|
|
78
|
-
this.ref.setPathEffect(
|
|
86
|
+
this.ref.setPathEffect(effect ? JsiSkPathEffect.fromValue(effect) : null);
|
|
79
87
|
}
|
|
80
88
|
|
|
81
89
|
setShader(shader: SkShader | null) {
|
|
82
|
-
this.ref.setShader(
|
|
90
|
+
this.ref.setShader(shader ? JsiSkShader.fromValue(shader) : null);
|
|
83
91
|
}
|
|
84
92
|
|
|
85
93
|
setStrokeCap(cap: StrokeCap) {
|
|
@@ -13,9 +13,11 @@ import type {
|
|
|
13
13
|
StrokeOpts,
|
|
14
14
|
} from "../types";
|
|
15
15
|
|
|
16
|
-
import { ckEnum, HostObject, optEnum
|
|
16
|
+
import { ckEnum, HostObject, optEnum } from "./Host";
|
|
17
17
|
import { JsiSkPoint } from "./JsiSkPoint";
|
|
18
18
|
import { JsiSkRect } from "./JsiSkRect";
|
|
19
|
+
import { JsiSkRRect } from "./JsiSkRRect";
|
|
20
|
+
import { JsiSkMatrix } from "./JsiSkMatrix";
|
|
19
21
|
|
|
20
22
|
const CommandCount = {
|
|
21
23
|
[PathVerb.Move]: 3,
|
|
@@ -26,20 +28,6 @@ const CommandCount = {
|
|
|
26
28
|
[PathVerb.Close]: 1,
|
|
27
29
|
};
|
|
28
30
|
|
|
29
|
-
const areCmdsInterpolatable = (cmd1: PathCommand[], cmd2: PathCommand[]) => {
|
|
30
|
-
if (cmd1.length !== cmd2.length) {
|
|
31
|
-
return false;
|
|
32
|
-
}
|
|
33
|
-
for (let i = 0; i < cmd1.length; i++) {
|
|
34
|
-
if (cmd1[i][0] !== cmd2[i][0]) {
|
|
35
|
-
return false;
|
|
36
|
-
} else if (cmd1[i][0] === PathVerb.Conic && cmd1[i][5] !== cmd2[i][5]) {
|
|
37
|
-
return false;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
return true;
|
|
41
|
-
};
|
|
42
|
-
|
|
43
31
|
export class JsiSkPath extends HostObject<Path, "Path"> implements SkPath {
|
|
44
32
|
constructor(CanvasKit: CanvasKit, ref: Path) {
|
|
45
33
|
super(CanvasKit, ref, "Path");
|
|
@@ -50,12 +38,20 @@ export class JsiSkPath extends HostObject<Path, "Path"> implements SkPath {
|
|
|
50
38
|
startAngleInDegrees: number,
|
|
51
39
|
sweepAngleInDegrees: number
|
|
52
40
|
) {
|
|
53
|
-
this.ref.addArc(
|
|
41
|
+
this.ref.addArc(
|
|
42
|
+
JsiSkRect.fromValue(this.CanvasKit, oval),
|
|
43
|
+
startAngleInDegrees,
|
|
44
|
+
sweepAngleInDegrees
|
|
45
|
+
);
|
|
54
46
|
return this;
|
|
55
47
|
}
|
|
56
48
|
|
|
57
49
|
addOval(oval: SkRect, isCCW?: boolean, startIndex?: number) {
|
|
58
|
-
this.ref.addOval(
|
|
50
|
+
this.ref.addOval(
|
|
51
|
+
JsiSkRect.fromValue(this.CanvasKit, oval),
|
|
52
|
+
isCCW,
|
|
53
|
+
startIndex
|
|
54
|
+
);
|
|
59
55
|
return this;
|
|
60
56
|
}
|
|
61
57
|
|
|
@@ -65,7 +61,7 @@ export class JsiSkPath extends HostObject<Path, "Path"> implements SkPath {
|
|
|
65
61
|
|
|
66
62
|
addPoly(points: SkPoint[], close: boolean) {
|
|
67
63
|
this.ref.addPoly(
|
|
68
|
-
points.map((p) =>
|
|
64
|
+
points.map((p) => Array.from(JsiSkPoint.fromValue(p))).flat(),
|
|
69
65
|
close
|
|
70
66
|
);
|
|
71
67
|
return this;
|
|
@@ -183,7 +179,7 @@ export class JsiSkPath extends HostObject<Path, "Path"> implements SkPath {
|
|
|
183
179
|
forceMoveTo: boolean
|
|
184
180
|
) {
|
|
185
181
|
this.ref.arcToOval(
|
|
186
|
-
|
|
182
|
+
JsiSkRect.fromValue(this.CanvasKit, oval),
|
|
187
183
|
startAngleInDegrees,
|
|
188
184
|
sweepAngleInDegrees,
|
|
189
185
|
forceMoveTo
|
|
@@ -247,7 +243,7 @@ export class JsiSkPath extends HostObject<Path, "Path"> implements SkPath {
|
|
|
247
243
|
}
|
|
248
244
|
|
|
249
245
|
equals(other: SkPath) {
|
|
250
|
-
return this.ref.equals(
|
|
246
|
+
return this.ref.equals(JsiSkPath.fromValue(other));
|
|
251
247
|
}
|
|
252
248
|
|
|
253
249
|
getBounds() {
|
|
@@ -263,11 +259,11 @@ export class JsiSkPath extends HostObject<Path, "Path"> implements SkPath {
|
|
|
263
259
|
}
|
|
264
260
|
|
|
265
261
|
addRect(rect: SkRect, isCCW?: boolean) {
|
|
266
|
-
this.ref.addRect(
|
|
262
|
+
this.ref.addRect(JsiSkRect.fromValue(this.CanvasKit, rect), isCCW);
|
|
267
263
|
}
|
|
268
264
|
|
|
269
265
|
addRRect(rrect: SkRRect, isCCW?: boolean) {
|
|
270
|
-
this.ref.addRRect(
|
|
266
|
+
this.ref.addRRect(JsiSkRRect.fromValue(this.CanvasKit, rrect), isCCW);
|
|
271
267
|
return this;
|
|
272
268
|
}
|
|
273
269
|
|
|
@@ -284,9 +280,7 @@ export class JsiSkPath extends HostObject<Path, "Path"> implements SkPath {
|
|
|
284
280
|
}
|
|
285
281
|
|
|
286
282
|
addCircle(x: number, y: number, r: number) {
|
|
287
|
-
|
|
288
|
-
// throw new NotImplementedOnRNWeb();
|
|
289
|
-
this.ref.addOval(this.CanvasKit.LTRBRect(x - r, y - r, x + r, y + r));
|
|
283
|
+
this.ref.addCircle(x, y, r);
|
|
290
284
|
return this;
|
|
291
285
|
}
|
|
292
286
|
|
|
@@ -298,7 +292,7 @@ export class JsiSkPath extends HostObject<Path, "Path"> implements SkPath {
|
|
|
298
292
|
}
|
|
299
293
|
|
|
300
294
|
op(path: SkPath, op: PathOp) {
|
|
301
|
-
return this.ref.op(
|
|
295
|
+
return this.ref.op(JsiSkPath.fromValue(path), ckEnum(op));
|
|
302
296
|
}
|
|
303
297
|
|
|
304
298
|
simplify() {
|
|
@@ -315,34 +309,15 @@ export class JsiSkPath extends HostObject<Path, "Path"> implements SkPath {
|
|
|
315
309
|
}
|
|
316
310
|
|
|
317
311
|
transform(m3: SkMatrix) {
|
|
318
|
-
this.ref.transform(
|
|
312
|
+
this.ref.transform(JsiSkMatrix.fromValue(m3));
|
|
319
313
|
}
|
|
320
314
|
|
|
321
315
|
interpolate(end: SkPath, t: number) {
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
return null;
|
|
328
|
-
}
|
|
329
|
-
const interpolated: PathCommand[] = [];
|
|
330
|
-
cmd1.forEach((cmd, i) => {
|
|
331
|
-
const interpolatedCmd = [cmd[0]];
|
|
332
|
-
interpolated.push(interpolatedCmd);
|
|
333
|
-
cmd.forEach((c, j) => {
|
|
334
|
-
if (j === 0) {
|
|
335
|
-
return;
|
|
336
|
-
}
|
|
337
|
-
if (interpolatedCmd[0] === PathVerb.Conic && j === 5) {
|
|
338
|
-
interpolatedCmd.push(c);
|
|
339
|
-
} else {
|
|
340
|
-
const c2 = cmd2[i][j];
|
|
341
|
-
interpolatedCmd.push(c2 + (c - c2) * t);
|
|
342
|
-
}
|
|
343
|
-
});
|
|
344
|
-
});
|
|
345
|
-
const path = this.CanvasKit.Path.MakeFromCmds(interpolated.flat());
|
|
316
|
+
const path = this.CanvasKit.Path.MakeFromPathInterpolation(
|
|
317
|
+
this.ref,
|
|
318
|
+
JsiSkPath.fromValue(end),
|
|
319
|
+
t
|
|
320
|
+
);
|
|
346
321
|
if (path === null) {
|
|
347
322
|
return null;
|
|
348
323
|
}
|
|
@@ -350,11 +325,10 @@ export class JsiSkPath extends HostObject<Path, "Path"> implements SkPath {
|
|
|
350
325
|
}
|
|
351
326
|
|
|
352
327
|
isInterpolatable(path2: SkPath): boolean {
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
return areCmdsInterpolatable(cmd1, cmd2);
|
|
328
|
+
return this.CanvasKit.Path.CanInterpolate(
|
|
329
|
+
this.ref,
|
|
330
|
+
JsiSkPath.fromValue(path2)
|
|
331
|
+
);
|
|
358
332
|
}
|
|
359
333
|
|
|
360
334
|
toCmds() {
|
|
@@ -8,7 +8,9 @@ import type {
|
|
|
8
8
|
SkPathEffect,
|
|
9
9
|
} from "../types";
|
|
10
10
|
|
|
11
|
-
import { ckEnum, Host, NotImplementedOnRNWeb
|
|
11
|
+
import { ckEnum, Host, NotImplementedOnRNWeb } from "./Host";
|
|
12
|
+
import { JsiSkMatrix } from "./JsiSkMatrix";
|
|
13
|
+
import { JsiSkPath } from "./JsiSkPath";
|
|
12
14
|
import { JsiSkPathEffect } from "./JsiSkPathEffect";
|
|
13
15
|
|
|
14
16
|
export class JsiSkPathEffectFactory extends Host implements PathEffectFactory {
|
|
@@ -47,7 +49,10 @@ export class JsiSkPathEffectFactory extends Host implements PathEffectFactory {
|
|
|
47
49
|
}
|
|
48
50
|
|
|
49
51
|
MakeLine2D(width: number, matrix: SkMatrix) {
|
|
50
|
-
const pe = this.CanvasKit.PathEffect.MakeLine2D(
|
|
52
|
+
const pe = this.CanvasKit.PathEffect.MakeLine2D(
|
|
53
|
+
width,
|
|
54
|
+
JsiSkMatrix.fromValue(matrix)
|
|
55
|
+
);
|
|
51
56
|
if (pe === null) {
|
|
52
57
|
return null;
|
|
53
58
|
}
|
|
@@ -61,7 +66,7 @@ export class JsiSkPathEffectFactory extends Host implements PathEffectFactory {
|
|
|
61
66
|
style: Path1DEffectStyle
|
|
62
67
|
) {
|
|
63
68
|
const pe = this.CanvasKit.PathEffect.MakePath1D(
|
|
64
|
-
|
|
69
|
+
JsiSkPath.fromValue(path),
|
|
65
70
|
advance,
|
|
66
71
|
phase,
|
|
67
72
|
ckEnum(style)
|
|
@@ -74,8 +79,8 @@ export class JsiSkPathEffectFactory extends Host implements PathEffectFactory {
|
|
|
74
79
|
|
|
75
80
|
MakePath2D(matrix: SkMatrix, path: SkPath) {
|
|
76
81
|
const pe = this.CanvasKit.PathEffect.MakePath2D(
|
|
77
|
-
|
|
78
|
-
|
|
82
|
+
JsiSkMatrix.fromValue(matrix),
|
|
83
|
+
JsiSkPath.fromValue(path)
|
|
79
84
|
);
|
|
80
85
|
if (pe === null) {
|
|
81
86
|
return null;
|
|
@@ -3,7 +3,7 @@ import type { CanvasKit } from "canvaskit-wasm";
|
|
|
3
3
|
import type { PathCommand, PathOp, SkFont, SkPath } from "../types";
|
|
4
4
|
import type { PathFactory } from "../types/Path/PathFactory";
|
|
5
5
|
|
|
6
|
-
import { Host, ckEnum,
|
|
6
|
+
import { Host, ckEnum, NotImplementedOnRNWeb } from "./Host";
|
|
7
7
|
import { JsiSkPath } from "./JsiSkPath";
|
|
8
8
|
|
|
9
9
|
export class JsiSkPathFactory extends Host implements PathFactory {
|
|
@@ -25,8 +25,8 @@ export class JsiSkPathFactory extends Host implements PathFactory {
|
|
|
25
25
|
|
|
26
26
|
MakeFromOp(one: SkPath, two: SkPath, op: PathOp) {
|
|
27
27
|
const path = this.CanvasKit.Path.MakeFromOp(
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
JsiSkPath.fromValue(one),
|
|
29
|
+
JsiSkPath.fromValue(two),
|
|
30
30
|
ckEnum(op)
|
|
31
31
|
);
|
|
32
32
|
if (path === null) {
|
|
@@ -9,8 +9,10 @@ import type {
|
|
|
9
9
|
SkMatrix,
|
|
10
10
|
} from "../types";
|
|
11
11
|
|
|
12
|
-
import { HostObject,
|
|
12
|
+
import { HostObject, ckEnum } from "./Host";
|
|
13
13
|
import { JsiSkShader } from "./JsiSkShader";
|
|
14
|
+
import { JsiSkMatrix } from "./JsiSkMatrix";
|
|
15
|
+
import { JsiSkRect } from "./JsiSkRect";
|
|
14
16
|
|
|
15
17
|
export class JsiSkPicture
|
|
16
18
|
extends HostObject<Picture, "Picture">
|
|
@@ -33,8 +35,8 @@ export class JsiSkPicture
|
|
|
33
35
|
ckEnum(tmx),
|
|
34
36
|
ckEnum(tmy),
|
|
35
37
|
ckEnum(mode),
|
|
36
|
-
localMatrix ?
|
|
37
|
-
tileRect ?
|
|
38
|
+
localMatrix ? JsiSkMatrix.fromValue(localMatrix) : undefined,
|
|
39
|
+
tileRect ? JsiSkRect.fromValue(this.CanvasKit, tileRect) : undefined
|
|
38
40
|
)
|
|
39
41
|
);
|
|
40
42
|
}
|
|
@@ -3,9 +3,10 @@ import type { CanvasKit, PictureRecorder } from "canvaskit-wasm";
|
|
|
3
3
|
import type { SkRect } from "../types";
|
|
4
4
|
import type { SkPictureRecorder } from "../types/Picture/PictureRecorder";
|
|
5
5
|
|
|
6
|
-
import { HostObject
|
|
6
|
+
import { HostObject } from "./Host";
|
|
7
7
|
import { JsiSkCanvas } from "./JsiSkCanvas";
|
|
8
8
|
import { JsiSkPicture } from "./JsiSkPicture";
|
|
9
|
+
import { JsiSkRect } from "./JsiSkRect";
|
|
9
10
|
|
|
10
11
|
export class JsiSkPictureRecorder
|
|
11
12
|
extends HostObject<PictureRecorder, "PictureRecorder">
|
|
@@ -18,7 +19,7 @@ export class JsiSkPictureRecorder
|
|
|
18
19
|
beginRecording(bounds: SkRect) {
|
|
19
20
|
return new JsiSkCanvas(
|
|
20
21
|
this.CanvasKit,
|
|
21
|
-
this.ref.beginRecording(
|
|
22
|
+
this.ref.beginRecording(JsiSkRect.fromValue(this.CanvasKit, bounds))
|
|
22
23
|
);
|
|
23
24
|
}
|
|
24
25
|
|
|
@@ -2,9 +2,19 @@ import type { CanvasKit, Point } from "canvaskit-wasm";
|
|
|
2
2
|
|
|
3
3
|
import type { SkPoint } from "../types";
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { BaseHostObject } from "./Host";
|
|
6
|
+
|
|
7
|
+
export class JsiSkPoint
|
|
8
|
+
extends BaseHostObject<Point, "Point">
|
|
9
|
+
implements SkPoint
|
|
10
|
+
{
|
|
11
|
+
static fromValue(point: SkPoint) {
|
|
12
|
+
if (point instanceof JsiSkPoint) {
|
|
13
|
+
return point.ref;
|
|
14
|
+
}
|
|
15
|
+
return new Float32Array([point.x, point.y]);
|
|
16
|
+
}
|
|
6
17
|
|
|
7
|
-
export class JsiSkPoint extends HostObject<Point, "Point"> implements SkPoint {
|
|
8
18
|
constructor(CanvasKit: CanvasKit, ref: Point) {
|
|
9
19
|
super(CanvasKit, ref, "Point");
|
|
10
20
|
}
|
|
@@ -2,10 +2,24 @@ import type { CanvasKit, RRect } from "canvaskit-wasm";
|
|
|
2
2
|
|
|
3
3
|
import type { SkRRect } from "../types";
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { BaseHostObject } from "./Host";
|
|
6
6
|
import { JsiSkRect } from "./JsiSkRect";
|
|
7
7
|
|
|
8
|
-
export class JsiSkRRect
|
|
8
|
+
export class JsiSkRRect
|
|
9
|
+
extends BaseHostObject<RRect, "RRect">
|
|
10
|
+
implements SkRRect
|
|
11
|
+
{
|
|
12
|
+
static fromValue(CanvasKit: CanvasKit, rect: SkRRect) {
|
|
13
|
+
if (rect instanceof JsiSkRect) {
|
|
14
|
+
return rect.ref;
|
|
15
|
+
}
|
|
16
|
+
return CanvasKit.RRectXY(
|
|
17
|
+
JsiSkRect.fromValue(CanvasKit, rect.rect),
|
|
18
|
+
rect.rx,
|
|
19
|
+
rect.ry
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
|
|
9
23
|
constructor(CanvasKit: CanvasKit, ref: RRect) {
|
|
10
24
|
super(CanvasKit, ref, "RRect");
|
|
11
25
|
}
|
|
@@ -2,17 +2,14 @@ import type { CanvasKit, Rect } from "canvaskit-wasm";
|
|
|
2
2
|
|
|
3
3
|
import type { SkRect } from "../types";
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { BaseHostObject } from "./Host";
|
|
6
6
|
|
|
7
|
-
export class JsiSkRect extends
|
|
7
|
+
export class JsiSkRect extends BaseHostObject<Rect, "Rect"> implements SkRect {
|
|
8
8
|
static fromValue(CanvasKit: CanvasKit, rect: SkRect) {
|
|
9
9
|
if (rect instanceof JsiSkRect) {
|
|
10
|
-
return rect;
|
|
10
|
+
return rect.ref;
|
|
11
11
|
}
|
|
12
|
-
return
|
|
13
|
-
CanvasKit,
|
|
14
|
-
CanvasKit.XYWHRect(rect.x, rect.y, rect.width, rect.height)
|
|
15
|
-
);
|
|
12
|
+
return CanvasKit.XYWHRect(rect.x, rect.y, rect.width, rect.height);
|
|
16
13
|
}
|
|
17
14
|
|
|
18
15
|
constructor(CanvasKit: CanvasKit, ref: Rect) {
|