@shopify/react-native-skia 0.1.155 → 0.1.156

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (162) hide show
  1. package/android/cpp/jni/JniLoad.cpp +5 -5
  2. package/android/cpp/jni/JniPlatformContext.cpp +107 -119
  3. package/android/cpp/jni/JniSkiaManager.cpp +18 -20
  4. package/android/cpp/jni/include/JniPlatformContext.h +41 -45
  5. package/android/cpp/jni/include/JniSkiaBaseView.h +52 -55
  6. package/android/cpp/jni/include/JniSkiaDrawView.h +72 -77
  7. package/android/cpp/jni/include/JniSkiaManager.h +51 -53
  8. package/android/cpp/jni/include/JniSkiaPictureView.h +74 -78
  9. package/android/cpp/rnskia-android/RNSkAndroidPlatformContext.h +36 -45
  10. package/android/cpp/rnskia-android/RNSkAndroidView.h +87 -92
  11. package/android/cpp/rnskia-android/RNSkOpenGLCanvasProvider.cpp +62 -65
  12. package/android/cpp/rnskia-android/RNSkOpenGLCanvasProvider.h +20 -17
  13. package/android/cpp/rnskia-android/SkiaOpenGLRenderer.cpp +257 -313
  14. package/android/cpp/rnskia-android/SkiaOpenGLRenderer.h +107 -110
  15. package/cpp/api/JsiSkApi.h +66 -62
  16. package/cpp/api/JsiSkCanvas.h +38 -30
  17. package/cpp/api/JsiSkColor.h +58 -56
  18. package/cpp/api/JsiSkColorFilter.h +5 -3
  19. package/cpp/api/JsiSkColorFilterFactory.h +23 -21
  20. package/cpp/api/JsiSkContourMeasure.h +74 -85
  21. package/cpp/api/JsiSkContourMeasureIter.h +68 -75
  22. package/cpp/api/JsiSkData.h +16 -22
  23. package/cpp/api/JsiSkDataFactory.h +86 -79
  24. package/cpp/api/JsiSkFont.h +286 -311
  25. package/cpp/api/JsiSkHostObjects.h +15 -16
  26. package/cpp/api/JsiSkImage.h +107 -103
  27. package/cpp/api/JsiSkImageFactory.h +34 -36
  28. package/cpp/api/JsiSkImageFilter.h +5 -3
  29. package/cpp/api/JsiSkImageFilterFactory.h +71 -68
  30. package/cpp/api/JsiSkImageInfo.h +41 -38
  31. package/cpp/api/JsiSkMaskFilter.h +5 -3
  32. package/cpp/api/JsiSkMaskFilterFactory.h +2 -3
  33. package/cpp/api/JsiSkMatrix.h +26 -36
  34. package/cpp/api/JsiSkPaint.h +20 -13
  35. package/cpp/api/JsiSkPath.h +70 -85
  36. package/cpp/api/JsiSkPathEffect.h +5 -3
  37. package/cpp/api/JsiSkPathEffectFactory.h +33 -28
  38. package/cpp/api/JsiSkPathFactory.h +68 -67
  39. package/cpp/api/JsiSkPicture.h +28 -22
  40. package/cpp/api/JsiSkPictureFactory.h +13 -12
  41. package/cpp/api/JsiSkPictureRecorder.h +21 -19
  42. package/cpp/api/JsiSkPoint.h +6 -8
  43. package/cpp/api/JsiSkRRect.h +11 -7
  44. package/cpp/api/JsiSkRSXform.h +82 -85
  45. package/cpp/api/JsiSkRect.h +9 -9
  46. package/cpp/api/JsiSkRuntimeEffect.h +182 -186
  47. package/cpp/api/JsiSkRuntimeEffectFactory.h +10 -11
  48. package/cpp/api/JsiSkRuntimeShaderBuilder.h +64 -61
  49. package/cpp/api/JsiSkSVG.h +4 -5
  50. package/cpp/api/JsiSkSVGFactory.h +28 -27
  51. package/cpp/api/JsiSkShader.h +3 -2
  52. package/cpp/api/JsiSkShaderFactory.h +37 -25
  53. package/cpp/api/JsiSkSurface.h +44 -40
  54. package/cpp/api/JsiSkSurfaceFactory.h +22 -22
  55. package/cpp/api/JsiSkTextBlob.h +28 -31
  56. package/cpp/api/JsiSkTextBlobFactory.h +88 -87
  57. package/cpp/api/JsiSkTypeface.h +6 -5
  58. package/cpp/api/JsiSkTypefaceFactory.h +22 -21
  59. package/cpp/api/JsiSkVertices.h +137 -124
  60. package/cpp/api/third_party/CSSColorParser.cpp +161 -174
  61. package/cpp/api/third_party/CSSColorParser.h +172 -96
  62. package/cpp/jsi/JsiHostObject.cpp +11 -9
  63. package/cpp/jsi/JsiHostObject.h +31 -24
  64. package/cpp/jsi/JsiSimpleValueWrapper.h +74 -83
  65. package/cpp/jsi/JsiValueWrapper.h +52 -54
  66. package/cpp/rnskia/RNSkAnimation.h +26 -29
  67. package/cpp/rnskia/RNSkDispatchQueue.cpp +50 -61
  68. package/cpp/rnskia/RNSkDispatchQueue.h +3 -1
  69. package/cpp/rnskia/RNSkInfoParameter.h +12 -12
  70. package/cpp/rnskia/RNSkJsView.cpp +82 -81
  71. package/cpp/rnskia/RNSkJsView.h +45 -41
  72. package/cpp/rnskia/RNSkJsiViewApi.h +99 -89
  73. package/cpp/rnskia/RNSkManager.cpp +8 -7
  74. package/cpp/rnskia/RNSkManager.h +8 -6
  75. package/cpp/rnskia/RNSkPictureView.h +44 -37
  76. package/cpp/rnskia/RNSkPlatformContext.h +39 -28
  77. package/cpp/rnskia/RNSkValueApi.h +33 -34
  78. package/cpp/rnskia/RNSkView.h +108 -93
  79. package/cpp/rnskia/values/RNSkClockValue.h +63 -64
  80. package/cpp/rnskia/values/RNSkComputedValue.h +32 -30
  81. package/cpp/rnskia/values/RNSkReadonlyValue.h +60 -59
  82. package/cpp/rnskia/values/RNSkValue.h +38 -40
  83. package/cpp/utils/RNSkLog.h +9 -7
  84. package/cpp/utils/RNSkMeasureTime.h +7 -7
  85. package/cpp/utils/RNSkTimingInfo.h +27 -24
  86. package/ios/RNSkia-iOS/RNSkMetalCanvasProvider.h +8 -9
  87. package/ios/RNSkia-iOS/RNSkiOSPlatformContext.h +24 -23
  88. package/ios/RNSkia-iOS/RNSkiOSView.h +16 -13
  89. package/ios/RNSkia-iOS/SkiaUIView.h +9 -8
  90. package/lib/commonjs/dom/nodes/JsiSkDOM.js +6 -0
  91. package/lib/commonjs/dom/nodes/JsiSkDOM.js.map +1 -1
  92. package/lib/commonjs/dom/nodes/LayerNode.js +43 -0
  93. package/lib/commonjs/dom/nodes/LayerNode.js.map +1 -0
  94. package/lib/commonjs/dom/types/NodeType.js +1 -0
  95. package/lib/commonjs/dom/types/NodeType.js.map +1 -1
  96. package/lib/commonjs/dom/types/SkDOM.js.map +1 -1
  97. package/lib/commonjs/renderer/HostComponents.js +3 -0
  98. package/lib/commonjs/renderer/HostComponents.js.map +1 -1
  99. package/lib/commonjs/renderer/components/Group.js +19 -4
  100. package/lib/commonjs/renderer/components/Group.js.map +1 -1
  101. package/lib/commonjs/renderer/components/Paint.js +6 -1
  102. package/lib/commonjs/renderer/components/Paint.js.map +1 -1
  103. package/lib/commonjs/views/SkiaPictureView.js +3 -2
  104. package/lib/commonjs/views/SkiaPictureView.js.map +1 -1
  105. package/lib/commonjs/views/SkiaView.js +6 -3
  106. package/lib/commonjs/views/SkiaView.js.map +1 -1
  107. package/lib/module/dom/nodes/JsiSkDOM.js +5 -0
  108. package/lib/module/dom/nodes/JsiSkDOM.js.map +1 -1
  109. package/lib/module/dom/nodes/LayerNode.js +32 -0
  110. package/lib/module/dom/nodes/LayerNode.js.map +1 -0
  111. package/lib/module/dom/types/NodeType.js +1 -0
  112. package/lib/module/dom/types/NodeType.js.map +1 -1
  113. package/lib/module/dom/types/SkDOM.js.map +1 -1
  114. package/lib/module/renderer/HostComponents.js +3 -0
  115. package/lib/module/renderer/HostComponents.js.map +1 -1
  116. package/lib/module/renderer/components/Group.js +16 -3
  117. package/lib/module/renderer/components/Group.js.map +1 -1
  118. package/lib/module/renderer/components/Paint.js +7 -1
  119. package/lib/module/renderer/components/Paint.js.map +1 -1
  120. package/lib/module/views/SkiaPictureView.js +2 -2
  121. package/lib/module/views/SkiaPictureView.js.map +1 -1
  122. package/lib/module/views/SkiaView.js +4 -2
  123. package/lib/module/views/SkiaView.js.map +1 -1
  124. package/lib/typescript/src/dom/nodes/JsiSkDOM.d.ts +2 -0
  125. package/lib/typescript/src/dom/nodes/LayerNode.d.ts +8 -0
  126. package/lib/typescript/src/dom/types/NodeType.d.ts +1 -0
  127. package/lib/typescript/src/dom/types/SkDOM.d.ts +1 -0
  128. package/lib/typescript/src/renderer/HostComponents.d.ts +2 -1
  129. package/lib/typescript/src/renderer/components/Group.d.ts +5 -1
  130. package/lib/typescript/src/views/SkiaView.d.ts +3 -0
  131. package/libs/android/arm64-v8a/libskottie.a +0 -0
  132. package/libs/android/arm64-v8a/libsksg.a +0 -0
  133. package/libs/android/armeabi-v7a/libskottie.a +0 -0
  134. package/libs/android/armeabi-v7a/libsksg.a +0 -0
  135. package/libs/android/x86/libskottie.a +0 -0
  136. package/libs/android/x86/libsksg.a +0 -0
  137. package/libs/android/x86_64/libskottie.a +0 -0
  138. package/libs/android/x86_64/libsksg.a +0 -0
  139. package/libs/ios/libskia.xcframework/ios-arm64_arm64e/libskia.a +0 -0
  140. package/libs/ios/libskia.xcframework/ios-arm64_arm64e_x86_64-simulator/libskia.a +0 -0
  141. package/libs/ios/libskottie.xcframework/Info.plist +42 -0
  142. package/libs/ios/libskottie.xcframework/ios-arm64_arm64e/libskottie.a +0 -0
  143. package/libs/ios/libskottie.xcframework/ios-arm64_arm64e_x86_64-simulator/libskottie.a +0 -0
  144. package/libs/ios/libsksg.xcframework/Info.plist +42 -0
  145. package/libs/ios/libsksg.xcframework/ios-arm64_arm64e/libsksg.a +0 -0
  146. package/libs/ios/libsksg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsksg.a +0 -0
  147. package/libs/ios/libskshaper.xcframework/Info.plist +5 -5
  148. package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e/libskshaper.a +0 -0
  149. package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e_x86_64-simulator/libskshaper.a +0 -0
  150. package/libs/ios/libsvg.xcframework/Info.plist +5 -5
  151. package/libs/ios/libsvg.xcframework/ios-arm64_arm64e/libsvg.a +0 -0
  152. package/libs/ios/libsvg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsvg.a +0 -0
  153. package/package.json +3 -1
  154. package/src/dom/nodes/JsiSkDOM.ts +5 -0
  155. package/src/dom/nodes/LayerNode.ts +35 -0
  156. package/src/dom/types/NodeType.ts +1 -0
  157. package/src/dom/types/SkDOM.ts +1 -0
  158. package/src/renderer/HostComponents.ts +3 -0
  159. package/src/renderer/components/Group.tsx +16 -3
  160. package/src/renderer/components/Paint.tsx +7 -1
  161. package/src/views/SkiaPictureView.tsx +2 -3
  162. package/src/views/SkiaView.tsx +2 -2
