@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
@@ -7,59 +7,81 @@ exports.JsiSkCanvas = void 0;
|
|
7
7
|
|
8
8
|
var _Host = require("./Host");
|
9
9
|
|
10
|
+
var _JsiSkPaint = require("./JsiSkPaint");
|
11
|
+
|
10
12
|
var _JsiSkRect = require("./JsiSkRect");
|
11
13
|
|
14
|
+
var _JsiSkRRect = require("./JsiSkRRect");
|
15
|
+
|
16
|
+
var _JsiSkImage = require("./JsiSkImage");
|
17
|
+
|
18
|
+
var _JsiSkVertices = require("./JsiSkVertices");
|
19
|
+
|
20
|
+
var _JsiSkPath = require("./JsiSkPath");
|
21
|
+
|
22
|
+
var _JsiSkFont = require("./JsiSkFont");
|
23
|
+
|
24
|
+
var _JsiSkTextBlob = require("./JsiSkTextBlob");
|
25
|
+
|
26
|
+
var _JsiSkPicture = require("./JsiSkPicture");
|
27
|
+
|
28
|
+
var _JsiSkMatrix = require("./JsiSkMatrix");
|
29
|
+
|
30
|
+
var _JsiSkImageFilter = require("./JsiSkImageFilter");
|
31
|
+
|
32
|
+
var _JsiSkPoint = require("./JsiSkPoint");
|
33
|
+
|
12
34
|
class JsiSkCanvas extends _Host.HostObject {
|
13
35
|
constructor(CanvasKit, ref) {
|
14
36
|
super(CanvasKit, ref, "Canvas");
|
15
37
|
}
|
16
38
|
|
17
39
|
drawRect(rect, paint) {
|
18
|
-
this.ref.drawRect(_JsiSkRect.JsiSkRect.fromValue(this.CanvasKit, rect)
|
40
|
+
this.ref.drawRect(_JsiSkRect.JsiSkRect.fromValue(this.CanvasKit, rect), _JsiSkPaint.JsiSkPaint.fromValue(paint));
|
19
41
|
}
|
20
42
|
|
21
43
|
drawImage(image, x, y, paint) {
|
22
|
-
this.ref.drawImage(
|
44
|
+
this.ref.drawImage(_JsiSkImage.JsiSkImage.fromValue(image), x, y, paint ? _JsiSkPaint.JsiSkPaint.fromValue(paint) : paint);
|
23
45
|
}
|
24
46
|
|
25
47
|
drawImageRect(img, src, dest, paint, fastSample) {
|
26
|
-
this.ref.drawImageRect(
|
48
|
+
this.ref.drawImageRect(_JsiSkImage.JsiSkImage.fromValue(img), _JsiSkRect.JsiSkRect.fromValue(this.CanvasKit, src), _JsiSkRect.JsiSkRect.fromValue(this.CanvasKit, dest), _JsiSkPaint.JsiSkPaint.fromValue(paint), fastSample);
|
27
49
|
}
|
28
50
|
|
29
51
|
drawImageCubic(img, left, top, B, C, paint) {
|
30
|
-
this.ref.drawImageCubic(
|
52
|
+
this.ref.drawImageCubic(_JsiSkImage.JsiSkImage.fromValue(img), left, top, B, C, paint ? _JsiSkPaint.JsiSkPaint.fromValue(paint) : paint);
|
31
53
|
}
|
32
54
|
|
33
55
|
drawImageOptions(img, left, top, fm, mm, paint) {
|
34
|
-
this.ref.drawImageOptions(
|
56
|
+
this.ref.drawImageOptions(_JsiSkImage.JsiSkImage.fromValue(img), left, top, (0, _Host.ckEnum)(fm), (0, _Host.ckEnum)(mm), paint ? _JsiSkPaint.JsiSkPaint.fromValue(paint) : paint);
|
35
57
|
}
|
36
58
|
|
37
59
|
drawImageNine(img, center, dest, filter, paint) {
|
38
|
-
this.ref.drawImageNine(
|
60
|
+
this.ref.drawImageNine(_JsiSkImage.JsiSkImage.fromValue(img), Array.from(_JsiSkRect.JsiSkRect.fromValue(this.CanvasKit, center)), _JsiSkRect.JsiSkRect.fromValue(this.CanvasKit, dest), (0, _Host.ckEnum)(filter), paint ? _JsiSkPaint.JsiSkPaint.fromValue(paint) : paint);
|
39
61
|
}
|
40
62
|
|
41
63
|
drawImageRectCubic(img, src, dest, B, C, paint) {
|
42
|
-
this.ref.drawImageRectCubic(
|
64
|
+
this.ref.drawImageRectCubic(_JsiSkImage.JsiSkImage.fromValue(img), _JsiSkRect.JsiSkRect.fromValue(this.CanvasKit, src), _JsiSkRect.JsiSkRect.fromValue(this.CanvasKit, dest), B, C, paint ? _JsiSkPaint.JsiSkPaint.fromValue(paint) : paint);
|
43
65
|
}
|
44
66
|
|
45
67
|
drawImageRectOptions(img, src, dest, fm, mm, paint) {
|
46
|
-
this.ref.drawImageRectOptions(
|
68
|
+
this.ref.drawImageRectOptions(_JsiSkImage.JsiSkImage.fromValue(img), _JsiSkRect.JsiSkRect.fromValue(this.CanvasKit, src), _JsiSkRect.JsiSkRect.fromValue(this.CanvasKit, dest), (0, _Host.ckEnum)(fm), (0, _Host.ckEnum)(mm), paint ? _JsiSkPaint.JsiSkPaint.fromValue(paint) : paint);
|
47
69
|
}
|
48
70
|
|
49
71
|
drawPaint(paint) {
|
50
|
-
this.ref.drawPaint(
|
72
|
+
this.ref.drawPaint(_JsiSkPaint.JsiSkPaint.fromValue(paint));
|
51
73
|
}
|
52
74
|
|
53
75
|
drawLine(x0, y0, x1, y1, paint) {
|
54
|
-
this.ref.drawLine(x0, y0, x1, y1,
|
76
|
+
this.ref.drawLine(x0, y0, x1, y1, _JsiSkPaint.JsiSkPaint.fromValue(paint));
|
55
77
|
}
|
56
78
|
|
57
79
|
drawCircle(cx, cy, radius, paint) {
|
58
|
-
this.ref.drawCircle(cx, cy, radius,
|
80
|
+
this.ref.drawCircle(cx, cy, radius, _JsiSkPaint.JsiSkPaint.fromValue(paint));
|
59
81
|
}
|
60
82
|
|
61
83
|
drawVertices(verts, mode, paint) {
|
62
|
-
this.ref.drawVertices(
|
84
|
+
this.ref.drawVertices(_JsiSkVertices.JsiSkVertices.fromValue(verts), (0, _Host.ckEnum)(mode), _JsiSkPaint.JsiSkPaint.fromValue(paint));
|
63
85
|
}
|
64
86
|
|
65
87
|
drawPatch(cubics, colors, texs, mode, paint) {
|
@@ -69,7 +91,7 @@ class JsiSkCanvas extends _Host.HostObject {
|
|
69
91
|
y
|
70
92
|
} = _ref;
|
71
93
|
return [x, y];
|
72
|
-
}).flat(), colors, (
|
94
|
+
}).flat(), colors, texs ? texs.flatMap(p => Array.from(_JsiSkPoint.JsiSkPoint.fromValue(p))) : texs, mode ? (0, _Host.ckEnum)(mode) : null, paint ? _JsiSkPaint.JsiSkPaint.fromValue(paint) : undefined);
|
73
95
|
}
|
74
96
|
|
75
97
|
restoreToCount(saveCount) {
|
@@ -83,39 +105,39 @@ class JsiSkCanvas extends _Host.HostObject {
|
|
83
105
|
y
|
84
106
|
} = _ref2;
|
85
107
|
return [x, y];
|
86
|
-
}).flat(),
|
108
|
+
}).flat(), _JsiSkPaint.JsiSkPaint.fromValue(paint));
|
87
109
|
}
|
88
110
|
|
89
111
|
drawArc(oval, startAngle, sweepAngle, useCenter, paint) {
|
90
|
-
this.ref.drawArc((
|
112
|
+
this.ref.drawArc(_JsiSkRect.JsiSkRect.fromValue(this.CanvasKit, oval), startAngle, sweepAngle, useCenter, _JsiSkPaint.JsiSkPaint.fromValue(paint));
|
91
113
|
}
|
92
114
|
|
93
115
|
drawRRect(rrect, paint) {
|
94
|
-
this.ref.drawRRect((
|
116
|
+
this.ref.drawRRect(_JsiSkRRect.JsiSkRRect.fromValue(this.CanvasKit, rrect), _JsiSkPaint.JsiSkPaint.fromValue(paint));
|
95
117
|
}
|
96
118
|
|
97
119
|
drawDRRect(outer, inner, paint) {
|
98
|
-
this.ref.drawDRRect((
|
120
|
+
this.ref.drawDRRect(_JsiSkRRect.JsiSkRRect.fromValue(this.CanvasKit, outer), _JsiSkRRect.JsiSkRRect.fromValue(this.CanvasKit, inner), _JsiSkPaint.JsiSkPaint.fromValue(paint));
|
99
121
|
}
|
100
122
|
|
101
123
|
drawOval(oval, paint) {
|
102
|
-
this.ref.drawOval((
|
124
|
+
this.ref.drawOval(_JsiSkRect.JsiSkRect.fromValue(this.CanvasKit, oval), _JsiSkPaint.JsiSkPaint.fromValue(paint));
|
103
125
|
}
|
104
126
|
|
105
127
|
drawPath(path, paint) {
|
106
|
-
this.ref.drawPath(
|
128
|
+
this.ref.drawPath(_JsiSkPath.JsiSkPath.fromValue(path), _JsiSkPaint.JsiSkPaint.fromValue(paint));
|
107
129
|
}
|
108
130
|
|
109
131
|
drawText(str, x, y, paint, font) {
|
110
|
-
this.ref.drawText(str, x, y,
|
132
|
+
this.ref.drawText(str, x, y, _JsiSkPaint.JsiSkPaint.fromValue(paint), _JsiSkFont.JsiSkFont.fromValue(font));
|
111
133
|
}
|
112
134
|
|
113
135
|
drawTextBlob(blob, x, y, paint) {
|
114
|
-
this.ref.drawTextBlob(
|
136
|
+
this.ref.drawTextBlob(_JsiSkTextBlob.JsiSkTextBlob.fromValue(blob), x, y, _JsiSkPaint.JsiSkPaint.fromValue(paint));
|
115
137
|
}
|
116
138
|
|
117
139
|
drawGlyphs(glyphs, positions, x, y, font, paint) {
|
118
|
-
this.ref.drawGlyphs(glyphs, positions.map(p => [p.x, p.y]).flat(), x, y,
|
140
|
+
this.ref.drawGlyphs(glyphs, positions.map(p => [p.x, p.y]).flat(), x, y, _JsiSkFont.JsiSkFont.fromValue(font), _JsiSkPaint.JsiSkPaint.fromValue(paint));
|
119
141
|
}
|
120
142
|
|
121
143
|
drawSvg(_svgDom, _width, _height) {
|
@@ -127,7 +149,7 @@ class JsiSkCanvas extends _Host.HostObject {
|
|
127
149
|
}
|
128
150
|
|
129
151
|
saveLayer(paint, bounds, backdrop, flags) {
|
130
|
-
return this.ref.saveLayer(
|
152
|
+
return this.ref.saveLayer(paint ? _JsiSkPaint.JsiSkPaint.fromValue(paint) : undefined, bounds ? _JsiSkRect.JsiSkRect.fromValue(this.CanvasKit, bounds) : bounds, backdrop ? _JsiSkImageFilter.JsiSkImageFilter.fromValue(backdrop) : backdrop, flags);
|
131
153
|
}
|
132
154
|
|
133
155
|
restore() {
|
@@ -159,23 +181,23 @@ class JsiSkCanvas extends _Host.HostObject {
|
|
159
181
|
}
|
160
182
|
|
161
183
|
clipPath(path, op, doAntiAlias) {
|
162
|
-
this.ref.clipPath(
|
184
|
+
this.ref.clipPath(_JsiSkPath.JsiSkPath.fromValue(path), (0, _Host.ckEnum)(op), doAntiAlias);
|
163
185
|
}
|
164
186
|
|
165
187
|
clipRect(rect, op, doAntiAlias) {
|
166
|
-
this.ref.clipRect((
|
188
|
+
this.ref.clipRect(_JsiSkRect.JsiSkRect.fromValue(this.CanvasKit, rect), (0, _Host.ckEnum)(op), doAntiAlias);
|
167
189
|
}
|
168
190
|
|
169
191
|
clipRRect(rrect, op, doAntiAlias) {
|
170
|
-
this.ref.clipRRect((
|
192
|
+
this.ref.clipRRect(_JsiSkRRect.JsiSkRRect.fromValue(this.CanvasKit, rrect), (0, _Host.ckEnum)(op), doAntiAlias);
|
171
193
|
}
|
172
194
|
|
173
195
|
concat(m) {
|
174
|
-
this.ref.concat(
|
196
|
+
this.ref.concat(_JsiSkMatrix.JsiSkMatrix.fromValue(m));
|
175
197
|
}
|
176
198
|
|
177
199
|
drawPicture(skp) {
|
178
|
-
this.ref.drawPicture(
|
200
|
+
this.ref.drawPicture(_JsiSkPicture.JsiSkPicture.fromValue(skp));
|
179
201
|
}
|
180
202
|
|
181
203
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["JsiSkCanvas.ts"],"names":["JsiSkCanvas","HostObject","constructor","CanvasKit","ref","drawRect","rect","paint","JsiSkRect","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;;AAOA;;AAEO,MAAMA,WAAN,SACGC,gBADH,CAGP;AACEC,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,QAAT,CACEG,qBAAUC,SAAV,CAAoB,KAAKN,SAAzB,EAAoCG,IAApC,EAA0CF,GAD5C,EAEE,mBAAeG,KAAf,CAFF;AAID;;AAEDG,EAAAA,SAAS,CAACC,KAAD,EAAiBC,CAAjB,EAA4BC,CAA5B,EAAuCN,KAAvC,EAAwD;AAC/D,SAAKH,GAAL,CAASM,SAAT,CAAmB,mBAAeC,KAAf,CAAnB,EAA0CC,CAA1C,EAA6CC,CAA7C,EAAgD,2BAAgBN,KAAhB,CAAhD;AACD;;AAEDO,EAAAA,aAAa,CACXC,GADW,EAEXC,GAFW,EAGXC,IAHW,EAIXV,KAJW,EAKXW,UALW,EAMX;AACA,SAAKd,GAAL,CAASU,aAAT,CACE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SAAS,CAACC,KAAD,EAAiBC,SAAjB,EAAwC;AAC/C,SAAKjG,GAAL,CAAS+F,SAAT,CAAmBC,KAAnB,EAA0BC,SAAS,GAAG,kBAAOA,SAAP,CAAH,GAAuBC,SAA1D;AACD;;AAEDC,EAAAA,KAAK,CAACH,KAAD,EAAiB;AACpB,SAAKhG,GAAL,CAASmG,KAAT,CAAeH,KAAf;AACD;;AAEDI,EAAAA,QAAQ,CAACrC,IAAD,EAAesC,EAAf,EAA2BC,WAA3B,EAAiD;AACvD,SAAKtG,GAAL,CAASoG,QAAT,CAAkB,mBAAQrC,IAAR,CAAlB,EAAiC,kBAAOsC,EAAP,CAAjC,EAA6CC,WAA7C;AACD;;AAEDC,EAAAA,QAAQ,CAACrG,IAAD,EAAemG,EAAf,EAA2BC,WAA3B,EAAiD;AACvD,SAAKtG,GAAL,CAASuG,QAAT,CAAkB,mBAAQrG,IAAR,CAAlB,EAAiC,kBAAOmG,EAAP,CAAjC,EAA6CC,WAA7C;AACD;;AAEDE,EAAAA,SAAS,CAAC/C,KAAD,EAAiB4C,EAAjB,EAA6BC,WAA7B,EAAmD;AAC1D,SAAKtG,GAAL,CAASwG,SAAT,CAAmB,mBAAQ/C,KAAR,CAAnB,EAAmC,kBAAO4C,EAAP,CAAnC,EAA+CC,WAA/C;AACD;;AAEDG,EAAAA,MAAM,CAACC,CAAD,EAAc;AAClB,SAAK1G,GAAL,CAASyG,MAAT,CAAgB,mBAAQC,CAAR,CAAhB;AACD;;AAEDC,EAAAA,WAAW,CAACC,GAAD,EAAiB;AAC1B,SAAK5G,GAAL,CAAS2G,WAAT,CAAqB,mBAAQC,GAAR,CAArB;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":["JsiSkCanvas","HostObject","constructor","CanvasKit","ref","drawRect","rect","paint","JsiSkRect","fromValue","JsiSkPaint","drawImage","image","x","y","JsiSkImage","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","JsiSkVertices","drawPatch","cubics","colors","texs","map","flat","flatMap","p","JsiSkPoint","undefined","restoreToCount","saveCount","drawPoints","points","drawArc","oval","startAngle","sweepAngle","useCenter","drawRRect","rrect","JsiSkRRect","drawDRRect","outer","inner","drawOval","drawPath","path","JsiSkPath","drawText","str","font","JsiSkFont","drawTextBlob","blob","JsiSkTextBlob","drawGlyphs","glyphs","positions","drawSvg","_svgDom","_width","_height","Error","save","saveLayer","bounds","backdrop","flags","JsiSkImageFilter","restore","rotate","rotationInDegrees","rx","ry","scale","sx","sy","skew","translate","dx","dy","drawColor","color","blendMode","clear","clipPath","op","doAntiAlias","clipRect","clipRRect","concat","m","JsiSkMatr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,CAACjH,IAAD,EAAe+G,EAAf,EAA2BC,WAA3B,EAAiD;AACvD,SAAKlH,GAAL,CAASmH,QAAT,CACE/G,qBAAUC,SAAV,CAAoB,KAAKN,SAAzB,EAAoCG,IAApC,CADF,EAEE,kBAAO+G,EAAP,CAFF,EAGEC,WAHF;AAKD;;AAEDE,EAAAA,SAAS,CAAClD,KAAD,EAAiB+C,EAAjB,EAA6BC,WAA7B,EAAmD;AAC1D,SAAKlH,GAAL,CAASoH,SAAT,CACEjD,uBAAW9D,SAAX,CAAqB,KAAKN,SAA1B,EAAqCmE,KAArC,CADF,EAEE,kBAAO+C,EAAP,CAFF,EAGEC,WAHF;AAKD;;AAEDG,EAAAA,MAAM,CAACC,CAAD,EAAc;AAClB,SAAKtH,GAAL,CAASqH,MAAT,CAAgBE,yBAAYlH,SAAZ,CAAsBiH,CAAtB,CAAhB;AACD;;AAEDE,EAAAA,WAAW,CAACC,GAAD,EAAiB;AAC1B,SAAKzH,GAAL,CAASwH,WAAT,CAAqBE,2BAAarH,SAAb,CAAuBoH,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"]}
|
@@ -19,15 +19,15 @@ class JsiSkColorFilterFactory extends _Host.Host {
|
|
19
19
|
}
|
20
20
|
|
21
21
|
MakeBlend(color, mode) {
|
22
|
-
return new _JsiSkColorFilter.JsiSkColorFilter(this.CanvasKit, this.CanvasKit.ColorFilter.MakeBlend(
|
22
|
+
return new _JsiSkColorFilter.JsiSkColorFilter(this.CanvasKit, this.CanvasKit.ColorFilter.MakeBlend(color, (0, _Host.ckEnum)(mode)));
|
23
23
|
}
|
24
24
|
|
25
25
|
MakeCompose(outer, inner) {
|
26
|
-
return new _JsiSkColorFilter.JsiSkColorFilter(this.CanvasKit, this.CanvasKit.ColorFilter.MakeCompose(
|
26
|
+
return new _JsiSkColorFilter.JsiSkColorFilter(this.CanvasKit, this.CanvasKit.ColorFilter.MakeCompose(_JsiSkColorFilter.JsiSkColorFilter.fromValue(outer), _JsiSkColorFilter.JsiSkColorFilter.fromValue(inner)));
|
27
27
|
}
|
28
28
|
|
29
29
|
MakeLerp(t, dst, src) {
|
30
|
-
return new _JsiSkColorFilter.JsiSkColorFilter(this.CanvasKit, this.CanvasKit.ColorFilter.MakeLerp(t,
|
30
|
+
return new _JsiSkColorFilter.JsiSkColorFilter(this.CanvasKit, this.CanvasKit.ColorFilter.MakeLerp(t, _JsiSkColorFilter.JsiSkColorFilter.fromValue(dst), _JsiSkColorFilter.JsiSkColorFilter.fromValue(src)));
|
31
31
|
}
|
32
32
|
|
33
33
|
MakeLinearToSRGBGamma() {
|
@@ -39,7 +39,7 @@ class JsiSkColorFilterFactory extends _Host.Host {
|
|
39
39
|
}
|
40
40
|
|
41
41
|
MakeLumaColorFilter() {
|
42
|
-
|
42
|
+
return new _JsiSkColorFilter.JsiSkColorFilter(this.CanvasKit, this.CanvasKit.ColorFilter.MakeLuma());
|
43
43
|
}
|
44
44
|
|
45
45
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["JsiSkColorFilterFactory.ts"],"names":["JsiSkColorFilterFactory","Host","constructor","CanvasKit","MakeMatrix","cMatrix","JsiSkColorFilter","ColorFilter","MakeBlend","color","mode","MakeCompose","outer","inner","MakeLerp","t","dst","src","MakeLinearToSRGBGamma","MakeSRGBToLinearGamma","MakeLumaColorFilter","
|
1
|
+
{"version":3,"sources":["JsiSkColorFilterFactory.ts"],"names":["JsiSkColorFilterFactory","Host","constructor","CanvasKit","MakeMatrix","cMatrix","JsiSkColorFilter","ColorFilter","MakeBlend","color","mode","MakeCompose","outer","inner","fromValue","MakeLerp","t","dst","src","MakeLinearToSRGBGamma","MakeSRGBToLinearGamma","MakeLumaColorFilter","MakeLuma"],"mappings":";;;;;;;AAUA;;AACA;;AAEO,MAAMA,uBAAN,SACGC,UADH,CAGP;AACEC,EAAAA,WAAW,CAACC,SAAD,EAAuB;AAChC,UAAMA,SAAN;AACD;;AAEDC,EAAAA,UAAU,CAACC,OAAD,EAA4B;AACpC,WAAO,IAAIC,kCAAJ,CACL,KAAKH,SADA,EAEL,KAAKA,SAAL,CAAeI,WAAf,CAA2BH,UAA3B,CAAsCC,OAAtC,CAFK,CAAP;AAID;;AAEDG,EAAAA,SAAS,CAACC,KAAD,EAAiBC,IAAjB,EAAkC;AACzC,WAAO,IAAIJ,kCAAJ,CACL,KAAKH,SADA,EAEL,KAAKA,SAAL,CAAeI,WAAf,CAA2BC,SAA3B,CAAqCC,KAArC,EAA4C,kBAAOC,IAAP,CAA5C,CAFK,CAAP;AAID;;AAEDC,EAAAA,WAAW,CAACC,KAAD,EAAuBC,KAAvB,EAA6C;AACtD,WAAO,IAAIP,kCAAJ,CACL,KAAKH,SADA,EAEL,KAAKA,SAAL,CAAeI,WAAf,CAA2BI,WAA3B,CACEL,mCAAiBQ,SAAjB,CAA2BF,KAA3B,CADF,EAEEN,mCAAiBQ,SAAjB,CAA2BD,KAA3B,CAFF,CAFK,CAAP;AAOD;;AAEDE,EAAAA,QAAQ,CAACC,CAAD,EAAYC,GAAZ,EAAgCC,GAAhC,EAAoD;AAC1D,WAAO,IAAIZ,kCAAJ,CACL,KAAKH,SADA,EAEL,KAAKA,SAAL,CAAeI,WAAf,CAA2BQ,QAA3B,CACEC,CADF,EAEEV,mCAAiBQ,SAAjB,CAA2BG,GAA3B,CAFF,EAGEX,mCAAiBQ,SAAjB,CAA2BI,GAA3B,CAHF,CAFK,CAAP;AAQD;;AAEDC,EAAAA,qBAAqB,GAAG;AACtB,WAAO,IAAIb,kCAAJ,CACL,KAAKH,SADA,EAEL,KAAKA,SAAL,CAAeI,WAAf,CAA2BY,qBAA3B,EAFK,CAAP;AAID;;AAEDC,EAAAA,qBAAqB,GAAG;AACtB,WAAO,IAAId,kCAAJ,CACL,KAAKH,SADA,EAEL,KAAKA,SAAL,CAAeI,WAAf,CAA2Ba,qBAA3B,EAFK,CAAP;AAID;;AAEDC,EAAAA,mBAAmB,GAAkB;AACnC,WAAO,IAAIf,kCAAJ,CACL,KAAKH,SADA,EAEL,KAAKA,SAAL,CAAeI,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"]}
|
@@ -7,6 +7,10 @@ exports.JsiSkFont = void 0;
|
|
7
7
|
|
8
8
|
var _Host = require("./Host");
|
9
9
|
|
10
|
+
var _JsiSkPaint = require("./JsiSkPaint");
|
11
|
+
|
12
|
+
var _JsiSkPoint = require("./JsiSkPoint");
|
13
|
+
|
10
14
|
var _JsiSkRect = require("./JsiSkRect");
|
11
15
|
|
12
16
|
var _JsiSkTypeface = require("./JsiSkTypeface");
|
@@ -39,11 +43,11 @@ class JsiSkFont extends _Host.HostObject {
|
|
39
43
|
|
40
44
|
|
41
45
|
getGlyphWidths(glyphs, paint) {
|
42
|
-
return [...this.ref.getGlyphWidths(glyphs, paint ?
|
46
|
+
return [...this.ref.getGlyphWidths(glyphs, paint ? _JsiSkPaint.JsiSkPaint.fromValue(paint) : null)];
|
43
47
|
}
|
44
48
|
|
45
49
|
getGlyphIntercepts(glyphs, positions, top, bottom) {
|
46
|
-
return [...this.ref.getGlyphIntercepts(glyphs, positions.map(p => (
|
50
|
+
return [...this.ref.getGlyphIntercepts(glyphs, positions.map(p => Array.from(_JsiSkPoint.JsiSkPoint.fromValue(p))).flat(), top, bottom)];
|
47
51
|
}
|
48
52
|
|
49
53
|
getScaleX() {
|
@@ -104,7 +108,7 @@ class JsiSkFont extends _Host.HostObject {
|
|
104
108
|
}
|
105
109
|
|
106
110
|
setTypeface(face) {
|
107
|
-
this.ref.setTypeface(face ?
|
111
|
+
this.ref.setTypeface(face ? _JsiSkTypeface.JsiSkTypeface.fromValue(face) : null);
|
108
112
|
}
|
109
113
|
|
110
114
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["JsiSkFont.ts"],"names":["JsiSkFont","HostObject","constructor","CanvasKit","ref","getTextWidth","text","paint","ids","getGlyphIDs","widths","getGlyphWidths","reduce","a","b","getMetrics","result","ascent","descent","leading","bounds","JsiSkRect","undefined","str","numCodePoints","glyphs","getGlyphIntercepts","positions","top","bottom","map","p","getScaleX","getSize","getSkewX","isEmbolden","getTypeface","tf","JsiSkTypeface","setEdging","edging","setEmbeddedBitmaps","embeddedBitmaps","setHinting","hinting","setLinearMetrics","linearMetrics","setScaleX","sx","setSize","points","setSkewX","setEmbolden","embolden","setSubpixel","subpixel","setTypeface","face"],"mappings":";;;;;;;AAWA;;AACA;;AACA;;AAEO,MAAMA,SAAN,SAAwBC,gBAAxB,CAAmE;AACxEC,EAAAA,WAAW,CAACC,SAAD,EAAuBC,GAAvB,EAAkC;AAC3C,UAAMD,SAAN,EAAiBC,GAAjB,EAAsB,MAAtB;AACD;;AAEDC,EAAAA,YAAY,CAACC,IAAD,EAAeC,KAAf,EAA4C;AACtD,UAAMC,GAAG,GAAG,KAAKC,WAAL,CAAiBH,IAAjB,CAAZ;AACA,UAAMI,MAAM,GAAG,KAAKC,cAAL,CAAoBH,GAApB,EAAyBD,KAAzB,CAAf;AACA,WAAOG,MAAM,CAACE,MAAP,CAAc,CAACC,CAAD,EAAIC,CAAJ,KAAUD,CAAC,GAAGC,CAA5B,EAA+B,CAA/B,CAAP;AACD;;AAEDC,EAAAA,UAAU,GAAG;AACX,UAAMC,MAAM,GAAG,KAAKZ,GAAL,CAASW,UAAT,EAAf;AACA,WAAO;AACLE,MAAAA,MAAM,EAAED,MAAM,CAACC,MADV;AAELC,MAAAA,OAAO,EAAEF,MAAM,CAACE,OAFX;AAGLC,MAAAA,OAAO,EAAEH,MAAM,CAACG,OAHX;AAILC,MAAAA,MAAM,EAAEJ,MAAM,CAACI,MAAP,GACJ,IAAIC,oBAAJ,CAAc,KAAKlB,SAAnB,EAA8Ba,MAAM,CAACI,MAArC,CADI,GAEJE;AANC,KAAP;AAQD;;AAEDb,EAAAA,WAAW,CAACc,GAAD,EAAcC,aAAd,EAAsC;AAC/C;AACA,WAAO,CAAC,GAAG,KAAKpB,GAAL,CAASK,WAAT,CAAqBc,GAArB,EAA0BC,aAA1B,CAAJ,CAAP;AACD,GA1BuE,CA4BxE;;;AACAb,EAAAA,cAAc,CAACc,MAAD,EAAmBlB,KAAnB,EAA2C;AACvD,WAAO,
|
1
|
+
{"version":3,"sources":["JsiSkFont.ts"],"names":["JsiSkFont","HostObject","constructor","CanvasKit","ref","getTextWidth","text","paint","ids","getGlyphIDs","widths","getGlyphWidths","reduce","a","b","getMetrics","result","ascent","descent","leading","bounds","JsiSkRect","undefined","str","numCodePoints","glyphs","JsiSkPaint","fromValue","getGlyphIntercepts","positions","top","bottom","map","p","Array","from","JsiSkPoint","flat","getScaleX","getSize","getSkewX","isEmbolden","getTypeface","tf","JsiSkTypeface","setEdging","edging","setEmbeddedBitmaps","embeddedBitmaps","setHinting","hinting","setLinearMetrics","linearMetrics","setScaleX","sx","setSize","points","setSkewX","setEmbolden","embolden","setSubpixel","subpixel","setTypeface","face"],"mappings":";;;;;;;AAWA;;AACA;;AACA;;AACA;;AACA;;AAEO,MAAMA,SAAN,SAAwBC,gBAAxB,CAAmE;AACxEC,EAAAA,WAAW,CAACC,SAAD,EAAuBC,GAAvB,EAAkC;AAC3C,UAAMD,SAAN,EAAiBC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,EAAiB;AACtB,SAAKpD,GAAL,CAASmD,OAAT,CAAiBC,MAAjB;AACD;;AAEDC,EAAAA,QAAQ,CAACH,EAAD,EAAa;AACnB,SAAKlD,GAAL,CAASqD,QAAT,CAAkBH,EAAlB;AACD;;AAEDI,EAAAA,WAAW,CAACC,QAAD,EAAoB;AAC7B,SAAKvD,GAAL,CAASsD,WAAT,CAAqBC,QAArB;AACD;;AAEDC,EAAAA,WAAW,CAACC,QAAD,EAAoB;AAC7B,SAAKzD,GAAL,CAASwD,WAAT,CAAqBC,QAArB;AACD;;AAEDC,EAAAA,WAAW,CAACC,IAAD,EAA0B;AACnC,SAAK3D,GAAL,CAAS0D,WAAT,CAAqBC,IAAI,GAAGnB,6BAAcjB,SAAd,CAAwBoC,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"]}
|
@@ -7,6 +7,8 @@ exports.JsiSkImage = void 0;
|
|
7
7
|
|
8
8
|
var _Host = require("./Host");
|
9
9
|
|
10
|
+
var _JsiSkMatrix = require("./JsiSkMatrix");
|
11
|
+
|
10
12
|
var _JsiSkShader = require("./JsiSkShader");
|
11
13
|
|
12
14
|
/*global btoa, atob*/
|
@@ -24,11 +26,11 @@ class JsiSkImage extends _Host.HostObject {
|
|
24
26
|
}
|
25
27
|
|
26
28
|
makeShaderOptions(tx, ty, fm, mm, localMatrix) {
|
27
|
-
return new _JsiSkShader.JsiSkShader(this.CanvasKit, this.ref.makeShaderOptions((0, _Host.ckEnum)(tx), (0, _Host.ckEnum)(ty), (0, _Host.ckEnum)(fm), (0, _Host.ckEnum)(mm), localMatrix ?
|
29
|
+
return new _JsiSkShader.JsiSkShader(this.CanvasKit, this.ref.makeShaderOptions((0, _Host.ckEnum)(tx), (0, _Host.ckEnum)(ty), (0, _Host.ckEnum)(fm), (0, _Host.ckEnum)(mm), localMatrix ? _JsiSkMatrix.JsiSkMatrix.fromValue(localMatrix) : undefined));
|
28
30
|
}
|
29
31
|
|
30
32
|
makeShaderCubic(tx, ty, B, C, localMatrix) {
|
31
|
-
return new _JsiSkShader.JsiSkShader(this.CanvasKit, this.ref.makeShaderCubic((0, _Host.ckEnum)(tx), (0, _Host.ckEnum)(ty), B, C, localMatrix ?
|
33
|
+
return new _JsiSkShader.JsiSkShader(this.CanvasKit, this.ref.makeShaderCubic((0, _Host.ckEnum)(tx), (0, _Host.ckEnum)(ty), B, C, localMatrix ? _JsiSkMatrix.JsiSkMatrix.fromValue(localMatrix) : undefined));
|
32
34
|
}
|
33
35
|
|
34
36
|
encodeToBytes(fmt, quality) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["JsiSkImage.ts"],"names":["JsiSkImage","HostObject","constructor","CanvasKit","ref","height","width","makeShaderOptions","tx","ty","fm","mm","localMatrix","JsiSkShader","undefined","makeShaderCubic","B","C","encodeToBytes","fmt","quality","result","Error","encodeToBase64","bytes","btoa","String","fromCharCode"],"mappings":";;;;;;;AAaA;;AACA;;
|
1
|
+
{"version":3,"sources":["JsiSkImage.ts"],"names":["JsiSkImage","HostObject","constructor","CanvasKit","ref","height","width","makeShaderOptions","tx","ty","fm","mm","localMatrix","JsiSkShader","JsiSkMatrix","fromValue","undefined","makeShaderCubic","B","C","encodeToBytes","fmt","quality","result","Error","encodeToBase64","bytes","btoa","String","fromCharCode"],"mappings":";;;;;;;AAaA;;AACA;;AACA;;AAfA;AAiBO,MAAMA,UAAN,SAAyBC,gBAAzB,CAAuE;AAC5EC,EAAAA,WAAW,CAACC,SAAD,EAAuBC,GAAvB,EAAmC;AAC5C,UAAMD,SAAN,EAAiBC,GAAjB,EAAsB,OAAtB;AACD;;AAEDC,EAAAA,MAAM,GAAG;AACP,WAAO,KAAKD,GAAL,CAASC,MAAT,EAAP;AACD;;AAEDC,EAAAA,KAAK,GAAG;AACN,WAAO,KAAKF,GAAL,CAASE,KAAT,EAAP;AACD;;AAEDC,EAAAA,iBAAiB,CACfC,EADe,EAEfC,EAFe,EAGfC,EAHe,EAIfC,EAJe,EAKfC,WALe,EAML;AACV,WAAO,IAAIC,wBAAJ,CACL,KAAKV,SADA,EAEL,KAAKC,GAAL,CAASG,iBAAT,CACE,kBAAOC,EAAP,CADF,EAEE,kBAAOC,EAAP,CAFF,EAGE,kBAAOC,EAAP,CAHF,EAIE,kBAAOC,EAAP,CAJF,EAKEC,WAAW,GAAGE,yBAAYC,SAAZ,CAAsBH,WAAtB,CAAH,GAAwCI,SALrD,CAFK,CAAP;AAUD;;AAEDC,EAAAA,eAAe,CACbT,EADa,EAEbC,EAFa,EAGbS,CAHa,EAIbC,CAJa,EAKbP,WALa,EAMH;AACV,WAAO,IAAIC,wBAAJ,CACL,KAAKV,SADA,EAEL,KAAKC,GAAL,CAASa,eAAT,CACE,kBAAOT,EAAP,CADF,EAEE,kBAAOC,EAAP,CAFF,EAGES,CAHF,EAIEC,CAJF,EAKEP,WAAW,GAAGE,yBAAYC,SAAZ,CAAsBH,WAAtB,CAAH,GAAwCI,SALrD,CAFK,CAAP;AAUD;;AAEDI,EAAAA,aAAa,CAACC,GAAD,EAAoBC,OAApB,EAAsC;AACjD,QAAIC,MAAJ;;AACA,QAAIF,GAAG,IAAIC,OAAX,EAAoB;AAClBC,MAAAA,MAAM,GAAG,KAAKnB,GAAL,CAASgB,aAAT,CAAuB,kBAAOC,GAAP,CAAvB,EAAoCC,OAApC,CAAT;AACD,KAFD,MAEO,IAAID,GAAJ,EAAS;AACdE,MAAAA,MAAM,GAAG,KAAKnB,GAAL,CAASgB,aAAT,CAAuB,kBAAOC,GAAP,CAAvB,CAAT;AACD,KAFM,MAEA;AACLE,MAAAA,MAAM,GAAG,KAAKnB,GAAL,CAASgB,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"]}
|
@@ -9,13 +9,15 @@ var _Host = require("./Host");
|
|
9
9
|
|
10
10
|
var _JsiSkImage = require("./JsiSkImage");
|
11
11
|
|
12
|
+
var _JsiSkData = require("./JsiSkData");
|
13
|
+
|
12
14
|
class JsiSkImageFactory extends _Host.Host {
|
13
15
|
constructor(CanvasKit) {
|
14
16
|
super(CanvasKit);
|
15
17
|
}
|
16
18
|
|
17
19
|
MakeImageFromEncoded(encoded) {
|
18
|
-
const image = this.CanvasKit.MakeImageFromEncoded(
|
20
|
+
const image = this.CanvasKit.MakeImageFromEncoded(_JsiSkData.JsiSkData.fromValue(encoded));
|
19
21
|
|
20
22
|
if (image === null) {
|
21
23
|
return null;
|
@@ -32,7 +34,7 @@ class JsiSkImageFactory extends _Host.Host {
|
|
32
34
|
colorType: (0, _Host.ckEnum)(info.colorType),
|
33
35
|
height: info.height,
|
34
36
|
width: info.width
|
35
|
-
},
|
37
|
+
}, _JsiSkData.JsiSkData.fromValue(data), bytesPerRow);
|
36
38
|
|
37
39
|
if (image === null) {
|
38
40
|
return null;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["JsiSkImageFactory.ts"],"names":["JsiSkImageFactory","Host","constructor","CanvasKit","MakeImageFromEncoded","encoded","image","JsiSkImage","MakeImage","info","data","bytesPerRow","alphaType","colorSpace","ColorSpace","SRGB","colorType","height","width"],"mappings":";;;;;;;AAKA;;AACA;;AAEO,MAAMA,iBAAN,SAAgCC,UAAhC,CAA6D;AAClEC,EAAAA,WAAW,CAACC,SAAD,EAAuB;AAChC,UAAMA,SAAN;AACD;;AAEDC,EAAAA,oBAAoB,CAACC,OAAD,EAAkB;AACpC,UAAMC,KAAK,GAAG,KAAKH,SAAL,CAAeC,oBAAf,
|
1
|
+
{"version":3,"sources":["JsiSkImageFactory.ts"],"names":["JsiSkImageFactory","Host","constructor","CanvasKit","MakeImageFromEncoded","encoded","image","JsiSkData","fromValue","JsiSkImage","MakeImage","info","data","bytesPerRow","alphaType","colorSpace","ColorSpace","SRGB","colorType","height","width"],"mappings":";;;;;;;AAKA;;AACA;;AACA;;AAEO,MAAMA,iBAAN,SAAgCC,UAAhC,CAA6D;AAClEC,EAAAA,WAAW,CAACC,SAAD,EAAuB;AAChC,UAAMA,SAAN;AACD;;AAEDC,EAAAA,oBAAoB,CAACC,OAAD,EAAkB;AACpC,UAAMC,KAAK,GAAG,KAAKH,SAAL,CAAeC,oBAAf,CACZG,qBAAUC,SAAV,CAAoBH,OAApB,CADY,CAAd;;AAGA,QAAIC,KAAK,KAAK,IAAd,EAAoB;AAClB,aAAO,IAAP;AACD;;AACD,WAAO,IAAIG,sBAAJ,CAAe,KAAKN,SAApB,EAA+BG,KAA/B,CAAP;AACD;;AAEDI,EAAAA,SAAS,CAACC,IAAD,EAAkBC,IAAlB,EAAgCC,WAAhC,EAAqD;AAC5D;AACA,UAAMP,KAAK,GAAG,KAAKH,SAAL,CAAeO,SAAf,CACZ;AACEI,MAAAA,SAAS,EAAE,kBAAOH,IAAI,CAACG,SAAZ,CADb;AAEEC,MAAAA,UAAU,EAAE,KAAKZ,SAAL,CAAea,UAAf,CAA0BC,IAFxC;AAGEC,MAAAA,SAAS,EAAE,kBAAOP,IAAI,CAACO,SAAZ,CAHb;AAIEC,MAAAA,MAAM,EAAER,IAAI,CAACQ,MAJf;AAKEC,MAAAA,KAAK,EAAET,IAAI,CAACS;AALd,KADY,EAQZb,qBAAUC,SAAV,CAAoBI,IAApB,CARY,EASZC,WATY,CAAd;;AAWA,QAAIP,KAAK,KAAK,IAAd,EAAoB;AAClB,aAAO,IAAP;AACD;;AACD,WAAO,IAAIG,sBAAJ,CAAe,KAAKN,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"]}
|
@@ -9,53 +9,95 @@ var _Host = require("./Host");
|
|
9
9
|
|
10
10
|
var _JsiSkImageFilter = require("./JsiSkImageFilter");
|
11
11
|
|
12
|
+
var _JsiSkColorFilter = require("./JsiSkColorFilter");
|
13
|
+
|
12
14
|
class JsiSkImageFilterFactory extends _Host.Host {
|
13
15
|
constructor(CanvasKit) {
|
14
16
|
super(CanvasKit);
|
15
17
|
}
|
16
18
|
|
17
|
-
MakeOffset(
|
18
|
-
|
19
|
+
MakeOffset(dx, dy, input) {
|
20
|
+
const inputFilter = input === null ? null : _JsiSkImageFilter.JsiSkImageFilter.fromValue(input);
|
21
|
+
const filter = this.CanvasKit.ImageFilter.MakeOffset(dx, dy, inputFilter);
|
22
|
+
return new _JsiSkImageFilter.JsiSkImageFilter(this.CanvasKit, filter);
|
19
23
|
}
|
20
24
|
|
21
|
-
MakeDisplacementMap(
|
22
|
-
|
25
|
+
MakeDisplacementMap(channelX, channelY, scale, in1, input) {
|
26
|
+
const inputFilter = input === null ? null : _JsiSkImageFilter.JsiSkImageFilter.fromValue(input);
|
27
|
+
const filter = this.CanvasKit.ImageFilter.MakeDisplacementMap((0, _Host.ckEnum)(channelX), (0, _Host.ckEnum)(channelY), scale, _JsiSkImageFilter.JsiSkImageFilter.fromValue(in1), inputFilter);
|
28
|
+
return new _JsiSkImageFilter.JsiSkImageFilter(this.CanvasKit, filter);
|
23
29
|
}
|
24
30
|
|
25
|
-
MakeShader(
|
26
|
-
|
31
|
+
MakeShader(shader, _input) {
|
32
|
+
const filter = this.CanvasKit.ImageFilter.MakeShader(_JsiSkImageFilter.JsiSkImageFilter.fromValue(shader));
|
33
|
+
return new _JsiSkImageFilter.JsiSkImageFilter(this.CanvasKit, filter);
|
27
34
|
}
|
28
35
|
|
29
36
|
MakeBlur(sigmaX, sigmaY, mode, input) {
|
30
|
-
return new _JsiSkImageFilter.JsiSkImageFilter(this.CanvasKit, this.CanvasKit.ImageFilter.MakeBlur(sigmaX, sigmaY, (0, _Host.ckEnum)(mode), input === null ? null :
|
37
|
+
return new _JsiSkImageFilter.JsiSkImageFilter(this.CanvasKit, this.CanvasKit.ImageFilter.MakeBlur(sigmaX, sigmaY, (0, _Host.ckEnum)(mode), input === null ? null : _JsiSkImageFilter.JsiSkImageFilter.fromValue(input)));
|
31
38
|
}
|
32
39
|
|
33
40
|
MakeColorFilter(cf, input) {
|
34
|
-
return new _JsiSkImageFilter.JsiSkImageFilter(this.CanvasKit, this.CanvasKit.ImageFilter.MakeColorFilter(
|
41
|
+
return new _JsiSkImageFilter.JsiSkImageFilter(this.CanvasKit, this.CanvasKit.ImageFilter.MakeColorFilter(_JsiSkColorFilter.JsiSkColorFilter.fromValue(cf), input === null ? null : _JsiSkImageFilter.JsiSkImageFilter.fromValue(input)));
|
35
42
|
}
|
36
43
|
|
37
44
|
MakeCompose(outer, inner) {
|
38
|
-
return new _JsiSkImageFilter.JsiSkImageFilter(this.CanvasKit, this.CanvasKit.ImageFilter.MakeCompose(outer === null ? null :
|
45
|
+
return new _JsiSkImageFilter.JsiSkImageFilter(this.CanvasKit, this.CanvasKit.ImageFilter.MakeCompose(outer === null ? null : _JsiSkImageFilter.JsiSkImageFilter.fromValue(outer), inner === null ? null : _JsiSkImageFilter.JsiSkImageFilter.fromValue(inner)));
|
39
46
|
}
|
40
47
|
|
41
|
-
MakeDropShadow(
|
42
|
-
|
48
|
+
MakeDropShadow(dx, dy, sigmaX, sigmaY, color, input, cropRect) {
|
49
|
+
const inputFilter = input === null ? null : _JsiSkImageFilter.JsiSkImageFilter.fromValue(input);
|
50
|
+
|
51
|
+
if (cropRect) {
|
52
|
+
throw new _Host.NotImplementedOnRNWeb("The cropRect argument is not yet supported on React Native Web.");
|
53
|
+
}
|
54
|
+
|
55
|
+
const filter = this.CanvasKit.ImageFilter.MakeDropShadow(dx, dy, sigmaX, sigmaY, color, inputFilter);
|
56
|
+
return new _JsiSkImageFilter.JsiSkImageFilter(this.CanvasKit, filter);
|
43
57
|
}
|
44
58
|
|
45
|
-
MakeDropShadowOnly(
|
46
|
-
|
59
|
+
MakeDropShadowOnly(dx, dy, sigmaX, sigmaY, color, input, cropRect) {
|
60
|
+
const inputFilter = input === null ? null : _JsiSkImageFilter.JsiSkImageFilter.fromValue(input);
|
61
|
+
|
62
|
+
if (cropRect) {
|
63
|
+
throw new _Host.NotImplementedOnRNWeb("The cropRect argument is not yet supported on React Native Web.");
|
64
|
+
}
|
65
|
+
|
66
|
+
const filter = this.CanvasKit.ImageFilter.MakeDropShadowOnly(dx, dy, sigmaX, sigmaY, color, inputFilter);
|
67
|
+
return new _JsiSkImageFilter.JsiSkImageFilter(this.CanvasKit, filter);
|
47
68
|
}
|
48
69
|
|
49
|
-
MakeErode(
|
50
|
-
|
70
|
+
MakeErode(rx, ry, input, cropRect) {
|
71
|
+
const inputFilter = input === null ? null : _JsiSkImageFilter.JsiSkImageFilter.fromValue(input);
|
72
|
+
|
73
|
+
if (cropRect) {
|
74
|
+
throw new _Host.NotImplementedOnRNWeb("The cropRect argument is not yet supported on React Native Web.");
|
75
|
+
}
|
76
|
+
|
77
|
+
const filter = this.CanvasKit.ImageFilter.MakeErode(rx, ry, inputFilter);
|
78
|
+
return new _JsiSkImageFilter.JsiSkImageFilter(this.CanvasKit, filter);
|
51
79
|
}
|
52
80
|
|
53
|
-
MakeDilate(
|
54
|
-
|
81
|
+
MakeDilate(rx, ry, input, cropRect) {
|
82
|
+
const inputFilter = input === null ? null : _JsiSkImageFilter.JsiSkImageFilter.fromValue(input);
|
83
|
+
|
84
|
+
if (cropRect) {
|
85
|
+
throw new _Host.NotImplementedOnRNWeb("The cropRect argument is not yet supported on React Native Web.");
|
86
|
+
}
|
87
|
+
|
88
|
+
const filter = this.CanvasKit.ImageFilter.MakeDilate(rx, ry, inputFilter);
|
89
|
+
return new _JsiSkImageFilter.JsiSkImageFilter(this.CanvasKit, filter);
|
55
90
|
}
|
56
91
|
|
57
|
-
MakeBlend(
|
58
|
-
|
92
|
+
MakeBlend(mode, background, foreground, cropRect) {
|
93
|
+
const inputFilter = foreground === null ? null : _JsiSkImageFilter.JsiSkImageFilter.fromValue(foreground);
|
94
|
+
|
95
|
+
if (cropRect) {
|
96
|
+
throw new _Host.NotImplementedOnRNWeb("The cropRect argument is not yet supported on React Native Web.");
|
97
|
+
}
|
98
|
+
|
99
|
+
const filter = this.CanvasKit.ImageFilter.MakeBlend((0, _Host.ckEnum)(mode), _JsiSkImageFilter.JsiSkImageFilter.fromValue(background), inputFilter);
|
100
|
+
return new _JsiSkImageFilter.JsiSkImageFilter(this.CanvasKit, filter);
|
59
101
|
}
|
60
102
|
|
61
103
|
MakeRuntimeShader(_builder, _childShaderName, _input) {
|