@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,13 +1,15 @@
|
|
1
1
|
// TODO: suggest to rename SkPicture to Picture for consistency
|
2
|
-
import { HostObject,
|
2
|
+
import { HostObject, ckEnum } from "./Host";
|
3
3
|
import { JsiSkShader } from "./JsiSkShader";
|
4
|
+
import { JsiSkMatrix } from "./JsiSkMatrix";
|
5
|
+
import { JsiSkRect } from "./JsiSkRect";
|
4
6
|
export class JsiSkPicture extends HostObject {
|
5
7
|
constructor(CanvasKit, ref) {
|
6
8
|
super(CanvasKit, ref, "Picture");
|
7
9
|
}
|
8
10
|
|
9
11
|
makeShader(tmx, tmy, mode, localMatrix, tileRect) {
|
10
|
-
return new JsiSkShader(this.CanvasKit, this.ref.makeShader(ckEnum(tmx), ckEnum(tmy), ckEnum(mode), localMatrix ?
|
12
|
+
return new JsiSkShader(this.CanvasKit, this.ref.makeShader(ckEnum(tmx), ckEnum(tmy), ckEnum(mode), localMatrix ? JsiSkMatrix.fromValue(localMatrix) : undefined, tileRect ? JsiSkRect.fromValue(this.CanvasKit, tileRect) : undefined));
|
11
13
|
}
|
12
14
|
|
13
15
|
serialize() {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["JsiSkPicture.ts"],"names":["HostObject","
|
1
|
+
{"version":3,"sources":["JsiSkPicture.ts"],"names":["HostObject","ckEnum","JsiSkShader","JsiSkMatrix","JsiSkRect","JsiSkPicture","constructor","CanvasKit","ref","makeShader","tmx","tmy","mode","localMatrix","tileRect","fromValue","undefined","serialize"],"mappings":"AAAA;AAWA,SAASA,UAAT,EAAqBC,MAArB,QAAmC,QAAnC;AACA,SAASC,WAAT,QAA4B,eAA5B;AACA,SAASC,WAAT,QAA4B,eAA5B;AACA,SAASC,SAAT,QAA0B,aAA1B;AAEA,OAAO,MAAMC,YAAN,SACGL,UADH,CAGP;AACEM,EAAAA,WAAW,CAACC,SAAD,EAAuBC,GAAvB,EAAqC;AAC9C,UAAMD,SAAN,EAAiBC,GAAjB,EAAsB,SAAtB;AACD;;AAEDC,EAAAA,UAAU,CACRC,GADQ,EAERC,GAFQ,EAGRC,IAHQ,EAIRC,WAJQ,EAKRC,QALQ,EAMR;AACA,WAAO,IAAIZ,WAAJ,CACL,KAAKK,SADA,EAEL,KAAKC,GAAL,CAASC,UAAT,CACER,MAAM,CAACS,GAAD,CADR,EAEET,MAAM,CAACU,GAAD,CAFR,EAGEV,MAAM,CAACW,IAAD,CAHR,EAIEC,WAAW,GAAGV,WAAW,CAACY,SAAZ,CAAsBF,WAAtB,CAAH,GAAwCG,SAJrD,EAKEF,QAAQ,GAAGV,SAAS,CAACW,SAAV,CAAoB,KAAKR,SAAzB,EAAoCO,QAApC,CAAH,GAAmDE,SAL7D,CAFK,CAAP;AAUD;;AAEDC,EAAAA,SAAS,GAAG;AACV,WAAO,KAAKT,GAAL,CAASS,SAAT,EAAP;AACD;;AA1BH","sourcesContent":["// TODO: suggest to rename SkPicture to Picture for consistency\nimport type { CanvasKit, SkPicture as Picture } from \"canvaskit-wasm\";\n\nimport type {\n FilterMode,\n SkRect,\n TileMode,\n SkPicture,\n SkMatrix,\n} from \"../types\";\n\nimport { HostObject, ckEnum } from \"./Host\";\nimport { JsiSkShader } from \"./JsiSkShader\";\nimport { JsiSkMatrix } from \"./JsiSkMatrix\";\nimport { JsiSkRect } from \"./JsiSkRect\";\n\nexport class JsiSkPicture\n extends HostObject<Picture, \"Picture\">\n implements SkPicture\n{\n constructor(CanvasKit: CanvasKit, ref: Picture) {\n super(CanvasKit, ref, \"Picture\");\n }\n\n makeShader(\n tmx: TileMode,\n tmy: TileMode,\n mode: FilterMode,\n localMatrix?: SkMatrix,\n tileRect?: SkRect\n ) {\n return new JsiSkShader(\n this.CanvasKit,\n this.ref.makeShader(\n ckEnum(tmx),\n ckEnum(tmy),\n ckEnum(mode),\n localMatrix ? JsiSkMatrix.fromValue(localMatrix) : undefined,\n tileRect ? JsiSkRect.fromValue(this.CanvasKit, tileRect) : undefined\n )\n );\n }\n\n serialize() {\n return this.ref.serialize();\n }\n}\n"]}
|
@@ -1,13 +1,14 @@
|
|
1
|
-
import { HostObject
|
1
|
+
import { HostObject } from "./Host";
|
2
2
|
import { JsiSkCanvas } from "./JsiSkCanvas";
|
3
3
|
import { JsiSkPicture } from "./JsiSkPicture";
|
4
|
+
import { JsiSkRect } from "./JsiSkRect";
|
4
5
|
export class JsiSkPictureRecorder extends HostObject {
|
5
6
|
constructor(CanvasKit, ref) {
|
6
7
|
super(CanvasKit, ref, "PictureRecorder");
|
7
8
|
}
|
8
9
|
|
9
10
|
beginRecording(bounds) {
|
10
|
-
return new JsiSkCanvas(this.CanvasKit, this.ref.beginRecording(
|
11
|
+
return new JsiSkCanvas(this.CanvasKit, this.ref.beginRecording(JsiSkRect.fromValue(this.CanvasKit, bounds)));
|
11
12
|
}
|
12
13
|
|
13
14
|
finishRecordingAsPicture() {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["JsiSkPictureRecorder.ts"],"names":["HostObject","
|
1
|
+
{"version":3,"sources":["JsiSkPictureRecorder.ts"],"names":["HostObject","JsiSkCanvas","JsiSkPicture","JsiSkRect","JsiSkPictureRecorder","constructor","CanvasKit","ref","beginRecording","bounds","fromValue","finishRecordingAsPicture"],"mappings":"AAKA,SAASA,UAAT,QAA2B,QAA3B;AACA,SAASC,WAAT,QAA4B,eAA5B;AACA,SAASC,YAAT,QAA6B,gBAA7B;AACA,SAASC,SAAT,QAA0B,aAA1B;AAEA,OAAO,MAAMC,oBAAN,SACGJ,UADH,CAGP;AACEK,EAAAA,WAAW,CAACC,SAAD,EAAuBC,GAAvB,EAA6C;AACtD,UAAMD,SAAN,EAAiBC,GAAjB,EAAsB,iBAAtB;AACD;;AAEDC,EAAAA,cAAc,CAACC,MAAD,EAAiB;AAC7B,WAAO,IAAIR,WAAJ,CACL,KAAKK,SADA,EAEL,KAAKC,GAAL,CAASC,cAAT,CAAwBL,SAAS,CAACO,SAAV,CAAoB,KAAKJ,SAAzB,EAAoCG,MAApC,CAAxB,CAFK,CAAP;AAID;;AAEDE,EAAAA,wBAAwB,GAAG;AACzB,WAAO,IAAIT,YAAJ,CACL,KAAKI,SADA,EAEL,KAAKC,GAAL,CAASI,wBAAT,EAFK,CAAP;AAID;;AAjBH","sourcesContent":["import type { CanvasKit, PictureRecorder } from \"canvaskit-wasm\";\n\nimport type { SkRect } from \"../types\";\nimport type { SkPictureRecorder } from \"../types/Picture/PictureRecorder\";\n\nimport { HostObject } from \"./Host\";\nimport { JsiSkCanvas } from \"./JsiSkCanvas\";\nimport { JsiSkPicture } from \"./JsiSkPicture\";\nimport { JsiSkRect } from \"./JsiSkRect\";\n\nexport class JsiSkPictureRecorder\n extends HostObject<PictureRecorder, \"PictureRecorder\">\n implements SkPictureRecorder\n{\n constructor(CanvasKit: CanvasKit, ref: PictureRecorder) {\n super(CanvasKit, ref, \"PictureRecorder\");\n }\n\n beginRecording(bounds: SkRect) {\n return new JsiSkCanvas(\n this.CanvasKit,\n this.ref.beginRecording(JsiSkRect.fromValue(this.CanvasKit, bounds))\n );\n }\n\n finishRecordingAsPicture() {\n return new JsiSkPicture(\n this.CanvasKit,\n this.ref.finishRecordingAsPicture()\n );\n }\n}\n"]}
|
@@ -1,5 +1,13 @@
|
|
1
|
-
import {
|
2
|
-
export class JsiSkPoint extends
|
1
|
+
import { BaseHostObject } from "./Host";
|
2
|
+
export class JsiSkPoint extends BaseHostObject {
|
3
|
+
static fromValue(point) {
|
4
|
+
if (point instanceof JsiSkPoint) {
|
5
|
+
return point.ref;
|
6
|
+
}
|
7
|
+
|
8
|
+
return new Float32Array([point.x, point.y]);
|
9
|
+
}
|
10
|
+
|
3
11
|
constructor(CanvasKit, ref) {
|
4
12
|
super(CanvasKit, ref, "Point");
|
5
13
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["JsiSkPoint.ts"],"names":["
|
1
|
+
{"version":3,"sources":["JsiSkPoint.ts"],"names":["BaseHostObject","JsiSkPoint","fromValue","point","ref","Float32Array","x","y","constructor","CanvasKit"],"mappings":"AAIA,SAASA,cAAT,QAA+B,QAA/B;AAEA,OAAO,MAAMC,UAAN,SACGD,cADH,CAGP;AACkB,SAATE,SAAS,CAACC,KAAD,EAAiB;AAC/B,QAAIA,KAAK,YAAYF,UAArB,EAAiC;AAC/B,aAAOE,KAAK,CAACC,GAAb;AACD;;AACD,WAAO,IAAIC,YAAJ,CAAiB,CAACF,KAAK,CAACG,CAAP,EAAUH,KAAK,CAACI,CAAhB,CAAjB,CAAP;AACD;;AAEDC,EAAAA,WAAW,CAACC,SAAD,EAAuBL,GAAvB,EAAmC;AAC5C,UAAMK,SAAN,EAAiBL,GAAjB,EAAsB,OAAtB;AACD;;AAEI,MAADE,CAAC,GAAG;AACN,WAAO,KAAKF,GAAL,CAAS,CAAT,CAAP;AACD;;AAEI,MAADG,CAAC,GAAG;AACN,WAAO,KAAKH,GAAL,CAAS,CAAT,CAAP;AACD;;AAlBH","sourcesContent":["import type { CanvasKit, Point } from \"canvaskit-wasm\";\n\nimport type { SkPoint } from \"../types\";\n\nimport { BaseHostObject } from \"./Host\";\n\nexport class JsiSkPoint\n extends BaseHostObject<Point, \"Point\">\n implements SkPoint\n{\n static fromValue(point: SkPoint) {\n if (point instanceof JsiSkPoint) {\n return point.ref;\n }\n return new Float32Array([point.x, point.y]);\n }\n\n constructor(CanvasKit: CanvasKit, ref: Point) {\n super(CanvasKit, ref, \"Point\");\n }\n\n get x() {\n return this.ref[0];\n }\n\n get y() {\n return this.ref[1];\n }\n}\n"]}
|
@@ -1,6 +1,6 @@
|
|
1
|
-
import {
|
1
|
+
import { BaseHostObject } from "./Host";
|
2
2
|
import { JsiSkRect } from "./JsiSkRect";
|
3
|
-
export class JsiSkRRect extends
|
3
|
+
export class JsiSkRRect extends BaseHostObject {
|
4
4
|
static fromValue(CanvasKit, rect) {
|
5
5
|
if (rect instanceof JsiSkRect) {
|
6
6
|
return rect.ref;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["JsiSkRRect.ts"],"names":["
|
1
|
+
{"version":3,"sources":["JsiSkRRect.ts"],"names":["BaseHostObject","JsiSkRect","JsiSkRRect","fromValue","CanvasKit","rect","ref","RRectXY","rx","ry","constructor","Float32Array","of"],"mappings":"AAIA,SAASA,cAAT,QAA+B,QAA/B;AACA,SAASC,SAAT,QAA0B,aAA1B;AAEA,OAAO,MAAMC,UAAN,SACGF,cADH,CAGP;AACkB,SAATG,SAAS,CAACC,SAAD,EAAuBC,IAAvB,EAAsC;AACpD,QAAIA,IAAI,YAAYJ,SAApB,EAA+B;AAC7B,aAAOI,IAAI,CAACC,GAAZ;AACD;;AACD,WAAOF,SAAS,CAACG,OAAV,CACLN,SAAS,CAACE,SAAV,CAAoBC,SAApB,EAA+BC,IAAI,CAACA,IAApC,CADK,EAELA,IAAI,CAACG,EAFA,EAGLH,IAAI,CAACI,EAHA,CAAP;AAKD;;AAEDC,EAAAA,WAAW,CAACN,SAAD,EAAuBE,GAAvB,EAAmC;AAC5C,UAAMF,SAAN,EAAiBE,GAAjB,EAAsB,OAAtB;AACD;;AAEK,MAAFE,EAAE,GAAG;AACP,WAAO,KAAKF,GAAL,CAAS,CAAT,CAAP;AACD;;AAEK,MAAFG,EAAE,GAAG;AACP,WAAO,KAAKH,GAAL,CAAS,CAAT,CAAP;AACD;;AAEO,MAAJD,IAAI,GAAG;AACT,WAAO,IAAIJ,SAAJ,CACL,KAAKG,SADA,EAELO,YAAY,CAACC,EAAb,CAAgB,KAAKN,GAAL,CAAS,CAAT,CAAhB,EAA6B,KAAKA,GAAL,CAAS,CAAT,CAA7B,EAA0C,KAAKA,GAAL,CAAS,CAAT,CAA1C,EAAuD,KAAKA,GAAL,CAAS,CAAT,CAAvD,CAFK,CAAP;AAID;;AA7BH","sourcesContent":["import type { CanvasKit, RRect } from \"canvaskit-wasm\";\n\nimport type { SkRRect } from \"../types\";\n\nimport { BaseHostObject } from \"./Host\";\nimport { JsiSkRect } from \"./JsiSkRect\";\n\nexport class JsiSkRRect\n extends BaseHostObject<RRect, \"RRect\">\n implements SkRRect\n{\n static fromValue(CanvasKit: CanvasKit, rect: SkRRect) {\n if (rect instanceof JsiSkRect) {\n return rect.ref;\n }\n return CanvasKit.RRectXY(\n JsiSkRect.fromValue(CanvasKit, rect.rect),\n rect.rx,\n rect.ry\n );\n }\n\n constructor(CanvasKit: CanvasKit, ref: RRect) {\n super(CanvasKit, ref, \"RRect\");\n }\n\n get rx() {\n return this.ref[4];\n }\n\n get ry() {\n return this.ref[5];\n }\n\n get rect() {\n return new JsiSkRect(\n this.CanvasKit,\n Float32Array.of(this.ref[0], this.ref[1], this.ref[2], this.ref[3])\n );\n }\n}\n"]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["JsiSkRSXform.ts"],"names":["HostObject","JsiSkRSXform","constructor","CanvasKit","ref"],"mappings":"AAIA,SAASA,UAAT,QAA2B,QAA3B;AAIA,OAAO,MAAMC,YAAN,SACGD,UADH,CAGP;AACEE,EAAAA,WAAW,CAACC,SAAD,EAAuBC,GAAvB,EAAqC;AAC9C,UAAMD,SAAN,EAAiBC,GAAjB,EAAsB,SAAtB;AACD;;AAHH","sourcesContent":["import type { CanvasKit } from \"canvaskit-wasm\";\n\nimport type { SkRSXform } from \"../types\";\n\nimport { HostObject } from \"./Host\";\n\
|
1
|
+
{"version":3,"sources":["JsiSkRSXform.ts"],"names":["HostObject","JsiSkRSXform","constructor","CanvasKit","ref"],"mappings":"AAIA,SAASA,UAAT,QAA2B,QAA3B;AAIA,OAAO,MAAMC,YAAN,SACGD,UADH,CAGP;AACEE,EAAAA,WAAW,CAACC,SAAD,EAAuBC,GAAvB,EAAqC;AAC9C,UAAMD,SAAN,EAAiBC,GAAjB,EAAsB,SAAtB;AACD;;AAHH","sourcesContent":["import type { CanvasKit } from \"canvaskit-wasm\";\n\nimport type { SkRSXform } from \"../types\";\n\nimport { HostObject } from \"./Host\";\n\nexport type RSXform = Float32Array;\n\nexport class JsiSkRSXform\n extends HostObject<RSXform, \"RSXform\">\n implements SkRSXform\n{\n constructor(CanvasKit: CanvasKit, ref: RSXform) {\n super(CanvasKit, ref, \"RSXform\");\n }\n}\n"]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["JsiSkRect.ts"],"names":["
|
1
|
+
{"version":3,"sources":["JsiSkRect.ts"],"names":["BaseHostObject","JsiSkRect","fromValue","CanvasKit","rect","ref","XYWHRect","x","y","width","height","constructor"],"mappings":"AAIA,SAASA,cAAT,QAA+B,QAA/B;AAEA,OAAO,MAAMC,SAAN,SAAwBD,cAAxB,CAAuE;AAC5D,SAATE,SAAS,CAACC,SAAD,EAAuBC,IAAvB,EAAqC;AACnD,QAAIA,IAAI,YAAYH,SAApB,EAA+B;AAC7B,aAAOG,IAAI,CAACC,GAAZ;AACD;;AACD,WAAOF,SAAS,CAACG,QAAV,CAAmBF,IAAI,CAACG,CAAxB,EAA2BH,IAAI,CAACI,CAAhC,EAAmCJ,IAAI,CAACK,KAAxC,EAA+CL,IAAI,CAACM,MAApD,CAAP;AACD;;AAEDC,EAAAA,WAAW,CAACR,SAAD,EAAuBE,GAAvB,EAAkC;AAC3C,UAAMF,SAAN,EAAiBE,GAAjB,EAAsB,MAAtB;AACD;;AAEI,MAADE,CAAC,GAAG;AACN,WAAO,KAAKF,GAAL,CAAS,CAAT,CAAP;AACD;;AAEI,MAADG,CAAC,GAAG;AACN,WAAO,KAAKH,GAAL,CAAS,CAAT,CAAP;AACD;;AAEQ,MAALI,KAAK,GAAG;AACV,WAAO,KAAKJ,GAAL,CAAS,CAAT,IAAc,KAAKA,GAAL,CAAS,CAAT,CAArB;AACD;;AAES,MAANK,MAAM,GAAG;AACX,WAAO,KAAKL,GAAL,CAAS,CAAT,IAAc,KAAKA,GAAL,CAAS,CAAT,CAArB;AACD;;AA1B2E","sourcesContent":["import type { CanvasKit, Rect } from \"canvaskit-wasm\";\n\nimport type { SkRect } from \"../types\";\n\nimport { BaseHostObject } from \"./Host\";\n\nexport class JsiSkRect extends BaseHostObject<Rect, \"Rect\"> implements SkRect {\n static fromValue(CanvasKit: CanvasKit, rect: SkRect) {\n if (rect instanceof JsiSkRect) {\n return rect.ref;\n }\n return CanvasKit.XYWHRect(rect.x, rect.y, rect.width, rect.height);\n }\n\n constructor(CanvasKit: CanvasKit, ref: Rect) {\n super(CanvasKit, ref, \"Rect\");\n }\n\n get x() {\n return this.ref[0];\n }\n\n get y() {\n return this.ref[1];\n }\n\n get width() {\n return this.ref[2] - this.ref[0];\n }\n\n get height() {\n return this.ref[3] - this.ref[1];\n }\n}\n"]}
|
@@ -1,4 +1,5 @@
|
|
1
|
-
import { HostObject
|
1
|
+
import { HostObject } from "./Host";
|
2
|
+
import { JsiSkMatrix } from "./JsiSkMatrix";
|
2
3
|
import { JsiSkShader } from "./JsiSkShader";
|
3
4
|
export class JsiSkRuntimeEffect extends HostObject {
|
4
5
|
constructor(CanvasKit, ref) {
|
@@ -6,11 +7,11 @@ export class JsiSkRuntimeEffect extends HostObject {
|
|
6
7
|
}
|
7
8
|
|
8
9
|
makeShader(uniforms, localMatrix) {
|
9
|
-
return new JsiSkShader(this.CanvasKit, this.ref.makeShader(uniforms, localMatrix !== undefined ?
|
10
|
+
return new JsiSkShader(this.CanvasKit, this.ref.makeShader(uniforms, localMatrix !== undefined ? JsiSkMatrix.fromValue(localMatrix) : localMatrix));
|
10
11
|
}
|
11
12
|
|
12
13
|
makeShaderWithChildren(uniforms, children, localMatrix) {
|
13
|
-
return new JsiSkShader(this.CanvasKit, this.ref.makeShaderWithChildren(uniforms, children === null || children === void 0 ? void 0 : children.map(child =>
|
14
|
+
return new JsiSkShader(this.CanvasKit, this.ref.makeShaderWithChildren(uniforms, children === null || children === void 0 ? void 0 : children.map(child => JsiSkShader.fromValue(child)), localMatrix !== undefined ? JsiSkMatrix.fromValue(localMatrix) : localMatrix));
|
14
15
|
}
|
15
16
|
|
16
17
|
getUniform(index) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["JsiSkRuntimeEffect.ts"],"names":["HostObject","
|
1
|
+
{"version":3,"sources":["JsiSkRuntimeEffect.ts"],"names":["HostObject","JsiSkMatrix","JsiSkShader","JsiSkRuntimeEffect","constructor","CanvasKit","ref","makeShader","uniforms","localMatrix","undefined","fromValue","makeShaderWithChildren","children","map","child","getUniform","index","getUniformCount","getUniformFloatCount","getUniformName"],"mappings":"AAKA,SAASA,UAAT,QAA2B,QAA3B;AACA,SAASC,WAAT,QAA4B,eAA5B;AACA,SAASC,WAAT,QAA4B,eAA5B;AAEA,OAAO,MAAMC,kBAAN,SACGH,UADH,CAGP;AACEI,EAAAA,WAAW,CAACC,SAAD,EAAuBC,GAAvB,EAA2C;AACpD,UAAMD,SAAN,EAAiBC,GAAjB,EAAsB,eAAtB;AACD;;AAEDC,EAAAA,UAAU,CAACC,QAAD,EAAqBC,WAArB,EAA6C;AACrD,WAAO,IAAIP,WAAJ,CACL,KAAKG,SADA,EAEL,KAAKC,GAAL,CAASC,UAAT,CACEC,QADF,EAEEC,WAAW,KAAKC,SAAhB,GACIT,WAAW,CAACU,SAAZ,CAAsBF,WAAtB,CADJ,GAEIA,WAJN,CAFK,CAAP;AASD;;AAEDG,EAAAA,sBAAsB,CACpBJ,QADoB,EAEpBK,QAFoB,EAGpBJ,WAHoB,EAIpB;AACA,WAAO,IAAIP,WAAJ,CACL,KAAKG,SADA,EAEL,KAAKC,GAAL,CAASM,sBAAT,CACEJ,QADF,EAEEK,QAFF,aAEEA,QAFF,uBAEEA,QAAQ,CAAEC,GAAV,CAAeC,KAAD,IAAWb,WAAW,CAACS,SAAZ,CAAsBI,KAAtB,CAAzB,CAFF,EAGEN,WAAW,KAAKC,SAAhB,GACIT,WAAW,CAACU,SAAZ,CAAsBF,WAAtB,CADJ,GAEIA,WALN,CAFK,CAAP;AAUD;;AAEDO,EAAAA,UAAU,CAACC,KAAD,EAAgB;AACxB,WAAO,KAAKX,GAAL,CAASU,UAAT,CAAoBC,KAApB,CAAP;AACD;;AAEDC,EAAAA,eAAe,GAAG;AAChB,WAAO,KAAKZ,GAAL,CAASY,eAAT,EAAP;AACD;;AAEDC,EAAAA,oBAAoB,GAAG;AACrB,WAAO,KAAKb,GAAL,CAASa,oBAAT,EAAP;AACD;;AAEDC,EAAAA,cAAc,CAACH,KAAD,EAAgB;AAC5B,WAAO,KAAKX,GAAL,CAASc,cAAT,CAAwBH,KAAxB,CAAP;AACD;;AAhDH","sourcesContent":["import type { CanvasKit, RuntimeEffect } from \"canvaskit-wasm\";\n\nimport type { SkMatrix, SkShader } from \"../types\";\nimport type { SkRuntimeEffect } from \"../types/RuntimeEffect/RuntimeEffect\";\n\nimport { HostObject } from \"./Host\";\nimport { JsiSkMatrix } from \"./JsiSkMatrix\";\nimport { JsiSkShader } from \"./JsiSkShader\";\n\nexport class JsiSkRuntimeEffect\n extends HostObject<RuntimeEffect, \"RuntimeEffect\">\n implements SkRuntimeEffect\n{\n constructor(CanvasKit: CanvasKit, ref: RuntimeEffect) {\n super(CanvasKit, ref, \"RuntimeEffect\");\n }\n\n makeShader(uniforms: number[], localMatrix?: SkMatrix) {\n return new JsiSkShader(\n this.CanvasKit,\n this.ref.makeShader(\n uniforms,\n localMatrix !== undefined\n ? JsiSkMatrix.fromValue(localMatrix)\n : localMatrix\n )\n );\n }\n\n makeShaderWithChildren(\n uniforms: number[],\n children?: SkShader[],\n localMatrix?: SkMatrix\n ) {\n return new JsiSkShader(\n this.CanvasKit,\n this.ref.makeShaderWithChildren(\n uniforms,\n children?.map((child) => JsiSkShader.fromValue(child)),\n localMatrix !== undefined\n ? JsiSkMatrix.fromValue(localMatrix)\n : localMatrix\n )\n );\n }\n\n getUniform(index: number) {\n return this.ref.getUniform(index);\n }\n\n getUniformCount() {\n return this.ref.getUniformCount();\n }\n\n getUniformFloatCount() {\n return this.ref.getUniformFloatCount();\n }\n\n getUniformName(index: number) {\n return this.ref.getUniformName(index);\n }\n}\n"]}
|
@@ -1,4 +1,6 @@
|
|
1
|
-
import { Host,
|
1
|
+
import { Host, ckEnum } from "./Host";
|
2
|
+
import { JsiSkMatrix } from "./JsiSkMatrix";
|
3
|
+
import { JsiSkPoint } from "./JsiSkPoint";
|
2
4
|
import { JsiSkShader } from "./JsiSkShader";
|
3
5
|
export class JsiSkShaderFactory extends Host {
|
4
6
|
constructor(CanvasKit) {
|
@@ -6,19 +8,19 @@ export class JsiSkShaderFactory extends Host {
|
|
6
8
|
}
|
7
9
|
|
8
10
|
MakeLinearGradient(start, end, colors, pos, mode, localMatrix, flags) {
|
9
|
-
return new JsiSkShader(this.CanvasKit, this.CanvasKit.Shader.MakeLinearGradient(
|
11
|
+
return new JsiSkShader(this.CanvasKit, this.CanvasKit.Shader.MakeLinearGradient(JsiSkPoint.fromValue(start), JsiSkPoint.fromValue(end), colors, pos, ckEnum(mode), localMatrix === undefined ? undefined : JsiSkMatrix.fromValue(localMatrix), flags));
|
10
12
|
}
|
11
13
|
|
12
14
|
MakeRadialGradient(center, radius, colors, pos, mode, localMatrix, flags) {
|
13
|
-
return new JsiSkShader(this.CanvasKit, this.CanvasKit.Shader.MakeRadialGradient(
|
15
|
+
return new JsiSkShader(this.CanvasKit, this.CanvasKit.Shader.MakeRadialGradient(JsiSkPoint.fromValue(center), radius, colors, pos, ckEnum(mode), localMatrix === undefined ? undefined : JsiSkMatrix.fromValue(localMatrix), flags));
|
14
16
|
}
|
15
17
|
|
16
18
|
MakeTwoPointConicalGradient(start, startRadius, end, endRadius, colors, pos, mode, localMatrix, flags) {
|
17
|
-
return new JsiSkShader(this.CanvasKit, this.CanvasKit.Shader.MakeTwoPointConicalGradient(
|
19
|
+
return new JsiSkShader(this.CanvasKit, this.CanvasKit.Shader.MakeTwoPointConicalGradient(JsiSkPoint.fromValue(start), startRadius, JsiSkPoint.fromValue(end), endRadius, colors, pos, ckEnum(mode), localMatrix === undefined ? undefined : JsiSkMatrix.fromValue(localMatrix), flags));
|
18
20
|
}
|
19
21
|
|
20
22
|
MakeSweepGradient(cx, cy, colors, pos, mode, localMatrix, flags, startAngleInDegrees, endAngleInDegrees) {
|
21
|
-
return new JsiSkShader(this.CanvasKit, this.CanvasKit.Shader.MakeSweepGradient(cx, cy, colors, pos, ckEnum(mode), localMatrix === undefined || localMatrix === null ? undefined :
|
23
|
+
return new JsiSkShader(this.CanvasKit, this.CanvasKit.Shader.MakeSweepGradient(cx, cy, colors, pos, ckEnum(mode), localMatrix === undefined || localMatrix === null ? undefined : JsiSkMatrix.fromValue(localMatrix), flags, startAngleInDegrees, endAngleInDegrees));
|
22
24
|
}
|
23
25
|
|
24
26
|
MakeTurbulence(baseFreqX, baseFreqY, octaves, seed, tileW, tileH) {
|
@@ -30,11 +32,11 @@ export class JsiSkShaderFactory extends Host {
|
|
30
32
|
}
|
31
33
|
|
32
34
|
MakeBlend(mode, one, two) {
|
33
|
-
return new JsiSkShader(this.CanvasKit, this.CanvasKit.Shader.MakeBlend(ckEnum(mode),
|
35
|
+
return new JsiSkShader(this.CanvasKit, this.CanvasKit.Shader.MakeBlend(ckEnum(mode), JsiSkShader.fromValue(one), JsiSkShader.fromValue(two)));
|
34
36
|
}
|
35
37
|
|
36
38
|
MakeColor(color) {
|
37
|
-
return new JsiSkShader(this.CanvasKit, this.CanvasKit.Shader.MakeColor(
|
39
|
+
return new JsiSkShader(this.CanvasKit, this.CanvasKit.Shader.MakeColor(color, this.CanvasKit.ColorSpace.SRGB));
|
38
40
|
}
|
39
41
|
|
40
42
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["JsiSkShaderFactory.ts"],"names":["Host","
|
1
|
+
{"version":3,"sources":["JsiSkShaderFactory.ts"],"names":["Host","ckEnum","JsiSkMatrix","JsiSkPoint","JsiSkShader","JsiSkShaderFactory","constructor","CanvasKit","MakeLinearGradient","start","end","colors","pos","mode","localMatrix","flags","Shader","fromValue","undefined","MakeRadialGradient","center","radius","MakeTwoPointConicalGradient","startRadius","endRadius","MakeSweepGradient","cx","cy","startAngleInDegrees","endAngleInDegrees","MakeTurbulence","baseFreqX","baseFreqY","octaves","seed","tileW","tileH","M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L,CAAeS,MAAf,CAAsBc,cAAtB,CACEC,SADF,EAEEC,SAFF,EAGEC,OAHF,EAIEC,IAJF,EAKEC,KALF,EAMEC,KANF,CAFK,CAAP;AAWD;;AAEDC,EAAAA,gBAAgB,CACdN,SADc,EAEdC,SAFc,EAGdC,OAHc,EAIdC,IAJc,EAKdC,KALc,EAMdC,KANc,EAOd;AACA,WAAO,IAAIhC,WAAJ,CACL,KAAKG,SADA,EAEL,KAAKA,SAAL,CAAeS,MAAf,CAAsBqB,gBAAtB,CACEN,SADF,EAEEC,SAFF,EAGEC,OAHF,EAIEC,IAJF,EAKEC,KALF,EAMEC,KANF,CAFK,CAAP;AAWD;;AAEDE,EAAAA,SAAS,CAACzB,IAAD,EAAkB0B,GAAlB,EAAiCC,GAAjC,EAAgD;AACvD,WAAO,IAAIpC,WAAJ,CACL,KAAKG,SADA,EAEL,KAAKA,SAAL,CAAeS,MAAf,CAAsBsB,SAAtB,CACErC,MAAM,CAACY,IAAD,CADR,EAEET,WAAW,CAACa,SAAZ,CAAsBsB,GAAtB,CAFF,EAGEnC,WAAW,CAACa,SAAZ,CAAsBuB,GAAtB,CAHF,CAFK,CAAP;AAQD;;AAEDC,EAAAA,SAAS,CAACC,KAAD,EAAiB;AACxB,WAAO,IAAItC,WAAJ,CACL,KAAKG,SADA,EAEL,KAAKA,SAAL,CAAeS,MAAf,CAAsByB,SAAtB,CAAgCC,KAAhC,EAAuC,KAAKnC,SAAL,CAAeoC,UAAf,CAA0BC,IAAjE,CAFK,CAAP;AAID;;AA3KmE","sourcesContent":["import type { CanvasKit } from \"canvaskit-wasm\";\n\nimport type {\n BlendMode,\n SkColor,\n SkMatrix,\n SkPoint,\n SkShader,\n TileMode,\n} from \"../types\";\nimport type { ShaderFactory } from \"../types/Shader/ShaderFactory\";\n\nimport { Host, ckEnum } from \"./Host\";\nimport { JsiSkMatrix } from \"./JsiSkMatrix\";\nimport { JsiSkPoint } from \"./JsiSkPoint\";\nimport { JsiSkShader } from \"./JsiSkShader\";\n\nexport class JsiSkShaderFactory extends Host implements ShaderFactory {\n constructor(CanvasKit: CanvasKit) {\n super(CanvasKit);\n }\n\n MakeLinearGradient(\n start: SkPoint,\n end: SkPoint,\n colors: SkColor[],\n pos: number[] | null,\n mode: TileMode,\n localMatrix?: SkMatrix,\n flags?: number\n ) {\n return new JsiSkShader(\n this.CanvasKit,\n this.CanvasKit.Shader.MakeLinearGradient(\n JsiSkPoint.fromValue(start),\n JsiSkPoint.fromValue(end),\n colors,\n pos,\n ckEnum(mode),\n localMatrix === undefined\n ? undefined\n : JsiSkMatrix.fromValue(localMatrix),\n flags\n )\n );\n }\n\n MakeRadialGradient(\n center: SkPoint,\n radius: number,\n colors: SkColor[],\n pos: number[] | null,\n mode: TileMode,\n localMatrix?: SkMatrix,\n flags?: number\n ) {\n return new JsiSkShader(\n this.CanvasKit,\n this.CanvasKit.Shader.MakeRadialGradient(\n JsiSkPoint.fromValue(center),\n radius,\n colors,\n pos,\n ckEnum(mode),\n localMatrix === undefined\n ? undefined\n : JsiSkMatrix.fromValue(localMatrix),\n flags\n )\n );\n }\n\n MakeTwoPointConicalGradient(\n start: SkPoint,\n startRadius: number,\n end: SkPoint,\n endRadius: number,\n colors: SkColor[],\n pos: number[] | null,\n mode: TileMode,\n localMatrix?: SkMatrix,\n flags?: number\n ) {\n return new JsiSkShader(\n this.CanvasKit,\n this.CanvasKit.Shader.MakeTwoPointConicalGradient(\n JsiSkPoint.fromValue(start),\n startRadius,\n JsiSkPoint.fromValue(end),\n endRadius,\n colors,\n pos,\n ckEnum(mode),\n localMatrix === undefined\n ? undefined\n : JsiSkMatrix.fromValue(localMatrix),\n flags\n )\n );\n }\n\n MakeSweepGradient(\n cx: number,\n cy: number,\n colors: SkColor[],\n pos: number[] | null,\n mode: TileMode,\n localMatrix?: SkMatrix | null,\n flags?: number,\n startAngleInDegrees?: number,\n endAngleInDegrees?: number\n ) {\n return new JsiSkShader(\n this.CanvasKit,\n this.CanvasKit.Shader.MakeSweepGradient(\n cx,\n cy,\n colors,\n pos,\n ckEnum(mode),\n localMatrix === undefined || localMatrix === null\n ? undefined\n : JsiSkMatrix.fromValue(localMatrix),\n flags,\n startAngleInDegrees,\n endAngleInDegrees\n )\n );\n }\n\n MakeTurbulence(\n baseFreqX: number,\n baseFreqY: number,\n octaves: number,\n seed: number,\n tileW: number,\n tileH: number\n ) {\n return new JsiSkShader(\n this.CanvasKit,\n this.CanvasKit.Shader.MakeTurbulence(\n baseFreqX,\n baseFreqY,\n octaves,\n seed,\n tileW,\n tileH\n )\n );\n }\n\n MakeFractalNoise(\n baseFreqX: number,\n baseFreqY: number,\n octaves: number,\n seed: number,\n tileW: number,\n tileH: number\n ) {\n return new JsiSkShader(\n this.CanvasKit,\n this.CanvasKit.Shader.MakeFractalNoise(\n baseFreqX,\n baseFreqY,\n octaves,\n seed,\n tileW,\n tileH\n )\n );\n }\n\n MakeBlend(mode: BlendMode, one: SkShader, two: SkShader) {\n return new JsiSkShader(\n this.CanvasKit,\n this.CanvasKit.Shader.MakeBlend(\n ckEnum(mode),\n JsiSkShader.fromValue(one),\n JsiSkShader.fromValue(two)\n )\n );\n }\n\n MakeColor(color: SkColor) {\n return new JsiSkShader(\n this.CanvasKit,\n this.CanvasKit.Shader.MakeColor(color, this.CanvasKit.ColorSpace.SRGB)\n );\n }\n}\n"]}
|
@@ -1,6 +1,7 @@
|
|
1
|
-
import { HostObject
|
1
|
+
import { HostObject } from "./Host";
|
2
2
|
import { JsiSkCanvas } from "./JsiSkCanvas";
|
3
3
|
import { JsiSkImage } from "./JsiSkImage";
|
4
|
+
import { JsiSkRect } from "./JsiSkRect";
|
4
5
|
export class JsiSkSurface extends HostObject {
|
5
6
|
constructor(CanvasKit, ref) {
|
6
7
|
super(CanvasKit, ref, "Surface");
|
@@ -11,7 +12,7 @@ export class JsiSkSurface extends HostObject {
|
|
11
12
|
}
|
12
13
|
|
13
14
|
makeImageSnapshot(bounds) {
|
14
|
-
const image = this.ref.makeImageSnapshot(
|
15
|
+
const image = this.ref.makeImageSnapshot(bounds ? Array.from(JsiSkRect.fromValue(this.CanvasKit, bounds)) : undefined);
|
15
16
|
return new JsiSkImage(this.CanvasKit, image);
|
16
17
|
}
|
17
18
|
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["JsiSkSurface.ts"],"names":["HostObject","
|
1
|
+
{"version":3,"sources":["JsiSkSurface.ts"],"names":["HostObject","JsiSkCanvas","JsiSkImage","JsiSkRect","JsiSkSurface","constructor","CanvasKit","ref","getCanvas","makeImageSnapshot","bounds","image","Array","from","fromValue","undefined"],"mappings":"AAIA,SAASA,UAAT,QAA2B,QAA3B;AACA,SAASC,WAAT,QAA4B,eAA5B;AACA,SAASC,UAAT,QAA2B,cAA3B;AACA,SAASC,SAAT,QAA0B,aAA1B;AAEA,OAAO,MAAMC,YAAN,SACGJ,UADH,CAGP;AACEK,EAAAA,WAAW,CAACC,SAAD,EAAuBC,GAAvB,EAAqC;AAC9C,UAAMD,SAAN,EAAiBC,GAAjB,EAAsB,SAAtB;AACD;;AAEDC,EAAAA,SAAS,GAAa;AACpB,WAAO,IAAIP,WAAJ,CAAgB,KAAKK,SAArB,EAAgC,KAAKC,GAAL,CAASC,SAAT,EAAhC,CAAP;AACD;;AAEDC,EAAAA,iBAAiB,CAACC,MAAD,EAA2B;AAC1C,UAAMC,KAAK,GAAG,KAAKJ,GAAL,CAASE,iBAAT,CACZC,MAAM,GACFE,KAAK,CAACC,IAAN,CAAWV,SAAS,CAACW,SAAV,CAAoB,KAAKR,SAAzB,EAAoCI,MAApC,CAAX,CADE,GAEFK,SAHQ,CAAd;AAKA,WAAO,IAAIb,UAAJ,CAAe,KAAKI,SAApB,EAA+BK,KAA/B,CAAP;AACD;;AAhBH","sourcesContent":["import type { CanvasKit, Surface } from \"canvaskit-wasm\";\n\nimport type { SkCanvas, SkImage, SkRect, SkSurface } from \"../types\";\n\nimport { HostObject } from \"./Host\";\nimport { JsiSkCanvas } from \"./JsiSkCanvas\";\nimport { JsiSkImage } from \"./JsiSkImage\";\nimport { JsiSkRect } from \"./JsiSkRect\";\n\nexport class JsiSkSurface\n extends HostObject<Surface, \"Surface\">\n implements SkSurface\n{\n constructor(CanvasKit: CanvasKit, ref: Surface) {\n super(CanvasKit, ref, \"Surface\");\n }\n\n getCanvas(): SkCanvas {\n return new JsiSkCanvas(this.CanvasKit, this.ref.getCanvas());\n }\n\n makeImageSnapshot(bounds?: SkRect): SkImage {\n const image = this.ref.makeImageSnapshot(\n bounds\n ? Array.from(JsiSkRect.fromValue(this.CanvasKit, bounds))\n : undefined\n );\n return new JsiSkImage(this.CanvasKit, image);\n }\n}\n"]}
|
@@ -1,24 +1,26 @@
|
|
1
|
-
import { Host
|
1
|
+
import { Host } from "./Host";
|
2
|
+
import { JsiSkFont } from "./JsiSkFont";
|
2
3
|
import { JsiSkTextBlob } from "./JsiSkTextBlob";
|
4
|
+
import { JsiSkRSXform } from "./JsiSkRSXform";
|
3
5
|
export class JsiSkTextBlobFactory extends Host {
|
4
6
|
constructor(CanvasKit) {
|
5
7
|
super(CanvasKit);
|
6
8
|
}
|
7
9
|
|
8
10
|
MakeFromText(str, font) {
|
9
|
-
return new JsiSkTextBlob(this.CanvasKit, this.CanvasKit.TextBlob.MakeFromText(str,
|
11
|
+
return new JsiSkTextBlob(this.CanvasKit, this.CanvasKit.TextBlob.MakeFromText(str, JsiSkFont.fromValue(font)));
|
10
12
|
}
|
11
13
|
|
12
14
|
MakeFromGlyphs(glyphs, font) {
|
13
|
-
return new JsiSkTextBlob(this.CanvasKit, this.CanvasKit.TextBlob.MakeFromGlyphs(glyphs,
|
15
|
+
return new JsiSkTextBlob(this.CanvasKit, this.CanvasKit.TextBlob.MakeFromGlyphs(glyphs, JsiSkFont.fromValue(font)));
|
14
16
|
}
|
15
17
|
|
16
18
|
MakeFromRSXform(str, rsxforms, font) {
|
17
|
-
return new JsiSkTextBlob(this.CanvasKit, this.CanvasKit.TextBlob.MakeFromRSXform(str, rsxforms.map(f => Array.from(
|
19
|
+
return new JsiSkTextBlob(this.CanvasKit, this.CanvasKit.TextBlob.MakeFromRSXform(str, rsxforms.map(f => Array.from(JsiSkRSXform.fromValue(f))).flat(), JsiSkFont.fromValue(font)));
|
18
20
|
}
|
19
21
|
|
20
22
|
MakeFromRSXformGlyphs(glyphs, rsxforms, font) {
|
21
|
-
return new JsiSkTextBlob(this.CanvasKit, this.CanvasKit.TextBlob.MakeFromRSXformGlyphs(glyphs, rsxforms.map(f =>
|
23
|
+
return new JsiSkTextBlob(this.CanvasKit, this.CanvasKit.TextBlob.MakeFromRSXformGlyphs(glyphs, rsxforms.map(f => JsiSkRSXform.fromValue(f)), JsiSkFont.fromValue(font)));
|
22
24
|
}
|
23
25
|
|
24
26
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["JsiSkTextBlobFactory.ts"],"names":["Host","
|
1
|
+
{"version":3,"sources":["JsiSkTextBlobFactory.ts"],"names":["Host","JsiSkFont","JsiSkTextBlob","JsiSkRSXform","JsiSkTextBlobFactory","constructor","CanvasKit","MakeFromText","str","font","TextBlob","fromValue","MakeFromGlyphs","glyphs","MakeFromRSXform","rsxforms","map","f","Array","from","flat","MakeFromRSXformGlyphs"],"mappings":"AAMA,SAASA,IAAT,QAAqB,QAArB;AACA,SAASC,SAAT,QAA0B,aAA1B;AACA,SAASC,aAAT,QAA8B,iBAA9B;AAEA,SAASC,YAAT,QAA6B,gBAA7B;AAEA,OAAO,MAAMC,oBAAN,SAAmCJ,IAAnC,CAAmE;AACxEK,EAAAA,WAAW,CAACC,SAAD,EAAuB;AAChC,UAAMA,SAAN;AACD;;AAEDC,EAAAA,YAAY,CAACC,GAAD,EAAcC,IAAd,EAA4B;AACtC,WAAO,IAAIP,aAAJ,CACL,KAAKI,SADA,EAEL,KAAKA,SAAL,CAAeI,QAAf,CAAwBH,YAAxB,CAAqCC,GAArC,EAA0CP,SAAS,CAACU,SAAV,CAAoBF,IAApB,CAA1C,CAFK,CAAP;AAID;;AAEDG,EAAAA,cAAc,CAACC,MAAD,EAAmBJ,IAAnB,EAAiC;AAC7C,WAAO,IAAIP,aAAJ,CACL,KAAKI,SADA,EAEL,KAAKA,SAAL,CAAeI,QAAf,CAAwBE,cAAxB,CAAuCC,MAAvC,EAA+CZ,SAAS,CAACU,SAAV,CAAoBF,IAApB,CAA/C,CAFK,CAAP;AAID;;AAEDK,EAAAA,eAAe,CAACN,GAAD,EAAcO,QAAd,EAAqCN,IAArC,EAAmD;AAChE,WAAO,IAAIP,aAAJ,CACL,KAAKI,SADA,EAEL,KAAKA,SAAL,CAAeI,QAAf,CAAwBI,eAAxB,CACEN,GADF,EAEEO,QAAQ,CACLC,GADH,CACQC,CAAD,IAAOC,KAAK,CAACC,IAAN,CAAWhB,YAAY,CAACQ,SAAb,CAAgCM,CAAhC,CAAX,CADd,EAEGG,IAFH,EAFF,EAKEnB,SAAS,CAACU,SAAV,CAAoBF,IAApB,CALF,CAFK,CAAP;AAUD;;AAEDY,EAAAA,qBAAqB,CAACR,MAAD,EAAmBE,QAAnB,EAA0CN,IAA1C,EAAwD;AAC3E,WAAO,IAAIP,aAAJ,CACL,KAAKI,SADA,EAEL,KAAKA,SAAL,CAAeI,QAAf,CAAwBW,qBAAxB,CACER,MADF,EAEEE,QAAQ,CAACC,GAAT,CAAcC,CAAD,IAAOd,YAAY,CAACQ,SAAb,CAAuBM,CAAvB,CAApB,CAFF,EAGEhB,SAAS,CAACU,SAAV,CAAoBF,IAApB,CAHF,CAFK,CAAP;AAQD;;AAzCuE","sourcesContent":["import type { CanvasKit } from \"canvaskit-wasm\";\n\nimport type { SkFont } from \"../types\";\nimport type { TextBlobFactory } from \"../types/TextBlob\";\nimport type { SkRSXform } from \"../types/RSXform\";\n\nimport { Host } from \"./Host\";\nimport { JsiSkFont } from \"./JsiSkFont\";\nimport { JsiSkTextBlob } from \"./JsiSkTextBlob\";\nimport type { RSXform } from \"./JsiSkRSXform\";\nimport { JsiSkRSXform } from \"./JsiSkRSXform\";\n\nexport class JsiSkTextBlobFactory extends Host implements TextBlobFactory {\n constructor(CanvasKit: CanvasKit) {\n super(CanvasKit);\n }\n\n MakeFromText(str: string, font: SkFont) {\n return new JsiSkTextBlob(\n this.CanvasKit,\n this.CanvasKit.TextBlob.MakeFromText(str, JsiSkFont.fromValue(font))\n );\n }\n\n MakeFromGlyphs(glyphs: number[], font: SkFont) {\n return new JsiSkTextBlob(\n this.CanvasKit,\n this.CanvasKit.TextBlob.MakeFromGlyphs(glyphs, JsiSkFont.fromValue(font))\n );\n }\n\n MakeFromRSXform(str: string, rsxforms: SkRSXform[], font: SkFont) {\n return new JsiSkTextBlob(\n this.CanvasKit,\n this.CanvasKit.TextBlob.MakeFromRSXform(\n str,\n rsxforms\n .map((f) => Array.from(JsiSkRSXform.fromValue<RSXform>(f)))\n .flat(),\n JsiSkFont.fromValue(font)\n )\n );\n }\n\n MakeFromRSXformGlyphs(glyphs: number[], rsxforms: SkRSXform[], font: SkFont) {\n return new JsiSkTextBlob(\n this.CanvasKit,\n this.CanvasKit.TextBlob.MakeFromRSXformGlyphs(\n glyphs,\n rsxforms.map((f) => JsiSkRSXform.fromValue(f)),\n JsiSkFont.fromValue(font)\n )\n );\n }\n}\n"]}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { Host
|
1
|
+
import { Host } from "./Host";
|
2
2
|
import { JsiSkTypeface } from "./JsiSkTypeface";
|
3
3
|
export class JsiSkTypefaceFactory extends Host {
|
4
4
|
constructor(CanvasKit) {
|
@@ -6,7 +6,7 @@ export class JsiSkTypefaceFactory extends Host {
|
|
6
6
|
}
|
7
7
|
|
8
8
|
MakeFreeTypeFaceFromData(data) {
|
9
|
-
const tf = this.CanvasKit.Typeface.MakeFreeTypeFaceFromData(
|
9
|
+
const tf = this.CanvasKit.Typeface.MakeFreeTypeFaceFromData(JsiSkTypeface.fromValue(data));
|
10
10
|
|
11
11
|
if (tf === null) {
|
12
12
|
return null;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["JsiSkTypefaceFactory.tsx"],"names":["Host","
|
1
|
+
{"version":3,"sources":["JsiSkTypefaceFactory.tsx"],"names":["Host","JsiSkTypeface","JsiSkTypefaceFactory","constructor","CanvasKit","MakeFreeTypeFaceFromData","data","tf","Typeface","fromValue"],"mappings":"AAIA,SAASA,IAAT,QAAqB,QAArB;AACA,SAASC,aAAT,QAA8B,iBAA9B;AAEA,OAAO,MAAMC,oBAAN,SAAmCF,IAAnC,CAAmE;AACxEG,EAAAA,WAAW,CAACC,SAAD,EAAuB;AAChC,UAAMA,SAAN;AACD;;AAEDC,EAAAA,wBAAwB,CAACC,IAAD,EAAe;AACrC,UAAMC,EAAE,GAAG,KAAKH,SAAL,CAAeI,QAAf,CAAwBH,wBAAxB,CACTJ,aAAa,CAACQ,SAAd,CAAwBH,IAAxB,CADS,CAAX;;AAGA,QAAIC,EAAE,KAAK,IAAX,EAAiB;AACf,aAAO,IAAP;AACD;;AACD,WAAO,IAAIN,aAAJ,CAAkB,KAAKG,SAAvB,EAAkCG,EAAlC,CAAP;AACD;;AAbuE","sourcesContent":["import type { CanvasKit } from \"canvaskit-wasm\";\n\nimport type { SkData, TypefaceFactory } from \"../types\";\n\nimport { Host } from \"./Host\";\nimport { JsiSkTypeface } from \"./JsiSkTypeface\";\n\nexport class JsiSkTypefaceFactory extends Host implements TypefaceFactory {\n constructor(CanvasKit: CanvasKit) {\n super(CanvasKit);\n }\n\n MakeFreeTypeFaceFromData(data: SkData) {\n const tf = this.CanvasKit.Typeface.MakeFreeTypeFaceFromData(\n JsiSkTypeface.fromValue(data)\n );\n if (tf === null) {\n return null;\n }\n return new JsiSkTypeface(this.CanvasKit, tf);\n }\n}\n"]}
|
@@ -5,7 +5,6 @@ import { Color } from "./JsiSkColor";
|
|
5
5
|
import { JsiSkSurfaceFactory } from "./JsiSkSurfaceFactory";
|
6
6
|
import { JsiSkRRect } from "./JsiSkRRect";
|
7
7
|
import { JsiSkRSXform } from "./JsiSkRSXform";
|
8
|
-
import { toValue } from "./Host";
|
9
8
|
import { JsiSkContourMeasureIter } from "./JsiSkContourMeasureIter";
|
10
9
|
import { JsiSkPictureRecorder } from "./JsiSkPictureRecorder";
|
11
10
|
import { JsiSkPictureFactory } from "./JsiSkPictureFactory";
|
@@ -24,22 +23,28 @@ import { JsiSkSVGFactory } from "./JsiSkSVGFactory";
|
|
24
23
|
import { JsiSkTextBlobFactory } from "./JsiSkTextBlobFactory";
|
25
24
|
import { JsiSkFont } from "./JsiSkFont";
|
26
25
|
import { MakeVertices } from "./JsiSkVerticesFactory";
|
26
|
+
import { JsiSkPath } from "./JsiSkPath";
|
27
|
+
import { JsiSkTypeface } from "./JsiSkTypeface";
|
27
28
|
export const JsiSkApi = CanvasKit => ({
|
28
29
|
Point: (x, y) => new JsiSkPoint(CanvasKit, Float32Array.of(x, y)),
|
29
30
|
RuntimeShaderBuilder: _ => {
|
30
31
|
throw new Error("Not implemented on React Native Web");
|
31
32
|
},
|
32
|
-
RRectXY: (rect, rx, ry) => new JsiSkRRect(CanvasKit, CanvasKit.RRectXY(
|
33
|
+
RRectXY: (rect, rx, ry) => new JsiSkRRect(CanvasKit, CanvasKit.RRectXY(JsiSkRect.fromValue(CanvasKit, rect), rx, ry)),
|
33
34
|
RSXform: (scos, ssin, tx, ty) => new JsiSkRSXform(CanvasKit, Float32Array.of(scos, ssin, tx, ty)),
|
34
35
|
Color,
|
35
|
-
ContourMeasureIter: (path, forceClosed, resScale) => new JsiSkContourMeasureIter(CanvasKit, new CanvasKit.ContourMeasureIter(
|
36
|
-
Paint: () =>
|
36
|
+
ContourMeasureIter: (path, forceClosed, resScale) => new JsiSkContourMeasureIter(CanvasKit, new CanvasKit.ContourMeasureIter(JsiSkPath.fromValue(path), forceClosed, resScale)),
|
37
|
+
Paint: () => {
|
38
|
+
const paint = new JsiSkPaint(CanvasKit, new CanvasKit.Paint());
|
39
|
+
paint.setAntiAlias(true);
|
40
|
+
return paint;
|
41
|
+
},
|
37
42
|
PictureRecorder: () => new JsiSkPictureRecorder(CanvasKit, new CanvasKit.PictureRecorder()),
|
38
43
|
Picture: new JsiSkPictureFactory(CanvasKit),
|
39
44
|
Path: new JsiSkPathFactory(CanvasKit),
|
40
45
|
Matrix: matrix => new JsiSkMatrix(CanvasKit, matrix ? Float32Array.of(...matrix) : Float32Array.of(...CanvasKit.Matrix.identity())),
|
41
46
|
ColorFilter: new JsiSkColorFilterFactory(CanvasKit),
|
42
|
-
Font: (typeface, size) => new JsiSkFont(CanvasKit, new CanvasKit.Font(typeface === undefined ? null :
|
47
|
+
Font: (typeface, size) => new JsiSkFont(CanvasKit, new CanvasKit.Font(typeface === undefined ? null : JsiSkTypeface.fromValue(typeface), size)),
|
43
48
|
Typeface: new JsiSkTypefaceFactory(CanvasKit),
|
44
49
|
MaskFilter: new JsiSkMaskFilterFactory(CanvasKit),
|
45
50
|
RuntimeEffect: new JsiSkRuntimeEffectFactory(CanvasKit),
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["JsiSkia.ts"],"names":["JsiSkPoint","JsiSkPaint","JsiSkRect","Color","JsiSkSurfaceFactory","JsiSkRRect","JsiSkRSXform","
|
1
|
+
{"version":3,"sources":["JsiSkia.ts"],"names":["JsiSkPoint","JsiSkPaint","JsiSkRect","Color","JsiSkSurfaceFactory","JsiSkRRect","JsiSkRSXform","JsiSkContourMeasureIter","JsiSkPictureRecorder","JsiSkPictureFactory","JsiSkPathFactory","JsiSkMatrix","JsiSkColorFilterFactory","JsiSkTypefaceFactory","JsiSkMaskFilterFactory","JsiSkRuntimeEffectFactory","JsiSkImageFilterFactory","JsiSkShaderFactory","JsiSkPathEffectFactory","JsiSkDataFactory","JsiSkImageFactory","JsiSkSVGFactory","JsiSkTextBlobFactory","JsiSkFont","MakeVertices","JsiSkPath","JsiSkTypeface","JsiSkApi","CanvasKit","Point","x","y","Float32Array","of","RuntimeShaderBuilder","_","Error","RRectXY","rect","rx","ry","fromValue","RSXform","scos","ssin","tx","ty","ContourMeasureIter","path","forceClosed","resScale","Paint","paint","setAntiAlias","PictureRecorder","Picture","Path","Matrix","matrix","identity","ColorFilter","Font","typeface","size","undefined","Typeface","MaskFilter","RuntimeEffect","ImageFilter","Shader","PathEffect","bind","Data","Image","SVG","TextBlob","XYWHRect","width","height","Surface"],"mappings":"AAYA,SAASA,UAAT,QAA2B,cAA3B;AACA,SAASC,UAAT,QAA2B,cAA3B;AACA,SAASC,SAAT,QAA0B,aAA1B;AACA,SAASC,KAAT,QAAsB,cAAtB;AACA,SAASC,mBAAT,QAAoC,uBAApC;AACA,SAASC,UAAT,QAA2B,cAA3B;AACA,SAASC,YAAT,QAA6B,gBAA7B;AACA,SAASC,uBAAT,QAAwC,2BAAxC;AACA,SAASC,oBAAT,QAAqC,wBAArC;AACA,SAASC,mBAAT,QAAoC,uBAApC;AACA,SAASC,gBAAT,QAAiC,oBAAjC;AACA,SAASC,WAAT,QAA4B,eAA5B;AACA,SAASC,uBAAT,QAAwC,2BAAxC;AACA,SAASC,oBAAT,QAAqC,wBAArC;AACA,SAASC,sBAAT,QAAuC,0BAAvC;AACA,SAASC,yBAAT,QAA0C,6BAA1C;AACA,SAASC,uBAAT,QAAwC,2BAAxC;AACA,SAASC,kBAAT,QAAmC,sBAAnC;AACA,SAASC,sBAAT,QAAuC,0BAAvC;AACA,SAASC,gBAAT,QAAiC,oBAAjC;AACA,SAASC,iBAAT,QAAkC,qBAAlC;AACA,SAASC,eAAT,QAAgC,mBAAhC;AACA,SAASC,oBAAT,QAAqC,wBAArC;AACA,SAASC,SAAT,QAA0B,aAA1B;AACA,SAASC,YAAT,QAA6B,wBAA7B;AACA,SAASC,SAAT,QAA0B,aAA1B;AACA,SAASC,aAAT,QAA8B,iBAA9B;AAEA,OAAO,MAAMC,QAAQ,GAAIC,SAAD,KAAiC;AACvDC,EAAAA,KAAK,EAAE,CAACC,CAAD,EAAYC,CAAZ,KACL,IAAI/B,UAAJ,CAAe4B,SAAf,EAA0BI,YAAY,CAACC,EAAb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iD;AA4DvD6C,EAAAA,KAAK,EAAE,IAAIrD,iBAAJ,CAAsBQ,SAAtB,CA5DgD;AA6DvD8C,EAAAA,GAAG,EAAE,IAAIrD,eAAJ,CAAoBO,SAApB,CA7DkD;AA8DvD+C,EAAAA,QAAQ,EAAE,IAAIrD,oBAAJ,CAAyBM,SAAzB,CA9D6C;AA+DvDgD,EAAAA,QAAQ,EAAE,CAAC9C,CAAD,EAAYC,CAAZ,EAAuB8C,KAAvB,EAAsCC,MAAtC,KAAyD;AACjE,WAAO,IAAI5E,SAAJ,CAAc0B,SAAd,EAAyBA,SAAS,CAACgD,QAAV,CAAmB9C,CAAnB,EAAsBC,CAAtB,EAAyB8C,KAAzB,EAAgCC,MAAhC,CAAzB,CAAP;AACD,GAjEsD;AAkEvDC,EAAAA,OAAO,EAAE,IAAI3E,mBAAJ,CAAwBwB,SAAxB;AAlE8C,CAAjC,CAAjB","sourcesContent":["import type { CanvasKit } from \"canvaskit-wasm\";\n\nimport type {\n SkContourMeasureIter,\n Skia,\n SkPath,\n SkRect,\n SkRuntimeEffect,\n SkRuntimeShaderBuilder,\n SkTypeface,\n} from \"../types\";\n\nimport { JsiSkPoint } from \"./JsiSkPoint\";\nimport { JsiSkPaint } from \"./JsiSkPaint\";\nimport { JsiSkRect } from \"./JsiSkRect\";\nimport { Color } from \"./JsiSkColor\";\nimport { JsiSkSurfaceFactory } from \"./JsiSkSurfaceFactory\";\nimport { JsiSkRRect } from \"./JsiSkRRect\";\nimport { JsiSkRSXform } from \"./JsiSkRSXform\";\nimport { JsiSkContourMeasureIter } from \"./JsiSkContourMeasureIter\";\nimport { JsiSkPictureRecorder } from \"./JsiSkPictureRecorder\";\nimport { JsiSkPictureFactory } from \"./JsiSkPictureFactory\";\nimport { JsiSkPathFactory } from \"./JsiSkPathFactory\";\nimport { JsiSkMatrix } from \"./JsiSkMatrix\";\nimport { JsiSkColorFilterFactory } from \"./JsiSkColorFilterFactory\";\nimport { JsiSkTypefaceFactory } from \"./JsiSkTypefaceFactory\";\nimport { JsiSkMaskFilterFactory } from \"./JsiSkMaskFilterFactory\";\nimport { JsiSkRuntimeEffectFactory } from \"./JsiSkRuntimeEffectFactory\";\nimport { JsiSkImageFilterFactory } from \"./JsiSkImageFilterFactory\";\nimport { JsiSkShaderFactory } from \"./JsiSkShaderFactory\";\nimport { JsiSkPathEffectFactory } from \"./JsiSkPathEffectFactory\";\nimport { JsiSkDataFactory } from \"./JsiSkDataFactory\";\nimport { JsiSkImageFactory } from \"./JsiSkImageFactory\";\nimport { JsiSkSVGFactory } from \"./JsiSkSVGFactory\";\nimport { JsiSkTextBlobFactory } from \"./JsiSkTextBlobFactory\";\nimport { JsiSkFont } from \"./JsiSkFont\";\nimport { MakeVertices } from \"./JsiSkVerticesFactory\";\nimport { JsiSkPath } from \"./JsiSkPath\";\nimport { JsiSkTypeface } from \"./JsiSkTypeface\";\n\nexport const JsiSkApi = (CanvasKit: CanvasKit): Skia => ({\n Point: (x: number, y: number) =>\n new JsiSkPoint(CanvasKit, Float32Array.of(x, y)),\n RuntimeShaderBuilder: (_: SkRuntimeEffect): SkRuntimeShaderBuilder => {\n throw new Error(\"Not implemented on React Native Web\");\n },\n RRectXY: (rect: SkRect, rx: number, ry: number) =>\n new JsiSkRRect(\n CanvasKit,\n CanvasKit.RRectXY(JsiSkRect.fromValue(CanvasKit, rect), rx, ry)\n ),\n RSXform: (scos: number, ssin: number, tx: number, ty: number) =>\n new JsiSkRSXform(CanvasKit, Float32Array.of(scos, ssin, tx, ty)),\n Color,\n ContourMeasureIter: (\n path: SkPath,\n forceClosed: boolean,\n resScale: number\n ): SkContourMeasureIter =>\n new JsiSkContourMeasureIter(\n CanvasKit,\n new CanvasKit.ContourMeasureIter(\n JsiSkPath.fromValue(path),\n forceClosed,\n resScale\n )\n ),\n Paint: () => {\n const paint = new JsiSkPaint(CanvasKit, new CanvasKit.Paint());\n paint.setAntiAlias(true);\n return paint;\n },\n PictureRecorder: () =>\n new JsiSkPictureRecorder(CanvasKit, new CanvasKit.PictureRecorder()),\n Picture: new JsiSkPictureFactory(CanvasKit),\n Path: new JsiSkPathFactory(CanvasKit),\n Matrix: (matrix?: readonly number[]) =>\n new JsiSkMatrix(\n CanvasKit,\n matrix\n ? Float32Array.of(...matrix)\n : Float32Array.of(...CanvasKit.Matrix.identity())\n ),\n ColorFilter: new JsiSkColorFilterFactory(CanvasKit),\n Font: (typeface?: SkTypeface, size?: number) =>\n new JsiSkFont(\n CanvasKit,\n new CanvasKit.Font(\n typeface === undefined ? null : JsiSkTypeface.fromValue(typeface),\n size\n )\n ),\n Typeface: new JsiSkTypefaceFactory(CanvasKit),\n MaskFilter: new JsiSkMaskFilterFactory(CanvasKit),\n RuntimeEffect: new JsiSkRuntimeEffectFactory(CanvasKit),\n ImageFilter: new JsiSkImageFilterFactory(CanvasKit),\n Shader: new JsiSkShaderFactory(CanvasKit),\n PathEffect: new JsiSkPathEffectFactory(CanvasKit),\n MakeVertices: MakeVertices.bind(null, CanvasKit),\n Data: new JsiSkDataFactory(CanvasKit),\n Image: new JsiSkImageFactory(CanvasKit),\n SVG: new JsiSkSVGFactory(CanvasKit),\n TextBlob: new JsiSkTextBlobFactory(CanvasKit),\n XYWHRect: (x: number, y: number, width: number, height: number) => {\n return new JsiSkRect(CanvasKit, CanvasKit.XYWHRect(x, y, width, height));\n },\n Surface: new JsiSkSurfaceFactory(CanvasKit),\n});\n"]}
|
@@ -19,8 +19,8 @@ export class SkiaView extends React.Component {
|
|
19
19
|
} = props;
|
20
20
|
|
21
21
|
if (onDraw) {
|
22
|
-
|
23
|
-
SkiaViewApi.
|
22
|
+
assertSkiaViewApi();
|
23
|
+
SkiaViewApi.setJsiProperty(this._nativeId, "drawCallback", onDraw);
|
24
24
|
}
|
25
25
|
}
|
26
26
|
|
@@ -34,8 +34,8 @@ export class SkiaView extends React.Component {
|
|
34
34
|
} = this.props;
|
35
35
|
|
36
36
|
if (onDraw !== prevProps.onDraw) {
|
37
|
-
|
38
|
-
SkiaViewApi.
|
37
|
+
assertSkiaViewApi();
|
38
|
+
SkiaViewApi.setJsiProperty(this._nativeId, "drawCallback", onDraw);
|
39
39
|
}
|
40
40
|
}
|
41
41
|
/**
|
@@ -46,7 +46,7 @@ export class SkiaView extends React.Component {
|
|
46
46
|
|
47
47
|
|
48
48
|
makeImageSnapshot(rect) {
|
49
|
-
|
49
|
+
assertSkiaViewApi();
|
50
50
|
return SkiaViewApi.makeImageSnapshot(this._nativeId, rect);
|
51
51
|
}
|
52
52
|
/**
|
@@ -55,23 +55,8 @@ export class SkiaView extends React.Component {
|
|
55
55
|
|
56
56
|
|
57
57
|
redraw() {
|
58
|
-
|
59
|
-
SkiaViewApi.
|
60
|
-
}
|
61
|
-
/**
|
62
|
-
* Updates the drawing mode for the skia view. This is the same
|
63
|
-
* as declaratively setting the mode property on the SkiaView.
|
64
|
-
* There are two drawing modes, "continuous" and "default",
|
65
|
-
* where the continuous mode will continuously redraw the view and
|
66
|
-
* the default mode will only redraw when any of the regular react
|
67
|
-
* properties are changed like size and margins.
|
68
|
-
* @param mode Drawing mode to use.
|
69
|
-
*/
|
70
|
-
|
71
|
-
|
72
|
-
setDrawMode(mode) {
|
73
|
-
assertDrawCallbacksEnabled();
|
74
|
-
SkiaViewApi.setDrawMode(this._nativeId, mode);
|
58
|
+
assertSkiaViewApi();
|
59
|
+
SkiaViewApi.requestRedraw(this._nativeId);
|
75
60
|
}
|
76
61
|
/**
|
77
62
|
* Registers one or move values as a dependant value of the Skia View. The view will
|
@@ -81,7 +66,7 @@ export class SkiaView extends React.Component {
|
|
81
66
|
|
82
67
|
|
83
68
|
registerValues(values) {
|
84
|
-
|
69
|
+
assertSkiaViewApi();
|
85
70
|
return SkiaViewApi.registerValuesInView(this._nativeId, values);
|
86
71
|
}
|
87
72
|
|
@@ -101,9 +86,9 @@ export class SkiaView extends React.Component {
|
|
101
86
|
|
102
87
|
}
|
103
88
|
|
104
|
-
const
|
105
|
-
if (SkiaViewApi === null || SkiaViewApi.
|
106
|
-
throw Error("Skia Api
|
89
|
+
const assertSkiaViewApi = () => {
|
90
|
+
if (SkiaViewApi === null || SkiaViewApi.setJsiProperty === null || SkiaViewApi.callJsiMethod === null || SkiaViewApi.registerValuesInView === null || SkiaViewApi.requestRedraw === null || SkiaViewApi.makeImageSnapshot === null) {
|
91
|
+
throw Error("Skia View Api was not found.");
|
107
92
|
}
|
108
93
|
};
|
109
94
|
//# sourceMappingURL=SkiaView.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["SkiaView.tsx"],"names":["React","requireNativeComponent","SkiaViewApi","SkiaViewNativeId","NativeSkiaView","SkiaView","Component","constructor","props","_nativeId","onDraw","
|
1
|
+
{"version":3,"sources":["SkiaView.tsx"],"names":["React","requireNativeComponent","SkiaViewApi","SkiaViewNativeId","NativeSkiaView","SkiaView","Component","constructor","props","_nativeId","onDraw","assertSkiaViewApi","setJsiProperty","nativeId","componentDidUpdate","prevProps","makeImageSnapshot","rect","redraw","requestRedraw","registerValues","values","registerValuesInView","render","mode","debug","viewProps","callJsiMethod","Error"],"mappings":";;;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAASC,sBAAT,QAAuC,cAAvC;AAKA,SAASC,WAAT,QAA4B,OAA5B;AAGA,IAAIC,gBAAgB,GAAG,IAAvB;AAEA,MAAMC,cAAc,GAAGH,sBAAsB,CAC3C,qBAD2C,CAA7C;AAIA,OAAO,MAAMI,QAAN,SAAuBL,KAAK,CAACM,SAA7B,CAAsD;AAC3DC,EAAAA,WAAW,CAACC,KAAD,EAAuB;AAChC,UAAMA,KAAN;;AADgC;;AAEhC,SAAKC,SAAL,GAAiBN,gBAAgB,EAAjC;AACA,UAAM;AAAEO,MAAAA;AAAF,QAAaF,KAAnB;;AACA,QAAIE,MAAJ,EAAY;AACVC,MAAAA,iBAAiB;AACjBT,MAAAA,WAAW,CAACU,cAAZ,CAA2B,KAAKH,SAAhC,EAA2C,cAA3C,EAA2DC,MAA3D;AACD;AACF;;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B,IAD/B,IAEAV,WAAW,CAACyB,aAAZ,KAA8B,IAF9B,IAGAzB,WAAW,CAACoB,oBAAZ,KAAqC,IAHrC,IAIApB,WAAW,CAACiB,aAAZ,KAA8B,IAJ9B,IAKAjB,WAAW,CAACc,iBAAZ,KAAkC,IANpC,EAOE;AACA,UAAMY,KAAK,CAAC,8BAAD,CAAX;AACD;AACF,CAXD","sourcesContent":["import React from \"react\";\nimport { requireNativeComponent } from \"react-native\";\n\nimport type { SkRect } from \"../skia/types\";\nimport type { SkiaValue } from \"../values\";\n\nimport { SkiaViewApi } from \"./api\";\nimport type { NativeSkiaViewProps, SkiaViewProps } from \"./types\";\n\nlet SkiaViewNativeId = 1000;\n\nconst NativeSkiaView = requireNativeComponent<NativeSkiaViewProps>(\n \"ReactNativeSkiaView\"\n);\n\nexport class SkiaView extends React.Component<SkiaViewProps> {\n constructor(props: SkiaViewProps) {\n super(props);\n this._nativeId = SkiaViewNativeId++;\n const { onDraw } = props;\n if (onDraw) {\n assertSkiaViewApi();\n SkiaViewApi.setJsiProperty(this._nativeId, \"drawCallback\", onDraw);\n }\n }\n\n private _nativeId: number;\n\n public get nativeId() {\n return this._nativeId;\n }\n\n componentDidUpdate(prevProps: SkiaViewProps) {\n const { onDraw } = this.props;\n if (onDraw !== prevProps.onDraw) {\n assertSkiaViewApi();\n SkiaViewApi.setJsiProperty(this._nativeId, \"drawCallback\", onDraw);\n }\n }\n\n /**\n * Creates a snapshot from the canvas in the surface\n * @param rect Rect to use as bounds. Optional.\n * @returns An Image object.\n */\n public makeImageSnapshot(rect?: SkRect) {\n assertSkiaViewApi();\n return SkiaViewApi.makeImageSnapshot(this._nativeId, rect);\n }\n\n /**\n * Sends a redraw request to the native SkiaView.\n */\n public redraw() {\n assertSkiaViewApi();\n SkiaViewApi.requestRedraw(this._nativeId);\n }\n\n /**\n * Registers one or move values as a dependant value of the Skia View. The view will\n * The view will redraw itself when any of the values change.\n * @param values Values to register\n */\n public registerValues(values: SkiaValue<unknown>[]): () => void {\n assertSkiaViewApi();\n return SkiaViewApi.registerValuesInView(this._nativeId, values);\n }\n\n render() {\n const { mode, debug = false, ...viewProps } = this.props;\n return (\n <NativeSkiaView\n collapsable={false}\n nativeID={`${this._nativeId}`}\n mode={mode}\n debug={debug}\n {...viewProps}\n />\n );\n }\n}\n\nconst assertSkiaViewApi = () => {\n if (\n SkiaViewApi === null ||\n SkiaViewApi.setJsiProperty === null ||\n SkiaViewApi.callJsiMethod === null ||\n SkiaViewApi.registerValuesInView === null ||\n SkiaViewApi.requestRedraw === null ||\n SkiaViewApi.makeImageSnapshot === null\n ) {\n throw Error(\"Skia View Api was not found.\");\n }\n};\n"]}
|