@@ -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
- using namespace facebook;
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, 512, fmt, args);
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& runtime, const std::string& message) {
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& runtime, const std::string& message) {
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& 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 = duration_cast<milliseconds>(stop - _start).count();
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 namespace std::chrono;
11
- using frame = duration<int32_t, std::ratio<1, 60>>;
12
- using ms = duration<float, std::milli>;
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
- _start = high_resolution_clock::now();
34
- }
35
-
33
+
34
+ void beginTiming() { _start = high_resolution_clock::now(); }
35
+
36
36
  void stopTiming() {
37
- time_point<steady_clock> stop = high_resolution_clock::now();
38
- addLastDuration(duration_cast<milliseconds>(stop - _start).count());
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", _name.c_str(), _lastDuration);
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
- void tick(time_point<steady_clock> now) {
77
- auto ms = duration_cast<milliseconds>(now.time_since_epoch()).count();
78
-
79
- if(_prevFpsTimer == -1) {
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*)>& cb) override;
20
-
18
+
19
+ void renderToCanvas(const std::function<void(SkCanvas *)> &cb) override;
20
+
21
21
  void setSize(int width, int height);
22
-
23
- CALayer* getLayer();
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
- namespace react {
23
- class CallInvoker;
24
- }
22
+ namespace react {
23
+ class CallInvoker;
25
24
  }
25
+ } // namespace facebook
26
26
 
