@shopify/react-native-skia 0.1.201 → 0.1.203
Sign up to get free protection for your applications and to get access to all the features.
- package/android/CMakeLists.txt +9 -9
- package/android/cpp/rnskia-android/RNSkAndroidPlatformContext.h +11 -0
- package/cpp/api/JsiSkApi.h +8 -0
- package/cpp/api/JsiSkFontMgr.h +54 -0
- package/cpp/api/JsiSkFontMgrFactory.h +40 -0
- package/cpp/api/JsiSkFontStyle.h +61 -0
- package/cpp/api/JsiSkTypeFaceFontProvider.h +80 -0
- package/cpp/api/JsiSkTypeFaceFontProviderFactory.h +32 -0
- package/cpp/rnskia/RNSkPlatformContext.h +6 -0
- package/cpp/rnskia/RNSkView.h +5 -2
- package/cpp/skia/include/core/SkColorTable.h +1 -1
- package/ios/RNSkia-iOS/RNSkMetalCanvasProvider.h +5 -14
- package/ios/RNSkia-iOS/RNSkMetalCanvasProvider.mm +7 -56
- package/ios/RNSkia-iOS/RNSkiOSPlatformContext.h +1 -0
- package/ios/RNSkia-iOS/RNSkiOSPlatformContext.mm +9 -2
- package/ios/RNSkia-iOS/SkiaMetalSurfaceFactory.h +31 -0
- package/ios/RNSkia-iOS/SkiaMetalSurfaceFactory.mm +105 -0
- package/lib/commonjs/skia/core/Data.d.ts +2 -0
- package/lib/commonjs/skia/core/Data.js +29 -1
- package/lib/commonjs/skia/core/Data.js.map +1 -1
- package/lib/commonjs/skia/core/Font.d.ts +14 -1
- package/lib/commonjs/skia/core/Font.js +93 -1
- package/lib/commonjs/skia/core/Font.js.map +1 -1
- package/lib/commonjs/skia/types/Font/FontMgr.d.ts +8 -0
- package/lib/commonjs/skia/types/Font/FontMgr.js +6 -0
- package/lib/commonjs/skia/types/Font/FontMgr.js.map +1 -0
- package/lib/commonjs/skia/types/Font/FontMgrFactory.d.ts +4 -0
- package/lib/commonjs/skia/types/Font/FontMgrFactory.js +6 -0
- package/lib/commonjs/skia/types/Font/FontMgrFactory.js.map +1 -0
- package/lib/commonjs/skia/types/Font/index.d.ts +2 -0
- package/lib/commonjs/skia/types/Font/index.js +26 -0
- package/lib/commonjs/skia/types/Font/index.js.map +1 -1
- package/lib/commonjs/skia/types/Paragraph/TypefaceFontProvider.d.ts +10 -0
- package/lib/commonjs/skia/types/Paragraph/TypefaceFontProvider.js +6 -0
- package/lib/commonjs/skia/types/Paragraph/TypefaceFontProvider.js.map +1 -0
- package/lib/commonjs/skia/types/Paragraph/TypefaceFontProviderFactory.d.ts +4 -0
- package/lib/commonjs/skia/types/Paragraph/TypefaceFontProviderFactory.js +6 -0
- package/lib/commonjs/skia/types/Paragraph/TypefaceFontProviderFactory.js.map +1 -0
- package/lib/commonjs/skia/types/Skia.d.ts +4 -1
- package/lib/commonjs/skia/types/Skia.js.map +1 -1
- package/lib/commonjs/skia/web/Host.d.ts +1 -1
- package/lib/commonjs/skia/web/Host.js +0 -2
- package/lib/commonjs/skia/web/Host.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkFontMgr.d.ts +10 -0
- package/lib/commonjs/skia/web/JsiSkFontMgr.js +34 -0
- package/lib/commonjs/skia/web/JsiSkFontMgr.js.map +1 -0
- package/lib/commonjs/skia/web/JsiSkFontMgrFactory.d.ts +8 -0
- package/lib/commonjs/skia/web/JsiSkFontMgrFactory.js +32 -0
- package/lib/commonjs/skia/web/JsiSkFontMgrFactory.js.map +1 -0
- package/lib/commonjs/skia/web/JsiSkTypefaceFontProvider.d.ts +13 -0
- package/lib/commonjs/skia/web/JsiSkTypefaceFontProvider.js +90 -0
- package/lib/commonjs/skia/web/JsiSkTypefaceFontProvider.js.map +1 -0
- package/lib/commonjs/skia/web/JsiSkTypefaceFontProviderFactory.d.ts +7 -0
- package/lib/commonjs/skia/web/JsiSkTypefaceFontProviderFactory.js +25 -0
- package/lib/commonjs/skia/web/JsiSkTypefaceFontProviderFactory.js.map +1 -0
- package/lib/commonjs/skia/web/JsiSkia.js +7 -1
- package/lib/commonjs/skia/web/JsiSkia.js.map +1 -1
- package/lib/module/skia/core/Data.d.ts +2 -0
- package/lib/module/skia/core/Data.js +24 -1
- package/lib/module/skia/core/Data.js.map +1 -1
- package/lib/module/skia/core/Font.d.ts +14 -1
- package/lib/module/skia/core/Font.js +83 -1
- package/lib/module/skia/core/Font.js.map +1 -1
- package/lib/module/skia/types/Font/FontMgr.d.ts +8 -0
- package/lib/module/skia/types/Font/FontMgr.js +2 -0
- package/lib/module/skia/types/Font/FontMgr.js.map +1 -0
- package/lib/module/skia/types/Font/FontMgrFactory.d.ts +4 -0
- package/lib/module/skia/types/Font/FontMgrFactory.js +2 -0
- package/lib/module/skia/types/Font/FontMgrFactory.js.map +1 -0
- package/lib/module/skia/types/Font/index.d.ts +2 -0
- package/lib/module/skia/types/Font/index.js +2 -0
- package/lib/module/skia/types/Font/index.js.map +1 -1
- package/lib/module/skia/types/Paragraph/TypefaceFontProvider.d.ts +10 -0
- package/lib/module/skia/types/Paragraph/TypefaceFontProvider.js +2 -0
- package/lib/module/skia/types/Paragraph/TypefaceFontProvider.js.map +1 -0
- package/lib/module/skia/types/Paragraph/TypefaceFontProviderFactory.d.ts +4 -0
- package/lib/module/skia/types/Paragraph/TypefaceFontProviderFactory.js +2 -0
- package/lib/module/skia/types/Paragraph/TypefaceFontProviderFactory.js.map +1 -0
- package/lib/module/skia/types/Skia.d.ts +4 -1
- package/lib/module/skia/types/Skia.js.map +1 -1
- package/lib/module/skia/web/Host.d.ts +1 -1
- package/lib/module/skia/web/Host.js +0 -2
- package/lib/module/skia/web/Host.js.map +1 -1
- package/lib/module/skia/web/JsiSkFontMgr.d.ts +10 -0
- package/lib/module/skia/web/JsiSkFontMgr.js +24 -0
- package/lib/module/skia/web/JsiSkFontMgr.js.map +1 -0
- package/lib/module/skia/web/JsiSkFontMgrFactory.d.ts +8 -0
- package/lib/module/skia/web/JsiSkFontMgrFactory.js +21 -0
- package/lib/module/skia/web/JsiSkFontMgrFactory.js.map +1 -0
- package/lib/module/skia/web/JsiSkTypefaceFontProvider.d.ts +13 -0
- package/lib/module/skia/web/JsiSkTypefaceFontProvider.js +80 -0
- package/lib/module/skia/web/JsiSkTypefaceFontProvider.js.map +1 -0
- package/lib/module/skia/web/JsiSkTypefaceFontProviderFactory.d.ts +7 -0
- package/lib/module/skia/web/JsiSkTypefaceFontProviderFactory.js +14 -0
- package/lib/module/skia/web/JsiSkTypefaceFontProviderFactory.js.map +1 -0
- package/lib/module/skia/web/JsiSkia.js +5 -1
- package/lib/module/skia/web/JsiSkia.js.map +1 -1
- package/lib/typescript/src/skia/core/Data.d.ts +2 -0
- package/lib/typescript/src/skia/core/Font.d.ts +14 -1
- package/lib/typescript/src/skia/types/Font/FontMgr.d.ts +8 -0
- package/lib/typescript/src/skia/types/Font/FontMgrFactory.d.ts +4 -0
- package/lib/typescript/src/skia/types/Font/index.d.ts +2 -0
- package/lib/typescript/src/skia/types/Paragraph/TypefaceFontProvider.d.ts +10 -0
- package/lib/typescript/src/skia/types/Paragraph/TypefaceFontProviderFactory.d.ts +4 -0
- package/lib/typescript/src/skia/types/Skia.d.ts +4 -1
- package/lib/typescript/src/skia/web/Host.d.ts +1 -1
- package/lib/typescript/src/skia/web/JsiSkFontMgr.d.ts +10 -0
- package/lib/typescript/src/skia/web/JsiSkFontMgrFactory.d.ts +8 -0
- package/lib/typescript/src/skia/web/JsiSkTypefaceFontProvider.d.ts +13 -0
- package/lib/typescript/src/skia/web/JsiSkTypefaceFontProviderFactory.d.ts +7 -0
- package/libs/android/arm64-v8a/libskia.a +0 -0
- package/libs/android/arm64-v8a/libskottie.a +0 -0
- package/libs/android/arm64-v8a/libskparagraph.a +0 -0
- package/libs/android/arm64-v8a/libskshaper.a +0 -0
- package/libs/android/arm64-v8a/libskunicode.a +0 -0
- package/libs/android/armeabi-v7a/libskia.a +0 -0
- package/libs/android/armeabi-v7a/libskottie.a +0 -0
- package/libs/android/armeabi-v7a/libskparagraph.a +0 -0
- package/libs/android/armeabi-v7a/libskshaper.a +0 -0
- package/libs/android/armeabi-v7a/libskunicode.a +0 -0
- package/libs/android/x86/libskia.a +0 -0
- package/libs/android/x86/libskottie.a +0 -0
- package/libs/android/x86/libskparagraph.a +0 -0
- package/libs/android/x86/libskshaper.a +0 -0
- package/libs/android/x86/libskunicode.a +0 -0
- package/libs/android/x86_64/libskia.a +0 -0
- package/libs/android/x86_64/libskottie.a +0 -0
- package/libs/android/x86_64/libskparagraph.a +0 -0
- package/libs/android/x86_64/libskshaper.a +0 -0
- package/libs/android/x86_64/libskunicode.a +0 -0
- package/libs/ios/libskia.xcframework/Info.plist +5 -5
- package/libs/ios/libskia.xcframework/ios-arm64_arm64e/libskia.a +0 -0
- package/libs/ios/libskia.xcframework/ios-arm64_arm64e_x86_64-simulator/libskia.a +0 -0
- package/libs/ios/libskottie.xcframework/ios-arm64_arm64e/libskottie.a +0 -0
- package/libs/ios/libskottie.xcframework/ios-arm64_arm64e_x86_64-simulator/libskottie.a +0 -0
- package/libs/ios/libskparagraph.xcframework/Info.plist +42 -0
- package/libs/ios/libskparagraph.xcframework/ios-arm64_arm64e/libskparagraph.a +0 -0
- package/libs/ios/libskparagraph.xcframework/ios-arm64_arm64e_x86_64-simulator/libskparagraph.a +0 -0
- package/libs/ios/libsksg.xcframework/ios-arm64_arm64e/libsksg.a +0 -0
- package/libs/ios/libsksg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsksg.a +0 -0
- package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e/libskshaper.a +0 -0
- package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e_x86_64-simulator/libskshaper.a +0 -0
- package/libs/ios/libskunicode.xcframework/Info.plist +42 -0
- package/libs/ios/libskunicode.xcframework/ios-arm64_arm64e/libskunicode.a +0 -0
- package/libs/ios/libskunicode.xcframework/ios-arm64_arm64e_x86_64-simulator/libskunicode.a +0 -0
- package/libs/ios/libsvg.xcframework/Info.plist +5 -5
- package/libs/ios/libsvg.xcframework/ios-arm64_arm64e/libsvg.a +0 -0
- package/libs/ios/libsvg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsvg.a +0 -0
- package/package.json +3 -1
- package/react-native-skia.podspec +2 -2
- package/src/skia/core/Data.ts +31 -1
- package/src/skia/core/Font.ts +109 -2
- package/src/skia/types/Font/FontMgr.ts +10 -0
- package/src/skia/types/Font/FontMgrFactory.ts +5 -0
- package/src/skia/types/Font/index.ts +2 -0
- package/src/skia/types/Paragraph/TypefaceFontProvider.ts +11 -0
- package/src/skia/types/Paragraph/TypefaceFontProviderFactory.ts +5 -0
- package/src/skia/types/Skia.ts +4 -2
- package/src/skia/web/Host.ts +1 -1
- package/src/skia/web/JsiSkFontMgr.ts +26 -0
- package/src/skia/web/JsiSkFontMgrFactory.ts +22 -0
- package/src/skia/web/JsiSkTypefaceFontProvider.ts +89 -0
- package/src/skia/web/JsiSkTypefaceFontProviderFactory.ts +18 -0
- package/src/skia/web/JsiSkia.ts +4 -0
- package/ios/RNSkia-iOS/SkiaMetalRenderer.h +0 -5
- package/ios/RNSkia-iOS/SkiaMetalRenderer.mm +0 -55
@@ -0,0 +1,105 @@
|
|
1
|
+
#import <RNSkLog.h>
|
2
|
+
|
3
|
+
#include <SkiaMetalSurfaceFactory.h>
|
4
|
+
|
5
|
+
#pragma clang diagnostic push
|
6
|
+
#pragma clang diagnostic ignored "-Wdocumentation"
|
7
|
+
|
8
|
+
#import "SkCanvas.h"
|
9
|
+
#import "SkColorSpace.h"
|
10
|
+
#import "SkSurface.h"
|
11
|
+
|
12
|
+
#import <include/gpu/GrBackendSurface.h>
|
13
|
+
#import <include/gpu/GrDirectContext.h>
|
14
|
+
#import <include/gpu/ganesh/SkSurfaceGanesh.h>
|
15
|
+
|
16
|
+
#pragma clang diagnostic pop
|
17
|
+
|
18
|
+
thread_local SkiaMetalContext ThreadContextHolder::ThreadSkiaMetalContext;
|
19
|
+
|
20
|
+
struct OffscreenRenderContext {
|
21
|
+
id<MTLTexture> texture;
|
22
|
+
|
23
|
+
OffscreenRenderContext(id<MTLDevice> device,
|
24
|
+
sk_sp<GrDirectContext> skiaContext,
|
25
|
+
id<MTLCommandQueue> commandQueue, int width,
|
26
|
+
int height) {
|
27
|
+
// Create a Metal texture descriptor
|
28
|
+
MTLTextureDescriptor *textureDescriptor = [MTLTextureDescriptor
|
29
|
+
texture2DDescriptorWithPixelFormat:MTLPixelFormatBGRA8Unorm
|
30
|
+
width:width
|
31
|
+
height:height
|
32
|
+
mipmapped:NO];
|
33
|
+
textureDescriptor.usage =
|
34
|
+
MTLTextureUsageRenderTarget | MTLTextureUsageShaderRead;
|
35
|
+
texture = [device newTextureWithDescriptor:textureDescriptor];
|
36
|
+
}
|
37
|
+
};
|
38
|
+
|
39
|
+
id<MTLDevice> SkiaMetalSurfaceFactory::device = MTLCreateSystemDefaultDevice();
|
40
|
+
|
41
|
+
bool SkiaMetalSurfaceFactory::createSkiaDirectContextIfNecessary(
|
42
|
+
SkiaMetalContext *skiaMetalContext) {
|
43
|
+
if (skiaMetalContext->skContext == nullptr) {
|
44
|
+
skiaMetalContext->commandQueue =
|
45
|
+
id<MTLCommandQueue>(CFRetain((GrMTLHandle)[device newCommandQueue]));
|
46
|
+
skiaMetalContext->skContext = GrDirectContext::MakeMetal(
|
47
|
+
(__bridge void *)device,
|
48
|
+
(__bridge void *)skiaMetalContext->commandQueue);
|
49
|
+
if (skiaMetalContext->skContext == nullptr) {
|
50
|
+
RNSkia::RNSkLogger::logToConsole("Couldn't create a Skia Metal Context");
|
51
|
+
return false;
|
52
|
+
}
|
53
|
+
}
|
54
|
+
return true;
|
55
|
+
}
|
56
|
+
|
57
|
+
sk_sp<SkSurface>
|
58
|
+
SkiaMetalSurfaceFactory::makeWindowedSurface(id<MTLTexture> texture, int width,
|
59
|
+
int height) {
|
60
|
+
// Get render context for current thread
|
61
|
+
if (!SkiaMetalSurfaceFactory::createSkiaDirectContextIfNecessary(
|
62
|
+
&ThreadContextHolder::ThreadSkiaMetalContext)) {
|
63
|
+
return nullptr;
|
64
|
+
}
|
65
|
+
GrMtlTextureInfo fbInfo;
|
66
|
+
fbInfo.fTexture.retain((__bridge void *)texture);
|
67
|
+
|
68
|
+
GrBackendRenderTarget backendRT(width, height, 1, fbInfo);
|
69
|
+
|
70
|
+
auto skSurface = SkSurfaces::WrapBackendRenderTarget(
|
71
|
+
ThreadContextHolder::ThreadSkiaMetalContext.skContext.get(), backendRT,
|
72
|
+
kTopLeft_GrSurfaceOrigin, kBGRA_8888_SkColorType, nullptr, nullptr);
|
73
|
+
|
74
|
+
if (skSurface == nullptr || skSurface->getCanvas() == nullptr) {
|
75
|
+
RNSkia::RNSkLogger::logToConsole(
|
76
|
+
"Skia surface could not be created from parameters.");
|
77
|
+
return nullptr;
|
78
|
+
}
|
79
|
+
return skSurface;
|
80
|
+
}
|
81
|
+
|
82
|
+
sk_sp<SkSurface> SkiaMetalSurfaceFactory::makeOffscreenSurface(int width,
|
83
|
+
int height) {
|
84
|
+
if (!SkiaMetalSurfaceFactory::createSkiaDirectContextIfNecessary(
|
85
|
+
&ThreadContextHolder::ThreadSkiaMetalContext)) {
|
86
|
+
return nullptr;
|
87
|
+
}
|
88
|
+
auto ctx = new OffscreenRenderContext(
|
89
|
+
device, ThreadContextHolder::ThreadSkiaMetalContext.skContext,
|
90
|
+
ThreadContextHolder::ThreadSkiaMetalContext.commandQueue, width, height);
|
91
|
+
|
92
|
+
// Create a GrBackendTexture from the Metal texture
|
93
|
+
GrMtlTextureInfo info;
|
94
|
+
info.fTexture.retain((__bridge void *)ctx->texture);
|
95
|
+
GrBackendTexture backendTexture(width, height, GrMipMapped::kNo, info);
|
96
|
+
|
97
|
+
// Create a SkSurface from the GrBackendTexture
|
98
|
+
auto surface = SkSurfaces::WrapBackendTexture(
|
99
|
+
ThreadContextHolder::ThreadSkiaMetalContext.skContext.get(),
|
100
|
+
backendTexture, kTopLeft_GrSurfaceOrigin, 0, kBGRA_8888_SkColorType,
|
101
|
+
nullptr, nullptr,
|
102
|
+
[](void *addr) { delete (OffscreenRenderContext *)addr; }, ctx);
|
103
|
+
|
104
|
+
return surface;
|
105
|
+
}
|
@@ -1,3 +1,5 @@
|
|
1
1
|
import type { SkData, DataSourceParam, SkJSIInstance } from "../types";
|
2
|
+
export declare const loadData: <T>(source: DataSourceParam, factory: (data: SkData) => T | null, onError?: ((err: Error) => void) | undefined) => Promise<T | null>;
|
3
|
+
export declare const useCollectionLoading: <T extends SkJSIInstance<string>>(source: DataSourceParam[], loader: () => Promise<(T | null)[]>) => T[] | null;
|
2
4
|
export declare const useRawData: <T extends SkJSIInstance<string>>(source: DataSourceParam, factory: (data: SkData) => T | null, onError?: ((err: Error) => void) | undefined) => T | null;
|
3
5
|
export declare const useData: (source: DataSourceParam, onError?: ((err: Error) => void) | undefined) => SkData | null;
|
@@ -3,7 +3,7 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.useRawData = exports.useData = void 0;
|
6
|
+
exports.useRawData = exports.useData = exports.useCollectionLoading = exports.loadData = void 0;
|
7
7
|
|
8
8
|
var _react = require("react");
|
9
9
|
|
@@ -33,6 +33,8 @@ const loadData = (source, factory, onError) => {
|
|
33
33
|
}
|
34
34
|
};
|
35
35
|
|
36
|
+
exports.loadData = loadData;
|
37
|
+
|
36
38
|
const useLoading = (source, loader) => {
|
37
39
|
const mounted = (0, _react.useRef)(false);
|
38
40
|
const [data, setData] = (0, _react.useState)(null);
|
@@ -55,6 +57,32 @@ const useLoading = (source, loader) => {
|
|
55
57
|
return data;
|
56
58
|
};
|
57
59
|
|
60
|
+
const useCollectionLoading = (source, loader) => {
|
61
|
+
const mounted = (0, _react.useRef)(false);
|
62
|
+
const [data, setData] = (0, _react.useState)(null);
|
63
|
+
const dataRef = (0, _react.useRef)(null);
|
64
|
+
(0, _react.useEffect)(() => {
|
65
|
+
mounted.current = true;
|
66
|
+
loader().then(result => {
|
67
|
+
const value = result.filter(r => r !== null);
|
68
|
+
|
69
|
+
if (mounted.current) {
|
70
|
+
setData(value);
|
71
|
+
dataRef.current = value;
|
72
|
+
}
|
73
|
+
});
|
74
|
+
return () => {
|
75
|
+
var _dataRef$current2;
|
76
|
+
|
77
|
+
(_dataRef$current2 = dataRef.current) === null || _dataRef$current2 === void 0 ? void 0 : _dataRef$current2.forEach(instance => instance === null || instance === void 0 ? void 0 : instance.dispose());
|
78
|
+
mounted.current = false;
|
79
|
+
}; // eslint-disable-next-line react-hooks/exhaustive-deps
|
80
|
+
}, [source]);
|
81
|
+
return data;
|
82
|
+
};
|
83
|
+
|
84
|
+
exports.useCollectionLoading = useCollectionLoading;
|
85
|
+
|
58
86
|
const useRawData = (source, factory, onError) => useLoading(source, () => loadData(source, factory, onError));
|
59
87
|
|
60
88
|
exports.useRawData = useRawData;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["factoryWrapper","data2","factory","onError","factoryResult","Error","loadData","source","undefined","Promise","resolve","Uint8Array","Skia","Data","fromBytes","uri","Platform","resolveAsset","fromURI","then","d","useLoading","loader","mounted","useRef","data","setData","useState","dataRef","useEffect","current","value","dispose","useRawData","identity","useData"],"sources":["Data.ts"],"sourcesContent":["import { useEffect, useRef, useState } from \"react\";\n\nimport { Skia } from \"../Skia\";\nimport type { SkData, DataSourceParam, SkJSIInstance } from \"../types\";\nimport { Platform } from \"../../Platform\";\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\
|
1
|
+
{"version":3,"names":["factoryWrapper","data2","factory","onError","factoryResult","Error","loadData","source","undefined","Promise","resolve","Uint8Array","Skia","Data","fromBytes","uri","Platform","resolveAsset","fromURI","then","d","useLoading","loader","mounted","useRef","data","setData","useState","dataRef","useEffect","current","value","dispose","useCollectionLoading","result","filter","r","forEach","instance","useRawData","identity","useData"],"sources":["Data.ts"],"sourcesContent":["import { useEffect, useRef, useState } from \"react\";\n\nimport { Skia } from \"../Skia\";\nimport type { SkData, DataSourceParam, SkJSIInstance } from \"../types\";\nimport { Platform } from \"../../Platform\";\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\nexport const loadData = <T>(\n source: DataSourceParam,\n factory: (data: SkData) => T | null,\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 =\n typeof source === \"string\" ? source : Platform.resolveAsset(source);\n return Skia.Data.fromURI(uri).then((d) =>\n factoryWrapper(d, factory, onError)\n );\n }\n};\n\nconst useLoading = <T extends SkJSIInstance<string>>(\n source: DataSourceParam,\n loader: () => Promise<T | null>\n) => {\n const mounted = useRef(false);\n const [data, setData] = useState<T | null>(null);\n const dataRef = useRef<T | null>(null);\n useEffect(() => {\n mounted.current = true;\n loader().then((value) => {\n if (mounted.current) {\n setData(value);\n dataRef.current = value;\n }\n });\n return () => {\n dataRef.current?.dispose();\n mounted.current = false;\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [source]);\n return data;\n};\n\nexport const useCollectionLoading = <T extends SkJSIInstance<string>>(\n source: DataSourceParam[],\n loader: () => Promise<(T | null)[]>\n) => {\n const mounted = useRef(false);\n const [data, setData] = useState<T[] | null>(null);\n const dataRef = useRef<T[] | null>(null);\n\n useEffect(() => {\n mounted.current = true;\n loader().then((result) => {\n const value = result.filter((r) => r !== null) as T[];\n if (mounted.current) {\n setData(value);\n dataRef.current = value;\n }\n });\n\n return () => {\n dataRef.current?.forEach((instance) => instance?.dispose());\n mounted.current = false;\n };\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [source]);\n\n return data;\n};\n\nexport const useRawData = <T extends SkJSIInstance<string>>(\n source: DataSourceParam,\n factory: (data: SkData) => T | null,\n onError?: (err: Error) => void\n) => useLoading(source, () => loadData<T>(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"],"mappings":"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"}
|
@@ -1,5 +1,18 @@
|
|
1
|
-
import type { DataSourceParam } from "../types";
|
1
|
+
import type { DataModule, DataSourceParam, SkFontMgr } from "../types";
|
2
|
+
import type { SkTypefaceFontProvider } from "../types/Paragraph/TypefaceFontProvider";
|
2
3
|
/**
|
3
4
|
* Returns a Skia Font object
|
4
5
|
* */
|
5
6
|
export declare const useFont: (font: DataSourceParam, size?: number, onError?: ((err: Error) => void) | undefined) => import("../types").SkFont | null;
|
7
|
+
declare type Slant = "normal" | "italic" | "oblique";
|
8
|
+
declare type Weight = "normal" | "bold" | "100" | "200" | "300" | "400" | "500" | "600" | "700" | "800" | "900";
|
9
|
+
interface RNFontStyle {
|
10
|
+
fontFamily: string;
|
11
|
+
fontSize: number;
|
12
|
+
fontStyle: Slant;
|
13
|
+
fontWeight: Weight;
|
14
|
+
}
|
15
|
+
export declare const matchFont: (inputStyle?: Partial<RNFontStyle>, fontMgr?: SkFontMgr) => import("../types").SkFont;
|
16
|
+
export declare const listFontFamilies: (fontMgr?: SkFontMgr) => string[];
|
17
|
+
export declare const useFonts: (sources: Record<string, DataModule[]>) => SkTypefaceFontProvider | null;
|
18
|
+
export {};
|
@@ -3,12 +3,16 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.useFont = void 0;
|
6
|
+
exports.useFonts = exports.useFont = exports.matchFont = exports.listFontFamilies = void 0;
|
7
7
|
|
8
8
|
var _react = require("react");
|
9
9
|
|
10
10
|
var _Skia = require("../Skia");
|
11
11
|
|
12
|
+
var _types = require("../types");
|
13
|
+
|
14
|
+
var _Platform = require("../../Platform");
|
15
|
+
|
12
16
|
var _Typeface = require("./Typeface");
|
13
17
|
|
14
18
|
/*global SkiaApi*/
|
@@ -30,4 +34,92 @@ const useFont = (font, size, onError) => {
|
|
30
34
|
};
|
31
35
|
|
32
36
|
exports.useFont = useFont;
|
37
|
+
const defaultFontStyle = {
|
38
|
+
fontFamily: "System",
|
39
|
+
fontSize: 14,
|
40
|
+
fontStyle: "normal",
|
41
|
+
fontWeight: "normal"
|
42
|
+
};
|
43
|
+
|
44
|
+
const slant = s => {
|
45
|
+
if (s === "italic") {
|
46
|
+
return _types.FontSlant.Italic;
|
47
|
+
} else if (s === "oblique") {
|
48
|
+
return _types.FontSlant.Oblique;
|
49
|
+
} else {
|
50
|
+
return _types.FontSlant.Upright;
|
51
|
+
}
|
52
|
+
};
|
53
|
+
|
54
|
+
const weight = fontWeight => {
|
55
|
+
switch (fontWeight) {
|
56
|
+
case "normal":
|
57
|
+
return 400;
|
58
|
+
|
59
|
+
case "bold":
|
60
|
+
return 700;
|
61
|
+
|
62
|
+
default:
|
63
|
+
return parseInt(fontWeight, 10);
|
64
|
+
}
|
65
|
+
};
|
66
|
+
|
67
|
+
const matchFont = function () {
|
68
|
+
let inputStyle = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
69
|
+
let fontMgr = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _Skia.Skia.FontMgr.System();
|
70
|
+
const fontStyle = { ...defaultFontStyle,
|
71
|
+
...inputStyle
|
72
|
+
};
|
73
|
+
const style = {
|
74
|
+
weight: weight(fontStyle.fontWeight),
|
75
|
+
width: 5,
|
76
|
+
slant: slant(fontStyle.fontStyle)
|
77
|
+
};
|
78
|
+
const typeface = fontMgr.matchFamilyStyle(fontStyle.fontFamily, style);
|
79
|
+
return _Skia.Skia.Font(typeface, fontStyle.fontSize);
|
80
|
+
};
|
81
|
+
|
82
|
+
exports.matchFont = matchFont;
|
83
|
+
|
84
|
+
const listFontFamilies = function () {
|
85
|
+
let fontMgr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _Skia.Skia.FontMgr.System();
|
86
|
+
return new Array(fontMgr.countFamilies()).fill(0).map((_, i) => fontMgr.getFamilyName(i));
|
87
|
+
};
|
88
|
+
|
89
|
+
exports.listFontFamilies = listFontFamilies;
|
90
|
+
|
91
|
+
const loadTypefaces = typefacesToLoad => {
|
92
|
+
const promises = Object.keys(typefacesToLoad).flatMap(familyName => {
|
93
|
+
return typefacesToLoad[familyName].map(typefaceToLoad => {
|
94
|
+
return _Skia.Skia.Data.fromURI(_Platform.Platform.resolveAsset(typefaceToLoad)).then(data => {
|
95
|
+
const tf = _Skia.Skia.Typeface.MakeFreeTypeFaceFromData(data);
|
96
|
+
|
97
|
+
if (tf === null) {
|
98
|
+
throw new Error(`Couldn't create typeface for ${familyName}`);
|
99
|
+
}
|
100
|
+
|
101
|
+
return [familyName, tf];
|
102
|
+
});
|
103
|
+
});
|
104
|
+
});
|
105
|
+
return Promise.all(promises);
|
106
|
+
};
|
107
|
+
|
108
|
+
const useFonts = sources => {
|
109
|
+
const [fontMgr, setFontMgr] = (0, _react.useState)(null);
|
110
|
+
(0, _react.useEffect)(() => {
|
111
|
+
loadTypefaces(sources).then(result => {
|
112
|
+
const fMgr = _Skia.Skia.TypefaceFontProvider.Make();
|
113
|
+
|
114
|
+
result.forEach(_ref => {
|
115
|
+
let [familyName, typeface] = _ref;
|
116
|
+
fMgr.registerFont(typeface, familyName);
|
117
|
+
});
|
118
|
+
setFontMgr(fMgr);
|
119
|
+
}); // eslint-disable-next-line react-hooks/exhaustive-deps
|
120
|
+
}, []);
|
121
|
+
return fontMgr;
|
122
|
+
};
|
123
|
+
|
124
|
+
exports.useFonts = useFonts;
|
33
125
|
//# sourceMappingURL=Font.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["useFont","font","size","onError","typeface","useTypeface","useMemo","Skia","Font"],"sources":["Font.ts"],"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"],"mappings":";;;;;;;AACA;;AAEA;;AAGA;;
|
1
|
+
{"version":3,"names":["useFont","font","size","onError","typeface","useTypeface","useMemo","Skia","Font","defaultFontStyle","fontFamily","fontSize","fontStyle","fontWeight","slant","s","FontSlant","Italic","Oblique","Upright","weight","parseInt","matchFont","inputStyle","fontMgr","FontMgr","System","style","width","matchFamilyStyle","listFontFamilies","Array","countFamilies","fill","map","_","i","getFamilyName","loadTypefaces","typefacesToLoad","promises","Object","keys","flatMap","familyName","typefaceToLoad","Data","fromURI","Platform","resolveAsset","then","data","tf","Typeface","MakeFreeTypeFaceFromData","Error","Promise","all","useFonts","sources","setFontMgr","useState","useEffect","result","fMgr","TypefaceFontProvider","Make","forEach","registerFont"],"sources":["Font.ts"],"sourcesContent":["/*global SkiaApi*/\nimport { useEffect, useMemo, useState } from \"react\";\n\nimport { Skia } from \"../Skia\";\nimport { FontSlant } from \"../types\";\nimport type { DataModule, DataSourceParam, SkFontMgr } from \"../types\";\nimport { Platform } from \"../../Platform\";\nimport type { SkTypefaceFontProvider } from \"../types/Paragraph/TypefaceFontProvider\";\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\ntype Slant = \"normal\" | \"italic\" | \"oblique\";\ntype Weight =\n | \"normal\"\n | \"bold\"\n | \"100\"\n | \"200\"\n | \"300\"\n | \"400\"\n | \"500\"\n | \"600\"\n | \"700\"\n | \"800\"\n | \"900\";\n\ninterface RNFontStyle {\n fontFamily: string;\n fontSize: number;\n fontStyle: Slant;\n fontWeight: Weight;\n}\n\nconst defaultFontStyle: RNFontStyle = {\n fontFamily: \"System\",\n fontSize: 14,\n fontStyle: \"normal\",\n fontWeight: \"normal\",\n};\n\nconst slant = (s: Slant) => {\n if (s === \"italic\") {\n return FontSlant.Italic;\n } else if (s === \"oblique\") {\n return FontSlant.Oblique;\n } else {\n return FontSlant.Upright;\n }\n};\n\nconst weight = (fontWeight: Weight) => {\n switch (fontWeight) {\n case \"normal\":\n return 400;\n case \"bold\":\n return 700;\n default:\n return parseInt(fontWeight, 10);\n }\n};\n\nexport const matchFont = (\n inputStyle: Partial<RNFontStyle> = {},\n fontMgr: SkFontMgr = Skia.FontMgr.System()\n) => {\n const fontStyle = {\n ...defaultFontStyle,\n ...inputStyle,\n };\n const style = {\n weight: weight(fontStyle.fontWeight),\n width: 5,\n slant: slant(fontStyle.fontStyle),\n };\n const typeface = fontMgr.matchFamilyStyle(fontStyle.fontFamily, style);\n return Skia.Font(typeface, fontStyle.fontSize);\n};\n\nexport const listFontFamilies = (fontMgr: SkFontMgr = Skia.FontMgr.System()) =>\n new Array(fontMgr.countFamilies())\n .fill(0)\n .map((_, i) => fontMgr.getFamilyName(i));\n\nconst loadTypefaces = (typefacesToLoad: Record<string, DataModule[]>) => {\n const promises = Object.keys(typefacesToLoad).flatMap((familyName) => {\n return typefacesToLoad[familyName].map((typefaceToLoad) => {\n return Skia.Data.fromURI(Platform.resolveAsset(typefaceToLoad)).then(\n (data) => {\n const tf = Skia.Typeface.MakeFreeTypeFaceFromData(data);\n if (tf === null) {\n throw new Error(`Couldn't create typeface for ${familyName}`);\n }\n return [familyName, tf] as const;\n }\n );\n });\n });\n return Promise.all(promises);\n};\n\nexport const useFonts = (sources: Record<string, DataModule[]>) => {\n const [fontMgr, setFontMgr] = useState<null | SkTypefaceFontProvider>(null);\n\n useEffect(() => {\n loadTypefaces(sources).then((result) => {\n const fMgr = Skia.TypefaceFontProvider.Make();\n result.forEach(([familyName, typeface]) => {\n fMgr.registerFont(typeface, familyName);\n });\n setFontMgr(fMgr);\n });\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n return fontMgr;\n};\n"],"mappings":"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"}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import type { SkJSIInstance } from "../JsiInstance";
|
2
|
+
import type { SkTypeface } from "../Typeface";
|
3
|
+
import type { FontStyle } from "./Font";
|
4
|
+
export interface SkFontMgr extends SkJSIInstance<"FontMgr"> {
|
5
|
+
countFamilies(): number;
|
6
|
+
getFamilyName(index: number): string;
|
7
|
+
matchFamilyStyle(name: string, style: FontStyle): SkTypeface;
|
8
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":[],"sources":["FontMgr.ts"],"sourcesContent":["import type { SkJSIInstance } from \"../JsiInstance\";\nimport type { SkTypeface } from \"../Typeface\";\n\nimport type { FontStyle } from \"./Font\";\n\nexport interface SkFontMgr extends SkJSIInstance<\"FontMgr\"> {\n countFamilies(): number;\n getFamilyName(index: number): string;\n matchFamilyStyle(name: string, style: FontStyle): SkTypeface;\n}\n"],"mappings":""}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":[],"sources":["FontMgrFactory.ts"],"sourcesContent":["import type { SkFontMgr } from \"./FontMgr\";\n\nexport interface FontMgrFactory {\n System(): SkFontMgr;\n}\n"],"mappings":""}
|
@@ -16,4 +16,30 @@ Object.keys(_Font).forEach(function (key) {
|
|
16
16
|
}
|
17
17
|
});
|
18
18
|
});
|
19
|
+
|
20
|
+
var _FontMgr = require("./FontMgr");
|
21
|
+
|
22
|
+
Object.keys(_FontMgr).forEach(function (key) {
|
23
|
+
if (key === "default" || key === "__esModule") return;
|
24
|
+
if (key in exports && exports[key] === _FontMgr[key]) return;
|
25
|
+
Object.defineProperty(exports, key, {
|
26
|
+
enumerable: true,
|
27
|
+
get: function () {
|
28
|
+
return _FontMgr[key];
|
29
|
+
}
|
30
|
+
});
|
31
|
+
});
|
32
|
+
|
33
|
+
var _FontMgrFactory = require("./FontMgrFactory");
|
34
|
+
|
35
|
+
Object.keys(_FontMgrFactory).forEach(function (key) {
|
36
|
+
if (key === "default" || key === "__esModule") return;
|
37
|
+
if (key in exports && exports[key] === _FontMgrFactory[key]) return;
|
38
|
+
Object.defineProperty(exports, key, {
|
39
|
+
enumerable: true,
|
40
|
+
get: function () {
|
41
|
+
return _FontMgrFactory[key];
|
42
|
+
}
|
43
|
+
});
|
44
|
+
});
|
19
45
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./Font\";\n"],"mappings":";;;;;;AAAA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
|
1
|
+
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./Font\";\nexport * from \"./FontMgr\";\nexport * from \"./FontMgrFactory\";\n"],"mappings":";;;;;;AAAA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import type { SkFontMgr } from "../Font";
|
2
|
+
import type { SkTypeface } from "../Typeface";
|
3
|
+
export interface SkTypefaceFontProvider extends SkFontMgr {
|
4
|
+
/**
|
5
|
+
* Registers a given typeface with the given family name.
|
6
|
+
* @param typeface - Typeface.
|
7
|
+
* @param family
|
8
|
+
*/
|
9
|
+
registerFont(typeface: SkTypeface, familyName: string): void;
|
10
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":[],"sources":["TypefaceFontProvider.ts"],"sourcesContent":["import type { SkFontMgr } from \"../Font\";\nimport type { SkTypeface } from \"../Typeface\";\n\nexport interface SkTypefaceFontProvider extends SkFontMgr {\n /**\n * Registers a given typeface with the given family name.\n * @param typeface - Typeface.\n * @param family\n */\n registerFont(typeface: SkTypeface, familyName: string): void;\n}\n"],"mappings":""}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":[],"sources":["TypefaceFontProviderFactory.ts"],"sourcesContent":["import type { SkTypefaceFontProvider } from \"./TypefaceFontProvider\";\n\nexport interface TypefaceFontProviderFactory {\n Make(): SkTypefaceFontProvider;\n}\n"],"mappings":""}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import type { ImageFilterFactory } from "./ImageFilter";
|
2
2
|
import type { PathFactory } from "./Path";
|
3
3
|
import type { ColorFilterFactory } from "./ColorFilter";
|
4
|
-
import type { SkFont } from "./Font";
|
4
|
+
import type { SkFont, FontMgrFactory } from "./Font";
|
5
5
|
import type { SkTypeface, TypefaceFactory } from "./Typeface";
|
6
6
|
import type { ImageFactory } from "./Image";
|
7
7
|
import type { MaskFilterFactory } from "./MaskFilter";
|
@@ -23,6 +23,7 @@ import type { SkPath } from "./Path/Path";
|
|
23
23
|
import type { SkContourMeasureIter } from "./ContourMeasure";
|
24
24
|
import type { PictureFactory, SkPictureRecorder } from "./Picture";
|
25
25
|
import type { Color, SkColor } from "./Color";
|
26
|
+
import type { TypefaceFontProviderFactory } from "./Paragraph/TypefaceFontProviderFactory";
|
26
27
|
/**
|
27
28
|
* Declares the interface for the native Skia API
|
28
29
|
*/
|
@@ -42,6 +43,8 @@ export interface Skia {
|
|
42
43
|
ColorFilter: ColorFilterFactory;
|
43
44
|
Font: (typeface?: SkTypeface, size?: number) => SkFont;
|
44
45
|
Typeface: TypefaceFactory;
|
46
|
+
TypefaceFontProvider: TypefaceFontProviderFactory;
|
47
|
+
FontMgr: FontMgrFactory;
|
45
48
|
MaskFilter: MaskFilterFactory;
|
46
49
|
RuntimeEffect: RuntimeEffectFactory;
|
47
50
|
ImageFilter: ImageFilterFactory;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":[],"sources":["Skia.ts"],"sourcesContent":["import type { ImageFilterFactory } from \"./ImageFilter\";\nimport type { PathFactory } from \"./Path\";\nimport type { ColorFilterFactory } from \"./ColorFilter\";\nimport type { SkFont } from \"./Font\";\nimport type { SkTypeface, TypefaceFactory } from \"./Typeface\";\nimport type { ImageFactory } from \"./Image\";\nimport type { MaskFilterFactory } from \"./MaskFilter\";\nimport type { SkPaint } from \"./Paint\";\nimport type { SkRect } from \"./Rect\";\nimport type { SkRRect } from \"./RRect\";\nimport type {\n RuntimeEffectFactory,\n SkRuntimeEffect,\n SkRuntimeShaderBuilder,\n} from \"./RuntimeEffect\";\nimport type { ShaderFactory } from \"./Shader\";\nimport type { SkMatrix } from \"./Matrix\";\nimport type { PathEffectFactory } from \"./PathEffect\";\nimport type { SkPoint } from \"./Point\";\nimport type { SkVertices, VertexMode } from \"./Vertices/Vertices\";\nimport type { DataFactory } from \"./Data\";\nimport type { SVGFactory } from \"./SVG\";\nimport type { TextBlobFactory } from \"./TextBlob\";\nimport type { SurfaceFactory } from \"./Surface\";\nimport type { SkRSXform } from \"./RSXform\";\nimport type { SkPath } from \"./Path/Path\";\nimport type { SkContourMeasureIter } from \"./ContourMeasure\";\nimport type { PictureFactory, SkPictureRecorder } from \"./Picture\";\nimport type { Color, SkColor } from \"./Color\";\
|
1
|
+
{"version":3,"names":[],"sources":["Skia.ts"],"sourcesContent":["import type { ImageFilterFactory } from \"./ImageFilter\";\nimport type { PathFactory } from \"./Path\";\nimport type { ColorFilterFactory } from \"./ColorFilter\";\nimport type { SkFont, FontMgrFactory } from \"./Font\";\nimport type { SkTypeface, TypefaceFactory } from \"./Typeface\";\nimport type { ImageFactory } from \"./Image\";\nimport type { MaskFilterFactory } from \"./MaskFilter\";\nimport type { SkPaint } from \"./Paint\";\nimport type { SkRect } from \"./Rect\";\nimport type { SkRRect } from \"./RRect\";\nimport type {\n RuntimeEffectFactory,\n SkRuntimeEffect,\n SkRuntimeShaderBuilder,\n} from \"./RuntimeEffect\";\nimport type { ShaderFactory } from \"./Shader\";\nimport type { SkMatrix } from \"./Matrix\";\nimport type { PathEffectFactory } from \"./PathEffect\";\nimport type { SkPoint } from \"./Point\";\nimport type { SkVertices, VertexMode } from \"./Vertices/Vertices\";\nimport type { DataFactory } from \"./Data\";\nimport type { SVGFactory } from \"./SVG\";\nimport type { TextBlobFactory } from \"./TextBlob\";\nimport type { SurfaceFactory } from \"./Surface\";\nimport type { SkRSXform } from \"./RSXform\";\nimport type { SkPath } from \"./Path/Path\";\nimport type { SkContourMeasureIter } from \"./ContourMeasure\";\nimport type { PictureFactory, SkPictureRecorder } from \"./Picture\";\nimport type { Color, SkColor } from \"./Color\";\nimport type { TypefaceFontProviderFactory } from \"./Paragraph/TypefaceFontProviderFactory\";\n/**\n * Declares the interface for the native Skia API\n */\nexport interface Skia {\n Point: (x: number, y: number) => SkPoint;\n XYWHRect: (x: number, y: number, width: number, height: number) => SkRect;\n RuntimeShaderBuilder: (rt: SkRuntimeEffect) => SkRuntimeShaderBuilder;\n RRectXY: (rect: SkRect, rx: number, ry: number) => SkRRect;\n RSXform: (scos: number, ssin: number, tx: number, ty: number) => SkRSXform;\n Color: (color: Color) => SkColor;\n ContourMeasureIter: (\n path: SkPath,\n forceClosed: boolean,\n resScale: number\n ) => SkContourMeasureIter;\n Paint: () => SkPaint;\n PictureRecorder: () => SkPictureRecorder;\n Picture: PictureFactory;\n Path: PathFactory;\n Matrix: (matrix?: readonly number[]) => SkMatrix;\n ColorFilter: ColorFilterFactory;\n Font: (typeface?: SkTypeface, size?: number) => SkFont;\n Typeface: TypefaceFactory;\n TypefaceFontProvider: TypefaceFontProviderFactory;\n FontMgr: FontMgrFactory;\n MaskFilter: MaskFilterFactory;\n RuntimeEffect: RuntimeEffectFactory;\n ImageFilter: ImageFilterFactory;\n Shader: ShaderFactory;\n PathEffect: PathEffectFactory;\n /**\n * Returns an Vertices based on the given positions and optional parameters.\n * See SkVertices.h (especially the Builder) for more details.\n * @param mode\n * @param positions\n * @param textureCoordinates\n * @param colors - either a list of int colors or a flattened color array.\n * @param indices\n * @param isVolatile\n */\n MakeVertices(\n mode: VertexMode,\n positions: SkPoint[],\n textureCoordinates?: SkPoint[] | null,\n colors?: SkColor[],\n indices?: number[] | null,\n isVolatile?: boolean\n ): SkVertices;\n Data: DataFactory;\n Image: ImageFactory;\n SVG: SVGFactory;\n TextBlob: TextBlobFactory;\n Surface: SurfaceFactory;\n}\n"],"mappings":""}
|
@@ -11,7 +11,7 @@ export declare abstract class BaseHostObject<T, N extends string> extends Host i
|
|
11
11
|
readonly __typename__: N;
|
12
12
|
ref: T;
|
13
13
|
constructor(CanvasKit: CanvasKit, ref: T, typename: N);
|
14
|
-
abstract dispose
|
14
|
+
abstract dispose(): void;
|
15
15
|
}
|
16
16
|
export declare abstract class HostObject<T, N extends string> extends BaseHostObject<T, N> {
|
17
17
|
static fromValue<T>(value: SkJSIInstance<string>): T;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["NotImplementedOnRNWeb","Error","constructor","msg","Host","CanvasKit","BaseHostObject","ref","typename","__typename__","HostObject","fromValue","value","ckEnum","optEnum","undefined"],"sources":["Host.ts"],"sourcesContent":["import type { CanvasKit, EmbindEnumEntity } from \"canvaskit-wasm\";\n\nimport type { SkJSIInstance } from \"../types\";\n\nexport class NotImplementedOnRNWeb extends Error {\n constructor(msg?: string) {\n super(msg ?? \"Not implemented on React Native Web\");\n }\n}\n\nexport abstract class Host {\n readonly CanvasKit: CanvasKit;\n\n constructor(CanvasKit: CanvasKit) {\n this.CanvasKit = CanvasKit;\n }\n}\n\nexport abstract class BaseHostObject<T, N extends string>\n extends Host\n implements SkJSIInstance<N>\n{\n readonly __typename__: N;\n ref: T;\n\n constructor(CanvasKit: CanvasKit, ref: T, typename: N) {\n super(CanvasKit);\n this.ref = ref;\n this.__typename__ = typename;\n }\n\n abstract dispose
|
1
|
+
{"version":3,"names":["NotImplementedOnRNWeb","Error","constructor","msg","Host","CanvasKit","BaseHostObject","ref","typename","__typename__","HostObject","fromValue","value","ckEnum","optEnum","undefined"],"sources":["Host.ts"],"sourcesContent":["import type { CanvasKit, EmbindEnumEntity } from \"canvaskit-wasm\";\n\nimport type { SkJSIInstance } from \"../types\";\n\nexport class NotImplementedOnRNWeb extends Error {\n constructor(msg?: string) {\n super(msg ?? \"Not implemented on React Native Web\");\n }\n}\n\nexport abstract class Host {\n readonly CanvasKit: CanvasKit;\n\n constructor(CanvasKit: CanvasKit) {\n this.CanvasKit = CanvasKit;\n }\n}\n\nexport abstract class BaseHostObject<T, N extends string>\n extends Host\n implements SkJSIInstance<N>\n{\n readonly __typename__: N;\n ref: T;\n\n constructor(CanvasKit: CanvasKit, ref: T, typename: N) {\n super(CanvasKit);\n this.ref = ref;\n this.__typename__ = typename;\n }\n\n abstract dispose(): void;\n}\n\nexport abstract class HostObject<T, N extends string> extends BaseHostObject<\n T,\n N\n> {\n static fromValue<T>(value: SkJSIInstance<string>) {\n return (value as HostObject<T, string>).ref;\n }\n}\n\nexport const ckEnum = (value: number): EmbindEnumEntity => ({ value });\nexport const optEnum = (\n value: number | undefined\n): EmbindEnumEntity | undefined =>\n value === undefined ? undefined : { value };\n"],"mappings":";;;;;;;;;AAIO,MAAMA,qBAAN,SAAoCC,KAApC,CAA0C;EAC/CC,WAAW,CAACC,GAAD,EAAe;IACxB,MAAMA,GAAG,IAAI,qCAAb;EACD;;AAH8C;;;;AAM1C,MAAeC,IAAf,CAAoB;EAGzBF,WAAW,CAACG,SAAD,EAAuB;IAAA;;IAChC,KAAKA,SAAL,GAAiBA,SAAjB;EACD;;AALwB;;;;AAQpB,MAAeC,cAAf,SACGF,IADH,CAGP;EAIEF,WAAW,CAACG,SAAD,EAAuBE,GAAvB,EAA+BC,QAA/B,EAA4C;IACrD,MAAMH,SAAN;;IADqD;;IAAA;;IAErD,KAAKE,GAAL,GAAWA,GAAX;IACA,KAAKE,YAAL,GAAoBD,QAApB;EACD;;AARH;;;;AAaO,MAAeE,UAAf,SAAuDJ,cAAvD,CAGL;EACgB,OAATK,SAAS,CAAIC,KAAJ,EAAkC;IAChD,OAAQA,KAAD,CAAiCL,GAAxC;EACD;;AAHD;;;;AAMK,MAAMM,MAAM,GAAID,KAAD,KAAsC;EAAEA;AAAF,CAAtC,CAAf;;;;AACA,MAAME,OAAO,GAClBF,KADqB,IAGrBA,KAAK,KAAKG,SAAV,GAAsBA,SAAtB,GAAkC;EAAEH;AAAF,CAH7B"}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import type { CanvasKit, FontMgr } from "canvaskit-wasm";
|
2
|
+
import type { FontStyle, SkFontMgr, SkTypeface } from "../types";
|
3
|
+
import { HostObject } from "./Host";
|
4
|
+
export declare class JsiSkFontMgr extends HostObject<FontMgr, "FontMgr"> implements SkFontMgr {
|
5
|
+
constructor(CanvasKit: CanvasKit, ref: FontMgr);
|
6
|
+
dispose(): void;
|
7
|
+
countFamilies(): number;
|
8
|
+
getFamilyName(index: number): string;
|
9
|
+
matchFamilyStyle(_familyName: string, _fontStyle: FontStyle): SkTypeface;
|
10
|
+
}
|
@@ -0,0 +1,34 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.JsiSkFontMgr = void 0;
|
7
|
+
|
8
|
+
var _Host = require("./Host");
|
9
|
+
|
10
|
+
class JsiSkFontMgr extends _Host.HostObject {
|
11
|
+
constructor(CanvasKit, ref) {
|
12
|
+
super(CanvasKit, ref, "FontMgr");
|
13
|
+
}
|
14
|
+
|
15
|
+
dispose() {
|
16
|
+
this.ref.delete();
|
17
|
+
}
|
18
|
+
|
19
|
+
countFamilies() {
|
20
|
+
return this.ref.countFamilies();
|
21
|
+
}
|
22
|
+
|
23
|
+
getFamilyName(index) {
|
24
|
+
return this.ref.getFamilyName(index);
|
25
|
+
}
|
26
|
+
|
27
|
+
matchFamilyStyle(_familyName, _fontStyle) {
|
28
|
+
throw new _Host.NotImplementedOnRNWeb();
|
29
|
+
}
|
30
|
+
|
31
|
+
}
|
32
|
+
|
33
|
+
exports.JsiSkFontMgr = JsiSkFontMgr;
|
34
|
+
//# sourceMappingURL=JsiSkFontMgr.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["JsiSkFontMgr","HostObject","constructor","CanvasKit","ref","dispose","delete","countFamilies","getFamilyName","index","matchFamilyStyle","_familyName","_fontStyle","NotImplementedOnRNWeb"],"sources":["JsiSkFontMgr.ts"],"sourcesContent":["import type { CanvasKit, FontMgr } from \"canvaskit-wasm\";\n\nimport type { FontStyle, SkFontMgr, SkTypeface } from \"../types\";\n\nimport { HostObject, NotImplementedOnRNWeb } from \"./Host\";\n\nexport class JsiSkFontMgr\n extends HostObject<FontMgr, \"FontMgr\">\n implements SkFontMgr\n{\n constructor(CanvasKit: CanvasKit, ref: FontMgr) {\n super(CanvasKit, ref, \"FontMgr\");\n }\n dispose() {\n this.ref.delete();\n }\n countFamilies() {\n return this.ref.countFamilies();\n }\n getFamilyName(index: number) {\n return this.ref.getFamilyName(index);\n }\n matchFamilyStyle(_familyName: string, _fontStyle: FontStyle): SkTypeface {\n throw new NotImplementedOnRNWeb();\n }\n}\n"],"mappings":";;;;;;;AAIA;;AAEO,MAAMA,YAAN,SACGC,gBADH,CAGP;EACEC,WAAW,CAACC,SAAD,EAAuBC,GAAvB,EAAqC;IAC9C,MAAMD,SAAN,EAAiBC,GAAjB,EAAsB,SAAtB;EACD;;EACDC,OAAO,GAAG;IACR,KAAKD,GAAL,CAASE,MAAT;EACD;;EACDC,aAAa,GAAG;IACd,OAAO,KAAKH,GAAL,CAASG,aAAT,EAAP;EACD;;EACDC,aAAa,CAACC,KAAD,EAAgB;IAC3B,OAAO,KAAKL,GAAL,CAASI,aAAT,CAAuBC,KAAvB,CAAP;EACD;;EACDC,gBAAgB,CAACC,WAAD,EAAsBC,UAAtB,EAAyD;IACvE,MAAM,IAAIC,2BAAJ,EAAN;EACD;;AAfH"}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import type { CanvasKit } from "canvaskit-wasm";
|
2
|
+
import type { FontMgrFactory } from "../types";
|
3
|
+
import { Host } from "./Host";
|
4
|
+
import { JsiSkFontMgr } from "./JsiSkFontMgr";
|
5
|
+
export declare class JsiSkFontMgrFactory extends Host implements FontMgrFactory {
|
6
|
+
constructor(CanvasKit: CanvasKit);
|
7
|
+
System(): JsiSkFontMgr;
|
8
|
+
}
|