@shopify/react-native-skia 0.1.139 → 0.1.142
Sign up to get free protection for your applications and to get access to all the features.
- package/android/CMakeLists.txt +5 -1
- package/android/build.gradle +3 -1
- package/android/cpp/rnskia-android/RNSkDrawViewImpl.cpp +2 -2
- package/android/cpp/rnskia-android/RNSkDrawViewImpl.h +1 -1
- package/android/cpp/rnskia-android/SkiaOpenGLRenderer.cpp +15 -16
- package/android/cpp/rnskia-android/SkiaOpenGLRenderer.h +2 -2
- package/android/src/main/java/com/shopify/reactnative/skia/SkiaDrawView.java +69 -27
- package/cpp/rnskia/RNSkDrawView.cpp +66 -66
- package/cpp/rnskia/RNSkDrawView.h +22 -6
- package/cpp/rnskia/RNSkJsiViewApi.h +2 -2
- package/cpp/rnskia/values/RNSkComputedValue.h +10 -7
- package/cpp/rnskia/values/RNSkReadonlyValue.h +21 -2
- package/cpp/rnskia/values/RNSkValue.h +1 -0
- package/ios/RNSkia-iOS/RNSkDrawViewImpl.h +1 -1
- package/ios/RNSkia-iOS/RNSkDrawViewImpl.mm +2 -2
- package/ios/RNSkia-iOS/SkiaDrawView.mm +4 -0
- package/lib/commonjs/mock/index.js +3 -1
- package/lib/commonjs/mock/index.js.map +1 -1
- package/lib/commonjs/renderer/DependencyManager.js +1 -1
- package/lib/commonjs/renderer/DependencyManager.js.map +1 -1
- package/lib/commonjs/renderer/processors/Animations/Animations.js +18 -5
- package/lib/commonjs/renderer/processors/Animations/Animations.js.map +1 -1
- package/lib/commonjs/skia/core/Data.js +10 -22
- package/lib/commonjs/skia/core/Data.js.map +1 -1
- package/lib/commonjs/skia/core/Font.js +2 -3
- package/lib/commonjs/skia/core/Font.js.map +1 -1
- package/lib/commonjs/skia/core/Image.js.map +1 -1
- package/lib/commonjs/skia/core/SVG.js.map +1 -1
- package/lib/commonjs/skia/core/Typeface.js.map +1 -1
- package/lib/commonjs/skia/types/Data/Data.js +5 -0
- package/lib/commonjs/skia/types/Data/Data.js.map +1 -1
- package/lib/commonjs/skia/types/Image/ImageFactory.js +0 -2
- package/lib/commonjs/skia/types/Image/ImageFactory.js.map +1 -1
- package/lib/commonjs/skia/types/Path/Path.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkCanvas.js +9 -7
- package/lib/commonjs/skia/web/JsiSkCanvas.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPath.js +7 -5
- package/lib/commonjs/skia/web/JsiSkPath.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkRRect.js +8 -0
- package/lib/commonjs/skia/web/JsiSkRRect.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkRect.js +2 -2
- package/lib/commonjs/skia/web/JsiSkRect.js.map +1 -1
- package/lib/commonjs/values/hooks/useComputedValue.js +6 -2
- package/lib/commonjs/values/hooks/useComputedValue.js.map +1 -1
- package/lib/commonjs/values/index.js +13 -0
- package/lib/commonjs/values/index.js.map +1 -1
- package/lib/commonjs/values/selector.js +24 -0
- package/lib/commonjs/values/selector.js.map +1 -0
- package/lib/commonjs/values/web/RNSkComputedValue.js +8 -0
- package/lib/commonjs/values/web/RNSkComputedValue.js.map +1 -1
- package/lib/commonjs/values/web/RNSkReadonlyValue.js +4 -0
- package/lib/commonjs/values/web/RNSkReadonlyValue.js.map +1 -1
- package/lib/commonjs/views/useTouchHandler.js +13 -15
- package/lib/commonjs/views/useTouchHandler.js.map +1 -1
- package/lib/module/mock/index.js +2 -1
- package/lib/module/mock/index.js.map +1 -1
- package/lib/module/renderer/DependencyManager.js +2 -2
- package/lib/module/renderer/DependencyManager.js.map +1 -1
- package/lib/module/renderer/processors/Animations/Animations.js +13 -4
- package/lib/module/renderer/processors/Animations/Animations.js.map +1 -1
- package/lib/module/skia/core/Data.js +10 -20
- package/lib/module/skia/core/Data.js.map +1 -1
- package/lib/module/skia/core/Font.js +2 -3
- package/lib/module/skia/core/Font.js.map +1 -1
- package/lib/module/skia/core/Image.js.map +1 -1
- package/lib/module/skia/core/SVG.js.map +1 -1
- package/lib/module/skia/core/Typeface.js.map +1 -1
- package/lib/module/skia/types/Data/Data.js +1 -1
- package/lib/module/skia/types/Data/Data.js.map +1 -1
- package/lib/module/skia/types/Image/ImageFactory.js +0 -1
- package/lib/module/skia/types/Image/ImageFactory.js.map +1 -1
- package/lib/module/skia/types/Path/Path.js.map +1 -1
- package/lib/module/skia/web/JsiSkCanvas.js +8 -7
- package/lib/module/skia/web/JsiSkCanvas.js.map +1 -1
- package/lib/module/skia/web/JsiSkPath.js +6 -5
- package/lib/module/skia/web/JsiSkPath.js.map +1 -1
- package/lib/module/skia/web/JsiSkRRect.js +8 -0
- package/lib/module/skia/web/JsiSkRRect.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/values/hooks/useComputedValue.js +7 -3
- package/lib/module/values/hooks/useComputedValue.js.map +1 -1
- package/lib/module/values/index.js +1 -0
- package/lib/module/values/index.js.map +1 -1
- package/lib/module/values/selector.js +15 -0
- package/lib/module/values/selector.js.map +1 -0
- package/lib/module/values/web/RNSkComputedValue.js +8 -0
- package/lib/module/values/web/RNSkComputedValue.js.map +1 -1
- package/lib/module/values/web/RNSkReadonlyValue.js +4 -0
- package/lib/module/values/web/RNSkReadonlyValue.js.map +1 -1
- package/lib/module/views/useTouchHandler.js +12 -14
- package/lib/module/views/useTouchHandler.js.map +1 -1
- package/lib/typescript/src/renderer/processors/Animations/Animations.d.ts +7 -2
- package/lib/typescript/src/skia/core/Data.d.ts +3 -5
- package/lib/typescript/src/skia/core/Font.d.ts +2 -2
- package/lib/typescript/src/skia/core/Image.d.ts +2 -2
- package/lib/typescript/src/skia/core/SVG.d.ts +2 -2
- package/lib/typescript/src/skia/core/Typeface.d.ts +2 -2
- package/lib/typescript/src/skia/types/Data/Data.d.ts +10 -3
- package/lib/typescript/src/skia/web/JsiSkRRect.d.ts +1 -0
- package/lib/typescript/src/skia/web/JsiSkRect.d.ts +1 -1
- package/lib/typescript/src/values/index.d.ts +1 -0
- package/lib/typescript/src/values/selector.d.ts +14 -0
- package/lib/typescript/src/values/types.d.ts +4 -0
- package/lib/typescript/src/values/web/RNSkComputedValue.d.ts +1 -0
- package/lib/typescript/src/values/web/RNSkReadonlyValue.d.ts +1 -0
- package/package.json +13 -8
- package/src/mock/index.ts +2 -1
- package/src/renderer/DependencyManager.tsx +5 -2
- package/src/renderer/processors/Animations/Animations.ts +27 -5
- package/src/skia/core/Data.ts +20 -51
- package/src/skia/core/Font.ts +4 -5
- package/src/skia/core/Image.ts +2 -2
- package/src/skia/core/SVG.ts +2 -2
- package/src/skia/core/Typeface.ts +2 -2
- package/src/skia/types/Data/Data.ts +11 -1
- package/src/skia/types/Image/ImageFactory.ts +0 -1
- package/src/skia/types/Path/Path.ts +0 -1
- package/src/skia/web/JsiSkCanvas.ts +22 -10
- package/src/skia/web/JsiSkPath.ts +14 -5
- package/src/skia/web/JsiSkRRect.ts +11 -0
- package/src/skia/web/JsiSkRect.ts +2 -5
- package/src/values/hooks/useComputedValue.ts +6 -3
- package/src/values/index.ts +1 -0
- package/src/values/selector.ts +24 -0
- package/src/values/types.ts +4 -0
- package/src/values/web/RNSkComputedValue.ts +6 -0
- package/src/values/web/RNSkReadonlyValue.ts +4 -0
- package/src/views/useTouchHandler.ts +15 -19
- package/android/README.md +0 -14
- package/cpp/skia/include/third_party/skcms/LICENSE +0 -29
- package/cpp/skia/include/third_party/vulkan/LICENSE +0 -29
- package/cpp/skia/readme.txt +0 -1
@@ -1,9 +1,10 @@
|
|
1
|
-
import {
|
2
|
-
import { Image
|
1
|
+
import { useEffect, useState } from "react";
|
2
|
+
import { Image } from "react-native";
|
3
3
|
import { Skia } from "../Skia";
|
4
|
+
import { isRNModule } from "../types";
|
4
5
|
|
5
6
|
const resolveAsset = source => {
|
6
|
-
return
|
7
|
+
return isRNModule(source) ? Image.resolveAssetSource(source).uri : source.default;
|
7
8
|
};
|
8
9
|
|
9
10
|
const factoryWrapper = (data2, factory, onError) => {
|
@@ -17,10 +18,8 @@ const factoryWrapper = (data2, factory, onError) => {
|
|
17
18
|
}
|
18
19
|
};
|
19
20
|
|
20
|
-
const loadDataCollection = (sources, factory, onError) => Promise.all(sources.map(source => loadData(source, factory, onError)));
|
21
|
-
|
22
21
|
const loadData = (source, factory, onError) => {
|
23
|
-
if (source === null) {
|
22
|
+
if (source === null || source === undefined) {
|
24
23
|
return new Promise(resolve => resolve(null));
|
25
24
|
} else if (source instanceof Uint8Array) {
|
26
25
|
return new Promise(resolve => resolve(factoryWrapper(Skia.Data.fromBytes(source), factory, onError)));
|
@@ -30,26 +29,17 @@ const loadData = (source, factory, onError) => {
|
|
30
29
|
}
|
31
30
|
};
|
32
31
|
|
33
|
-
const useLoading =
|
34
|
-
let deps = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
32
|
+
const useLoading = (source, loader) => {
|
35
33
|
const [data, setData] = useState(null);
|
36
|
-
const prevSourceRef = useRef();
|
37
34
|
useEffect(() => {
|
38
|
-
|
39
|
-
|
40
|
-
loader().then(setData);
|
41
|
-
} else {
|
42
|
-
setData(null);
|
43
|
-
} // eslint-disable-next-line react-hooks/exhaustive-deps
|
44
|
-
|
45
|
-
}, deps);
|
35
|
+
loader().then(setData); // eslint-disable-next-line react-hooks/exhaustive-deps
|
36
|
+
}, [source]);
|
46
37
|
return data;
|
47
38
|
};
|
48
39
|
|
49
|
-
export const
|
50
|
-
export const useRawData = (source, factory, onError, deps) => useLoading(source, () => loadData(source, factory, onError), deps);
|
40
|
+
export const useRawData = (source, factory, onError) => useLoading(source, () => loadData(source, factory, onError));
|
51
41
|
|
52
42
|
const identity = data => data;
|
53
43
|
|
54
|
-
export const useData = (source, onError
|
44
|
+
export const useData = (source, onError) => useRawData(source, identity, onError);
|
55
45
|
//# sourceMappingURL=Data.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["Data.ts"],"names":["
|
1
|
+
{"version":3,"sources":["Data.ts"],"names":["useEffect","useState","Image","Skia","isRNModule","resolveAsset","source","resolveAssetSource","uri","default","factoryWrapper","data2","factory","onError","factoryResult","Error","loadData","undefined","Promise","resolve","Uint8Array","Data","fromBytes","fromURI","then","d","useLoading","loader","data","setData","useRawData","identity","useData"],"mappings":"AAAA,SAASA,SAAT,EAAoBC,QAApB,QAAoC,OAApC;AACA,SAASC,KAAT,QAAsB,cAAtB;AAEA,SAASC,IAAT,QAAqB,SAArB;AACA,SAASC,UAAT,QAA2B,UAA3B;;AAGA,MAAMC,YAAY,GAAIC,MAAD,IAAwB;AAC3C,SAAOF,UAAU,CAACE,MAAD,CAAV,GACHJ,KAAK,CAACK,kBAAN,CAAyBD,MAAzB,EAAiCE,GAD9B,GAEHF,MAAM,CAACG,OAFX;AAGD,CAJD;;AAMA,MAAMC,cAAc,GAAG,CACrBC,KADqB,EAErBC,OAFqB,EAGrBC,OAHqB,KAIlB;AACH,QAAMC,aAAa,GAAGF,OAAO,CAACD,KAAD,CAA7B;;AACA,MAAIG,aAAa,KAAK,IAAtB,EAA4B;AAC1BD,IAAAA,OAAO,IAAIA,OAAO,CAAC,IAAIE,KAAJ,CAAU,qBAAV,CAAD,CAAlB;AACA,WAAO,IAAP;AACD,GAHD,MAGO;AACL,WAAOD,aAAP;AACD;AACF,CAZD;;AAcA,MAAME,QAAQ,GAAG,CACfV,MADe,EAEfM,OAFe,EAGfC,OAHe,KAIO;AACtB,MAAIP,MAAM,KAAK,IAAX,IAAmBA,MAAM,KAAKW,SAAlC,EAA6C;AAC3C,WAAO,IAAIC,OAAJ,CAAaC,OAAD,IAAaA,OAAO,CAAC,IAAD,CAAhC,CAAP;AACD,GAFD,MAEO,IAAIb,MAAM,YAAYc,UAAtB,EAAkC;AACvC,WAAO,IAAIF,OAAJ,CAAaC,OAAD,IACjBA,OAAO,CAACT,cAAc,CAACP,IAAI,CAACkB,IAAL,CAAUC,SAAV,CAAoBhB,MAApB,CAAD,EAA8BM,OAA9B,EAAuCC,OAAvC,CAAf,CADF,CAAP;AAGD,GAJM,MAIA;AACL,UAAML,GAAG,GAAG,OAAOF,MAAP,KAAkB,QAAlB,GAA6BA,MAA7B,GAAsCD,YAAY,CAACC,MAAD,CAA9D;AACA,WAAOH,IAAI,CAACkB,IAAL,CAAUE,OAAV,CAAkBf,GAAlB,EAAuBgB,IAAvB,CAA6BC,CAAD,IACjCf,cAAc,CAACe,CAAD,EAAIb,OAAJ,EAAaC,OAAb,CADT,CAAP;AAGD;AACF,CAjBD;;AAkBA,MAAMa,UAAU,GAAG,CACjBpB,MADiB,EAEjBqB,MAFiB,KAGd;AACH,QAAM,CAACC,IAAD,EAAOC,OAAP,IAAkB5B,QAAQ,CAAW,IAAX,CAAhC;AACAD,EAAAA,SAAS,CAAC,MAAM;AACd2B,IAAAA,MAAM,GAAGH,IAAT,CAAcK,OAAd,EADc,CAEd;AACD,GAHQ,EAGN,CAACvB,MAAD,CAHM,CAAT;AAIA,SAAOsB,IAAP;AACD,CAVD;;AAYA,OAAO,MAAME,UAAU,GAAG,CACxBxB,MADwB,EAExBM,OAFwB,EAGxBC,OAHwB,KAIrBa,UAAU,CAACpB,MAAD,EAAS,MAAMU,QAAQ,CAACV,MAAD,EAASM,OAAT,EAAkBC,OAAlB,CAAvB,CAJR;;AAMP,MAAMkB,QAAQ,GAAIH,IAAD,IAAkBA,IAAnC;;AAEA,OAAO,MAAMI,OAAO,GAAG,CACrB1B,MADqB,EAErBO,OAFqB,KAGlBiB,UAAU,CAACxB,MAAD,EAASyB,QAAT,EAAmBlB,OAAnB,CAHR","sourcesContent":["import { useEffect, useState } from \"react\";\nimport { Image } from \"react-native\";\n\nimport { Skia } from \"../Skia\";\nimport { isRNModule } from \"../types\";\nimport type { SkData, DataModule, DataSourceParam } from \"../types\";\n\nconst resolveAsset = (source: DataModule) => {\n return isRNModule(source)\n ? Image.resolveAssetSource(source).uri\n : source.default;\n};\n\nconst factoryWrapper = <T>(\n data2: SkData,\n factory: (data: SkData) => T,\n onError?: (err: Error) => void\n) => {\n const factoryResult = factory(data2);\n if (factoryResult === null) {\n onError && onError(new Error(\"Could not load data\"));\n return null;\n } else {\n return factoryResult;\n }\n};\n\nconst loadData = <T>(\n source: DataSourceParam,\n factory: (data: SkData) => T,\n onError?: (err: Error) => void\n): Promise<T | null> => {\n if (source === null || source === undefined) {\n return new Promise((resolve) => resolve(null));\n } else if (source instanceof Uint8Array) {\n return new Promise((resolve) =>\n resolve(factoryWrapper(Skia.Data.fromBytes(source), factory, onError))\n );\n } else {\n const uri = typeof source === \"string\" ? source : resolveAsset(source);\n return Skia.Data.fromURI(uri).then((d) =>\n factoryWrapper(d, factory, onError)\n );\n }\n};\nconst useLoading = <T>(\n source: DataSourceParam,\n loader: () => Promise<T | null>\n) => {\n const [data, setData] = useState<T | null>(null);\n useEffect(() => {\n loader().then(setData);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [source]);\n return data;\n};\n\nexport const useRawData = <T>(\n source: DataSourceParam,\n factory: (data: SkData) => T,\n onError?: (err: Error) => void\n) => useLoading(source, () => loadData(source, factory, onError));\n\nconst identity = (data: SkData) => data;\n\nexport const useData = (\n source: DataSourceParam,\n onError?: (err: Error) => void\n) => useRawData(source, identity, onError);\n"]}
|
@@ -15,8 +15,7 @@ export const useFont = (font, size, onError) => {
|
|
15
15
|
return Skia.Font(typeface);
|
16
16
|
} else {
|
17
17
|
return null;
|
18
|
-
}
|
19
|
-
|
20
|
-
}, [typeface]);
|
18
|
+
}
|
19
|
+
}, [size, typeface]);
|
21
20
|
};
|
22
21
|
//# sourceMappingURL=Font.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["Font.ts"],"names":["useMemo","Skia","useTypeface","useFont","font","size","onError","typeface","Font"],"mappings":"AAAA;AACA,SAASA,OAAT,QAAwB,OAAxB;AAEA,SAASC,IAAT,QAAqB,SAArB;AAGA,SAASC,WAAT,QAA4B,YAA5B;AAEA;AACA;AACA;;AACA,OAAO,MAAMC,OAAO,GAAG,CACrBC,IADqB,EAErBC,IAFqB,EAGrBC,OAHqB,
|
1
|
+
{"version":3,"sources":["Font.ts"],"names":["useMemo","Skia","useTypeface","useFont","font","size","onError","typeface","Font"],"mappings":"AAAA;AACA,SAASA,OAAT,QAAwB,OAAxB;AAEA,SAASC,IAAT,QAAqB,SAArB;AAGA,SAASC,WAAT,QAA4B,YAA5B;AAEA;AACA;AACA;;AACA,OAAO,MAAMC,OAAO,GAAG,CACrBC,IADqB,EAErBC,IAFqB,EAGrBC,OAHqB,KAIlB;AACH,QAAMC,QAAQ,GAAGL,WAAW,CAACE,IAAD,EAAOE,OAAP,CAA5B;AACA,SAAON,OAAO,CAAC,MAAM;AACnB,QAAIO,QAAQ,IAAIF,IAAhB,EAAsB;AACpB,aAAOJ,IAAI,CAACO,IAAL,CAAUD,QAAV,EAAoBF,IAApB,CAAP;AACD,KAFD,MAEO,IAAIE,QAAQ,IAAI,CAACF,IAAjB,EAAuB;AAC5B,aAAOJ,IAAI,CAACO,IAAL,CAAUD,QAAV,CAAP;AACD,KAFM,MAEA;AACL,aAAO,IAAP;AACD;AACF,GARa,EAQX,CAACF,IAAD,EAAOE,QAAP,CARW,CAAd;AASD,CAfM","sourcesContent":["/*global SkiaApi*/\nimport { useMemo } from \"react\";\n\nimport { Skia } from \"../Skia\";\nimport type { DataSourceParam } from \"../types\";\n\nimport { useTypeface } from \"./Typeface\";\n\n/**\n * Returns a Skia Font object\n * */\nexport const useFont = (\n font: DataSourceParam,\n size?: number,\n onError?: (err: Error) => void\n) => {\n const typeface = useTypeface(font, onError);\n return useMemo(() => {\n if (typeface && size) {\n return Skia.Font(typeface, size);\n } else if (typeface && !size) {\n return Skia.Font(typeface);\n } else {\n return null;\n }\n }, [size, typeface]);\n};\n"]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["Image.ts"],"names":["Skia","useRawData","imgFactory","Image","MakeImageFromEncoded","bind","useImage","source","onError"],"mappings":"AAAA,SAASA,IAAT,QAAqB,SAArB;AAGA,SAASC,UAAT,QAA2B,QAA3B;AAEA,MAAMC,UAAU,GAAGF,IAAI,CAACG,KAAL,CAAWC,oBAAX,CAAgCC,IAAhC,CAAqCL,IAAI,CAACG,KAA1C,CAAnB;AAEA;AACA;AACA;;AACA,OAAO,MAAMG,QAAQ,GAAG,CACtBC,MADsB,EAEtBC,OAFsB,KAGnBP,UAAU,CAACM,MAAD,EAASL,UAAT,EAAqBM,OAArB,CAHR","sourcesContent":["import { Skia } from \"../Skia\";\nimport type {
|
1
|
+
{"version":3,"sources":["Image.ts"],"names":["Skia","useRawData","imgFactory","Image","MakeImageFromEncoded","bind","useImage","source","onError"],"mappings":"AAAA,SAASA,IAAT,QAAqB,SAArB;AAGA,SAASC,UAAT,QAA2B,QAA3B;AAEA,MAAMC,UAAU,GAAGF,IAAI,CAACG,KAAL,CAAWC,oBAAX,CAAgCC,IAAhC,CAAqCL,IAAI,CAACG,KAA1C,CAAnB;AAEA;AACA;AACA;;AACA,OAAO,MAAMG,QAAQ,GAAG,CACtBC,MADsB,EAEtBC,OAFsB,KAGnBP,UAAU,CAACM,MAAD,EAASL,UAAT,EAAqBM,OAArB,CAHR","sourcesContent":["import { Skia } from \"../Skia\";\nimport type { DataSourceParam } from \"../types\";\n\nimport { useRawData } from \"./Data\";\n\nconst imgFactory = Skia.Image.MakeImageFromEncoded.bind(Skia.Image);\n\n/**\n * Returns a Skia Image object\n * */\nexport const useImage = (\n source: DataSourceParam,\n onError?: (err: Error) => void\n) => useRawData(source, imgFactory, onError);\n"]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["SVG.ts"],"names":["Skia","useRawData","svgFactory","SVG","MakeFromData","bind","useSVG","source","onError"],"mappings":"AAAA,SAASA,IAAT,QAAqB,SAArB;AAGA,SAASC,UAAT,QAA2B,QAA3B;AAEA,MAAMC,UAAU,GAAGF,IAAI,CAACG,GAAL,CAASC,YAAT,CAAsBC,IAAtB,CAA2BL,IAAI,CAACG,GAAhC,CAAnB;AAEA,OAAO,MAAMG,MAAM,GAAG,CACpBC,MADoB,EAEpBC,OAFoB,KAGjBP,UAAU,CAACM,MAAD,EAASL,UAAT,EAAqBM,OAArB,CAHR","sourcesContent":["import { Skia } from \"../Skia\";\nimport type {
|
1
|
+
{"version":3,"sources":["SVG.ts"],"names":["Skia","useRawData","svgFactory","SVG","MakeFromData","bind","useSVG","source","onError"],"mappings":"AAAA,SAASA,IAAT,QAAqB,SAArB;AAGA,SAASC,UAAT,QAA2B,QAA3B;AAEA,MAAMC,UAAU,GAAGF,IAAI,CAACG,GAAL,CAASC,YAAT,CAAsBC,IAAtB,CAA2BL,IAAI,CAACG,GAAhC,CAAnB;AAEA,OAAO,MAAMG,MAAM,GAAG,CACpBC,MADoB,EAEpBC,OAFoB,KAGjBP,UAAU,CAACM,MAAD,EAASL,UAAT,EAAqBM,OAArB,CAHR","sourcesContent":["import { Skia } from \"../Skia\";\nimport type { DataSourceParam } from \"../types\";\n\nimport { useRawData } from \"./Data\";\n\nconst svgFactory = Skia.SVG.MakeFromData.bind(Skia.SVG);\n\nexport const useSVG = (\n source: DataSourceParam,\n onError?: (err: Error) => void\n) => useRawData(source, svgFactory, onError);\n"]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["Typeface.ts"],"names":["Skia","useRawData","tfFactory","Typeface","MakeFreeTypeFaceFromData","bind","useTypeface","source","onError"],"mappings":"AAAA,SAASA,IAAT,QAAqB,SAArB;AAGA,SAASC,UAAT,QAA2B,QAA3B;AAEA,MAAMC,SAAS,GAAGF,IAAI,CAACG,QAAL,CAAcC,wBAAd,CAAuCC,IAAvC,CAA4CL,IAAI,CAACG,QAAjD,CAAlB;AAEA;AACA;AACA;;AACA,OAAO,MAAMG,WAAW,GAAG,CACzBC,MADyB,EAEzBC,OAFyB,KAGtBP,UAAU,CAACM,MAAD,EAASL,SAAT,EAAoBM,OAApB,CAHR","sourcesContent":["import { Skia } from \"../Skia\";\nimport type {
|
1
|
+
{"version":3,"sources":["Typeface.ts"],"names":["Skia","useRawData","tfFactory","Typeface","MakeFreeTypeFaceFromData","bind","useTypeface","source","onError"],"mappings":"AAAA,SAASA,IAAT,QAAqB,SAArB;AAGA,SAASC,UAAT,QAA2B,QAA3B;AAEA,MAAMC,SAAS,GAAGF,IAAI,CAACG,QAAL,CAAcC,wBAAd,CAAuCC,IAAvC,CAA4CL,IAAI,CAACG,QAAjD,CAAlB;AAEA;AACA;AACA;;AACA,OAAO,MAAMG,WAAW,GAAG,CACzBC,MADyB,EAEzBC,OAFyB,KAGtBP,UAAU,CAACM,MAAD,EAASL,SAAT,EAAoBM,OAApB,CAHR","sourcesContent":["import { Skia } from \"../Skia\";\nimport type { DataSourceParam } from \"../types\";\n\nimport { useRawData } from \"./Data\";\n\nconst tfFactory = Skia.Typeface.MakeFreeTypeFaceFromData.bind(Skia.Typeface);\n\n/**\n * Returns a Skia Typeface object\n * */\nexport const useTypeface = (\n source: DataSourceParam,\n onError?: (err: Error) => void\n) => useRawData(source, tfFactory, onError);\n"]}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
export
|
1
|
+
export const isRNModule = mod => typeof mod === "number";
|
2
2
|
//# sourceMappingURL=Data.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
|
1
|
+
{"version":3,"sources":["Data.ts"],"names":["isRNModule","mod"],"mappings":"AAaA,OAAO,MAAMA,UAAU,GAAIC,GAAD,IACxB,OAAOA,GAAP,KAAe,QADV","sourcesContent":["import type { SkJSIInstance } from \"../JsiInstance\";\n\nexport type SkData = SkJSIInstance<\"Data\">;\n\ntype RNModule = number;\ntype ESModule = {\n __esModule: true;\n default: string;\n};\nexport type DataModule = RNModule | ESModule;\nexport type DataSource = DataModule | string | Uint8Array;\nexport type DataSourceParam = DataSource | null | undefined;\n\nexport const isRNModule = (mod: DataModule): mod is RNModule =>\n typeof mod === \"number\";\n"]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["ImageFactory.ts"],"names":["AlphaType","ColorType"],"mappings":"
|
1
|
+
{"version":3,"sources":["ImageFactory.ts"],"names":["AlphaType","ColorType"],"mappings":"AAIA,WAAYA,SAAZ;;WAAYA,S;AAAAA,EAAAA,S,CAAAA,S;AAAAA,EAAAA,S,CAAAA,S;AAAAA,EAAAA,S,CAAAA,S;AAAAA,EAAAA,S,CAAAA,S;GAAAA,S,KAAAA,S;;AAOZ,WAAYC,SAAZ;;WAAYA,S;AAAAA,EAAAA,S,CAAAA,S;AAAAA,EAAAA,S,CAAAA,S;AAAAA,EAAAA,S,CAAAA,S;AAAAA,EAAAA,S,CAAAA,S;AAAAA,EAAAA,S,CAAAA,S;AAAAA,EAAAA,S,CAAAA,S;AAAAA,EAAAA,S,CAAAA,S;AAAAA,EAAAA,S,CAAAA,S;AAAAA,EAAAA,S,CAAAA,S;AAAAA,EAAAA,S,CAAAA,S;AAAAA,EAAAA,S,CAAAA,S;AAAAA,EAAAA,S,CAAAA,S;AAAAA,EAAAA,S,CAAAA,S;AAAAA,EAAAA,S,CAAAA,S;AAAAA,EAAAA,S,CAAAA,S;AAAAA,EAAAA,S,CAAAA,S;AAAAA,EAAAA,S,CAAAA,S;AAAAA,EAAAA,S,CAAAA,S;AAAAA,EAAAA,S,CAAAA,S;AAAAA,EAAAA,S,CAAAA,S;AAAAA,EAAAA,S,CAAAA,S;AAAAA,EAAAA,S,CAAAA,S;GAAAA,S,KAAAA,S","sourcesContent":["import type { SkData } from \"../Data\";\n\nimport type { SkImage } from \"./Image\";\n\nexport enum AlphaType {\n Unknown,\n Opaque,\n Premul,\n Unpremul,\n}\n\nexport enum ColorType {\n Unknown, //!< uninitialized\n Alpha_8, //!< pixel with alpha in 8-bit byte\n RGB_565, //!< pixel with 5 bits red, 6 bits green, 5 bits blue, in 16-bit word\n ARGB_4444, //!< pixel with 4 bits for alpha, red, green, blue; in 16-bit word\n RGBA_8888, //!< pixel with 8 bits for red, green, blue, alpha; in 32-bit word\n RGB_888x, //!< pixel with 8 bits each for red, green, blue; in 32-bit word\n BGRA_8888, //!< pixel with 8 bits for blue, green, red, alpha; in 32-bit word\n RGBA_1010102, //!< 10 bits for red, green, blue; 2 bits for alpha; in 32-bit word\n BGRA_1010102, //!< 10 bits for blue, green, red; 2 bits for alpha; in 32-bit word\n RGB_101010x, //!< pixel with 10 bits each for red, green, blue; in 32-bit word\n BGR_101010x, //!< pixel with 10 bits each for blue, green, red; in 32-bit word\n Gray_8, //!< pixel with grayscale level in 8-bit byte\n RGBA_F16Norm, //!< pixel with half floats in [0,1] for red, green, blue, alpha;\n // in 64-bit word\n RGBA_F16, //!< pixel with half floats for red, green, blue, alpha;\n // in 64-bit word\n RGBA_F32, //!< pixel using C float for red, green, blue, alpha; in 128-bit word\n\n // The following 6 colortypes are just for reading from - not for rendering to\n R8G8_unorm, //!< pixel with a uint8_t for red and green\n\n A16_float, //!< pixel with a half float for alpha\n R16G16_float, //!< pixel with a half float for red and green\n\n A16_unorm, //!< pixel with a little endian uint16_t for alpha\n R16G16_unorm, //!< pixel with a little endian uint16_t for red and green\n R16G16B16A16_unorm, //!< pixel with a little endian uint16_t for red, green, blue\n // and alpha\n SRGBA_8888,\n}\n\nexport interface ImageInfo {\n alphaType: AlphaType;\n // TODO: add support for color space\n // colorSpace: ColorSpace;\n colorType: ColorType;\n height: number;\n width: number;\n}\n\nexport interface ImageFactory {\n /**\n * Return an Image backed by the encoded data, but attempt to defer decoding until the image\n * is actually used/drawn. This deferral allows the system to cache the result, either on the\n * CPU or on the GPU, depending on where the image is drawn.\n * This decoding uses the codecs that have been compiled into CanvasKit. If the bytes are\n * invalid (or an unrecognized codec), null will be returned. See Image.h for more details.\n * @param data - Data object with bytes of data\n * @returns If the encoded format is not supported, or subset is outside of the bounds of the decoded\n * image, nullptr is returned.\n */\n MakeImageFromEncoded: (encoded: SkData) => SkImage | null;\n\n /**\n * Returns an image with the given pixel data and format.\n * Note that we will always make a copy of the pixel data, because of inconsistencies in\n * behavior between GPU and CPU (i.e. the pixel data will be turned into a GPU texture and\n * not modifiable after creation).\n *\n * @param info\n * @param data - bytes representing the pixel data.\n * @param bytesPerRow\n */\n MakeImage(info: ImageInfo, data: SkData, bytesPerRow: number): SkImage | null;\n}\n"]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["Path.ts"],"names":["FillType","PathOp","PathVerb","isPath","obj","__typename__"],"mappings":"AAOA;AACA;AACA;AAeA,WAAYA,QAAZ;;WAAYA,Q;AAAAA,EAAAA,Q,CAAAA,Q;AAAAA,EAAAA,Q,CAAAA,Q;AAAAA,EAAAA,Q,CAAAA,Q;AAAAA,EAAAA,Q,CAAAA,Q;GAAAA,Q,KAAAA,Q;;AAOZ,WAAYC,MAAZ;;WAAYA,M;AAAAA,EAAAA,M,CAAAA,M;AAAAA,EAAAA,M,CAAAA,M;AAAAA,EAAAA,M,CAAAA,M;AAAAA,EAAAA,M,CAAAA,M;AAAAA,EAAAA,M,CAAAA,M;GAAAA,M,KAAAA,M;;AAQZ,WAAYC,QAAZ;;WAAYA,Q;AAAAA,EAAAA,Q,CAAAA,Q;AAAAA,EAAAA,Q,CAAAA,Q;AAAAA,EAAAA,Q,CAAAA,Q;AAAAA,EAAAA,Q,CAAAA,Q;AAAAA,EAAAA,Q,CAAAA,Q;AAAAA,EAAAA,Q,CAAAA,Q;GAAAA,Q,KAAAA,Q;;AAWZ,OAAO,MAAMC,MAAM,GAAIC,GAAD,IACpBA,GAAG,KAAK,IAAR,IAAgBA,GAAG,CAACC,YAAJ,KAAqB,MADhC","sourcesContent":["import type { SkRect } from \"../Rect\";\nimport type { SkPoint } from \"../Point\";\nimport type { SkRRect } from \"../RRect\";\nimport type { StrokeJoin, StrokeCap } from \"../Paint\";\nimport type { SkMatrix } from \"../Matrix\";\nimport type { SkJSIInstance } from \"../JsiInstance\";\n\n/**\n * Options used for Path.stroke(). If an option is omitted, a sensible default will be used.\n */\nexport interface StrokeOpts {\n /** The width of the stroked lines. */\n width?: number;\n // eslint-disable-next-line camelcase\n miter_limit?: number;\n /**\n * if > 1, increase precision, else if (0 < resScale < 1) reduce precision to\n * favor speed and size\n */\n precision?: number;\n join?: StrokeJoin;\n cap?: StrokeCap;\n}\n\nexport enum FillType {\n Winding,\n EvenOdd,\n InverseWinding,\n InverseEvenOdd,\n}\n\nexport enum PathOp {\n Difference, //!< subtract the op path from the first path\n Intersect, //!< intersect the two paths\n Union, //!< union (inclusive-or) the two paths\n XOR, //!< exclusive-or the two paths\n ReverseDifference,\n}\n\nexport enum PathVerb {\n Move,\n Line,\n Quad,\n Conic,\n Cubic,\n Close,\n}\n\nexport type PathCommand = number[];\n\nexport const isPath = (obj: SkJSIInstance<string> | null): obj is SkPath =>\n obj !== null && obj.__typename__ === \"Path\";\n\nexport interface SkPath extends SkJSIInstance<\"Path\"> {\n /**\n * Appends arc to Path, as the start of new contour. Arc added is part of ellipse\n * bounded by oval, from startAngle through sweepAngle. Both startAngle and\n * sweepAngle are measured in degrees, where zero degrees is aligned with the\n * positive x-axis, and positive sweeps extends arc clockwise.\n * Returns the modified path for easier chaining.\n * @param oval\n * @param startAngle\n * @param sweepAngle\n */\n addArc(\n oval: SkRect,\n startAngleInDegrees: number,\n sweepAngleInDegrees: number\n ): SkPath;\n\n /**\n * Adds oval to Path, appending kMove_Verb, four kConic_Verb, and kClose_Verb.\n * Oval is upright ellipse bounded by Rect oval with radii equal to half oval width\n * and half oval height. Oval begins at start and continues clockwise by default.\n * Returns the modified path for easier chaining.\n * @param oval\n * @param isCCW - if the path should be drawn counter-clockwise or not\n * @param startIndex - index of initial point of ellipse\n */\n addOval(oval: SkRect, isCCW?: boolean, startIndex?: number): SkPath;\n\n /**\n * Returns the number of points in this path. Initially zero.\n */\n countPoints(): number;\n\n /**\n * Adds contour created from array of n points, adding (count - 1) line segments.\n * Contour added starts at pts[0], then adds a line for every additional point\n * in pts array. If close is true, appends kClose_Verb to Path, connecting\n * pts[count - 1] and pts[0].\n * Returns the modified path for easier chaining.\n * @param points\n * @param close - if true, will add a line connecting last point to the first point.\n */\n addPoly(points: SkPoint[], close: boolean): SkPath;\n\n /** Adds beginning of contour at SkPoint (x, y).\n\n @param x x-axis value of contour start\n @param y y-axis value of contour start\n @return reference to SkPath\n\n example: https://fiddle.skia.org/c/@Path_moveTo\n */\n moveTo(x: number, y: number): SkPath;\n /** Adds line from last point to (x, y). If SkPath is empty, or last SkPath::Verb is\n kClose_Verb, last point is set to (0, 0) before adding line.\n\n lineTo() appends kMove_Verb to verb array and (0, 0) to SkPoint array, if needed.\n lineTo() then appends kLine_Verb to verb array and (x, y) to SkPoint array.\n\n @param x end of added line on x-axis\n @param y end of added line on y-axis\n @return reference to SkPath\n\n example: https://fiddle.skia.org/c/@Path_lineTo\n */\n lineTo(x: number, y: number): SkPath;\n\n /**\n * Returns a new path that covers the same area as the original path, but with the\n * Winding FillType. This may re-draw some contours in the path as counter-clockwise\n * instead of clockwise to achieve that effect. If such a transformation cannot\n * be done, null is returned.\n */\n makeAsWinding(): SkPath | null;\n\n /**\n * Translates all the points in the path by dx, dy.\n * @param dx\n * @param dy\n */\n offset(dx: number, dy: number): SkPath;\n\n /**\n * Relative version of arcToRotated.\n * @param rx\n * @param ry\n * @param xAxisRotate\n * @param useSmallArc\n * @param isCCW\n * @param dx\n * @param dy\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 ): SkPath;\n\n /**\n * Relative version of conicTo.\n * @param dx1\n * @param dy1\n * @param dx2\n * @param dy2\n * @param w\n */\n rConicTo(\n dx1: number,\n dy1: number,\n dx2: number,\n dy2: number,\n w: number\n ): SkPath;\n\n /**\n * Relative version of cubicTo.\n * @param cpx1\n * @param cpy1\n * @param cpx2\n * @param cpy2\n * @param x\n * @param y\n */\n rCubicTo(\n cpx1: number,\n cpy1: number,\n cpx2: number,\n cpy2: number,\n x: number,\n y: number\n ): SkPath;\n\n /**\n * Relative version of moveTo.\n * @param x\n * @param y\n */\n rMoveTo(x: number, y: number): SkPath;\n\n /**\n * Relative version of lineTo.\n * @param x\n * @param y\n */\n rLineTo(x: number, y: number): SkPath;\n\n /**\n * Relative version of quadTo.\n * @param x1\n * @param y1\n * @param x2\n * @param y2\n */\n rQuadTo(x1: number, y1: number, x2: number, y2: number): SkPath;\n\n /**\n * Sets FillType, the rule used to fill Path.\n * @param fill\n */\n setFillType(fill: FillType): void;\n\n /**\n * Specifies whether Path is volatile; whether it will be altered or discarded\n * by the caller after it is drawn. Path by default have volatile set false.\n *\n * Mark animating or temporary paths as volatile to improve performance.\n * Mark unchanging Path non-volatile to improve repeated rendering.\n * @param volatile\n */\n setIsVolatile(volatile: boolean): void;\n\n /**\n * Turns this path into the filled equivalent of the stroked path. Returns false if the operation\n * fails (e.g. the path is a hairline).\n * @param opts - describe how stroked path should look.\n * If such a transformation cannot be done, null is returned.\n */\n stroke(opts?: StrokeOpts): null | SkPath;\n\n /**\n * Appends CLOSE_VERB to Path. A closed contour connects the first and last point\n * with a line, forming a continuous loop.\n */\n close(): void;\n\n /**\n * Sets Path to its initial state.\n * Removes verb array, point array, and weights, and sets FillType to Winding.\n * Internal storage associated with Path is released\n */\n reset(): void;\n\n /**\n * Sets Path to its initial state.\n * Removes verb array, point array, and weights, and sets FillType to Winding.\n * Internal storage associated with Path is *not* released.\n * Use rewind() instead of reset() if Path storage will be reused and performance\n * is critical.\n */\n rewind(): void;\n\n /**\n * Returns minimum and maximum axes values of the lines and curves in Path.\n * Returns (0, 0, 0, 0) if Path contains no points.\n * Returned bounds width and height may be larger or smaller than area affected\n * when Path is drawn.\n *\n * Behaves identically to getBounds() when Path contains\n * only lines. If Path contains curves, computed bounds includes\n * the maximum extent of the quad, conic, or cubic; is slower than getBounds();\n * and unlike getBounds(), does not cache the result.\n */\n computeTightBounds(): SkRect;\n\n /**\n * Appends arc to Path. Arc added is part of ellipse\n * bounded by oval, from startAngle through sweepAngle. Both startAngle and\n * sweepAngle are measured in degrees, where zero degrees is aligned with the\n * positive x-axis, and positive sweeps extends arc clockwise.\n * Returns the modified path for easier chaining.\n * @param oval\n * @param startAngleInDegrees\n * @param sweepAngleInDegrees\n * @param forceMoveTo\n */\n arcToOval(\n oval: SkRect,\n startAngleInDegrees: number,\n sweepAngleInDegrees: number,\n forceMoveTo: boolean\n ): SkPath;\n\n /**\n * Appends arc to Path. Arc is implemented by one or more conics weighted to\n * describe part of oval with radii (rx, ry) rotated by xAxisRotate degrees. Arc\n * curves from last Path Point to (x, y), choosing one of four possible routes:\n * clockwise or counterclockwise, and smaller or larger. See SkPath.h for more details.\n * Returns the modified path for easier chaining.\n * @param rx\n * @param ry\n * @param xAxisRotate\n * @param useSmallArc\n * @param isCCW\n * @param x\n * @param y\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 ): SkPath;\n\n /**\n * Appends arc to Path, after appending line if needed. Arc is implemented by conic\n * weighted to describe part of circle. Arc is contained by tangent from\n * last Path point to (x1, y1), and tangent from (x1, y1) to (x2, y2). Arc\n * is part of circle sized to radius, positioned so it touches both tangent lines.\n * Returns the modified path for easier chaining.\n * @param x1\n * @param y1\n * @param x2\n * @param y2\n * @param radius\n */\n arcToTangent(\n x1: number,\n y1: number,\n x2: number,\n y2: number,\n radius: number\n ): SkPath;\n\n /**\n * Adds conic from last point towards (x1, y1), to (x2, y2), weighted by w.\n * If Path is empty, or path is closed, the last point is set to (0, 0)\n * before adding conic.\n * Returns the modified path for easier chaining.\n * @param x1\n * @param y1\n * @param x2\n * @param y2\n * @param w\n */\n conicTo(x1: number, y1: number, x2: number, y2: number, w: number): SkPath;\n\n /**\n * Returns true if the point (x, y) is contained by Path, taking into\n * account FillType.\n * @param x\n * @param y\n */\n contains(x: number, y: number): boolean;\n\n /**\n * Returns a copy of this Path.\n */\n copy(): SkPath;\n\n /**\n * Adds cubic from last point towards (x1, y1), then towards (x2, y2), ending at\n * (x3, y3). If Path is empty, or path is closed, the last point is set to\n * (0, 0) before adding cubic.\n * @param cpx1\n * @param cpy1\n * @param cpx2\n * @param cpy2\n * @param x\n * @param y\n */\n cubicTo(\n cpx1: number,\n cpy1: number,\n cpx2: number,\n cpy2: number,\n x: number,\n y: number\n ): SkPath;\n\n /**\n * Changes this path to be the dashed version of itself. This is the same effect as creating\n * a DashPathEffect and calling filterPath on this path.\n * @param on\n * @param off\n * @param phase\n */\n dash(on: number, off: number, phase: number): boolean;\n\n /**\n * Returns true if other path is equal to this path.\n * @param other\n */\n equals(other: SkPath): boolean;\n\n /**\n * Returns minimum and maximum axes values of Point array.\n * Returns (0, 0, 0, 0) if Path contains no points. Returned bounds width and height may\n * be larger or smaller than area affected when Path is drawn.\n */\n getBounds(): SkRect;\n\n /**\n * Return the FillType for this path.\n */\n getFillType(): FillType;\n\n /**\n Adds quad from last point towards (x1, y1), to (x2, y2).\n\n If SkPath is empty, or last SkPath::Verb is kClose_Verb, last point is set to (0, 0) before adding quad.\n\n Appends kMove_Verb to verb array and (0, 0) to SkPoint array, if needed; then appends kQuad_Verb to verb array;\n and (x1, y1), (x2, y2) to SkPoint array.\n\n Parameters\n x1\tcontrol SkPoint of quad on x-axis\n y1\tcontrol SkPoint of quad on y-axis\n x2\tend SkPoint of quad on x-axis\n y2\tend SkPoint of quad on y-axis\n Returns\n reference to SkPath\n example: https://fiddle.skia.org/c/@Path_quadTo\n */\n quadTo(x1: number, y1: number, x2: number, y2: number): void;\n\n /**\n * Adds Rect to Path, appending kMove_Verb, three kLine_Verb, and kClose_Verb,\n * starting with top-left corner of Rect; followed by top-right, bottom-right,\n * and bottom-left if isCCW is false; or followed by bottom-left,\n * bottom-right, and top-right if isCCW is true.\n * Returns the modified path for easier chaining.\n * @param rect\n * @param isCCW\n */\n addRect(rect: SkRect, isCCW?: boolean): void;\n\n /**\n * Adds rrect to Path, creating a new closed contour.\n * Returns the modified path for easier chaining.\n * @param rrect\n * @param isCCW\n */\n addRRect(rrect: SkRRect, isCCW?: boolean): SkPath;\n\n /**\n * Returns the Point at index in Point array. Valid range for index is\n * 0 to countPoints() - 1.\n * @param index\n */\n getPoint(index: number): SkPoint;\n\n /**\n * Returns true if there are no verbs in the path.\n */\n isEmpty(): boolean;\n\n /**\n * Returns true if the path is volatile; it will not be altered or discarded\n * by the caller after it is drawn. Path by default have volatile set false, allowing\n * Surface to attach a cache of data which speeds repeated drawing. If true, Surface\n * may not speed repeated drawing.\n */\n isVolatile(): boolean;\n\n /** Adds circle centered at (x, y) of size radius to SkPath, appending kMove_Verb,\n four kConic_Verb, and kClose_Verb. Circle begins at: (x + radius, y), continuing\n clockwise if dir is kCW_Direction, and counterclockwise if dir is kCCW_Direction.\n\n Has no effect if radius is zero or negative.\n\n @param x center of circle\n @param y center of circle\n @param radius distance from center to edge \n @return reference to SkPath\n */\n addCircle(x: number, y: number, r: number): SkPath;\n\n getLastPt(): { x: number; y: number };\n\n /** Set this path to the result of applying the Op to this path and the\n specified path: this = (this op operand).\n The resulting path will be constructed from non-overlapping contours.\n The curve order is reduced where possible so that cubics may be turned\n into quadratics, and quadratics maybe turned into lines.\n\n Returns true if operation was able to produce a result;\n otherwise, result is unmodified.\n\n @param path The second path (for difference, the subtrahend)\n @param op The operator to apply.\n @param result The product of the operands. The result may be one of the\n inputs.\n @return True if the operation succeeded.\n */\n op(path: SkPath, op: PathOp): boolean;\n\n /** Set this path to a set of non-overlapping contours that describe the\n same area as the original path.\n The curve order is reduced where possible so that cubics may\n be turned into quadratics, and quadratics maybe turned into lines.\n\n Returns true if operation was able to produce a result;\n otherwise, result is unmodified.\n\n @param result The simplified path. The result may be the input.\n @return True if simplification succeeded.\n */\n simplify(): boolean;\n\n /**\n * Returns this path as an SVG string.\n */\n toSVGString(): string;\n\n /**\n * Take start and stop \"t\" values (values between 0...1), and modify this path such that\n * it is a subset of the original path.\n * The trim values apply to the entire path, so if it contains several contours, all of them\n * are including in the calculation.\n * Null is returned if either input value is NaN.\n * @param startT - a value in the range [0.0, 1.0]. 0.0 is the beginning of the path.\n * @param stopT - a value in the range [0.0, 1.0]. 1.0 is the end of the path.\n * @param isComplement\n */\n trim(startT: number, stopT: number, isComplement: boolean): null | SkPath;\n\n /**\n * Transforms the path by the specified matrix.\n */\n transform(m3: SkMatrix): void;\n\n /**\n * Interpolates between Path with point array of equal size.\n * Copy verb array and weights to result, and set result path to a weighted\n * average of this path array and ending path.\n\n * weight is most useful when between zero (ending path) and\n one (this path); will work with values outside of this\n range.\n\n * interpolate() returns undefined if path is not\n * the same size as ending path. Call isInterpolatable() to check Path\n * compatibility prior to calling interpolate().\n\n * @param ending path to interpolate with\n * @param weight contribution of this path, and\n * one minus contribution of ending path\n * @return Path replaced by interpolated averages or null if \n * not interpolatable\n * */\n interpolate(end: SkPath, weight: number): SkPath | null;\n\n /** Returns true if Path contain equal verbs and equal weights.\n * @param compare path to compare\n * @return true if Path can be interpolated equivalent\n *\n * */\n isInterpolatable(compare: SkPath): boolean;\n\n /**\n * Serializes the contents of this path as a series of commands.\n */\n toCmds(): PathCommand[];\n}\n"]}
|
1
|
+
{"version":3,"sources":["Path.ts"],"names":["FillType","PathOp","PathVerb","isPath","obj","__typename__"],"mappings":"AAOA;AACA;AACA;AAcA,WAAYA,QAAZ;;WAAYA,Q;AAAAA,EAAAA,Q,CAAAA,Q;AAAAA,EAAAA,Q,CAAAA,Q;AAAAA,EAAAA,Q,CAAAA,Q;AAAAA,EAAAA,Q,CAAAA,Q;GAAAA,Q,KAAAA,Q;;AAOZ,WAAYC,MAAZ;;WAAYA,M;AAAAA,EAAAA,M,CAAAA,M;AAAAA,EAAAA,M,CAAAA,M;AAAAA,EAAAA,M,CAAAA,M;AAAAA,EAAAA,M,CAAAA,M;AAAAA,EAAAA,M,CAAAA,M;GAAAA,M,KAAAA,M;;AAQZ,WAAYC,QAAZ;;WAAYA,Q;AAAAA,EAAAA,Q,CAAAA,Q;AAAAA,EAAAA,Q,CAAAA,Q;AAAAA,EAAAA,Q,CAAAA,Q;AAAAA,EAAAA,Q,CAAAA,Q;AAAAA,EAAAA,Q,CAAAA,Q;AAAAA,EAAAA,Q,CAAAA,Q;GAAAA,Q,KAAAA,Q;;AAWZ,OAAO,MAAMC,MAAM,GAAIC,GAAD,IACpBA,GAAG,KAAK,IAAR,IAAgBA,GAAG,CAACC,YAAJ,KAAqB,MADhC","sourcesContent":["import type { SkRect } from \"../Rect\";\nimport type { SkPoint } from \"../Point\";\nimport type { SkRRect } from \"../RRect\";\nimport type { StrokeJoin, StrokeCap } from \"../Paint\";\nimport type { SkMatrix } from \"../Matrix\";\nimport type { SkJSIInstance } from \"../JsiInstance\";\n\n/**\n * Options used for Path.stroke(). If an option is omitted, a sensible default will be used.\n */\nexport interface StrokeOpts {\n /** The width of the stroked lines. */\n width?: number;\n miter_limit?: number;\n /**\n * if > 1, increase precision, else if (0 < resScale < 1) reduce precision to\n * favor speed and size\n */\n precision?: number;\n join?: StrokeJoin;\n cap?: StrokeCap;\n}\n\nexport enum FillType {\n Winding,\n EvenOdd,\n InverseWinding,\n InverseEvenOdd,\n}\n\nexport enum PathOp {\n Difference, //!< subtract the op path from the first path\n Intersect, //!< intersect the two paths\n Union, //!< union (inclusive-or) the two paths\n XOR, //!< exclusive-or the two paths\n ReverseDifference,\n}\n\nexport enum PathVerb {\n Move,\n Line,\n Quad,\n Conic,\n Cubic,\n Close,\n}\n\nexport type PathCommand = number[];\n\nexport const isPath = (obj: SkJSIInstance<string> | null): obj is SkPath =>\n obj !== null && obj.__typename__ === \"Path\";\n\nexport interface SkPath extends SkJSIInstance<\"Path\"> {\n /**\n * Appends arc to Path, as the start of new contour. Arc added is part of ellipse\n * bounded by oval, from startAngle through sweepAngle. Both startAngle and\n * sweepAngle are measured in degrees, where zero degrees is aligned with the\n * positive x-axis, and positive sweeps extends arc clockwise.\n * Returns the modified path for easier chaining.\n * @param oval\n * @param startAngle\n * @param sweepAngle\n */\n addArc(\n oval: SkRect,\n startAngleInDegrees: number,\n sweepAngleInDegrees: number\n ): SkPath;\n\n /**\n * Adds oval to Path, appending kMove_Verb, four kConic_Verb, and kClose_Verb.\n * Oval is upright ellipse bounded by Rect oval with radii equal to half oval width\n * and half oval height. Oval begins at start and continues clockwise by default.\n * Returns the modified path for easier chaining.\n * @param oval\n * @param isCCW - if the path should be drawn counter-clockwise or not\n * @param startIndex - index of initial point of ellipse\n */\n addOval(oval: SkRect, isCCW?: boolean, startIndex?: number): SkPath;\n\n /**\n * Returns the number of points in this path. Initially zero.\n */\n countPoints(): number;\n\n /**\n * Adds contour created from array of n points, adding (count - 1) line segments.\n * Contour added starts at pts[0], then adds a line for every additional point\n * in pts array. If close is true, appends kClose_Verb to Path, connecting\n * pts[count - 1] and pts[0].\n * Returns the modified path for easier chaining.\n * @param points\n * @param close - if true, will add a line connecting last point to the first point.\n */\n addPoly(points: SkPoint[], close: boolean): SkPath;\n\n /** Adds beginning of contour at SkPoint (x, y).\n\n @param x x-axis value of contour start\n @param y y-axis value of contour start\n @return reference to SkPath\n\n example: https://fiddle.skia.org/c/@Path_moveTo\n */\n moveTo(x: number, y: number): SkPath;\n /** Adds line from last point to (x, y). If SkPath is empty, or last SkPath::Verb is\n kClose_Verb, last point is set to (0, 0) before adding line.\n\n lineTo() appends kMove_Verb to verb array and (0, 0) to SkPoint array, if needed.\n lineTo() then appends kLine_Verb to verb array and (x, y) to SkPoint array.\n\n @param x end of added line on x-axis\n @param y end of added line on y-axis\n @return reference to SkPath\n\n example: https://fiddle.skia.org/c/@Path_lineTo\n */\n lineTo(x: number, y: number): SkPath;\n\n /**\n * Returns a new path that covers the same area as the original path, but with the\n * Winding FillType. This may re-draw some contours in the path as counter-clockwise\n * instead of clockwise to achieve that effect. If such a transformation cannot\n * be done, null is returned.\n */\n makeAsWinding(): SkPath | null;\n\n /**\n * Translates all the points in the path by dx, dy.\n * @param dx\n * @param dy\n */\n offset(dx: number, dy: number): SkPath;\n\n /**\n * Relative version of arcToRotated.\n * @param rx\n * @param ry\n * @param xAxisRotate\n * @param useSmallArc\n * @param isCCW\n * @param dx\n * @param dy\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 ): SkPath;\n\n /**\n * Relative version of conicTo.\n * @param dx1\n * @param dy1\n * @param dx2\n * @param dy2\n * @param w\n */\n rConicTo(\n dx1: number,\n dy1: number,\n dx2: number,\n dy2: number,\n w: number\n ): SkPath;\n\n /**\n * Relative version of cubicTo.\n * @param cpx1\n * @param cpy1\n * @param cpx2\n * @param cpy2\n * @param x\n * @param y\n */\n rCubicTo(\n cpx1: number,\n cpy1: number,\n cpx2: number,\n cpy2: number,\n x: number,\n y: number\n ): SkPath;\n\n /**\n * Relative version of moveTo.\n * @param x\n * @param y\n */\n rMoveTo(x: number, y: number): SkPath;\n\n /**\n * Relative version of lineTo.\n * @param x\n * @param y\n */\n rLineTo(x: number, y: number): SkPath;\n\n /**\n * Relative version of quadTo.\n * @param x1\n * @param y1\n * @param x2\n * @param y2\n */\n rQuadTo(x1: number, y1: number, x2: number, y2: number): SkPath;\n\n /**\n * Sets FillType, the rule used to fill Path.\n * @param fill\n */\n setFillType(fill: FillType): void;\n\n /**\n * Specifies whether Path is volatile; whether it will be altered or discarded\n * by the caller after it is drawn. Path by default have volatile set false.\n *\n * Mark animating or temporary paths as volatile to improve performance.\n * Mark unchanging Path non-volatile to improve repeated rendering.\n * @param volatile\n */\n setIsVolatile(volatile: boolean): void;\n\n /**\n * Turns this path into the filled equivalent of the stroked path. Returns false if the operation\n * fails (e.g. the path is a hairline).\n * @param opts - describe how stroked path should look.\n * If such a transformation cannot be done, null is returned.\n */\n stroke(opts?: StrokeOpts): null | SkPath;\n\n /**\n * Appends CLOSE_VERB to Path. A closed contour connects the first and last point\n * with a line, forming a continuous loop.\n */\n close(): void;\n\n /**\n * Sets Path to its initial state.\n * Removes verb array, point array, and weights, and sets FillType to Winding.\n * Internal storage associated with Path is released\n */\n reset(): void;\n\n /**\n * Sets Path to its initial state.\n * Removes verb array, point array, and weights, and sets FillType to Winding.\n * Internal storage associated with Path is *not* released.\n * Use rewind() instead of reset() if Path storage will be reused and performance\n * is critical.\n */\n rewind(): void;\n\n /**\n * Returns minimum and maximum axes values of the lines and curves in Path.\n * Returns (0, 0, 0, 0) if Path contains no points.\n * Returned bounds width and height may be larger or smaller than area affected\n * when Path is drawn.\n *\n * Behaves identically to getBounds() when Path contains\n * only lines. If Path contains curves, computed bounds includes\n * the maximum extent of the quad, conic, or cubic; is slower than getBounds();\n * and unlike getBounds(), does not cache the result.\n */\n computeTightBounds(): SkRect;\n\n /**\n * Appends arc to Path. Arc added is part of ellipse\n * bounded by oval, from startAngle through sweepAngle. Both startAngle and\n * sweepAngle are measured in degrees, where zero degrees is aligned with the\n * positive x-axis, and positive sweeps extends arc clockwise.\n * Returns the modified path for easier chaining.\n * @param oval\n * @param startAngleInDegrees\n * @param sweepAngleInDegrees\n * @param forceMoveTo\n */\n arcToOval(\n oval: SkRect,\n startAngleInDegrees: number,\n sweepAngleInDegrees: number,\n forceMoveTo: boolean\n ): SkPath;\n\n /**\n * Appends arc to Path. Arc is implemented by one or more conics weighted to\n * describe part of oval with radii (rx, ry) rotated by xAxisRotate degrees. Arc\n * curves from last Path Point to (x, y), choosing one of four possible routes:\n * clockwise or counterclockwise, and smaller or larger. See SkPath.h for more details.\n * Returns the modified path for easier chaining.\n * @param rx\n * @param ry\n * @param xAxisRotate\n * @param useSmallArc\n * @param isCCW\n * @param x\n * @param y\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 ): SkPath;\n\n /**\n * Appends arc to Path, after appending line if needed. Arc is implemented by conic\n * weighted to describe part of circle. Arc is contained by tangent from\n * last Path point to (x1, y1), and tangent from (x1, y1) to (x2, y2). Arc\n * is part of circle sized to radius, positioned so it touches both tangent lines.\n * Returns the modified path for easier chaining.\n * @param x1\n * @param y1\n * @param x2\n * @param y2\n * @param radius\n */\n arcToTangent(\n x1: number,\n y1: number,\n x2: number,\n y2: number,\n radius: number\n ): SkPath;\n\n /**\n * Adds conic from last point towards (x1, y1), to (x2, y2), weighted by w.\n * If Path is empty, or path is closed, the last point is set to (0, 0)\n * before adding conic.\n * Returns the modified path for easier chaining.\n * @param x1\n * @param y1\n * @param x2\n * @param y2\n * @param w\n */\n conicTo(x1: number, y1: number, x2: number, y2: number, w: number): SkPath;\n\n /**\n * Returns true if the point (x, y) is contained by Path, taking into\n * account FillType.\n * @param x\n * @param y\n */\n contains(x: number, y: number): boolean;\n\n /**\n * Returns a copy of this Path.\n */\n copy(): SkPath;\n\n /**\n * Adds cubic from last point towards (x1, y1), then towards (x2, y2), ending at\n * (x3, y3). If Path is empty, or path is closed, the last point is set to\n * (0, 0) before adding cubic.\n * @param cpx1\n * @param cpy1\n * @param cpx2\n * @param cpy2\n * @param x\n * @param y\n */\n cubicTo(\n cpx1: number,\n cpy1: number,\n cpx2: number,\n cpy2: number,\n x: number,\n y: number\n ): SkPath;\n\n /**\n * Changes this path to be the dashed version of itself. This is the same effect as creating\n * a DashPathEffect and calling filterPath on this path.\n * @param on\n * @param off\n * @param phase\n */\n dash(on: number, off: number, phase: number): boolean;\n\n /**\n * Returns true if other path is equal to this path.\n * @param other\n */\n equals(other: SkPath): boolean;\n\n /**\n * Returns minimum and maximum axes values of Point array.\n * Returns (0, 0, 0, 0) if Path contains no points. Returned bounds width and height may\n * be larger or smaller than area affected when Path is drawn.\n */\n getBounds(): SkRect;\n\n /**\n * Return the FillType for this path.\n */\n getFillType(): FillType;\n\n /**\n Adds quad from last point towards (x1, y1), to (x2, y2).\n\n If SkPath is empty, or last SkPath::Verb is kClose_Verb, last point is set to (0, 0) before adding quad.\n\n Appends kMove_Verb to verb array and (0, 0) to SkPoint array, if needed; then appends kQuad_Verb to verb array;\n and (x1, y1), (x2, y2) to SkPoint array.\n\n Parameters\n x1\tcontrol SkPoint of quad on x-axis\n y1\tcontrol SkPoint of quad on y-axis\n x2\tend SkPoint of quad on x-axis\n y2\tend SkPoint of quad on y-axis\n Returns\n reference to SkPath\n example: https://fiddle.skia.org/c/@Path_quadTo\n */\n quadTo(x1: number, y1: number, x2: number, y2: number): void;\n\n /**\n * Adds Rect to Path, appending kMove_Verb, three kLine_Verb, and kClose_Verb,\n * starting with top-left corner of Rect; followed by top-right, bottom-right,\n * and bottom-left if isCCW is false; or followed by bottom-left,\n * bottom-right, and top-right if isCCW is true.\n * Returns the modified path for easier chaining.\n * @param rect\n * @param isCCW\n */\n addRect(rect: SkRect, isCCW?: boolean): void;\n\n /**\n * Adds rrect to Path, creating a new closed contour.\n * Returns the modified path for easier chaining.\n * @param rrect\n * @param isCCW\n */\n addRRect(rrect: SkRRect, isCCW?: boolean): SkPath;\n\n /**\n * Returns the Point at index in Point array. Valid range for index is\n * 0 to countPoints() - 1.\n * @param index\n */\n getPoint(index: number): SkPoint;\n\n /**\n * Returns true if there are no verbs in the path.\n */\n isEmpty(): boolean;\n\n /**\n * Returns true if the path is volatile; it will not be altered or discarded\n * by the caller after it is drawn. Path by default have volatile set false, allowing\n * Surface to attach a cache of data which speeds repeated drawing. If true, Surface\n * may not speed repeated drawing.\n */\n isVolatile(): boolean;\n\n /** Adds circle centered at (x, y) of size radius to SkPath, appending kMove_Verb,\n four kConic_Verb, and kClose_Verb. Circle begins at: (x + radius, y), continuing\n clockwise if dir is kCW_Direction, and counterclockwise if dir is kCCW_Direction.\n\n Has no effect if radius is zero or negative.\n\n @param x center of circle\n @param y center of circle\n @param radius distance from center to edge \n @return reference to SkPath\n */\n addCircle(x: number, y: number, r: number): SkPath;\n\n getLastPt(): { x: number; y: number };\n\n /** Set this path to the result of applying the Op to this path and the\n specified path: this = (this op operand).\n The resulting path will be constructed from non-overlapping contours.\n The curve order is reduced where possible so that cubics may be turned\n into quadratics, and quadratics maybe turned into lines.\n\n Returns true if operation was able to produce a result;\n otherwise, result is unmodified.\n\n @param path The second path (for difference, the subtrahend)\n @param op The operator to apply.\n @param result The product of the operands. The result may be one of the\n inputs.\n @return True if the operation succeeded.\n */\n op(path: SkPath, op: PathOp): boolean;\n\n /** Set this path to a set of non-overlapping contours that describe the\n same area as the original path.\n The curve order is reduced where possible so that cubics may\n be turned into quadratics, and quadratics maybe turned into lines.\n\n Returns true if operation was able to produce a result;\n otherwise, result is unmodified.\n\n @param result The simplified path. The result may be the input.\n @return True if simplification succeeded.\n */\n simplify(): boolean;\n\n /**\n * Returns this path as an SVG string.\n */\n toSVGString(): string;\n\n /**\n * Take start and stop \"t\" values (values between 0...1), and modify this path such that\n * it is a subset of the original path.\n * The trim values apply to the entire path, so if it contains several contours, all of them\n * are including in the calculation.\n * Null is returned if either input value is NaN.\n * @param startT - a value in the range [0.0, 1.0]. 0.0 is the beginning of the path.\n * @param stopT - a value in the range [0.0, 1.0]. 1.0 is the end of the path.\n * @param isComplement\n */\n trim(startT: number, stopT: number, isComplement: boolean): null | SkPath;\n\n /**\n * Transforms the path by the specified matrix.\n */\n transform(m3: SkMatrix): void;\n\n /**\n * Interpolates between Path with point array of equal size.\n * Copy verb array and weights to result, and set result path to a weighted\n * average of this path array and ending path.\n\n * weight is most useful when between zero (ending path) and\n one (this path); will work with values outside of this\n range.\n\n * interpolate() returns undefined if path is not\n * the same size as ending path. Call isInterpolatable() to check Path\n * compatibility prior to calling interpolate().\n\n * @param ending path to interpolate with\n * @param weight contribution of this path, and\n * one minus contribution of ending path\n * @return Path replaced by interpolated averages or null if \n * not interpolatable\n * */\n interpolate(end: SkPath, weight: number): SkPath | null;\n\n /** Returns true if Path contain equal verbs and equal weights.\n * @param compare path to compare\n * @return true if Path can be interpolated equivalent\n *\n * */\n isInterpolatable(compare: SkPath): boolean;\n\n /**\n * Serializes the contents of this path as a series of commands.\n */\n toCmds(): PathCommand[];\n}\n"]}
|
@@ -1,12 +1,13 @@
|
|
1
1
|
import { ckEnum, HostObject, toValue, toUndefinedableValue, toOptionalValue } from "./Host";
|
2
2
|
import { JsiSkRect } from "./JsiSkRect";
|
3
|
+
import { JsiSkRRect } from "./JsiSkRRect";
|
3
4
|
export class JsiSkCanvas extends HostObject {
|
4
5
|
constructor(CanvasKit, ref) {
|
5
6
|
super(CanvasKit, ref, "Canvas");
|
6
7
|
}
|
7
8
|
|
8
9
|
drawRect(rect, paint) {
|
9
|
-
this.ref.drawRect(JsiSkRect.fromValue(this.CanvasKit, rect)
|
10
|
+
this.ref.drawRect(JsiSkRect.fromValue(this.CanvasKit, rect), toValue(paint));
|
10
11
|
}
|
11
12
|
|
12
13
|
drawImage(image, x, y, paint) {
|
@@ -14,7 +15,7 @@ export class JsiSkCanvas extends HostObject {
|
|
14
15
|
}
|
15
16
|
|
16
17
|
drawImageRect(img, src, dest, paint, fastSample) {
|
17
|
-
this.ref.drawImageRect(toValue(img), JsiSkRect.fromValue(this.CanvasKit, src)
|
18
|
+
this.ref.drawImageRect(toValue(img), JsiSkRect.fromValue(this.CanvasKit, src), JsiSkRect.fromValue(this.CanvasKit, dest), toValue(paint), fastSample);
|
18
19
|
}
|
19
20
|
|
20
21
|
drawImageCubic(img, left, top, B, C, paint) {
|
@@ -30,11 +31,11 @@ export class JsiSkCanvas extends HostObject {
|
|
30
31
|
}
|
31
32
|
|
32
33
|
drawImageRectCubic(img, src, dest, B, C, paint) {
|
33
|
-
this.ref.drawImageRectCubic(toValue(img), JsiSkRect.fromValue(this.CanvasKit, src)
|
34
|
+
this.ref.drawImageRectCubic(toValue(img), JsiSkRect.fromValue(this.CanvasKit, src), JsiSkRect.fromValue(this.CanvasKit, dest), B, C, toOptionalValue(paint));
|
34
35
|
}
|
35
36
|
|
36
37
|
drawImageRectOptions(img, src, dest, fm, mm, paint) {
|
37
|
-
this.ref.drawImageRectOptions(toValue(img), JsiSkRect.fromValue(this.CanvasKit, src)
|
38
|
+
this.ref.drawImageRectOptions(toValue(img), JsiSkRect.fromValue(this.CanvasKit, src), JsiSkRect.fromValue(this.CanvasKit, dest), ckEnum(fm), ckEnum(mm), toOptionalValue(paint));
|
38
39
|
}
|
39
40
|
|
40
41
|
drawPaint(paint) {
|
@@ -82,7 +83,7 @@ export class JsiSkCanvas extends HostObject {
|
|
82
83
|
}
|
83
84
|
|
84
85
|
drawRRect(rrect, paint) {
|
85
|
-
this.ref.drawRRect(
|
86
|
+
this.ref.drawRRect(JsiSkRRect.fromValue(this.CanvasKit, rrect), toValue(paint));
|
86
87
|
}
|
87
88
|
|
88
89
|
drawDRRect(outer, inner, paint) {
|
@@ -154,11 +155,11 @@ export class JsiSkCanvas extends HostObject {
|
|
154
155
|
}
|
155
156
|
|
156
157
|
clipRect(rect, op, doAntiAlias) {
|
157
|
-
this.ref.clipRect(
|
158
|
+
this.ref.clipRect(JsiSkRect.fromValue(this.CanvasKit, rect), ckEnum(op), doAntiAlias);
|
158
159
|
}
|
159
160
|
|
160
161
|
clipRRect(rrect, op, doAntiAlias) {
|
161
|
-
this.ref.clipRRect(
|
162
|
+
this.ref.clipRRect(JsiSkRRect.fromValue(this.CanvasKit, rrect), ckEnum(op), doAntiAlias);
|
162
163
|
}
|
163
164
|
|
164
165
|
concat(m) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["JsiSkCanvas.ts"],"names":["ckEnum","HostObject","toValue","toUndefinedableValue","toOptionalValue","JsiSkRect","JsiSkCanvas","constructor","CanvasKit","ref","drawRect","rect","paint","fromValue","drawImage","image","x","y","drawImageRect","img","src","dest","fastSample","drawImageCubic","left","top","B","C","drawImageOptions","fm","mm","drawImageNine","center","filter","drawImageRectCubic","drawImageRectOptions","drawPaint","drawLine","x0","y0","x1","y1","drawCircle","cx","cy","radius","drawVertices","verts","mode","drawPatch","cubics","colors","texs","map","flat","restoreToCount","saveCount","drawPoints","points","drawArc","oval","startAngle","sweepAngle","useCenter","drawRRect","rrect","drawDRRect","outer","inner","drawOval","drawPath","path","drawText","str","font","drawTextBlob","blob","drawGlyphs","glyphs","positions","p","drawSvg","_svgDom","_width","_height","Error","save","saveLayer","bounds","backdrop","flags","restore","rotate","rotationInDegrees","rx","ry","scale","sx","sy","skew","translate","dx","dy","drawColor","color","blendMode","undefined","clear","clipPath","op","doAntiAlias","clipRect","clipRRect","concat","m","drawPicture","skp"],"mappings":"AA0BA,SACEA,MADF,EAEEC,UAFF,EAGEC,OAHF,EAIEC,oBAJF,EAKEC,eALF,QAMO,QANP;AAOA,SAASC,SAAT,QAA0B,aAA1B;AAEA,OAAO,MAAMC,WAAN,SACGL,UADH,CAGP;AACEM,EAAAA,WAAW,CAACC,SAAD,EAAuBC,GAAvB,EAAoC;AAC7C,UAAMD,SAAN,EAAiBC,GAAjB,EAAsB,QAAtB;AACD;;AAEDC,EAAAA,QAAQ,CAACC,IAAD,EAAeC,KAAf,EAA+B;AACrC,SAAKH,GAAL,CAASC,QAAT,CACEL,SAAS,CAACQ,SAAV,CAAoB,KAAKL,SAAzB,EAAoCG,IAApC,EAA0CF,GAD5C,EAEEP,OAAO,CAAQU,KAAR,CAFT;AAID;;AAEDE,EAAAA,SAAS,CAACC,KAAD,EAAiBC,CAAjB,EAA4BC,CAA5B,EAAuCL,KAAvC,EAAwD;AAC/D,SAAKH,GAAL,CAASK,SAAT,CAAmBZ,OAAO,CAAQa,KAAR,CAA1B,EAA0CC,CAA1C,EAA6CC,CAA7C,EAAgDb,eAAe,CAACQ,KAAD,CAA/D;AACD;;AAEDM,EAAAA,aAAa,CACXC,GADW,EAEXC,GAFW,EAGXC,IAHW,EAIXT,KAJW,EAKXU,UALW,EAMX;AACA,SAAKb,GAAL,CAASS,aAAT,CACEhB,OAAO,CAAQiB,GAAR,CADT,EAEEd,SAAS,CAACQ,SAAV,CAAoB,KAAKL,SAAzB,EAAoCY,GAApC,EAAyCX,GAF3C,EAGEJ,SAAS,CAACQ,SAAV,CAAoB,KAAKL,SAAzB,EAAoCa,IAApC,EAA0CZ,GAH5C,EAIEP,OAAO,CAAQU,KAAR,CAJT,EAKEU,UALF;AAOD;;AAEDC,EAAAA,cAAc,CACZJ,GADY,EAEZK,IAFY,EAGZC,GAHY,EAIZC,CAJY,EAKZC,CALY,E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AAEDC,EAAAA,SAAS,CAACC,KAAD,EAAiBC,SAAjB,EAAwC;AAC/C,SAAKhG,GAAL,CAAS8F,SAAT,CAAmBC,KAAnB,EAA0BC,SAAS,GAAGzG,MAAM,CAACyG,SAAD,CAAT,GAAuBC,SAA1D;AACD;;AAEDC,EAAAA,KAAK,CAACH,KAAD,EAAiB;AACpB,SAAK/F,GAAL,CAASkG,KAAT,CAAeH,KAAf;AACD;;AAEDI,EAAAA,QAAQ,CAACrC,IAAD,EAAesC,EAAf,EAA2BC,WAA3B,EAAiD;AACvD,SAAKrG,GAAL,CAASmG,QAAT,CAAkB1G,OAAO,CAACqE,IAAD,CAAzB,EAAiCvE,MAAM,CAAC6G,EAAD,CAAvC,EAA6CC,WAA7C;AACD;;AAEDC,EAAAA,QAAQ,CAACpG,IAAD,EAAekG,EAAf,EAA2BC,WAA3B,EAAiD;AACvD,SAAKrG,GAAL,CAASsG,QAAT,CAAkB7G,OAAO,CAACS,IAAD,CAAzB,EAAiCX,MAAM,CAAC6G,EAAD,CAAvC,EAA6CC,WAA7C;AACD;;AAEDE,EAAAA,SAAS,CAAC/C,KAAD,EAAiB4C,EAAjB,EAA6BC,WAA7B,EAAmD;AAC1D,SAAKrG,GAAL,CAASuG,SAAT,CAAmB9G,OAAO,CAAC+D,KAAD,CAA1B,EAAmCjE,MAAM,CAAC6G,EAAD,CAAzC,EAA+CC,WAA/C;AACD;;AAEDG,EAAAA,MAAM,CAACC,CAAD,EAAc;AAClB,SAAKzG,GAAL,CAASwG,MAAT,CAAgB/G,OAAO,CAACgH,CAAD,CAAvB;AACD;;AAEDC,EAAAA,WAAW,CAACC,GAAD,EAAiB;AAC1B,SAAK3G,GAAL,CAAS0G,WAAT,CAAqBjH,OAAO,CAACkH,GAAD,CAA5B;AACD;;AAlSH","sourcesContent":["import type { Canvas, Image, CanvasKit, Paint } from \"canvaskit-wasm\";\n\nimport type {\n BlendMode,\n ClipOp,\n FilterMode,\n MipmapMode,\n PointMode,\n SaveLayerFlag,\n SkCanvas,\n SkColor,\n SkFont,\n SkImage,\n SkImageFilter,\n SkMatrix,\n SkPaint,\n SkPath,\n SkPicture,\n SkPoint,\n SkRect,\n SkRRect,\n SkSVG,\n SkTextBlob,\n SkVertices,\n} from \"../types\";\n\nimport {\n ckEnum,\n HostObject,\n toValue,\n toUndefinedableValue,\n toOptionalValue,\n} from \"./Host\";\nimport { JsiSkRect } from \"./JsiSkRect\";\n\nexport class JsiSkCanvas\n extends HostObject<Canvas, \"Canvas\">\n implements SkCanvas\n{\n constructor(CanvasKit: CanvasKit, ref: Canvas) {\n super(CanvasKit, ref, \"Canvas\");\n }\n\n drawRect(rect: SkRect, paint: SkPaint) {\n this.ref.drawRect(\n JsiSkRect.fromValue(this.CanvasKit, rect).ref,\n toValue<Paint>(paint)\n );\n }\n\n drawImage(image: SkImage, x: number, y: number, paint?: SkPaint) {\n this.ref.drawImage(toValue<Image>(image), x, y, toOptionalValue(paint));\n }\n\n drawImageRect(\n img: SkImage,\n src: SkRect,\n dest: SkRect,\n paint: SkPaint,\n fastSample?: boolean\n ) {\n this.ref.drawImageRect(\n toValue<Image>(img),\n JsiSkRect.fromValue(this.CanvasKit, src).ref,\n JsiSkRect.fromValue(this.CanvasKit, dest).ref,\n toValue<Paint>(paint),\n fastSample\n );\n }\n\n drawImageCubic(\n img: SkImage,\n left: number,\n top: number,\n B: number,\n C: number,\n paint?: SkPaint | null\n ) {\n this.ref.drawImageCubic(\n toValue(img),\n left,\n top,\n B,\n C,\n toOptionalValue(paint)\n );\n }\n\n drawImageOptions(\n img: SkImage,\n left: number,\n top: number,\n fm: FilterMode,\n mm: MipmapMode,\n paint?: SkPaint | null\n ) {\n this.ref.drawImageOptions(\n toValue(img),\n left,\n top,\n ckEnum(fm),\n ckEnum(mm),\n toOptionalValue(paint)\n );\n }\n\n drawImageNine(\n img: SkImage,\n center: SkRect,\n dest: SkRect,\n filter: FilterMode,\n paint?: SkPaint | null\n ) {\n this.ref.drawImageNine(\n toValue(img),\n toValue(center),\n toValue(dest),\n ckEnum(filter),\n toOptionalValue(paint)\n );\n }\n\n drawImageRectCubic(\n img: SkImage,\n src: SkRect,\n dest: SkRect,\n B: number,\n C: number,\n paint?: SkPaint | null\n ) {\n this.ref.drawImageRectCubic(\n toValue<Image>(img),\n JsiSkRect.fromValue(this.CanvasKit, src).ref,\n JsiSkRect.fromValue(this.CanvasKit, dest).ref,\n B,\n C,\n toOptionalValue(paint)\n );\n }\n\n drawImageRectOptions(\n img: SkImage,\n src: SkRect,\n dest: SkRect,\n fm: FilterMode,\n mm: MipmapMode,\n paint?: SkPaint | null\n ) {\n this.ref.drawImageRectOptions(\n toValue<Image>(img),\n JsiSkRect.fromValue(this.CanvasKit, src).ref,\n JsiSkRect.fromValue(this.CanvasKit, dest).ref,\n ckEnum(fm),\n ckEnum(mm),\n toOptionalValue(paint)\n );\n }\n\n drawPaint(paint: SkPaint) {\n this.ref.drawPaint(toValue(paint));\n }\n\n drawLine(x0: number, y0: number, x1: number, y1: number, paint: SkPaint) {\n this.ref.drawLine(x0, y0, x1, y1, toValue(paint));\n }\n\n drawCircle(cx: number, cy: number, radius: number, paint: SkPaint) {\n this.ref.drawCircle(cx, cy, radius, toValue(paint));\n }\n\n drawVertices(verts: SkVertices, mode: BlendMode, paint: SkPaint) {\n this.ref.drawVertices(toValue(verts), ckEnum(mode), toValue(paint));\n }\n\n drawPatch(\n cubics: SkPoint[],\n colors?: SkColor[] | null,\n texs?: SkPoint[] | null,\n mode?: BlendMode | null,\n paint?: SkPaint\n ) {\n this.ref.drawPatch(\n cubics.map(({ x, y }) => [x, y]).flat(),\n colors,\n toOptionalValue(texs),\n mode ? ckEnum(mode) : null,\n toUndefinedableValue(paint)\n );\n }\n\n restoreToCount(saveCount: number) {\n this.ref.restoreToCount(saveCount);\n }\n\n drawPoints(mode: PointMode, points: SkPoint[], paint: SkPaint) {\n this.ref.drawPoints(\n ckEnum(mode),\n points.map(({ x, y }) => [x, y]).flat(),\n toValue(paint)\n );\n }\n\n drawArc(\n oval: SkRect,\n startAngle: number,\n sweepAngle: number,\n useCenter: boolean,\n paint: SkPaint\n ) {\n this.ref.drawArc(\n toValue(oval),\n startAngle,\n sweepAngle,\n useCenter,\n toValue(paint)\n );\n }\n\n drawRRect(rrect: SkRRect, paint: SkPaint) {\n this.ref.drawRRect(toValue(rrect), toValue(paint));\n }\n\n drawDRRect(outer: SkRRect, inner: SkRRect, paint: SkPaint) {\n this.ref.drawDRRect(toValue(outer), toValue(inner), toValue(paint));\n }\n\n drawOval(oval: SkRect, paint: SkPaint) {\n this.ref.drawOval(toValue(oval), toValue(paint));\n }\n\n drawPath(path: SkPath, paint: SkPaint) {\n this.ref.drawPath(toValue(path), toValue(paint));\n }\n\n drawText(str: string, x: number, y: number, paint: SkPaint, font: SkFont) {\n this.ref.drawText(str, x, y, toValue(paint), toValue(font));\n }\n\n drawTextBlob(blob: SkTextBlob, x: number, y: number, paint: SkPaint) {\n this.ref.drawTextBlob(toValue(blob), x, y, toValue(paint));\n }\n\n drawGlyphs(\n glyphs: number[],\n positions: SkPoint[],\n x: number,\n y: number,\n font: SkFont,\n paint: SkPaint\n ) {\n this.ref.drawGlyphs(\n glyphs,\n positions.map((p) => [p.x, p.y]).flat(),\n x,\n y,\n toValue(font),\n toValue(paint)\n );\n }\n\n drawSvg(_svgDom: SkSVG, _width?: number, _height?: number) {\n throw new Error(\"drawSvg is not implemented on React Native Web\");\n }\n\n save() {\n return this.ref.save();\n }\n\n saveLayer(\n paint?: SkPaint,\n bounds?: SkRect | null,\n backdrop?: SkImageFilter | null,\n flags?: SaveLayerFlag\n ) {\n return this.ref.saveLayer(\n toUndefinedableValue(paint),\n toOptionalValue(bounds),\n toOptionalValue(backdrop),\n flags\n );\n }\n\n restore() {\n this.ref.restore();\n }\n\n rotate(rotationInDegrees: number, rx: number, ry: number) {\n this.ref.rotate(rotationInDegrees, rx, ry);\n }\n\n scale(sx: number, sy: number) {\n this.ref.scale(sx, sy);\n }\n\n skew(sx: number, sy: number) {\n this.ref.skew(sx, sy);\n }\n\n translate(dx: number, dy: number) {\n this.ref.translate(dx, dy);\n }\n\n drawColor(color: SkColor, blendMode?: BlendMode) {\n this.ref.drawColor(color, blendMode ? ckEnum(blendMode) : undefined);\n }\n\n clear(color: SkColor) {\n this.ref.clear(color);\n }\n\n clipPath(path: SkPath, op: ClipOp, doAntiAlias: boolean) {\n this.ref.clipPath(toValue(path), ckEnum(op), doAntiAlias);\n }\n\n clipRect(rect: SkRect, op: ClipOp, doAntiAlias: boolean) {\n this.ref.clipRect(toValue(rect), ckEnum(op), doAntiAlias);\n }\n\n clipRRect(rrect: SkRRect, op: ClipOp, doAntiAlias: boolean) {\n this.ref.clipRRect(toValue(rrect), ckEnum(op), doAntiAlias);\n }\n\n concat(m: SkMatrix) {\n this.ref.concat(toValue(m));\n }\n\n drawPicture(skp: SkPicture) {\n this.ref.drawPicture(toValue(skp));\n }\n}\n"]}
|
1
|
+
{"version":3,"sources":["JsiSkCanvas.ts"],"names":["ckEnum","HostObject","toValue","toUndefinedableValue","toOptionalValue","JsiSkRect","JsiSkRRect","JsiSkCanvas","constructor","CanvasKit","ref","drawRect","rect","paint","fromValue","drawImage","image","x","y","drawImageRect","img","src","dest","fastSample","drawImageCubic","left","top","B","C","drawImageOptions","fm","mm","drawImageNine","center","filter","drawImageRectCubic","drawImageRectOptions","drawPaint","drawLine","x0","y0","x1","y1","drawCircle","cx","cy","radius","drawVertices","verts","mode","drawPatch","cubics","colors","texs","map","flat","restoreToCount","saveCount","drawPoints","points","drawArc","oval","startAngle","sweepAngle","useCenter","drawRRect","rrect","drawDRRect","outer","inner","drawOval","drawPath","path","drawText","str","font","drawTextBlob","blob","drawGlyphs","glyphs","positions","p","drawSvg","_svgDom","_width","_height","Error","save","saveLayer","bounds","backdrop","flags","restore","rotate","rotationInDegrees","rx","ry","scale","sx","sy","skew","translate","dx","dy","drawColor","color","blendMode","undefined","clear","clipPath","op","doAntiAlias","clipRect","clipRRect","concat","m","dr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AAnB,EAA0BC,SAAS,GAAG1G,MAAM,CAAC0G,SAAD,CAAT,GAAuBC,SAA1D;AACD;;AAEDC,EAAAA,KAAK,CAACH,KAAD,EAAiB;AACpB,SAAK/F,GAAL,CAASkG,KAAT,CAAeH,KAAf;AACD;;AAEDI,EAAAA,QAAQ,CAACrC,IAAD,EAAesC,EAAf,EAA2BC,WAA3B,EAAiD;AACvD,SAAKrG,GAAL,CAASmG,QAAT,CAAkB3G,OAAO,CAACsE,IAAD,CAAzB,EAAiCxE,MAAM,CAAC8G,EAAD,CAAvC,EAA6CC,WAA7C;AACD;;AAEDC,EAAAA,QAAQ,CAACpG,IAAD,EAAekG,EAAf,EAA2BC,WAA3B,EAAiD;AACvD,SAAKrG,GAAL,CAASsG,QAAT,CACE3G,SAAS,CAACS,SAAV,CAAoB,KAAKL,SAAzB,EAAoCG,IAApC,CADF,EAEEZ,MAAM,CAAC8G,EAAD,CAFR,EAGEC,WAHF;AAKD;;AAEDE,EAAAA,SAAS,CAAC/C,KAAD,EAAiB4C,EAAjB,EAA6BC,WAA7B,EAAmD;AAC1D,SAAKrG,GAAL,CAASuG,SAAT,CACE3G,UAAU,CAACQ,SAAX,CAAqB,KAAKL,SAA1B,EAAqCyD,KAArC,CADF,EAEElE,MAAM,CAAC8G,EAAD,CAFR,EAGEC,WAHF;AAKD;;AAEDG,EAAAA,MAAM,CAACC,CAAD,EAAc;AAClB,SAAKzG,GAAL,CAASwG,MAAT,CAAgBhH,OAAO,CAACiH,CAAD,CAAvB;AACD;;AAEDC,EAAAA,WAAW,CAACC,GAAD,EAAiB;AAC1B,SAAK3G,GAAL,CAAS0G,WAAT,CAAqBlH,OAAO,CAACmH,GAAD,CAA5B;AACD;;AA7SH","sourcesContent":["import type { Canvas, Image, CanvasKit, Paint } from \"canvaskit-wasm\";\n\nimport type {\n BlendMode,\n ClipOp,\n FilterMode,\n MipmapMode,\n PointMode,\n SaveLayerFlag,\n SkCanvas,\n SkColor,\n SkFont,\n SkImage,\n SkImageFilter,\n SkMatrix,\n SkPaint,\n SkPath,\n SkPicture,\n SkPoint,\n SkRect,\n SkRRect,\n SkSVG,\n SkTextBlob,\n SkVertices,\n} from \"../types\";\n\nimport {\n ckEnum,\n HostObject,\n toValue,\n toUndefinedableValue,\n toOptionalValue,\n} from \"./Host\";\nimport { JsiSkRect } from \"./JsiSkRect\";\nimport { JsiSkRRect } from \"./JsiSkRRect\";\n\nexport class JsiSkCanvas\n extends HostObject<Canvas, \"Canvas\">\n implements SkCanvas\n{\n constructor(CanvasKit: CanvasKit, ref: Canvas) {\n super(CanvasKit, ref, \"Canvas\");\n }\n\n drawRect(rect: SkRect, paint: SkPaint) {\n this.ref.drawRect(\n JsiSkRect.fromValue(this.CanvasKit, rect),\n toValue<Paint>(paint)\n );\n }\n\n drawImage(image: SkImage, x: number, y: number, paint?: SkPaint) {\n this.ref.drawImage(toValue<Image>(image), x, y, toOptionalValue(paint));\n }\n\n drawImageRect(\n img: SkImage,\n src: SkRect,\n dest: SkRect,\n paint: SkPaint,\n fastSample?: boolean\n ) {\n this.ref.drawImageRect(\n toValue<Image>(img),\n JsiSkRect.fromValue(this.CanvasKit, src),\n JsiSkRect.fromValue(this.CanvasKit, dest),\n toValue<Paint>(paint),\n fastSample\n );\n }\n\n drawImageCubic(\n img: SkImage,\n left: number,\n top: number,\n B: number,\n C: number,\n paint?: SkPaint | null\n ) {\n this.ref.drawImageCubic(\n toValue(img),\n left,\n top,\n B,\n C,\n toOptionalValue(paint)\n );\n }\n\n drawImageOptions(\n img: SkImage,\n left: number,\n top: number,\n fm: FilterMode,\n mm: MipmapMode,\n paint?: SkPaint | null\n ) {\n this.ref.drawImageOptions(\n toValue(img),\n left,\n top,\n ckEnum(fm),\n ckEnum(mm),\n toOptionalValue(paint)\n );\n }\n\n drawImageNine(\n img: SkImage,\n center: SkRect,\n dest: SkRect,\n filter: FilterMode,\n paint?: SkPaint | null\n ) {\n this.ref.drawImageNine(\n toValue(img),\n toValue(center),\n toValue(dest),\n ckEnum(filter),\n toOptionalValue(paint)\n );\n }\n\n drawImageRectCubic(\n img: SkImage,\n src: SkRect,\n dest: SkRect,\n B: number,\n C: number,\n paint?: SkPaint | null\n ) {\n this.ref.drawImageRectCubic(\n toValue<Image>(img),\n JsiSkRect.fromValue(this.CanvasKit, src),\n JsiSkRect.fromValue(this.CanvasKit, dest),\n B,\n C,\n toOptionalValue(paint)\n );\n }\n\n drawImageRectOptions(\n img: SkImage,\n src: SkRect,\n dest: SkRect,\n fm: FilterMode,\n mm: MipmapMode,\n paint?: SkPaint | null\n ) {\n this.ref.drawImageRectOptions(\n toValue<Image>(img),\n JsiSkRect.fromValue(this.CanvasKit, src),\n JsiSkRect.fromValue(this.CanvasKit, dest),\n ckEnum(fm),\n ckEnum(mm),\n toOptionalValue(paint)\n );\n }\n\n drawPaint(paint: SkPaint) {\n this.ref.drawPaint(toValue(paint));\n }\n\n drawLine(x0: number, y0: number, x1: number, y1: number, paint: SkPaint) {\n this.ref.drawLine(x0, y0, x1, y1, toValue(paint));\n }\n\n drawCircle(cx: number, cy: number, radius: number, paint: SkPaint) {\n this.ref.drawCircle(cx, cy, radius, toValue(paint));\n }\n\n drawVertices(verts: SkVertices, mode: BlendMode, paint: SkPaint) {\n this.ref.drawVertices(toValue(verts), ckEnum(mode), toValue(paint));\n }\n\n drawPatch(\n cubics: SkPoint[],\n colors?: SkColor[] | null,\n texs?: SkPoint[] | null,\n mode?: BlendMode | null,\n paint?: SkPaint\n ) {\n this.ref.drawPatch(\n cubics.map(({ x, y }) => [x, y]).flat(),\n colors,\n toOptionalValue(texs),\n mode ? ckEnum(mode) : null,\n toUndefinedableValue(paint)\n );\n }\n\n restoreToCount(saveCount: number) {\n this.ref.restoreToCount(saveCount);\n }\n\n drawPoints(mode: PointMode, points: SkPoint[], paint: SkPaint) {\n this.ref.drawPoints(\n ckEnum(mode),\n points.map(({ x, y }) => [x, y]).flat(),\n toValue(paint)\n );\n }\n\n drawArc(\n oval: SkRect,\n startAngle: number,\n sweepAngle: number,\n useCenter: boolean,\n paint: SkPaint\n ) {\n this.ref.drawArc(\n toValue(oval),\n startAngle,\n sweepAngle,\n useCenter,\n toValue(paint)\n );\n }\n\n drawRRect(rrect: SkRRect, paint: SkPaint) {\n this.ref.drawRRect(\n JsiSkRRect.fromValue(this.CanvasKit, rrect),\n toValue(paint)\n );\n }\n\n drawDRRect(outer: SkRRect, inner: SkRRect, paint: SkPaint) {\n this.ref.drawDRRect(toValue(outer), toValue(inner), toValue(paint));\n }\n\n drawOval(oval: SkRect, paint: SkPaint) {\n this.ref.drawOval(toValue(oval), toValue(paint));\n }\n\n drawPath(path: SkPath, paint: SkPaint) {\n this.ref.drawPath(toValue(path), toValue(paint));\n }\n\n drawText(str: string, x: number, y: number, paint: SkPaint, font: SkFont) {\n this.ref.drawText(str, x, y, toValue(paint), toValue(font));\n }\n\n drawTextBlob(blob: SkTextBlob, x: number, y: number, paint: SkPaint) {\n this.ref.drawTextBlob(toValue(blob), x, y, toValue(paint));\n }\n\n drawGlyphs(\n glyphs: number[],\n positions: SkPoint[],\n x: number,\n y: number,\n font: SkFont,\n paint: SkPaint\n ) {\n this.ref.drawGlyphs(\n glyphs,\n positions.map((p) => [p.x, p.y]).flat(),\n x,\n y,\n toValue(font),\n toValue(paint)\n );\n }\n\n drawSvg(_svgDom: SkSVG, _width?: number, _height?: number) {\n throw new Error(\"drawSvg is not implemented on React Native Web\");\n }\n\n save() {\n return this.ref.save();\n }\n\n saveLayer(\n paint?: SkPaint,\n bounds?: SkRect | null,\n backdrop?: SkImageFilter | null,\n flags?: SaveLayerFlag\n ) {\n return this.ref.saveLayer(\n toUndefinedableValue(paint),\n toOptionalValue(bounds),\n toOptionalValue(backdrop),\n flags\n );\n }\n\n restore() {\n this.ref.restore();\n }\n\n rotate(rotationInDegrees: number, rx: number, ry: number) {\n this.ref.rotate(rotationInDegrees, rx, ry);\n }\n\n scale(sx: number, sy: number) {\n this.ref.scale(sx, sy);\n }\n\n skew(sx: number, sy: number) {\n this.ref.skew(sx, sy);\n }\n\n translate(dx: number, dy: number) {\n this.ref.translate(dx, dy);\n }\n\n drawColor(color: SkColor, blendMode?: BlendMode) {\n this.ref.drawColor(color, blendMode ? ckEnum(blendMode) : undefined);\n }\n\n clear(color: SkColor) {\n this.ref.clear(color);\n }\n\n clipPath(path: SkPath, op: ClipOp, doAntiAlias: boolean) {\n this.ref.clipPath(toValue(path), ckEnum(op), doAntiAlias);\n }\n\n clipRect(rect: SkRect, op: ClipOp, doAntiAlias: boolean) {\n this.ref.clipRect(\n JsiSkRect.fromValue(this.CanvasKit, rect),\n ckEnum(op),\n doAntiAlias\n );\n }\n\n clipRRect(rrect: SkRRect, op: ClipOp, doAntiAlias: boolean) {\n this.ref.clipRRect(\n JsiSkRRect.fromValue(this.CanvasKit, rrect),\n ckEnum(op),\n doAntiAlias\n );\n }\n\n concat(m: SkMatrix) {\n this.ref.concat(toValue(m));\n }\n\n drawPicture(skp: SkPicture) {\n this.ref.drawPicture(toValue(skp));\n }\n}\n"]}
|
@@ -2,6 +2,7 @@ import { PathVerb } from "../types";
|
|
2
2
|
import { ckEnum, HostObject, optEnum, toValue } from "./Host";
|
3
3
|
import { JsiSkPoint } from "./JsiSkPoint";
|
4
4
|
import { JsiSkRect } from "./JsiSkRect";
|
5
|
+
import { JsiSkRRect } from "./JsiSkRRect";
|
5
6
|
const CommandCount = {
|
6
7
|
[PathVerb.Move]: 3,
|
7
8
|
[PathVerb.Line]: 3,
|
@@ -33,12 +34,12 @@ export class JsiSkPath extends HostObject {
|
|
33
34
|
}
|
34
35
|
|
35
36
|
addArc(oval, startAngleInDegrees, sweepAngleInDegrees) {
|
36
|
-
this.ref.addArc(
|
37
|
+
this.ref.addArc(JsiSkRect.fromValue(this.CanvasKit, oval), startAngleInDegrees, sweepAngleInDegrees);
|
37
38
|
return this;
|
38
39
|
}
|
39
40
|
|
40
41
|
addOval(oval, isCCW, startIndex) {
|
41
|
-
this.ref.addOval(
|
42
|
+
this.ref.addOval(JsiSkRect.fromValue(this.CanvasKit, oval), isCCW, startIndex);
|
42
43
|
return this;
|
43
44
|
}
|
44
45
|
|
@@ -138,7 +139,7 @@ export class JsiSkPath extends HostObject {
|
|
138
139
|
}
|
139
140
|
|
140
141
|
arcToOval(oval, startAngleInDegrees, sweepAngleInDegrees, forceMoveTo) {
|
141
|
-
this.ref.arcToOval(
|
142
|
+
this.ref.arcToOval(JsiSkRect.fromValue(this.CanvasKit, oval), startAngleInDegrees, sweepAngleInDegrees, forceMoveTo);
|
142
143
|
return this;
|
143
144
|
}
|
144
145
|
|
@@ -191,11 +192,11 @@ export class JsiSkPath extends HostObject {
|
|
191
192
|
}
|
192
193
|
|
193
194
|
addRect(rect, isCCW) {
|
194
|
-
this.ref.addRect(
|
195
|
+
this.ref.addRect(JsiSkRect.fromValue(this.CanvasKit, rect), isCCW);
|
195
196
|
}
|
196
197
|
|
197
198
|
addRRect(rrect, isCCW) {
|
198
|
-
this.ref.addRRect(
|
199
|
+
this.ref.addRRect(JsiSkRRect.fromValue(this.CanvasKit, rrect), isCCW);
|
199
200
|
return this;
|
200
201
|
}
|
201
202
|
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["JsiSkPath.ts"],"names":["PathVerb","ckEnum","HostObject","optEnum","toValue","JsiSkPoint","JsiSkRect","CommandCount","Move","Line","Quad","Conic","Cubic","Close","areCmdsInterpolatable","cmd1","cmd2","length","i","JsiSkPath","constructor","CanvasKit","ref","addArc","oval","startAngleInDegrees","sweepAngleInDegrees","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;AAEA,MAAMC,YAAY,GAAG;AACnB,GAACP,QAAQ,CAACQ,IAAV,GAAiB,CADE;AAEnB,GAACR,QAAQ,CAACS,IAAV,GAAiB,CAFE;AAGnB,GAACT,QAAQ,CAACU,IAAV,GAAiB,CAHE;AAInB,GAACV,QAAQ,CAACW,KAAV,GAAkB,CAJC;AAKnB,GAACX,QAAQ,CAACY,KAAV,GAAkB,CALC;AAMnB,GAACZ,QAAQ,CAACa,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,C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A6BC,CAAC,KAAK2H,IAAI,CAAC5H,MAAL,GAAc,CAArD,EAAwD;AACtD8H,UAAAA,GAAG,CAACX,IAAJ,CAAS,EAAT;AACD;AACF,OAND,MAMO;AACL,cAAMnH,MAAM,GAAGV,YAAY,CAACyI,OAAO,CAAC,CAAD,CAAR,CAA3B;;AACA,YAAIA,OAAO,CAAC/H,MAAR,GAAiBA,MAArB,EAA6B;AAC3B+H,UAAAA,OAAO,CAACZ,IAAR,CAAaF,GAAb;AACD;;AACD,YAAIc,OAAO,CAAC/H,MAAR,KAAmBA,MAAnB,IAA6BC,CAAC,KAAK2H,IAAI,CAAC5H,MAAL,GAAc,CAArD,EAAwD;AACtD8H,UAAAA,GAAG,CAACX,IAAJ,CAAS,EAAT;AACD;AACF;;AACD,aAAOW,GAAP;AACD,KArBc,EAqBZ,EArBY,CAAf;AAsBA,WAAOtG,MAAP;AACD;;AAtVuE","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\";\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(toValue(oval), startAngleInDegrees, sweepAngleInDegrees);\n return this;\n }\n\n addOval(oval: SkRect, isCCW?: boolean, startIndex?: number) {\n this.ref.addOval(toValue(oval), isCCW, startIndex);\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 toValue(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(toValue(rect), isCCW);\n }\n\n addRRect(rrect: SkRRect, isCCW?: boolean) {\n this.ref.addRRect(toValue(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","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,C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vB,EAA0B;AACxBgI,QAAAA,OAAO,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,6 +1,14 @@
|
|
1
1
|
import { HostObject } from "./Host";
|
2
2
|
import { JsiSkRect } from "./JsiSkRect";
|
3
3
|
export class JsiSkRRect extends HostObject {
|
4
|
+
static fromValue(CanvasKit, rect) {
|
5
|
+
if (rect instanceof JsiSkRect) {
|
6
|
+
return rect.ref;
|
7
|
+
}
|
8
|
+
|
9
|
+
return CanvasKit.RRectXY(JsiSkRect.fromValue(CanvasKit, rect.rect), rect.rx, rect.ry);
|
10
|
+
}
|
11
|
+
|
4
12
|
constructor(CanvasKit, ref) {
|
5
13
|
super(CanvasKit, ref, "RRect");
|
6
14
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["JsiSkRRect.ts"],"names":["HostObject","JsiSkRect","JsiSkRRect","
|
1
|
+
{"version":3,"sources":["JsiSkRRect.ts"],"names":["HostObject","JsiSkRect","JsiSkRRect","fromValue","CanvasKit","rect","ref","RRectXY","rx","ry","constructor","Float32Array","of"],"mappings":"AAIA,SAASA,UAAT,QAA2B,QAA3B;AACA,SAASC,SAAT,QAA0B,aAA1B;AAEA,OAAO,MAAMC,UAAN,SAAyBF,UAAzB,CAAuE;AAC5D,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;;AA7B2E","sourcesContent":["import type { CanvasKit, RRect } from \"canvaskit-wasm\";\n\nimport type { SkRRect } from \"../types\";\n\nimport { HostObject } from \"./Host\";\nimport { JsiSkRect } from \"./JsiSkRect\";\n\nexport class JsiSkRRect extends HostObject<RRect, \"RRect\"> implements SkRRect {\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"]}
|