27
27
  namespace RNSkia {
28
28
 
29
- using namespace facebook;
29
+ namespace jsi = facebook::jsi;
30
30
 
31
- static void handleNotification(CFNotificationCenterRef center, void *observer, CFStringRef name, const void *object, CFDictionaryRef userInfo);
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
- std::shared_ptr<react::CallInvoker> callInvoker)
37
- : RNSkPlatformContext(runtime, callInvoker, [[UIScreen mainScreen] scale]) {
38
- // We need to make sure we invalidate when modules are freed
39
- CFNotificationCenterAddObserver(
40
- CFNotificationCenterGetLocalCenter(),
41
- this,
42
- &handleNotification,
43
- (__bridge CFStringRef)RCTBridgeWillInvalidateModulesNotification,
44
- NULL,
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(CFNotificationCenterGetLocalCenter(), this);
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, CFStringRef name,
72
- const void *object, CFDictionaryRef userInfo) {
73
- (static_cast<RNSkiOSPlatformContext*>(observer))->willInvalidateModules();
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* getLayer() = 0;
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
- T(context, std::make_shared<RNSkMetalCanvasProvider>(std::bind(&RNSkia::RNSkView::requestRedraw, this), context)) {}
21
-
22
- CALayer* getLayer() override {
23
- return std::static_pointer_cast<RNSkMetalCanvasProvider>(this->getCanvasProvider())->getLayer();
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())->setSize(width, height);
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)initWithManager: (RNSkia::RNSkManager*)manager
17
- factory: (std::function<std::shared_ptr<RNSkBaseiOSView>(
18
- std::shared_ptr<RNSkia::RNSkPlatformContext>)>)factory;
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>) impl;
21
+ - (std::shared_ptr<RNSkBaseiOSView>)impl;
21
22
 
