@shopify/react-native-skia 0.1.142 → 0.1.146
Sign up to get free protection for your applications and to get access to all the features.
- package/cpp/api/JsiSkContourMeasure.h +4 -4
- package/cpp/api/JsiSkDataFactory.h +3 -3
- package/cpp/api/JsiSkFont.h +1 -1
- package/cpp/api/JsiSkPaint.h +6 -0
- package/cpp/api/JsiSkPathFactory.h +2 -2
- package/cpp/api/JsiSkPicture.h +7 -1
- package/cpp/api/JsiSkPictureFactory.h +1 -1
- package/cpp/api/JsiSkRuntimeEffect.h +6 -6
- package/cpp/api/JsiSkRuntimeEffectFactory.h +1 -1
- package/cpp/jsi/JsiSimpleValueWrapper.h +27 -27
- package/cpp/jsi/JsiValueWrapper.h +127 -0
- package/cpp/rnskia/RNSkDrawView.cpp +44 -20
- package/cpp/rnskia/RNSkDrawView.h +18 -20
- package/cpp/rnskia/RNSkJsiViewApi.h +180 -166
- package/cpp/rnskia/values/RNSkComputedValue.h +11 -11
- package/cpp/rnskia/values/RNSkReadonlyValue.h +19 -19
- package/cpp/rnskia/values/RNSkValue.h +13 -13
- package/cpp/utils/RNSkLog.h +4 -4
- package/lib/commonjs/renderer/Canvas.js +17 -7
- package/lib/commonjs/renderer/Canvas.js.map +1 -1
- package/lib/commonjs/renderer/DependencyManager.js +144 -36
- package/lib/commonjs/renderer/DependencyManager.js.map +1 -1
- package/lib/commonjs/renderer/HostConfig.js +18 -2
- package/lib/commonjs/renderer/HostConfig.js.map +1 -1
- package/lib/commonjs/renderer/components/Blend.js +20 -5
- package/lib/commonjs/renderer/components/Blend.js.map +1 -1
- package/lib/commonjs/renderer/components/backdrop/BackdropFilter.js.map +1 -1
- package/lib/commonjs/renderer/components/imageFilters/Morphology.js +1 -1
- package/lib/commonjs/renderer/components/imageFilters/Morphology.js.map +1 -1
- package/lib/commonjs/renderer/components/imageFilters/Shadow.js +1 -1
- package/lib/commonjs/renderer/components/imageFilters/Shadow.js.map +1 -1
- package/lib/commonjs/renderer/nodes/Declaration.js +2 -3
- package/lib/commonjs/renderer/nodes/Declaration.js.map +1 -1
- package/lib/commonjs/renderer/nodes/Drawing.js +3 -7
- package/lib/commonjs/renderer/nodes/Drawing.js.map +1 -1
- package/lib/commonjs/renderer/nodes/Node.js +9 -7
- package/lib/commonjs/renderer/nodes/Node.js.map +1 -1
- package/lib/commonjs/renderer/processors/Animations/Animations.js +3 -22
- package/lib/commonjs/renderer/processors/Animations/Animations.js.map +1 -1
- package/lib/commonjs/skia/types/Paint/Paint.js.map +1 -1
- package/lib/commonjs/skia/web/Host.js +12 -21
- package/lib/commonjs/skia/web/Host.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkCanvas.js +46 -26
- package/lib/commonjs/skia/web/JsiSkCanvas.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkColorFilterFactory.js +4 -4
- package/lib/commonjs/skia/web/JsiSkColorFilterFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkFont.js +7 -3
- package/lib/commonjs/skia/web/JsiSkFont.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkImage.js +4 -2
- package/lib/commonjs/skia/web/JsiSkImage.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkImageFactory.js +4 -2
- package/lib/commonjs/skia/web/JsiSkImageFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkImageFilterFactory.js +61 -19
- package/lib/commonjs/skia/web/JsiSkImageFilterFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkMatrix.js +1 -1
- package/lib/commonjs/skia/web/JsiSkMatrix.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPaint.js +19 -6
- package/lib/commonjs/skia/web/JsiSkPaint.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPath.js +9 -55
- package/lib/commonjs/skia/web/JsiSkPath.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPathEffectFactory.js +7 -3
- package/lib/commonjs/skia/web/JsiSkPathEffectFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPathFactory.js +1 -1
- package/lib/commonjs/skia/web/JsiSkPathFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPicture.js +5 -1
- package/lib/commonjs/skia/web/JsiSkPicture.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPictureRecorder.js +3 -1
- package/lib/commonjs/skia/web/JsiSkPictureRecorder.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPoint.js +9 -1
- package/lib/commonjs/skia/web/JsiSkPoint.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkRRect.js +1 -1
- package/lib/commonjs/skia/web/JsiSkRRect.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkRSXform.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkRect.js +1 -1
- package/lib/commonjs/skia/web/JsiSkRect.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkRuntimeEffect.js +4 -2
- package/lib/commonjs/skia/web/JsiSkRuntimeEffect.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkShaderFactory.js +10 -6
- package/lib/commonjs/skia/web/JsiSkShaderFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkSurface.js +3 -1
- package/lib/commonjs/skia/web/JsiSkSurface.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkTextBlobFactory.js +8 -4
- package/lib/commonjs/skia/web/JsiSkTextBlobFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkTypefaceFactory.js +1 -1
- package/lib/commonjs/skia/web/JsiSkTypefaceFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkia.js +12 -6
- package/lib/commonjs/skia/web/JsiSkia.js.map +1 -1
- package/lib/commonjs/views/SkiaView.js +11 -27
- package/lib/commonjs/views/SkiaView.js.map +1 -1
- package/lib/commonjs/views/types.js.map +1 -1
- package/lib/module/renderer/Canvas.js +17 -6
- package/lib/module/renderer/Canvas.js.map +1 -1
- package/lib/module/renderer/DependencyManager.js +140 -33
- package/lib/module/renderer/DependencyManager.js.map +1 -1
- package/lib/module/renderer/HostConfig.js +18 -2
- package/lib/module/renderer/HostConfig.js.map +1 -1
- package/lib/module/renderer/components/Blend.js +21 -5
- package/lib/module/renderer/components/Blend.js.map +1 -1
- package/lib/module/renderer/components/backdrop/BackdropFilter.js.map +1 -1
- package/lib/module/renderer/components/imageFilters/Morphology.js +1 -1
- package/lib/module/renderer/components/imageFilters/Morphology.js.map +1 -1
- package/lib/module/renderer/components/imageFilters/Shadow.js +1 -1
- package/lib/module/renderer/components/imageFilters/Shadow.js.map +1 -1
- package/lib/module/renderer/nodes/Declaration.js +3 -4
- package/lib/module/renderer/nodes/Declaration.js.map +1 -1
- package/lib/module/renderer/nodes/Drawing.js +3 -6
- package/lib/module/renderer/nodes/Drawing.js.map +1 -1
- package/lib/module/renderer/nodes/Node.js +9 -7
- package/lib/module/renderer/nodes/Node.js.map +1 -1
- package/lib/module/renderer/processors/Animations/Animations.js +1 -16
- package/lib/module/renderer/processors/Animations/Animations.js.map +1 -1
- package/lib/module/skia/types/Paint/Paint.js.map +1 -1
- package/lib/module/skia/web/Host.js +9 -9
- package/lib/module/skia/web/Host.js.map +1 -1
- package/lib/module/skia/web/JsiSkCanvas.js +37 -27
- package/lib/module/skia/web/JsiSkCanvas.js.map +1 -1
- package/lib/module/skia/web/JsiSkColorFilterFactory.js +5 -5
- package/lib/module/skia/web/JsiSkColorFilterFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkFont.js +6 -4
- package/lib/module/skia/web/JsiSkFont.js.map +1 -1
- package/lib/module/skia/web/JsiSkImage.js +4 -3
- package/lib/module/skia/web/JsiSkImage.js.map +1 -1
- package/lib/module/skia/web/JsiSkImageFactory.js +4 -3
- package/lib/module/skia/web/JsiSkImageFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkImageFilterFactory.js +61 -20
- package/lib/module/skia/web/JsiSkImageFilterFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkMatrix.js +2 -2
- package/lib/module/skia/web/JsiSkMatrix.js.map +1 -1
- package/lib/module/skia/web/JsiSkPaint.js +15 -7
- package/lib/module/skia/web/JsiSkPaint.js.map +1 -1
- package/lib/module/skia/web/JsiSkPath.js +9 -57
- package/lib/module/skia/web/JsiSkPath.js.map +1 -1
- package/lib/module/skia/web/JsiSkPathEffectFactory.js +6 -4
- package/lib/module/skia/web/JsiSkPathEffectFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkPathFactory.js +2 -2
- package/lib/module/skia/web/JsiSkPathFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkPicture.js +4 -2
- package/lib/module/skia/web/JsiSkPicture.js.map +1 -1
- package/lib/module/skia/web/JsiSkPictureRecorder.js +3 -2
- package/lib/module/skia/web/JsiSkPictureRecorder.js.map +1 -1
- package/lib/module/skia/web/JsiSkPoint.js +10 -2
- package/lib/module/skia/web/JsiSkPoint.js.map +1 -1
- package/lib/module/skia/web/JsiSkRRect.js +2 -2
- package/lib/module/skia/web/JsiSkRRect.js.map +1 -1
- package/lib/module/skia/web/JsiSkRSXform.js.map +1 -1
- package/lib/module/skia/web/JsiSkRect.js +2 -2
- package/lib/module/skia/web/JsiSkRect.js.map +1 -1
- package/lib/module/skia/web/JsiSkRuntimeEffect.js +4 -3
- package/lib/module/skia/web/JsiSkRuntimeEffect.js.map +1 -1
- package/lib/module/skia/web/JsiSkShaderFactory.js +9 -7
- package/lib/module/skia/web/JsiSkShaderFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkSurface.js +3 -2
- package/lib/module/skia/web/JsiSkSurface.js.map +1 -1
- package/lib/module/skia/web/JsiSkTextBlobFactory.js +7 -5
- package/lib/module/skia/web/JsiSkTextBlobFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkTypefaceFactory.js +2 -2
- package/lib/module/skia/web/JsiSkTypefaceFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkia.js +10 -5
- package/lib/module/skia/web/JsiSkia.js.map +1 -1
- package/lib/module/views/SkiaView.js +11 -26
- package/lib/module/views/SkiaView.js.map +1 -1
- package/lib/module/views/types.js.map +1 -1
- package/lib/typescript/src/renderer/Canvas.d.ts +1 -1
- package/lib/typescript/src/renderer/DependencyManager.d.ts +40 -14
- package/lib/typescript/src/renderer/nodes/Declaration.d.ts +2 -2
- package/lib/typescript/src/renderer/nodes/Drawing.d.ts +2 -2
- package/lib/typescript/src/renderer/nodes/Node.d.ts +3 -2
- package/lib/typescript/src/renderer/processors/Animations/Animations.d.ts +0 -1
- package/lib/typescript/src/skia/types/Paint/Paint.d.ts +5 -0
- package/lib/typescript/src/skia/types/Picture/Picture.d.ts +2 -1
- package/lib/typescript/src/skia/web/Host.d.ts +6 -8
- package/lib/typescript/src/skia/web/JsiSkImageFilterFactory.d.ts +8 -8
- package/lib/typescript/src/skia/web/JsiSkPaint.d.ts +1 -0
- package/lib/typescript/src/skia/web/JsiSkPoint.d.ts +3 -2
- package/lib/typescript/src/skia/web/JsiSkRRect.d.ts +2 -2
- package/lib/typescript/src/skia/web/JsiSkRSXform.d.ts +1 -2
- package/lib/typescript/src/skia/web/JsiSkRect.d.ts +2 -2
- package/lib/typescript/src/skia/web/JsiSkTextBlobFactory.d.ts +2 -1
- package/lib/typescript/src/views/SkiaView.d.ts +1 -11
- package/lib/typescript/src/views/types.d.ts +5 -5
- package/libs/ios/libskia.xcframework/Info.plist +5 -5
- package/libs/ios/libskia.xcframework/ios-arm64_arm64e/libskia.a +0 -0
- package/libs/ios/libskia.xcframework/ios-arm64_arm64e_x86_64-simulator/libskia.a +0 -0
- package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e/libskshaper.a +0 -0
- package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e_x86_64-simulator/libskshaper.a +0 -0
- package/libs/ios/libsvg.xcframework/ios-arm64_arm64e/libsvg.a +0 -0
- package/libs/ios/libsvg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsvg.a +0 -0
- package/package.json +2 -2
- package/src/renderer/Canvas.tsx +19 -7
- package/src/renderer/DependencyManager.tsx +170 -39
- package/src/renderer/HostConfig.ts +12 -2
- package/src/renderer/components/Blend.tsx +25 -5
- package/src/renderer/components/backdrop/BackdropFilter.tsx +1 -1
- package/src/renderer/components/imageFilters/Morphology.tsx +2 -2
- package/src/renderer/components/imageFilters/Shadow.tsx +2 -2
- package/src/renderer/nodes/Declaration.tsx +6 -8
- package/src/renderer/nodes/Drawing.tsx +5 -7
- package/src/renderer/nodes/Node.ts +11 -9
- package/src/renderer/processors/Animations/Animations.ts +2 -15
- package/src/skia/types/Paint/Paint.ts +6 -0
- package/src/skia/types/Picture/Picture.ts +2 -1
- package/src/skia/web/Host.ts +12 -22
- package/src/skia/web/JsiSkCanvas.ts +78 -47
- package/src/skia/web/JsiSkColorFilterFactory.ts +15 -5
- package/src/skia/web/JsiSkFont.ts +11 -4
- package/src/skia/web/JsiSkImage.ts +4 -3
- package/src/skia/web/JsiSkImageFactory.ts +6 -3
- package/src/skia/web/JsiSkImageFilterFactory.ts +124 -52
- package/src/skia/web/JsiSkMatrix.ts +4 -2
- package/src/skia/web/JsiSkPaint.ts +15 -7
- package/src/skia/web/JsiSkPath.ts +16 -51
- package/src/skia/web/JsiSkPathEffectFactory.ts +10 -5
- package/src/skia/web/JsiSkPathFactory.ts +3 -3
- package/src/skia/web/JsiSkPicture.ts +5 -3
- package/src/skia/web/JsiSkPictureRecorder.ts +3 -2
- package/src/skia/web/JsiSkPoint.ts +12 -2
- package/src/skia/web/JsiSkRRect.ts +5 -2
- package/src/skia/web/JsiSkRSXform.ts +1 -1
- package/src/skia/web/JsiSkRect.ts +2 -2
- package/src/skia/web/JsiSkRuntimeEffect.ts +9 -4
- package/src/skia/web/JsiSkShaderFactory.ts +24 -15
- package/src/skia/web/JsiSkSurface.ts +7 -2
- package/src/skia/web/JsiSkTextBlobFactory.ts +14 -8
- package/src/skia/web/JsiSkTypefaceFactory.tsx +4 -2
- package/src/skia/web/JsiSkia.ts +17 -5
- package/src/views/SkiaView.tsx +17 -28
- package/src/views/types.ts +7 -6
@@ -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) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["JsiSkImageFilterFactory.ts"],"names":["Host","NotImplementedOnRNWeb","ckEnum","toValue","JsiSkImageFilter","JsiSkImageFilterFactory","constructor","CanvasKit","MakeOffset","_dx","_dy","_input","MakeDisplacementMap","_channelX","_channelY","_scale","_in1","MakeShader","_shader","MakeBlur","sigmaX","sigmaY","mode","input","ImageFilter","MakeColorFilter","cf","MakeCompose","outer","inner","MakeDropShadow","_sigmaX","_sigmaY","_color","_cropRect","MakeDropShadowOnly","MakeErode","_rx","_ry","MakeDilate","MakeBlend","_mode","_background","_foreground","MakeRuntimeShader","_builder","_childShaderName"],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IAAIzB,gBAAJ,CACL,KAAKG,SADA,EAEL,KAAKA,SAAL,CAAeiB,WAAf,CAA2BG,WAA3B,CACEC,KAAK,KAAK,IAAV,GAAiB,IAAjB,GAAwBzB,OAAO,CAACyB,KAAD,CADjC,EAEEC,KAAK,KAAK,IAAV,GAAiB,IAAjB,GAAwB1B,OAAO,CAAC0B,KAAD,CAFjC,CAFK,CAAP;AAOD;;AAEDC,EAAAA,cAAc,CACZrB,GADY,EAEZC,GAFY,EAGZqB,OAHY,EAIZC,OAJY,EAKZC,MALY,EAMZtB,MANY,EAOZuB,SAPY,EAQG;AACf,UAAM,IAAIjC,qBAAJ,EAAN;AACD;;AAEDkC,EAAAA,kBAAkB,CAChB1B,GADgB,EAEhBC,GAFgB,EAGhBqB,OAHgB,EAIhBC,OAJgB,EAKhBC,MALgB,EAMhBtB,MANgB,EAOhBuB,SAPgB,EAQD;AACf,UAAM,IAAIjC,qBAAJ,EAAN;AACD;;AAEDmC,EAAAA,SAAS,CACPC,GADO,EAEPC,GAFO,EAGP3B,MAHO,EAIPuB,SAJO,EAKQ;AACf,UAAM,IAAIjC,qBAAJ,EAAN;AACD;;AAEDsC,EAAAA,UAAU,CACRF,GADQ,EAERC,GAFQ,EAGR3B,MAHQ,EAIRuB,SAJQ,EAKO;AACf,UAAM,IAAIjC,qBAAJ,EAAN;AACD;;AAEDuC,EAAAA,SAAS,CACPC,KADO,EAEPC,WAFO,EAGPC,WAHO,EAIPT,SAJO,EAKQ;AACf,UAAM,IAAIjC,qBAAJ,EAAN;AACD;;AAED2C,EAAAA,iBAAiB,CACfC,QADe,EAEfC,gBAFe,EAGfnC,MAHe,EAIA;AACf,UAAM,IAAIV,qBAAJ,EAAN;AACD;;AAzHH","sourcesContent":["import type { CanvasKit } from \"canvaskit-wasm\";\n\nimport type {\n ColorChannel,\n ImageFilterFactory,\n SkColor,\n SkColorFilter,\n SkImageFilter,\n BlendMode,\n SkRect,\n SkRuntimeShaderBuilder,\n SkShader,\n TileMode,\n} from \"../types\";\n\nimport { Host, NotImplementedOnRNWeb, ckEnum, toValue } from \"./Host\";\nimport { JsiSkImageFilter } from \"./JsiSkImageFilter\";\n\nexport class JsiSkImageFilterFactory\n extends Host\n implements ImageFilterFactory\n{\n constructor(CanvasKit: CanvasKit) {\n super(CanvasKit);\n }\n\n MakeOffset(\n _dx: number,\n _dy: number,\n _input: SkImageFilter | null\n ): SkImageFilter {\n throw new NotImplementedOnRNWeb();\n }\n\n MakeDisplacementMap(\n _channelX: ColorChannel,\n _channelY: ColorChannel,\n _scale: number,\n _in1: SkImageFilter,\n _input: SkImageFilter | null\n ): SkImageFilter {\n throw new NotImplementedOnRNWeb();\n }\n\n MakeShader(_shader: SkShader, _input: SkImageFilter | null): SkImageFilter {\n throw new NotImplementedOnRNWeb();\n }\n\n MakeBlur(\n sigmaX: number,\n sigmaY: number,\n mode: TileMode,\n input: SkImageFilter | null\n ) {\n return new JsiSkImageFilter(\n this.CanvasKit,\n this.CanvasKit.ImageFilter.MakeBlur(\n sigmaX,\n sigmaY,\n ckEnum(mode),\n input === null ? null : toValue(input)\n )\n );\n }\n\n MakeColorFilter(cf: SkColorFilter, input: SkImageFilter | null) {\n return new JsiSkImageFilter(\n this.CanvasKit,\n this.CanvasKit.ImageFilter.MakeColorFilter(\n toValue(cf),\n input === null ? null : toValue(input)\n )\n );\n }\n\n MakeCompose(outer: SkImageFilter | null, inner: SkImageFilter | null) {\n return new JsiSkImageFilter(\n this.CanvasKit,\n this.CanvasKit.ImageFilter.MakeCompose(\n outer === null ? null : toValue(outer),\n inner === null ? null : toValue(inner)\n )\n );\n }\n\n MakeDropShadow(\n _dx: number,\n _dy: number,\n _sigmaX: number,\n _sigmaY: number,\n _color: SkColor,\n _input: SkImageFilter | null,\n _cropRect?: SkRect\n ): SkImageFilter {\n throw new NotImplementedOnRNWeb();\n }\n\n MakeDropShadowOnly(\n _dx: number,\n _dy: number,\n _sigmaX: number,\n _sigmaY: number,\n _color: SkColor,\n _input: SkImageFilter | null,\n _cropRect?: SkRect\n ): SkImageFilter {\n throw new NotImplementedOnRNWeb();\n }\n\n MakeErode(\n _rx: number,\n _ry: number,\n _input: SkImageFilter | null,\n _cropRect?: SkRect\n ): SkImageFilter {\n throw new NotImplementedOnRNWeb();\n }\n\n MakeDilate(\n _rx: number,\n _ry: number,\n _input: SkImageFilter | null,\n _cropRect?: SkRect\n ): SkImageFilter {\n throw new NotImplementedOnRNWeb();\n }\n\n MakeBlend(\n _mode: BlendMode,\n _background: SkImageFilter,\n _foreground: SkImageFilter | null,\n _cropRect?: SkRect\n ): SkImageFilter {\n throw new NotImplementedOnRNWeb();\n }\n\n MakeRuntimeShader(\n _builder: SkRuntimeShaderBuilder,\n _childShaderName: string | null,\n _input: SkImageFilter | null\n ): SkImageFilter {\n throw new NotImplementedOnRNWeb();\n }\n}\n"]}
|
1
|
+
{"version":3,"sources":["JsiSkImageFilterFactory.ts"],"names":["Host","NotImplementedOnRNWeb","ckEnum","JsiSkImageFilter","JsiSkColorFilter","JsiSkImageFilterFactory","constructor","CanvasKit","MakeOffset","dx","dy","input","inputFilter","fromValue","filter","ImageFilter","MakeDisplacementMap","channelX","channelY","scale","in1","MakeShader","shader","_input","MakeBlur","sigmaX","sigmaY","mode","MakeColorFilter","cf","MakeCompose","outer","inner","MakeDropShadow","color","cropRect","MakeDropShadowOnly","MakeErode","rx","ry","MakeDilate","MakeBlend","background","foreground","MakeRuntimeShader","_builder","_childShaderName"],"mappings":"AAeA,SAASA,IAAT,EAAeC,qBAAf,EAAsCC,MAAtC,QAAoD,QAApD;AACA,SAASC,gBAAT,QAAiC,oBAAjC;AACA,SAASC,gBAAT,QAAiC,oBAAjC;AAEA,OAAO,MAAMC,uBAAN,SACGL,IADH,CAGP;AACEM,EAAAA,WAAW,CAACC,SAAD,EAAuB;AAChC,UAAMA,SAAN;AACD;;AAEDC,EAAAA,UAAU,CAACC,EAAD,EAAaC,EAAb,EAAyBC,KAAzB,EAAsD;AAC9D,UAAMC,WAAW,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AIRwB,QAJQ,EAKO;AACf,UAAMvB,WAAW,GACfD,KAAK,KAAK,IAAV,GAAiB,IAAjB,GAAwBR,gBAAgB,CAACU,SAAjB,CAAwCF,KAAxC,CAD1B;;AAEA,QAAIwB,QAAJ,EAAc;AACZ,YAAM,IAAIlC,qBAAJ,CACJ,iEADI,CAAN;AAGD;;AACD,UAAMa,MAAM,GAAG,KAAKP,SAAL,CAAeQ,WAAf,CAA2ByB,UAA3B,CAAsCF,EAAtC,EAA0CC,EAA1C,EAA8C3B,WAA9C,CAAf;AACA,WAAO,IAAIT,gBAAJ,CAAqB,KAAKI,SAA1B,EAAqCO,MAArC,CAAP;AACD;;AAED2B,EAAAA,SAAS,CACPd,IADO,EAEPe,UAFO,EAGPC,UAHO,EAIPR,QAJO,EAKQ;AACf,UAAMvB,WAAW,GACf+B,UAAU,KAAK,IAAf,GACI,IADJ,GAEIxC,gBAAgB,CAACU,SAAjB,CAAwC8B,UAAxC,CAHN;;AAIA,QAAIR,QAAJ,EAAc;AACZ,YAAM,IAAIlC,qBAAJ,CACJ,iEADI,CAAN;AAGD;;AACD,UAAMa,MAAM,GAAG,KAAKP,SAAL,CAAeQ,WAAf,CAA2B0B,SAA3B,CACbvC,MAAM,CAACyB,IAAD,CADO,EAEbxB,gBAAgB,CAACU,SAAjB,CAA2B6B,UAA3B,CAFa,EAGb9B,WAHa,CAAf;AAKA,WAAO,IAAIT,gBAAJ,CAAqB,KAAKI,SAA1B,EAAqCO,MAArC,CAAP;AACD;;AAED8B,EAAAA,iBAAiB,CACfC,QADe,EAEfC,gBAFe,EAGfvB,MAHe,EAIA;AACf,UAAM,IAAItB,qBAAJ,EAAN;AACD;;AAhMH","sourcesContent":["import type { CanvasKit, ImageFilter } from \"canvaskit-wasm\";\n\nimport type {\n ColorChannel,\n ImageFilterFactory,\n SkColor,\n SkColorFilter,\n SkImageFilter,\n BlendMode,\n SkRect,\n SkRuntimeShaderBuilder,\n SkShader,\n TileMode,\n} from \"../types\";\n\nimport { Host, NotImplementedOnRNWeb, ckEnum } from \"./Host\";\nimport { JsiSkImageFilter } from \"./JsiSkImageFilter\";\nimport { JsiSkColorFilter } from \"./JsiSkColorFilter\";\n\nexport class JsiSkImageFilterFactory\n extends Host\n implements ImageFilterFactory\n{\n constructor(CanvasKit: CanvasKit) {\n super(CanvasKit);\n }\n\n MakeOffset(dx: number, dy: number, input: SkImageFilter | null) {\n const inputFilter =\n input === null ? null : JsiSkImageFilter.fromValue<ImageFilter>(input);\n const filter = this.CanvasKit.ImageFilter.MakeOffset(dx, dy, inputFilter);\n return new JsiSkImageFilter(this.CanvasKit, filter);\n }\n\n MakeDisplacementMap(\n channelX: ColorChannel,\n channelY: ColorChannel,\n scale: number,\n in1: SkImageFilter,\n input: SkImageFilter | null\n ): SkImageFilter {\n const inputFilter =\n input === null ? null : JsiSkImageFilter.fromValue<ImageFilter>(input);\n const filter = this.CanvasKit.ImageFilter.MakeDisplacementMap(\n ckEnum(channelX),\n ckEnum(channelY),\n scale,\n JsiSkImageFilter.fromValue(in1),\n inputFilter\n );\n return new JsiSkImageFilter(this.CanvasKit, filter);\n }\n\n MakeShader(shader: SkShader, _input: SkImageFilter | null): SkImageFilter {\n const filter = this.CanvasKit.ImageFilter.MakeShader(\n JsiSkImageFilter.fromValue(shader)\n );\n return new JsiSkImageFilter(this.CanvasKit, filter);\n }\n\n MakeBlur(\n sigmaX: number,\n sigmaY: number,\n mode: TileMode,\n input: SkImageFilter | null\n ) {\n return new JsiSkImageFilter(\n this.CanvasKit,\n this.CanvasKit.ImageFilter.MakeBlur(\n sigmaX,\n sigmaY,\n ckEnum(mode),\n input === null ? null : JsiSkImageFilter.fromValue(input)\n )\n );\n }\n\n MakeColorFilter(cf: SkColorFilter, input: SkImageFilter | null) {\n return new JsiSkImageFilter(\n this.CanvasKit,\n this.CanvasKit.ImageFilter.MakeColorFilter(\n JsiSkColorFilter.fromValue(cf),\n input === null ? null : JsiSkImageFilter.fromValue(input)\n )\n );\n }\n\n MakeCompose(outer: SkImageFilter | null, inner: SkImageFilter | null) {\n return new JsiSkImageFilter(\n this.CanvasKit,\n this.CanvasKit.ImageFilter.MakeCompose(\n outer === null ? null : JsiSkImageFilter.fromValue(outer),\n inner === null ? null : JsiSkImageFilter.fromValue(inner)\n )\n );\n }\n\n MakeDropShadow(\n dx: number,\n dy: number,\n sigmaX: number,\n sigmaY: number,\n color: SkColor,\n input: SkImageFilter | null,\n cropRect?: SkRect\n ): SkImageFilter {\n const inputFilter =\n input === null ? null : JsiSkImageFilter.fromValue<ImageFilter>(input);\n if (cropRect) {\n throw new NotImplementedOnRNWeb(\n \"The cropRect argument is not yet supported on React Native Web.\"\n );\n }\n const filter = this.CanvasKit.ImageFilter.MakeDropShadow(\n dx,\n dy,\n sigmaX,\n sigmaY,\n color,\n inputFilter\n );\n return new JsiSkImageFilter(this.CanvasKit, filter);\n }\n\n MakeDropShadowOnly(\n dx: number,\n dy: number,\n sigmaX: number,\n sigmaY: number,\n color: SkColor,\n input: SkImageFilter | null,\n cropRect?: SkRect\n ): SkImageFilter {\n const inputFilter =\n input === null ? null : JsiSkImageFilter.fromValue<ImageFilter>(input);\n if (cropRect) {\n throw new NotImplementedOnRNWeb(\n \"The cropRect argument is not yet supported on React Native Web.\"\n );\n }\n const filter = this.CanvasKit.ImageFilter.MakeDropShadowOnly(\n dx,\n dy,\n sigmaX,\n sigmaY,\n color,\n inputFilter\n );\n return new JsiSkImageFilter(this.CanvasKit, filter);\n }\n\n MakeErode(\n rx: number,\n ry: number,\n input: SkImageFilter | null,\n cropRect?: SkRect\n ): SkImageFilter {\n const inputFilter =\n input === null ? null : JsiSkImageFilter.fromValue<ImageFilter>(input);\n if (cropRect) {\n throw new NotImplementedOnRNWeb(\n \"The cropRect argument is not yet supported on React Native Web.\"\n );\n }\n const filter = this.CanvasKit.ImageFilter.MakeErode(rx, ry, inputFilter);\n return new JsiSkImageFilter(this.CanvasKit, filter);\n }\n\n MakeDilate(\n rx: number,\n ry: number,\n input: SkImageFilter | null,\n cropRect?: SkRect\n ): SkImageFilter {\n const inputFilter =\n input === null ? null : JsiSkImageFilter.fromValue<ImageFilter>(input);\n if (cropRect) {\n throw new NotImplementedOnRNWeb(\n \"The cropRect argument is not yet supported on React Native Web.\"\n );\n }\n const filter = this.CanvasKit.ImageFilter.MakeDilate(rx, ry, inputFilter);\n return new JsiSkImageFilter(this.CanvasKit, filter);\n }\n\n MakeBlend(\n mode: BlendMode,\n background: SkImageFilter,\n foreground: SkImageFilter | null,\n cropRect?: SkRect\n ): SkImageFilter {\n const inputFilter =\n foreground === null\n ? null\n : JsiSkImageFilter.fromValue<ImageFilter>(foreground);\n if (cropRect) {\n throw new NotImplementedOnRNWeb(\n \"The cropRect argument is not yet supported on React Native Web.\"\n );\n }\n const filter = this.CanvasKit.ImageFilter.MakeBlend(\n ckEnum(mode),\n JsiSkImageFilter.fromValue(background),\n inputFilter\n );\n return new JsiSkImageFilter(this.CanvasKit, filter);\n }\n\n MakeRuntimeShader(\n _builder: SkRuntimeShaderBuilder,\n _childShaderName: string | null,\n _input: SkImageFilter | null\n ): SkImageFilter {\n throw new NotImplementedOnRNWeb();\n }\n}\n"]}
|
@@ -1,11 +1,11 @@
|
|
1
|
-
import { HostObject
|
1
|
+
import { HostObject } from "./Host";
|
2
2
|
export class JsiSkMatrix extends HostObject {
|
3
3
|
constructor(CanvasKit, ref) {
|
4
4
|
super(CanvasKit, ref, "Matrix");
|
5
5
|
}
|
6
6
|
|
7
7
|
concat(matrix) {
|
8
|
-
this.ref.set(this.CanvasKit.Matrix.multiply(this.ref,
|
8
|
+
this.ref.set(this.CanvasKit.Matrix.multiply(this.ref, JsiSkMatrix.fromValue(matrix)));
|
9
9
|
}
|
10
10
|
|
11
11
|
translate(x, y) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["JsiSkMatrix.ts"],"names":["HostObject","
|
1
|
+
{"version":3,"sources":["JsiSkMatrix.ts"],"names":["HostObject","JsiSkMatrix","constructor","CanvasKit","ref","concat","matrix","set","Matrix","multiply","fromValue","translate","x","y","Float32Array","of","translated","scale","scaled","skew","skewed","rotate","value","rotated","identity"],"mappings":"AAIA,SAASA,UAAT,QAA2B,QAA3B;AAEA,OAAO,MAAMC,WAAN,SACGD,UADH,CAGP;AACEE,EAAAA,WAAW,CAACC,SAAD,EAAuBC,GAAvB,EAAuC;AAChD,UAAMD,SAAN,EAAiBC,GAAjB,EAAsB,QAAtB;AACD;;AAEDC,EAAAA,MAAM,CAACC,MAAD,EAAmB;AACvB,SAAKF,GAAL,CAASG,GAAT,CACE,KAAKJ,SAAL,CAAeK,MAAf,CAAsBC,QAAtB,CAA+B,KAAKL,GAApC,EAAyCH,WAAW,CAACS,SAAZ,CAAsBJ,MAAtB,CAAzC,CADF;AAGD;;AAEDK,EAAAA,SAAS,CAACC,CAAD,EAAYC,CAAZ,EAAuB;AAC9B,SAAKR,MAAL,CACE,IAAIJ,WAAJ,CACE,KAAKE,SADP,EAEEW,YAAY,CAACC,EAAb,CAAgB,GAAG,KAAKZ,SAAL,CAAeK,MAAf,CAAsBQ,UAAtB,CAAiCJ,CAAjC,EAAoCC,CAApC,CAAnB,CAFF,CADF;AAMD;;AAEDI,EAAAA,KAAK,CAACL,CAAD,EAAYC,CAAZ,EAAwB;AAC3B,SAAKR,MAAL,CACE,IAAIJ,WAAJ,CACE,KAAKE,SADP,EAEEW,YAAY,CAACC,EAAb,CAAgB,GAAG,KAAKZ,SAAL,CAAeK,MAAf,CAAsBU,MAAtB,CAA6BN,CAA7B,EAAgCC,CAAhC,aAAgCA,CAAhC,cAAgCA,CAAhC,GAAqCD,CAArC,CAAnB,CAFF,CADF;AAMD;;AAEDO,EAAAA,IAAI,CAACP,CAAD,EAAYC,CAAZ,EAAuB;AACzB,SAAKR,MAAL,CACE,IAAIJ,WAAJ,CACE,KAAKE,SADP,EAEEW,YAAY,CAACC,EAAb,CAAgB,GAAG,KAAKZ,SAAL,CAAeK,MAAf,CAAsBY,MAAtB,CAA6BR,CAA7B,EAAgCC,CAAhC,CAAnB,CAFF,CADF;AAMD;;AAEDQ,EAAAA,MAAM,CAACC,KAAD,EAAgB;AACpB,SAAKjB,MAAL,CACE,IAAIJ,WAAJ,CACE,KAAKE,SADP,EAEEW,YAAY,CAACC,EAAb,CAAgB,GAAG,KAAKZ,SAAL,CAAeK,MAAf,CAAsBe,OAAtB,CAA8BD,KAA9B,CAAnB,CAFF,CADF;AAMD;;AAEDE,EAAAA,QAAQ,GAAG;AACT,SAAKpB,GAAL,CAASG,GAAT,CAAa,KAAKJ,SAAL,CAAeK,MAAf,CAAsBgB,QAAtB,EAAb;AACD;;AAjDH","sourcesContent":["import type { CanvasKit, Matrix3x3 } from \"canvaskit-wasm\";\n\nimport type { SkMatrix } from \"../types\";\n\nimport { HostObject } from \"./Host\";\n\nexport class JsiSkMatrix\n extends HostObject<Matrix3x3, \"Matrix\">\n implements SkMatrix\n{\n constructor(CanvasKit: CanvasKit, ref: Matrix3x3) {\n super(CanvasKit, ref, \"Matrix\");\n }\n\n concat(matrix: SkMatrix) {\n this.ref.set(\n this.CanvasKit.Matrix.multiply(this.ref, JsiSkMatrix.fromValue(matrix))\n );\n }\n\n translate(x: number, y: number) {\n this.concat(\n new JsiSkMatrix(\n this.CanvasKit,\n Float32Array.of(...this.CanvasKit.Matrix.translated(x, y))\n )\n );\n }\n\n scale(x: number, y?: number) {\n this.concat(\n new JsiSkMatrix(\n this.CanvasKit,\n Float32Array.of(...this.CanvasKit.Matrix.scaled(x, y ?? x))\n )\n );\n }\n\n skew(x: number, y: number) {\n this.concat(\n new JsiSkMatrix(\n this.CanvasKit,\n Float32Array.of(...this.CanvasKit.Matrix.skewed(x, y))\n )\n );\n }\n\n rotate(value: number) {\n this.concat(\n new JsiSkMatrix(\n this.CanvasKit,\n Float32Array.of(...this.CanvasKit.Matrix.rotated(value))\n )\n );\n }\n\n identity() {\n this.ref.set(this.CanvasKit.Matrix.identity());\n }\n}\n"]}
|
@@ -1,7 +1,11 @@
|
|
1
|
-
import { HostObject,
|
1
|
+
import { HostObject, ckEnum } from "./Host";
|
2
|
+
import { JsiSkColorFilter } from "./JsiSkColorFilter";
|
3
|
+
import { JsiSkImageFilter } from "./JsiSkImageFilter";
|
4
|
+
import { JsiSkMaskFilter } from "./JsiSkMaskFilter";
|
5
|
+
import { JsiSkPathEffect } from "./JsiSkPathEffect";
|
6
|
+
import { JsiSkShader } from "./JsiSkShader";
|
2
7
|
export class JsiSkPaint extends HostObject {
|
3
8
|
constructor(CanvasKit, ref) {
|
4
|
-
ref.setAntiAlias(true);
|
5
9
|
super(CanvasKit, ref, "Paint");
|
6
10
|
}
|
7
11
|
|
@@ -9,6 +13,10 @@ export class JsiSkPaint extends HostObject {
|
|
9
13
|
return new JsiSkPaint(this.CanvasKit, this.ref.copy());
|
10
14
|
}
|
11
15
|
|
16
|
+
reset() {
|
17
|
+
this.ref = new this.CanvasKit.Paint();
|
18
|
+
}
|
19
|
+
|
12
20
|
getColor() {
|
13
21
|
return this.ref.getColor();
|
14
22
|
}
|
@@ -46,23 +54,23 @@ export class JsiSkPaint extends HostObject {
|
|
46
54
|
}
|
47
55
|
|
48
56
|
setColorFilter(filter) {
|
49
|
-
this.ref.setColorFilter(
|
57
|
+
this.ref.setColorFilter(filter ? JsiSkColorFilter.fromValue(filter) : null);
|
50
58
|
}
|
51
59
|
|
52
60
|
setImageFilter(filter) {
|
53
|
-
this.ref.setImageFilter(
|
61
|
+
this.ref.setImageFilter(filter ? JsiSkImageFilter.fromValue(filter) : null);
|
54
62
|
}
|
55
63
|
|
56
64
|
setMaskFilter(filter) {
|
57
|
-
this.ref.setMaskFilter(
|
65
|
+
this.ref.setMaskFilter(filter ? JsiSkMaskFilter.fromValue(filter) : null);
|
58
66
|
}
|
59
67
|
|
60
68
|
setPathEffect(effect) {
|
61
|
-
this.ref.setPathEffect(
|
69
|
+
this.ref.setPathEffect(effect ? JsiSkPathEffect.fromValue(effect) : null);
|
62
70
|
}
|
63
71
|
|
64
72
|
setShader(shader) {
|
65
|
-
this.ref.setShader(
|
73
|
+
this.ref.setShader(shader ? JsiSkShader.fromValue(shader) : null);
|
66
74
|
}
|
67
75
|
|
68
76
|
setStrokeCap(cap) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["JsiSkPaint.ts"],"names":["HostObject","
|
1
|
+
{"version":3,"sources":["JsiSkPaint.ts"],"names":["HostObject","ckEnum","JsiSkColorFilter","JsiSkImageFilter","JsiSkMaskFilter","JsiSkPathEffect","JsiSkShader","JsiSkPaint","constructor","CanvasKit","ref","copy","reset","Paint","getColor","getStrokeCap","value","getStrokeJoin","getStrokeMiter","getStrokeWidth","setAlphaf","alpha","setAntiAlias","aa","setBlendMode","blendMode","setColor","color","setColorFilter","filter","fromValue","setImageFilter","setMaskFilter","setPathEffect","effect","setShader","shader","setStrokeCap","cap","setStrokeJoin","join","setStrokeMiter","limit","setStrokeWidth","width","setStyle","style"],"mappings":"AAgBA,SAASA,UAAT,EAAqBC,MAArB,QAAmC,QAAnC;AACA,SAASC,gBAAT,QAAiC,oBAAjC;AACA,SAASC,gBAAT,QAAiC,oBAAjC;AACA,SAASC,eAAT,QAAgC,mBAAhC;AACA,SAASC,eAAT,QAAgC,mBAAhC;AACA,SAASC,WAAT,QAA4B,eAA5B;AAEA,OAAO,MAAMC,UAAN,SAAyBP,UAAzB,CAAuE;AAC5EQ,EAAAA,WAAW,CAACC,SAAD,EAAuBC,GAAvB,EAAmC;AAC5C,UAAMD,SAAN,EAAiBC,GAAjB,EAAsB,OAAtB;AACD;;AAEDC,EAAAA,IAAI,GAAG;AACL,WAAO,IAAIJ,UAAJ,CAAe,KAAKE,SAApB,EAA+B,KAAKC,GAAL,CAASC,IAAT,EAA/B,CAAP;AACD;;AAEDC,EAAAA,KAAK,GAAG;AACN,SAAKF,GAAL,GAAW,IAAI,KAAKD,SAAL,CAAeI,KAAnB,EAAX;AACD;;AAEDC,EAAAA,QAAQ,GAAG;AACT,WAAO,KAAKJ,GAAL,CAASI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aAAa,CAACC,MAAD,EAA8B;AACzC,SAAKxB,GAAL,CAASuB,aAAT,CAAuBC,MAAM,GAAG7B,eAAe,CAACyB,SAAhB,CAA0BI,MAA1B,CAAH,GAAuC,IAApE;AACD;;AAEDC,EAAAA,SAAS,CAACC,MAAD,EAA0B;AACjC,SAAK1B,GAAL,CAASyB,SAAT,CAAmBC,MAAM,GAAG9B,WAAW,CAACwB,SAAZ,CAAsBM,MAAtB,CAAH,GAAmC,IAA5D;AACD;;AAEDC,EAAAA,YAAY,CAACC,GAAD,EAAiB;AAC3B,SAAK5B,GAAL,CAAS2B,YAAT,CAAsBpC,MAAM,CAACqC,GAAD,CAA5B;AACD;;AAEDC,EAAAA,aAAa,CAACC,IAAD,EAAmB;AAC9B,SAAK9B,GAAL,CAAS6B,aAAT,CAAuBtC,MAAM,CAACuC,IAAD,CAA7B;AACD;;AAEDC,EAAAA,cAAc,CAACC,KAAD,EAAgB;AAC5B,SAAKhC,GAAL,CAAS+B,cAAT,CAAwBC,KAAxB;AACD;;AAEDC,EAAAA,cAAc,CAACC,KAAD,EAAgB;AAC5B,SAAKlC,GAAL,CAASiC,cAAT,CAAwBC,KAAxB;AACD;;AAEDC,EAAAA,QAAQ,CAACC,KAAD,EAAoB;AAC1B,SAAKpC,GAAL,CAASmC,QAAT,CAAkB;AAAE7B,MAAAA,KAAK,EAAE8B;AAAT,KAAlB;AACD;;AAvF2E","sourcesContent":["import type { CanvasKit, Paint } from \"canvaskit-wasm\";\n\nimport type {\n StrokeJoin,\n BlendMode,\n SkColor,\n SkColorFilter,\n SkImageFilter,\n SkPaint,\n SkShader,\n StrokeCap,\n PaintStyle,\n SkMaskFilter,\n SkPathEffect,\n} from \"../types\";\n\nimport { HostObject, ckEnum } from \"./Host\";\nimport { JsiSkColorFilter } from \"./JsiSkColorFilter\";\nimport { JsiSkImageFilter } from \"./JsiSkImageFilter\";\nimport { JsiSkMaskFilter } from \"./JsiSkMaskFilter\";\nimport { JsiSkPathEffect } from \"./JsiSkPathEffect\";\nimport { JsiSkShader } from \"./JsiSkShader\";\n\nexport class JsiSkPaint extends HostObject<Paint, \"Paint\"> implements SkPaint {\n constructor(CanvasKit: CanvasKit, ref: Paint) {\n super(CanvasKit, ref, \"Paint\");\n }\n\n copy() {\n return new JsiSkPaint(this.CanvasKit, this.ref.copy());\n }\n\n reset() {\n this.ref = new this.CanvasKit.Paint();\n }\n\n getColor() {\n return this.ref.getColor();\n }\n\n getStrokeCap() {\n return this.ref.getStrokeCap().value;\n }\n\n getStrokeJoin() {\n return this.ref.getStrokeJoin().value;\n }\n\n getStrokeMiter() {\n return this.ref.getStrokeMiter();\n }\n\n getStrokeWidth() {\n return this.ref.getStrokeWidth();\n }\n\n setAlphaf(alpha: number) {\n this.ref.setAlphaf(alpha);\n }\n\n setAntiAlias(aa: boolean) {\n this.ref.setAntiAlias(aa);\n }\n\n setBlendMode(blendMode: BlendMode) {\n this.ref.setBlendMode(ckEnum(blendMode));\n }\n\n setColor(color: SkColor) {\n this.ref.setColor(color);\n }\n\n setColorFilter(filter: SkColorFilter | null) {\n this.ref.setColorFilter(filter ? JsiSkColorFilter.fromValue(filter) : null);\n }\n\n setImageFilter(filter: SkImageFilter | null) {\n this.ref.setImageFilter(filter ? JsiSkImageFilter.fromValue(filter) : null);\n }\n\n setMaskFilter(filter: SkMaskFilter | null) {\n this.ref.setMaskFilter(filter ? JsiSkMaskFilter.fromValue(filter) : null);\n }\n\n setPathEffect(effect: SkPathEffect | null) {\n this.ref.setPathEffect(effect ? JsiSkPathEffect.fromValue(effect) : null);\n }\n\n setShader(shader: SkShader | null) {\n this.ref.setShader(shader ? JsiSkShader.fromValue(shader) : null);\n }\n\n setStrokeCap(cap: StrokeCap) {\n this.ref.setStrokeCap(ckEnum(cap));\n }\n\n setStrokeJoin(join: StrokeJoin) {\n this.ref.setStrokeJoin(ckEnum(join));\n }\n\n setStrokeMiter(limit: number) {\n this.ref.setStrokeMiter(limit);\n }\n\n setStrokeWidth(width: number) {\n this.ref.setStrokeWidth(width);\n }\n\n setStyle(style: PaintStyle) {\n this.ref.setStyle({ value: style });\n }\n}\n"]}
|
@@ -1,8 +1,9 @@
|
|
1
1
|
import { PathVerb } from "../types";
|
2
|
-
import { ckEnum, HostObject, optEnum
|
2
|
+
import { ckEnum, HostObject, optEnum } from "./Host";
|
3
3
|
import { JsiSkPoint } from "./JsiSkPoint";
|
4
4
|
import { JsiSkRect } from "./JsiSkRect";
|
5
5
|
import { JsiSkRRect } from "./JsiSkRRect";
|
6
|
+
import { JsiSkMatrix } from "./JsiSkMatrix";
|
6
7
|
const CommandCount = {
|
7
8
|
[PathVerb.Move]: 3,
|
8
9
|
[PathVerb.Line]: 3,
|
@@ -11,23 +12,6 @@ const CommandCount = {
|
|
11
12
|
[PathVerb.Cubic]: 7,
|
12
13
|
[PathVerb.Close]: 1
|
13
14
|
};
|
14
|
-
|
15
|
-
const areCmdsInterpolatable = (cmd1, cmd2) => {
|
16
|
-
if (cmd1.length !== cmd2.length) {
|
17
|
-
return false;
|
18
|
-
}
|
19
|
-
|
20
|
-
for (let i = 0; i < cmd1.length; i++) {
|
21
|
-
if (cmd1[i][0] !== cmd2[i][0]) {
|
22
|
-
return false;
|
23
|
-
} else if (cmd1[i][0] === PathVerb.Conic && cmd1[i][5] !== cmd2[i][5]) {
|
24
|
-
return false;
|
25
|
-
}
|
26
|
-
}
|
27
|
-
|
28
|
-
return true;
|
29
|
-
};
|
30
|
-
|
31
15
|
export class JsiSkPath extends HostObject {
|
32
16
|
constructor(CanvasKit, ref) {
|
33
17
|
super(CanvasKit, ref, "Path");
|
@@ -48,7 +32,7 @@ export class JsiSkPath extends HostObject {
|
|
48
32
|
}
|
49
33
|
|
50
34
|
addPoly(points, close) {
|
51
|
-
this.ref.addPoly(points.map(p =>
|
35
|
+
this.ref.addPoly(points.map(p => Array.from(JsiSkPoint.fromValue(p))).flat(), close);
|
52
36
|
return this;
|
53
37
|
}
|
54
38
|
|
@@ -176,7 +160,7 @@ export class JsiSkPath extends HostObject {
|
|
176
160
|
}
|
177
161
|
|
178
162
|
equals(other) {
|
179
|
-
return this.ref.equals(
|
163
|
+
return this.ref.equals(JsiSkPath.fromValue(other));
|
180
164
|
}
|
181
165
|
|
182
166
|
getBounds() {
|
@@ -213,9 +197,7 @@ export class JsiSkPath extends HostObject {
|
|
213
197
|
}
|
214
198
|
|
215
199
|
addCircle(x, y, r) {
|
216
|
-
|
217
|
-
// throw new NotImplementedOnRNWeb();
|
218
|
-
this.ref.addOval(this.CanvasKit.LTRBRect(x - r, y - r, x + r, y + r));
|
200
|
+
this.ref.addCircle(x, y, r);
|
219
201
|
return this;
|
220
202
|
}
|
221
203
|
|
@@ -224,7 +206,7 @@ export class JsiSkPath extends HostObject {
|
|
224
206
|
}
|
225
207
|
|
226
208
|
op(path, op) {
|
227
|
-
return this.ref.op(
|
209
|
+
return this.ref.op(JsiSkPath.fromValue(path), ckEnum(op));
|
228
210
|
}
|
229
211
|
|
230
212
|
simplify() {
|
@@ -241,37 +223,11 @@ export class JsiSkPath extends HostObject {
|
|
241
223
|
}
|
242
224
|
|
243
225
|
transform(m3) {
|
244
|
-
this.ref.transform(
|
226
|
+
this.ref.transform(JsiSkMatrix.fromValue(m3));
|
245
227
|
}
|
246
228
|
|
247
229
|
interpolate(end, t) {
|
248
|
-
|
249
|
-
// throw new NotImplementedOnRNWeb();
|
250
|
-
const cmd1 = this.toCmds();
|
251
|
-
const cmd2 = end.toCmds();
|
252
|
-
|
253
|
-
if (!areCmdsInterpolatable(cmd1, cmd2)) {
|
254
|
-
return null;
|
255
|
-
}
|
256
|
-
|
257
|
-
const interpolated = [];
|
258
|
-
cmd1.forEach((cmd, i) => {
|
259
|
-
const interpolatedCmd = [cmd[0]];
|
260
|
-
interpolated.push(interpolatedCmd);
|
261
|
-
cmd.forEach((c, j) => {
|
262
|
-
if (j === 0) {
|
263
|
-
return;
|
264
|
-
}
|
265
|
-
|
266
|
-
if (interpolatedCmd[0] === PathVerb.Conic && j === 5) {
|
267
|
-
interpolatedCmd.push(c);
|
268
|
-
} else {
|
269
|
-
const c2 = cmd2[i][j];
|
270
|
-
interpolatedCmd.push(c2 + (c - c2) * t);
|
271
|
-
}
|
272
|
-
});
|
273
|
-
});
|
274
|
-
const path = this.CanvasKit.Path.MakeFromCmds(interpolated.flat());
|
230
|
+
const path = this.CanvasKit.Path.MakeFromPathInterpolation(this.ref, JsiSkPath.fromValue(end), t);
|
275
231
|
|
276
232
|
if (path === null) {
|
277
233
|
return null;
|
@@ -281,11 +237,7 @@ export class JsiSkPath extends HostObject {
|
|
281
237
|
}
|
282
238
|
|
283
239
|
isInterpolatable(path2) {
|
284
|
-
|
285
|
-
// throw new NotImplementedOnRNWeb();
|
286
|
-
const cmd1 = this.toCmds();
|
287
|
-
const cmd2 = path2.toCmds();
|
288
|
-
return areCmdsInterpolatable(cmd1, cmd2);
|
240
|
+
return this.CanvasKit.Path.CanInterpolate(this.ref, JsiSkPath.fromValue(path2));
|
289
241
|
}
|
290
242
|
|
291
243
|
toCmds() {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["JsiSkPath.ts"],"names":["PathVerb","ckEnum","HostObject","optEnum","toValue","JsiSkPoint","JsiSkRect","JsiSkRRect","CommandCount","Move","Line","Quad","Conic","Cubic","Close","areCmdsInterpolatable","cmd1","cmd2","length","i","JsiSkPath","constructor","CanvasKit","ref","addArc","oval","startAngleInDegrees","sweepAngleInDegrees","fromValue","addOval","isCCW","startIndex","countPoints","addPoly","points","close","map","p","moveTo","x","y","lineTo","makeAsWinding","result","offset","dx","dy","rArcTo","rx","ry","xAxisRotateInDegrees","useSmallArc","rConicTo","dx1","dy1","dx2","dy2","w","rCubicTo","cpx1","cpy1","cpx2","cpy2","rMoveTo","rLineTo","rQuadTo","x1","y1","x2","y2","setFillType","fill","setIsVolatile","volatile","stroke","opts","undefined","width","miter_limit","precision","join","cap","reset","rewind","computeTightBounds","arcToOval","forceMoveTo","arcToRotated","arcToTangent","radius","conicTo","contains","copy","cubicTo","dash","on","off","phase","equals","other","getBounds","getFillType","value","quadTo","addRect","rect","addRRect","rrect","getPoint","index","isEmpty","isVolatile","addCircle","r","LTRBRect","getLastPt","op","path","simplify","toSVGString","trim","startT","stopT","isComplement","transform","m3","interpolate","end","t","toCmds","interpolated","forEach","cmd","interpolatedCmd","push","c","j","c2","Path","MakeFromCmds","flat","isInterpolatable","path2","cmds","reduce","acc","current"],"mappings":"AAEA,SAASA,QAAT,QAAyB,UAAzB;AAaA,SAASC,MAAT,EAAiBC,UAAjB,EAA6BC,OAA7B,EAAsCC,OAAtC,QAAqD,QAArD;AACA,SAASC,UAAT,QAA2B,cAA3B;AACA,SAASC,SAAT,QAA0B,aAA1B;AACA,SAASC,UAAT,QAA2B,cAA3B;AAEA,MAAMC,YAAY,GAAG;AACnB,GAACR,QAAQ,CAACS,IAAV,GAAiB,CADE;AAEnB,GAACT,QAAQ,CAACU,IAAV,GAAiB,CAFE;AAGnB,GAACV,QAAQ,CAACW,IAAV,GAAiB,CAHE;AAInB,GAACX,QAAQ,CAACY,KAAV,GAAkB,CAJC;AAKnB,GAACZ,QAAQ,CAACa,KAAV,GAAkB,CALC;AAMnB,GAACb,QAAQ,CAACc,KAAV,GAAkB;AANC,CAArB;;AASA,MAAMC,qBAAqB,GAAG,CAACC,IAAD,EAAsBC,IAAtB,KAA8C;AAC1E,MAAID,IAAI,CAACE,MAAL,KAAgBD,IAAI,CAACC,MAAzB,EAAiC;AAC/B,WAAO,KAAP;AACD;;AACD,OAAK,IAAIC,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGH,IAAI,CAACE,MAAzB,EAAiCC,CAAC,EAAlC,EAAsC;AACpC,QAAIH,IAAI,CAACG,CAAD,CAAJ,CAAQ,CAAR,MAAeF,IAAI,CAACE,CAAD,CAAJ,CAAQ,CAAR,CAAnB,EAA+B;AAC7B,aAAO,KAAP;AACD,KAFD,MAEO,IAAIH,IAAI,CAACG,CAAD,CAAJ,CAAQ,CAAR,MAAenB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,CAACZ,IAAR,CAAaF,GAAb;AACA,cAAMlH,MAAM,GAAGV,YAAY,CAAC0I,OAAO,CAAC,CAAD,CAAR,CAA3B;;AACA,YAAIA,OAAO,CAAChI,MAAR,KAAmBA,MAAnB,IAA6BC,CAAC,KAAK4H,IAAI,CAAC7H,MAAL,GAAc,CAArD,EAAwD;AACtD+H,UAAAA,GAAG,CAACX,IAAJ,CAAS,EAAT;AACD;AACF,OAND,MAMO;AACL,cAAMpH,MAAM,GAAGV,YAAY,CAAC0I,OAAO,CAAC,CAAD,CAAR,CAA3B;;AACA,YAAIA,OAAO,CAAChI,MAAR,GAAiBA,MAArB,EAA6B;AAC3BgI,UAAAA,OAAO,CAACZ,IAAR,CAAaF,GAAb;AACD;;AACD,YAAIc,OAAO,CAAChI,MAAR,KAAmBA,MAAnB,IAA6BC,CAAC,KAAK4H,IAAI,CAAC7H,MAAL,GAAc,CAArD,EAAwD;AACtD+H,UAAAA,GAAG,CAACX,IAAJ,CAAS,EAAT;AACD;AACF;;AACD,aAAOW,GAAP;AACD,KArBc,EAqBZ,EArBY,CAAf;AAsBA,WAAOtG,MAAP;AACD;;AA9VuE","sourcesContent":["import type { CanvasKit, Path } from \"canvaskit-wasm\";\n\nimport { PathVerb } from \"../types\";\nimport type {\n FillType,\n PathCommand,\n PathOp,\n SkMatrix,\n SkPath,\n SkPoint,\n SkRect,\n SkRRect,\n StrokeOpts,\n} from \"../types\";\n\nimport { ckEnum, HostObject, optEnum, toValue } from \"./Host\";\nimport { JsiSkPoint } from \"./JsiSkPoint\";\nimport { JsiSkRect } from \"./JsiSkRect\";\nimport { JsiSkRRect } from \"./JsiSkRRect\";\n\nconst CommandCount = {\n [PathVerb.Move]: 3,\n [PathVerb.Line]: 3,\n [PathVerb.Quad]: 5,\n [PathVerb.Conic]: 6,\n [PathVerb.Cubic]: 7,\n [PathVerb.Close]: 1,\n};\n\nconst areCmdsInterpolatable = (cmd1: PathCommand[], cmd2: PathCommand[]) => {\n if (cmd1.length !== cmd2.length) {\n return false;\n }\n for (let i = 0; i < cmd1.length; i++) {\n if (cmd1[i][0] !== cmd2[i][0]) {\n return false;\n } else if (cmd1[i][0] === PathVerb.Conic && cmd1[i][5] !== cmd2[i][5]) {\n return false;\n }\n }\n return true;\n};\n\nexport class JsiSkPath extends HostObject<Path, \"Path\"> implements SkPath {\n constructor(CanvasKit: CanvasKit, ref: Path) {\n super(CanvasKit, ref, \"Path\");\n }\n\n addArc(\n oval: SkRect,\n startAngleInDegrees: number,\n sweepAngleInDegrees: number\n ) {\n this.ref.addArc(\n JsiSkRect.fromValue(this.CanvasKit, oval),\n startAngleInDegrees,\n sweepAngleInDegrees\n );\n return this;\n }\n\n addOval(oval: SkRect, isCCW?: boolean, startIndex?: number) {\n this.ref.addOval(\n JsiSkRect.fromValue(this.CanvasKit, oval),\n isCCW,\n startIndex\n );\n return this;\n }\n\n countPoints() {\n return this.ref.countPoints();\n }\n\n addPoly(points: SkPoint[], close: boolean) {\n this.ref.addPoly(\n points.map((p) => toValue(p)),\n close\n );\n return this;\n }\n\n moveTo(x: number, y: number) {\n this.ref.moveTo(x, y);\n return this;\n }\n\n lineTo(x: number, y: number) {\n this.ref.lineTo(x, y);\n return this;\n }\n\n makeAsWinding() {\n const result = this.ref.makeAsWinding();\n return result === null ? result : this;\n }\n\n offset(dx: number, dy: number) {\n this.ref.offset(dx, dy);\n return this;\n }\n\n rArcTo(\n rx: number,\n ry: number,\n xAxisRotateInDegrees: number,\n useSmallArc: boolean,\n isCCW: boolean,\n dx: number,\n dy: number\n ) {\n this.ref.rArcTo(rx, ry, xAxisRotateInDegrees, useSmallArc, isCCW, dx, dy);\n return this;\n }\n\n rConicTo(dx1: number, dy1: number, dx2: number, dy2: number, w: number) {\n this.ref.rConicTo(dx1, dy1, dx2, dy2, w);\n return this;\n }\n\n rCubicTo(\n cpx1: number,\n cpy1: number,\n cpx2: number,\n cpy2: number,\n x: number,\n y: number\n ) {\n this.ref.rCubicTo(cpx1, cpy1, cpx2, cpy2, x, y);\n return this;\n }\n\n rMoveTo(x: number, y: number) {\n this.ref.rMoveTo(x, y);\n return this;\n }\n\n rLineTo(x: number, y: number) {\n this.ref.rLineTo(x, y);\n return this;\n }\n\n rQuadTo(x1: number, y1: number, x2: number, y2: number) {\n this.ref.rQuadTo(x1, y1, x2, y2);\n return this;\n }\n\n setFillType(fill: FillType) {\n this.ref.setFillType(ckEnum(fill));\n }\n\n setIsVolatile(volatile: boolean) {\n this.ref.setIsVolatile(volatile);\n }\n\n stroke(opts?: StrokeOpts) {\n const result = this.ref.stroke(\n opts === undefined\n ? undefined\n : {\n width: opts.width,\n // eslint-disable-next-line camelcase\n miter_limit: opts.width,\n precision: opts.width,\n join: optEnum(opts.join),\n cap: optEnum(opts.cap),\n }\n );\n return result === null ? result : this;\n }\n\n close() {\n this.ref.close();\n }\n\n reset() {\n this.ref.reset();\n }\n\n rewind() {\n this.ref.rewind();\n }\n\n computeTightBounds(): SkRect {\n return new JsiSkRect(this.CanvasKit, this.ref.computeTightBounds());\n }\n\n arcToOval(\n oval: SkRect,\n startAngleInDegrees: number,\n sweepAngleInDegrees: number,\n forceMoveTo: boolean\n ) {\n this.ref.arcToOval(\n JsiSkRect.fromValue(this.CanvasKit, oval),\n startAngleInDegrees,\n sweepAngleInDegrees,\n forceMoveTo\n );\n return this;\n }\n\n arcToRotated(\n rx: number,\n ry: number,\n xAxisRotateInDegrees: number,\n useSmallArc: boolean,\n isCCW: boolean,\n x: number,\n y: number\n ) {\n this.ref.arcToRotated(\n rx,\n ry,\n xAxisRotateInDegrees,\n useSmallArc,\n isCCW,\n x,\n y\n );\n return this;\n }\n\n arcToTangent(x1: number, y1: number, x2: number, y2: number, radius: number) {\n this.ref.arcToTangent(x1, y1, x2, y2, radius);\n return this;\n }\n\n conicTo(x1: number, y1: number, x2: number, y2: number, w: number) {\n this.ref.conicTo(x1, y1, x2, y2, w);\n return this;\n }\n\n contains(x: number, y: number) {\n return this.ref.contains(x, y);\n }\n\n copy() {\n return new JsiSkPath(this.CanvasKit, this.ref.copy());\n }\n\n cubicTo(\n cpx1: number,\n cpy1: number,\n cpx2: number,\n cpy2: number,\n x: number,\n y: number\n ) {\n this.ref.cubicTo(cpx1, cpy1, cpx2, cpy2, x, y);\n return this;\n }\n\n dash(on: number, off: number, phase: number) {\n return this.ref.dash(on, off, phase);\n }\n\n equals(other: SkPath) {\n return this.ref.equals(toValue(other));\n }\n\n getBounds() {\n return new JsiSkRect(this.CanvasKit, this.ref.getBounds());\n }\n\n getFillType() {\n return this.ref.getFillType().value;\n }\n\n quadTo(x1: number, y1: number, x2: number, y2: number) {\n this.ref.quadTo(x1, y1, x2, y2);\n }\n\n addRect(rect: SkRect, isCCW?: boolean) {\n this.ref.addRect(JsiSkRect.fromValue(this.CanvasKit, rect), isCCW);\n }\n\n addRRect(rrect: SkRRect, isCCW?: boolean) {\n this.ref.addRRect(JsiSkRRect.fromValue(this.CanvasKit, rrect), isCCW);\n return this;\n }\n\n getPoint(index: number) {\n return new JsiSkPoint(this.CanvasKit, this.ref.getPoint(index));\n }\n\n isEmpty() {\n return this.ref.isEmpty();\n }\n\n isVolatile() {\n return this.ref.isVolatile();\n }\n\n addCircle(x: number, y: number, r: number) {\n // We leave the comment below to remind us that this is not implemented in CanvasKit\n // throw new NotImplementedOnRNWeb();\n this.ref.addOval(this.CanvasKit.LTRBRect(x - r, y - r, x + r, y + r));\n return this;\n }\n\n getLastPt() {\n return new JsiSkPoint(\n this.CanvasKit,\n this.ref.getPoint(this.ref.countPoints() - 1)\n );\n }\n\n op(path: SkPath, op: PathOp) {\n return this.ref.op(toValue(path), ckEnum(op));\n }\n\n simplify() {\n return this.ref.simplify();\n }\n\n toSVGString() {\n return this.ref.toSVGString();\n }\n\n trim(startT: number, stopT: number, isComplement: boolean) {\n const result = this.ref.trim(startT, stopT, isComplement);\n return result === null ? result : this;\n }\n\n transform(m3: SkMatrix) {\n this.ref.transform(toValue(m3));\n }\n\n interpolate(end: SkPath, t: number) {\n // Do not remove the comment below. We use it to track missing APIs in CanvasKit\n // throw new NotImplementedOnRNWeb();\n const cmd1 = this.toCmds();\n const cmd2 = end.toCmds();\n if (!areCmdsInterpolatable(cmd1, cmd2)) {\n return null;\n }\n const interpolated: PathCommand[] = [];\n cmd1.forEach((cmd, i) => {\n const interpolatedCmd = [cmd[0]];\n interpolated.push(interpolatedCmd);\n cmd.forEach((c, j) => {\n if (j === 0) {\n return;\n }\n if (interpolatedCmd[0] === PathVerb.Conic && j === 5) {\n interpolatedCmd.push(c);\n } else {\n const c2 = cmd2[i][j];\n interpolatedCmd.push(c2 + (c - c2) * t);\n }\n });\n });\n const path = this.CanvasKit.Path.MakeFromCmds(interpolated.flat());\n if (path === null) {\n return null;\n }\n return new JsiSkPath(this.CanvasKit, path);\n }\n\n isInterpolatable(path2: SkPath): boolean {\n // Do not remove the comment below. We use it to track missing APIs in CanvasKit\n // throw new NotImplementedOnRNWeb();\n const cmd1 = this.toCmds();\n const cmd2 = path2.toCmds();\n return areCmdsInterpolatable(cmd1, cmd2);\n }\n\n toCmds() {\n const cmds = this.ref.toCmds();\n const result = cmds.reduce<PathCommand[]>((acc, cmd, i) => {\n if (i === 0) {\n acc.push([]);\n }\n const current = acc[acc.length - 1];\n if (current.length === 0) {\n current.push(cmd);\n const length = CommandCount[current[0] as PathVerb];\n if (current.length === length && i !== cmds.length - 1) {\n acc.push([]);\n }\n } else {\n const length = CommandCount[current[0] as PathVerb];\n if (current.length < length) {\n current.push(cmd);\n }\n if (current.length === length && i !== cmds.length - 1) {\n acc.push([]);\n }\n }\n return acc;\n }, []);\n return result;\n }\n}\n"]}
|
1
|
+
{"version":3,"sources":["JsiSkPath.ts"],"names":["PathVerb","ckEnum","HostObject","optEnum","JsiSkPoint","JsiSkRect","JsiSkRRect","JsiSkMatrix","CommandCount","Move","Line","Quad","Conic","Cubic","Close","JsiSkPath","constructor","CanvasKit","ref","addArc","oval","startAngleInDegrees","sweepAngleInDegrees","fromValue","addOval","isCCW","startIndex","countPoints","addPoly","points","close","map","p","Array","from","flat","moveTo","x","y","lineTo","makeAsWinding","result","offset","dx","dy","rArcTo","rx","ry","xAxisRotateInDegrees","useSmallArc","rConicTo","dx1","dy1","dx2","dy2","w","rCubicTo","cpx1","cpy1","cpx2","cpy2","rMoveTo","rLineTo","rQuadTo","x1","y1","x2","y2","setFillType","fill","setIsVolatile","volatile","stroke","opts","undefined","width","miter_limit","precision","join","cap","reset","rewind","computeTightBounds","arcToOval","forceMoveTo","arcToRotated","arcToTangent","radius","conicTo","contains","copy","cubicTo","dash","on","off","phase","equals","other","getBounds","getFillType","value","quadTo","addRect","rect","addRRect","rrect","getPoint","index","isEmpty","isVolatile","addCircle","r","getLastPt","op","path","simplify","toSVGString","trim","startT","stopT","isComplement","transform","m3","interpolate","end","t","Path","MakeFromPathInterpolation","isInterpolatable","path2","CanInterpolate","toCmds","cmds","reduce","acc","cmd","i","push","current","length"],"mappings":"AAEA,SAASA,QAAT,QAAyB,UAAzB;AAaA,SAASC,MAAT,EAAiBC,UAAjB,EAA6BC,OAA7B,QAA4C,QAA5C;AACA,SAASC,UAAT,QAA2B,cAA3B;AACA,SAASC,SAAT,QAA0B,aAA1B;AACA,SAASC,UAAT,QAA2B,cAA3B;AACA,SAASC,WAAT,QAA4B,eAA5B;AAEA,MAAMC,YAAY,GAAG;AACnB,GAACR,QAAQ,CAACS,IAAV,GAAiB,CADE;AAEnB,GAACT,QAAQ,CAACU,IAAV,GAAiB,CAFE;AAGnB,GAACV,QAAQ,CAACW,IAAV,GAAiB,CAHE;AAInB,GAACX,QAAQ,CAACY,KAAV,GAAkB,CAJC;AAKnB,GAACZ,QAAQ,CAACa,KAAV,GAAkB,CALC;AAMnB,GAACb,QAAQ,CAACc,KAAV,GAAkB;AANC,CAArB;AASA,OAAO,MAAMC,SAAN,SAAwBb,UAAxB,CAAmE;AACxEc,EAAAA,WAAW,CAACC,SAAD,EAAuBC,GAAvB,EAAkC;AAC3C,UAAMD,SAAN,EAAiBC,GAAjB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IAAR,CAAaF,GAAb;AACA,cAAMI,MAAM,GAAGnI,YAAY,CAACkI,OAAO,CAAC,CAAD,CAAR,CAA3B;;AACA,YAAIA,OAAO,CAACC,MAAR,KAAmBA,MAAnB,IAA6BH,CAAC,KAAKJ,IAAI,CAACO,MAAL,GAAc,CAArD,EAAwD;AACtDL,UAAAA,GAAG,CAACG,IAAJ,CAAS,EAAT;AACD;AACF,OAND,MAMO;AACL,cAAME,MAAM,GAAGnI,YAAY,CAACkI,OAAO,CAAC,CAAD,CAAR,CAA3B;;AACA,YAAIA,OAAO,CAACC,MAAR,GAAiBA,MAArB,EAA6B;AAC3BD,UAAAA,OAAO,CAACD,IAAR,CAAaF,GAAb;AACD;;AACD,YAAIG,OAAO,CAACC,MAAR,KAAmBA,MAAnB,IAA6BH,CAAC,KAAKJ,IAAI,CAACO,MAAL,GAAc,CAArD,EAAwD;AACtDL,UAAAA,GAAG,CAACG,IAAJ,CAAS,EAAT;AACD;AACF;;AACD,aAAOH,GAAP;AACD,KArBc,EAqBZ,EArBY,CAAf;AAsBA,WAAO7F,MAAP;AACD;;AAxUuE","sourcesContent":["import type { CanvasKit, Path } from \"canvaskit-wasm\";\n\nimport { PathVerb } from \"../types\";\nimport type {\n FillType,\n PathCommand,\n PathOp,\n SkMatrix,\n SkPath,\n SkPoint,\n SkRect,\n SkRRect,\n StrokeOpts,\n} from \"../types\";\n\nimport { ckEnum, HostObject, optEnum } from \"./Host\";\nimport { JsiSkPoint } from \"./JsiSkPoint\";\nimport { JsiSkRect } from \"./JsiSkRect\";\nimport { JsiSkRRect } from \"./JsiSkRRect\";\nimport { JsiSkMatrix } from \"./JsiSkMatrix\";\n\nconst CommandCount = {\n [PathVerb.Move]: 3,\n [PathVerb.Line]: 3,\n [PathVerb.Quad]: 5,\n [PathVerb.Conic]: 6,\n [PathVerb.Cubic]: 7,\n [PathVerb.Close]: 1,\n};\n\nexport class JsiSkPath extends HostObject<Path, \"Path\"> implements SkPath {\n constructor(CanvasKit: CanvasKit, ref: Path) {\n super(CanvasKit, ref, \"Path\");\n }\n\n addArc(\n oval: SkRect,\n startAngleInDegrees: number,\n sweepAngleInDegrees: number\n ) {\n this.ref.addArc(\n JsiSkRect.fromValue(this.CanvasKit, oval),\n startAngleInDegrees,\n sweepAngleInDegrees\n );\n return this;\n }\n\n addOval(oval: SkRect, isCCW?: boolean, startIndex?: number) {\n this.ref.addOval(\n JsiSkRect.fromValue(this.CanvasKit, oval),\n isCCW,\n startIndex\n );\n return this;\n }\n\n countPoints() {\n return this.ref.countPoints();\n }\n\n addPoly(points: SkPoint[], close: boolean) {\n this.ref.addPoly(\n points.map((p) => Array.from(JsiSkPoint.fromValue(p))).flat(),\n close\n );\n return this;\n }\n\n moveTo(x: number, y: number) {\n this.ref.moveTo(x, y);\n return this;\n }\n\n lineTo(x: number, y: number) {\n this.ref.lineTo(x, y);\n return this;\n }\n\n makeAsWinding() {\n const result = this.ref.makeAsWinding();\n return result === null ? result : this;\n }\n\n offset(dx: number, dy: number) {\n this.ref.offset(dx, dy);\n return this;\n }\n\n rArcTo(\n rx: number,\n ry: number,\n xAxisRotateInDegrees: number,\n useSmallArc: boolean,\n isCCW: boolean,\n dx: number,\n dy: number\n ) {\n this.ref.rArcTo(rx, ry, xAxisRotateInDegrees, useSmallArc, isCCW, dx, dy);\n return this;\n }\n\n rConicTo(dx1: number, dy1: number, dx2: number, dy2: number, w: number) {\n this.ref.rConicTo(dx1, dy1, dx2, dy2, w);\n return this;\n }\n\n rCubicTo(\n cpx1: number,\n cpy1: number,\n cpx2: number,\n cpy2: number,\n x: number,\n y: number\n ) {\n this.ref.rCubicTo(cpx1, cpy1, cpx2, cpy2, x, y);\n return this;\n }\n\n rMoveTo(x: number, y: number) {\n this.ref.rMoveTo(x, y);\n return this;\n }\n\n rLineTo(x: number, y: number) {\n this.ref.rLineTo(x, y);\n return this;\n }\n\n rQuadTo(x1: number, y1: number, x2: number, y2: number) {\n this.ref.rQuadTo(x1, y1, x2, y2);\n return this;\n }\n\n setFillType(fill: FillType) {\n this.ref.setFillType(ckEnum(fill));\n }\n\n setIsVolatile(volatile: boolean) {\n this.ref.setIsVolatile(volatile);\n }\n\n stroke(opts?: StrokeOpts) {\n const result = this.ref.stroke(\n opts === undefined\n ? undefined\n : {\n width: opts.width,\n // eslint-disable-next-line camelcase\n miter_limit: opts.width,\n precision: opts.width,\n join: optEnum(opts.join),\n cap: optEnum(opts.cap),\n }\n );\n return result === null ? result : this;\n }\n\n close() {\n this.ref.close();\n }\n\n reset() {\n this.ref.reset();\n }\n\n rewind() {\n this.ref.rewind();\n }\n\n computeTightBounds(): SkRect {\n return new JsiSkRect(this.CanvasKit, this.ref.computeTightBounds());\n }\n\n arcToOval(\n oval: SkRect,\n startAngleInDegrees: number,\n sweepAngleInDegrees: number,\n forceMoveTo: boolean\n ) {\n this.ref.arcToOval(\n JsiSkRect.fromValue(this.CanvasKit, oval),\n startAngleInDegrees,\n sweepAngleInDegrees,\n forceMoveTo\n );\n return this;\n }\n\n arcToRotated(\n rx: number,\n ry: number,\n xAxisRotateInDegrees: number,\n useSmallArc: boolean,\n isCCW: boolean,\n x: number,\n y: number\n ) {\n this.ref.arcToRotated(\n rx,\n ry,\n xAxisRotateInDegrees,\n useSmallArc,\n isCCW,\n x,\n y\n );\n return this;\n }\n\n arcToTangent(x1: number, y1: number, x2: number, y2: number, radius: number) {\n this.ref.arcToTangent(x1, y1, x2, y2, radius);\n return this;\n }\n\n conicTo(x1: number, y1: number, x2: number, y2: number, w: number) {\n this.ref.conicTo(x1, y1, x2, y2, w);\n return this;\n }\n\n contains(x: number, y: number) {\n return this.ref.contains(x, y);\n }\n\n copy() {\n return new JsiSkPath(this.CanvasKit, this.ref.copy());\n }\n\n cubicTo(\n cpx1: number,\n cpy1: number,\n cpx2: number,\n cpy2: number,\n x: number,\n y: number\n ) {\n this.ref.cubicTo(cpx1, cpy1, cpx2, cpy2, x, y);\n return this;\n }\n\n dash(on: number, off: number, phase: number) {\n return this.ref.dash(on, off, phase);\n }\n\n equals(other: SkPath) {\n return this.ref.equals(JsiSkPath.fromValue(other));\n }\n\n getBounds() {\n return new JsiSkRect(this.CanvasKit, this.ref.getBounds());\n }\n\n getFillType() {\n return this.ref.getFillType().value;\n }\n\n quadTo(x1: number, y1: number, x2: number, y2: number) {\n this.ref.quadTo(x1, y1, x2, y2);\n }\n\n addRect(rect: SkRect, isCCW?: boolean) {\n this.ref.addRect(JsiSkRect.fromValue(this.CanvasKit, rect), isCCW);\n }\n\n addRRect(rrect: SkRRect, isCCW?: boolean) {\n this.ref.addRRect(JsiSkRRect.fromValue(this.CanvasKit, rrect), isCCW);\n return this;\n }\n\n getPoint(index: number) {\n return new JsiSkPoint(this.CanvasKit, this.ref.getPoint(index));\n }\n\n isEmpty() {\n return this.ref.isEmpty();\n }\n\n isVolatile() {\n return this.ref.isVolatile();\n }\n\n addCircle(x: number, y: number, r: number) {\n this.ref.addCircle(x, y, r);\n return this;\n }\n\n getLastPt() {\n return new JsiSkPoint(\n this.CanvasKit,\n this.ref.getPoint(this.ref.countPoints() - 1)\n );\n }\n\n op(path: SkPath, op: PathOp) {\n return this.ref.op(JsiSkPath.fromValue(path), ckEnum(op));\n }\n\n simplify() {\n return this.ref.simplify();\n }\n\n toSVGString() {\n return this.ref.toSVGString();\n }\n\n trim(startT: number, stopT: number, isComplement: boolean) {\n const result = this.ref.trim(startT, stopT, isComplement);\n return result === null ? result : this;\n }\n\n transform(m3: SkMatrix) {\n this.ref.transform(JsiSkMatrix.fromValue(m3));\n }\n\n interpolate(end: SkPath, t: number) {\n const path = this.CanvasKit.Path.MakeFromPathInterpolation(\n this.ref,\n JsiSkPath.fromValue(end),\n t\n );\n if (path === null) {\n return null;\n }\n return new JsiSkPath(this.CanvasKit, path);\n }\n\n isInterpolatable(path2: SkPath): boolean {\n return this.CanvasKit.Path.CanInterpolate(\n this.ref,\n JsiSkPath.fromValue(path2)\n );\n }\n\n toCmds() {\n const cmds = this.ref.toCmds();\n const result = cmds.reduce<PathCommand[]>((acc, cmd, i) => {\n if (i === 0) {\n acc.push([]);\n }\n const current = acc[acc.length - 1];\n if (current.length === 0) {\n current.push(cmd);\n const length = CommandCount[current[0] as PathVerb];\n if (current.length === length && i !== cmds.length - 1) {\n acc.push([]);\n }\n } else {\n const length = CommandCount[current[0] as PathVerb];\n if (current.length < length) {\n current.push(cmd);\n }\n if (current.length === length && i !== cmds.length - 1) {\n acc.push([]);\n }\n }\n return acc;\n }, []);\n return result;\n }\n}\n"]}
|
@@ -1,4 +1,6 @@
|
|
1
|
-
import { ckEnum, Host, NotImplementedOnRNWeb
|
1
|
+
import { ckEnum, Host, NotImplementedOnRNWeb } from "./Host";
|
2
|
+
import { JsiSkMatrix } from "./JsiSkMatrix";
|
3
|
+
import { JsiSkPath } from "./JsiSkPath";
|
2
4
|
import { JsiSkPathEffect } from "./JsiSkPathEffect";
|
3
5
|
export class JsiSkPathEffectFactory extends Host {
|
4
6
|
constructor(CanvasKit) {
|
@@ -34,7 +36,7 @@ export class JsiSkPathEffectFactory extends Host {
|
|
34
36
|
}
|
35
37
|
|
36
38
|
MakeLine2D(width, matrix) {
|
37
|
-
const pe = this.CanvasKit.PathEffect.MakeLine2D(width,
|
39
|
+
const pe = this.CanvasKit.PathEffect.MakeLine2D(width, JsiSkMatrix.fromValue(matrix));
|
38
40
|
|
39
41
|
if (pe === null) {
|
40
42
|
return null;
|
@@ -44,7 +46,7 @@ export class JsiSkPathEffectFactory extends Host {
|
|
44
46
|
}
|
45
47
|
|
46
48
|
MakePath1D(path, advance, phase, style) {
|
47
|
-
const pe = this.CanvasKit.PathEffect.MakePath1D(
|
49
|
+
const pe = this.CanvasKit.PathEffect.MakePath1D(JsiSkPath.fromValue(path), advance, phase, ckEnum(style));
|
48
50
|
|
49
51
|
if (pe === null) {
|
50
52
|
return null;
|
@@ -54,7 +56,7 @@ export class JsiSkPathEffectFactory extends Host {
|
|
54
56
|
}
|
55
57
|
|
56
58
|
MakePath2D(matrix, path) {
|
57
|
-
const pe = this.CanvasKit.PathEffect.MakePath2D(
|
59
|
+
const pe = this.CanvasKit.PathEffect.MakePath2D(JsiSkMatrix.fromValue(matrix), JsiSkPath.fromValue(path));
|
58
60
|
|
59
61
|
if (pe === null) {
|
60
62
|
return null;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["JsiSkPathEffectFactory.ts"],"names":["ckEnum","Host","NotImplementedOnRNWeb","
|
1
|
+
{"version":3,"sources":["JsiSkPathEffectFactory.ts"],"names":["ckEnum","Host","NotImplementedOnRNWeb","JsiSkMatrix","JsiSkPath","JsiSkPathEffect","JsiSkPathEffectFactory","constructor","CanvasKit","MakeCorner","radius","pe","PathEffect","MakeDash","intervals","phase","MakeDiscrete","segLength","dev","seedAssist","MakeCompose","_outer","_inner","MakeSum","MakeLine2D","width","matrix","fromValue","MakePath1D","path","advance","style","MakePath2D"],"mappings":"AAUA,SAASA,MAAT,EAAiBC,IAAjB,EAAuBC,qBAAvB,QAAoD,QAApD;AACA,SAASC,WAAT,QAA4B,eAA5B;AACA,SAASC,SAAT,QAA0B,aAA1B;AACA,SAASC,eAAT,QAAgC,mBAAhC;AAEA,OAAO,MAAMC,sBAAN,SAAqCL,IAArC,CAAuE;AAC5EM,EAAAA,WAAW,CAACC,SAAD,EAAuB;AAChC,UAAMA,SAAN;AACD;;AAEDC,EAAAA,UAAU,CAACC,MAAD,EAAiB;AACzB,UAAMC,EAAE,GAAG,KAAKH,SAAL,CAAeI,UAAf,CAA0BH,UAA1B,CAAqCC,MAArC,CAAX;;AACA,QAAIC,EAAE,KAAK,IAAX,EAAiB;AACf,aAAO,IAAP;AACD;;AACD,WAAO,IAAIN,eAAJ,CAAoB,KAAKG,SAAzB,EAAoCG,EAApC,CAAP;AACD;;AAEDE,EAAAA,QAAQ,CAACC,SAAD,EAAsBC,KAAtB,EAAsC;AAC5C,UAAMJ,EAAE,GAAG,KAAKH,SAAL,CAAeI,UAAf,CAA0BC,QAA1B,CAAmCC,SAAnC,EAA8CC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B,EAAoCG,EAApC,CAAP;AACD;;AAEDqB,EAAAA,UAAU,CAACN,MAAD,EAAmBG,IAAnB,EAAiC;AACzC,UAAMlB,EAAE,GAAG,KAAKH,SAAL,CAAeI,UAAf,CAA0BoB,UAA1B,CACT7B,WAAW,CAACwB,SAAZ,CAAsBD,MAAtB,CADS,EAETtB,SAAS,CAACuB,SAAV,CAAoBE,IAApB,CAFS,CAAX;;AAIA,QAAIlB,EAAE,KAAK,IAAX,EAAiB;AACf,aAAO,IAAP;AACD;;AACD,WAAO,IAAIN,eAAJ,CAAoB,KAAKG,SAAzB,EAAoCG,EAApC,CAAP;AACD;;AAzE2E","sourcesContent":["import type { CanvasKit } from \"canvaskit-wasm\";\n\nimport type {\n Path1DEffectStyle,\n PathEffectFactory,\n SkMatrix,\n SkPath,\n SkPathEffect,\n} from \"../types\";\n\nimport { ckEnum, Host, NotImplementedOnRNWeb } from \"./Host\";\nimport { JsiSkMatrix } from \"./JsiSkMatrix\";\nimport { JsiSkPath } from \"./JsiSkPath\";\nimport { JsiSkPathEffect } from \"./JsiSkPathEffect\";\n\nexport class JsiSkPathEffectFactory extends Host implements PathEffectFactory {\n constructor(CanvasKit: CanvasKit) {\n super(CanvasKit);\n }\n\n MakeCorner(radius: number) {\n const pe = this.CanvasKit.PathEffect.MakeCorner(radius);\n if (pe === null) {\n return null;\n }\n return new JsiSkPathEffect(this.CanvasKit, pe);\n }\n\n MakeDash(intervals: number[], phase?: number) {\n const pe = this.CanvasKit.PathEffect.MakeDash(intervals, phase);\n return new JsiSkPathEffect(this.CanvasKit, pe);\n }\n\n MakeDiscrete(segLength: number, dev: number, seedAssist: number) {\n const pe = this.CanvasKit.PathEffect.MakeDiscrete(\n segLength,\n dev,\n seedAssist\n );\n return new JsiSkPathEffect(this.CanvasKit, pe);\n }\n\n MakeCompose(_outer: SkPathEffect, _inner: SkPathEffect): SkPathEffect {\n throw new NotImplementedOnRNWeb();\n }\n\n MakeSum(_outer: SkPathEffect, _inner: SkPathEffect): SkPathEffect {\n throw new NotImplementedOnRNWeb();\n }\n\n MakeLine2D(width: number, matrix: SkMatrix) {\n const pe = this.CanvasKit.PathEffect.MakeLine2D(\n width,\n JsiSkMatrix.fromValue(matrix)\n );\n if (pe === null) {\n return null;\n }\n return new JsiSkPathEffect(this.CanvasKit, pe);\n }\n\n MakePath1D(\n path: SkPath,\n advance: number,\n phase: number,\n style: Path1DEffectStyle\n ) {\n const pe = this.CanvasKit.PathEffect.MakePath1D(\n JsiSkPath.fromValue(path),\n advance,\n phase,\n ckEnum(style)\n );\n if (pe === null) {\n return null;\n }\n return new JsiSkPathEffect(this.CanvasKit, pe);\n }\n\n MakePath2D(matrix: SkMatrix, path: SkPath) {\n const pe = this.CanvasKit.PathEffect.MakePath2D(\n JsiSkMatrix.fromValue(matrix),\n JsiSkPath.fromValue(path)\n );\n if (pe === null) {\n return null;\n }\n return new JsiSkPathEffect(this.CanvasKit, pe);\n }\n}\n"]}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { Host, ckEnum,
|
1
|
+
import { Host, ckEnum, NotImplementedOnRNWeb } from "./Host";
|
2
2
|
import { JsiSkPath } from "./JsiSkPath";
|
3
3
|
export class JsiSkPathFactory extends Host {
|
4
4
|
constructor(CanvasKit) {
|
@@ -20,7 +20,7 @@ export class JsiSkPathFactory extends Host {
|
|
20
20
|
}
|
21
21
|
|
22
22
|
MakeFromOp(one, two, op) {
|
23
|
-
const path = this.CanvasKit.Path.MakeFromOp(
|
23
|
+
const path = this.CanvasKit.Path.MakeFromOp(JsiSkPath.fromValue(one), JsiSkPath.fromValue(two), ckEnum(op));
|
24
24
|
|
25
25
|
if (path === null) {
|
26
26
|
return null;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["JsiSkPathFactory.ts"],"names":["Host","ckEnum","
|
1
|
+
{"version":3,"sources":["JsiSkPathFactory.ts"],"names":["Host","ckEnum","NotImplementedOnRNWeb","JsiSkPath","JsiSkPathFactory","constructor","CanvasKit","Make","Path","MakeFromSVGString","str","path","MakeFromOp","one","two","op","fromValue","MakeFromCmds","cmds","flat","MakeFromText","_text","_x","_y","_font"],"mappings":"AAKA,SAASA,IAAT,EAAeC,MAAf,EAAuBC,qBAAvB,QAAoD,QAApD;AACA,SAASC,SAAT,QAA0B,aAA1B;AAEA,OAAO,MAAMC,gBAAN,SAA+BJ,IAA/B,CAA2D;AAChEK,EAAAA,WAAW,CAACC,SAAD,EAAuB;AAChC,UAAMA,SAAN;AACD;;AAEDC,EAAAA,IAAI,GAAG;AACL,WAAO,IAAIJ,SAAJ,CAAc,KAAKG,SAAnB,EAA8B,IAAI,KAAKA,SAAL,CAAeE,IAAnB,EAA9B,CAAP;AACD;;AAEDC,EAAAA,iBAAiB,CAACC,GAAD,EAAc;AAC7B,UAAMC,IAAI,GAAG,KAAKL,SAAL,CAAeE,IAAf,CAAoBC,iBAApB,CAAsCC,GAAtC,CAAb;;AACA,QAAIC,IAAI,KAAK,IAAb,EAAmB;AACjB,aAAO,IAAP;AACD;;AACD,WAAO,IAAIR,SAAJ,CAAc,KAAKG,SAAnB,EAA8BK,IAA9B,CAAP;AACD;;AAEDC,EAAAA,UAAU,CAACC,GAAD,EAAcC,GAAd,EAA2BC,EAA3B,EAAuC;AAC/C,UAAMJ,IAAI,GAAG,KAAKL,SAAL,CAAeE,IAAf,CAAoBI,UAApB,CACXT,SAAS,CAACa,SAAV,CAAoBH,GAApB,CADW,EAEXV,SAAS,CAACa,SAAV,CAAoBF,GAApB,CAFW,EAGXb,MAAM,CAACc,EAAD,CAHK,CAAb;;AAKA,QAAIJ,IAAI,KAAK,IAAb,EAAmB;AACjB,aAAO,IAAP;AACD;;AACD,WAAO,IAAIR,SAAJ,CAAc,KAAKG,SAAnB,EAA8BK,IAA9B,CAAP;AACD;;AAEDM,EAAAA,YAAY,CAACC,IAAD,EAAsB;AAChC,UAAMP,IAAI,GAAG,KAAKL,SAAL,CAAeE,IAAf,CAAoBS,YAApB,CAAiCC,IAAI,CAACC,IAAL,EAAjC,CAAb;;AACA,QAAIR,IAAI,KAAK,IAAb,EAAmB;AACjB,aAAO,IAAP;AACD;;AACD,WAAO,IAAIR,SAAJ,CAAc,KAAKG,SAAnB,EAA8BK,IAA9B,CAAP;AACD;;AAEDS,EAAAA,YAAY,CACVC,KADU,EAEVC,EAFU,EAGVC,EAHU,EAIVC,KAJU,EAKK;AACf,UAAM,IAAItB,qBAAJ,EAAN;AACD;;AA5C+D","sourcesContent":["import type { CanvasKit } from \"canvaskit-wasm\";\n\nimport type { PathCommand, PathOp, SkFont, SkPath } from \"../types\";\nimport type { PathFactory } from \"../types/Path/PathFactory\";\n\nimport { Host, ckEnum, NotImplementedOnRNWeb } from \"./Host\";\nimport { JsiSkPath } from \"./JsiSkPath\";\n\nexport class JsiSkPathFactory extends Host implements PathFactory {\n constructor(CanvasKit: CanvasKit) {\n super(CanvasKit);\n }\n\n Make() {\n return new JsiSkPath(this.CanvasKit, new this.CanvasKit.Path());\n }\n\n MakeFromSVGString(str: string) {\n const path = this.CanvasKit.Path.MakeFromSVGString(str);\n if (path === null) {\n return null;\n }\n return new JsiSkPath(this.CanvasKit, path);\n }\n\n MakeFromOp(one: SkPath, two: SkPath, op: PathOp) {\n const path = this.CanvasKit.Path.MakeFromOp(\n JsiSkPath.fromValue(one),\n JsiSkPath.fromValue(two),\n ckEnum(op)\n );\n if (path === null) {\n return null;\n }\n return new JsiSkPath(this.CanvasKit, path);\n }\n\n MakeFromCmds(cmds: PathCommand[]) {\n const path = this.CanvasKit.Path.MakeFromCmds(cmds.flat());\n if (path === null) {\n return null;\n }\n return new JsiSkPath(this.CanvasKit, path);\n }\n\n MakeFromText(\n _text: string,\n _x: number,\n _y: number,\n _font: SkFont\n ): SkPath | null {\n throw new NotImplementedOnRNWeb();\n }\n}\n"]}
|