@shopify/react-native-skia 0.1.209 → 0.1.211
Sign up to get free protection for your applications and to get access to all the features.
- package/cpp/api/JsiSkAnimatedImage.h +60 -0
- package/cpp/api/JsiSkAnimatedImageFactory.h +39 -0
- package/cpp/api/JsiSkApi.h +4 -0
- package/cpp/api/JsiSkFont.h +17 -0
- package/cpp/api/JsiSkImage.h +15 -23
- package/lib/commonjs/external/reanimated/moduleWrapper.d.ts +2 -0
- package/lib/commonjs/external/reanimated/moduleWrapper.js +11 -11
- package/lib/commonjs/external/reanimated/moduleWrapper.js.map +1 -1
- package/lib/commonjs/skia/core/AnimatedImage.d.ts +6 -0
- package/lib/commonjs/skia/core/AnimatedImage.js +65 -0
- package/lib/commonjs/skia/core/AnimatedImage.js.map +1 -0
- package/lib/commonjs/skia/core/index.d.ts +1 -0
- package/lib/commonjs/skia/core/index.js +13 -0
- package/lib/commonjs/skia/core/index.js.map +1 -1
- package/lib/commonjs/skia/types/AnimatedImage/AnimatedImage.d.ts +24 -0
- package/lib/commonjs/{dom/nodes/PaintContext.js → skia/types/AnimatedImage/AnimatedImage.js} +1 -1
- package/lib/commonjs/skia/types/AnimatedImage/AnimatedImage.js.map +1 -0
- package/lib/commonjs/skia/types/AnimatedImage/AnimatedImageFactory.d.ts +13 -0
- package/lib/commonjs/skia/types/AnimatedImage/AnimatedImageFactory.js +6 -0
- package/lib/commonjs/skia/types/AnimatedImage/AnimatedImageFactory.js.map +1 -0
- package/lib/commonjs/skia/types/AnimatedImage/index.d.ts +2 -0
- package/lib/commonjs/skia/types/AnimatedImage/index.js +32 -0
- package/lib/commonjs/skia/types/AnimatedImage/index.js.map +1 -0
- package/lib/commonjs/skia/types/Font/Font.d.ts +9 -0
- package/lib/commonjs/skia/types/Font/Font.js.map +1 -1
- package/lib/commonjs/skia/types/Skia.d.ts +2 -0
- package/lib/commonjs/skia/types/Skia.js.map +1 -1
- package/lib/commonjs/skia/types/index.d.ts +1 -0
- package/lib/commonjs/skia/types/index.js +13 -0
- package/lib/commonjs/skia/types/index.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkAnimatedImage.d.ts +11 -0
- package/lib/commonjs/skia/web/JsiSkAnimatedImage.js +44 -0
- package/lib/commonjs/skia/web/JsiSkAnimatedImage.js.map +1 -0
- package/lib/commonjs/skia/web/JsiSkAnimatedImageFactory.d.ts +9 -0
- package/lib/commonjs/skia/web/JsiSkAnimatedImageFactory.js +32 -0
- package/lib/commonjs/skia/web/JsiSkAnimatedImageFactory.js.map +1 -0
- package/lib/commonjs/skia/web/JsiSkFont.d.ts +2 -1
- package/lib/commonjs/skia/web/JsiSkFont.js +4 -0
- package/lib/commonjs/skia/web/JsiSkFont.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkia.js +3 -0
- package/lib/commonjs/skia/web/JsiSkia.js.map +1 -1
- package/lib/module/external/reanimated/moduleWrapper.d.ts +2 -0
- package/lib/module/external/reanimated/moduleWrapper.js +8 -11
- package/lib/module/external/reanimated/moduleWrapper.js.map +1 -1
- package/lib/module/skia/core/AnimatedImage.d.ts +6 -0
- package/lib/module/skia/core/AnimatedImage.js +49 -0
- package/lib/module/skia/core/AnimatedImage.js.map +1 -0
- package/lib/module/skia/core/index.d.ts +1 -0
- package/lib/module/skia/core/index.js +1 -0
- package/lib/module/skia/core/index.js.map +1 -1
- package/lib/module/skia/types/AnimatedImage/AnimatedImage.d.ts +24 -0
- package/lib/module/skia/types/AnimatedImage/AnimatedImage.js +2 -0
- package/lib/module/skia/types/AnimatedImage/AnimatedImage.js.map +1 -0
- package/lib/module/skia/types/AnimatedImage/AnimatedImageFactory.d.ts +13 -0
- package/lib/module/skia/types/AnimatedImage/AnimatedImageFactory.js +2 -0
- package/lib/module/skia/types/AnimatedImage/AnimatedImageFactory.js.map +1 -0
- package/lib/module/skia/types/AnimatedImage/index.d.ts +2 -0
- package/lib/module/skia/types/AnimatedImage/index.js +3 -0
- package/lib/module/skia/types/AnimatedImage/index.js.map +1 -0
- package/lib/module/skia/types/Font/Font.d.ts +9 -0
- package/lib/module/skia/types/Font/Font.js.map +1 -1
- package/lib/module/skia/types/Skia.d.ts +2 -0
- package/lib/module/skia/types/Skia.js.map +1 -1
- package/lib/module/skia/types/index.d.ts +1 -0
- package/lib/module/skia/types/index.js +1 -0
- package/lib/module/skia/types/index.js.map +1 -1
- package/lib/module/skia/web/JsiSkAnimatedImage.d.ts +11 -0
- package/lib/module/skia/web/JsiSkAnimatedImage.js +33 -0
- package/lib/module/skia/web/JsiSkAnimatedImage.js.map +1 -0
- package/lib/module/skia/web/JsiSkAnimatedImageFactory.d.ts +9 -0
- package/lib/module/skia/web/JsiSkAnimatedImageFactory.js +20 -0
- package/lib/module/skia/web/JsiSkAnimatedImageFactory.js.map +1 -0
- package/lib/module/skia/web/JsiSkFont.d.ts +2 -1
- package/lib/module/skia/web/JsiSkFont.js +5 -1
- package/lib/module/skia/web/JsiSkFont.js.map +1 -1
- package/lib/module/skia/web/JsiSkia.js +2 -0
- package/lib/module/skia/web/JsiSkia.js.map +1 -1
- package/lib/typescript/src/external/reanimated/moduleWrapper.d.ts +2 -0
- package/lib/typescript/src/skia/core/AnimatedImage.d.ts +6 -0
- package/lib/typescript/src/skia/core/index.d.ts +1 -0
- package/lib/typescript/src/skia/types/AnimatedImage/AnimatedImage.d.ts +24 -0
- package/lib/typescript/src/skia/types/AnimatedImage/AnimatedImageFactory.d.ts +13 -0
- package/lib/typescript/src/skia/types/AnimatedImage/index.d.ts +2 -0
- package/lib/typescript/src/skia/types/Font/Font.d.ts +9 -0
- package/lib/typescript/src/skia/types/Skia.d.ts +2 -0
- package/lib/typescript/src/skia/types/index.d.ts +1 -0
- package/lib/typescript/src/skia/web/JsiSkAnimatedImage.d.ts +11 -0
- package/lib/typescript/src/skia/web/JsiSkAnimatedImageFactory.d.ts +9 -0
- package/lib/typescript/src/skia/web/JsiSkFont.d.ts +2 -1
- package/package.json +1 -1
- package/src/external/reanimated/moduleWrapper.ts +9 -8
- package/src/skia/core/AnimatedImage.ts +63 -0
- package/src/skia/core/index.ts +1 -0
- package/src/skia/types/AnimatedImage/AnimatedImage.ts +29 -0
- package/src/skia/types/AnimatedImage/AnimatedImageFactory.ts +15 -0
- package/src/skia/types/AnimatedImage/index.ts +2 -0
- package/src/skia/types/Font/Font.ts +10 -0
- package/src/skia/types/Skia.ts +3 -0
- package/src/skia/types/index.ts +1 -0
- package/src/skia/web/JsiSkAnimatedImage.ts +35 -0
- package/src/skia/web/JsiSkAnimatedImageFactory.ts +27 -0
- package/src/skia/web/JsiSkFont.ts +6 -1
- package/src/skia/web/JsiSkia.ts +2 -0
- package/lib/commonjs/dom/nodes/PaintContext.d.ts +0 -19
- package/lib/commonjs/dom/nodes/PaintContext.js.map +0 -1
- package/lib/module/dom/nodes/PaintContext.d.ts +0 -19
- package/lib/module/dom/nodes/PaintContext.js +0 -2
- package/lib/module/dom/nodes/PaintContext.js.map +0 -1
- package/lib/typescript/src/dom/nodes/PaintContext.d.ts +0 -19
- package/src/dom/nodes/PaintContext.ts +0 -32
@@ -0,0 +1,60 @@
|
|
1
|
+
#pragma once
|
2
|
+
|
3
|
+
#include <memory>
|
4
|
+
#include <string>
|
5
|
+
#include <utility>
|
6
|
+
|
7
|
+
#include "JsiSkHostObjects.h"
|
8
|
+
|
9
|
+
#pragma clang diagnostic push
|
10
|
+
#pragma clang diagnostic ignored "-Wdocumentation"
|
11
|
+
|
12
|
+
#include "JsiSkImage.h"
|
13
|
+
#include "SkBase64.h"
|
14
|
+
#include "SkStream.h"
|
15
|
+
#include "include/codec/SkEncodedImageFormat.h"
|
16
|
+
|
17
|
+
#include "include/android/SkAnimatedImage.h"
|
18
|
+
#include "include/codec/SkAndroidCodec.h"
|
19
|
+
|
20
|
+
#pragma clang diagnostic pop
|
21
|
+
|
22
|
+
#include <jsi/jsi.h>
|
23
|
+
|
24
|
+
namespace RNSkia {
|
25
|
+
|
26
|
+
namespace jsi = facebook::jsi;
|
27
|
+
|
28
|
+
class JsiSkAnimatedImage
|
29
|
+
: public JsiSkWrappingSkPtrHostObject<SkAnimatedImage> {
|
30
|
+
public:
|
31
|
+
// TODO-API: Properties?
|
32
|
+
JSI_HOST_FUNCTION(getCurrentFrame) {
|
33
|
+
auto image = getObject()->getCurrentFrame();
|
34
|
+
return jsi::Object::createFromHostObject(
|
35
|
+
runtime, std::make_shared<JsiSkImage>(getContext(), std::move(image)));
|
36
|
+
}
|
37
|
+
|
38
|
+
JSI_HOST_FUNCTION(currentFrameDuration) {
|
39
|
+
return static_cast<int>(getObject()->currentFrameDuration());
|
40
|
+
}
|
41
|
+
|
42
|
+
JSI_HOST_FUNCTION(decodeNextFrame) {
|
43
|
+
return static_cast<int>(getObject()->decodeNextFrame());
|
44
|
+
}
|
45
|
+
|
46
|
+
EXPORT_JSI_API_TYPENAME(JsiSkAnimatedImage, "AnimatedImage")
|
47
|
+
|
48
|
+
JSI_EXPORT_FUNCTIONS(JSI_EXPORT_FUNC(JsiSkAnimatedImage, dispose),
|
49
|
+
JSI_EXPORT_FUNC(JsiSkAnimatedImage, getCurrentFrame),
|
50
|
+
JSI_EXPORT_FUNC(JsiSkAnimatedImage,
|
51
|
+
currentFrameDuration),
|
52
|
+
JSI_EXPORT_FUNC(JsiSkAnimatedImage, decodeNextFrame))
|
53
|
+
|
54
|
+
JsiSkAnimatedImage(std::shared_ptr<RNSkPlatformContext> context,
|
55
|
+
const sk_sp<SkAnimatedImage> image)
|
56
|
+
: JsiSkWrappingSkPtrHostObject<SkAnimatedImage>(std::move(context),
|
57
|
+
std::move(image)) {}
|
58
|
+
};
|
59
|
+
|
60
|
+
} // namespace RNSkia
|
@@ -0,0 +1,39 @@
|
|
1
|
+
#pragma once
|
2
|
+
|
3
|
+
#include <memory>
|
4
|
+
#include <utility>
|
5
|
+
|
6
|
+
#include <jsi/jsi.h>
|
7
|
+
|
8
|
+
#include "JsiPromises.h"
|
9
|
+
#include "JsiSkAnimatedImage.h"
|
10
|
+
#include "JsiSkData.h"
|
11
|
+
#include "JsiSkHostObjects.h"
|
12
|
+
|
13
|
+
namespace RNSkia {
|
14
|
+
|
15
|
+
namespace jsi = facebook::jsi;
|
16
|
+
|
17
|
+
class JsiSkAnimatedImageFactory : public JsiSkHostObject {
|
18
|
+
public:
|
19
|
+
JSI_HOST_FUNCTION(MakeAnimatedImageFromEncoded) {
|
20
|
+
auto data = JsiSkData::fromValue(runtime, arguments[0]);
|
21
|
+
auto codec = SkAndroidCodec::MakeFromData(data);
|
22
|
+
auto image = SkAnimatedImage::Make(std::move(codec));
|
23
|
+
if (image == nullptr) {
|
24
|
+
return jsi::Value::null();
|
25
|
+
}
|
26
|
+
return jsi::Object::createFromHostObject(
|
27
|
+
runtime,
|
28
|
+
std::make_shared<JsiSkAnimatedImage>(getContext(), std::move(image)));
|
29
|
+
}
|
30
|
+
|
31
|
+
JSI_EXPORT_FUNCTIONS(JSI_EXPORT_FUNC(JsiSkAnimatedImageFactory,
|
32
|
+
MakeAnimatedImageFromEncoded))
|
33
|
+
|
34
|
+
explicit JsiSkAnimatedImageFactory(
|
35
|
+
std::shared_ptr<RNSkPlatformContext> context)
|
36
|
+
: JsiSkHostObject(std::move(context)) {}
|
37
|
+
};
|
38
|
+
|
39
|
+
} // namespace RNSkia
|
package/cpp/api/JsiSkApi.h
CHANGED
@@ -6,6 +6,8 @@
|
|
6
6
|
|
7
7
|
#include "JsiSkHostObjects.h"
|
8
8
|
|
9
|
+
#include "JsiSkAnimatedImage.h"
|
10
|
+
#include "JsiSkAnimatedImageFactory.h"
|
9
11
|
#include "JsiSkColor.h"
|
10
12
|
#include "JsiSkColorFilter.h"
|
11
13
|
#include "JsiSkColorFilterFactory.h"
|
@@ -79,6 +81,8 @@ public:
|
|
79
81
|
installReadonlyProperty("SVG", std::make_shared<JsiSkSVGFactory>(context));
|
80
82
|
installReadonlyProperty("Image",
|
81
83
|
std::make_shared<JsiSkImageFactory>(context));
|
84
|
+
installReadonlyProperty(
|
85
|
+
"AnimatedImage", std::make_shared<JsiSkAnimatedImageFactory>(context));
|
82
86
|
installReadonlyProperty("Typeface",
|
83
87
|
std::make_shared<JsiSkTypefaceFactory>(context));
|
84
88
|
installReadonlyProperty("Data",
|
package/cpp/api/JsiSkFont.h
CHANGED
@@ -60,6 +60,7 @@ public:
|
|
60
60
|
return jsiWidths;
|
61
61
|
}
|
62
62
|
|
63
|
+
// TODO: deprecate
|
63
64
|
JSI_HOST_FUNCTION(getTextWidth) {
|
64
65
|
auto str = arguments[0].asString(runtime).utf8(runtime);
|
65
66
|
auto numGlyphIDs = getObject()->countText(str.c_str(), str.length(),
|
@@ -85,6 +86,21 @@ public:
|
|
85
86
|
return jsi::Value(std::accumulate(widthPtrs.begin(), widthPtrs.end(), 0));
|
86
87
|
}
|
87
88
|
|
89
|
+
JSI_HOST_FUNCTION(measureText) {
|
90
|
+
auto str = arguments[0].asString(runtime).utf8(runtime);
|
91
|
+
SkRect bounds;
|
92
|
+
if (count > 1) {
|
93
|
+
auto paint = JsiSkPaint::fromValue(runtime, arguments[1]);
|
94
|
+
getObject()->measureText(str.c_str(), str.length(), SkTextEncoding::kUTF8,
|
95
|
+
&bounds, paint.get());
|
96
|
+
} else {
|
97
|
+
getObject()->measureText(str.c_str(), str.length(), SkTextEncoding::kUTF8,
|
98
|
+
&bounds);
|
99
|
+
}
|
100
|
+
return jsi::Object::createFromHostObject(
|
101
|
+
runtime, std::make_shared<JsiSkRect>(getContext(), std::move(bounds)));
|
102
|
+
}
|
103
|
+
|
88
104
|
JSI_HOST_FUNCTION(getMetrics) {
|
89
105
|
SkFontMetrics fm;
|
90
106
|
getObject()->getMetrics(&fm);
|
@@ -260,6 +276,7 @@ public:
|
|
260
276
|
JSI_EXPORT_FUNC(JsiSkFont, setTypeface),
|
261
277
|
JSI_EXPORT_FUNC(JsiSkFont, getGlyphWidths),
|
262
278
|
JSI_EXPORT_FUNC(JsiSkFont, getTextWidth),
|
279
|
+
JSI_EXPORT_FUNC(JsiSkFont, measureText),
|
263
280
|
JSI_EXPORT_FUNC(JsiSkFont, dispose))
|
264
281
|
|
265
282
|
JsiSkFont(std::shared_ptr<RNSkPlatformContext> context, const SkFont &font)
|
package/cpp/api/JsiSkImage.h
CHANGED
@@ -64,23 +64,32 @@ public:
|
|
64
64
|
std::make_shared<JsiSkShader>(getContext(), std::move(shader)));
|
65
65
|
}
|
66
66
|
|
67
|
-
|
67
|
+
sk_sp<SkData> encodeImageData(const jsi::Value *arguments, size_t count) {
|
68
68
|
// Get optional parameters
|
69
69
|
auto format =
|
70
70
|
count >= 1 ? static_cast<SkEncodedImageFormat>(arguments[0].asNumber())
|
71
71
|
: SkEncodedImageFormat::kPNG;
|
72
|
-
auto quality = count == 2 ? arguments[1].asNumber() : 100.0;
|
73
72
|
|
74
|
-
|
73
|
+
auto quality = count == 2 ? arguments[1].asNumber() : 100.0;
|
74
|
+
auto image = getObject();
|
75
|
+
if (image->isTextureBacked()) {
|
76
|
+
image = image->makeNonTextureImage();
|
77
|
+
}
|
75
78
|
sk_sp<SkData> data;
|
76
79
|
if (format == SkEncodedImageFormat::kJPEG) {
|
77
80
|
SkJpegEncoder::Options options;
|
78
81
|
options.fQuality = quality;
|
79
|
-
data = SkJpegEncoder::Encode(nullptr,
|
82
|
+
data = SkJpegEncoder::Encode(nullptr, image.get(), options);
|
80
83
|
} else {
|
81
84
|
SkPngEncoder::Options options;
|
82
|
-
data = SkPngEncoder::Encode(nullptr,
|
85
|
+
data = SkPngEncoder::Encode(nullptr, image.get(), options);
|
83
86
|
}
|
87
|
+
return data;
|
88
|
+
}
|
89
|
+
|
90
|
+
JSI_HOST_FUNCTION(encodeToBytes) {
|
91
|
+
auto data = encodeImageData(arguments, count);
|
92
|
+
|
84
93
|
auto arrayCtor =
|
85
94
|
runtime.global().getPropertyAsFunction(runtime, "Uint8Array");
|
86
95
|
size_t size = data->size();
|
@@ -99,25 +108,8 @@ public:
|
|
99
108
|
}
|
100
109
|
|
101
110
|
JSI_HOST_FUNCTION(encodeToBase64) {
|
102
|
-
|
103
|
-
auto format =
|
104
|
-
count >= 1 ? static_cast<SkEncodedImageFormat>(arguments[0].asNumber())
|
105
|
-
: SkEncodedImageFormat::kPNG;
|
111
|
+
auto data = encodeImageData(arguments, count);
|
106
112
|
|
107
|
-
auto quality = count == 2 ? arguments[1].asNumber() : 100.0;
|
108
|
-
auto image = getObject();
|
109
|
-
if (image->isTextureBacked()) {
|
110
|
-
image = image->makeNonTextureImage();
|
111
|
-
}
|
112
|
-
sk_sp<SkData> data;
|
113
|
-
if (format == SkEncodedImageFormat::kJPEG) {
|
114
|
-
SkJpegEncoder::Options options;
|
115
|
-
options.fQuality = quality;
|
116
|
-
data = SkJpegEncoder::Encode(nullptr, image.get(), options);
|
117
|
-
} else {
|
118
|
-
SkPngEncoder::Options options;
|
119
|
-
data = SkPngEncoder::Encode(nullptr, image.get(), options);
|
120
|
-
}
|
121
113
|
auto len = SkBase64::Encode(data->bytes(), data->size(), nullptr);
|
122
114
|
auto buffer = std::string(len, 0);
|
123
115
|
SkBase64::Encode(data->bytes(), data->size(),
|
@@ -1,7 +1,9 @@
|
|
1
1
|
import type { SharedValueType } from "../../renderer/processors/Animations";
|
2
2
|
export declare const HAS_REANIMATED2: boolean;
|
3
3
|
export declare const HAS_REANIMATED3: boolean;
|
4
|
+
export declare function throwOnMissingReanimated(): void;
|
4
5
|
export declare const useSharedValue: any;
|
6
|
+
export declare const useFrameCallback: (...args: any[]) => any;
|
5
7
|
export declare const startMapper: any;
|
6
8
|
export declare const stopMapper: any;
|
7
9
|
export declare const runOnJS: any;
|
@@ -3,17 +3,17 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.
|
6
|
+
exports.stopMapper = exports.startMapper = exports.runOnJS = exports.isSharedValue = exports.HAS_REANIMATED3 = exports.HAS_REANIMATED2 = void 0;
|
7
|
+
exports.throwOnMissingReanimated = throwOnMissingReanimated;
|
8
|
+
exports.useSharedValue = exports.useFrameCallback = void 0;
|
7
9
|
|
8
10
|
var _react = require("react");
|
9
11
|
|
10
|
-
var _Reanimated, _Reanimated2, _Reanimated3, _Reanimated4;
|
12
|
+
var _Reanimated, _Reanimated2, _Reanimated3, _Reanimated4, _Reanimated5;
|
11
13
|
|
12
14
|
// This one is needed for the deprecated useSharedValue function
|
13
15
|
// We can remove it once we remove the deprecation
|
14
|
-
|
15
|
-
let Reanimated2; // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
16
|
-
|
16
|
+
let Reanimated2;
|
17
17
|
let Reanimated3;
|
18
18
|
let reanimatedVersion;
|
19
19
|
|
@@ -32,7 +32,7 @@ exports.HAS_REANIMATED2 = HAS_REANIMATED2;
|
|
32
32
|
const HAS_REANIMATED3 = !!Reanimated3;
|
33
33
|
exports.HAS_REANIMATED3 = HAS_REANIMATED3;
|
34
34
|
|
35
|
-
function
|
35
|
+
function throwOnMissingReanimated() {
|
36
36
|
if (!HAS_REANIMATED2) {
|
37
37
|
throw new Error("Reanimated was not found, make sure react-native-reanimated package is installed if you want to use \
|
38
38
|
react-native-skia's integration layer API.");
|
@@ -43,8 +43,6 @@ function throwOnMissingReanimated3() {
|
|
43
43
|
if (!HAS_REANIMATED3) {
|
44
44
|
throw new Error(`Reanimated version ${reanimatedVersion} is not supported, please upgrade to 3.0.0 or newer.`);
|
45
45
|
}
|
46
|
-
|
47
|
-
throwOnMissingReanimated2();
|
48
46
|
}
|
49
47
|
|
50
48
|
const useSharedValue = ((_Reanimated = Reanimated2) === null || _Reanimated === void 0 ? void 0 : _Reanimated.useSharedValue) || (value => (0, _react.useMemo)(() => ({
|
@@ -52,11 +50,13 @@ const useSharedValue = ((_Reanimated = Reanimated2) === null || _Reanimated ===
|
|
52
50
|
}), [value]));
|
53
51
|
|
54
52
|
exports.useSharedValue = useSharedValue;
|
55
|
-
const
|
53
|
+
const useFrameCallback = ((_Reanimated2 = Reanimated2) === null || _Reanimated2 === void 0 ? void 0 : _Reanimated2.useFrameCallback) || throwOnMissingReanimated;
|
54
|
+
exports.useFrameCallback = useFrameCallback;
|
55
|
+
const startMapper = ((_Reanimated3 = Reanimated2) === null || _Reanimated3 === void 0 ? void 0 : _Reanimated3.startMapper) || throwOnMissingReanimated;
|
56
56
|
exports.startMapper = startMapper;
|
57
|
-
const stopMapper = ((
|
57
|
+
const stopMapper = ((_Reanimated4 = Reanimated2) === null || _Reanimated4 === void 0 ? void 0 : _Reanimated4.stopMapper) || throwOnMissingReanimated;
|
58
58
|
exports.stopMapper = stopMapper;
|
59
|
-
const runOnJS = ((
|
59
|
+
const runOnJS = ((_Reanimated5 = Reanimated2) === null || _Reanimated5 === void 0 ? void 0 : _Reanimated5.runOnJS) || throwOnMissingReanimated;
|
60
60
|
exports.runOnJS = runOnJS;
|
61
61
|
|
62
62
|
const isSharedValue = value => {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["Reanimated2","Reanimated3","reanimatedVersion","require","version","includes","e","HAS_REANIMATED2","HAS_REANIMATED3","
|
1
|
+
{"version":3,"names":["Reanimated2","Reanimated3","reanimatedVersion","require","version","includes","e","HAS_REANIMATED2","HAS_REANIMATED3","throwOnMissingReanimated","Error","throwOnMissingReanimated3","useSharedValue","value","useMemo","useFrameCallback","startMapper","stopMapper","runOnJS","isSharedValue"],"sources":["moduleWrapper.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { useMemo } from \"react\";\n\nimport type { SharedValueType } from \"../../renderer/processors/Animations\";\n\n// This one is needed for the deprecated useSharedValue function\n// We can remove it once we remove the deprecation\n\nlet Reanimated2: any;\n\nlet Reanimated3: any;\nlet reanimatedVersion: string;\n\ntry {\n Reanimated2 = require(\"react-native-reanimated\");\n reanimatedVersion =\n // eslint-disable-next-line import/extensions\n require(\"react-native-reanimated/package.json\").version;\n if (\n reanimatedVersion &&\n (reanimatedVersion >= \"3.0.0\" || reanimatedVersion.includes(\"3.0.0-\"))\n ) {\n Reanimated3 = Reanimated2;\n }\n} catch (e) {}\n\nexport const HAS_REANIMATED2 = !!Reanimated2;\nexport const HAS_REANIMATED3 = !!Reanimated3;\n\nexport function throwOnMissingReanimated() {\n if (!HAS_REANIMATED2) {\n throw new Error(\n \"Reanimated was not found, make sure react-native-reanimated package is installed if you want to use \\\n react-native-skia's integration layer API.\"\n );\n }\n}\n\nfunction throwOnMissingReanimated3() {\n if (!HAS_REANIMATED3) {\n throw new Error(\n `Reanimated version ${reanimatedVersion} is not supported, please upgrade to 3.0.0 or newer.`\n );\n }\n}\n\nexport const useSharedValue =\n Reanimated2?.useSharedValue ||\n ((value: number) => useMemo(() => ({ value }), [value]));\nexport const useFrameCallback: (...args: any[]) => any =\n Reanimated2?.useFrameCallback || throwOnMissingReanimated;\n\nexport const startMapper = Reanimated2?.startMapper || throwOnMissingReanimated;\nexport const stopMapper = Reanimated2?.stopMapper || throwOnMissingReanimated;\nexport const runOnJS = Reanimated2?.runOnJS || throwOnMissingReanimated;\nexport const isSharedValue = <T>(\n value: unknown\n): value is SharedValueType<T> => {\n throwOnMissingReanimated3();\n return !!value && Reanimated3.isSharedValue(value);\n};\n"],"mappings":";;;;;;;;;AACA;;;;AAIA;AACA;AAEA,IAAIA,WAAJ;AAEA,IAAIC,WAAJ;AACA,IAAIC,iBAAJ;;AAEA,IAAI;EACFF,WAAW,GAAGG,OAAO,CAAC,yBAAD,CAArB;EACAD,iBAAiB,GACf;EACAC,OAAO,CAAC,sCAAD,CAAP,CAAgDC,OAFlD;;EAGA,IACEF,iBAAiB,KAChBA,iBAAiB,IAAI,OAArB,IAAgCA,iBAAiB,CAACG,QAAlB,CAA2B,QAA3B,CADhB,CADnB,EAGE;IACAJ,WAAW,GAAGD,WAAd;EACD;AACF,CAXD,CAWE,OAAOM,CAAP,EAAU,CAAE;;AAEP,MAAMC,eAAe,GAAG,CAAC,CAACP,WAA1B;;AACA,MAAMQ,eAAe,GAAG,CAAC,CAACP,WAA1B;;;AAEA,SAASQ,wBAAT,GAAoC;EACzC,IAAI,CAACF,eAAL,EAAsB;IACpB,MAAM,IAAIG,KAAJ,CACJ;AACN,iDAFU,CAAN;EAID;AACF;;AAED,SAASC,yBAAT,GAAqC;EACnC,IAAI,CAACH,eAAL,EAAsB;IACpB,MAAM,IAAIE,KAAJ,CACH,sBAAqBR,iBAAkB,sDADpC,CAAN;EAGD;AACF;;AAEM,MAAMU,cAAc,GACzB,gBAAAZ,WAAW,UAAX,kDAAaY,cAAb,MACEC,KAAD,IAAmB,IAAAC,cAAA,EAAQ,OAAO;EAAED;AAAF,CAAP,CAAR,EAA2B,CAACA,KAAD,CAA3B,CADpB,CADK;;;AAGA,MAAME,gBAAyC,GACpD,iBAAAf,WAAW,UAAX,oDAAae,gBAAb,KAAiCN,wBAD5B;;AAGA,MAAMO,WAAW,GAAG,iBAAAhB,WAAW,UAAX,oDAAagB,WAAb,KAA4BP,wBAAhD;;AACA,MAAMQ,UAAU,GAAG,iBAAAjB,WAAW,UAAX,oDAAaiB,UAAb,KAA2BR,wBAA9C;;AACA,MAAMS,OAAO,GAAG,iBAAAlB,WAAW,UAAX,oDAAakB,OAAb,KAAwBT,wBAAxC;;;AACA,MAAMU,aAAa,GACxBN,KAD2B,IAEK;EAChCF,yBAAyB;EACzB,OAAO,CAAC,CAACE,KAAF,IAAWZ,WAAW,CAACkB,aAAZ,CAA0BN,KAA1B,CAAlB;AACD,CALM"}
|
@@ -0,0 +1,6 @@
|
|
1
|
+
import type { DataSourceParam } from "../types";
|
2
|
+
/**
|
3
|
+
* Returns a Skia Animated Image object
|
4
|
+
* */
|
5
|
+
export declare const useAnimatedImage: (source: DataSourceParam, onError?: ((err: Error) => void) | undefined) => import("../types").SkAnimatedImage | null;
|
6
|
+
export declare const useAnimatedImageValue: (source: DataSourceParam) => any;
|
@@ -0,0 +1,65 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.useAnimatedImageValue = exports.useAnimatedImage = void 0;
|
7
|
+
|
8
|
+
var _moduleWrapper = require("../../external/reanimated/moduleWrapper");
|
9
|
+
|
10
|
+
var _Skia = require("../Skia");
|
11
|
+
|
12
|
+
var _Data = require("./Data");
|
13
|
+
|
14
|
+
const animatedImgFactory = _Skia.Skia.AnimatedImage.MakeAnimatedImageFromEncoded.bind(_Skia.Skia.AnimatedImage);
|
15
|
+
/**
|
16
|
+
* Returns a Skia Animated Image object
|
17
|
+
* */
|
18
|
+
|
19
|
+
|
20
|
+
const useAnimatedImage = (source, onError) => (0, _Data.useRawData)(source, animatedImgFactory, onError);
|
21
|
+
|
22
|
+
exports.useAnimatedImage = useAnimatedImage;
|
23
|
+
const DEFAULT_FRAME_DURATION = 60;
|
24
|
+
|
25
|
+
const useAnimatedImageValue = source => {
|
26
|
+
(0, _moduleWrapper.throwOnMissingReanimated)();
|
27
|
+
const currentFrame = (0, _moduleWrapper.useSharedValue)(null);
|
28
|
+
const lastTimestamp = (0, _moduleWrapper.useSharedValue)(0);
|
29
|
+
const animatedImage = useAnimatedImage(source, err => {
|
30
|
+
console.error(err);
|
31
|
+
throw new Error(`Could not load animated image - got '${err.message}'`);
|
32
|
+
});
|
33
|
+
const frameDuration = (animatedImage === null || animatedImage === void 0 ? void 0 : animatedImage.currentFrameDuration()) || DEFAULT_FRAME_DURATION; // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
34
|
+
|
35
|
+
(0, _moduleWrapper.useFrameCallback)(frameInfo => {
|
36
|
+
if (!animatedImage) {
|
37
|
+
currentFrame.value = null;
|
38
|
+
return;
|
39
|
+
}
|
40
|
+
|
41
|
+
const {
|
42
|
+
timestamp
|
43
|
+
} = frameInfo;
|
44
|
+
const elapsed = timestamp - lastTimestamp.value; // Check if it's time to switch frames based on GIF frame duration
|
45
|
+
|
46
|
+
if (elapsed < frameDuration) {
|
47
|
+
return;
|
48
|
+
} // Update the current frame
|
49
|
+
|
50
|
+
|
51
|
+
animatedImage.decodeNextFrame();
|
52
|
+
|
53
|
+
if (currentFrame.value) {
|
54
|
+
currentFrame.value.dispose();
|
55
|
+
}
|
56
|
+
|
57
|
+
currentFrame.value = animatedImage.getCurrentFrame(); // Update the last timestamp
|
58
|
+
|
59
|
+
lastTimestamp.value = timestamp; // eslint-disable-next-line react-hooks/exhaustive-deps
|
60
|
+
}, true);
|
61
|
+
return currentFrame;
|
62
|
+
};
|
63
|
+
|
64
|
+
exports.useAnimatedImageValue = useAnimatedImageValue;
|
65
|
+
//# sourceMappingURL=AnimatedImage.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["animatedImgFactory","Skia","AnimatedImage","MakeAnimatedImageFromEncoded","bind","useAnimatedImage","source","onError","useRawData","DEFAULT_FRAME_DURATION","useAnimatedImageValue","throwOnMissingReanimated","currentFrame","useSharedValue","lastTimestamp","animatedImage","err","console","error","Error","message","frameDuration","currentFrameDuration","useFrameCallback","frameInfo","value","timestamp","elapsed","decodeNextFrame","dispose","getCurrentFrame"],"sources":["AnimatedImage.ts"],"sourcesContent":["import {\n throwOnMissingReanimated,\n useFrameCallback,\n useSharedValue,\n} from \"../../external/reanimated/moduleWrapper\";\nimport { Skia } from \"../Skia\";\nimport type { DataSourceParam } from \"../types\";\n\nimport { useRawData } from \"./Data\";\n\nconst animatedImgFactory = Skia.AnimatedImage.MakeAnimatedImageFromEncoded.bind(\n Skia.AnimatedImage\n);\n\n/**\n * Returns a Skia Animated Image object\n * */\nexport const useAnimatedImage = (\n source: DataSourceParam,\n onError?: (err: Error) => void\n) => useRawData(source, animatedImgFactory, onError);\n\nconst DEFAULT_FRAME_DURATION = 60;\n\nexport const useAnimatedImageValue = (source: DataSourceParam) => {\n throwOnMissingReanimated();\n const currentFrame = useSharedValue(null);\n const lastTimestamp = useSharedValue(0);\n const animatedImage = useAnimatedImage(source, (err) => {\n console.error(err);\n throw new Error(`Could not load animated image - got '${err.message}'`);\n });\n const frameDuration =\n animatedImage?.currentFrameDuration() || DEFAULT_FRAME_DURATION;\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n useFrameCallback((frameInfo: any) => {\n if (!animatedImage) {\n currentFrame.value = null;\n return;\n }\n\n const { timestamp } = frameInfo;\n const elapsed = timestamp - lastTimestamp.value;\n\n // Check if it's time to switch frames based on GIF frame duration\n if (elapsed < frameDuration) {\n return;\n }\n\n // Update the current frame\n animatedImage.decodeNextFrame();\n if (currentFrame.value) {\n currentFrame.value.dispose();\n }\n currentFrame.value = animatedImage.getCurrentFrame();\n\n // Update the last timestamp\n lastTimestamp.value = timestamp;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, true);\n return currentFrame;\n};\n"],"mappings":";;;;;;;AAAA;;AAKA;;AAGA;;AAEA,MAAMA,kBAAkB,GAAGC,UAAA,CAAKC,aAAL,CAAmBC,4BAAnB,CAAgDC,IAAhD,CACzBH,UAAA,CAAKC,aADoB,CAA3B;AAIA;AACA;AACA;;;AACO,MAAMG,gBAAgB,GAAG,CAC9BC,MAD8B,EAE9BC,OAF8B,KAG3B,IAAAC,gBAAA,EAAWF,MAAX,EAAmBN,kBAAnB,EAAuCO,OAAvC,CAHE;;;AAKP,MAAME,sBAAsB,GAAG,EAA/B;;AAEO,MAAMC,qBAAqB,GAAIJ,MAAD,IAA6B;EAChE,IAAAK,uCAAA;EACA,MAAMC,YAAY,GAAG,IAAAC,6BAAA,EAAe,IAAf,CAArB;EACA,MAAMC,aAAa,GAAG,IAAAD,6BAAA,EAAe,CAAf,CAAtB;EACA,MAAME,aAAa,GAAGV,gBAAgB,CAACC,MAAD,EAAUU,GAAD,IAAS;IACtDC,OAAO,CAACC,KAAR,CAAcF,GAAd;IACA,MAAM,IAAIG,KAAJ,CAAW,wCAAuCH,GAAG,CAACI,OAAQ,GAA9D,CAAN;EACD,CAHqC,CAAtC;EAIA,MAAMC,aAAa,GACjB,CAAAN,aAAa,SAAb,IAAAA,aAAa,WAAb,YAAAA,aAAa,CAAEO,oBAAf,OAAyCb,sBAD3C,CARgE,CAWhE;;EACA,IAAAc,+BAAA,EAAkBC,SAAD,IAAoB;IACnC,IAAI,CAACT,aAAL,EAAoB;MAClBH,YAAY,CAACa,KAAb,GAAqB,IAArB;MACA;IACD;;IAED,MAAM;MAAEC;IAAF,IAAgBF,SAAtB;IACA,MAAMG,OAAO,GAAGD,SAAS,GAAGZ,aAAa,CAACW,KAA1C,CAPmC,CASnC;;IACA,IAAIE,OAAO,GAAGN,aAAd,EAA6B;MAC3B;IACD,CAZkC,CAcnC;;;IACAN,aAAa,CAACa,eAAd;;IACA,IAAIhB,YAAY,CAACa,KAAjB,EAAwB;MACtBb,YAAY,CAACa,KAAb,CAAmBI,OAAnB;IACD;;IACDjB,YAAY,CAACa,KAAb,GAAqBV,aAAa,CAACe,eAAd,EAArB,CAnBmC,CAqBnC;;IACAhB,aAAa,CAACW,KAAd,GAAsBC,SAAtB,CAtBmC,CAuBnC;EACD,CAxBD,EAwBG,IAxBH;EAyBA,OAAOd,YAAP;AACD,CAtCM"}
|
@@ -56,6 +56,19 @@ Object.keys(_Image).forEach(function (key) {
|
|
56
56
|
});
|
57
57
|
});
|
58
58
|
|
59
|
+
var _AnimatedImage = require("./AnimatedImage");
|
60
|
+
|
61
|
+
Object.keys(_AnimatedImage).forEach(function (key) {
|
62
|
+
if (key === "default" || key === "__esModule") return;
|
63
|
+
if (key in exports && exports[key] === _AnimatedImage[key]) return;
|
64
|
+
Object.defineProperty(exports, key, {
|
65
|
+
enumerable: true,
|
66
|
+
get: function () {
|
67
|
+
return _AnimatedImage[key];
|
68
|
+
}
|
69
|
+
});
|
70
|
+
});
|
71
|
+
|
59
72
|
var _Picture = require("./Picture");
|
60
73
|
|
61
74
|
Object.keys(_Picture).forEach(function (key) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./Data\";\nexport * from \"./Font\";\nexport * from \"./Typeface\";\nexport * from \"./Image\";\nexport * from \"./Picture\";\nexport * from \"./SVG\";\nexport * from \"./Vector\";\nexport * from \"./Rect\";\nexport * from \"./RRect\";\nexport * from \"./Matrix\";\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;;AACA;;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;;AACA;;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;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
|
1
|
+
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./Data\";\nexport * from \"./Font\";\nexport * from \"./Typeface\";\nexport * from \"./Image\";\nexport * from \"./AnimatedImage\";\nexport * from \"./Picture\";\nexport * from \"./SVG\";\nexport * from \"./Vector\";\nexport * from \"./Rect\";\nexport * from \"./RRect\";\nexport * from \"./Matrix\";\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;;AACA;;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;;AACA;;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;;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,24 @@
|
|
1
|
+
import type { SkJSIInstance } from "../JsiInstance";
|
2
|
+
import type { SkImage } from "../Image";
|
3
|
+
export interface SkAnimatedImage extends SkJSIInstance<"AnimatedImage"> {
|
4
|
+
/**
|
5
|
+
* Decode the next frame.
|
6
|
+
*
|
7
|
+
* If the animation is on the last frame or has hit an error, returns
|
8
|
+
* kFinished (-1).
|
9
|
+
*/
|
10
|
+
decodeNextFrame(): number;
|
11
|
+
/**
|
12
|
+
* Returns the current frame as an SkImage. The SkImage will not change
|
13
|
+
* after it has been returned.
|
14
|
+
* If there is no current frame, null will be returned.
|
15
|
+
*/
|
16
|
+
getCurrentFrame(): SkImage | null;
|
17
|
+
/**
|
18
|
+
* How long to display the current frame.
|
19
|
+
*
|
20
|
+
* Useful for the first frame, for which decodeNextFrame is called
|
21
|
+
* internally.
|
22
|
+
*/
|
23
|
+
currentFrameDuration(): number;
|
24
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":[],"sources":["AnimatedImage.ts"],"sourcesContent":["import type { SkJSIInstance } from \"../JsiInstance\";\nimport type { SkImage } from \"../Image\";\n\nexport interface SkAnimatedImage extends SkJSIInstance<\"AnimatedImage\"> {\n /**\n * Decode the next frame.\n *\n * If the animation is on the last frame or has hit an error, returns\n * kFinished (-1).\n */\n decodeNextFrame(): number;\n\n /**\n * Returns the current frame as an SkImage. The SkImage will not change\n * after it has been returned.\n * If there is no current frame, null will be returned.\n */\n getCurrentFrame(): SkImage | null;\n\n /**\n * How long to display the current frame.\n *\n * Useful for the first frame, for which decodeNextFrame is called\n * internally.\n */\n currentFrameDuration(): number;\n\n // TODO - add the rest of the methods from the Skia API (see SkAnimatedImage.h)\n}\n"],"mappings":""}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import type { SkData } from "../Data";
|
2
|
+
import type { SkAnimatedImage } from "./AnimatedImage";
|
3
|
+
export interface AnimatedImageFactory {
|
4
|
+
/**
|
5
|
+
* Decodes the given bytes into an animated image. Returns null if the bytes were invalid.
|
6
|
+
* The passed in bytes will be copied into the WASM heap, so the caller can dispose of them.
|
7
|
+
*
|
8
|
+
* The returned AnimatedImage will be "pointing to" the first frame, i.e. currentFrameDuration
|
9
|
+
* and makeImageAtCurrentFrame will be referring to the first frame.
|
10
|
+
* @param encoded
|
11
|
+
*/
|
12
|
+
MakeAnimatedImageFromEncoded: (encoded: SkData) => SkAnimatedImage | null;
|
13
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":[],"sources":["AnimatedImageFactory.ts"],"sourcesContent":["import type { SkData } from \"../Data\";\n\nimport type { SkAnimatedImage } from \"./AnimatedImage\";\n\nexport interface AnimatedImageFactory {\n /**\n * Decodes the given bytes into an animated image. Returns null if the bytes were invalid.\n * The passed in bytes will be copied into the WASM heap, so the caller can dispose of them.\n *\n * The returned AnimatedImage will be \"pointing to\" the first frame, i.e. currentFrameDuration\n * and makeImageAtCurrentFrame will be referring to the first frame.\n * @param encoded\n */\n MakeAnimatedImageFromEncoded: (encoded: SkData) => SkAnimatedImage | null;\n}\n"],"mappings":""}
|
@@ -0,0 +1,32 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
|
7
|
+
var _AnimatedImage = require("./AnimatedImage");
|
8
|
+
|
9
|
+
Object.keys(_AnimatedImage).forEach(function (key) {
|
10
|
+
if (key === "default" || key === "__esModule") return;
|
11
|
+
if (key in exports && exports[key] === _AnimatedImage[key]) return;
|
12
|
+
Object.defineProperty(exports, key, {
|
13
|
+
enumerable: true,
|
14
|
+
get: function () {
|
15
|
+
return _AnimatedImage[key];
|
16
|
+
}
|
17
|
+
});
|
18
|
+
});
|
19
|
+
|
20
|
+
var _AnimatedImageFactory = require("./AnimatedImageFactory");
|
21
|
+
|
22
|
+
Object.keys(_AnimatedImageFactory).forEach(function (key) {
|
23
|
+
if (key === "default" || key === "__esModule") return;
|
24
|
+
if (key in exports && exports[key] === _AnimatedImageFactory[key]) return;
|
25
|
+
Object.defineProperty(exports, key, {
|
26
|
+
enumerable: true,
|
27
|
+
get: function () {
|
28
|
+
return _AnimatedImageFactory[key];
|
29
|
+
}
|
30
|
+
});
|
31
|
+
});
|
32
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./AnimatedImage\";\nexport * from \"./AnimatedImageFactory\";\n"],"mappings":";;;;;;AAAA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
|
@@ -10,10 +10,19 @@ export interface FontMetrics {
|
|
10
10
|
bounds?: SkRect;
|
11
11
|
}
|
12
12
|
export interface SkFont extends SkJSIInstance<"Font"> {
|
13
|
+
/**
|
14
|
+
* Returns the advance width of text.
|
15
|
+
* The advance is the normal distance to move before drawing additional text.
|
16
|
+
* Returns the bounding box of text
|
17
|
+
* @param text
|
18
|
+
* @param paint
|
19
|
+
*/
|
20
|
+
measureText(text: string, paint?: SkPaint): SkRect;
|
13
21
|
/**
|
14
22
|
* Retrieves the total width of the provided text
|
15
23
|
* @param text
|
16
24
|
* @param paint
|
25
|
+
* @deprecated Use measureText or getGlyphWidths instead
|
17
26
|
*/
|
18
27
|
getTextWidth(text: string, paint?: SkPaint): number;
|
19
28
|
/**
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["fontStyle","weight","width","slant","FontWeight","FontWidth","FontSlant","FontEdging","FontHinting","FontStyle","Normal","Upright","Bold","Italic","BoldItalic"],"sources":["Font.ts"],"sourcesContent":["import type { SkJSIInstance } from \"../JsiInstance\";\nimport type { SkPaint } from \"../Paint\";\nimport type { SkRect } from \"../Rect\";\nimport type { SkPoint } from \"../Point\";\nimport type { SkTypeface } from \"../Typeface\";\n\nexport interface FontMetrics {\n ascent: number; // suggested space above the baseline. < 0\n descent: number; // suggested space below the baseline. > 0\n leading: number; // suggested spacing between descent of previous line and ascent of next line.\n bounds?: SkRect; // smallest rect containing all glyphs (relative to 0,0)\n}\n\nexport interface SkFont extends SkJSIInstance<\"Font\"> {\n /**\n * Retrieves the total width of the provided text\n * @param text\n * @param paint\n */\n getTextWidth(text: string, paint?: SkPaint): number;\n\n /**\n * Retrieves the advanceX measurements for each glyph.\n * If paint is not null, its stroking, PathEffect, and MaskFilter fields are respected.\n * One width per glyph is returned in the returned array.\n * @param glyphs\n * @param paint\n */\n getGlyphWidths(glyphs: number[], paint?: SkPaint): number[];\n\n /**\n * Returns the FontMetrics for this font.\n */\n getMetrics(): FontMetrics;\n\n /**\n * Retrieves the glyph ids for each code point in the provided string. This call is passed to\n * the typeface of this font. Note that glyph IDs are typeface-dependent; different faces\n * may have different ids for the same code point.\n * @param str\n * @param numCodePoints - the number of code points in the string. Defaults to str.length.\n */\n getGlyphIDs(str: string, numCodePoints?: number): number[];\n\n /**\n * Computes any intersections of a thick \"line\" and a run of positionsed glyphs.\n * The thick line is represented as a top and bottom coordinate (positive for\n * below the baseline, negative for above). If there are no intersections\n * (e.g. if this is intended as an underline, and there are no \"collisions\")\n * then the returned array will be empty. If there are intersections, the array\n * will contain pairs of X coordinates [start, end] for each segment that\n * intersected with a glyph.\n *\n * @param glyphs the glyphs to intersect with\n * @param positions x,y coordinates (2 per glyph) for each glyph\n * @param top top of the thick \"line\" to use for intersection testing\n * @param bottom bottom of the thick \"line\" to use for intersection testing\n * @return array of [start, end] x-coordinate pairs. Maybe be empty.\n */\n getGlyphIntercepts(\n glyphs: number[],\n positions: SkPoint[],\n top: number,\n bottom: number\n ): number[];\n\n /**\n * Returns text scale on x-axis. Default value is 1.\n */\n getScaleX(): number;\n\n /**\n * Returns text size in points.\n */\n getSize(): number;\n\n /**\n * Returns text skew on x-axis. Default value is zero.\n */\n getSkewX(): number;\n\n /**\n * Returns embolden effect for this font. Default value is false.\n */\n isEmbolden(): boolean;\n\n /**\n * Returns the Typeface set for this font.\n */\n getTypeface(): SkTypeface | null;\n\n /**\n * Requests, but does not require, that edge pixels draw opaque or with partial transparency.\n * @param edging\n */\n setEdging(edging: FontEdging): void;\n\n /**\n * Requests, but does not require, to use bitmaps in fonts instead of outlines.\n * @param embeddedBitmaps\n */\n setEmbeddedBitmaps(embeddedBitmaps: boolean): void;\n\n /**\n * Sets level of glyph outline adjustment.\n * @param hinting\n */\n setHinting(hinting: FontHinting): void;\n\n /**\n * Requests, but does not require, linearly scalable font and glyph metrics.\n *\n * For outline fonts 'true' means font and glyph metrics should ignore hinting and rounding.\n * Note that some bitmap formats may not be able to scale linearly and will ignore this flag.\n * @param linearMetrics\n */\n setLinearMetrics(linearMetrics: boolean): void;\n\n /**\n * Sets the text scale on the x-axis.\n * @param sx\n */\n setScaleX(sx: number): void;\n\n /**\n * Sets the text size in points on this font.\n * @param points\n */\n setSize(points: number): void;\n\n /**\n * Sets the text-skew on the x axis for this font.\n * @param sx\n */\n setSkewX(sx: number): void;\n\n /**\n * Set embolden effect for this font.\n * @param embolden\n */\n setEmbolden(embolden: boolean): void;\n\n /**\n * Requests, but does not require, that glyphs respect sub-pixel positioning.\n * @param subpixel\n */\n setSubpixel(subpixel: boolean): void;\n\n /**\n * Sets the typeface to use with this font. null means to clear the typeface and use the\n * default one.\n * @param face\n */\n setTypeface(face: SkTypeface | null): void;\n}\n\nconst fontStyle = (\n weight: FontWeight,\n width: FontWidth,\n slant: FontSlant\n): FontStyle => ({ weight, width, slant });\n\nexport interface FontStyle {\n weight?: FontWeight;\n width?: FontWidth;\n slant?: FontSlant;\n}\n\nexport enum FontWeight {\n Invisible = 0,\n Thin = 100,\n ExtraLight = 200,\n Light = 300,\n Normal = 400,\n Medium = 500,\n SemiBold = 600,\n Bold = 700,\n ExtraBold = 800,\n Black = 900,\n ExtraBlack = 1000,\n}\n\nexport enum FontWidth {\n UltraCondensed = 1,\n ExtraCondensed = 2,\n Condensed = 3,\n SemiCondensed = 4,\n Normal = 5,\n SemiExpanded = 6,\n Expanded = 7,\n ExtraExpanded = 8,\n UltraExpanded = 9,\n}\n\nexport enum FontSlant {\n Upright,\n Italic,\n Oblique,\n}\n\nexport enum FontEdging {\n Alias,\n AntiAlias,\n SubpixelAntiAlias,\n}\n\nexport enum FontHinting {\n None,\n Slight,\n Normal,\n Full,\n}\n\nexport const FontStyle = {\n Normal: fontStyle(FontWeight.Normal, FontWidth.Normal, FontSlant.Upright),\n Bold: fontStyle(FontWeight.Bold, FontWidth.Normal, FontSlant.Upright),\n Italic: fontStyle(FontWeight.Normal, FontWidth.Normal, FontSlant.Italic),\n BoldItalic: fontStyle(FontWeight.Bold, FontWidth.Normal, FontSlant.Italic),\n};\n"],"mappings":";;;;;;;
|
1
|
+
{"version":3,"names":["fontStyle","weight","width","slant","FontWeight","FontWidth","FontSlant","FontEdging","FontHinting","FontStyle","Normal","Upright","Bold","Italic","BoldItalic"],"sources":["Font.ts"],"sourcesContent":["import type { SkJSIInstance } from \"../JsiInstance\";\nimport type { SkPaint } from \"../Paint\";\nimport type { SkRect } from \"../Rect\";\nimport type { SkPoint } from \"../Point\";\nimport type { SkTypeface } from \"../Typeface\";\n\nexport interface FontMetrics {\n ascent: number; // suggested space above the baseline. < 0\n descent: number; // suggested space below the baseline. > 0\n leading: number; // suggested spacing between descent of previous line and ascent of next line.\n bounds?: SkRect; // smallest rect containing all glyphs (relative to 0,0)\n}\n\nexport interface SkFont extends SkJSIInstance<\"Font\"> {\n /**\n * Returns the advance width of text.\n * The advance is the normal distance to move before drawing additional text.\n * Returns the bounding box of text\n * @param text\n * @param paint\n */\n measureText(text: string, paint?: SkPaint): SkRect;\n\n /**\n * Retrieves the total width of the provided text\n * @param text\n * @param paint\n * @deprecated Use measureText or getGlyphWidths instead\n */\n getTextWidth(text: string, paint?: SkPaint): number;\n\n /**\n * Retrieves the advanceX measurements for each glyph.\n * If paint is not null, its stroking, PathEffect, and MaskFilter fields are respected.\n * One width per glyph is returned in the returned array.\n * @param glyphs\n * @param paint\n */\n getGlyphWidths(glyphs: number[], paint?: SkPaint): number[];\n\n /**\n * Returns the FontMetrics for this font.\n */\n getMetrics(): FontMetrics;\n\n /**\n * Retrieves the glyph ids for each code point in the provided string. This call is passed to\n * the typeface of this font. Note that glyph IDs are typeface-dependent; different faces\n * may have different ids for the same code point.\n * @param str\n * @param numCodePoints - the number of code points in the string. Defaults to str.length.\n */\n getGlyphIDs(str: string, numCodePoints?: number): number[];\n\n /**\n * Computes any intersections of a thick \"line\" and a run of positionsed glyphs.\n * The thick line is represented as a top and bottom coordinate (positive for\n * below the baseline, negative for above). If there are no intersections\n * (e.g. if this is intended as an underline, and there are no \"collisions\")\n * then the returned array will be empty. If there are intersections, the array\n * will contain pairs of X coordinates [start, end] for each segment that\n * intersected with a glyph.\n *\n * @param glyphs the glyphs to intersect with\n * @param positions x,y coordinates (2 per glyph) for each glyph\n * @param top top of the thick \"line\" to use for intersection testing\n * @param bottom bottom of the thick \"line\" to use for intersection testing\n * @return array of [start, end] x-coordinate pairs. Maybe be empty.\n */\n getGlyphIntercepts(\n glyphs: number[],\n positions: SkPoint[],\n top: number,\n bottom: number\n ): number[];\n\n /**\n * Returns text scale on x-axis. Default value is 1.\n */\n getScaleX(): number;\n\n /**\n * Returns text size in points.\n */\n getSize(): number;\n\n /**\n * Returns text skew on x-axis. Default value is zero.\n */\n getSkewX(): number;\n\n /**\n * Returns embolden effect for this font. Default value is false.\n */\n isEmbolden(): boolean;\n\n /**\n * Returns the Typeface set for this font.\n */\n getTypeface(): SkTypeface | null;\n\n /**\n * Requests, but does not require, that edge pixels draw opaque or with partial transparency.\n * @param edging\n */\n setEdging(edging: FontEdging): void;\n\n /**\n * Requests, but does not require, to use bitmaps in fonts instead of outlines.\n * @param embeddedBitmaps\n */\n setEmbeddedBitmaps(embeddedBitmaps: boolean): void;\n\n /**\n * Sets level of glyph outline adjustment.\n * @param hinting\n */\n setHinting(hinting: FontHinting): void;\n\n /**\n * Requests, but does not require, linearly scalable font and glyph metrics.\n *\n * For outline fonts 'true' means font and glyph metrics should ignore hinting and rounding.\n * Note that some bitmap formats may not be able to scale linearly and will ignore this flag.\n * @param linearMetrics\n */\n setLinearMetrics(linearMetrics: boolean): void;\n\n /**\n * Sets the text scale on the x-axis.\n * @param sx\n */\n setScaleX(sx: number): void;\n\n /**\n * Sets the text size in points on this font.\n * @param points\n */\n setSize(points: number): void;\n\n /**\n * Sets the text-skew on the x axis for this font.\n * @param sx\n */\n setSkewX(sx: number): void;\n\n /**\n * Set embolden effect for this font.\n * @param embolden\n */\n setEmbolden(embolden: boolean): void;\n\n /**\n * Requests, but does not require, that glyphs respect sub-pixel positioning.\n * @param subpixel\n */\n setSubpixel(subpixel: boolean): void;\n\n /**\n * Sets the typeface to use with this font. null means to clear the typeface and use the\n * default one.\n * @param face\n */\n setTypeface(face: SkTypeface | null): void;\n}\n\nconst fontStyle = (\n weight: FontWeight,\n width: FontWidth,\n slant: FontSlant\n): FontStyle => ({ weight, width, slant });\n\nexport interface FontStyle {\n weight?: FontWeight;\n width?: FontWidth;\n slant?: FontSlant;\n}\n\nexport enum FontWeight {\n Invisible = 0,\n Thin = 100,\n ExtraLight = 200,\n Light = 300,\n Normal = 400,\n Medium = 500,\n SemiBold = 600,\n Bold = 700,\n ExtraBold = 800,\n Black = 900,\n ExtraBlack = 1000,\n}\n\nexport enum FontWidth {\n UltraCondensed = 1,\n ExtraCondensed = 2,\n Condensed = 3,\n SemiCondensed = 4,\n Normal = 5,\n SemiExpanded = 6,\n Expanded = 7,\n ExtraExpanded = 8,\n UltraExpanded = 9,\n}\n\nexport enum FontSlant {\n Upright,\n Italic,\n Oblique,\n}\n\nexport enum FontEdging {\n Alias,\n AntiAlias,\n SubpixelAntiAlias,\n}\n\nexport enum FontHinting {\n None,\n Slight,\n Normal,\n Full,\n}\n\nexport const FontStyle = {\n Normal: fontStyle(FontWeight.Normal, FontWidth.Normal, FontSlant.Upright),\n Bold: fontStyle(FontWeight.Bold, FontWidth.Normal, FontSlant.Upright),\n Italic: fontStyle(FontWeight.Normal, FontWidth.Normal, FontSlant.Italic),\n BoldItalic: fontStyle(FontWeight.Bold, FontWidth.Normal, FontSlant.Italic),\n};\n"],"mappings":";;;;;;;AAsKA,MAAMA,SAAS,GAAG,CAChBC,MADgB,EAEhBC,KAFgB,EAGhBC,KAHgB,MAID;EAAEF,MAAF;EAAUC,KAAV;EAAiBC;AAAjB,CAJC,CAAlB;;IAYYC,U;;;WAAAA,U;EAAAA,U,CAAAA,U;EAAAA,U,CAAAA,U;EAAAA,U,CAAAA,U;EAAAA,U,CAAAA,U;EAAAA,U,CAAAA,U;EAAAA,U,CAAAA,U;EAAAA,U,CAAAA,U;EAAAA,U,CAAAA,U;EAAAA,U,CAAAA,U;EAAAA,U,CAAAA,U;EAAAA,U,CAAAA,U;GAAAA,U,0BAAAA,U;;IAcAC,S;;;WAAAA,S;EAAAA,S,CAAAA,S;EAAAA,S,CAAAA,S;EAAAA,S,CAAAA,S;EAAAA,S,CAAAA,S;EAAAA,S,CAAAA,S;EAAAA,S,CAAAA,S;EAAAA,S,CAAAA,S;EAAAA,S,CAAAA,S;EAAAA,S,CAAAA,S;GAAAA,S,yBAAAA,S;;IAYAC,S;;;WAAAA,S;EAAAA,S,CAAAA,S;EAAAA,S,CAAAA,S;EAAAA,S,CAAAA,S;GAAAA,S,yBAAAA,S;;IAMAC,U;;;WAAAA,U;EAAAA,U,CAAAA,U;EAAAA,U,CAAAA,U;EAAAA,U,CAAAA,U;GAAAA,U,0BAAAA,U;;IAMAC,W;;;WAAAA,W;EAAAA,W,CAAAA,W;EAAAA,W,CAAAA,W;EAAAA,W,CAAAA,W;EAAAA,W,CAAAA,W;GAAAA,W,2BAAAA,W;;AAOL,MAAMC,SAAS,GAAG;EACvBC,MAAM,EAAEV,SAAS,CAACI,UAAU,CAACM,MAAZ,EAAoBL,SAAS,CAACK,MAA9B,EAAsCJ,SAAS,CAACK,OAAhD,CADM;EAEvBC,IAAI,EAAEZ,SAAS,CAACI,UAAU,CAACQ,IAAZ,EAAkBP,SAAS,CAACK,MAA5B,EAAoCJ,SAAS,CAACK,OAA9C,CAFQ;EAGvBE,MAAM,EAAEb,SAAS,CAACI,UAAU,CAACM,MAAZ,EAAoBL,SAAS,CAACK,MAA9B,EAAsCJ,SAAS,CAACO,MAAhD,CAHM;EAIvBC,UAAU,EAAEd,SAAS,CAACI,UAAU,CAACQ,IAAZ,EAAkBP,SAAS,CAACK,MAA5B,EAAoCJ,SAAS,CAACO,MAA9C;AAJE,CAAlB"}
|
@@ -24,6 +24,7 @@ import type { SkContourMeasureIter } from "./ContourMeasure";
|
|
24
24
|
import type { PictureFactory, SkPictureRecorder } from "./Picture";
|
25
25
|
import type { Color, SkColor } from "./Color";
|
26
26
|
import type { TypefaceFontProviderFactory } from "./Paragraph/TypefaceFontProviderFactory";
|
27
|
+
import type { AnimatedImageFactory } from "./AnimatedImage";
|
27
28
|
/**
|
28
29
|
* Declares the interface for the native Skia API
|
29
30
|
*/
|
@@ -63,6 +64,7 @@ export interface Skia {
|
|
63
64
|
MakeVertices(mode: VertexMode, positions: SkPoint[], textureCoordinates?: SkPoint[] | null, colors?: SkColor[], indices?: number[] | null, isVolatile?: boolean): SkVertices;
|
64
65
|
Data: DataFactory;
|
65
66
|
Image: ImageFactory;
|
67
|
+
AnimatedImage: AnimatedImageFactory;
|
66
68
|
SVG: SVGFactory;
|
67
69
|
TextBlob: TextBlobFactory;
|
68
70
|
Surface: SurfaceFactory;
|
@@ -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, 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":""}
|
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\";\nimport type { AnimatedImageFactory } from \"./AnimatedImage\";\n\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 AnimatedImage: AnimatedImageFactory;\n SVG: SVGFactory;\n TextBlob: TextBlobFactory;\n Surface: SurfaceFactory;\n}\n"],"mappings":""}
|