22
- - (void) setDrawingMode:(std::string) mode;
23
- - (void) setDebugMode:(bool) debugMode;
24
- - (void) setNativeId:(size_t) nativeId;
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 }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AIyG,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,CAAP;EACD;;EAEDI,KAAK,CAACJ,KAAD,EAAoB;IACvB,OAAO,IAAIK,oBAAJ,CAAc,KAAKP,GAAnB,EAAwBE,KAAxB,CAAP;EACD,CAboC,CAerC;;;EACAM,IAAI,CAACN,KAAD,EAA2B;IAC7B,OAAO,IAAIO,kBAAJ,CAAa,KAAKT,GAAlB,EAAuBE,KAAvB,CAAP;EACD;;EAEDQ,KAAK,CAACR,KAAD,EAAoB;IACvB,OAAO,IAAIS,mBAAJ,CAAc,KAAKX,GAAnB,EAAwBE,KAAxB,CAAP;EACD;;EAEDU,MAAM,CAACV,KAAD,EAAqB;IACzB,OAAO,IAAIW,oBAAJ,CAAe,KAAKb,GAApB,EAAyBE,KAAzB,CAAP;EACD;;EAEDY,IAAI,CAACZ,KAAD,EAAmB;IACrB,OAAO,IA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IAC7C,OAAO,IAAImG,2BAAJ,CAAyB,KAAKrG,GAA9B,EAAmCE,KAAnC,CAAP;EACD;;EAEDoG,aAAa,GAAG;IACd,OAAO,IAAIC,wBAAJ,CAAsB,KAAKvG,GAA3B,CAAP;EACD;;EAEDwG,gBAAgB,CAACtG,KAAD,EAA+B;IAC7C,OAAO,IAAIuG,2BAAJ,CAAyB,KAAKzG,GAA9B,EAAmCE,KAAnC,CAAP;EACD;;EAEDwG,KAAK,CAACxG,KAAD,EAAoB;IACvB,OAAO,IAAIyG,gBAAJ,CAAc,KAAK3G,GAAnB,EAAwBE,KAAxB,CAAP;EACD;;EAED0G,cAAc,CAAC1G,KAAD,EAAuB;IACnC,OAAO,IAAI2G,4BAAJ,CAAuB,KAAK7G,GAA5B,EAAiCE,KAAjC,CAAP;EACD;;EAED4G,GAAG,CAAC5G,KAAD,EAAkB;IACnB,OAAO,IAAI6G,iBAAJ,CAAY,KAAK/G,GAAjB,EAAsBE,KAAtB,CAAP;EACD;;EAED8G,SAAS,CAAC9G,KAAD,EAAwB;IAC/B,OAAO,IAAI+G,uBAAJ,CAAkB,KAAKjH,GAAvB,EAA4BE,KAA5B,CAAP;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"}
@@ -8,6 +8,7 @@ let NodeType;
8
8
  exports.NodeType = NodeType;
9
9
 
