@shopify/react-native-skia 0.1.141 → 0.1.145
Sign up to get free protection for your applications and to get access to all the features.
- 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,56 +1,67 @@
|
|
1
|
-
import { ckEnum, HostObject
|
1
|
+
import { ckEnum, HostObject } from "./Host";
|
2
|
+
import { JsiSkPaint } from "./JsiSkPaint";
|
2
3
|
import { JsiSkRect } from "./JsiSkRect";
|
4
|
+
import { JsiSkRRect } from "./JsiSkRRect";
|
5
|
+
import { JsiSkImage } from "./JsiSkImage";
|
6
|
+
import { JsiSkVertices } from "./JsiSkVertices";
|
7
|
+
import { JsiSkPath } from "./JsiSkPath";
|
8
|
+
import { JsiSkFont } from "./JsiSkFont";
|
9
|
+
import { JsiSkTextBlob } from "./JsiSkTextBlob";
|
10
|
+
import { JsiSkPicture } from "./JsiSkPicture";
|
11
|
+
import { JsiSkMatrix } from "./JsiSkMatrix";
|
12
|
+
import { JsiSkImageFilter } from "./JsiSkImageFilter";
|
13
|
+
import { JsiSkPoint } from "./JsiSkPoint";
|
3
14
|
export class JsiSkCanvas extends HostObject {
|
4
15
|
constructor(CanvasKit, ref) {
|
5
16
|
super(CanvasKit, ref, "Canvas");
|
6
17
|
}
|
7
18
|
|
8
19
|
drawRect(rect, paint) {
|
9
|
-
this.ref.drawRect(JsiSkRect.fromValue(this.CanvasKit, rect)
|
20
|
+
this.ref.drawRect(JsiSkRect.fromValue(this.CanvasKit, rect), JsiSkPaint.fromValue(paint));
|
10
21
|
}
|
11
22
|
|
12
23
|
drawImage(image, x, y, paint) {
|
13
|
-
this.ref.drawImage(
|
24
|
+
this.ref.drawImage(JsiSkImage.fromValue(image), x, y, paint ? JsiSkPaint.fromValue(paint) : paint);
|
14
25
|
}
|
15
26
|
|
16
27
|
drawImageRect(img, src, dest, paint, fastSample) {
|
17
|
-
this.ref.drawImageRect(
|
28
|
+
this.ref.drawImageRect(JsiSkImage.fromValue(img), JsiSkRect.fromValue(this.CanvasKit, src), JsiSkRect.fromValue(this.CanvasKit, dest), JsiSkPaint.fromValue(paint), fastSample);
|
18
29
|
}
|
19
30
|
|
20
31
|
drawImageCubic(img, left, top, B, C, paint) {
|
21
|
-
this.ref.drawImageCubic(
|
32
|
+
this.ref.drawImageCubic(JsiSkImage.fromValue(img), left, top, B, C, paint ? JsiSkPaint.fromValue(paint) : paint);
|
22
33
|
}
|
23
34
|
|
24
35
|
drawImageOptions(img, left, top, fm, mm, paint) {
|
25
|
-
this.ref.drawImageOptions(
|
36
|
+
this.ref.drawImageOptions(JsiSkImage.fromValue(img), left, top, ckEnum(fm), ckEnum(mm), paint ? JsiSkPaint.fromValue(paint) : paint);
|
26
37
|
}
|
27
38
|
|
28
39
|
drawImageNine(img, center, dest, filter, paint) {
|
29
|
-
this.ref.drawImageNine(
|
40
|
+
this.ref.drawImageNine(JsiSkImage.fromValue(img), Array.from(JsiSkRect.fromValue(this.CanvasKit, center)), JsiSkRect.fromValue(this.CanvasKit, dest), ckEnum(filter), paint ? JsiSkPaint.fromValue(paint) : paint);
|
30
41
|
}
|
31
42
|
|
32
43
|
drawImageRectCubic(img, src, dest, B, C, paint) {
|
33
|
-
this.ref.drawImageRectCubic(
|
44
|
+
this.ref.drawImageRectCubic(JsiSkImage.fromValue(img), JsiSkRect.fromValue(this.CanvasKit, src), JsiSkRect.fromValue(this.CanvasKit, dest), B, C, paint ? JsiSkPaint.fromValue(paint) : paint);
|
34
45
|
}
|
35
46
|
|
36
47
|
drawImageRectOptions(img, src, dest, fm, mm, paint) {
|
37
|
-
this.ref.drawImageRectOptions(
|
48
|
+
this.ref.drawImageRectOptions(JsiSkImage.fromValue(img), JsiSkRect.fromValue(this.CanvasKit, src), JsiSkRect.fromValue(this.CanvasKit, dest), ckEnum(fm), ckEnum(mm), paint ? JsiSkPaint.fromValue(paint) : paint);
|
38
49
|
}
|
39
50
|
|
40
51
|
drawPaint(paint) {
|
41
|
-
this.ref.drawPaint(
|
52
|
+
this.ref.drawPaint(JsiSkPaint.fromValue(paint));
|
42
53
|
}
|
43
54
|
|
44
55
|
drawLine(x0, y0, x1, y1, paint) {
|
45
|
-
this.ref.drawLine(x0, y0, x1, y1,
|
56
|
+
this.ref.drawLine(x0, y0, x1, y1, JsiSkPaint.fromValue(paint));
|
46
57
|
}
|
47
58
|
|
48
59
|
drawCircle(cx, cy, radius, paint) {
|
49
|
-
this.ref.drawCircle(cx, cy, radius,
|
60
|
+
this.ref.drawCircle(cx, cy, radius, JsiSkPaint.fromValue(paint));
|
50
61
|
}
|
51
62
|
|
52
63
|
drawVertices(verts, mode, paint) {
|
53
|
-
this.ref.drawVertices(
|
64
|
+
this.ref.drawVertices(JsiSkVertices.fromValue(verts), ckEnum(mode), JsiSkPaint.fromValue(paint));
|
54
65
|
}
|
55
66
|
|
56
67
|
drawPatch(cubics, colors, texs, mode, paint) {
|
@@ -60,7 +71,7 @@ export class JsiSkCanvas extends HostObject {
|
|
60
71
|
y
|
61
72
|
} = _ref;
|
62
73
|
return [x, y];
|
63
|
-
}).flat(), colors,
|
74
|
+
}).flat(), colors, texs ? texs.flatMap(p => Array.from(JsiSkPoint.fromValue(p))) : texs, mode ? ckEnum(mode) : null, paint ? JsiSkPaint.fromValue(paint) : undefined);
|
64
75
|
}
|
65
76
|
|
66
77
|
restoreToCount(saveCount) {
|
@@ -74,39 +85,39 @@ export class JsiSkCanvas extends HostObject {
|
|
74
85
|
y
|
75
86
|
} = _ref2;
|
76
87
|
return [x, y];
|
77
|
-
}).flat(),
|
88
|
+
}).flat(), JsiSkPaint.fromValue(paint));
|
78
89
|
}
|
79
90
|
|
80
91
|
drawArc(oval, startAngle, sweepAngle, useCenter, paint) {
|
81
|
-
this.ref.drawArc(
|
92
|
+
this.ref.drawArc(JsiSkRect.fromValue(this.CanvasKit, oval), startAngle, sweepAngle, useCenter, JsiSkPaint.fromValue(paint));
|
82
93
|
}
|
83
94
|
|
84
95
|
drawRRect(rrect, paint) {
|
85
|
-
this.ref.drawRRect(
|
96
|
+
this.ref.drawRRect(JsiSkRRect.fromValue(this.CanvasKit, rrect), JsiSkPaint.fromValue(paint));
|
86
97
|
}
|
87
98
|
|
88
99
|
drawDRRect(outer, inner, paint) {
|
89
|
-
this.ref.drawDRRect(
|
100
|
+
this.ref.drawDRRect(JsiSkRRect.fromValue(this.CanvasKit, outer), JsiSkRRect.fromValue(this.CanvasKit, inner), JsiSkPaint.fromValue(paint));
|
90
101
|
}
|
91
102
|
|
92
103
|
drawOval(oval, paint) {
|
93
|
-
this.ref.drawOval(
|
104
|
+
this.ref.drawOval(JsiSkRect.fromValue(this.CanvasKit, oval), JsiSkPaint.fromValue(paint));
|
94
105
|
}
|
95
106
|
|
96
107
|
drawPath(path, paint) {
|
97
|
-
this.ref.drawPath(
|
108
|
+
this.ref.drawPath(JsiSkPath.fromValue(path), JsiSkPaint.fromValue(paint));
|
98
109
|
}
|
99
110
|
|
100
111
|
drawText(str, x, y, paint, font) {
|
101
|
-
this.ref.drawText(str, x, y,
|
112
|
+
this.ref.drawText(str, x, y, JsiSkPaint.fromValue(paint), JsiSkFont.fromValue(font));
|
102
113
|
}
|
103
114
|
|
104
115
|
drawTextBlob(blob, x, y, paint) {
|
105
|
-
this.ref.drawTextBlob(
|
116
|
+
this.ref.drawTextBlob(JsiSkTextBlob.fromValue(blob), x, y, JsiSkPaint.fromValue(paint));
|
106
117
|
}
|
107
118
|
|
108
119
|
drawGlyphs(glyphs, positions, x, y, font, paint) {
|
109
|
-
this.ref.drawGlyphs(glyphs, positions.map(p => [p.x, p.y]).flat(), x, y,
|
120
|
+
this.ref.drawGlyphs(glyphs, positions.map(p => [p.x, p.y]).flat(), x, y, JsiSkFont.fromValue(font), JsiSkPaint.fromValue(paint));
|
110
121
|
}
|
111
122
|
|
112
123
|
drawSvg(_svgDom, _width, _height) {
|
@@ -118,7 +129,7 @@ export class JsiSkCanvas extends HostObject {
|
|
118
129
|
}
|
119
130
|
|
120
131
|
saveLayer(paint, bounds, backdrop, flags) {
|
121
|
-
return this.ref.saveLayer(
|
132
|
+
return this.ref.saveLayer(paint ? JsiSkPaint.fromValue(paint) : undefined, bounds ? JsiSkRect.fromValue(this.CanvasKit, bounds) : bounds, backdrop ? JsiSkImageFilter.fromValue(backdrop) : backdrop, flags);
|
122
133
|
}
|
123
134
|
|
124
135
|
restore() {
|
@@ -150,23 +161,23 @@ export class JsiSkCanvas extends HostObject {
|
|
150
161
|
}
|
151
162
|
|
152
163
|
clipPath(path, op, doAntiAlias) {
|
153
|
-
this.ref.clipPath(
|
164
|
+
this.ref.clipPath(JsiSkPath.fromValue(path), ckEnum(op), doAntiAlias);
|
154
165
|
}
|
155
166
|
|
156
167
|
clipRect(rect, op, doAntiAlias) {
|
157
|
-
this.ref.clipRect(
|
168
|
+
this.ref.clipRect(JsiSkRect.fromValue(this.CanvasKit, rect), ckEnum(op), doAntiAlias);
|
158
169
|
}
|
159
170
|
|
160
171
|
clipRRect(rrect, op, doAntiAlias) {
|
161
|
-
this.ref.clipRRect(
|
172
|
+
this.ref.clipRRect(JsiSkRRect.fromValue(this.CanvasKit, rrect), ckEnum(op), doAntiAlias);
|
162
173
|
}
|
163
174
|
|
164
175
|
concat(m) {
|
165
|
-
this.ref.concat(
|
176
|
+
this.ref.concat(JsiSkMatrix.fromValue(m));
|
166
177
|
}
|
167
178
|
|
168
179
|
drawPicture(skp) {
|
169
|
-
this.ref.drawPicture(
|
180
|
+
this.ref.drawPicture(JsiSkPicture.fromValue(skp));
|
170
181
|
}
|
171
182
|
|
172
183
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["JsiSkCanvas.ts"],"names":["ckEnum","HostObject","toValue","toUndefinedableValue","toOptionalValue","JsiSkRect","JsiSkCanvas","constructor","CanvasKit","ref","drawRect","rect","paint","fromValue","drawImage","image","x","y","drawImageRect","img","src","dest","fastSample","drawImageCubic","left","top","B","C","drawImageOptions","fm","mm","drawImageNine","center","filter","drawImageRectCubic","drawImageRectOptions","drawPaint","drawLine","x0","y0","x1","y1","drawCircle","cx","cy","radius","drawVertices","verts","mode","drawPatch","cubics","colors","texs","map","flat","restoreToCount","saveCount","drawPoints","points","drawArc","oval","startAngle","sweepAngle","useCenter","drawRRect","rrect","drawDRRect","outer","inner","drawOval","drawPath","path","drawText","str","font","drawTextBlob","blob","drawGlyphs","glyphs","positions","p","drawSvg","_svgDom","_width","_height","Error","save","saveLayer","bounds","backdrop","flags","restore","rotate","rotationInDegrees","rx","ry","scale","sx","sy","skew","translate","dx","dy","drawColor","color","blendMode","undefined","clear","clipPath","op","doAntiAlias","clipRect","clipRRect","concat","m","drawPicture","skp"],"mappings":"AA0BA,SACEA,MADF,EAEEC,UAFF,EAGEC,OAHF,EAIEC,oBAJF,EAKEC,eALF,QAMO,QANP;AAOA,SAASC,SAAT,QAA0B,aAA1B;AAEA,OAAO,MAAMC,WAAN,SACGL,UADH,CAGP;AACEM,EAAAA,WAAW,CAACC,SAAD,EAAuBC,GAAvB,EAAoC;AAC7C,UAAMD,SAAN,EAAiBC,GAAjB,EAAsB,QAAtB;AACD;;AAEDC,EAAAA,QAAQ,CAACC,IAAD,EAAeC,KAAf,EAA+B;AACrC,SAAKH,GAAL,CAASC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EAAD,CAAvC,EAA6CC,WAA7C;AACD;;AAEDC,EAAAA,QAAQ,CAACpG,IAAD,EAAekG,EAAf,EAA2BC,WAA3B,EAAiD;AACvD,SAAKrG,GAAL,CAASsG,QAAT,CAAkB7G,OAAO,CAACS,IAAD,CAAzB,EAAiCX,MAAM,CAAC6G,EAAD,CAAvC,EAA6CC,WAA7C;AACD;;AAEDE,EAAAA,SAAS,CAAC/C,KAAD,EAAiB4C,EAAjB,EAA6BC,WAA7B,EAAmD;AAC1D,SAAKrG,GAAL,CAASuG,SAAT,CAAmB9G,OAAO,CAAC+D,KAAD,CAA1B,EAAmCjE,MAAM,CAAC6G,EAAD,CAAzC,EAA+CC,WAA/C;AACD;;AAEDG,EAAAA,MAAM,CAACC,CAAD,EAAc;AAClB,SAAKzG,GAAL,CAASwG,MAAT,CAAgB/G,OAAO,CAACgH,CAAD,CAAvB;AACD;;AAEDC,EAAAA,WAAW,CAACC,GAAD,EAAiB;AAC1B,SAAK3G,GAAL,CAAS0G,WAAT,CAAqBjH,OAAO,CAACkH,GAAD,CAA5B;AACD;;AAlSH","sourcesContent":["import type { Canvas, Image, CanvasKit, Paint } from \"canvaskit-wasm\";\n\nimport type {\n BlendMode,\n ClipOp,\n FilterMode,\n MipmapMode,\n PointMode,\n SaveLayerFlag,\n SkCanvas,\n SkColor,\n SkFont,\n SkImage,\n SkImageFilter,\n SkMatrix,\n SkPaint,\n SkPath,\n SkPicture,\n SkPoint,\n SkRect,\n SkRRect,\n SkSVG,\n SkTextBlob,\n SkVertices,\n} from \"../types\";\n\nimport {\n ckEnum,\n HostObject,\n toValue,\n toUndefinedableValue,\n toOptionalValue,\n} from \"./Host\";\nimport { JsiSkRect } from \"./JsiSkRect\";\n\nexport class JsiSkCanvas\n extends HostObject<Canvas, \"Canvas\">\n implements SkCanvas\n{\n constructor(CanvasKit: CanvasKit, ref: Canvas) {\n super(CanvasKit, ref, \"Canvas\");\n }\n\n drawRect(rect: SkRect, paint: SkPaint) {\n this.ref.drawRect(\n JsiSkRect.fromValue(this.CanvasKit, rect).ref,\n toValue<Paint>(paint)\n );\n }\n\n drawImage(image: SkImage, x: number, y: number, paint?: SkPaint) {\n this.ref.drawImage(toValue<Image>(image), x, y, toOptionalValue(paint));\n }\n\n drawImageRect(\n img: SkImage,\n src: SkRect,\n dest: SkRect,\n paint: SkPaint,\n fastSample?: boolean\n ) {\n this.ref.drawImageRect(\n toValue<Image>(img),\n JsiSkRect.fromValue(this.CanvasKit, src).ref,\n JsiSkRect.fromValue(this.CanvasKit, dest).ref,\n toValue<Paint>(paint),\n fastSample\n );\n }\n\n drawImageCubic(\n img: SkImage,\n left: number,\n top: number,\n B: number,\n C: number,\n paint?: SkPaint | null\n ) {\n this.ref.drawImageCubic(\n toValue(img),\n left,\n top,\n B,\n C,\n toOptionalValue(paint)\n );\n }\n\n drawImageOptions(\n img: SkImage,\n left: number,\n top: number,\n fm: FilterMode,\n mm: MipmapMode,\n paint?: SkPaint | null\n ) {\n this.ref.drawImageOptions(\n toValue(img),\n left,\n top,\n ckEnum(fm),\n ckEnum(mm),\n toOptionalValue(paint)\n );\n }\n\n drawImageNine(\n img: SkImage,\n center: SkRect,\n dest: SkRect,\n filter: FilterMode,\n paint?: SkPaint | null\n ) {\n this.ref.drawImageNine(\n toValue(img),\n toValue(center),\n toValue(dest),\n ckEnum(filter),\n toOptionalValue(paint)\n );\n }\n\n drawImageRectCubic(\n img: SkImage,\n src: SkRect,\n dest: SkRect,\n B: number,\n C: number,\n paint?: SkPaint | null\n ) {\n this.ref.drawImageRectCubic(\n toValue<Image>(img),\n JsiSkRect.fromValue(this.CanvasKit, src).ref,\n JsiSkRect.fromValue(this.CanvasKit, dest).ref,\n B,\n C,\n toOptionalValue(paint)\n );\n }\n\n drawImageRectOptions(\n img: SkImage,\n src: SkRect,\n dest: SkRect,\n fm: FilterMode,\n mm: MipmapMode,\n paint?: SkPaint | null\n ) {\n this.ref.drawImageRectOptions(\n toValue<Image>(img),\n JsiSkRect.fromValue(this.CanvasKit, src).ref,\n JsiSkRect.fromValue(this.CanvasKit, dest).ref,\n ckEnum(fm),\n ckEnum(mm),\n toOptionalValue(paint)\n );\n }\n\n drawPaint(paint: SkPaint) {\n this.ref.drawPaint(toValue(paint));\n }\n\n drawLine(x0: number, y0: number, x1: number, y1: number, paint: SkPaint) {\n this.ref.drawLine(x0, y0, x1, y1, toValue(paint));\n }\n\n drawCircle(cx: number, cy: number, radius: number, paint: SkPaint) {\n this.ref.drawCircle(cx, cy, radius, toValue(paint));\n }\n\n drawVertices(verts: SkVertices, mode: BlendMode, paint: SkPaint) {\n this.ref.drawVertices(toValue(verts), ckEnum(mode), toValue(paint));\n }\n\n drawPatch(\n cubics: SkPoint[],\n colors?: SkColor[] | null,\n texs?: SkPoint[] | null,\n mode?: BlendMode | null,\n paint?: SkPaint\n ) {\n this.ref.drawPatch(\n cubics.map(({ x, y }) => [x, y]).flat(),\n colors,\n toOptionalValue(texs),\n mode ? ckEnum(mode) : null,\n toUndefinedableValue(paint)\n );\n }\n\n restoreToCount(saveCount: number) {\n this.ref.restoreToCount(saveCount);\n }\n\n drawPoints(mode: PointMode, points: SkPoint[], paint: SkPaint) {\n this.ref.drawPoints(\n ckEnum(mode),\n points.map(({ x, y }) => [x, y]).flat(),\n toValue(paint)\n );\n }\n\n drawArc(\n oval: SkRect,\n startAngle: number,\n sweepAngle: number,\n useCenter: boolean,\n paint: SkPaint\n ) {\n this.ref.drawArc(\n toValue(oval),\n startAngle,\n sweepAngle,\n useCenter,\n toValue(paint)\n );\n }\n\n drawRRect(rrect: SkRRect, paint: SkPaint) {\n this.ref.drawRRect(toValue(rrect), toValue(paint));\n }\n\n drawDRRect(outer: SkRRect, inner: SkRRect, paint: SkPaint) {\n this.ref.drawDRRect(toValue(outer), toValue(inner), toValue(paint));\n }\n\n drawOval(oval: SkRect, paint: SkPaint) {\n this.ref.drawOval(toValue(oval), toValue(paint));\n }\n\n drawPath(path: SkPath, paint: SkPaint) {\n this.ref.drawPath(toValue(path), toValue(paint));\n }\n\n drawText(str: string, x: number, y: number, paint: SkPaint, font: SkFont) {\n this.ref.drawText(str, x, y, toValue(paint), toValue(font));\n }\n\n drawTextBlob(blob: SkTextBlob, x: number, y: number, paint: SkPaint) {\n this.ref.drawTextBlob(toValue(blob), x, y, toValue(paint));\n }\n\n drawGlyphs(\n glyphs: number[],\n positions: SkPoint[],\n x: number,\n y: number,\n font: SkFont,\n paint: SkPaint\n ) {\n this.ref.drawGlyphs(\n glyphs,\n positions.map((p) => [p.x, p.y]).flat(),\n x,\n y,\n toValue(font),\n toValue(paint)\n );\n }\n\n drawSvg(_svgDom: SkSVG, _width?: number, _height?: number) {\n throw new Error(\"drawSvg is not implemented on React Native Web\");\n }\n\n save() {\n return this.ref.save();\n }\n\n saveLayer(\n paint?: SkPaint,\n bounds?: SkRect | null,\n backdrop?: SkImageFilter | null,\n flags?: SaveLayerFlag\n ) {\n return this.ref.saveLayer(\n toUndefinedableValue(paint),\n toOptionalValue(bounds),\n toOptionalValue(backdrop),\n flags\n );\n }\n\n restore() {\n this.ref.restore();\n }\n\n rotate(rotationInDegrees: number, rx: number, ry: number) {\n this.ref.rotate(rotationInDegrees, rx, ry);\n }\n\n scale(sx: number, sy: number) {\n this.ref.scale(sx, sy);\n }\n\n skew(sx: number, sy: number) {\n this.ref.skew(sx, sy);\n }\n\n translate(dx: number, dy: number) {\n this.ref.translate(dx, dy);\n }\n\n drawColor(color: SkColor, blendMode?: BlendMode) {\n this.ref.drawColor(color, blendMode ? ckEnum(blendMode) : undefined);\n }\n\n clear(color: SkColor) {\n this.ref.clear(color);\n }\n\n clipPath(path: SkPath, op: ClipOp, doAntiAlias: boolean) {\n this.ref.clipPath(toValue(path), ckEnum(op), doAntiAlias);\n }\n\n clipRect(rect: SkRect, op: ClipOp, doAntiAlias: boolean) {\n this.ref.clipRect(toValue(rect), ckEnum(op), doAntiAlias);\n }\n\n clipRRect(rrect: SkRRect, op: ClipOp, doAntiAlias: boolean) {\n this.ref.clipRRect(toValue(rrect), ckEnum(op), doAntiAlias);\n }\n\n concat(m: SkMatrix) {\n this.ref.concat(toValue(m));\n }\n\n drawPicture(skp: SkPicture) {\n this.ref.drawPicture(toValue(skp));\n }\n}\n"]}
|
1
|
+
{"version":3,"sources":["JsiSkCanvas.ts"],"names":["ckEnum","HostObject","JsiSkPaint","JsiSkRect","JsiSkRRect","JsiSkImage","JsiSkVertices","JsiSkPath","JsiSkFont","JsiSkTextBlob","JsiSkPicture","JsiSkMatrix","JsiSkImageFilter","JsiSkPoint","JsiSkCanvas","constructor","CanvasKit","ref","drawRect","rect","paint","fromValue","drawImage","image","x","y","drawImageRect","img","src","dest","fastSample","drawImageCubic","left","top","B","C","drawImageOptions","fm","mm","drawImageNine","center","filter","Array","from","drawImageRectCubic","drawImageRectOptions","drawPaint","drawLine","x0","y0","x1","y1","drawCircle","cx","cy","radius","drawVertices","verts","mode","drawPatch","cubics","colors","texs","map","flat","flatMap","p","undefined","restoreToCount","saveCount","drawPoints","points","drawArc","oval","startAngle","sweepAngle","useCenter","drawRRect","rrect","drawDRRect","outer","inner","drawOval","drawPath","path","drawText","str","font","drawTextBlob","blob","drawGlyphs","glyphs","positions","drawSvg","_svgDom","_width","_height","Error","save","saveLayer","bounds","backdrop","flags","restore","rotate","rotationInDegrees","rx","ry","scale","sx","sy","skew","translate","dx","dy","drawColor","color","blendMode","clear","clipPath","op","doAntiAlias","clipRect","clipRRect","concat","m","drawPicture","skp"],"mappings":"AA0BA,SAASA,MAAT,EAAiBC,UAAjB,QAAmC,QAAnC;AACA,SAASC,UAAT,QAA2B,cAA3B;AACA,SAASC,SAAT,QAA0B,aAA1B;AACA,SAASC,UAAT,QAA2B,cAA3B;AACA,SAASC,UAAT,QAA2B,cAA3B;AACA,SAASC,aAAT,QAA8B,iBAA9B;AACA,SAASC,SAAT,QAA0B,aAA1B;AACA,SAASC,SAAT,QAA0B,aAA1B;AACA,SAASC,aAAT,QAA8B,iBAA9B;AACA,SAASC,YAAT,Q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,KAAK,CAACF,KAAD,EAAiB;AACpB,SAAKnG,GAAL,CAASqG,KAAT,CAAeF,KAAf;AACD;;AAEDG,EAAAA,QAAQ,CAACnC,IAAD,EAAeoC,EAAf,EAA2BC,WAA3B,EAAiD;AACvD,SAAKxG,GAAL,CAASsG,QAAT,CAAkBhH,SAAS,CAACc,SAAV,CAAoB+D,IAApB,CAAlB,EAA6CpF,MAAM,CAACwH,EAAD,CAAnD,EAAyDC,WAAzD;AACD;;AAEDC,EAAAA,QAAQ,CAACvG,IAAD,EAAeqG,EAAf,EAA2BC,WAA3B,EAAiD;AACvD,SAAKxG,GAAL,CAASyG,QAAT,CACEvH,SAAS,CAACkB,SAAV,CAAoB,KAAKL,SAAzB,EAAoCG,IAApC,CADF,EAEEnB,MAAM,CAACwH,EAAD,CAFR,EAGEC,WAHF;AAKD;;AAEDE,EAAAA,SAAS,CAAC7C,KAAD,EAAiB0C,EAAjB,EAA6BC,WAA7B,EAAmD;AAC1D,SAAKxG,GAAL,CAAS0G,SAAT,CACEvH,UAAU,CAACiB,SAAX,CAAqB,KAAKL,SAA1B,EAAqC8D,KAArC,CADF,EAEE9E,MAAM,CAACwH,EAAD,CAFR,EAGEC,WAHF;AAKD;;AAEDG,EAAAA,MAAM,CAACC,CAAD,EAAc;AAClB,SAAK5G,GAAL,CAAS2G,MAAT,CAAgBjH,WAAW,CAACU,SAAZ,CAAsBwG,CAAtB,CAAhB;AACD;;AAEDC,EAAAA,WAAW,CAACC,GAAD,EAAiB;AAC1B,SAAK9G,GAAL,CAAS6G,WAAT,CAAqBpH,YAAY,CAACW,SAAb,CAAuB0G,GAAvB,CAArB;AACD;;AAxUH","sourcesContent":["import type { Canvas, CanvasKit } from \"canvaskit-wasm\";\n\nimport type {\n BlendMode,\n ClipOp,\n FilterMode,\n MipmapMode,\n PointMode,\n SaveLayerFlag,\n SkCanvas,\n SkColor,\n SkFont,\n SkImage,\n SkImageFilter,\n SkMatrix,\n SkPaint,\n SkPath,\n SkPicture,\n SkPoint,\n SkRect,\n SkRRect,\n SkSVG,\n SkTextBlob,\n SkVertices,\n} from \"../types\";\n\nimport { ckEnum, HostObject } from \"./Host\";\nimport { JsiSkPaint } from \"./JsiSkPaint\";\nimport { JsiSkRect } from \"./JsiSkRect\";\nimport { JsiSkRRect } from \"./JsiSkRRect\";\nimport { JsiSkImage } from \"./JsiSkImage\";\nimport { JsiSkVertices } from \"./JsiSkVertices\";\nimport { JsiSkPath } from \"./JsiSkPath\";\nimport { JsiSkFont } from \"./JsiSkFont\";\nimport { JsiSkTextBlob } from \"./JsiSkTextBlob\";\nimport { JsiSkPicture } from \"./JsiSkPicture\";\nimport { JsiSkMatrix } from \"./JsiSkMatrix\";\nimport { JsiSkImageFilter } from \"./JsiSkImageFilter\";\nimport { JsiSkPoint } from \"./JsiSkPoint\";\n\nexport class JsiSkCanvas\n extends HostObject<Canvas, \"Canvas\">\n implements SkCanvas\n{\n constructor(CanvasKit: CanvasKit, ref: Canvas) {\n super(CanvasKit, ref, \"Canvas\");\n }\n\n drawRect(rect: SkRect, paint: SkPaint) {\n this.ref.drawRect(\n JsiSkRect.fromValue(this.CanvasKit, rect),\n JsiSkPaint.fromValue(paint)\n );\n }\n\n drawImage(image: SkImage, x: number, y: number, paint?: SkPaint) {\n this.ref.drawImage(\n JsiSkImage.fromValue(image),\n x,\n y,\n paint ? JsiSkPaint.fromValue(paint) : paint\n );\n }\n\n drawImageRect(\n img: SkImage,\n src: SkRect,\n dest: SkRect,\n paint: SkPaint,\n fastSample?: boolean\n ) {\n this.ref.drawImageRect(\n JsiSkImage.fromValue(img),\n JsiSkRect.fromValue(this.CanvasKit, src),\n JsiSkRect.fromValue(this.CanvasKit, dest),\n JsiSkPaint.fromValue(paint),\n fastSample\n );\n }\n\n drawImageCubic(\n img: SkImage,\n left: number,\n top: number,\n B: number,\n C: number,\n paint?: SkPaint | null\n ) {\n this.ref.drawImageCubic(\n JsiSkImage.fromValue(img),\n left,\n top,\n B,\n C,\n paint ? JsiSkPaint.fromValue(paint) : paint\n );\n }\n\n drawImageOptions(\n img: SkImage,\n left: number,\n top: number,\n fm: FilterMode,\n mm: MipmapMode,\n paint?: SkPaint | null\n ) {\n this.ref.drawImageOptions(\n JsiSkImage.fromValue(img),\n left,\n top,\n ckEnum(fm),\n ckEnum(mm),\n paint ? JsiSkPaint.fromValue(paint) : paint\n );\n }\n\n drawImageNine(\n img: SkImage,\n center: SkRect,\n dest: SkRect,\n filter: FilterMode,\n paint?: SkPaint | null\n ) {\n this.ref.drawImageNine(\n JsiSkImage.fromValue(img),\n Array.from(JsiSkRect.fromValue(this.CanvasKit, center)),\n JsiSkRect.fromValue(this.CanvasKit, dest),\n ckEnum(filter),\n paint ? JsiSkPaint.fromValue(paint) : paint\n );\n }\n\n drawImageRectCubic(\n img: SkImage,\n src: SkRect,\n dest: SkRect,\n B: number,\n C: number,\n paint?: SkPaint | null\n ) {\n this.ref.drawImageRectCubic(\n JsiSkImage.fromValue(img),\n JsiSkRect.fromValue(this.CanvasKit, src),\n JsiSkRect.fromValue(this.CanvasKit, dest),\n B,\n C,\n paint ? JsiSkPaint.fromValue(paint) : paint\n );\n }\n\n drawImageRectOptions(\n img: SkImage,\n src: SkRect,\n dest: SkRect,\n fm: FilterMode,\n mm: MipmapMode,\n paint?: SkPaint | null\n ) {\n this.ref.drawImageRectOptions(\n JsiSkImage.fromValue(img),\n JsiSkRect.fromValue(this.CanvasKit, src),\n JsiSkRect.fromValue(this.CanvasKit, dest),\n ckEnum(fm),\n ckEnum(mm),\n paint ? JsiSkPaint.fromValue(paint) : paint\n );\n }\n\n drawPaint(paint: SkPaint) {\n this.ref.drawPaint(JsiSkPaint.fromValue(paint));\n }\n\n drawLine(x0: number, y0: number, x1: number, y1: number, paint: SkPaint) {\n this.ref.drawLine(x0, y0, x1, y1, JsiSkPaint.fromValue(paint));\n }\n\n drawCircle(cx: number, cy: number, radius: number, paint: SkPaint) {\n this.ref.drawCircle(cx, cy, radius, JsiSkPaint.fromValue(paint));\n }\n\n drawVertices(verts: SkVertices, mode: BlendMode, paint: SkPaint) {\n this.ref.drawVertices(\n JsiSkVertices.fromValue(verts),\n ckEnum(mode),\n JsiSkPaint.fromValue(paint)\n );\n }\n\n drawPatch(\n cubics: SkPoint[],\n colors?: SkColor[] | null,\n texs?: SkPoint[] | null,\n mode?: BlendMode | null,\n paint?: SkPaint\n ) {\n this.ref.drawPatch(\n cubics.map(({ x, y }) => [x, y]).flat(),\n colors,\n texs ? texs.flatMap((p) => Array.from(JsiSkPoint.fromValue(p))) : texs,\n mode ? ckEnum(mode) : null,\n paint ? JsiSkPaint.fromValue(paint) : undefined\n );\n }\n\n restoreToCount(saveCount: number) {\n this.ref.restoreToCount(saveCount);\n }\n\n drawPoints(mode: PointMode, points: SkPoint[], paint: SkPaint) {\n this.ref.drawPoints(\n ckEnum(mode),\n points.map(({ x, y }) => [x, y]).flat(),\n JsiSkPaint.fromValue(paint)\n );\n }\n\n drawArc(\n oval: SkRect,\n startAngle: number,\n sweepAngle: number,\n useCenter: boolean,\n paint: SkPaint\n ) {\n this.ref.drawArc(\n JsiSkRect.fromValue(this.CanvasKit, oval),\n startAngle,\n sweepAngle,\n useCenter,\n JsiSkPaint.fromValue(paint)\n );\n }\n\n drawRRect(rrect: SkRRect, paint: SkPaint) {\n this.ref.drawRRect(\n JsiSkRRect.fromValue(this.CanvasKit, rrect),\n JsiSkPaint.fromValue(paint)\n );\n }\n\n drawDRRect(outer: SkRRect, inner: SkRRect, paint: SkPaint) {\n this.ref.drawDRRect(\n JsiSkRRect.fromValue(this.CanvasKit, outer),\n JsiSkRRect.fromValue(this.CanvasKit, inner),\n JsiSkPaint.fromValue(paint)\n );\n }\n\n drawOval(oval: SkRect, paint: SkPaint) {\n this.ref.drawOval(\n JsiSkRect.fromValue(this.CanvasKit, oval),\n JsiSkPaint.fromValue(paint)\n );\n }\n\n drawPath(path: SkPath, paint: SkPaint) {\n this.ref.drawPath(JsiSkPath.fromValue(path), JsiSkPaint.fromValue(paint));\n }\n\n drawText(str: string, x: number, y: number, paint: SkPaint, font: SkFont) {\n this.ref.drawText(\n str,\n x,\n y,\n JsiSkPaint.fromValue(paint),\n JsiSkFont.fromValue(font)\n );\n }\n\n drawTextBlob(blob: SkTextBlob, x: number, y: number, paint: SkPaint) {\n this.ref.drawTextBlob(\n JsiSkTextBlob.fromValue(blob),\n x,\n y,\n JsiSkPaint.fromValue(paint)\n );\n }\n\n drawGlyphs(\n glyphs: number[],\n positions: SkPoint[],\n x: number,\n y: number,\n font: SkFont,\n paint: SkPaint\n ) {\n this.ref.drawGlyphs(\n glyphs,\n positions.map((p) => [p.x, p.y]).flat(),\n x,\n y,\n JsiSkFont.fromValue(font),\n JsiSkPaint.fromValue(paint)\n );\n }\n\n drawSvg(_svgDom: SkSVG, _width?: number, _height?: number) {\n throw new Error(\"drawSvg is not implemented on React Native Web\");\n }\n\n save() {\n return this.ref.save();\n }\n\n saveLayer(\n paint?: SkPaint,\n bounds?: SkRect | null,\n backdrop?: SkImageFilter | null,\n flags?: SaveLayerFlag\n ) {\n return this.ref.saveLayer(\n paint ? JsiSkPaint.fromValue(paint) : undefined,\n bounds ? JsiSkRect.fromValue(this.CanvasKit, bounds) : bounds,\n backdrop ? JsiSkImageFilter.fromValue(backdrop) : backdrop,\n flags\n );\n }\n\n restore() {\n this.ref.restore();\n }\n\n rotate(rotationInDegrees: number, rx: number, ry: number) {\n this.ref.rotate(rotationInDegrees, rx, ry);\n }\n\n scale(sx: number, sy: number) {\n this.ref.scale(sx, sy);\n }\n\n skew(sx: number, sy: number) {\n this.ref.skew(sx, sy);\n }\n\n translate(dx: number, dy: number) {\n this.ref.translate(dx, dy);\n }\n\n drawColor(color: SkColor, blendMode?: BlendMode) {\n this.ref.drawColor(color, blendMode ? ckEnum(blendMode) : undefined);\n }\n\n clear(color: SkColor) {\n this.ref.clear(color);\n }\n\n clipPath(path: SkPath, op: ClipOp, doAntiAlias: boolean) {\n this.ref.clipPath(JsiSkPath.fromValue(path), ckEnum(op), doAntiAlias);\n }\n\n clipRect(rect: SkRect, op: ClipOp, doAntiAlias: boolean) {\n this.ref.clipRect(\n JsiSkRect.fromValue(this.CanvasKit, rect),\n ckEnum(op),\n doAntiAlias\n );\n }\n\n clipRRect(rrect: SkRRect, op: ClipOp, doAntiAlias: boolean) {\n this.ref.clipRRect(\n JsiSkRRect.fromValue(this.CanvasKit, rrect),\n ckEnum(op),\n doAntiAlias\n );\n }\n\n concat(m: SkMatrix) {\n this.ref.concat(JsiSkMatrix.fromValue(m));\n }\n\n drawPicture(skp: SkPicture) {\n this.ref.drawPicture(JsiSkPicture.fromValue(skp));\n }\n}\n"]}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { ckEnum, Host
|
1
|
+
import { ckEnum, Host } from "./Host";
|
2
2
|
import { JsiSkColorFilter } from "./JsiSkColorFilter";
|
3
3
|
export class JsiSkColorFilterFactory extends Host {
|
4
4
|
constructor(CanvasKit) {
|
@@ -10,15 +10,15 @@ export class JsiSkColorFilterFactory extends Host {
|
|
10
10
|
}
|
11
11
|
|
12
12
|
MakeBlend(color, mode) {
|
13
|
-
return new JsiSkColorFilter(this.CanvasKit, this.CanvasKit.ColorFilter.MakeBlend(
|
13
|
+
return new JsiSkColorFilter(this.CanvasKit, this.CanvasKit.ColorFilter.MakeBlend(color, ckEnum(mode)));
|
14
14
|
}
|
15
15
|
|
16
16
|
MakeCompose(outer, inner) {
|
17
|
-
return new JsiSkColorFilter(this.CanvasKit, this.CanvasKit.ColorFilter.MakeCompose(
|
17
|
+
return new JsiSkColorFilter(this.CanvasKit, this.CanvasKit.ColorFilter.MakeCompose(JsiSkColorFilter.fromValue(outer), JsiSkColorFilter.fromValue(inner)));
|
18
18
|
}
|
19
19
|
|
20
20
|
MakeLerp(t, dst, src) {
|
21
|
-
return new JsiSkColorFilter(this.CanvasKit, this.CanvasKit.ColorFilter.MakeLerp(t,
|
21
|
+
return new JsiSkColorFilter(this.CanvasKit, this.CanvasKit.ColorFilter.MakeLerp(t, JsiSkColorFilter.fromValue(dst), JsiSkColorFilter.fromValue(src)));
|
22
22
|
}
|
23
23
|
|
24
24
|
MakeLinearToSRGBGamma() {
|
@@ -30,7 +30,7 @@ export class JsiSkColorFilterFactory extends Host {
|
|
30
30
|
}
|
31
31
|
|
32
32
|
MakeLumaColorFilter() {
|
33
|
-
|
33
|
+
return new JsiSkColorFilter(this.CanvasKit, this.CanvasKit.ColorFilter.MakeLuma());
|
34
34
|
}
|
35
35
|
|
36
36
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["JsiSkColorFilterFactory.ts"],"names":["ckEnum","Host","
|
1
|
+
{"version":3,"sources":["JsiSkColorFilterFactory.ts"],"names":["ckEnum","Host","JsiSkColorFilter","JsiSkColorFilterFactory","constructor","CanvasKit","MakeMatrix","cMatrix","ColorFilter","MakeBlend","color","mode","MakeCompose","outer","inner","fromValue","MakeLerp","t","dst","src","MakeLinearToSRGBGamma","MakeSRGBToLinearGamma","MakeLumaColorFilter","MakeLuma"],"mappings":"AAUA,SAASA,MAAT,EAAiBC,IAAjB,QAA6B,QAA7B;AACA,SAASC,gBAAT,QAAiC,oBAAjC;AAEA,OAAO,MAAMC,uBAAN,SACGF,IADH,CAGP;AACEG,EAAAA,WAAW,CAACC,SAAD,EAAuB;AAChC,UAAMA,SAAN;AACD;;AAEDC,EAAAA,UAAU,CAACC,OAAD,EAA4B;AACpC,WAAO,IAAIL,gBAAJ,CACL,KAAKG,SADA,EAEL,KAAKA,SAAL,CAAeG,WAAf,CAA2BF,UAA3B,CAAsCC,OAAtC,CAFK,CAAP;AAID;;AAEDE,EAAAA,SAAS,CAACC,KAAD,EAAiBC,IAAjB,EAAkC;AACzC,WAAO,IAAIT,gBAAJ,CACL,KAAKG,SADA,EAEL,KAAKA,SAAL,CAAeG,WAAf,CAA2BC,SAA3B,CAAqCC,KAArC,EAA4CV,MAAM,CAACW,IAAD,CAAlD,CAFK,CAAP;AAID;;AAEDC,EAAAA,WAAW,CAACC,KAAD,EAAuBC,KAAvB,EAA6C;AACtD,WAAO,IAAIZ,gBAAJ,CACL,KAAKG,SADA,EAEL,KAAKA,SAAL,CAAeG,WAAf,CAA2BI,WAA3B,CACEV,gBAAgB,CAACa,SAAjB,CAA2BF,KAA3B,CADF,EAEEX,gBAAgB,CAACa,SAAjB,CAA2BD,KAA3B,CAFF,CAFK,CAAP;AAOD;;AAEDE,EAAAA,QAAQ,CAACC,CAAD,EAAYC,GAAZ,EAAgCC,GAAhC,EAAoD;AAC1D,WAAO,IAAIjB,gBAAJ,CACL,KAAKG,SADA,EAEL,KAAKA,SAAL,CAAeG,WAAf,CAA2BQ,QAA3B,CACEC,CADF,EAEEf,gBAAgB,CAACa,SAAjB,CAA2BG,GAA3B,CAFF,EAGEhB,gBAAgB,CAACa,SAAjB,CAA2BI,GAA3B,CAHF,CAFK,CAAP;AAQD;;AAEDC,EAAAA,qBAAqB,GAAG;AACtB,WAAO,IAAIlB,gBAAJ,CACL,KAAKG,SADA,EAEL,KAAKA,SAAL,CAAeG,WAAf,CAA2BY,qBAA3B,EAFK,CAAP;AAID;;AAEDC,EAAAA,qBAAqB,GAAG;AACtB,WAAO,IAAInB,gBAAJ,CACL,KAAKG,SADA,EAEL,KAAKA,SAAL,CAAeG,WAAf,CAA2Ba,qBAA3B,EAFK,CAAP;AAID;;AAEDC,EAAAA,mBAAmB,GAAkB;AACnC,WAAO,IAAIpB,gBAAJ,CACL,KAAKG,SADA,EAEL,KAAKA,SAAL,CAAeG,WAAf,CAA2Be,QAA3B,EAFK,CAAP;AAID;;AA3DH","sourcesContent":["import type { CanvasKit } from \"canvaskit-wasm\";\n\nimport type {\n ColorFilterFactory,\n SkColorFilter,\n InputColorMatrix,\n SkColor,\n BlendMode,\n} from \"../types\";\n\nimport { ckEnum, Host } from \"./Host\";\nimport { JsiSkColorFilter } from \"./JsiSkColorFilter\";\n\nexport class JsiSkColorFilterFactory\n extends Host\n implements ColorFilterFactory\n{\n constructor(CanvasKit: CanvasKit) {\n super(CanvasKit);\n }\n\n MakeMatrix(cMatrix: InputColorMatrix) {\n return new JsiSkColorFilter(\n this.CanvasKit,\n this.CanvasKit.ColorFilter.MakeMatrix(cMatrix)\n );\n }\n\n MakeBlend(color: SkColor, mode: BlendMode) {\n return new JsiSkColorFilter(\n this.CanvasKit,\n this.CanvasKit.ColorFilter.MakeBlend(color, ckEnum(mode))\n );\n }\n\n MakeCompose(outer: SkColorFilter, inner: SkColorFilter) {\n return new JsiSkColorFilter(\n this.CanvasKit,\n this.CanvasKit.ColorFilter.MakeCompose(\n JsiSkColorFilter.fromValue(outer),\n JsiSkColorFilter.fromValue(inner)\n )\n );\n }\n\n MakeLerp(t: number, dst: SkColorFilter, src: SkColorFilter) {\n return new JsiSkColorFilter(\n this.CanvasKit,\n this.CanvasKit.ColorFilter.MakeLerp(\n t,\n JsiSkColorFilter.fromValue(dst),\n JsiSkColorFilter.fromValue(src)\n )\n );\n }\n\n MakeLinearToSRGBGamma() {\n return new JsiSkColorFilter(\n this.CanvasKit,\n this.CanvasKit.ColorFilter.MakeLinearToSRGBGamma()\n );\n }\n\n MakeSRGBToLinearGamma() {\n return new JsiSkColorFilter(\n this.CanvasKit,\n this.CanvasKit.ColorFilter.MakeSRGBToLinearGamma()\n );\n }\n\n MakeLumaColorFilter(): SkColorFilter {\n return new JsiSkColorFilter(\n this.CanvasKit,\n this.CanvasKit.ColorFilter.MakeLuma()\n );\n }\n}\n"]}
|
@@ -1,4 +1,6 @@
|
|
1
|
-
import { HostObject,
|
1
|
+
import { HostObject, ckEnum } from "./Host";
|
2
|
+
import { JsiSkPaint } from "./JsiSkPaint";
|
3
|
+
import { JsiSkPoint } from "./JsiSkPoint";
|
2
4
|
import { JsiSkRect } from "./JsiSkRect";
|
3
5
|
import { JsiSkTypeface } from "./JsiSkTypeface";
|
4
6
|
export class JsiSkFont extends HostObject {
|
@@ -29,11 +31,11 @@ export class JsiSkFont extends HostObject {
|
|
29
31
|
|
30
32
|
|
31
33
|
getGlyphWidths(glyphs, paint) {
|
32
|
-
return [...this.ref.getGlyphWidths(glyphs, paint ?
|
34
|
+
return [...this.ref.getGlyphWidths(glyphs, paint ? JsiSkPaint.fromValue(paint) : null)];
|
33
35
|
}
|
34
36
|
|
35
37
|
getGlyphIntercepts(glyphs, positions, top, bottom) {
|
36
|
-
return [...this.ref.getGlyphIntercepts(glyphs, positions.map(p =>
|
38
|
+
return [...this.ref.getGlyphIntercepts(glyphs, positions.map(p => Array.from(JsiSkPoint.fromValue(p))).flat(), top, bottom)];
|
37
39
|
}
|
38
40
|
|
39
41
|
getScaleX() {
|
@@ -94,7 +96,7 @@ export class JsiSkFont extends HostObject {
|
|
94
96
|
}
|
95
97
|
|
96
98
|
setTypeface(face) {
|
97
|
-
this.ref.setTypeface(face ?
|
99
|
+
this.ref.setTypeface(face ? JsiSkTypeface.fromValue(face) : null);
|
98
100
|
}
|
99
101
|
|
100
102
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["JsiSkFont.ts"],"names":["HostObject","
|
1
|
+
{"version":3,"sources":["JsiSkFont.ts"],"names":["HostObject","ckEnum","JsiSkPaint","JsiSkPoint","JsiSkRect","JsiSkTypeface","JsiSkFont","constructor","CanvasKit","ref","getTextWidth","text","paint","ids","getGlyphIDs","widths","getGlyphWidths","reduce","a","b","getMetrics","result","ascent","descent","leading","bounds","undefined","str","numCodePoints","glyphs","fromValue","getGlyphIntercepts","positions","top","bottom","map","p","Array","from","flat","getScaleX","getSize","getSkewX","isEmbolden","getTypeface","tf","setEdging","edging","setEmbeddedBitmaps","embeddedBitmaps","setHinting","hinting","setLinearMetrics","linearMetrics","setScaleX","sx","setSize","points","setSkewX","setEmbolden","embolden","setSubpixel","subpixel","setTypeface","face"],"mappings":"AAWA,SAASA,UAAT,EAAqBC,MAArB,QAAmC,QAAnC;AACA,SAASC,UAAT,QAA2B,cAA3B;AACA,SAASC,UAAT,QAA2B,cAA3B;AACA,SAASC,SAAT,QAA0B,aAA1B;AAC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AAyB;AACvC,SAAK5C,GAAL,CAAS2C,gBAAT,CAA0BC,aAA1B;AACD;;AAEDC,EAAAA,SAAS,CAACC,EAAD,EAAa;AACpB,SAAK9C,GAAL,CAAS6C,SAAT,CAAmBC,EAAnB;AACD;;AAEDC,EAAAA,OAAO,CAACC,MAAD,EAAiB;AACtB,SAAKhD,GAAL,CAAS+C,OAAT,CAAiBC,MAAjB;AACD;;AAEDC,EAAAA,QAAQ,CAACH,EAAD,EAAa;AACnB,SAAK9C,GAAL,CAASiD,QAAT,CAAkBH,EAAlB;AACD;;AAEDI,EAAAA,WAAW,CAACC,QAAD,EAAoB;AAC7B,SAAKnD,GAAL,CAASkD,WAAT,CAAqBC,QAArB;AACD;;AAEDC,EAAAA,WAAW,CAACC,QAAD,EAAoB;AAC7B,SAAKrD,GAAL,CAASoD,WAAT,CAAqBC,QAArB;AACD;;AAEDC,EAAAA,WAAW,CAACC,IAAD,EAA0B;AACnC,SAAKvD,GAAL,CAASsD,WAAT,CAAqBC,IAAI,GAAG3D,aAAa,CAACyB,SAAd,CAAwBkC,IAAxB,CAAH,GAAmC,IAA5D;AACD;;AAjHuE","sourcesContent":["import type { CanvasKit, Font } from \"canvaskit-wasm\";\n\nimport type {\n FontEdging,\n FontHinting,\n SkFont,\n SkPaint,\n SkPoint,\n SkTypeface,\n} from \"../types\";\n\nimport { HostObject, ckEnum } from \"./Host\";\nimport { JsiSkPaint } from \"./JsiSkPaint\";\nimport { JsiSkPoint } from \"./JsiSkPoint\";\nimport { JsiSkRect } from \"./JsiSkRect\";\nimport { JsiSkTypeface } from \"./JsiSkTypeface\";\n\nexport class JsiSkFont extends HostObject<Font, \"Font\"> implements SkFont {\n constructor(CanvasKit: CanvasKit, ref: Font) {\n super(CanvasKit, ref, \"Font\");\n }\n\n getTextWidth(text: string, paint?: SkPaint | undefined) {\n const ids = this.getGlyphIDs(text);\n const widths = this.getGlyphWidths(ids, paint);\n return widths.reduce((a, b) => a + b, 0);\n }\n\n getMetrics() {\n const result = this.ref.getMetrics();\n return {\n ascent: result.ascent,\n descent: result.descent,\n leading: result.leading,\n bounds: result.bounds\n ? new JsiSkRect(this.CanvasKit, result.bounds)\n : undefined,\n };\n }\n\n getGlyphIDs(str: string, numCodePoints?: number) {\n // TODO: Fix return value in the C++ implementation\n return [...this.ref.getGlyphIDs(str, numCodePoints)];\n }\n\n // TODO: Fix return value in the C++ implementation, it return float32\n getGlyphWidths(glyphs: number[], paint?: SkPaint | null) {\n return [\n ...this.ref.getGlyphWidths(\n glyphs,\n paint ? JsiSkPaint.fromValue(paint) : null\n ),\n ];\n }\n\n getGlyphIntercepts(\n glyphs: number[],\n positions: SkPoint[],\n top: number,\n bottom: number\n ) {\n return [\n ...this.ref.getGlyphIntercepts(\n glyphs,\n positions.map((p) => Array.from(JsiSkPoint.fromValue(p))).flat(),\n top,\n bottom\n ),\n ];\n }\n\n getScaleX() {\n return this.ref.getScaleX();\n }\n\n getSize() {\n return this.ref.getSize();\n }\n\n getSkewX() {\n return this.ref.getSkewX();\n }\n\n isEmbolden() {\n return this.ref.isEmbolden();\n }\n\n getTypeface() {\n const tf = this.ref.getTypeface();\n return tf ? new JsiSkTypeface(this.CanvasKit, tf) : null;\n }\n\n setEdging(edging: FontEdging) {\n this.ref.setEdging(ckEnum(edging));\n }\n\n setEmbeddedBitmaps(embeddedBitmaps: boolean) {\n this.ref.setEmbeddedBitmaps(embeddedBitmaps);\n }\n\n setHinting(hinting: FontHinting) {\n this.ref.setHinting(ckEnum(hinting));\n }\n\n setLinearMetrics(linearMetrics: boolean) {\n this.ref.setLinearMetrics(linearMetrics);\n }\n\n setScaleX(sx: number) {\n this.ref.setScaleX(sx);\n }\n\n setSize(points: number) {\n this.ref.setSize(points);\n }\n\n setSkewX(sx: number) {\n this.ref.setSkewX(sx);\n }\n\n setEmbolden(embolden: boolean) {\n this.ref.setEmbolden(embolden);\n }\n\n setSubpixel(subpixel: boolean) {\n this.ref.setSubpixel(subpixel);\n }\n\n setTypeface(face: SkTypeface | null) {\n this.ref.setTypeface(face ? JsiSkTypeface.fromValue(face) : null);\n }\n}\n"]}
|
@@ -1,5 +1,6 @@
|
|
1
1
|
/*global btoa, atob*/
|
2
|
-
import { ckEnum, HostObject
|
2
|
+
import { ckEnum, HostObject } from "./Host";
|
3
|
+
import { JsiSkMatrix } from "./JsiSkMatrix";
|
3
4
|
import { JsiSkShader } from "./JsiSkShader";
|
4
5
|
export class JsiSkImage extends HostObject {
|
5
6
|
constructor(CanvasKit, ref) {
|
@@ -15,11 +16,11 @@ export class JsiSkImage extends HostObject {
|
|
15
16
|
}
|
16
17
|
|
17
18
|
makeShaderOptions(tx, ty, fm, mm, localMatrix) {
|
18
|
-
return new JsiSkShader(this.CanvasKit, this.ref.makeShaderOptions(ckEnum(tx), ckEnum(ty), ckEnum(fm), ckEnum(mm), localMatrix ?
|
19
|
+
return new JsiSkShader(this.CanvasKit, this.ref.makeShaderOptions(ckEnum(tx), ckEnum(ty), ckEnum(fm), ckEnum(mm), localMatrix ? JsiSkMatrix.fromValue(localMatrix) : undefined));
|
19
20
|
}
|
20
21
|
|
21
22
|
makeShaderCubic(tx, ty, B, C, localMatrix) {
|
22
|
-
return new JsiSkShader(this.CanvasKit, this.ref.makeShaderCubic(ckEnum(tx), ckEnum(ty), B, C, localMatrix ?
|
23
|
+
return new JsiSkShader(this.CanvasKit, this.ref.makeShaderCubic(ckEnum(tx), ckEnum(ty), B, C, localMatrix ? JsiSkMatrix.fromValue(localMatrix) : undefined));
|
23
24
|
}
|
24
25
|
|
25
26
|
encodeToBytes(fmt, quality) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["JsiSkImage.ts"],"names":["ckEnum","HostObject","
|
1
|
+
{"version":3,"sources":["JsiSkImage.ts"],"names":["ckEnum","HostObject","JsiSkMatrix","JsiSkShader","JsiSkImage","constructor","CanvasKit","ref","height","width","makeShaderOptions","tx","ty","fm","mm","localMatrix","fromValue","undefined","makeShaderCubic","B","C","encodeToBytes","fmt","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GAAD,EAAoBC,OAApB,EAAsC;AACjD,QAAIC,MAAJ;;AACA,QAAIF,GAAG,IAAIC,OAAX,EAAoB;AAClBC,MAAAA,MAAM,GAAG,KAAKjB,GAAL,CAASc,aAAT,CAAuBrB,MAAM,CAACsB,GAAD,CAA7B,EAAoCC,OAApC,CAAT;AACD,KAFD,MAEO,IAAID,GAAJ,EAAS;AACdE,MAAAA,MAAM,GAAG,KAAKjB,GAAL,CAASc,aAAT,CAAuBrB,MAAM,CAACsB,GAAD,CAA7B,CAAT;AACD,KAFM,MAEA;AACLE,MAAAA,MAAM,GAAG,KAAKjB,GAAL,CAASc,aAAT,EAAT;AACD;;AACD,QAAI,CAACG,MAAL,EAAa;AACX,YAAM,IAAIC,KAAJ,CAAU,sBAAV,CAAN;AACD;;AACD,WAAOD,MAAP;AACD;;AAEDE,EAAAA,cAAc,CAACJ,GAAD,EAAoBC,OAApB,EAAsC;AAClD,UAAMI,KAAK,GAAG,KAAKN,aAAL,CAAmBC,GAAnB,EAAwBC,OAAxB,CAAd;AACA,WAAOK,IAAI,CAACC,MAAM,CAACC,YAAP,CAAoB,GAAGH,KAAvB,CAAD,CAAX;AACD;;AArE2E","sourcesContent":["/*global btoa, atob*/\nimport type { CanvasKit, Image } from \"canvaskit-wasm\";\n\nimport type {\n ImageFormat,\n FilterMode,\n MipmapMode,\n SkImage,\n SkMatrix,\n SkShader,\n TileMode,\n} from \"../types\";\n\nimport { ckEnum, HostObject } from \"./Host\";\nimport { JsiSkMatrix } from \"./JsiSkMatrix\";\nimport { JsiSkShader } from \"./JsiSkShader\";\n\nexport class JsiSkImage extends HostObject<Image, \"Image\"> implements SkImage {\n constructor(CanvasKit: CanvasKit, ref: Image) {\n super(CanvasKit, ref, \"Image\");\n }\n\n height() {\n return this.ref.height();\n }\n\n width() {\n return this.ref.width();\n }\n\n makeShaderOptions(\n tx: TileMode,\n ty: TileMode,\n fm: FilterMode,\n mm: MipmapMode,\n localMatrix?: SkMatrix\n ): SkShader {\n return new JsiSkShader(\n this.CanvasKit,\n this.ref.makeShaderOptions(\n ckEnum(tx),\n ckEnum(ty),\n ckEnum(fm),\n ckEnum(mm),\n localMatrix ? JsiSkMatrix.fromValue(localMatrix) : undefined\n )\n );\n }\n\n makeShaderCubic(\n tx: TileMode,\n ty: TileMode,\n B: number,\n C: number,\n localMatrix?: SkMatrix\n ): SkShader {\n return new JsiSkShader(\n this.CanvasKit,\n this.ref.makeShaderCubic(\n ckEnum(tx),\n ckEnum(ty),\n B,\n C,\n localMatrix ? JsiSkMatrix.fromValue(localMatrix) : undefined\n )\n );\n }\n\n encodeToBytes(fmt?: ImageFormat, quality?: number) {\n let result: Uint8Array | null;\n if (fmt && quality) {\n result = this.ref.encodeToBytes(ckEnum(fmt), quality);\n } else if (fmt) {\n result = this.ref.encodeToBytes(ckEnum(fmt));\n } else {\n result = this.ref.encodeToBytes();\n }\n if (!result) {\n throw new Error(\"encodeToBytes failed\");\n }\n return result;\n }\n\n encodeToBase64(fmt?: ImageFormat, quality?: number) {\n const bytes = this.encodeToBytes(fmt, quality);\n return btoa(String.fromCharCode(...bytes));\n }\n}\n"]}
|
@@ -1,12 +1,13 @@
|
|
1
|
-
import { Host,
|
1
|
+
import { Host, ckEnum } from "./Host";
|
2
2
|
import { JsiSkImage } from "./JsiSkImage";
|
3
|
+
import { JsiSkData } from "./JsiSkData";
|
3
4
|
export class JsiSkImageFactory extends Host {
|
4
5
|
constructor(CanvasKit) {
|
5
6
|
super(CanvasKit);
|
6
7
|
}
|
7
8
|
|
8
9
|
MakeImageFromEncoded(encoded) {
|
9
|
-
const image = this.CanvasKit.MakeImageFromEncoded(
|
10
|
+
const image = this.CanvasKit.MakeImageFromEncoded(JsiSkData.fromValue(encoded));
|
10
11
|
|
11
12
|
if (image === null) {
|
12
13
|
return null;
|
@@ -23,7 +24,7 @@ export class JsiSkImageFactory extends Host {
|
|
23
24
|
colorType: ckEnum(info.colorType),
|
24
25
|
height: info.height,
|
25
26
|
width: info.width
|
26
|
-
},
|
27
|
+
}, JsiSkData.fromValue(data), bytesPerRow);
|
27
28
|
|
28
29
|
if (image === null) {
|
29
30
|
return null;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["JsiSkImageFactory.ts"],"names":["Host","
|
1
|
+
{"version":3,"sources":["JsiSkImageFactory.ts"],"names":["Host","ckEnum","JsiSkImage","JsiSkData","JsiSkImageFactory","constructor","CanvasKit","MakeImageFromEncoded","encoded","image","fromValue","MakeImage","info","data","bytesPerRow","alphaType","colorSpace","ColorSpace","SRGB","colorType","height","width"],"mappings":"AAKA,SAASA,IAAT,EAAeC,MAAf,QAA6B,QAA7B;AACA,SAASC,UAAT,QAA2B,cAA3B;AACA,SAASC,SAAT,QAA0B,aAA1B;AAEA,OAAO,MAAMC,iBAAN,SAAgCJ,IAAhC,CAA6D;AAClEK,EAAAA,WAAW,CAACC,SAAD,EAAuB;AAChC,UAAMA,SAAN;AACD;;AAEDC,EAAAA,oBAAoB,CAACC,OAAD,EAAkB;AACpC,UAAMC,KAAK,GAAG,KAAKH,SAAL,CAAeC,oBAAf,CACZJ,SAAS,CAACO,SAAV,CAAoBF,OAApB,CADY,CAAd;;AAGA,QAAIC,KAAK,KAAK,IAAd,EAAoB;AAClB,aAAO,IAAP;AACD;;AACD,WAAO,IAAIP,UAAJ,CAAe,KAAKI,SAApB,EAA+BG,KAA/B,CAAP;AACD;;AAEDE,EAAAA,SAAS,CAACC,IAAD,EAAkBC,IAAlB,EAAgCC,WAAhC,EAAqD;AAC5D;AACA,UAAML,KAAK,GAAG,KAAKH,SAAL,CAAeK,SAAf,CACZ;AACEI,MAAAA,SAAS,EAAEd,MAAM,CAACW,IAAI,CAACG,SAAN,CADnB;AAEEC,MAAAA,UAAU,EAAE,KAAKV,SAAL,CAAeW,UAAf,CAA0BC,IAFxC;AAGEC,MAAAA,SAAS,EAAElB,MAAM,CAACW,IAAI,CAACO,SAAN,CAHnB;AAIEC,MAAAA,MAAM,EAAER,IAAI,CAACQ,MAJf;AAKEC,MAAAA,KAAK,EAAET,IAAI,CAACS;AALd,KADY,EAQZlB,SAAS,CAACO,SAAV,CAAoBG,IAApB,CARY,EASZC,WATY,CAAd;;AAWA,QAAIL,KAAK,KAAK,IAAd,EAAoB;AAClB,aAAO,IAAP;AACD;;AACD,WAAO,IAAIP,UAAJ,CAAe,KAAKI,SAApB,EAA+BG,KAA/B,CAAP;AACD;;AAhCiE","sourcesContent":["import type { CanvasKit } from \"canvaskit-wasm\";\n\nimport type { SkData, ImageInfo } from \"../types\";\nimport type { ImageFactory } from \"../types/Image/ImageFactory\";\n\nimport { Host, ckEnum } from \"./Host\";\nimport { JsiSkImage } from \"./JsiSkImage\";\nimport { JsiSkData } from \"./JsiSkData\";\n\nexport class JsiSkImageFactory extends Host implements ImageFactory {\n constructor(CanvasKit: CanvasKit) {\n super(CanvasKit);\n }\n\n MakeImageFromEncoded(encoded: SkData) {\n const image = this.CanvasKit.MakeImageFromEncoded(\n JsiSkData.fromValue(encoded)\n );\n if (image === null) {\n return null;\n }\n return new JsiSkImage(this.CanvasKit, image);\n }\n\n MakeImage(info: ImageInfo, data: SkData, bytesPerRow: number) {\n // see toSkImageInfo() from canvaskit\n const image = this.CanvasKit.MakeImage(\n {\n alphaType: ckEnum(info.alphaType),\n colorSpace: this.CanvasKit.ColorSpace.SRGB,\n colorType: ckEnum(info.colorType),\n height: info.height,\n width: info.width,\n },\n JsiSkData.fromValue(data),\n bytesPerRow\n );\n if (image === null) {\n return null;\n }\n return new JsiSkImage(this.CanvasKit, image);\n }\n}\n"]}
|
@@ -1,52 +1,93 @@
|
|
1
|
-
import { Host, NotImplementedOnRNWeb, ckEnum
|
1
|
+
import { Host, NotImplementedOnRNWeb, ckEnum } from "./Host";
|
2
2
|
import { JsiSkImageFilter } from "./JsiSkImageFilter";
|
3
|
+
import { JsiSkColorFilter } from "./JsiSkColorFilter";
|
3
4
|
export class JsiSkImageFilterFactory extends Host {
|
4
5
|
constructor(CanvasKit) {
|
5
6
|
super(CanvasKit);
|
6
7
|
}
|
7
8
|
|
8
|
-
MakeOffset(
|
9
|
-
|
9
|
+
MakeOffset(dx, dy, input) {
|
10
|
+
const inputFilter = input === null ? null : JsiSkImageFilter.fromValue(input);
|
11
|
+
const filter = this.CanvasKit.ImageFilter.MakeOffset(dx, dy, inputFilter);
|
12
|
+
return new JsiSkImageFilter(this.CanvasKit, filter);
|
10
13
|
}
|
11
14
|
|
12
|
-
MakeDisplacementMap(
|
13
|
-
|
15
|
+
MakeDisplacementMap(channelX, channelY, scale, in1, input) {
|
16
|
+
const inputFilter = input === null ? null : JsiSkImageFilter.fromValue(input);
|
17
|
+
const filter = this.CanvasKit.ImageFilter.MakeDisplacementMap(ckEnum(channelX), ckEnum(channelY), scale, JsiSkImageFilter.fromValue(in1), inputFilter);
|
18
|
+
return new JsiSkImageFilter(this.CanvasKit, filter);
|
14
19
|
}
|
15
20
|
|
16
|
-
MakeShader(
|
17
|
-
|
21
|
+
MakeShader(shader, _input) {
|
22
|
+
const filter = this.CanvasKit.ImageFilter.MakeShader(JsiSkImageFilter.fromValue(shader));
|
23
|
+
return new JsiSkImageFilter(this.CanvasKit, filter);
|
18
24
|
}
|
19
25
|
|
20
26
|
MakeBlur(sigmaX, sigmaY, mode, input) {
|
21
|
-
return new JsiSkImageFilter(this.CanvasKit, this.CanvasKit.ImageFilter.MakeBlur(sigmaX, sigmaY, ckEnum(mode), input === null ? null :
|
27
|
+
return new JsiSkImageFilter(this.CanvasKit, this.CanvasKit.ImageFilter.MakeBlur(sigmaX, sigmaY, ckEnum(mode), input === null ? null : JsiSkImageFilter.fromValue(input)));
|
22
28
|
}
|
23
29
|
|
24
30
|
MakeColorFilter(cf, input) {
|
25
|
-
return new JsiSkImageFilter(this.CanvasKit, this.CanvasKit.ImageFilter.MakeColorFilter(
|
31
|
+
return new JsiSkImageFilter(this.CanvasKit, this.CanvasKit.ImageFilter.MakeColorFilter(JsiSkColorFilter.fromValue(cf), input === null ? null : JsiSkImageFilter.fromValue(input)));
|
26
32
|
}
|
27
33
|
|
28
34
|
MakeCompose(outer, inner) {
|
29
|
-
return new JsiSkImageFilter(this.CanvasKit, this.CanvasKit.ImageFilter.MakeCompose(outer === null ? null :
|
35
|
+
return new JsiSkImageFilter(this.CanvasKit, this.CanvasKit.ImageFilter.MakeCompose(outer === null ? null : JsiSkImageFilter.fromValue(outer), inner === null ? null : JsiSkImageFilter.fromValue(inner)));
|
30
36
|
}
|
31
37
|
|
32
|
-
MakeDropShadow(
|
33
|
-
|
38
|
+
MakeDropShadow(dx, dy, sigmaX, sigmaY, color, input, cropRect) {
|
39
|
+
const inputFilter = input === null ? null : JsiSkImageFilter.fromValue(input);
|
40
|
+
|
41
|
+
if (cropRect) {
|
42
|
+
throw new NotImplementedOnRNWeb("The cropRect argument is not yet supported on React Native Web.");
|
43
|
+
}
|
44
|
+
|
45
|
+
const filter = this.CanvasKit.ImageFilter.MakeDropShadow(dx, dy, sigmaX, sigmaY, color, inputFilter);
|
46
|
+
return new JsiSkImageFilter(this.CanvasKit, filter);
|
34
47
|
}
|
35
48
|
|
36
|
-
MakeDropShadowOnly(
|
37
|
-
|
49
|
+
MakeDropShadowOnly(dx, dy, sigmaX, sigmaY, color, input, cropRect) {
|
50
|
+
const inputFilter = input === null ? null : JsiSkImageFilter.fromValue(input);
|
51
|
+
|
52
|
+
if (cropRect) {
|
53
|
+
throw new NotImplementedOnRNWeb("The cropRect argument is not yet supported on React Native Web.");
|
54
|
+
}
|
55
|
+
|
56
|
+
const filter = this.CanvasKit.ImageFilter.MakeDropShadowOnly(dx, dy, sigmaX, sigmaY, color, inputFilter);
|
57
|
+
return new JsiSkImageFilter(this.CanvasKit, filter);
|
38
58
|
}
|
39
59
|
|
40
|
-
MakeErode(
|
41
|
-
|
60
|
+
MakeErode(rx, ry, input, cropRect) {
|
61
|
+
const inputFilter = input === null ? null : JsiSkImageFilter.fromValue(input);
|
62
|
+
|
63
|
+
if (cropRect) {
|
64
|
+
throw new NotImplementedOnRNWeb("The cropRect argument is not yet supported on React Native Web.");
|
65
|
+
}
|
66
|
+
|
67
|
+
const filter = this.CanvasKit.ImageFilter.MakeErode(rx, ry, inputFilter);
|
68
|
+
return new JsiSkImageFilter(this.CanvasKit, filter);
|
42
69
|
}
|
43
70
|
|
44
|
-
MakeDilate(
|
45
|
-
|
71
|
+
MakeDilate(rx, ry, input, cropRect) {
|
72
|
+
const inputFilter = input === null ? null : JsiSkImageFilter.fromValue(input);
|
73
|
+
|
74
|
+
if (cropRect) {
|
75
|
+
throw new NotImplementedOnRNWeb("The cropRect argument is not yet supported on React Native Web.");
|
76
|
+
}
|
77
|
+
|
78
|
+
const filter = this.CanvasKit.ImageFilter.MakeDilate(rx, ry, inputFilter);
|
79
|
+
return new JsiSkImageFilter(this.CanvasKit, filter);
|
46
80
|
}
|
47
81
|
|
48
|
-
MakeBlend(
|
49
|
-
|
82
|
+
MakeBlend(mode, background, foreground, cropRect) {
|
83
|
+
const inputFilter = foreground === null ? null : JsiSkImageFilter.fromValue(foreground);
|
84
|
+
|
85
|
+
if (cropRect) {
|
86
|
+
throw new NotImplementedOnRNWeb("The cropRect argument is not yet supported on React Native Web.");
|
87
|
+
}
|
88
|
+
|
89
|
+
const filter = this.CanvasKit.ImageFilter.MakeBlend(ckEnum(mode), JsiSkImageFilter.fromValue(background), inputFilter);
|
90
|
+
return new JsiSkImageFilter(this.CanvasKit, filter);
|
50
91
|
}
|
51
92
|
|
52
93
|
MakeRuntimeShader(_builder, _childShaderName, _input) {
|