@shopify/react-native-skia 0.1.142 → 0.1.146
Sign up to get free protection for your applications and to get access to all the features.
- package/cpp/api/JsiSkContourMeasure.h +4 -4
- package/cpp/api/JsiSkDataFactory.h +3 -3
- package/cpp/api/JsiSkFont.h +1 -1
- package/cpp/api/JsiSkPaint.h +6 -0
- package/cpp/api/JsiSkPathFactory.h +2 -2
- package/cpp/api/JsiSkPicture.h +7 -1
- package/cpp/api/JsiSkPictureFactory.h +1 -1
- package/cpp/api/JsiSkRuntimeEffect.h +6 -6
- package/cpp/api/JsiSkRuntimeEffectFactory.h +1 -1
- package/cpp/jsi/JsiSimpleValueWrapper.h +27 -27
- package/cpp/jsi/JsiValueWrapper.h +127 -0
- package/cpp/rnskia/RNSkDrawView.cpp +44 -20
- package/cpp/rnskia/RNSkDrawView.h +18 -20
- package/cpp/rnskia/RNSkJsiViewApi.h +180 -166
- package/cpp/rnskia/values/RNSkComputedValue.h +11 -11
- package/cpp/rnskia/values/RNSkReadonlyValue.h +19 -19
- package/cpp/rnskia/values/RNSkValue.h +13 -13
- package/cpp/utils/RNSkLog.h +4 -4
- 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 +18 -2
- 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 +3 -22
- package/lib/commonjs/renderer/processors/Animations/Animations.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 +46 -26
- 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 +9 -55
- 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 +1 -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 +1 -1
- 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/views/SkiaView.js +11 -27
- package/lib/commonjs/views/SkiaView.js.map +1 -1
- package/lib/commonjs/views/types.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 +140 -33
- package/lib/module/renderer/DependencyManager.js.map +1 -1
- package/lib/module/renderer/HostConfig.js +18 -2
- 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 +1 -16
- package/lib/module/renderer/processors/Animations/Animations.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 +37 -27
- 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 +9 -57
- 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 +2 -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 +2 -2
- 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/views/SkiaView.js +11 -26
- package/lib/module/views/SkiaView.js.map +1 -1
- package/lib/module/views/types.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 +0 -1
- 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 +2 -2
- package/lib/typescript/src/skia/web/JsiSkRSXform.d.ts +1 -2
- package/lib/typescript/src/skia/web/JsiSkRect.d.ts +2 -2
- package/lib/typescript/src/skia/web/JsiSkTextBlobFactory.d.ts +2 -1
- package/lib/typescript/src/views/SkiaView.d.ts +1 -11
- package/lib/typescript/src/views/types.d.ts +5 -5
- 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 +2 -2
- package/src/renderer/Canvas.tsx +19 -7
- package/src/renderer/DependencyManager.tsx +170 -39
- package/src/renderer/HostConfig.ts +12 -2
- 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 +2 -15
- 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 +78 -47
- 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 +16 -51
- 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 +5 -2
- package/src/skia/web/JsiSkRSXform.ts +1 -1
- package/src/skia/web/JsiSkRect.ts +2 -2
- 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/views/SkiaView.tsx +17 -28
- package/src/views/types.ts +7 -6
@@ -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,10 +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
19
|
import { JsiSkRRect } from "./JsiSkRRect";
|
20
|
+
import { JsiSkMatrix } from "./JsiSkMatrix";
|
20
21
|
|
21
22
|
const CommandCount = {
|
22
23
|
[PathVerb.Move]: 3,
|
@@ -27,20 +28,6 @@ const CommandCount = {
|
|
27
28
|
[PathVerb.Close]: 1,
|
28
29
|
};
|
29
30
|
|
30
|
-
const areCmdsInterpolatable = (cmd1: PathCommand[], cmd2: PathCommand[]) => {
|
31
|
-
if (cmd1.length !== cmd2.length) {
|
32
|
-
return false;
|
33
|
-
}
|
34
|
-
for (let i = 0; i < cmd1.length; i++) {
|
35
|
-
if (cmd1[i][0] !== cmd2[i][0]) {
|
36
|
-
return false;
|
37
|
-
} else if (cmd1[i][0] === PathVerb.Conic && cmd1[i][5] !== cmd2[i][5]) {
|
38
|
-
return false;
|
39
|
-
}
|
40
|
-
}
|
41
|
-
return true;
|
42
|
-
};
|
43
|
-
|
44
31
|
export class JsiSkPath extends HostObject<Path, "Path"> implements SkPath {
|
45
32
|
constructor(CanvasKit: CanvasKit, ref: Path) {
|
46
33
|
super(CanvasKit, ref, "Path");
|
@@ -74,7 +61,7 @@ export class JsiSkPath extends HostObject<Path, "Path"> implements SkPath {
|
|
74
61
|
|
75
62
|
addPoly(points: SkPoint[], close: boolean) {
|
76
63
|
this.ref.addPoly(
|
77
|
-
points.map((p) =>
|
64
|
+
points.map((p) => Array.from(JsiSkPoint.fromValue(p))).flat(),
|
78
65
|
close
|
79
66
|
);
|
80
67
|
return this;
|
@@ -256,7 +243,7 @@ export class JsiSkPath extends HostObject<Path, "Path"> implements SkPath {
|
|
256
243
|
}
|
257
244
|
|
258
245
|
equals(other: SkPath) {
|
259
|
-
return this.ref.equals(
|
246
|
+
return this.ref.equals(JsiSkPath.fromValue(other));
|
260
247
|
}
|
261
248
|
|
262
249
|
getBounds() {
|
@@ -293,9 +280,7 @@ export class JsiSkPath extends HostObject<Path, "Path"> implements SkPath {
|
|
293
280
|
}
|
294
281
|
|
295
282
|
addCircle(x: number, y: number, r: number) {
|
296
|
-
|
297
|
-
// throw new NotImplementedOnRNWeb();
|
298
|
-
this.ref.addOval(this.CanvasKit.LTRBRect(x - r, y - r, x + r, y + r));
|
283
|
+
this.ref.addCircle(x, y, r);
|
299
284
|
return this;
|
300
285
|
}
|
301
286
|
|
@@ -307,7 +292,7 @@ export class JsiSkPath extends HostObject<Path, "Path"> implements SkPath {
|
|
307
292
|
}
|
308
293
|
|
309
294
|
op(path: SkPath, op: PathOp) {
|
310
|
-
return this.ref.op(
|
295
|
+
return this.ref.op(JsiSkPath.fromValue(path), ckEnum(op));
|
311
296
|
}
|
312
297
|
|
313
298
|
simplify() {
|
@@ -324,34 +309,15 @@ export class JsiSkPath extends HostObject<Path, "Path"> implements SkPath {
|
|
324
309
|
}
|
325
310
|
|
326
311
|
transform(m3: SkMatrix) {
|
327
|
-
this.ref.transform(
|
312
|
+
this.ref.transform(JsiSkMatrix.fromValue(m3));
|
328
313
|
}
|
329
314
|
|
330
315
|
interpolate(end: SkPath, t: number) {
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
return null;
|
337
|
-
}
|
338
|
-
const interpolated: PathCommand[] = [];
|
339
|
-
cmd1.forEach((cmd, i) => {
|
340
|
-
const interpolatedCmd = [cmd[0]];
|
341
|
-
interpolated.push(interpolatedCmd);
|
342
|
-
cmd.forEach((c, j) => {
|
343
|
-
if (j === 0) {
|
344
|
-
return;
|
345
|
-
}
|
346
|
-
if (interpolatedCmd[0] === PathVerb.Conic && j === 5) {
|
347
|
-
interpolatedCmd.push(c);
|
348
|
-
} else {
|
349
|
-
const c2 = cmd2[i][j];
|
350
|
-
interpolatedCmd.push(c2 + (c - c2) * t);
|
351
|
-
}
|
352
|
-
});
|
353
|
-
});
|
354
|
-
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
|
+
);
|
355
321
|
if (path === null) {
|
356
322
|
return null;
|
357
323
|
}
|
@@ -359,11 +325,10 @@ export class JsiSkPath extends HostObject<Path, "Path"> implements SkPath {
|
|
359
325
|
}
|
360
326
|
|
361
327
|
isInterpolatable(path2: SkPath): boolean {
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
return areCmdsInterpolatable(cmd1, cmd2);
|
328
|
+
return this.CanvasKit.Path.CanInterpolate(
|
329
|
+
this.ref,
|
330
|
+
JsiSkPath.fromValue(path2)
|
331
|
+
);
|
367
332
|
}
|
368
333
|
|
369
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,13 @@ 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
|
+
{
|
9
12
|
static fromValue(CanvasKit: CanvasKit, rect: SkRRect) {
|
10
13
|
if (rect instanceof JsiSkRect) {
|
11
14
|
return rect.ref;
|
@@ -2,9 +2,9 @@ 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
10
|
return rect.ref;
|
@@ -3,7 +3,8 @@ import type { CanvasKit, RuntimeEffect } from "canvaskit-wasm";
|
|
3
3
|
import type { SkMatrix, SkShader } from "../types";
|
4
4
|
import type { SkRuntimeEffect } from "../types/RuntimeEffect/RuntimeEffect";
|
5
5
|
|
6
|
-
import { HostObject
|
6
|
+
import { HostObject } from "./Host";
|
7
|
+
import { JsiSkMatrix } from "./JsiSkMatrix";
|
7
8
|
import { JsiSkShader } from "./JsiSkShader";
|
8
9
|
|
9
10
|
export class JsiSkRuntimeEffect
|
@@ -19,7 +20,9 @@ export class JsiSkRuntimeEffect
|
|
19
20
|
this.CanvasKit,
|
20
21
|
this.ref.makeShader(
|
21
22
|
uniforms,
|
22
|
-
localMatrix !== undefined
|
23
|
+
localMatrix !== undefined
|
24
|
+
? JsiSkMatrix.fromValue(localMatrix)
|
25
|
+
: localMatrix
|
23
26
|
)
|
24
27
|
);
|
25
28
|
}
|
@@ -33,8 +36,10 @@ export class JsiSkRuntimeEffect
|
|
33
36
|
this.CanvasKit,
|
34
37
|
this.ref.makeShaderWithChildren(
|
35
38
|
uniforms,
|
36
|
-
children?.map((child) =>
|
37
|
-
localMatrix !== undefined
|
39
|
+
children?.map((child) => JsiSkShader.fromValue(child)),
|
40
|
+
localMatrix !== undefined
|
41
|
+
? JsiSkMatrix.fromValue(localMatrix)
|
42
|
+
: localMatrix
|
38
43
|
)
|
39
44
|
);
|
40
45
|
}
|
@@ -10,7 +10,9 @@ import type {
|
|
10
10
|
} from "../types";
|
11
11
|
import type { ShaderFactory } from "../types/Shader/ShaderFactory";
|
12
12
|
|
13
|
-
import { Host,
|
13
|
+
import { Host, ckEnum } from "./Host";
|
14
|
+
import { JsiSkMatrix } from "./JsiSkMatrix";
|
15
|
+
import { JsiSkPoint } from "./JsiSkPoint";
|
14
16
|
import { JsiSkShader } from "./JsiSkShader";
|
15
17
|
|
16
18
|
export class JsiSkShaderFactory extends Host implements ShaderFactory {
|
@@ -30,12 +32,14 @@ export class JsiSkShaderFactory extends Host implements ShaderFactory {
|
|
30
32
|
return new JsiSkShader(
|
31
33
|
this.CanvasKit,
|
32
34
|
this.CanvasKit.Shader.MakeLinearGradient(
|
33
|
-
|
34
|
-
|
35
|
+
JsiSkPoint.fromValue(start),
|
36
|
+
JsiSkPoint.fromValue(end),
|
35
37
|
colors,
|
36
38
|
pos,
|
37
39
|
ckEnum(mode),
|
38
|
-
localMatrix === undefined
|
40
|
+
localMatrix === undefined
|
41
|
+
? undefined
|
42
|
+
: JsiSkMatrix.fromValue(localMatrix),
|
39
43
|
flags
|
40
44
|
)
|
41
45
|
);
|
@@ -53,12 +57,14 @@ export class JsiSkShaderFactory extends Host implements ShaderFactory {
|
|
53
57
|
return new JsiSkShader(
|
54
58
|
this.CanvasKit,
|
55
59
|
this.CanvasKit.Shader.MakeRadialGradient(
|
56
|
-
|
60
|
+
JsiSkPoint.fromValue(center),
|
57
61
|
radius,
|
58
62
|
colors,
|
59
63
|
pos,
|
60
64
|
ckEnum(mode),
|
61
|
-
localMatrix === undefined
|
65
|
+
localMatrix === undefined
|
66
|
+
? undefined
|
67
|
+
: JsiSkMatrix.fromValue(localMatrix),
|
62
68
|
flags
|
63
69
|
)
|
64
70
|
);
|
@@ -78,14 +84,16 @@ export class JsiSkShaderFactory extends Host implements ShaderFactory {
|
|
78
84
|
return new JsiSkShader(
|
79
85
|
this.CanvasKit,
|
80
86
|
this.CanvasKit.Shader.MakeTwoPointConicalGradient(
|
81
|
-
|
87
|
+
JsiSkPoint.fromValue(start),
|
82
88
|
startRadius,
|
83
|
-
|
89
|
+
JsiSkPoint.fromValue(end),
|
84
90
|
endRadius,
|
85
91
|
colors,
|
86
92
|
pos,
|
87
93
|
ckEnum(mode),
|
88
|
-
localMatrix === undefined
|
94
|
+
localMatrix === undefined
|
95
|
+
? undefined
|
96
|
+
: JsiSkMatrix.fromValue(localMatrix),
|
89
97
|
flags
|
90
98
|
)
|
91
99
|
);
|
@@ -112,7 +120,7 @@ export class JsiSkShaderFactory extends Host implements ShaderFactory {
|
|
112
120
|
ckEnum(mode),
|
113
121
|
localMatrix === undefined || localMatrix === null
|
114
122
|
? undefined
|
115
|
-
:
|
123
|
+
: JsiSkMatrix.fromValue(localMatrix),
|
116
124
|
flags,
|
117
125
|
startAngleInDegrees,
|
118
126
|
endAngleInDegrees
|
@@ -165,17 +173,18 @@ export class JsiSkShaderFactory extends Host implements ShaderFactory {
|
|
165
173
|
MakeBlend(mode: BlendMode, one: SkShader, two: SkShader) {
|
166
174
|
return new JsiSkShader(
|
167
175
|
this.CanvasKit,
|
168
|
-
this.CanvasKit.Shader.MakeBlend(
|
176
|
+
this.CanvasKit.Shader.MakeBlend(
|
177
|
+
ckEnum(mode),
|
178
|
+
JsiSkShader.fromValue(one),
|
179
|
+
JsiSkShader.fromValue(two)
|
180
|
+
)
|
169
181
|
);
|
170
182
|
}
|
171
183
|
|
172
184
|
MakeColor(color: SkColor) {
|
173
185
|
return new JsiSkShader(
|
174
186
|
this.CanvasKit,
|
175
|
-
this.CanvasKit.Shader.MakeColor(
|
176
|
-
toValue(color),
|
177
|
-
this.CanvasKit.ColorSpace.SRGB
|
178
|
-
)
|
187
|
+
this.CanvasKit.Shader.MakeColor(color, this.CanvasKit.ColorSpace.SRGB)
|
179
188
|
);
|
180
189
|
}
|
181
190
|
}
|
@@ -2,9 +2,10 @@ import type { CanvasKit, Surface } from "canvaskit-wasm";
|
|
2
2
|
|
3
3
|
import type { SkCanvas, SkImage, SkRect, SkSurface } from "../types";
|
4
4
|
|
5
|
-
import { HostObject
|
5
|
+
import { HostObject } from "./Host";
|
6
6
|
import { JsiSkCanvas } from "./JsiSkCanvas";
|
7
7
|
import { JsiSkImage } from "./JsiSkImage";
|
8
|
+
import { JsiSkRect } from "./JsiSkRect";
|
8
9
|
|
9
10
|
export class JsiSkSurface
|
10
11
|
extends HostObject<Surface, "Surface">
|
@@ -19,7 +20,11 @@ export class JsiSkSurface
|
|
19
20
|
}
|
20
21
|
|
21
22
|
makeImageSnapshot(bounds?: SkRect): SkImage {
|
22
|
-
const image = this.ref.makeImageSnapshot(
|
23
|
+
const image = this.ref.makeImageSnapshot(
|
24
|
+
bounds
|
25
|
+
? Array.from(JsiSkRect.fromValue(this.CanvasKit, bounds))
|
26
|
+
: undefined
|
27
|
+
);
|
23
28
|
return new JsiSkImage(this.CanvasKit, image);
|
24
29
|
}
|
25
30
|
}
|
@@ -1,10 +1,14 @@
|
|
1
1
|
import type { CanvasKit } from "canvaskit-wasm";
|
2
2
|
|
3
|
-
import type { SkFont
|
3
|
+
import type { SkFont } from "../types";
|
4
4
|
import type { TextBlobFactory } from "../types/TextBlob";
|
5
|
+
import type { SkRSXform } from "../types/RSXform";
|
5
6
|
|
6
|
-
import { Host
|
7
|
+
import { Host } from "./Host";
|
8
|
+
import { JsiSkFont } from "./JsiSkFont";
|
7
9
|
import { JsiSkTextBlob } from "./JsiSkTextBlob";
|
10
|
+
import type { RSXform } from "./JsiSkRSXform";
|
11
|
+
import { JsiSkRSXform } from "./JsiSkRSXform";
|
8
12
|
|
9
13
|
export class JsiSkTextBlobFactory extends Host implements TextBlobFactory {
|
10
14
|
constructor(CanvasKit: CanvasKit) {
|
@@ -14,14 +18,14 @@ export class JsiSkTextBlobFactory extends Host implements TextBlobFactory {
|
|
14
18
|
MakeFromText(str: string, font: SkFont) {
|
15
19
|
return new JsiSkTextBlob(
|
16
20
|
this.CanvasKit,
|
17
|
-
this.CanvasKit.TextBlob.MakeFromText(str,
|
21
|
+
this.CanvasKit.TextBlob.MakeFromText(str, JsiSkFont.fromValue(font))
|
18
22
|
);
|
19
23
|
}
|
20
24
|
|
21
25
|
MakeFromGlyphs(glyphs: number[], font: SkFont) {
|
22
26
|
return new JsiSkTextBlob(
|
23
27
|
this.CanvasKit,
|
24
|
-
this.CanvasKit.TextBlob.MakeFromGlyphs(glyphs,
|
28
|
+
this.CanvasKit.TextBlob.MakeFromGlyphs(glyphs, JsiSkFont.fromValue(font))
|
25
29
|
);
|
26
30
|
}
|
27
31
|
|
@@ -30,8 +34,10 @@ export class JsiSkTextBlobFactory extends Host implements TextBlobFactory {
|
|
30
34
|
this.CanvasKit,
|
31
35
|
this.CanvasKit.TextBlob.MakeFromRSXform(
|
32
36
|
str,
|
33
|
-
rsxforms
|
34
|
-
|
37
|
+
rsxforms
|
38
|
+
.map((f) => Array.from(JsiSkRSXform.fromValue<RSXform>(f)))
|
39
|
+
.flat(),
|
40
|
+
JsiSkFont.fromValue(font)
|
35
41
|
)
|
36
42
|
);
|
37
43
|
}
|
@@ -41,8 +47,8 @@ export class JsiSkTextBlobFactory extends Host implements TextBlobFactory {
|
|
41
47
|
this.CanvasKit,
|
42
48
|
this.CanvasKit.TextBlob.MakeFromRSXformGlyphs(
|
43
49
|
glyphs,
|
44
|
-
rsxforms.map((f) =>
|
45
|
-
|
50
|
+
rsxforms.map((f) => JsiSkRSXform.fromValue(f)),
|
51
|
+
JsiSkFont.fromValue(font)
|
46
52
|
)
|
47
53
|
);
|
48
54
|
}
|
@@ -2,7 +2,7 @@ import type { CanvasKit } from "canvaskit-wasm";
|
|
2
2
|
|
3
3
|
import type { SkData, TypefaceFactory } from "../types";
|
4
4
|
|
5
|
-
import { Host
|
5
|
+
import { Host } from "./Host";
|
6
6
|
import { JsiSkTypeface } from "./JsiSkTypeface";
|
7
7
|
|
8
8
|
export class JsiSkTypefaceFactory extends Host implements TypefaceFactory {
|
@@ -11,7 +11,9 @@ export class JsiSkTypefaceFactory extends Host implements TypefaceFactory {
|
|
11
11
|
}
|
12
12
|
|
13
13
|
MakeFreeTypeFaceFromData(data: SkData) {
|
14
|
-
const tf = this.CanvasKit.Typeface.MakeFreeTypeFaceFromData(
|
14
|
+
const tf = this.CanvasKit.Typeface.MakeFreeTypeFaceFromData(
|
15
|
+
JsiSkTypeface.fromValue(data)
|
16
|
+
);
|
15
17
|
if (tf === null) {
|
16
18
|
return null;
|
17
19
|
}
|
package/src/skia/web/JsiSkia.ts
CHANGED
@@ -17,7 +17,6 @@ import { Color } from "./JsiSkColor";
|
|
17
17
|
import { JsiSkSurfaceFactory } from "./JsiSkSurfaceFactory";
|
18
18
|
import { JsiSkRRect } from "./JsiSkRRect";
|
19
19
|
import { JsiSkRSXform } from "./JsiSkRSXform";
|
20
|
-
import { toValue } from "./Host";
|
21
20
|
import { JsiSkContourMeasureIter } from "./JsiSkContourMeasureIter";
|
22
21
|
import { JsiSkPictureRecorder } from "./JsiSkPictureRecorder";
|
23
22
|
import { JsiSkPictureFactory } from "./JsiSkPictureFactory";
|
@@ -36,6 +35,8 @@ import { JsiSkSVGFactory } from "./JsiSkSVGFactory";
|
|
36
35
|
import { JsiSkTextBlobFactory } from "./JsiSkTextBlobFactory";
|
37
36
|
import { JsiSkFont } from "./JsiSkFont";
|
38
37
|
import { MakeVertices } from "./JsiSkVerticesFactory";
|
38
|
+
import { JsiSkPath } from "./JsiSkPath";
|
39
|
+
import { JsiSkTypeface } from "./JsiSkTypeface";
|
39
40
|
|
40
41
|
export const JsiSkApi = (CanvasKit: CanvasKit): Skia => ({
|
41
42
|
Point: (x: number, y: number) =>
|
@@ -44,7 +45,10 @@ export const JsiSkApi = (CanvasKit: CanvasKit): Skia => ({
|
|
44
45
|
throw new Error("Not implemented on React Native Web");
|
45
46
|
},
|
46
47
|
RRectXY: (rect: SkRect, rx: number, ry: number) =>
|
47
|
-
new JsiSkRRect(
|
48
|
+
new JsiSkRRect(
|
49
|
+
CanvasKit,
|
50
|
+
CanvasKit.RRectXY(JsiSkRect.fromValue(CanvasKit, rect), rx, ry)
|
51
|
+
),
|
48
52
|
RSXform: (scos: number, ssin: number, tx: number, ty: number) =>
|
49
53
|
new JsiSkRSXform(CanvasKit, Float32Array.of(scos, ssin, tx, ty)),
|
50
54
|
Color,
|
@@ -55,9 +59,17 @@ export const JsiSkApi = (CanvasKit: CanvasKit): Skia => ({
|
|
55
59
|
): SkContourMeasureIter =>
|
56
60
|
new JsiSkContourMeasureIter(
|
57
61
|
CanvasKit,
|
58
|
-
new CanvasKit.ContourMeasureIter(
|
62
|
+
new CanvasKit.ContourMeasureIter(
|
63
|
+
JsiSkPath.fromValue(path),
|
64
|
+
forceClosed,
|
65
|
+
resScale
|
66
|
+
)
|
59
67
|
),
|
60
|
-
Paint: () =>
|
68
|
+
Paint: () => {
|
69
|
+
const paint = new JsiSkPaint(CanvasKit, new CanvasKit.Paint());
|
70
|
+
paint.setAntiAlias(true);
|
71
|
+
return paint;
|
72
|
+
},
|
61
73
|
PictureRecorder: () =>
|
62
74
|
new JsiSkPictureRecorder(CanvasKit, new CanvasKit.PictureRecorder()),
|
63
75
|
Picture: new JsiSkPictureFactory(CanvasKit),
|
@@ -74,7 +86,7 @@ export const JsiSkApi = (CanvasKit: CanvasKit): Skia => ({
|
|
74
86
|
new JsiSkFont(
|
75
87
|
CanvasKit,
|
76
88
|
new CanvasKit.Font(
|
77
|
-
typeface === undefined ? null :
|
89
|
+
typeface === undefined ? null : JsiSkTypeface.fromValue(typeface),
|
78
90
|
size
|
79
91
|
)
|
80
92
|
),
|