10
10
  (function (NodeType) {
11
+ NodeType["Layer"] = "skLayer";
11
12
  NodeType["Shader"] = "skShader";
12
13
  NodeType["ImageShader"] = "skImageShader";
13
14
  NodeType["ColorShader"] = "skColorShader";
@@ -1 +1 @@
1
- {"version":3,"names":["NodeType","DeclarationType"],"sources":["NodeType.ts"],"sourcesContent":["export const enum NodeType {\n // Shaders\n Shader = \"skShader\",\n ImageShader = \"skImageShader\",\n ColorShader = \"skColorShader\",\n Turbulence = \"skTurbulence\",\n FractalNoise = \"skFractalNoise\",\n LinearGradient = \"skLinearGradient\",\n RadialGradient = \"skRadialGradient\",\n SweepGradient = \"skSweepGradient\",\n TwoPointConicalGradient = \"skTwoPointConicalGradient\",\n\n // Mask Filters\n BlurMaskFilter = \"skBlurMaskFilter\",\n\n // Path Effects\n DiscretePathEffect = \"skDiscretePathEffect\",\n DashPathEffect = \"skDashPathEffect\",\n Path1DPathEffect = \"skPath1DPathEffect\",\n Path2DPathEffect = \"skPath2DPathEffect\",\n CornerPathEffect = \"skCornerPathEffect\",\n SumPathEffect = \"skSumPathEffect\",\n Line2DPathEffect = \"skLine2DPathEffect\",\n\n // Color Filters\n MatrixColorFilter = \"skMatrixColorFilter\",\n BlendColorFilter = \"skBlendColorFilter\",\n LinearToSRGBGammaColorFilter = \"skLinearToSRGBGammaColorFilter\",\n SRGBToLinearGammaColorFilter = \"skSRGBToLinearGammaColorFilter\",\n LumaColorFilter = \"skLumaColorFilter\",\n LerpColorFilter = \"skLerpColorFilter\",\n\n // Image Filters\n OffsetImageFilter = \"skOffsetImageFilter\",\n DisplacementMapImageFilter = \"skDisplacementMapImageFilter\",\n BlurImageFilter = \"skBlurImageFilter\",\n DropShadowImageFilter = \"skDropShadowImageFilter\",\n MorphologyImageFilter = \"skMorphologyImageFilter\",\n BlendImageFilter = \"skBlendImageFilter\",\n RuntimeShaderImageFilter = \"skRuntimeShaderImageFilter\",\n\n // Mixed\n Blend = \"skBlend\",\n BackdropFilter = \"skBackdropFilter\",\n Box = \"skBox\",\n BoxShadow = \"skBoxShadow\",\n\n // Drawings\n Group = \"skGroup\",\n Drawing = \"skDrawing\",\n Paint = \"skPaint\",\n Circle = \"skCircle\",\n Fill = \"skFill\",\n Image = \"skImage\",\n Points = \"skPoints\",\n Path = \"skPath\",\n Rect = \"skRect\",\n RRect = \"skRRect\",\n Oval = \"skOval\",\n Line = \"skLine\",\n Patch = \"skPatch\",\n Vertices = \"skVertices\",\n DiffRect = \"skDiffRect\",\n Text = \"skText\",\n TextPath = \"skTextPath\",\n TextBlob = \"skTextBlob\",\n Glyphs = \"skGlyphs\",\n Picture = \"skPicture\",\n ImageSVG = \"skImageSVG\",\n}\n\nexport const enum DeclarationType {\n Paint,\n Shader,\n ImageFilter,\n ColorFilter,\n PathEffect,\n MaskFilter,\n Unknown,\n}\n"],"mappings":";;;;;;IAAkBA,Q;;;WAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;GAAAA,Q,wBAAAA,Q;;IAuEAC,e;;;WAAAA,e;EAAAA,e,CAAAA,e;EAAAA,e,CAAAA,e;EAAAA,e,CAAAA,e;EAAAA,e,CAAAA,e;EAAAA,e,CAAAA,e;EAAAA,e,CAAAA,e;EAAAA,e,CAAAA,e;GAAAA,e,+BAAAA,e"}
1
+ {"version":3,"names":["NodeType","DeclarationType"],"sources":["NodeType.ts"],"sourcesContent":["export const enum NodeType {\n // Shaders\n Layer = \"skLayer\",\n Shader = \"skShader\",\n ImageShader = \"skImageShader\",\n ColorShader = \"skColorShader\",\n Turbulence = \"skTurbulence\",\n FractalNoise = \"skFractalNoise\",\n LinearGradient = \"skLinearGradient\",\n RadialGradient = \"skRadialGradient\",\n SweepGradient = \"skSweepGradient\",\n TwoPointConicalGradient = \"skTwoPointConicalGradient\",\n\n // Mask Filters\n BlurMaskFilter = \"skBlurMaskFilter\",\n\n // Path Effects\n DiscretePathEffect = \"skDiscretePathEffect\",\n DashPathEffect = \"skDashPathEffect\",\n Path1DPathEffect = \"skPath1DPathEffect\",\n Path2DPathEffect = \"skPath2DPathEffect\",\n CornerPathEffect = \"skCornerPathEffect\",\n SumPathEffect = \"skSumPathEffect\",\n Line2DPathEffect = \"skLine2DPathEffect\",\n\n // Color Filters\n MatrixColorFilter = \"skMatrixColorFilter\",\n BlendColorFilter = \"skBlendColorFilter\",\n LinearToSRGBGammaColorFilter = \"skLinearToSRGBGammaColorFilter\",\n SRGBToLinearGammaColorFilter = \"skSRGBToLinearGammaColorFilter\",\n LumaColorFilter = \"skLumaColorFilter\",\n LerpColorFilter = \"skLerpColorFilter\",\n\n // Image Filters\n OffsetImageFilter = \"skOffsetImageFilter\",\n DisplacementMapImageFilter = \"skDisplacementMapImageFilter\",\n BlurImageFilter = \"skBlurImageFilter\",\n DropShadowImageFilter = \"skDropShadowImageFilter\",\n MorphologyImageFilter = \"skMorphologyImageFilter\",\n BlendImageFilter = \"skBlendImageFilter\",\n RuntimeShaderImageFilter = \"skRuntimeShaderImageFilter\",\n\n // Mixed\n Blend = \"skBlend\",\n BackdropFilter = \"skBackdropFilter\",\n Box = \"skBox\",\n BoxShadow = \"skBoxShadow\",\n\n // Drawings\n Group = \"skGroup\",\n Drawing = \"skDrawing\",\n Paint = \"skPaint\",\n Circle = \"skCircle\",\n Fill = \"skFill\",\n Image = \"skImage\",\n Points = \"skPoints\",\n Path = \"skPath\",\n Rect = \"skRect\",\n RRect = \"skRRect\",\n Oval = \"skOval\",\n Line = \"skLine\",\n Patch = \"skPatch\",\n Vertices = \"skVertices\",\n DiffRect = \"skDiffRect\",\n Text = \"skText\",\n TextPath = \"skTextPath\",\n TextBlob = \"skTextBlob\",\n Glyphs = \"skGlyphs\",\n Picture = \"skPicture\",\n ImageSVG = \"skImageSVG\",\n}\n\nexport const enum DeclarationType {\n Paint,\n Shader,\n ImageFilter,\n ColorFilter,\n PathEffect,\n MaskFilter,\n Unknown,\n}\n"],"mappings":";;;;;;IAAkBA,Q;;;WAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;GAAAA,Q,wBAAAA,Q;;IAwEAC,e;;;WAAAA,e;EAAAA,e,CAAAA,e;EAAAA,e,CAAAA,e;EAAAA,e,CAAAA,e;EAAAA,e,CAAAA,e;EAAAA,e,CAAAA,e;EAAAA,e,CAAAA,e;EAAAA,e,CAAAA,e;GAAAA,e,+BAAAA,e"}
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["SkDOM.ts"],"sourcesContent":["import type {\n SkImageFilter,\n SkMaskFilter,\n SkShader,\n SkColorFilter,\n SkPathEffect,\n SkPaint,\n} from \"../../skia/types\";\n\nimport type { ChildrenProps, GroupProps, PaintProps } from \"./Common\";\nimport type {\n BlendImageFilterProps,\n BlurImageFilterProps,\n DropShadowImageFilterProps,\n OffsetImageFilterProps,\n RuntimeShaderImageFilterProps,\n DisplacementMapImageFilterProps,\n MorphologyImageFilterProps,\n BlendProps,\n} from \"./ImageFilters\";\nimport type { DeclarationNode, RenderNode } from \"./Node\";\nimport type {\n BlendColorFilterProps,\n MatrixColorFilterProps,\n LerpColorFilterProps,\n} from \"./ColorFilters\";\nimport type {\n ImageProps,\n CircleProps,\n PathProps,\n CustomDrawingNodeProps,\n LineProps,\n OvalProps,\n PatchProps,\n PointsProps,\n RectProps,\n RoundedRectProps,\n VerticesProps,\n TextProps,\n DiffRectProps,\n TextPathProps,\n TextBlobProps,\n GlyphsProps,\n PictureProps,\n ImageSVGProps,\n DrawingNodeProps,\n BoxProps,\n BoxShadowProps,\n} from \"./Drawings\";\nimport type { BlurMaskFilterProps } from \"./MaskFilters\";\nimport type {\n FractalNoiseProps,\n SweepGradientProps,\n ImageShaderProps,\n LinearGradientProps,\n ShaderProps,\n TurbulenceProps,\n TwoPointConicalGradientProps,\n RadialGradientProps,\n ColorProps,\n} from \"./Shaders\";\nimport type {\n CornerPathEffectProps,\n DashPathEffectProps,\n DiscretePathEffectProps,\n Line2DPathEffectProps,\n Path1DPathEffectProps,\n Path2DPathEffectProps,\n} from \"./PathEffects\";\n\ntype ImageFilterNode<P> = DeclarationNode<P, SkImageFilter>;\n\ntype PathEffectNode<P> = DeclarationNode<P, SkPathEffect>;\ntype NullablePathEffectNode<P> = DeclarationNode<P, SkPathEffect, null>;\n\ntype DrawingNode<P extends GroupProps> = RenderNode<P>;\n\nexport interface SkDOM {\n Group(props?: GroupProps): RenderNode<GroupProps>;\n Paint(props: PaintProps): DeclarationNode<PaintProps, SkPaint>;\n\n // Drawings\n Fill(props?: DrawingNodeProps): DrawingNode<DrawingNodeProps>;\n Image(props: ImageProps): DrawingNode<ImageProps>;\n Circle(props: CircleProps): DrawingNode<CircleProps>;\n Path(props: PathProps): DrawingNode<PathProps>;\n CustomDrawing(\n props: CustomDrawingNodeProps\n ): DrawingNode<CustomDrawingNodeProps>;\n Line(props: LineProps): DrawingNode<LineProps>;\n Oval(props: OvalProps): DrawingNode<OvalProps>;\n Patch(props: PatchProps): DrawingNode<PatchProps>;\n Points(props: PointsProps): DrawingNode<PointsProps>;\n Rect(props: RectProps): DrawingNode<RectProps>;\n RRect(props: RoundedRectProps): DrawingNode<RoundedRectProps>;\n Vertices(props: VerticesProps): DrawingNode<VerticesProps>;\n Text(props: TextProps): DrawingNode<TextProps>;\n TextPath(props: TextPathProps): DrawingNode<TextPathProps>;\n TextBlob(props: TextBlobProps): DrawingNode<TextBlobProps>;\n Glyphs(props: GlyphsProps): DrawingNode<GlyphsProps>;\n DiffRect(props: DiffRectProps): DrawingNode<DiffRectProps>;\n Picture(props: PictureProps): DrawingNode<PictureProps>;\n ImageSVG(props: ImageSVGProps): DrawingNode<ImageSVGProps>;\n\n // BlurMaskFilters\n BlurMaskFilter(\n props: BlurMaskFilterProps\n ): DeclarationNode<BlurMaskFilterProps, SkMaskFilter>;\n\n // ImageFilters\n BlendImageFilter(\n props: BlendImageFilterProps\n ): ImageFilterNode<BlendImageFilterProps>;\n BlurImageFilter(\n props: BlurImageFilterProps\n ): ImageFilterNode<BlurImageFilterProps>;\n OffsetImageFilter(\n props: OffsetImageFilterProps\n ): ImageFilterNode<OffsetImageFilterProps>;\n DropShadowImageFilter(\n props: DropShadowImageFilterProps\n ): ImageFilterNode<DropShadowImageFilterProps>;\n MorphologyImageFilter(\n props: MorphologyImageFilterProps\n ): ImageFilterNode<MorphologyImageFilterProps>;\n DisplacementMapImageFilter(\n props: DisplacementMapImageFilterProps\n ): ImageFilterNode<DisplacementMapImageFilterProps>;\n RuntimeShaderImageFilter(\n props: RuntimeShaderImageFilterProps\n ): ImageFilterNode<RuntimeShaderImageFilterProps>;\n\n // ColorFilters\n MatrixColorFilter(\n props: MatrixColorFilterProps\n ): DeclarationNode<MatrixColorFilterProps, SkColorFilter>;\n BlendColorFilter(\n props: BlendColorFilterProps\n ): DeclarationNode<BlendColorFilterProps, SkColorFilter>;\n LumaColorFilter(): DeclarationNode<null, SkColorFilter>;\n LinearToSRGBGammaColorFilter(): DeclarationNode<null, SkColorFilter>;\n SRGBToLinearGammaColorFilter(): DeclarationNode<null, SkColorFilter>;\n LerpColorFilter(\n props: LerpColorFilterProps\n ): DeclarationNode<LerpColorFilterProps, SkColorFilter>;\n\n // Shaders\n Shader(props: ShaderProps): DeclarationNode<ShaderProps, SkShader>;\n ImageShader(\n props: ImageShaderProps\n ): DeclarationNode<ImageShaderProps, SkShader>;\n ColorShader(props: ColorProps): DeclarationNode<ColorProps, SkShader>;\n Turbulence(\n props: TurbulenceProps\n ): DeclarationNode<TurbulenceProps, SkShader>;\n FractalNoise(\n props: FractalNoiseProps\n ): DeclarationNode<FractalNoiseProps, SkShader>;\n LinearGradient(\n props: LinearGradientProps\n ): DeclarationNode<LinearGradientProps, SkShader>;\n RadialGradient(\n props: RadialGradientProps\n ): DeclarationNode<RadialGradientProps, SkShader>;\n SweepGradient(\n props: SweepGradientProps\n ): DeclarationNode<SweepGradientProps, SkShader>;\n TwoPointConicalGradient(\n props: TwoPointConicalGradientProps\n ): DeclarationNode<TwoPointConicalGradientProps, SkShader>;\n\n // Path Effects\n CornerPathEffect(\n props: CornerPathEffectProps\n ): NullablePathEffectNode<CornerPathEffectProps>;\n DiscretePathEffect(\n props: DiscretePathEffectProps\n ): PathEffectNode<DiscretePathEffectProps>;\n DashPathEffect(\n props: DashPathEffectProps\n ): PathEffectNode<DashPathEffectProps>;\n Path1DPathEffect(\n props: Path1DPathEffectProps\n ): NullablePathEffectNode<Path1DPathEffectProps>;\n Path2DPathEffect(\n props: Path2DPathEffectProps\n ): NullablePathEffectNode<Path2DPathEffectProps>;\n SumPathEffect(): NullablePathEffectNode<null>;\n Line2DPathEffect(\n props: Line2DPathEffectProps\n ): NullablePathEffectNode<Line2DPathEffectProps>;\n\n // Mixed\n Blend(\n props: BlendProps\n ): DeclarationNode<BlendProps, SkShader | SkImageFilter>;\n BackdropFilter(props: ChildrenProps): RenderNode<ChildrenProps>;\n Box(props: BoxProps): RenderNode<BoxProps>;\n BoxShadow(\n props: BoxShadowProps\n ): DeclarationNode<BoxShadowProps, BoxShadowProps>;\n}\n"],"mappings":""}
1
+ {"version":3,"names":[],"sources":["SkDOM.ts"],"sourcesContent":["import type {\n SkImageFilter,\n SkMaskFilter,\n SkShader,\n SkColorFilter,\n SkPathEffect,\n SkPaint,\n} from \"../../skia/types\";\n\nimport type { ChildrenProps, GroupProps, PaintProps } from \"./Common\";\nimport type {\n BlendImageFilterProps,\n BlurImageFilterProps,\n DropShadowImageFilterProps,\n OffsetImageFilterProps,\n RuntimeShaderImageFilterProps,\n DisplacementMapImageFilterProps,\n MorphologyImageFilterProps,\n BlendProps,\n} from \"./ImageFilters\";\nimport type { DeclarationNode, RenderNode } from \"./Node\";\nimport type {\n BlendColorFilterProps,\n MatrixColorFilterProps,\n LerpColorFilterProps,\n} from \"./ColorFilters\";\nimport type {\n ImageProps,\n CircleProps,\n PathProps,\n CustomDrawingNodeProps,\n LineProps,\n OvalProps,\n PatchProps,\n PointsProps,\n RectProps,\n RoundedRectProps,\n VerticesProps,\n TextProps,\n DiffRectProps,\n TextPathProps,\n TextBlobProps,\n GlyphsProps,\n PictureProps,\n ImageSVGProps,\n DrawingNodeProps,\n BoxProps,\n BoxShadowProps,\n} from \"./Drawings\";\nimport type { BlurMaskFilterProps } from \"./MaskFilters\";\nimport type {\n FractalNoiseProps,\n SweepGradientProps,\n ImageShaderProps,\n LinearGradientProps,\n ShaderProps,\n TurbulenceProps,\n TwoPointConicalGradientProps,\n RadialGradientProps,\n ColorProps,\n} from \"./Shaders\";\nimport type {\n CornerPathEffectProps,\n DashPathEffectProps,\n DiscretePathEffectProps,\n Line2DPathEffectProps,\n Path1DPathEffectProps,\n Path2DPathEffectProps,\n} from \"./PathEffects\";\n\ntype ImageFilterNode<P> = DeclarationNode<P, SkImageFilter>;\n\ntype PathEffectNode<P> = DeclarationNode<P, SkPathEffect>;\ntype NullablePathEffectNode<P> = DeclarationNode<P, SkPathEffect, null>;\n\ntype DrawingNode<P extends GroupProps> = RenderNode<P>;\n\nexport interface SkDOM {\n Layer(props?: ChildrenProps): RenderNode<ChildrenProps>;\n Group(props?: GroupProps): RenderNode<GroupProps>;\n Paint(props: PaintProps): DeclarationNode<PaintProps, SkPaint>;\n\n // Drawings\n Fill(props?: DrawingNodeProps): DrawingNode<DrawingNodeProps>;\n Image(props: ImageProps): DrawingNode<ImageProps>;\n Circle(props: CircleProps): DrawingNode<CircleProps>;\n Path(props: PathProps): DrawingNode<PathProps>;\n CustomDrawing(\n props: CustomDrawingNodeProps\n ): DrawingNode<CustomDrawingNodeProps>;\n Line(props: LineProps): DrawingNode<LineProps>;\n Oval(props: OvalProps): DrawingNode<OvalProps>;\n Patch(props: PatchProps): DrawingNode<PatchProps>;\n Points(props: PointsProps): DrawingNode<PointsProps>;\n Rect(props: RectProps): DrawingNode<RectProps>;\n RRect(props: RoundedRectProps): DrawingNode<RoundedRectProps>;\n Vertices(props: VerticesProps): DrawingNode<VerticesProps>;\n Text(props: TextProps): DrawingNode<TextProps>;\n TextPath(props: TextPathProps): DrawingNode<TextPathProps>;\n TextBlob(props: TextBlobProps): DrawingNode<TextBlobProps>;\n Glyphs(props: GlyphsProps): DrawingNode<GlyphsProps>;\n DiffRect(props: DiffRectProps): DrawingNode<DiffRectProps>;\n Picture(props: PictureProps): DrawingNode<PictureProps>;\n ImageSVG(props: ImageSVGProps): DrawingNode<ImageSVGProps>;\n\n // BlurMaskFilters\n BlurMaskFilter(\n props: BlurMaskFilterProps\n ): DeclarationNode<BlurMaskFilterProps, SkMaskFilter>;\n\n // ImageFilters\n BlendImageFilter(\n props: BlendImageFilterProps\n ): ImageFilterNode<BlendImageFilterProps>;\n BlurImageFilter(\n props: BlurImageFilterProps\n ): ImageFilterNode<BlurImageFilterProps>;\n OffsetImageFilter(\n props: OffsetImageFilterProps\n ): ImageFilterNode<OffsetImageFilterProps>;\n DropShadowImageFilter(\n props: DropShadowImageFilterProps\n ): ImageFilterNode<DropShadowImageFilterProps>;\n MorphologyImageFilter(\n props: MorphologyImageFilterProps\n ): ImageFilterNode<MorphologyImageFilterProps>;\n DisplacementMapImageFilter(\n props: DisplacementMapImageFilterProps\n ): ImageFilterNode<DisplacementMapImageFilterProps>;\n RuntimeShaderImageFilter(\n props: RuntimeShaderImageFilterProps\n ): ImageFilterNode<RuntimeShaderImageFilterProps>;\n\n // ColorFilters\n MatrixColorFilter(\n props: MatrixColorFilterProps\n ): DeclarationNode<MatrixColorFilterProps, SkColorFilter>;\n BlendColorFilter(\n props: BlendColorFilterProps\n ): DeclarationNode<BlendColorFilterProps, SkColorFilter>;\n LumaColorFilter(): DeclarationNode<null, SkColorFilter>;\n LinearToSRGBGammaColorFilter(): DeclarationNode<null, SkColorFilter>;\n SRGBToLinearGammaColorFilter(): DeclarationNode<null, SkColorFilter>;\n LerpColorFilter(\n props: LerpColorFilterProps\n ): DeclarationNode<LerpColorFilterProps, SkColorFilter>;\n\n // Shaders\n Shader(props: ShaderProps): DeclarationNode<ShaderProps, SkShader>;\n ImageShader(\n props: ImageShaderProps\n ): DeclarationNode<ImageShaderProps, SkShader>;\n ColorShader(props: ColorProps): DeclarationNode<ColorProps, SkShader>;\n Turbulence(\n props: TurbulenceProps\n ): DeclarationNode<TurbulenceProps, SkShader>;\n FractalNoise(\n props: FractalNoiseProps\n ): DeclarationNode<FractalNoiseProps, SkShader>;\n LinearGradient(\n props: LinearGradientProps\n ): DeclarationNode<LinearGradientProps, SkShader>;\n RadialGradient(\n props: RadialGradientProps\n ): DeclarationNode<RadialGradientProps, SkShader>;\n SweepGradient(\n props: SweepGradientProps\n ): DeclarationNode<SweepGradientProps, SkShader>;\n TwoPointConicalGradient(\n props: TwoPointConicalGradientProps\n ): DeclarationNode<TwoPointConicalGradientProps, SkShader>;\n\n // Path Effects\n CornerPathEffect(\n props: CornerPathEffectProps\n ): NullablePathEffectNode<CornerPathEffectProps>;\n DiscretePathEffect(\n props: DiscretePathEffectProps\n ): PathEffectNode<DiscretePathEffectProps>;\n DashPathEffect(\n props: DashPathEffectProps\n ): PathEffectNode<DashPathEffectProps>;\n Path1DPathEffect(\n props: Path1DPathEffectProps\n ): NullablePathEffectNode<Path1DPathEffectProps>;\n Path2DPathEffect(\n props: Path2DPathEffectProps\n ): NullablePathEffectNode<Path2DPathEffectProps>;\n SumPathEffect(): NullablePathEffectNode<null>;\n Line2DPathEffect(\n props: Line2DPathEffectProps\n ): NullablePathEffectNode<Line2DPathEffectProps>;\n\n // Mixed\n Blend(\n props: BlendProps\n ): DeclarationNode<BlendProps, SkShader | SkImageFilter>;\n BackdropFilter(props: ChildrenProps): RenderNode<ChildrenProps>;\n Box(props: BoxProps): RenderNode<BoxProps>;\n BoxShadow(\n props: BoxShadowProps\n ): DeclarationNode<BoxShadowProps, BoxShadowProps>;\n}\n"],"mappings":""}
@@ -15,6 +15,9 @@ const createNode = (container, type, props) => {
15
15
  } = container;
16
16
 
17
17
  switch (type) {
18
+ case _types.NodeType.Layer:
19
+ return Sk.Layer(props);
20
+
18
21
  case _types.NodeType.Group:
19
22
  return Sk.Group(props);
20
23