@shopify/react-native-skia 0.1.227 → 0.1.229
Sign up to get free protection for your applications and to get access to all the features.
- package/cpp/api/JsiSkCanvas.h +2 -1
- package/cpp/api/JsiSkMatrix.h +27 -11
- package/cpp/api/JsiSkTypeface.h +1 -0
- package/cpp/rnskia/dom/props/MatrixProp.h +14 -3
- package/lib/commonjs/dom/types/Common.d.ts +2 -2
- package/lib/commonjs/dom/types/Common.js.map +1 -1
- package/lib/commonjs/external/reanimated/interpolators.d.ts +1 -0
- package/lib/commonjs/external/reanimated/interpolators.js +16 -3
- package/lib/commonjs/external/reanimated/interpolators.js.map +1 -1
- package/lib/commonjs/external/reanimated/moduleWrapper.d.ts +2 -1
- package/lib/commonjs/external/reanimated/moduleWrapper.js +9 -7
- package/lib/commonjs/external/reanimated/moduleWrapper.js.map +1 -1
- package/lib/commonjs/renderer/Canvas.js +7 -13
- package/lib/commonjs/renderer/Canvas.js.map +1 -1
- package/lib/commonjs/skia/core/Vector.d.ts +0 -5
- package/lib/commonjs/skia/core/Vector.js +1 -17
- package/lib/commonjs/skia/core/Vector.js.map +1 -1
- package/lib/commonjs/skia/types/Canvas.d.ts +2 -2
- package/lib/commonjs/skia/types/Canvas.js.map +1 -1
- package/lib/commonjs/skia/types/Matrix.d.ts +3 -13
- package/lib/commonjs/skia/types/Matrix.js +1 -16
- package/lib/commonjs/skia/types/Matrix.js.map +1 -1
- package/lib/commonjs/skia/types/Matrix4.d.ts +60 -1
- package/lib/commonjs/skia/types/Matrix4.js +159 -14
- package/lib/commonjs/skia/types/Matrix4.js.map +1 -1
- package/lib/commonjs/skia/types/Path/Path.d.ts +2 -2
- package/lib/commonjs/skia/types/Path/Path.js.map +1 -1
- package/lib/commonjs/skia/web/Host.d.ts +2 -3
- package/lib/commonjs/skia/web/Host.js +4 -12
- package/lib/commonjs/skia/web/Host.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkCanvas.js +12 -12
- package/lib/commonjs/skia/web/JsiSkCanvas.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkColorFilterFactory.js +1 -1
- package/lib/commonjs/skia/web/JsiSkColorFilterFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkFont.js +2 -2
- package/lib/commonjs/skia/web/JsiSkFont.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkImage.js +6 -6
- package/lib/commonjs/skia/web/JsiSkImage.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkImageFactory.js +2 -2
- package/lib/commonjs/skia/web/JsiSkImageFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkImageFilterFactory.js +3 -3
- package/lib/commonjs/skia/web/JsiSkImageFilterFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkMaskFilterFactory.js +1 -1
- package/lib/commonjs/skia/web/JsiSkMaskFilterFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkMatrix.d.ts +2 -2
- package/lib/commonjs/skia/web/JsiSkMatrix.js +6 -1
- package/lib/commonjs/skia/web/JsiSkMatrix.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPaint.js +3 -3
- package/lib/commonjs/skia/web/JsiSkPaint.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPath.js +4 -4
- package/lib/commonjs/skia/web/JsiSkPath.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPathEffectFactory.js +1 -1
- 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 +1 -1
- package/lib/commonjs/skia/web/JsiSkPicture.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkShaderFactory.js +5 -5
- package/lib/commonjs/skia/web/JsiSkShaderFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkVerticesFactory.js +3 -3
- package/lib/commonjs/skia/web/JsiSkVerticesFactory.js.map +1 -1
- package/lib/module/dom/types/Common.d.ts +2 -2
- package/lib/module/dom/types/Common.js.map +1 -1
- package/lib/module/external/reanimated/interpolators.d.ts +1 -0
- package/lib/module/external/reanimated/interpolators.js +14 -4
- package/lib/module/external/reanimated/interpolators.js.map +1 -1
- package/lib/module/external/reanimated/moduleWrapper.d.ts +2 -1
- package/lib/module/external/reanimated/moduleWrapper.js +7 -6
- package/lib/module/external/reanimated/moduleWrapper.js.map +1 -1
- package/lib/module/renderer/Canvas.js +7 -12
- package/lib/module/renderer/Canvas.js.map +1 -1
- package/lib/module/skia/core/Vector.d.ts +0 -5
- package/lib/module/skia/core/Vector.js +0 -13
- package/lib/module/skia/core/Vector.js.map +1 -1
- package/lib/module/skia/types/Canvas.d.ts +2 -2
- package/lib/module/skia/types/Canvas.js.map +1 -1
- package/lib/module/skia/types/Matrix.d.ts +3 -13
- package/lib/module/skia/types/Matrix.js +0 -14
- package/lib/module/skia/types/Matrix.js.map +1 -1
- package/lib/module/skia/types/Matrix4.d.ts +60 -1
- package/lib/module/skia/types/Matrix4.js +132 -18
- package/lib/module/skia/types/Matrix4.js.map +1 -1
- package/lib/module/skia/types/Path/Path.d.ts +2 -2
- package/lib/module/skia/types/Path/Path.js.map +1 -1
- package/lib/module/skia/web/Host.d.ts +2 -3
- package/lib/module/skia/web/Host.js +2 -7
- package/lib/module/skia/web/Host.js.map +1 -1
- package/lib/module/skia/web/JsiSkCanvas.js +13 -13
- package/lib/module/skia/web/JsiSkCanvas.js.map +1 -1
- package/lib/module/skia/web/JsiSkColorFilterFactory.js +2 -2
- package/lib/module/skia/web/JsiSkColorFilterFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkFont.js +3 -3
- package/lib/module/skia/web/JsiSkFont.js.map +1 -1
- package/lib/module/skia/web/JsiSkImage.js +7 -7
- package/lib/module/skia/web/JsiSkImage.js.map +1 -1
- package/lib/module/skia/web/JsiSkImageFactory.js +3 -3
- package/lib/module/skia/web/JsiSkImageFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkImageFilterFactory.js +4 -4
- package/lib/module/skia/web/JsiSkImageFilterFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkMaskFilterFactory.js +2 -2
- package/lib/module/skia/web/JsiSkMaskFilterFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkMatrix.d.ts +2 -2
- package/lib/module/skia/web/JsiSkMatrix.js +6 -1
- package/lib/module/skia/web/JsiSkMatrix.js.map +1 -1
- package/lib/module/skia/web/JsiSkPaint.js +4 -4
- package/lib/module/skia/web/JsiSkPaint.js.map +1 -1
- package/lib/module/skia/web/JsiSkPath.js +5 -5
- package/lib/module/skia/web/JsiSkPath.js.map +1 -1
- package/lib/module/skia/web/JsiSkPathEffectFactory.js +2 -2
- 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 +2 -2
- package/lib/module/skia/web/JsiSkPicture.js.map +1 -1
- package/lib/module/skia/web/JsiSkShaderFactory.js +6 -6
- package/lib/module/skia/web/JsiSkShaderFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkVerticesFactory.js +2 -2
- package/lib/module/skia/web/JsiSkVerticesFactory.js.map +1 -1
- package/lib/typescript/src/dom/types/Common.d.ts +2 -2
- package/lib/typescript/src/external/reanimated/interpolators.d.ts +1 -0
- package/lib/typescript/src/external/reanimated/moduleWrapper.d.ts +2 -1
- package/lib/typescript/src/skia/core/Vector.d.ts +0 -5
- package/lib/typescript/src/skia/types/Canvas.d.ts +2 -2
- package/lib/typescript/src/skia/types/Matrix.d.ts +3 -13
- package/lib/typescript/src/skia/types/Matrix4.d.ts +60 -1
- package/lib/typescript/src/skia/types/Path/Path.d.ts +2 -2
- package/lib/typescript/src/skia/web/Host.d.ts +2 -3
- package/lib/typescript/src/skia/web/JsiSkMatrix.d.ts +2 -2
- package/package.json +2 -1
- package/src/dom/types/Common.ts +2 -2
- package/src/external/reanimated/interpolators.ts +20 -5
- package/src/external/reanimated/moduleWrapper.ts +6 -0
- package/src/renderer/Canvas.tsx +6 -13
- package/src/skia/core/Vector.ts +0 -7
- package/src/skia/types/Canvas.ts +2 -2
- package/src/skia/types/Matrix.ts +4 -13
- package/src/skia/types/Matrix4.ts +190 -81
- package/src/skia/types/Path/Path.ts +2 -2
- package/src/skia/web/Host.ts +4 -3
- package/src/skia/web/JsiSkCanvas.ts +22 -15
- package/src/skia/web/JsiSkColorFilterFactory.ts +5 -2
- package/src/skia/web/JsiSkFont.ts +3 -3
- package/src/skia/web/JsiSkImage.ts +14 -11
- package/src/skia/web/JsiSkImageFactory.ts +3 -3
- package/src/skia/web/JsiSkImageFilterFactory.ts +5 -5
- package/src/skia/web/JsiSkMaskFilterFactory.ts +6 -2
- package/src/skia/web/JsiSkMatrix.ts +12 -3
- package/src/skia/web/JsiSkPaint.ts +4 -4
- package/src/skia/web/JsiSkPath.ts +8 -5
- package/src/skia/web/JsiSkPathEffectFactory.ts +2 -2
- package/src/skia/web/JsiSkPathFactory.ts +2 -2
- package/src/skia/web/JsiSkPicture.ts +4 -4
- package/src/skia/web/JsiSkShaderFactory.ts +6 -6
- package/src/skia/web/JsiSkVerticesFactory.ts +2 -2
@@ -1,9 +1,13 @@
|
|
1
1
|
import type { CanvasKit, Matrix3x3 } from "canvaskit-wasm";
|
2
2
|
|
3
|
-
import
|
3
|
+
import { toMatrix3 } from "../types";
|
4
|
+
import type { SkMatrix, InputMatrix, Matrix4 } from "../types";
|
4
5
|
|
5
6
|
import { HostObject } from "./Host";
|
6
7
|
|
8
|
+
const isMatrixHostObject = (obj: InputMatrix): obj is SkMatrix =>
|
9
|
+
!Array.isArray(obj);
|
10
|
+
|
7
11
|
export class JsiSkMatrix
|
8
12
|
extends HostObject<Matrix3x3, "Matrix">
|
9
13
|
implements SkMatrix
|
@@ -24,9 +28,14 @@ export class JsiSkMatrix
|
|
24
28
|
// Do nothing - the matrix is represenetd by a Float32Array
|
25
29
|
};
|
26
30
|
|
27
|
-
concat(matrix:
|
31
|
+
concat(matrix: InputMatrix) {
|
28
32
|
this.preMultiply(
|
29
|
-
|
33
|
+
// eslint-disable-next-line no-nested-ternary
|
34
|
+
isMatrixHostObject(matrix)
|
35
|
+
? JsiSkMatrix.fromValue(matrix)
|
36
|
+
: matrix.length === 16
|
37
|
+
? toMatrix3(matrix as Matrix4)
|
38
|
+
: [...matrix]
|
30
39
|
);
|
31
40
|
return this;
|
32
41
|
}
|
@@ -14,7 +14,7 @@ import type {
|
|
14
14
|
SkPathEffect,
|
15
15
|
} from "../types";
|
16
16
|
|
17
|
-
import { HostObject,
|
17
|
+
import { HostObject, getEnum } from "./Host";
|
18
18
|
import { JsiSkColorFilter } from "./JsiSkColorFilter";
|
19
19
|
import { JsiSkImageFilter } from "./JsiSkImageFilter";
|
20
20
|
import { JsiSkMaskFilter } from "./JsiSkMaskFilter";
|
@@ -75,7 +75,7 @@ export class JsiSkPaint extends HostObject<Paint, "Paint"> implements SkPaint {
|
|
75
75
|
}
|
76
76
|
|
77
77
|
setBlendMode(blendMode: BlendMode) {
|
78
|
-
this.ref.setBlendMode(
|
78
|
+
this.ref.setBlendMode(getEnum(this.CanvasKit.BlendMode, blendMode));
|
79
79
|
}
|
80
80
|
|
81
81
|
setColor(color: SkColor) {
|
@@ -103,11 +103,11 @@ export class JsiSkPaint extends HostObject<Paint, "Paint"> implements SkPaint {
|
|
103
103
|
}
|
104
104
|
|
105
105
|
setStrokeCap(cap: StrokeCap) {
|
106
|
-
this.ref.setStrokeCap(
|
106
|
+
this.ref.setStrokeCap(getEnum(this.CanvasKit.StrokeCap, cap));
|
107
107
|
}
|
108
108
|
|
109
109
|
setStrokeJoin(join: StrokeJoin) {
|
110
|
-
this.ref.setStrokeJoin(
|
110
|
+
this.ref.setStrokeJoin(getEnum(this.CanvasKit.StrokeJoin, join));
|
111
111
|
}
|
112
112
|
|
113
113
|
setStrokeMiter(limit: number) {
|
@@ -13,7 +13,7 @@ import type {
|
|
13
13
|
StrokeOpts,
|
14
14
|
} from "../types";
|
15
15
|
|
16
|
-
import {
|
16
|
+
import { getEnum, HostObject, optEnum } from "./Host";
|
17
17
|
import { JsiSkPoint } from "./JsiSkPoint";
|
18
18
|
import { JsiSkRect } from "./JsiSkRect";
|
19
19
|
import { JsiSkRRect } from "./JsiSkRRect";
|
@@ -149,7 +149,7 @@ export class JsiSkPath extends HostObject<Path, "Path"> implements SkPath {
|
|
149
149
|
}
|
150
150
|
|
151
151
|
setFillType(fill: FillType) {
|
152
|
-
this.ref.setFillType(
|
152
|
+
this.ref.setFillType(getEnum(this.CanvasKit.FillType, fill));
|
153
153
|
return this;
|
154
154
|
}
|
155
155
|
|
@@ -167,8 +167,8 @@ export class JsiSkPath extends HostObject<Path, "Path"> implements SkPath {
|
|
167
167
|
// eslint-disable-next-line camelcase
|
168
168
|
miter_limit: opts.width,
|
169
169
|
precision: opts.width,
|
170
|
-
join: optEnum(opts.join),
|
171
|
-
cap: optEnum(opts.cap),
|
170
|
+
join: optEnum(this.CanvasKit.StrokeJoin, opts.join),
|
171
|
+
cap: optEnum(this.CanvasKit.StrokeCap, opts.cap),
|
172
172
|
}
|
173
173
|
);
|
174
174
|
return result === null ? result : this;
|
@@ -315,7 +315,10 @@ export class JsiSkPath extends HostObject<Path, "Path"> implements SkPath {
|
|
315
315
|
}
|
316
316
|
|
317
317
|
op(path: SkPath, op: PathOp) {
|
318
|
-
return this.ref.op(
|
318
|
+
return this.ref.op(
|
319
|
+
JsiSkPath.fromValue(path),
|
320
|
+
getEnum(this.CanvasKit.PathOp, op)
|
321
|
+
);
|
319
322
|
}
|
320
323
|
|
321
324
|
simplify() {
|
@@ -8,7 +8,7 @@ import type {
|
|
8
8
|
SkPathEffect,
|
9
9
|
} from "../types";
|
10
10
|
|
11
|
-
import {
|
11
|
+
import { getEnum, Host, NotImplementedOnRNWeb } from "./Host";
|
12
12
|
import { JsiSkMatrix } from "./JsiSkMatrix";
|
13
13
|
import { JsiSkPath } from "./JsiSkPath";
|
14
14
|
import { JsiSkPathEffect } from "./JsiSkPathEffect";
|
@@ -69,7 +69,7 @@ export class JsiSkPathEffectFactory extends Host implements PathEffectFactory {
|
|
69
69
|
JsiSkPath.fromValue(path),
|
70
70
|
advance,
|
71
71
|
phase,
|
72
|
-
|
72
|
+
getEnum(this.CanvasKit.Path1DEffect, style)
|
73
73
|
);
|
74
74
|
if (pe === null) {
|
75
75
|
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,
|
6
|
+
import { Host, getEnum, NotImplementedOnRNWeb } from "./Host";
|
7
7
|
import { JsiSkPath } from "./JsiSkPath";
|
8
8
|
|
9
9
|
export class JsiSkPathFactory extends Host implements PathFactory {
|
@@ -27,7 +27,7 @@ export class JsiSkPathFactory extends Host implements PathFactory {
|
|
27
27
|
const path = this.CanvasKit.Path.MakeFromOp(
|
28
28
|
JsiSkPath.fromValue(one),
|
29
29
|
JsiSkPath.fromValue(two),
|
30
|
-
|
30
|
+
getEnum(this.CanvasKit.PathOp, op)
|
31
31
|
);
|
32
32
|
if (path === null) {
|
33
33
|
return null;
|
@@ -9,7 +9,7 @@ import type {
|
|
9
9
|
SkMatrix,
|
10
10
|
} from "../types";
|
11
11
|
|
12
|
-
import { HostObject,
|
12
|
+
import { HostObject, getEnum } from "./Host";
|
13
13
|
import { JsiSkShader } from "./JsiSkShader";
|
14
14
|
import { JsiSkMatrix } from "./JsiSkMatrix";
|
15
15
|
import { JsiSkRect } from "./JsiSkRect";
|
@@ -36,9 +36,9 @@ export class JsiSkPicture
|
|
36
36
|
return new JsiSkShader(
|
37
37
|
this.CanvasKit,
|
38
38
|
this.ref.makeShader(
|
39
|
-
|
40
|
-
|
41
|
-
|
39
|
+
getEnum(this.CanvasKit.TileMode, tmx),
|
40
|
+
getEnum(this.CanvasKit.TileMode, tmy),
|
41
|
+
getEnum(this.CanvasKit.FilterMode, mode),
|
42
42
|
localMatrix ? JsiSkMatrix.fromValue(localMatrix) : undefined,
|
43
43
|
tileRect ? JsiSkRect.fromValue(this.CanvasKit, tileRect) : undefined
|
44
44
|
)
|
@@ -10,7 +10,7 @@ import type {
|
|
10
10
|
} from "../types";
|
11
11
|
import type { ShaderFactory } from "../types/Shader/ShaderFactory";
|
12
12
|
|
13
|
-
import { Host,
|
13
|
+
import { Host, getEnum } from "./Host";
|
14
14
|
import { JsiSkMatrix } from "./JsiSkMatrix";
|
15
15
|
import { JsiSkPoint } from "./JsiSkPoint";
|
16
16
|
import { JsiSkShader } from "./JsiSkShader";
|
@@ -36,7 +36,7 @@ export class JsiSkShaderFactory extends Host implements ShaderFactory {
|
|
36
36
|
JsiSkPoint.fromValue(end),
|
37
37
|
colors,
|
38
38
|
pos,
|
39
|
-
|
39
|
+
getEnum(this.CanvasKit.TileMode, mode),
|
40
40
|
localMatrix === undefined
|
41
41
|
? undefined
|
42
42
|
: JsiSkMatrix.fromValue(localMatrix),
|
@@ -61,7 +61,7 @@ export class JsiSkShaderFactory extends Host implements ShaderFactory {
|
|
61
61
|
radius,
|
62
62
|
colors,
|
63
63
|
pos,
|
64
|
-
|
64
|
+
getEnum(this.CanvasKit.TileMode, mode),
|
65
65
|
localMatrix === undefined
|
66
66
|
? undefined
|
67
67
|
: JsiSkMatrix.fromValue(localMatrix),
|
@@ -90,7 +90,7 @@ export class JsiSkShaderFactory extends Host implements ShaderFactory {
|
|
90
90
|
endRadius,
|
91
91
|
colors,
|
92
92
|
pos,
|
93
|
-
|
93
|
+
getEnum(this.CanvasKit.TileMode, mode),
|
94
94
|
localMatrix === undefined
|
95
95
|
? undefined
|
96
96
|
: JsiSkMatrix.fromValue(localMatrix),
|
@@ -117,7 +117,7 @@ export class JsiSkShaderFactory extends Host implements ShaderFactory {
|
|
117
117
|
cy,
|
118
118
|
colors,
|
119
119
|
pos,
|
120
|
-
|
120
|
+
getEnum(this.CanvasKit.TileMode, mode),
|
121
121
|
localMatrix === undefined || localMatrix === null
|
122
122
|
? undefined
|
123
123
|
: JsiSkMatrix.fromValue(localMatrix),
|
@@ -174,7 +174,7 @@ export class JsiSkShaderFactory extends Host implements ShaderFactory {
|
|
174
174
|
return new JsiSkShader(
|
175
175
|
this.CanvasKit,
|
176
176
|
this.CanvasKit.Shader.MakeBlend(
|
177
|
-
|
177
|
+
getEnum(this.CanvasKit.BlendMode, mode),
|
178
178
|
JsiSkShader.fromValue(one),
|
179
179
|
JsiSkShader.fromValue(two)
|
180
180
|
)
|
@@ -2,8 +2,8 @@ import type { CanvasKit } from "canvaskit-wasm";
|
|
2
2
|
|
3
3
|
import type { SkColor, SkPoint, VertexMode } from "../types";
|
4
4
|
|
5
|
-
import { ckEnum } from "./Host";
|
6
5
|
import { JsiSkVertices } from "./JsiSkVertices";
|
6
|
+
import { getEnum } from "./Host";
|
7
7
|
|
8
8
|
const concat = (...arrays: Float32Array[]) => {
|
9
9
|
let totalLength = 0;
|
@@ -31,7 +31,7 @@ export const MakeVertices = (
|
|
31
31
|
new JsiSkVertices(
|
32
32
|
CanvasKit,
|
33
33
|
CanvasKit.MakeVertices(
|
34
|
-
|
34
|
+
getEnum(CanvasKit.VertexMode, mode),
|
35
35
|
positions.map(({ x, y }) => [x, y]).flat(),
|
36
36
|
(textureCoordinates || []).map(({ x, y }) => [x, y]).flat(),
|
37
37
|
!colors ? null : colors.reduce((a, c) => concat(a, c)),
|