@shopify/react-native-skia 0.1.154 → 0.1.156
Sign up to get free protection for your applications and to get access to all the features.
- package/android/cpp/jni/JniLoad.cpp +5 -5
- package/android/cpp/jni/JniPlatformContext.cpp +107 -119
- package/android/cpp/jni/JniSkiaManager.cpp +18 -20
- package/android/cpp/jni/include/JniPlatformContext.h +41 -45
- package/android/cpp/jni/include/JniSkiaBaseView.h +52 -55
- package/android/cpp/jni/include/JniSkiaDrawView.h +72 -77
- package/android/cpp/jni/include/JniSkiaManager.h +51 -53
- package/android/cpp/jni/include/JniSkiaPictureView.h +74 -78
- package/android/cpp/rnskia-android/RNSkAndroidPlatformContext.h +36 -45
- package/android/cpp/rnskia-android/RNSkAndroidView.h +87 -92
- package/android/cpp/rnskia-android/RNSkOpenGLCanvasProvider.cpp +62 -65
- package/android/cpp/rnskia-android/RNSkOpenGLCanvasProvider.h +20 -17
- package/android/cpp/rnskia-android/SkiaOpenGLRenderer.cpp +257 -313
- package/android/cpp/rnskia-android/SkiaOpenGLRenderer.h +107 -110
- package/cpp/api/JsiSkApi.h +66 -62
- package/cpp/api/JsiSkCanvas.h +38 -30
- package/cpp/api/JsiSkColor.h +58 -56
- package/cpp/api/JsiSkColorFilter.h +5 -3
- package/cpp/api/JsiSkColorFilterFactory.h +23 -21
- package/cpp/api/JsiSkContourMeasure.h +74 -85
- package/cpp/api/JsiSkContourMeasureIter.h +68 -75
- package/cpp/api/JsiSkData.h +16 -22
- package/cpp/api/JsiSkDataFactory.h +86 -79
- package/cpp/api/JsiSkFont.h +286 -311
- package/cpp/api/JsiSkHostObjects.h +15 -16
- package/cpp/api/JsiSkImage.h +107 -103
- package/cpp/api/JsiSkImageFactory.h +34 -36
- package/cpp/api/JsiSkImageFilter.h +5 -3
- package/cpp/api/JsiSkImageFilterFactory.h +71 -68
- package/cpp/api/JsiSkImageInfo.h +41 -38
- package/cpp/api/JsiSkMaskFilter.h +5 -3
- package/cpp/api/JsiSkMaskFilterFactory.h +2 -3
- package/cpp/api/JsiSkMatrix.h +26 -36
- package/cpp/api/JsiSkPaint.h +20 -13
- package/cpp/api/JsiSkPath.h +70 -85
- package/cpp/api/JsiSkPathEffect.h +5 -3
- package/cpp/api/JsiSkPathEffectFactory.h +33 -28
- package/cpp/api/JsiSkPathFactory.h +68 -67
- package/cpp/api/JsiSkPicture.h +28 -22
- package/cpp/api/JsiSkPictureFactory.h +13 -12
- package/cpp/api/JsiSkPictureRecorder.h +21 -19
- package/cpp/api/JsiSkPoint.h +6 -8
- package/cpp/api/JsiSkRRect.h +11 -7
- package/cpp/api/JsiSkRSXform.h +82 -85
- package/cpp/api/JsiSkRect.h +9 -9
- package/cpp/api/JsiSkRuntimeEffect.h +182 -186
- package/cpp/api/JsiSkRuntimeEffectFactory.h +10 -11
- package/cpp/api/JsiSkRuntimeShaderBuilder.h +64 -61
- package/cpp/api/JsiSkSVG.h +4 -5
- package/cpp/api/JsiSkSVGFactory.h +28 -27
- package/cpp/api/JsiSkShader.h +3 -2
- package/cpp/api/JsiSkShaderFactory.h +37 -25
- package/cpp/api/JsiSkSurface.h +44 -40
- package/cpp/api/JsiSkSurfaceFactory.h +22 -22
- package/cpp/api/JsiSkTextBlob.h +28 -31
- package/cpp/api/JsiSkTextBlobFactory.h +88 -87
- package/cpp/api/JsiSkTypeface.h +6 -5
- package/cpp/api/JsiSkTypefaceFactory.h +22 -21
- package/cpp/api/JsiSkVertices.h +137 -124
- package/cpp/api/third_party/CSSColorParser.cpp +161 -174
- package/cpp/api/third_party/CSSColorParser.h +172 -96
- package/cpp/jsi/JsiHostObject.cpp +11 -9
- package/cpp/jsi/JsiHostObject.h +31 -24
- package/cpp/jsi/JsiSimpleValueWrapper.h +74 -83
- package/cpp/jsi/JsiValueWrapper.h +52 -54
- package/cpp/rnskia/RNSkAnimation.h +26 -29
- package/cpp/rnskia/RNSkDispatchQueue.cpp +50 -61
- package/cpp/rnskia/RNSkDispatchQueue.h +3 -1
- package/cpp/rnskia/RNSkInfoParameter.h +12 -12
- package/cpp/rnskia/RNSkJsView.cpp +82 -81
- package/cpp/rnskia/RNSkJsView.h +45 -41
- package/cpp/rnskia/RNSkJsiViewApi.h +99 -89
- package/cpp/rnskia/RNSkManager.cpp +8 -7
- package/cpp/rnskia/RNSkManager.h +8 -6
- package/cpp/rnskia/RNSkPictureView.h +44 -37
- package/cpp/rnskia/RNSkPlatformContext.h +39 -28
- package/cpp/rnskia/RNSkValueApi.h +33 -34
- package/cpp/rnskia/RNSkView.h +108 -93
- package/cpp/rnskia/values/RNSkClockValue.h +63 -64
- package/cpp/rnskia/values/RNSkComputedValue.h +32 -30
- package/cpp/rnskia/values/RNSkReadonlyValue.h +60 -59
- package/cpp/rnskia/values/RNSkValue.h +38 -40
- package/cpp/utils/RNSkLog.h +9 -7
- package/cpp/utils/RNSkMeasureTime.h +7 -7
- package/cpp/utils/RNSkTimingInfo.h +27 -24
- package/ios/RNSkia-iOS/RNSkMetalCanvasProvider.h +8 -9
- package/ios/RNSkia-iOS/RNSkiOSPlatformContext.h +24 -23
- package/ios/RNSkia-iOS/RNSkiOSView.h +16 -13
- package/ios/RNSkia-iOS/SkiaUIView.h +9 -8
- package/lib/commonjs/dom/nodes/JsiSkDOM.js +6 -0
- package/lib/commonjs/dom/nodes/JsiSkDOM.js.map +1 -1
- package/lib/commonjs/dom/nodes/LayerNode.js +43 -0
- package/lib/commonjs/dom/nodes/LayerNode.js.map +1 -0
- package/lib/commonjs/dom/nodes/RenderNode.js +1 -1
- package/lib/commonjs/dom/nodes/RenderNode.js.map +1 -1
- package/lib/commonjs/dom/types/NodeType.js +1 -0
- package/lib/commonjs/dom/types/NodeType.js.map +1 -1
- package/lib/commonjs/dom/types/SkDOM.js.map +1 -1
- package/lib/commonjs/renderer/HostComponents.js +3 -0
- package/lib/commonjs/renderer/HostComponents.js.map +1 -1
- package/lib/commonjs/renderer/components/Group.js +19 -4
- package/lib/commonjs/renderer/components/Group.js.map +1 -1
- package/lib/commonjs/renderer/components/Paint.js +6 -1
- package/lib/commonjs/renderer/components/Paint.js.map +1 -1
- package/lib/commonjs/views/SkiaPictureView.js +3 -2
- package/lib/commonjs/views/SkiaPictureView.js.map +1 -1
- package/lib/commonjs/views/SkiaView.js +6 -3
- package/lib/commonjs/views/SkiaView.js.map +1 -1
- package/lib/module/dom/nodes/JsiSkDOM.js +5 -0
- package/lib/module/dom/nodes/JsiSkDOM.js.map +1 -1
- package/lib/module/dom/nodes/LayerNode.js +32 -0
- package/lib/module/dom/nodes/LayerNode.js.map +1 -0
- package/lib/module/dom/nodes/RenderNode.js +1 -1
- package/lib/module/dom/nodes/RenderNode.js.map +1 -1
- package/lib/module/dom/types/NodeType.js +1 -0
- package/lib/module/dom/types/NodeType.js.map +1 -1
- package/lib/module/dom/types/SkDOM.js.map +1 -1
- package/lib/module/renderer/HostComponents.js +3 -0
- package/lib/module/renderer/HostComponents.js.map +1 -1
- package/lib/module/renderer/components/Group.js +16 -3
- package/lib/module/renderer/components/Group.js.map +1 -1
- package/lib/module/renderer/components/Paint.js +7 -1
- package/lib/module/renderer/components/Paint.js.map +1 -1
- package/lib/module/views/SkiaPictureView.js +2 -2
- package/lib/module/views/SkiaPictureView.js.map +1 -1
- package/lib/module/views/SkiaView.js +4 -2
- package/lib/module/views/SkiaView.js.map +1 -1
- package/lib/typescript/src/dom/nodes/JsiSkDOM.d.ts +2 -0
- package/lib/typescript/src/dom/nodes/LayerNode.d.ts +8 -0
- package/lib/typescript/src/dom/types/NodeType.d.ts +1 -0
- package/lib/typescript/src/dom/types/SkDOM.d.ts +1 -0
- package/lib/typescript/src/renderer/HostComponents.d.ts +2 -1
- package/lib/typescript/src/renderer/components/Group.d.ts +5 -1
- package/lib/typescript/src/views/SkiaView.d.ts +3 -0
- package/libs/android/arm64-v8a/libskottie.a +0 -0
- package/libs/android/arm64-v8a/libsksg.a +0 -0
- package/libs/android/armeabi-v7a/libskottie.a +0 -0
- package/libs/android/armeabi-v7a/libsksg.a +0 -0
- package/libs/android/x86/libskottie.a +0 -0
- package/libs/android/x86/libsksg.a +0 -0
- package/libs/android/x86_64/libskottie.a +0 -0
- package/libs/android/x86_64/libsksg.a +0 -0
- 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/Info.plist +42 -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/libsksg.xcframework/Info.plist +42 -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/Info.plist +5 -5
- package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e/libskshaper.a +0 -0
- package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e_x86_64-simulator/libskshaper.a +0 -0
- package/libs/ios/libsvg.xcframework/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/src/dom/nodes/JsiSkDOM.ts +5 -0
- package/src/dom/nodes/LayerNode.ts +35 -0
- package/src/dom/nodes/RenderNode.ts +4 -3
- package/src/dom/types/NodeType.ts +1 -0
- package/src/dom/types/SkDOM.ts +1 -0
- package/src/renderer/HostComponents.ts +3 -0
- package/src/renderer/components/Group.tsx +16 -3
- package/src/renderer/components/Paint.tsx +7 -1
- package/src/views/SkiaPictureView.tsx +2 -3
- package/src/views/SkiaView.tsx +2 -2
package/cpp/utils/RNSkLog.h
CHANGED
@@ -4,8 +4,8 @@
|
|
4
4
|
|
5
5
|
#pragma once
|
6
6
|
|
7
|
-
#include <string>
|
8
7
|
#include <jsi/jsi.h>
|
8
|
+
#include <string>
|
9
9
|
|
10
10
|
#ifdef ANDROID
|
11
11
|
#include <android/log.h>
|
@@ -17,7 +17,7 @@
|
|
17
17
|
|
18
18
|
namespace RNSkia {
|
19
19
|
|
20
|
-
|
20
|
+
namespace jsi = facebook::jsi;
|
21
21
|
|
22
22
|
class RNSkLogger {
|
23
23
|
public:
|
@@ -45,7 +45,7 @@ public:
|
|
45
45
|
va_start(args, fmt);
|
46
46
|
|
47
47
|
static char buffer[512];
|
48
|
-
vsnprintf(buffer,
|
48
|
+
vsnprintf(buffer, sizeof(buffer), fmt, args);
|
49
49
|
#ifdef ANDROID
|
50
50
|
__android_log_write(ANDROID_LOG_INFO, "RNSkia", buffer);
|
51
51
|
#endif
|
@@ -55,22 +55,24 @@ public:
|
|
55
55
|
va_end(args);
|
56
56
|
}
|
57
57
|
|
58
|
-
static void logToJavascriptConsole(jsi::Runtime&
|
58
|
+
static void logToJavascriptConsole(jsi::Runtime &runtime,
|
59
|
+
const std::string &message) {
|
59
60
|
auto console = RNSkLogger::getJavascriptConsole(runtime).asObject(runtime);
|
60
61
|
auto log = console.getPropertyAsFunction(runtime, "log");
|
61
62
|
log.call(runtime, jsi::String::createFromUtf8(runtime, message));
|
62
63
|
}
|
63
64
|
|
64
|
-
static void warnToJavascriptConsole(jsi::Runtime&
|
65
|
+
static void warnToJavascriptConsole(jsi::Runtime &runtime,
|
66
|
+
const std::string &message) {
|
65
67
|
auto console = RNSkLogger::getJavascriptConsole(runtime).asObject(runtime);
|
66
68
|
auto warn = console.getPropertyAsFunction(runtime, "warn");
|
67
69
|
warn.call(runtime, jsi::String::createFromUtf8(runtime, message));
|
68
70
|
}
|
69
71
|
|
70
72
|
private:
|
71
|
-
static jsi::Value getJavascriptConsole(jsi::Runtime&
|
73
|
+
static jsi::Value getJavascriptConsole(jsi::Runtime &runtime) {
|
72
74
|
auto console = runtime.global().getProperty(runtime, "console");
|
73
|
-
if(console.isUndefined() || console.isNull()) {
|
75
|
+
if (console.isUndefined() || console.isNull()) {
|
74
76
|
throw jsi::JSError(runtime, "Could not find console object.");
|
75
77
|
return jsi::Value::undefined();
|
76
78
|
}
|
@@ -11,22 +11,22 @@
|
|
11
11
|
|
12
12
|
namespace RNSkia {
|
13
13
|
|
14
|
-
using namespace std::chrono;
|
15
|
-
|
16
14
|
class RNSkMeasureTime {
|
17
15
|
public:
|
18
|
-
RNSkMeasureTime(const std::string &name)
|
19
|
-
: _name(name), _start(high_resolution_clock::now()){}
|
16
|
+
explicit RNSkMeasureTime(const std::string &name)
|
17
|
+
: _name(name), _start(std::chrono::high_resolution_clock::now()) {}
|
20
18
|
|
21
19
|
~RNSkMeasureTime() {
|
22
|
-
auto stop = high_resolution_clock::now();
|
23
|
-
auto duration =
|
20
|
+
auto stop = std::chrono::high_resolution_clock::now();
|
21
|
+
auto duration =
|
22
|
+
std::chrono::duration_cast<std::chrono::milliseconds>(stop - _start)
|
23
|
+
.count();
|
24
24
|
RNSkLogger::logToConsole("%s: %lld ms\n", _name.c_str(), duration);
|
25
25
|
}
|
26
26
|
|
27
27
|
private:
|
28
28
|
std::string _name;
|
29
|
-
time_point<steady_clock> _start;
|
29
|
+
std::chrono::time_point<std::chrono::steady_clock> _start;
|
30
30
|
};
|
31
31
|
|
32
32
|
}; // namespace RNSkia
|
@@ -2,18 +2,20 @@
|
|
2
2
|
|
3
3
|
#include <RNSkLog.h>
|
4
4
|
#include <chrono>
|
5
|
+
#include <string>
|
6
|
+
#include <utility>
|
5
7
|
|
6
8
|
#define NUMBER_OF_DURATION_SAMPLES 10
|
7
9
|
|
8
10
|
namespace RNSkia {
|
9
11
|
|
10
|
-
using
|
11
|
-
using
|
12
|
-
using
|
12
|
+
using frame = std::chrono::duration<int32_t, std::ratio<1, 60>>;
|
13
|
+
using ms = std::chrono::duration<float, std::milli>;
|
14
|
+
using high_resolution_clock = std::chrono::high_resolution_clock;
|
13
15
|
|
14
16
|
class RNSkTimingInfo {
|
15
17
|
public:
|
16
|
-
RNSkTimingInfo(const std::string &name): _name(std::move(name)) {
|
18
|
+
explicit RNSkTimingInfo(const std::string &name) : _name(std::move(name)) {
|
17
19
|
reset();
|
18
20
|
}
|
19
21
|
|
@@ -28,24 +30,24 @@ public:
|
|
28
30
|
_lastFrameCount = -1;
|
29
31
|
_didSkip = false;
|
30
32
|
}
|
31
|
-
|
32
|
-
void beginTiming() {
|
33
|
-
|
34
|
-
}
|
35
|
-
|
33
|
+
|
34
|
+
void beginTiming() { _start = high_resolution_clock::now(); }
|
35
|
+
|
36
36
|
void stopTiming() {
|
37
|
-
time_point<steady_clock> stop =
|
38
|
-
|
37
|
+
std::chrono::time_point<std::chrono::steady_clock> stop =
|
38
|
+
high_resolution_clock::now();
|
39
|
+
addLastDuration(
|
40
|
+
std::chrono::duration_cast<std::chrono::milliseconds>(stop - _start)
|
41
|
+
.count());
|
39
42
|
tick(stop);
|
40
|
-
if(_didSkip) {
|
43
|
+
if (_didSkip) {
|
41
44
|
_didSkip = false;
|
42
|
-
RNSkLogger::logToConsole("%s: Skipped frame. Previous frame time: %lldms",
|
45
|
+
RNSkLogger::logToConsole("%s: Skipped frame. Previous frame time: %lldms",
|
46
|
+
_name.c_str(), _lastDuration);
|
43
47
|
}
|
44
48
|
}
|
45
49
|
|
46
|
-
void markSkipped() {
|
47
|
-
_didSkip = true;
|
48
|
-
}
|
50
|
+
void markSkipped() { _didSkip = true; }
|
49
51
|
|
50
52
|
long getAverage() { return static_cast<long>(_average); }
|
51
53
|
long getFps() { return _lastFrameCount; }
|
@@ -72,27 +74,28 @@ public:
|
|
72
74
|
}
|
73
75
|
|
74
76
|
private:
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
77
|
+
void tick(std::chrono::time_point<std::chrono::steady_clock> now) {
|
78
|
+
auto ms = std::chrono::duration_cast<std::chrono::milliseconds>(
|
79
|
+
now.time_since_epoch())
|
80
|
+
.count();
|
81
|
+
|
82
|
+
if (_prevFpsTimer == -1) {
|
80
83
|
_prevFpsTimer = ms;
|
81
|
-
} else if(ms - _prevFpsTimer >= 1000) {
|
84
|
+
} else if (ms - _prevFpsTimer >= 1000) {
|
82
85
|
_lastFrameCount = _frameCount;
|
83
86
|
_prevFpsTimer = ms;
|
84
87
|
_frameCount = 0;
|
85
88
|
}
|
86
89
|
_frameCount++;
|
87
90
|
}
|
88
|
-
|
91
|
+
|
89
92
|
double _lastTimeStamp;
|
90
93
|
long _lastDurations[NUMBER_OF_DURATION_SAMPLES];
|
91
94
|
int _lastDurationIndex;
|
92
95
|
int _lastDurationsCount;
|
93
96
|
long _lastDuration;
|
94
97
|
std::atomic<double> _average;
|
95
|
-
time_point<steady_clock> _start;
|
98
|
+
std::chrono::time_point<std::chrono::steady_clock> _start;
|
96
99
|
long _prevFpsTimer;
|
97
100
|
double _frameCount;
|
98
101
|
double _lastFrameCount;
|
@@ -6,22 +6,22 @@
|
|
6
6
|
#import <MetalKit/MetalKit.h>
|
7
7
|
#import <QuartzCore/CAMetalLayer.h>
|
8
8
|
|
9
|
-
class RNSkMetalCanvasProvider: public RNSkia::RNSkCanvasProvider {
|
9
|
+
class RNSkMetalCanvasProvider : public RNSkia::RNSkCanvasProvider {
|
10
10
|
public:
|
11
11
|
RNSkMetalCanvasProvider(std::function<void()> requestRedraw,
|
12
12
|
std::shared_ptr<RNSkia::RNSkPlatformContext> context);
|
13
|
-
|
13
|
+
|
14
14
|
~RNSkMetalCanvasProvider();
|
15
15
|
|
16
16
|
float getScaledWidth() override;
|
17
17
|
float getScaledHeight() override;
|
18
|
-
|
19
|
-
void renderToCanvas(const std::function<void(SkCanvas*)
|
20
|
-
|
18
|
+
|
19
|
+
void renderToCanvas(const std::function<void(SkCanvas *)> &cb) override;
|
20
|
+
|
21
21
|
void setSize(int width, int height);
|
22
|
-
|
23
|
-
CALayer*
|
24
|
-
|
22
|
+
|
23
|
+
CALayer *getLayer();
|
24
|
+
|
25
25
|
private:
|
26
26
|
std::shared_ptr<RNSkia::RNSkPlatformContext> _context;
|
27
27
|
float _width = -1;
|
@@ -34,5 +34,4 @@ private:
|
|
34
34
|
static id<MTLCommandQueue> _commandQueue;
|
35
35
|
static id<MTLDevice> _device;
|
36
36
|
static sk_sp<GrDirectContext> _skContext;
|
37
|
-
|
38
37
|
};
|
@@ -19,35 +19,35 @@
|
|
19
19
|
#include <jsi/jsi.h>
|
20
20
|
|
21
21
|
namespace facebook {
|
22
|
-
|
23
|
-
|
24
|
-
}
|
22
|
+
namespace react {
|
23
|
+
class CallInvoker;
|
25
24
|
}
|
25
|
+
} // namespace facebook
|
26
26
|
|
27
27
|
namespace RNSkia {
|
28
28
|
|
29
|
-
|
29
|
+
namespace jsi = facebook::jsi;
|
30
30
|
|
31
|
-
static void handleNotification(CFNotificationCenterRef center, void *observer,
|
31
|
+
static void handleNotification(CFNotificationCenterRef center, void *observer,
|
32
|
+
CFStringRef name, const void *object,
|
33
|
+
CFDictionaryRef userInfo);
|
32
34
|
|
33
35
|
class RNSkiOSPlatformContext : public RNSkPlatformContext {
|
34
36
|
public:
|
35
37
|
RNSkiOSPlatformContext(jsi::Runtime *runtime,
|
36
|
-
|
37
|
-
: RNSkPlatformContext(runtime, callInvoker,
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
CFNotificationSuspensionBehaviorDeliverImmediately
|
46
|
-
);
|
47
|
-
}
|
38
|
+
std::shared_ptr<react::CallInvoker> callInvoker)
|
39
|
+
: RNSkPlatformContext(runtime, callInvoker,
|
40
|
+
[[UIScreen mainScreen] scale]) {
|
41
|
+
// We need to make sure we invalidate when modules are freed
|
42
|
+
CFNotificationCenterAddObserver(
|
43
|
+
CFNotificationCenterGetLocalCenter(), this, &handleNotification,
|
44
|
+
(__bridge CFStringRef)RCTBridgeWillInvalidateModulesNotification, NULL,
|
45
|
+
CFNotificationSuspensionBehaviorDeliverImmediately);
|
46
|
+
}
|
48
47
|
|
49
48
|
~RNSkiOSPlatformContext() {
|
50
|
-
CFNotificationCenterRemoveEveryObserver(
|
49
|
+
CFNotificationCenterRemoveEveryObserver(
|
50
|
+
CFNotificationCenterGetLocalCenter(), this);
|
51
51
|
}
|
52
52
|
|
53
53
|
void startDrawLoop() override;
|
@@ -58,19 +58,20 @@ public:
|
|
58
58
|
const std::function<void(std::unique_ptr<SkStreamAsset>)> &op) override;
|
59
59
|
|
60
60
|
void raiseError(const std::exception &err) override;
|
61
|
-
|
61
|
+
|
62
62
|
void willInvalidateModules() {
|
63
63
|
// We need to do some house-cleaning here!
|
64
64
|
invalidate();
|
65
65
|
}
|
66
|
-
|
66
|
+
|
67
67
|
private:
|
68
68
|
DisplayLink *_displayLink;
|
69
69
|
};
|
70
70
|
|
71
|
-
static void handleNotification(CFNotificationCenterRef center, void *observer,
|
72
|
-
const void *object,
|
73
|
-
|
71
|
+
static void handleNotification(CFNotificationCenterRef center, void *observer,
|
72
|
+
CFStringRef name, const void *object,
|
73
|
+
CFDictionaryRef userInfo) {
|
74
|
+
(static_cast<RNSkiOSPlatformContext *>(observer))->willInvalidateModules();
|
74
75
|
}
|
75
76
|
|
76
77
|
} // namespace RNSkia
|
@@ -2,33 +2,36 @@
|
|
2
2
|
|
3
3
|
#import <memory>
|
4
4
|
|
5
|
+
#import "RNSkMetalCanvasProvider.h"
|
5
6
|
#import "RNSkView.h"
|
6
7
|
#import "RNSkiOSPlatformContext.h"
|
7
|
-
#import "RNSkMetalCanvasProvider.h"
|
8
8
|
|
9
9
|
class RNSkBaseiOSView {
|
10
10
|
public:
|
11
|
-
virtual CALayer*
|
11
|
+
virtual CALayer *getLayer() = 0;
|
12
12
|
virtual void setSize(int width, int height) = 0;
|
13
13
|
virtual std::shared_ptr<RNSkia::RNSkView> getDrawView() = 0;
|
14
14
|
};
|
15
15
|
|
16
|
-
template <class T>
|
17
|
-
class RNSkiOSView: public RNSkBaseiOSView, public T {
|
16
|
+
template <class T> class RNSkiOSView : public RNSkBaseiOSView, public T {
|
18
17
|
public:
|
19
|
-
RNSkiOSView(std::shared_ptr<RNSkia::RNSkPlatformContext> context)
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
18
|
+
RNSkiOSView(std::shared_ptr<RNSkia::RNSkPlatformContext> context)
|
19
|
+
: T(context,
|
20
|
+
std::make_shared<RNSkMetalCanvasProvider>(
|
21
|
+
std::bind(&RNSkia::RNSkView::requestRedraw, this), context)) {}
|
22
|
+
|
23
|
+
CALayer *getLayer() override {
|
24
|
+
return std::static_pointer_cast<RNSkMetalCanvasProvider>(
|
25
|
+
this->getCanvasProvider())
|
26
|
+
->getLayer();
|
24
27
|
}
|
25
|
-
|
28
|
+
|
26
29
|
void setSize(int width, int height) override {
|
27
|
-
std::static_pointer_cast<RNSkMetalCanvasProvider>(this->getCanvasProvider())
|
30
|
+
std::static_pointer_cast<RNSkMetalCanvasProvider>(this->getCanvasProvider())
|
31
|
+
->setSize(width, height);
|
28
32
|
}
|
29
|
-
|
33
|
+
|
30
34
|
std::shared_ptr<RNSkia::RNSkView> getDrawView() override {
|
31
35
|
return this->shared_from_this();
|
32
36
|
}
|
33
|
-
|
34
37
|
};
|
@@ -6,21 +6,22 @@
|
|
6
6
|
#import <CoreFoundation/CoreFoundation.h>
|
7
7
|
#import <UIKit/UIKit.h>
|
8
8
|
|
9
|
-
#import <RNSkiOSView.h>
|
10
9
|
#import <RNSkManager.h>
|
10
|
+
#import <RNSkiOSView.h>
|
11
11
|
|
12
12
|
class RNSkiOSJsView;
|
13
13
|
|
14
14
|
@interface SkiaUIView : UIView
|
15
15
|
|
16
|
-
- (instancetype)
|
17
|
-
|
18
|
-
|
16
|
+
- (instancetype)
|
17
|
+
initWithManager:(RNSkia::RNSkManager *)manager
|
18
|
+
factory:(std::function<std::shared_ptr<RNSkBaseiOSView>(
|
19
|
+
std::shared_ptr<RNSkia::RNSkPlatformContext>)>)factory;
|
19
20
|
|
20
|
-
- (std::shared_ptr<RNSkBaseiOSView>)
|
21
|
+
- (std::shared_ptr<RNSkBaseiOSView>)impl;
|
21
22
|
|
22
|
-
- (void)
|
23
|
-
- (void)
|
24
|
-
- (void)
|
23
|
+
- (void)setDrawingMode:(std::string)mode;
|
24
|
+
- (void)setDebugMode:(bool)debugMode;
|
25
|
+
- (void)setNativeId:(size_t)nativeId;
|
25
26
|
|
26
27
|
@end
|
@@ -19,11 +19,17 @@ var _GroupNode = require("./GroupNode");
|
|
19
19
|
|
20
20
|
var _PaintNode = require("./PaintNode");
|
21
21
|
|
22
|
+
var _LayerNode = require("./LayerNode");
|
23
|
+
|
22
24
|
class JsiSkDOM {
|
23
25
|
constructor(ctx) {
|
24
26
|
this.ctx = ctx;
|
25
27
|
}
|
26
28
|
|
29
|
+
Layer(props) {
|
30
|
+
return new _LayerNode.LayerNode(this.ctx, props ?? {});
|
31
|
+
}
|
32
|
+
|
27
33
|
Group(props) {
|
28
34
|
return new _GroupNode.GroupNode(this.ctx, props ?? {});
|
29
35
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["JsiSkDOM","constructor","ctx","Group","props","GroupNode","Paint","PaintNode","Fill","FillNode","Image","ImageNode","Circle","CircleNode","Path","PathNode","CustomDrawing","CustomDrawingNode","Line","LineNode","Oval","OvalNode","Patch","PatchNode","Points","PointsNode","Rect","RectNode","RRect","RRectNode","Vertices","VerticesNode","Text","TextNode","TextPath","TextPathNode","TextBlob","TextBlobNode","Glyphs","GlyphsNode","DiffRect","DiffRectNode","Picture","PictureNode","ImageSVG","ImageSVGNode","BlurMaskFilter","BlurMaskFilterNode","BlendImageFilter","BlendImageFilterNode","DropShadowImageFilter","DropShadowImageFilterNode","DisplacementMapImageFilter","DisplacementMapImageFilterNode","BlurImageFilter","BlurImageFilterNode","OffsetImageFilter","OffsetImageFilterNode","MorphologyImageFilter","MorphologyImageFilterNode","RuntimeShaderImageFilter","RuntimeShaderImageFilterNode","MatrixColorFilter","MatrixColorFilterNode","BlendColorFilter","BlendColorFilterNode","LumaColorFilter","LumaColorFilterNode","LinearToSRGBGammaColorFilter","LinearToSRGBGammaColorFilterNode","SRGBToLinearGammaColorFilter","SRGBToLinearGammaColorFilterNode","LerpColorFilter","LerpColorFilterNode","Shader","ShaderNode","ImageShader","ImageShaderNode","ColorShader","ColorNode","SweepGradient","SweepGradientNode","Turbulence","TurbulenceNode","FractalNoise","FractalNoiseNode","LinearGradient","LinearGradientNode","RadialGradient","RadialGradientNode","TwoPointConicalGradient","TwoPointConicalGradientNode","CornerPathEffect","CornerPathEffectNode","DiscretePathEffect","DiscretePathEffectNode","DashPathEffect","DashPathEffectNode","Path1DPathEffect","Path1DPathEffectNode","Path2DPathEffect","Path2DPathEffectNode","SumPathEffect","SumPathEffectNode","Line2DPathEffect","Line2DPathEffectNode","Blend","BlendNode","BackdropFilter","BackdropFilterNode","Box","BoxNode","BoxShadow","BoxShadowNode"],"sources":["JsiSkDOM.ts"],"sourcesContent":["import type {\n PathProps,\n SkDOM,\n GroupProps,\n ImageProps,\n BlurImageFilterProps,\n MatrixColorFilterProps,\n CircleProps,\n BlurMaskFilterProps,\n LinearGradientProps,\n PaintProps,\n ShaderProps,\n ImageShaderProps,\n CustomDrawingNodeProps,\n LineProps,\n OvalProps,\n PatchProps,\n PointsProps,\n RectProps,\n RoundedRectProps,\n VerticesProps,\n TextProps,\n DiffRectProps,\n OffsetImageFilterProps,\n BlendColorFilterProps,\n TextPathProps,\n TextBlobProps,\n GlyphsProps,\n TwoPointConicalGradientProps,\n TurbulenceProps,\n SweepGradientProps,\n RadialGradientProps,\n FractalNoiseProps,\n ColorProps,\n PictureProps,\n ImageSVGProps,\n LerpColorFilterProps,\n DrawingNodeProps,\n BoxProps,\n BoxShadowProps,\n ChildrenProps,\n} from \"../types\";\nimport type {\n BlendImageFilterProps,\n BlendProps,\n DisplacementMapImageFilterProps,\n DropShadowImageFilterProps,\n MorphologyImageFilterProps,\n RuntimeShaderImageFilterProps,\n} from \"../types/ImageFilters\";\nimport type {\n CornerPathEffectProps,\n DashPathEffectProps,\n DiscretePathEffectProps,\n Line2DPathEffectProps,\n Path1DPathEffectProps,\n Path2DPathEffectProps,\n} from \"../types/PathEffects\";\n\nimport {\n FillNode,\n ImageNode,\n CircleNode,\n PathNode,\n LineNode,\n PatchNode,\n PointsNode,\n RectNode,\n RRectNode,\n VerticesNode,\n TextNode,\n OvalNode,\n CustomDrawingNode,\n TextPathNode,\n TextBlobNode,\n GlyphsNode,\n DiffRectNode,\n PictureNode,\n ImageSVGNode,\n BackdropFilterNode,\n BoxNode,\n BoxShadowNode,\n} from \"./drawings\";\nimport {\n BlendImageFilterNode,\n BlurImageFilterNode,\n BlurMaskFilterNode,\n DisplacementMapImageFilterNode,\n DropShadowImageFilterNode,\n OffsetImageFilterNode,\n RuntimeShaderImageFilterNode,\n CornerPathEffectNode,\n DiscretePathEffectNode,\n DashPathEffectNode,\n Path1DPathEffectNode,\n Path2DPathEffectNode,\n SumPathEffectNode,\n Line2DPathEffectNode,\n BlendNode,\n} from \"./paint\";\nimport {\n MatrixColorFilterNode,\n LumaColorFilterNode,\n LinearToSRGBGammaColorFilterNode,\n SRGBToLinearGammaColorFilterNode,\n BlendColorFilterNode,\n LerpColorFilterNode,\n} from \"./paint/ColorFilters\";\nimport {\n LinearGradientNode,\n ShaderNode,\n ImageShaderNode,\n TwoPointConicalGradientNode,\n TurbulenceNode,\n SweepGradientNode,\n RadialGradientNode,\n FractalNoiseNode,\n ColorNode,\n} from \"./paint/Shaders\";\nimport { MorphologyImageFilterNode } from \"./paint/ImageFilters\";\nimport { GroupNode } from \"./GroupNode\";\nimport { PaintNode } from \"./PaintNode\";\nimport type { NodeContext } from \"./Node\";\n\nexport class JsiSkDOM implements SkDOM {\n constructor(private ctx: NodeContext) {}\n\n Group(props?: GroupProps) {\n return new GroupNode(this.ctx, props ?? {});\n }\n\n Paint(props: PaintProps) {\n return new PaintNode(this.ctx, props);\n }\n\n // Drawings\n Fill(props?: DrawingNodeProps) {\n return new FillNode(this.ctx, props);\n }\n\n Image(props: ImageProps) {\n return new ImageNode(this.ctx, props);\n }\n\n Circle(props: CircleProps) {\n return new CircleNode(this.ctx, props);\n }\n\n Path(props: PathProps) {\n return new PathNode(this.ctx, props);\n }\n\n CustomDrawing(props: CustomDrawingNodeProps) {\n return new CustomDrawingNode(this.ctx, props);\n }\n\n Line(props: LineProps) {\n return new LineNode(this.ctx, props);\n }\n\n Oval(props: OvalProps) {\n return new OvalNode(this.ctx, props);\n }\n\n Patch(props: PatchProps) {\n return new PatchNode(this.ctx, props);\n }\n\n Points(props: PointsProps) {\n return new PointsNode(this.ctx, props);\n }\n\n Rect(props: RectProps) {\n return new RectNode(this.ctx, props);\n }\n\n RRect(props: RoundedRectProps) {\n return new RRectNode(this.ctx, props);\n }\n\n Vertices(props: VerticesProps) {\n return new VerticesNode(this.ctx, props);\n }\n\n Text(props: TextProps) {\n return new TextNode(this.ctx, props);\n }\n\n TextPath(props: TextPathProps) {\n return new TextPathNode(this.ctx, props);\n }\n\n TextBlob(props: TextBlobProps) {\n return new TextBlobNode(this.ctx, props);\n }\n\n Glyphs(props: GlyphsProps) {\n return new GlyphsNode(this.ctx, props);\n }\n\n DiffRect(props: DiffRectProps) {\n return new DiffRectNode(this.ctx, props);\n }\n\n Picture(props: PictureProps) {\n return new PictureNode(this.ctx, props);\n }\n\n ImageSVG(props: ImageSVGProps) {\n return new ImageSVGNode(this.ctx, props);\n }\n\n // BlurMaskFilters\n BlurMaskFilter(props: BlurMaskFilterProps) {\n return new BlurMaskFilterNode(this.ctx, props);\n }\n\n // ImageFilters\n BlendImageFilter(props: BlendImageFilterProps) {\n return new BlendImageFilterNode(this.ctx, props);\n }\n\n DropShadowImageFilter(props: DropShadowImageFilterProps) {\n return new DropShadowImageFilterNode(this.ctx, props);\n }\n\n DisplacementMapImageFilter(props: DisplacementMapImageFilterProps) {\n return new DisplacementMapImageFilterNode(this.ctx, props);\n }\n\n BlurImageFilter(props: BlurImageFilterProps) {\n return new BlurImageFilterNode(this.ctx, props);\n }\n\n OffsetImageFilter(props: OffsetImageFilterProps) {\n return new OffsetImageFilterNode(this.ctx, props);\n }\n\n MorphologyImageFilter(props: MorphologyImageFilterProps) {\n return new MorphologyImageFilterNode(this.ctx, props);\n }\n\n RuntimeShaderImageFilter(props: RuntimeShaderImageFilterProps) {\n return new RuntimeShaderImageFilterNode(this.ctx, props);\n }\n\n // Color Filters\n MatrixColorFilter(props: MatrixColorFilterProps) {\n return new MatrixColorFilterNode(this.ctx, props);\n }\n\n BlendColorFilter(props: BlendColorFilterProps) {\n return new BlendColorFilterNode(this.ctx, props);\n }\n\n LumaColorFilter() {\n return new LumaColorFilterNode(this.ctx);\n }\n\n LinearToSRGBGammaColorFilter() {\n return new LinearToSRGBGammaColorFilterNode(this.ctx);\n }\n\n SRGBToLinearGammaColorFilter() {\n return new SRGBToLinearGammaColorFilterNode(this.ctx);\n }\n\n LerpColorFilter(props: LerpColorFilterProps) {\n return new LerpColorFilterNode(this.ctx, props);\n }\n\n // Shaders\n Shader(props: ShaderProps) {\n return new ShaderNode(this.ctx, props);\n }\n\n ImageShader(props: ImageShaderProps) {\n return new ImageShaderNode(this.ctx, props);\n }\n\n ColorShader(props: ColorProps) {\n return new ColorNode(this.ctx, props);\n }\n\n SweepGradient(props: SweepGradientProps) {\n return new SweepGradientNode(this.ctx, props);\n }\n\n Turbulence(props: TurbulenceProps) {\n return new TurbulenceNode(this.ctx, props);\n }\n\n FractalNoise(props: FractalNoiseProps) {\n return new FractalNoiseNode(this.ctx, props);\n }\n\n LinearGradient(props: LinearGradientProps) {\n return new LinearGradientNode(this.ctx, props);\n }\n\n RadialGradient(props: RadialGradientProps) {\n return new RadialGradientNode(this.ctx, props);\n }\n\n TwoPointConicalGradient(props: TwoPointConicalGradientProps) {\n return new TwoPointConicalGradientNode(this.ctx, props);\n }\n\n // Path Effects\n CornerPathEffect(props: CornerPathEffectProps) {\n return new CornerPathEffectNode(this.ctx, props);\n }\n\n DiscretePathEffect(props: DiscretePathEffectProps) {\n return new DiscretePathEffectNode(this.ctx, props);\n }\n\n DashPathEffect(props: DashPathEffectProps) {\n return new DashPathEffectNode(this.ctx, props);\n }\n\n Path1DPathEffect(props: Path1DPathEffectProps) {\n return new Path1DPathEffectNode(this.ctx, props);\n }\n\n Path2DPathEffect(props: Path2DPathEffectProps) {\n return new Path2DPathEffectNode(this.ctx, props);\n }\n\n SumPathEffect() {\n return new SumPathEffectNode(this.ctx);\n }\n\n Line2DPathEffect(props: Line2DPathEffectProps) {\n return new Line2DPathEffectNode(this.ctx, props);\n }\n\n Blend(props: BlendProps) {\n return new BlendNode(this.ctx, props);\n }\n\n BackdropFilter(props: ChildrenProps) {\n return new BackdropFilterNode(this.ctx, props);\n }\n\n Box(props: BoxProps) {\n return new BoxNode(this.ctx, props);\n }\n\n BoxShadow(props: BoxShadowProps) {\n return new BoxShadowNode(this.ctx, props);\n }\n}\n"],"mappings":";;;;;;;AA2DA;;AAwBA;;AAiBA;;AAQA;;AAWA;;AACA;;AACA;;AAGO,MAAMA,QAAN,CAAgC;EACrCC,WAAW,CAASC,GAAT,EAA2B;IAAA,KAAlBA,GAAkB,GAAlBA,GAAkB;EAAE;;EAExCC,KAAK,CAACC,KAAD,EAAqB;IACxB,OAAO,IAAIC,oBAAJ,CAAc,KAAKH,GAAnB,EAAwBE,KAAK,IAAI,EAAjC,CAAP;EACD;;EAEDE,KAAK,CAACF,KAAD,EAAoB;IACvB,OAAO,IAAIG,oBAAJ,CAAc,KAAKL,GAAnB,EAAwBE,KAAxB,CAAP;EACD,CAToC,CAWrC;;;EACAI,IAAI,CAACJ,KAAD,EAA2B;IAC7B,OAAO,IAAIK,kBAAJ,CAAa,KAAKP,GAAlB,EAAuBE,KAAvB,CAAP;EACD;;EAEDM,KAAK,CAACN,KAAD,EAAoB;IACvB,OAAO,IAAIO,mBAAJ,CAAc,KAAKT,GAAnB,EAAwBE,KAAxB,CAAP;EACD;;EAEDQ,MAAM,CAACR,KAAD,EAAqB;IACzB,OAAO,IAAIS,oBAAJ,CAAe,KAAKX,GAApB,EAAyBE,KAA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,KAAnC,CAAP;EACD;;EAEDgG,gBAAgB,CAAChG,KAAD,EAA+B;IAC7C,OAAO,IAAIiG,2BAAJ,CAAyB,KAAKnG,GAA9B,EAAmCE,KAAnC,CAAP;EACD;;EAEDkG,aAAa,GAAG;IACd,OAAO,IAAIC,wBAAJ,CAAsB,KAAKrG,GAA3B,CAAP;EACD;;EAEDsG,gBAAgB,CAACpG,KAAD,EAA+B;IAC7C,OAAO,IAAIqG,2BAAJ,CAAyB,KAAKvG,GAA9B,EAAmCE,KAAnC,CAAP;EACD;;EAEDsG,KAAK,CAACtG,KAAD,EAAoB;IACvB,OAAO,IAAIuG,gBAAJ,CAAc,KAAKzG,GAAnB,EAAwBE,KAAxB,CAAP;EACD;;EAEDwG,cAAc,CAACxG,KAAD,EAAuB;IACnC,OAAO,IAAIyG,4BAAJ,CAAuB,KAAK3G,GAA5B,EAAiCE,KAAjC,CAAP;EACD;;EAED0G,GAAG,CAAC1G,KAAD,EAAkB;IACnB,OAAO,IAAI2G,iBAAJ,CAAY,KAAK7G,GAAjB,EAAsBE,KAAtB,CAAP;EACD;;EAED4G,SAAS,CAAC5G,KAAD,EAAwB;IAC/B,OAAO,IAAI6G,uBAAJ,CAAkB,KAAK/G,GAAvB,EAA4BE,KAA5B,CAAP;EACD;;AAnOoC"}
|
1
|
+
{"version":3,"names":["JsiSkDOM","constructor","ctx","Layer","props","LayerNode","Group","GroupNode","Paint","PaintNode","Fill","FillNode","Image","ImageNode","Circle","CircleNode","Path","PathNode","CustomDrawing","CustomDrawingNode","Line","LineNode","Oval","OvalNode","Patch","PatchNode","Points","PointsNode","Rect","RectNode","RRect","RRectNode","Vertices","VerticesNode","Text","TextNode","TextPath","TextPathNode","TextBlob","TextBlobNode","Glyphs","GlyphsNode","DiffRect","DiffRectNode","Picture","PictureNode","ImageSVG","ImageSVGNode","BlurMaskFilter","BlurMaskFilterNode","BlendImageFilter","BlendImageFilterNode","DropShadowImageFilter","DropShadowImageFilterNode","DisplacementMapImageFilter","DisplacementMapImageFilterNode","BlurImageFilter","BlurImageFilterNode","OffsetImageFilter","OffsetImageFilterNode","MorphologyImageFilter","MorphologyImageFilterNode","RuntimeShaderImageFilter","RuntimeShaderImageFilterNode","MatrixColorFilter","MatrixColorFilterNode","BlendColorFilter","BlendColorFilterNode","LumaColorFilter","LumaColorFilterNode","LinearToSRGBGammaColorFilter","LinearToSRGBGammaColorFilterNode","SRGBToLinearGammaColorFilter","SRGBToLinearGammaColorFilterNode","LerpColorFilter","LerpColorFilterNode","Shader","ShaderNode","ImageShader","ImageShaderNode","ColorShader","ColorNode","SweepGradient","SweepGradientNode","Turbulence","TurbulenceNode","FractalNoise","FractalNoiseNode","LinearGradient","LinearGradientNode","RadialGradient","RadialGradientNode","TwoPointConicalGradient","TwoPointConicalGradientNode","CornerPathEffect","CornerPathEffectNode","DiscretePathEffect","DiscretePathEffectNode","DashPathEffect","DashPathEffectNode","Path1DPathEffect","Path1DPathEffectNode","Path2DPathEffect","Path2DPathEffectNode","SumPathEffect","SumPathEffectNode","Line2DPathEffect","Line2DPathEffectNode","Blend","BlendNode","BackdropFilter","BackdropFilterNode","Box","BoxNode","BoxShadow","BoxShadowNode"],"sources":["JsiSkDOM.ts"],"sourcesContent":["import type {\n PathProps,\n SkDOM,\n GroupProps,\n ImageProps,\n BlurImageFilterProps,\n MatrixColorFilterProps,\n CircleProps,\n BlurMaskFilterProps,\n LinearGradientProps,\n PaintProps,\n ShaderProps,\n ImageShaderProps,\n CustomDrawingNodeProps,\n LineProps,\n OvalProps,\n PatchProps,\n PointsProps,\n RectProps,\n RoundedRectProps,\n VerticesProps,\n TextProps,\n DiffRectProps,\n OffsetImageFilterProps,\n BlendColorFilterProps,\n TextPathProps,\n TextBlobProps,\n GlyphsProps,\n TwoPointConicalGradientProps,\n TurbulenceProps,\n SweepGradientProps,\n RadialGradientProps,\n FractalNoiseProps,\n ColorProps,\n PictureProps,\n ImageSVGProps,\n LerpColorFilterProps,\n DrawingNodeProps,\n BoxProps,\n BoxShadowProps,\n ChildrenProps,\n} from \"../types\";\nimport type {\n BlendImageFilterProps,\n BlendProps,\n DisplacementMapImageFilterProps,\n DropShadowImageFilterProps,\n MorphologyImageFilterProps,\n RuntimeShaderImageFilterProps,\n} from \"../types/ImageFilters\";\nimport type {\n CornerPathEffectProps,\n DashPathEffectProps,\n DiscretePathEffectProps,\n Line2DPathEffectProps,\n Path1DPathEffectProps,\n Path2DPathEffectProps,\n} from \"../types/PathEffects\";\n\nimport {\n FillNode,\n ImageNode,\n CircleNode,\n PathNode,\n LineNode,\n PatchNode,\n PointsNode,\n RectNode,\n RRectNode,\n VerticesNode,\n TextNode,\n OvalNode,\n CustomDrawingNode,\n TextPathNode,\n TextBlobNode,\n GlyphsNode,\n DiffRectNode,\n PictureNode,\n ImageSVGNode,\n BackdropFilterNode,\n BoxNode,\n BoxShadowNode,\n} from \"./drawings\";\nimport {\n BlendImageFilterNode,\n BlurImageFilterNode,\n BlurMaskFilterNode,\n DisplacementMapImageFilterNode,\n DropShadowImageFilterNode,\n OffsetImageFilterNode,\n RuntimeShaderImageFilterNode,\n CornerPathEffectNode,\n DiscretePathEffectNode,\n DashPathEffectNode,\n Path1DPathEffectNode,\n Path2DPathEffectNode,\n SumPathEffectNode,\n Line2DPathEffectNode,\n BlendNode,\n} from \"./paint\";\nimport {\n MatrixColorFilterNode,\n LumaColorFilterNode,\n LinearToSRGBGammaColorFilterNode,\n SRGBToLinearGammaColorFilterNode,\n BlendColorFilterNode,\n LerpColorFilterNode,\n} from \"./paint/ColorFilters\";\nimport {\n LinearGradientNode,\n ShaderNode,\n ImageShaderNode,\n TwoPointConicalGradientNode,\n TurbulenceNode,\n SweepGradientNode,\n RadialGradientNode,\n FractalNoiseNode,\n ColorNode,\n} from \"./paint/Shaders\";\nimport { MorphologyImageFilterNode } from \"./paint/ImageFilters\";\nimport { GroupNode } from \"./GroupNode\";\nimport { PaintNode } from \"./PaintNode\";\nimport type { NodeContext } from \"./Node\";\nimport { LayerNode } from \"./LayerNode\";\n\nexport class JsiSkDOM implements SkDOM {\n constructor(private ctx: NodeContext) {}\n\n Layer(props?: ChildrenProps) {\n return new LayerNode(this.ctx, props ?? {});\n }\n\n Group(props?: GroupProps) {\n return new GroupNode(this.ctx, props ?? {});\n }\n\n Paint(props: PaintProps) {\n return new PaintNode(this.ctx, props);\n }\n\n // Drawings\n Fill(props?: DrawingNodeProps) {\n return new FillNode(this.ctx, props);\n }\n\n Image(props: ImageProps) {\n return new ImageNode(this.ctx, props);\n }\n\n Circle(props: CircleProps) {\n return new CircleNode(this.ctx, props);\n }\n\n Path(props: PathProps) {\n return new PathNode(this.ctx, props);\n }\n\n CustomDrawing(props: CustomDrawingNodeProps) {\n return new CustomDrawingNode(this.ctx, props);\n }\n\n Line(props: LineProps) {\n return new LineNode(this.ctx, props);\n }\n\n Oval(props: OvalProps) {\n return new OvalNode(this.ctx, props);\n }\n\n Patch(props: PatchProps) {\n return new PatchNode(this.ctx, props);\n }\n\n Points(props: PointsProps) {\n return new PointsNode(this.ctx, props);\n }\n\n Rect(props: RectProps) {\n return new RectNode(this.ctx, props);\n }\n\n RRect(props: RoundedRectProps) {\n return new RRectNode(this.ctx, props);\n }\n\n Vertices(props: VerticesProps) {\n return new VerticesNode(this.ctx, props);\n }\n\n Text(props: TextProps) {\n return new TextNode(this.ctx, props);\n }\n\n TextPath(props: TextPathProps) {\n return new TextPathNode(this.ctx, props);\n }\n\n TextBlob(props: TextBlobProps) {\n return new TextBlobNode(this.ctx, props);\n }\n\n Glyphs(props: GlyphsProps) {\n return new GlyphsNode(this.ctx, props);\n }\n\n DiffRect(props: DiffRectProps) {\n return new DiffRectNode(this.ctx, props);\n }\n\n Picture(props: PictureProps) {\n return new PictureNode(this.ctx, props);\n }\n\n ImageSVG(props: ImageSVGProps) {\n return new ImageSVGNode(this.ctx, props);\n }\n\n // BlurMaskFilters\n BlurMaskFilter(props: BlurMaskFilterProps) {\n return new BlurMaskFilterNode(this.ctx, props);\n }\n\n // ImageFilters\n BlendImageFilter(props: BlendImageFilterProps) {\n return new BlendImageFilterNode(this.ctx, props);\n }\n\n DropShadowImageFilter(props: DropShadowImageFilterProps) {\n return new DropShadowImageFilterNode(this.ctx, props);\n }\n\n DisplacementMapImageFilter(props: DisplacementMapImageFilterProps) {\n return new DisplacementMapImageFilterNode(this.ctx, props);\n }\n\n BlurImageFilter(props: BlurImageFilterProps) {\n return new BlurImageFilterNode(this.ctx, props);\n }\n\n OffsetImageFilter(props: OffsetImageFilterProps) {\n return new OffsetImageFilterNode(this.ctx, props);\n }\n\n MorphologyImageFilter(props: MorphologyImageFilterProps) {\n return new MorphologyImageFilterNode(this.ctx, props);\n }\n\n RuntimeShaderImageFilter(props: RuntimeShaderImageFilterProps) {\n return new RuntimeShaderImageFilterNode(this.ctx, props);\n }\n\n // Color Filters\n MatrixColorFilter(props: MatrixColorFilterProps) {\n return new MatrixColorFilterNode(this.ctx, props);\n }\n\n BlendColorFilter(props: BlendColorFilterProps) {\n return new BlendColorFilterNode(this.ctx, props);\n }\n\n LumaColorFilter() {\n return new LumaColorFilterNode(this.ctx);\n }\n\n LinearToSRGBGammaColorFilter() {\n return new LinearToSRGBGammaColorFilterNode(this.ctx);\n }\n\n SRGBToLinearGammaColorFilter() {\n return new SRGBToLinearGammaColorFilterNode(this.ctx);\n }\n\n LerpColorFilter(props: LerpColorFilterProps) {\n return new LerpColorFilterNode(this.ctx, props);\n }\n\n // Shaders\n Shader(props: ShaderProps) {\n return new ShaderNode(this.ctx, props);\n }\n\n ImageShader(props: ImageShaderProps) {\n return new ImageShaderNode(this.ctx, props);\n }\n\n ColorShader(props: ColorProps) {\n return new ColorNode(this.ctx, props);\n }\n\n SweepGradient(props: SweepGradientProps) {\n return new SweepGradientNode(this.ctx, props);\n }\n\n Turbulence(props: TurbulenceProps) {\n return new TurbulenceNode(this.ctx, props);\n }\n\n FractalNoise(props: FractalNoiseProps) {\n return new FractalNoiseNode(this.ctx, props);\n }\n\n LinearGradient(props: LinearGradientProps) {\n return new LinearGradientNode(this.ctx, props);\n }\n\n RadialGradient(props: RadialGradientProps) {\n return new RadialGradientNode(this.ctx, props);\n }\n\n TwoPointConicalGradient(props: TwoPointConicalGradientProps) {\n return new TwoPointConicalGradientNode(this.ctx, props);\n }\n\n // Path Effects\n CornerPathEffect(props: CornerPathEffectProps) {\n return new CornerPathEffectNode(this.ctx, props);\n }\n\n DiscretePathEffect(props: DiscretePathEffectProps) {\n return new DiscretePathEffectNode(this.ctx, props);\n }\n\n DashPathEffect(props: DashPathEffectProps) {\n return new DashPathEffectNode(this.ctx, props);\n }\n\n Path1DPathEffect(props: Path1DPathEffectProps) {\n return new Path1DPathEffectNode(this.ctx, props);\n }\n\n Path2DPathEffect(props: Path2DPathEffectProps) {\n return new Path2DPathEffectNode(this.ctx, props);\n }\n\n SumPathEffect() {\n return new SumPathEffectNode(this.ctx);\n }\n\n Line2DPathEffect(props: Line2DPathEffectProps) {\n return new Line2DPathEffectNode(this.ctx, props);\n }\n\n Blend(props: BlendProps) {\n return new BlendNode(this.ctx, props);\n }\n\n BackdropFilter(props: ChildrenProps) {\n return new BackdropFilterNode(this.ctx, props);\n }\n\n Box(props: BoxProps) {\n return new BoxNode(this.ctx, props);\n }\n\n BoxShadow(props: BoxShadowProps) {\n return new BoxShadowNode(this.ctx, props);\n }\n}\n"],"mappings":";;;;;;;AA2DA;;AAwBA;;AAiBA;;AAQA;;AAWA;;AACA;;AACA;;AAEA;;AAEO,MAAMA,QAAN,CAAgC;EACrCC,WAAW,CAASC,GAAT,EAA2B;IAAA,KAAlBA,GAAkB,GAAlBA,GAAkB;EAAE;;EAExCC,KAAK,CAACC,KAAD,EAAwB;IAC3B,OAAO,IAAIC,oBAAJ,CAAc,KAAKH,GAAnB,EAAwBE,KAAK,IAAI,EAAjC,CAAP;EACD;;EAEDE,KAAK,CAACF,KAAD,EAAqB;IACxB,OAAO,IAAIG,oBAAJ,CAAc,KAAKL,GAAnB,EAAwBE,KAAK,IAAI,EAAjC,CA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P;EACD;;AAvOoC"}
|
@@ -0,0 +1,43 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.LayerNode = void 0;
|
7
|
+
|
8
|
+
var _types = require("../types");
|
9
|
+
|
10
|
+
var _RenderNode = require("./RenderNode");
|
11
|
+
|
12
|
+
var _Node = require("./Node");
|
13
|
+
|
14
|
+
const isLayer = node => node instanceof _Node.JsiDeclarationNode && node.isPaint();
|
15
|
+
|
16
|
+
class LayerNode extends _RenderNode.JsiRenderNode {
|
17
|
+
constructor(ctx, props) {
|
18
|
+
super(ctx, _types.NodeType.Layer, props);
|
19
|
+
}
|
20
|
+
|
21
|
+
renderNode(ctx) {
|
22
|
+
const [layer, ...children] = this.children();
|
23
|
+
|
24
|
+
if (isLayer(layer)) {
|
25
|
+
const paint = layer.materialize();
|
26
|
+
ctx.canvas.saveLayer(paint);
|
27
|
+
}
|
28
|
+
|
29
|
+
children.map(child => {
|
30
|
+
if (child instanceof _RenderNode.JsiRenderNode) {
|
31
|
+
child.render(ctx);
|
32
|
+
}
|
33
|
+
});
|
34
|
+
|
35
|
+
if (isLayer(layer)) {
|
36
|
+
ctx.canvas.restore();
|
37
|
+
}
|
38
|
+
}
|
39
|
+
|
40
|
+
}
|
41
|
+
|
42
|
+
exports.LayerNode = LayerNode;
|
43
|
+
//# sourceMappingURL=LayerNode.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["isLayer","node","JsiDeclarationNode","isPaint","LayerNode","JsiRenderNode","constructor","ctx","props","NodeType","Layer","renderNode","layer","children","paint","materialize","canvas","saveLayer","map","child","render","restore"],"sources":["LayerNode.ts"],"sourcesContent":["import type { DeclarationNode, DrawingContext, Node } from \"../types\";\nimport { NodeType } from \"../types\";\nimport type { ChildrenProps } from \"../types/Common\";\nimport type { SkPaint } from \"../../skia\";\n\nimport { JsiRenderNode } from \"./RenderNode\";\nimport type { NodeContext } from \"./Node\";\nimport { JsiDeclarationNode } from \"./Node\";\n\nconst isLayer = (\n node: Node<unknown>\n): node is DeclarationNode<unknown, SkPaint> =>\n node instanceof JsiDeclarationNode && node.isPaint();\n\nexport class LayerNode extends JsiRenderNode<ChildrenProps> {\n constructor(ctx: NodeContext, props: ChildrenProps) {\n super(ctx, NodeType.Layer, props);\n }\n\n renderNode(ctx: DrawingContext): void {\n const [layer, ...children] = this.children();\n if (isLayer(layer)) {\n const paint = layer.materialize() as SkPaint;\n ctx.canvas.saveLayer(paint);\n }\n children.map((child) => {\n if (child instanceof JsiRenderNode) {\n child.render(ctx);\n }\n });\n if (isLayer(layer)) {\n ctx.canvas.restore();\n }\n }\n}\n"],"mappings":";;;;;;;AACA;;AAIA;;AAEA;;AAEA,MAAMA,OAAO,GACXC,IADc,IAGdA,IAAI,YAAYC,wBAAhB,IAAsCD,IAAI,CAACE,OAAL,EAHxC;;AAKO,MAAMC,SAAN,SAAwBC,yBAAxB,CAAqD;EAC1DC,WAAW,CAACC,GAAD,EAAmBC,KAAnB,EAAyC;IAClD,MAAMD,GAAN,EAAWE,eAAA,CAASC,KAApB,EAA2BF,KAA3B;EACD;;EAEDG,UAAU,CAACJ,GAAD,EAA4B;IACpC,MAAM,CAACK,KAAD,EAAQ,GAAGC,QAAX,IAAuB,KAAKA,QAAL,EAA7B;;IACA,IAAIb,OAAO,CAACY,KAAD,CAAX,EAAoB;MAClB,MAAME,KAAK,GAAGF,KAAK,CAACG,WAAN,EAAd;MACAR,GAAG,CAACS,MAAJ,CAAWC,SAAX,CAAqBH,KAArB;IACD;;IACDD,QAAQ,CAACK,GAAT,CAAcC,KAAD,IAAW;MACtB,IAAIA,KAAK,YAAYd,yBAArB,EAAoC;QAClCc,KAAK,CAACC,MAAN,CAAab,GAAb;MACD;IACF,CAJD;;IAKA,IAAIP,OAAO,CAACY,KAAD,CAAX,EAAoB;MAClBL,GAAG,CAACS,MAAJ,CAAWK,OAAX;IACD;EACF;;AAnByD"}
|
@@ -193,7 +193,7 @@ class JsiRenderNode extends _Node.JsiNode {
|
|
193
193
|
const {
|
194
194
|
canvas
|
195
195
|
} = parentCtx;
|
196
|
-
const opacity = this.props.opacity ? parentCtx.opacity * this.props.opacity : parentCtx.opacity;
|
196
|
+
const opacity = this.props.opacity !== undefined ? parentCtx.opacity * this.props.opacity : parentCtx.opacity;
|
197
197
|
|
198
198
|
if (this.paintCache === null || this.paintCache.parent !== parentCtx.paint) {
|
199
199
|
const paintCtx = this.getPaintCtx();
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["paintProps","JsiRenderNode","JsiNode","constructor","ctx","type","props","matrix","Skia","Matrix","onPropChange","setProps","paintCache","setProp","key","value","hasChanged","includes","identity","clipPath","undefined","clipRect","clipRRect","computeMatrix","computeClip","addChild","child","JsiDeclarationNode","setInvalidate","insertChildBefore","before","clip","isPathDef","processPath","isRRect","processTransformProps","getPaintCtx","color","strokeWidth","blendMode","style","strokeJoin","strokeCap","strokeMiter","opacity","antiAlias","Color","BlendMode","enumKey","PaintStyle","StrokeJoin","StrokeCap","_children","forEach","isColorFilter","cf","materialize","colorFilter","ColorFilter","MakeCompose","isShader","shader","isPathEffect","pe","pathEffect","PathEffect","isImageFilter","filter","imageFilter","ImageFilter","isMaskFilter","maskFilter","render","parentCtx","invertClip","layer","transform","canvas","parent","paint","paintCtx","concatPaint","hasTransform","hasClip","shouldSave","op","ClipOp","Difference","Intersect","saveLayer","isSkPaint","current","save","concat","renderNode","restore","obj","__typename__","alpha","copy","setShader","setColor","cl","getColor","setStrokeWidth","setAntiAlias","setBlendMode","setColorFilter","setImageFilter","setMaskFilter","setPathEffect","setAlphaf","setStrokeCap","setStrokeJoin","setStrokeMiter","setStyle"],"sources":["RenderNode.ts"],"sourcesContent":["import type { RefObject } from \"react\";\n\nimport type {\n SkMatrix,\n SkRect,\n SkRRect,\n SkPath,\n SkPaint,\n} from \"../../skia/types\";\nimport {\n StrokeCap,\n StrokeJoin,\n PaintStyle,\n BlendMode,\n ClipOp,\n isRRect,\n} from \"../../skia/types\";\nimport type {\n RenderNode,\n GroupProps,\n DrawingContext,\n NodeType,\n Node,\n DeclarationNode,\n} from \"../types\";\n\nimport { isPathDef, processPath, processTransformProps } from \"./datatypes\";\nimport type { NodeContext } from \"./Node\";\nimport { JsiNode, JsiDeclarationNode } from \"./Node\";\nimport type { PaintContext } from \"./PaintContext\";\nimport { enumKey } from \"./datatypes/Enum\";\n\nconst paintProps = [\n \"color\",\n \"strokeWidth\",\n \"blendMode\",\n \"strokeCap\",\n \"strokeJoin\",\n \"strokeMiter\",\n \"style\",\n \"antiAlias\",\n \"opacity\",\n];\n\ninterface PaintCache {\n parent: SkPaint;\n child: SkPaint;\n}\n\nexport abstract class JsiRenderNode<P extends GroupProps>\n extends JsiNode<P>\n implements RenderNode<P>\n{\n paintCache: PaintCache | null = null;\n matrix: SkMatrix;\n clipRect?: SkRect;\n clipRRect?: SkRRect;\n clipPath?: SkPath;\n\n constructor(ctx: NodeContext, type: NodeType, props: P) {\n super(ctx, type, props);\n this.matrix = this.Skia.Matrix();\n this.onPropChange();\n }\n\n setProps(props: P) {\n super.setProps(props);\n this.onPropChange();\n this.paintCache = null;\n }\n\n setProp<K extends keyof P>(key: K, value: P[K]) {\n const hasChanged = super.setProp(key, value);\n if (hasChanged) {\n this.onPropChange();\n if (paintProps.includes(key as string)) {\n this.paintCache = null;\n }\n }\n return hasChanged;\n }\n\n protected onPropChange() {\n this.matrix.identity();\n this.clipPath = undefined;\n this.clipRect = undefined;\n this.clipRRect = undefined;\n this.computeMatrix();\n this.computeClip();\n }\n\n addChild(child: Node<unknown>) {\n if (child instanceof JsiDeclarationNode) {\n child.setInvalidate(() => (this.paintCache = null));\n }\n super.addChild(child);\n }\n\n insertChildBefore(child: Node<unknown>, before: Node<unknown>) {\n if (child instanceof JsiDeclarationNode) {\n child.setInvalidate(() => (this.paintCache = null));\n }\n super.insertChildBefore(child, before);\n }\n\n private computeClip() {\n const { clip } = this.props;\n if (clip) {\n if (isPathDef(clip)) {\n this.clipPath = processPath(this.Skia, clip);\n } else if (isRRect(clip)) {\n this.clipRRect = clip;\n } else {\n this.clipRect = clip;\n }\n }\n }\n\n private computeMatrix() {\n processTransformProps(this.matrix, this.props);\n }\n\n private getPaintCtx() {\n let ctx: PaintContext | undefined;\n const {\n color,\n strokeWidth,\n blendMode,\n style,\n strokeJoin,\n strokeCap,\n strokeMiter,\n opacity,\n antiAlias,\n } = this.props;\n if (\n color !== undefined ||\n strokeWidth !== undefined ||\n blendMode !== undefined ||\n style !== undefined ||\n strokeJoin !== undefined ||\n strokeCap !== undefined ||\n strokeMiter !== undefined ||\n opacity !== undefined ||\n antiAlias !== undefined\n ) {\n ctx = {};\n if (color !== undefined) {\n ctx.color = this.Skia.Color(color);\n }\n if (strokeWidth !== undefined) {\n ctx.strokeWidth = strokeWidth;\n }\n if (blendMode !== undefined) {\n ctx.blendMode = BlendMode[enumKey(blendMode)];\n }\n if (style !== undefined) {\n ctx.style = PaintStyle[enumKey(style)];\n }\n if (strokeJoin !== undefined) {\n ctx.strokeJoin = StrokeJoin[enumKey(strokeJoin)];\n }\n if (strokeCap !== undefined) {\n ctx.strokeCap = StrokeCap[enumKey(strokeCap)];\n }\n if (strokeMiter !== undefined) {\n ctx.strokeMiter = strokeMiter;\n }\n if (opacity !== undefined) {\n ctx.opacity = opacity;\n }\n if (antiAlias !== undefined) {\n ctx.antiAlias = antiAlias;\n }\n }\n this._children.forEach((child) => {\n if (child instanceof JsiDeclarationNode) {\n if (child.isColorFilter()) {\n ctx = ctx || {};\n const cf = child.materialize();\n ctx.colorFilter = ctx.colorFilter\n ? this.Skia.ColorFilter.MakeCompose(cf, ctx.colorFilter)\n : cf;\n } else if (child.isShader()) {\n ctx = ctx || {};\n const shader = child.materialize();\n ctx.shader = shader;\n } else if (child.isPathEffect()) {\n ctx = ctx || {};\n const pe = child.materialize();\n ctx.pathEffect = ctx.pathEffect\n ? this.Skia.PathEffect.MakeCompose(pe, ctx.pathEffect)\n : pe;\n } else if (child.isImageFilter()) {\n ctx = ctx || {};\n const filter = child.materialize();\n ctx.imageFilter = ctx.imageFilter\n ? this.Skia.ImageFilter.MakeCompose(filter, ctx.imageFilter)\n : filter;\n } else if (child.isMaskFilter()) {\n ctx = ctx || {};\n const filter = child.materialize();\n ctx.maskFilter = filter;\n }\n }\n });\n return ctx;\n }\n\n render(parentCtx: DrawingContext) {\n const { invertClip, layer, matrix, transform } = this.props;\n const { canvas } = parentCtx;\n\n const opacity = this.props.opacity\n ? parentCtx.opacity * this.props.opacity\n : parentCtx.opacity;\n\n if (\n this.paintCache === null ||\n this.paintCache.parent !== parentCtx.paint\n ) {\n const paintCtx = this.getPaintCtx();\n const child = paintCtx\n ? concatPaint(parentCtx.paint, paintCtx, parentCtx.opacity)\n : parentCtx.paint;\n this.paintCache = { parent: parentCtx.paint, child };\n }\n const paint = this.paintCache.child;\n // TODO: can we only recreate a new context here if needed?\n const ctx = { ...parentCtx, opacity, paint };\n const hasTransform = matrix !== undefined || transform !== undefined;\n const hasClip =\n this.clipRect !== undefined ||\n this.clipPath !== undefined ||\n this.clipRRect !== undefined;\n const shouldSave = hasTransform || hasClip || !!layer;\n const op = invertClip ? ClipOp.Difference : ClipOp.Intersect;\n\n if (shouldSave) {\n if (layer) {\n if (typeof layer === \"boolean\") {\n canvas.saveLayer();\n } else if (isSkPaint(layer)) {\n canvas.saveLayer(layer);\n } else {\n canvas.saveLayer(\n layer.current ? layer.current.materialize() : undefined\n );\n }\n } else {\n canvas.save();\n }\n }\n\n if (this.matrix) {\n canvas.concat(this.matrix);\n }\n if (this.clipRect) {\n canvas.clipRect(this.clipRect, op, true);\n } else if (this.clipRRect) {\n canvas.clipRRect(this.clipRRect, op, true);\n } else if (this.clipPath) {\n canvas.clipPath(this.clipPath, op, true);\n }\n\n this.renderNode(ctx);\n\n if (shouldSave) {\n canvas.restore();\n }\n }\n\n abstract renderNode(ctx: DrawingContext): void;\n}\n\nexport const isSkPaint = (\n obj: RefObject<DeclarationNode<unknown, SkPaint>> | SkPaint\n): obj is SkPaint => \"__typename__\" in obj && obj.__typename__ === \"Paint\";\n\nconst concatPaint = (\n parent: SkPaint,\n {\n color,\n strokeWidth,\n shader,\n antiAlias,\n blendMode,\n colorFilter,\n imageFilter,\n maskFilter,\n pathEffect,\n opacity: alpha,\n strokeCap,\n strokeJoin,\n strokeMiter,\n style,\n }: PaintContext,\n opacity: number\n) => {\n const paint = parent.copy();\n if (color !== undefined) {\n paint.setShader(null);\n color[3] *= opacity;\n paint.setColor(color);\n } else {\n const cl = paint.getColor();\n cl[3] *= opacity;\n paint.setColor(cl);\n }\n if (strokeWidth !== undefined) {\n paint.setStrokeWidth(strokeWidth);\n }\n if (shader !== undefined) {\n paint.setShader(shader);\n }\n if (antiAlias !== undefined) {\n paint.setAntiAlias(antiAlias);\n }\n if (blendMode !== undefined) {\n paint.setBlendMode(blendMode);\n }\n if (colorFilter !== undefined) {\n paint.setColorFilter(colorFilter);\n }\n if (imageFilter !== undefined) {\n paint.setImageFilter(imageFilter);\n }\n if (maskFilter !== undefined) {\n paint.setMaskFilter(maskFilter);\n }\n if (pathEffect !== undefined) {\n paint.setPathEffect(pathEffect);\n }\n if (alpha !== undefined) {\n paint.setAlphaf(alpha * opacity);\n }\n if (strokeCap !== undefined) {\n paint.setStrokeCap(strokeCap);\n }\n if (strokeJoin !== undefined) {\n paint.setStrokeJoin(strokeJoin);\n }\n if (strokeMiter !== undefined) {\n paint.setStrokeMiter(strokeMiter);\n }\n if (style !== undefined) {\n paint.setStyle(style);\n }\n return paint;\n};\n"],"mappings":";;;;;;;AASA;;AAiBA;;AAEA;;AAEA;;;;AAEA,MAAMA,UAAU,GAAG,CACjB,OADiB,EAEjB,aAFiB,EAGjB,WAHiB,EAIjB,WAJiB,EAKjB,YALiB,EAMjB,aANiB,EAOjB,OAPiB,EAQjB,WARiB,EASjB,SATiB,CAAnB;;AAiBO,MAAeC,aAAf,SACGC,aADH,CAGP;E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EACD;;EACD,IAAIF,SAAS,KAAKtB,SAAlB,EAA6B;IAC3B2D,KAAK,CAACiC,YAAN,CAAmBtE,SAAnB;EACD;;EACD,IAAID,UAAU,KAAKrB,SAAnB,EAA8B;IAC5B2D,KAAK,CAACkC,aAAN,CAAoBxE,UAApB;EACD;;EACD,IAAIE,WAAW,KAAKvB,SAApB,EAA+B;IAC7B2D,KAAK,CAACmC,cAAN,CAAqBvE,WAArB;EACD;;EACD,IAAIH,KAAK,KAAKpB,SAAd,EAAyB;IACvB2D,KAAK,CAACoC,QAAN,CAAe3E,KAAf;EACD;;EACD,OAAOuC,KAAP;AACD,CAtED"}
|
1
|
+
{"version":3,"names":["paintProps","JsiRenderNode","JsiNode","constructor","ctx","type","props","matrix","Skia","Matrix","onPropChange","setProps","paintCache","setProp","key","value","hasChanged","includes","identity","clipPath","undefined","clipRect","clipRRect","computeMatrix","computeClip","addChild","child","JsiDeclarationNode","setInvalidate","insertChildBefore","before","clip","isPathDef","processPath","isRRect","processTransformProps","getPaintCtx","color","strokeWidth","blendMode","style","strokeJoin","strokeCap","strokeMiter","opacity","antiAlias","Color","BlendMode","enumKey","PaintStyle","StrokeJoin","StrokeCap","_children","forEach","isColorFilter","cf","materialize","colorFilter","ColorFilter","MakeCompose","isShader","shader","isPathEffect","pe","pathEffect","PathEffect","isImageFilter","filter","imageFilter","ImageFilter","isMaskFilter","maskFilter","render","parentCtx","invertClip","layer","transform","canvas","parent","paint","paintCtx","concatPaint","hasTransform","hasClip","shouldSave","op","ClipOp","Difference","Intersect","saveLayer","isSkPaint","current","save","concat","renderNode","restore","obj","__typename__","alpha","copy","setShader","setColor","cl","getColor","setStrokeWidth","setAntiAlias","setBlendMode","setColorFilter","setImageFilter","setMaskFilter","setPathEffect","setAlphaf","setStrokeCap","setStrokeJoin","setStrokeMiter","setStyle"],"sources":["RenderNode.ts"],"sourcesContent":["import type { RefObject } from \"react\";\n\nimport type {\n SkMatrix,\n SkRect,\n SkRRect,\n SkPath,\n SkPaint,\n} from \"../../skia/types\";\nimport {\n StrokeCap,\n StrokeJoin,\n PaintStyle,\n BlendMode,\n ClipOp,\n isRRect,\n} from \"../../skia/types\";\nimport type {\n RenderNode,\n GroupProps,\n DrawingContext,\n NodeType,\n Node,\n DeclarationNode,\n} from \"../types\";\n\nimport { isPathDef, processPath, processTransformProps } from \"./datatypes\";\nimport type { NodeContext } from \"./Node\";\nimport { JsiNode, JsiDeclarationNode } from \"./Node\";\nimport type { PaintContext } from \"./PaintContext\";\nimport { enumKey } from \"./datatypes/Enum\";\n\nconst paintProps = [\n \"color\",\n \"strokeWidth\",\n \"blendMode\",\n \"strokeCap\",\n \"strokeJoin\",\n \"strokeMiter\",\n \"style\",\n \"antiAlias\",\n \"opacity\",\n];\n\ninterface PaintCache {\n parent: SkPaint;\n child: SkPaint;\n}\n\nexport abstract class JsiRenderNode<P extends GroupProps>\n extends JsiNode<P>\n implements RenderNode<P>\n{\n paintCache: PaintCache | null = null;\n matrix: SkMatrix;\n clipRect?: SkRect;\n clipRRect?: SkRRect;\n clipPath?: SkPath;\n\n constructor(ctx: NodeContext, type: NodeType, props: P) {\n super(ctx, type, props);\n this.matrix = this.Skia.Matrix();\n this.onPropChange();\n }\n\n setProps(props: P) {\n super.setProps(props);\n this.onPropChange();\n this.paintCache = null;\n }\n\n setProp<K extends keyof P>(key: K, value: P[K]) {\n const hasChanged = super.setProp(key, value);\n if (hasChanged) {\n this.onPropChange();\n if (paintProps.includes(key as string)) {\n this.paintCache = null;\n }\n }\n return hasChanged;\n }\n\n protected onPropChange() {\n this.matrix.identity();\n this.clipPath = undefined;\n this.clipRect = undefined;\n this.clipRRect = undefined;\n this.computeMatrix();\n this.computeClip();\n }\n\n addChild(child: Node<unknown>) {\n if (child instanceof JsiDeclarationNode) {\n child.setInvalidate(() => (this.paintCache = null));\n }\n super.addChild(child);\n }\n\n insertChildBefore(child: Node<unknown>, before: Node<unknown>) {\n if (child instanceof JsiDeclarationNode) {\n child.setInvalidate(() => (this.paintCache = null));\n }\n super.insertChildBefore(child, before);\n }\n\n private computeClip() {\n const { clip } = this.props;\n if (clip) {\n if (isPathDef(clip)) {\n this.clipPath = processPath(this.Skia, clip);\n } else if (isRRect(clip)) {\n this.clipRRect = clip;\n } else {\n this.clipRect = clip;\n }\n }\n }\n\n private computeMatrix() {\n processTransformProps(this.matrix, this.props);\n }\n\n private getPaintCtx() {\n let ctx: PaintContext | undefined;\n const {\n color,\n strokeWidth,\n blendMode,\n style,\n strokeJoin,\n strokeCap,\n strokeMiter,\n opacity,\n antiAlias,\n } = this.props;\n if (\n color !== undefined ||\n strokeWidth !== undefined ||\n blendMode !== undefined ||\n style !== undefined ||\n strokeJoin !== undefined ||\n strokeCap !== undefined ||\n strokeMiter !== undefined ||\n opacity !== undefined ||\n antiAlias !== undefined\n ) {\n ctx = {};\n if (color !== undefined) {\n ctx.color = this.Skia.Color(color);\n }\n if (strokeWidth !== undefined) {\n ctx.strokeWidth = strokeWidth;\n }\n if (blendMode !== undefined) {\n ctx.blendMode = BlendMode[enumKey(blendMode)];\n }\n if (style !== undefined) {\n ctx.style = PaintStyle[enumKey(style)];\n }\n if (strokeJoin !== undefined) {\n ctx.strokeJoin = StrokeJoin[enumKey(strokeJoin)];\n }\n if (strokeCap !== undefined) {\n ctx.strokeCap = StrokeCap[enumKey(strokeCap)];\n }\n if (strokeMiter !== undefined) {\n ctx.strokeMiter = strokeMiter;\n }\n if (opacity !== undefined) {\n ctx.opacity = opacity;\n }\n if (antiAlias !== undefined) {\n ctx.antiAlias = antiAlias;\n }\n }\n this._children.forEach((child) => {\n if (child instanceof JsiDeclarationNode) {\n if (child.isColorFilter()) {\n ctx = ctx || {};\n const cf = child.materialize();\n ctx.colorFilter = ctx.colorFilter\n ? this.Skia.ColorFilter.MakeCompose(cf, ctx.colorFilter)\n : cf;\n } else if (child.isShader()) {\n ctx = ctx || {};\n const shader = child.materialize();\n ctx.shader = shader;\n } else if (child.isPathEffect()) {\n ctx = ctx || {};\n const pe = child.materialize();\n ctx.pathEffect = ctx.pathEffect\n ? this.Skia.PathEffect.MakeCompose(pe, ctx.pathEffect)\n : pe;\n } else if (child.isImageFilter()) {\n ctx = ctx || {};\n const filter = child.materialize();\n ctx.imageFilter = ctx.imageFilter\n ? this.Skia.ImageFilter.MakeCompose(filter, ctx.imageFilter)\n : filter;\n } else if (child.isMaskFilter()) {\n ctx = ctx || {};\n const filter = child.materialize();\n ctx.maskFilter = filter;\n }\n }\n });\n return ctx;\n }\n\n render(parentCtx: DrawingContext) {\n const { invertClip, layer, matrix, transform } = this.props;\n const { canvas } = parentCtx;\n\n const opacity =\n this.props.opacity !== undefined\n ? parentCtx.opacity * this.props.opacity\n : parentCtx.opacity;\n\n if (\n this.paintCache === null ||\n this.paintCache.parent !== parentCtx.paint\n ) {\n const paintCtx = this.getPaintCtx();\n const child = paintCtx\n ? concatPaint(parentCtx.paint, paintCtx, parentCtx.opacity)\n : parentCtx.paint;\n this.paintCache = { parent: parentCtx.paint, child };\n }\n const paint = this.paintCache.child;\n // TODO: can we only recreate a new context here if needed?\n const ctx = { ...parentCtx, opacity, paint };\n const hasTransform = matrix !== undefined || transform !== undefined;\n const hasClip =\n this.clipRect !== undefined ||\n this.clipPath !== undefined ||\n this.clipRRect !== undefined;\n const shouldSave = hasTransform || hasClip || !!layer;\n const op = invertClip ? ClipOp.Difference : ClipOp.Intersect;\n\n if (shouldSave) {\n if (layer) {\n if (typeof layer === \"boolean\") {\n canvas.saveLayer();\n } else if (isSkPaint(layer)) {\n canvas.saveLayer(layer);\n } else {\n canvas.saveLayer(\n layer.current ? layer.current.materialize() : undefined\n );\n }\n } else {\n canvas.save();\n }\n }\n\n if (this.matrix) {\n canvas.concat(this.matrix);\n }\n if (this.clipRect) {\n canvas.clipRect(this.clipRect, op, true);\n } else if (this.clipRRect) {\n canvas.clipRRect(this.clipRRect, op, true);\n } else if (this.clipPath) {\n canvas.clipPath(this.clipPath, op, true);\n }\n\n this.renderNode(ctx);\n\n if (shouldSave) {\n canvas.restore();\n }\n }\n\n abstract renderNode(ctx: DrawingContext): void;\n}\n\nexport const isSkPaint = (\n obj: RefObject<DeclarationNode<unknown, SkPaint>> | SkPaint\n): obj is SkPaint => \"__typename__\" in obj && obj.__typename__ === \"Paint\";\n\nconst concatPaint = (\n parent: SkPaint,\n {\n color,\n strokeWidth,\n shader,\n antiAlias,\n blendMode,\n colorFilter,\n imageFilter,\n maskFilter,\n pathEffect,\n opacity: alpha,\n strokeCap,\n strokeJoin,\n strokeMiter,\n style,\n }: PaintContext,\n opacity: number\n) => {\n const paint = parent.copy();\n if (color !== undefined) {\n paint.setShader(null);\n color[3] *= opacity;\n paint.setColor(color);\n } else {\n const cl = paint.getColor();\n cl[3] *= opacity;\n paint.setColor(cl);\n }\n if (strokeWidth !== undefined) {\n paint.setStrokeWidth(strokeWidth);\n }\n if (shader !== undefined) {\n paint.setShader(shader);\n }\n if (antiAlias !== undefined) {\n paint.setAntiAlias(antiAlias);\n }\n if (blendMode !== undefined) {\n paint.setBlendMode(blendMode);\n }\n if (colorFilter !== undefined) {\n paint.setColorFilter(colorFilter);\n }\n if (imageFilter !== undefined) {\n paint.setImageFilter(imageFilter);\n }\n if (maskFilter !== undefined) {\n paint.setMaskFilter(maskFilter);\n }\n if (pathEffect !== undefined) {\n paint.setPathEffect(pathEffect);\n }\n if (alpha !== undefined) {\n paint.setAlphaf(alpha * opacity);\n }\n if (strokeCap !== undefined) {\n paint.setStrokeCap(strokeCap);\n }\n if (strokeJoin !== undefined) {\n paint.setStrokeJoin(strokeJoin);\n }\n if (strokeMiter !== undefined) {\n paint.setStrokeMiter(strokeMiter);\n }\n if (style !== undefined) {\n paint.setStyle(style);\n }\n return paint;\n};\n"],"mappings":";;;;;;;AASA;;AAiBA;;AAEA;;AAEA;;;;AAEA,MAAMA,UAAU,GAAG,CACjB,OADiB,EAEjB,aAFiB,EAGjB,WAHiB,EAIjB,WAJiB,EAKjB,YALiB,EAMjB,aANiB,EAOjB,OAPiB,EAQjB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