@shopify/react-native-skia 0.1.230 → 0.1.232

Sign up to get free protection for your applications and to get access to all the features.
Files changed (142) hide show
  1. package/android/CMakeLists.txt +1 -0
  2. package/android/cpp/rnskia-android/SkiaOpenGLSurfaceFactory.cpp +2 -2
  3. package/cpp/api/JsiSkAnimatedImage.h +1 -1
  4. package/cpp/api/JsiSkDataFactory.h +6 -6
  5. package/cpp/api/JsiSkImage.h +4 -4
  6. package/cpp/api/JsiSkPath.h +1 -1
  7. package/cpp/api/JsiSkRRect.h +30 -3
  8. package/cpp/api/third_party/base64.cpp +153 -0
  9. package/cpp/api/third_party/base64.h +50 -0
  10. package/cpp/jsi/JsiPromises.h +1 -1
  11. package/cpp/rnskia/dom/props/FontProp.h +2 -4
  12. package/cpp/rnskia/dom/props/RRectProp.h +50 -0
  13. package/ios/RNSkia-iOS/SkiaMetalSurfaceFactory.mm +1 -1
  14. package/lib/commonjs/dom/nodes/JsiSkDOM.d.ts +2 -1
  15. package/lib/commonjs/dom/nodes/datatypes/Rect.d.ts +1 -1
  16. package/lib/commonjs/dom/nodes/drawings/RRectNode.d.ts +3 -3
  17. package/lib/commonjs/dom/nodes/drawings/RRectNode.js.map +1 -1
  18. package/lib/commonjs/dom/nodes/drawings/Text.js +1 -11
  19. package/lib/commonjs/dom/nodes/drawings/Text.js.map +1 -1
  20. package/lib/commonjs/dom/types/Common.d.ts +2 -2
  21. package/lib/commonjs/dom/types/Common.js.map +1 -1
  22. package/lib/commonjs/dom/types/Drawings.d.ts +1 -1
  23. package/lib/commonjs/dom/types/Drawings.js.map +1 -1
  24. package/lib/commonjs/headless/index.d.ts +3 -1
  25. package/lib/commonjs/headless/index.js +12 -6
  26. package/lib/commonjs/headless/index.js.map +1 -1
  27. package/lib/commonjs/skia/types/Canvas.d.ts +4 -4
  28. package/lib/commonjs/skia/types/Canvas.js.map +1 -1
  29. package/lib/commonjs/skia/types/Matrix4.d.ts +5 -0
  30. package/lib/commonjs/skia/types/Matrix4.js +8 -3
  31. package/lib/commonjs/skia/types/Matrix4.js.map +1 -1
  32. package/lib/commonjs/skia/types/Paragraph/Paragraph.d.ts +2 -2
  33. package/lib/commonjs/skia/types/Paragraph/Paragraph.js.map +1 -1
  34. package/lib/commonjs/skia/types/Paragraph/ParagraphStyle.d.ts +6 -6
  35. package/lib/commonjs/skia/types/Paragraph/ParagraphStyle.js +25 -25
  36. package/lib/commonjs/skia/types/Paragraph/ParagraphStyle.js.map +1 -1
  37. package/lib/commonjs/skia/types/Path/Path.d.ts +2 -2
  38. package/lib/commonjs/skia/types/Path/Path.js.map +1 -1
  39. package/lib/commonjs/skia/types/RRect.d.ts +9 -0
  40. package/lib/commonjs/skia/types/RRect.js.map +1 -1
  41. package/lib/commonjs/skia/web/JsiSkCanvas.d.ts +4 -4
  42. package/lib/commonjs/skia/web/JsiSkCanvas.js.map +1 -1
  43. package/lib/commonjs/skia/web/JsiSkParagraphStyle.js +1 -1
  44. package/lib/commonjs/skia/web/JsiSkParagraphStyle.js.map +1 -1
  45. package/lib/commonjs/skia/web/JsiSkPath.d.ts +2 -2
  46. package/lib/commonjs/skia/web/JsiSkPath.js.map +1 -1
  47. package/lib/commonjs/skia/web/JsiSkRRect.d.ts +2 -2
  48. package/lib/commonjs/skia/web/JsiSkRRect.js +4 -0
  49. package/lib/commonjs/skia/web/JsiSkRRect.js.map +1 -1
  50. package/lib/commonjs/web/LoadSkiaWeb.js +4 -1
  51. package/lib/commonjs/web/LoadSkiaWeb.js.map +1 -1
  52. package/lib/module/dom/nodes/JsiSkDOM.d.ts +2 -1
  53. package/lib/module/dom/nodes/datatypes/Rect.d.ts +1 -1
  54. package/lib/module/dom/nodes/drawings/RRectNode.d.ts +3 -3
  55. package/lib/module/dom/nodes/drawings/RRectNode.js.map +1 -1
  56. package/lib/module/dom/nodes/drawings/Text.js +1 -11
  57. package/lib/module/dom/nodes/drawings/Text.js.map +1 -1
  58. package/lib/module/dom/types/Common.d.ts +2 -2
  59. package/lib/module/dom/types/Common.js.map +1 -1
  60. package/lib/module/dom/types/Drawings.d.ts +1 -1
  61. package/lib/module/dom/types/Drawings.js.map +1 -1
  62. package/lib/module/headless/index.d.ts +3 -1
  63. package/lib/module/headless/index.js +5 -3
  64. package/lib/module/headless/index.js.map +1 -1
  65. package/lib/module/skia/types/Canvas.d.ts +4 -4
  66. package/lib/module/skia/types/Canvas.js.map +1 -1
  67. package/lib/module/skia/types/Matrix4.d.ts +5 -0
  68. package/lib/module/skia/types/Matrix4.js +6 -4
  69. package/lib/module/skia/types/Matrix4.js.map +1 -1
  70. package/lib/module/skia/types/Paragraph/Paragraph.d.ts +2 -2
  71. package/lib/module/skia/types/Paragraph/Paragraph.js.map +1 -1
  72. package/lib/module/skia/types/Paragraph/ParagraphStyle.d.ts +6 -6
  73. package/lib/module/skia/types/Paragraph/ParagraphStyle.js +21 -21
  74. package/lib/module/skia/types/Paragraph/ParagraphStyle.js.map +1 -1
  75. package/lib/module/skia/types/Path/Path.d.ts +2 -2
  76. package/lib/module/skia/types/Path/Path.js.map +1 -1
  77. package/lib/module/skia/types/RRect.d.ts +9 -0
  78. package/lib/module/skia/types/RRect.js.map +1 -1
  79. package/lib/module/skia/web/JsiSkCanvas.d.ts +4 -4
  80. package/lib/module/skia/web/JsiSkCanvas.js.map +1 -1
  81. package/lib/module/skia/web/JsiSkParagraphStyle.js +2 -2
  82. package/lib/module/skia/web/JsiSkParagraphStyle.js.map +1 -1
  83. package/lib/module/skia/web/JsiSkPath.d.ts +2 -2
  84. package/lib/module/skia/web/JsiSkPath.js.map +1 -1
  85. package/lib/module/skia/web/JsiSkRRect.d.ts +2 -2
  86. package/lib/module/skia/web/JsiSkRRect.js +4 -0
  87. package/lib/module/skia/web/JsiSkRRect.js.map +1 -1
  88. package/lib/module/web/LoadSkiaWeb.js +5 -1
  89. package/lib/module/web/LoadSkiaWeb.js.map +1 -1
  90. package/lib/typescript/src/dom/nodes/JsiSkDOM.d.ts +2 -1
  91. package/lib/typescript/src/dom/nodes/datatypes/Rect.d.ts +1 -1
  92. package/lib/typescript/src/dom/nodes/drawings/RRectNode.d.ts +3 -3
  93. package/lib/typescript/src/dom/types/Common.d.ts +2 -2
  94. package/lib/typescript/src/dom/types/Drawings.d.ts +1 -1
  95. package/lib/typescript/src/headless/index.d.ts +3 -1
  96. package/lib/typescript/src/skia/types/Canvas.d.ts +4 -4
  97. package/lib/typescript/src/skia/types/Matrix4.d.ts +5 -0
  98. package/lib/typescript/src/skia/types/Paragraph/Paragraph.d.ts +2 -2
  99. package/lib/typescript/src/skia/types/Paragraph/ParagraphStyle.d.ts +6 -6
  100. package/lib/typescript/src/skia/types/Path/Path.d.ts +2 -2
  101. package/lib/typescript/src/skia/types/RRect.d.ts +9 -0
  102. package/lib/typescript/src/skia/web/JsiSkCanvas.d.ts +4 -4
  103. package/lib/typescript/src/skia/web/JsiSkPath.d.ts +2 -2
  104. package/lib/typescript/src/skia/web/JsiSkRRect.d.ts +2 -2
  105. package/libs/android/arm64-v8a/libskia.a +0 -0
  106. package/libs/android/armeabi-v7a/libskia.a +0 -0
  107. package/libs/android/x86/libskia.a +0 -0
  108. package/libs/android/x86_64/libskia.a +0 -0
  109. package/libs/ios/libskia.xcframework/ios-arm64_arm64e/libskia.a +0 -0
  110. package/libs/ios/libskia.xcframework/ios-arm64_arm64e_x86_64-simulator/libskia.a +0 -0
  111. package/libs/ios/libskottie.xcframework/Info.plist +5 -5
  112. package/libs/ios/libskottie.xcframework/ios-arm64_arm64e/libskottie.a +0 -0
  113. package/libs/ios/libskottie.xcframework/ios-arm64_arm64e_x86_64-simulator/libskottie.a +0 -0
  114. package/libs/ios/libskparagraph.xcframework/ios-arm64_arm64e/libskparagraph.a +0 -0
  115. package/libs/ios/libskparagraph.xcframework/ios-arm64_arm64e_x86_64-simulator/libskparagraph.a +0 -0
  116. package/libs/ios/libsksg.xcframework/ios-arm64_arm64e/libsksg.a +0 -0
  117. package/libs/ios/libsksg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsksg.a +0 -0
  118. package/libs/ios/libskshaper.xcframework/Info.plist +5 -5
  119. package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e/libskshaper.a +0 -0
  120. package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e_x86_64-simulator/libskshaper.a +0 -0
  121. package/libs/ios/libskunicode.xcframework/ios-arm64_arm64e/libskunicode.a +0 -0
  122. package/libs/ios/libskunicode.xcframework/ios-arm64_arm64e_x86_64-simulator/libskunicode.a +0 -0
  123. package/libs/ios/libsvg.xcframework/Info.plist +5 -5
  124. package/libs/ios/libsvg.xcframework/ios-arm64_arm64e/libsvg.a +0 -0
  125. package/libs/ios/libsvg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsvg.a +0 -0
  126. package/package.json +1 -1
  127. package/src/dom/nodes/drawings/RRectNode.ts +2 -2
  128. package/src/dom/nodes/drawings/Text.ts +1 -14
  129. package/src/dom/types/Common.ts +2 -1
  130. package/src/dom/types/Drawings.ts +1 -1
  131. package/src/headless/index.ts +7 -3
  132. package/src/skia/types/Canvas.ts +4 -4
  133. package/src/skia/types/Matrix4.ts +8 -6
  134. package/src/skia/types/Paragraph/Paragraph.ts +2 -2
  135. package/src/skia/types/Paragraph/ParagraphStyle.ts +6 -6
  136. package/src/skia/types/Path/Path.ts +2 -2
  137. package/src/skia/types/RRect.ts +11 -0
  138. package/src/skia/web/JsiSkCanvas.ts +4 -4
  139. package/src/skia/web/JsiSkParagraphStyle.ts +2 -2
  140. package/src/skia/web/JsiSkPath.ts +2 -2
  141. package/src/skia/web/JsiSkRRect.ts +23 -2
  142. package/src/web/LoadSkiaWeb.tsx +4 -1
@@ -62,6 +62,7 @@ add_library(
62
62
  "${PROJECT_SOURCE_DIR}/../cpp/rnskia/dom/base/ConcatablePaint.cpp"
63
63
 
64
64
  "${PROJECT_SOURCE_DIR}/../cpp/api/third_party/CSSColorParser.cpp"
65
+ "${PROJECT_SOURCE_DIR}/../cpp/api/third_party/base64.cpp"
65
66
 
66
67
  )
67
68
 
@@ -31,8 +31,8 @@ sk_sp<SkSurface> SkiaOpenGLSurfaceFactory::makeOffscreenSurface(int width,
31
31
  // Create texture
32
32
  auto texture =
33
33
  ThreadContextHolder::ThreadSkiaOpenGLContext.directContext
34
- ->createBackendTexture(width, height, colorType, GrMipMapped::kNo,
35
- GrRenderable::kYes);
34
+ ->createBackendTexture(width, height, colorType,
35
+ skgpu::Mipmapped::kNo, GrRenderable::kYes);
36
36
 
37
37
  struct ReleaseContext {
38
38
  SkiaOpenGLContext *context;
@@ -5,12 +5,12 @@
5
5
  #include <utility>
6
6
 
7
7
  #include "JsiSkHostObjects.h"
8
+ #include "third_party/base64.h"
8
9
 
9
10
  #pragma clang diagnostic push
10
11
  #pragma clang diagnostic ignored "-Wdocumentation"
11
12
 
12
13
  #include "JsiSkImage.h"
13
- #include "SkBase64.h"
14
14
  #include "SkStream.h"
15
15
  #include "include/codec/SkEncodedImageFormat.h"
16
16
 
@@ -7,7 +7,7 @@
7
7
 
8
8
  #include "JsiPromises.h"
9
9
  #include "JsiSkData.h"
10
- #include "SkBase64.h"
10
+ #include "third_party/base64.h"
11
11
 
12
12
  namespace RNSkia {
13
13
 
@@ -67,17 +67,17 @@ public:
67
67
  // Calculate length
68
68
  size_t len;
69
69
  auto err =
70
- SkBase64::Decode(&base64.utf8(runtime).c_str()[0], size, nullptr, &len);
71
- if (err != SkBase64::Error::kNoError) {
70
+ Base64::Decode(&base64.utf8(runtime).c_str()[0], size, nullptr, &len);
71
+ if (err != Base64::Error::kNone) {
72
72
  throw jsi::JSError(runtime, "Error decoding base64 string");
73
73
  return jsi::Value::undefined();
74
74
  }
75
75
 
76
76
  // Create data object and decode
77
77
  auto data = SkData::MakeUninitialized(len);
78
- err = SkBase64::Decode(&base64.utf8(runtime).c_str()[0], size,
79
- data->writable_data(), &len);
80
- if (err != SkBase64::Error::kNoError) {
78
+ err = Base64::Decode(&base64.utf8(runtime).c_str()[0], size,
79
+ data->writable_data(), &len);
80
+ if (err != Base64::Error::kNone) {
81
81
  throw jsi::JSError(runtime, "Error decoding base64 string");
82
82
  return jsi::Value::undefined();
83
83
  }
@@ -8,13 +8,13 @@
8
8
  #include "JsiSkImageInfo.h"
9
9
  #include "JsiSkMatrix.h"
10
10
  #include "JsiSkShader.h"
11
+ #include "third_party/base64.h"
11
12
 
12
13
  #include "RNSkTypedArray.h"
13
14
 
14
15
  #pragma clang diagnostic push
15
16
  #pragma clang diagnostic ignored "-Wdocumentation"
16
17
 
17
- #include "SkBase64.h"
18
18
  #include "SkImage.h"
19
19
  #include "SkStream.h"
20
20
  #include "include/codec/SkEncodedImageFormat.h"
@@ -133,10 +133,10 @@ public:
133
133
  JSI_HOST_FUNCTION(encodeToBase64) {
134
134
  auto data = encodeImageData(arguments, count);
135
135
 
136
- auto len = SkBase64::Encode(data->bytes(), data->size(), nullptr);
136
+ auto len = Base64::Encode(data->bytes(), data->size(), nullptr);
137
137
  auto buffer = std::string(len, 0);
138
- SkBase64::Encode(data->bytes(), data->size(),
139
- reinterpret_cast<void *>(&buffer[0]));
138
+ Base64::Encode(data->bytes(), data->size(),
139
+ reinterpret_cast<void *>(&buffer[0]));
140
140
  return jsi::String::createFromAscii(runtime, buffer);
141
141
  }
142
142
 
@@ -494,7 +494,7 @@ public:
494
494
  JSI_HOST_FUNCTION(interpolate) {
495
495
  auto path2 = JsiSkPath::fromValue(runtime, arguments[0]);
496
496
  auto weight = arguments[1].asNumber();
497
- if (count > 2) {
497
+ if (count > 2 && !arguments[2].isUndefined()) {
498
498
  auto path3 = JsiSkPath::fromValue(runtime, arguments[2]);
499
499
  auto succeed = getObject()->interpolate(*path2, weight, path3.get());
500
500
  if (!succeed) {
@@ -2,6 +2,7 @@
2
2
 
3
3
  #include <memory>
4
4
  #include <utility>
5
+ #include <vector>
5
6
 
6
7
  #include <jsi/jsi.h>
7
8
 
@@ -61,9 +62,35 @@ public:
61
62
  } else {
62
63
  auto rect =
63
64
  JsiSkRect::fromValue(runtime, object.getProperty(runtime, "rect"));
64
- auto rx = object.getProperty(runtime, "rx").asNumber();
65
- auto ry = object.getProperty(runtime, "ry").asNumber();
66
- return std::make_shared<SkRRect>(SkRRect::MakeRectXY(*rect, rx, ry));
65
+ if (!object.getProperty(runtime, "rx").isUndefined()) {
66
+ auto rx = object.getProperty(runtime, "rx").asNumber();
67
+ auto ry = object.getProperty(runtime, "ry").asNumber();
68
+ return std::make_shared<SkRRect>(SkRRect::MakeRectXY(*rect, rx, ry));
69
+ } else if (object.getProperty(runtime, "topLeft").isObject() &&
70
+ object.getProperty(runtime, "topRight").isObject() &&
71
+ object.getProperty(runtime, "bottomRight").isObject() &&
72
+ object.getProperty(runtime, "bottomLeft").isObject()) {
73
+ std::vector<SkPoint> points;
74
+ std::shared_ptr<SkPoint> topLeft = JsiSkPoint::fromValue(
75
+ runtime, object.getProperty(runtime, "topLeft").asObject(runtime));
76
+ std::shared_ptr<SkPoint> topRight = JsiSkPoint::fromValue(
77
+ runtime, object.getProperty(runtime, "topRight").asObject(runtime));
78
+ std::shared_ptr<SkPoint> bottomRight = JsiSkPoint::fromValue(
79
+ runtime,
80
+ object.getProperty(runtime, "bottomRight").asObject(runtime));
81
+ std::shared_ptr<SkPoint> bottomLeft = JsiSkPoint::fromValue(
82
+ runtime,
83
+ object.getProperty(runtime, "bottomLeft").asObject(runtime));
84
+ points.push_back(*topLeft.get());
85
+ points.push_back(*topRight.get());
86
+ points.push_back(*bottomRight.get());
87
+ points.push_back(*bottomLeft.get());
88
+ auto rrect = SkRRect::MakeEmpty();
89
+ rrect.setRectRadii(*rect, points.data());
90
+ return std::make_shared<SkRRect>(rrect);
91
+ } else {
92
+ throw jsi::JSError(runtime, "Invalid RRect object");
93
+ }
67
94
  }
68
95
  }
69
96
 
@@ -0,0 +1,153 @@
1
+ /*
2
+ * Copyright 2006 The Android Open Source Project
3
+ *
4
+ * Use of this source code is governed by a BSD-style license that can be
5
+ * found in the LICENSE file.
6
+ */
7
+ #include "third_party/base64.h"
8
+
9
+ #include <cstdint>
10
+
11
+ #define DecodePad -2
12
+ #define EncodePad 64
13
+
14
+ static const char kDefaultEncode[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
15
+ "abcdefghijklmnopqrstuvwxyz"
16
+ "0123456789+/=";
17
+
18
+ static const signed char kDecodeData[] = {
19
+ 62, -1, -1, -1, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1,
20
+ -1, -1, DecodePad, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
21
+ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
22
+ -1, -1, -1, -1, -1, -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
23
+ 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51};
24
+
25
+ namespace RNSkia {
26
+
27
+ Base64::Error Base64::Decode(const void *srcv, size_t srcLength, void *dstv,
28
+ size_t *dstLength) {
29
+ const unsigned char *src = static_cast<const unsigned char *>(srcv);
30
+ unsigned char *dst = static_cast<unsigned char *>(dstv);
31
+
32
+ int i = 0;
33
+ bool padTwo = false;
34
+ bool padThree = false;
35
+ char unsigned const *const end = src + srcLength;
36
+ while (src < end) {
37
+ unsigned char bytes[4] = {0, 0, 0, 0};
38
+ int byte = 0;
39
+ do {
40
+ unsigned char srcByte = *src++;
41
+ if (srcByte == 0) {
42
+ *dstLength = i;
43
+ return Error::kNone;
44
+ }
45
+ if (srcByte <= ' ') {
46
+ continue; // treat as white space
47
+ }
48
+ if (srcByte < '+' || srcByte > 'z') {
49
+ return Error::kBadChar;
50
+ }
51
+ signed char decoded = kDecodeData[srcByte - '+'];
52
+ bytes[byte] = decoded;
53
+ if (decoded != DecodePad) {
54
+ if (decoded < 0) {
55
+ return Error::kBadChar;
56
+ }
57
+ byte++;
58
+ if (*src) {
59
+ continue;
60
+ }
61
+ if (byte == 0) {
62
+ *dstLength = i;
63
+ return Error::kNone;
64
+ }
65
+ if (byte == 4) {
66
+ break;
67
+ }
68
+ }
69
+ // As an optimization, if we find an equals sign
70
+ // we assume all future bytes to read are the
71
+ // appropriate number of padding equals signs.
72
+ if (byte < 2) {
73
+ return Error::kBadPadding;
74
+ }
75
+ padThree = true;
76
+ if (byte == 2) {
77
+ padTwo = true;
78
+ }
79
+ break;
80
+ } while (byte < 4);
81
+ int two = 0;
82
+ int three = 0;
83
+ if (dst) {
84
+ int one = (uint8_t)(bytes[0] << 2);
85
+ two = bytes[1];
86
+ one |= two >> 4;
87
+ two = (uint8_t)((two << 4) & 0xFF);
88
+ three = bytes[2];
89
+ two |= three >> 2;
90
+ three = (uint8_t)((three << 6) & 0xFF);
91
+ three |= bytes[3];
92
+ dst[i] = (unsigned char)one;
93
+ }
94
+ i++;
95
+ if (padTwo) {
96
+ break;
97
+ }
98
+ if (dst) {
99
+ dst[i] = (unsigned char)two;
100
+ }
101
+ i++;
102
+ if (padThree) {
103
+ break;
104
+ }
105
+ if (dst) {
106
+ dst[i] = (unsigned char)three;
107
+ }
108
+ i++;
109
+ }
110
+ *dstLength = i;
111
+ return Error::kNone;
112
+ }
113
+
114
+ size_t Base64::Encode(const void *srcv, size_t length, void *dstv) {
115
+ const unsigned char *src = static_cast<const unsigned char *>(srcv);
116
+ unsigned char *dst = static_cast<unsigned char *>(dstv);
117
+
118
+ const char *encode = kDefaultEncode;
119
+ if (dst) {
120
+ size_t remainder = length % 3;
121
+ char unsigned const *const end = &src[length - remainder];
122
+ while (src < end) {
123
+ unsigned a = *src++;
124
+ unsigned b = *src++;
125
+ unsigned c = *src++;
126
+ int d = c & 0x3F;
127
+ c = (c >> 6 | b << 2) & 0x3F;
128
+ b = (b >> 4 | a << 4) & 0x3F;
129
+ a = a >> 2;
130
+ *dst++ = encode[a];
131
+ *dst++ = encode[b];
132
+ *dst++ = encode[c];
133
+ *dst++ = encode[d];
134
+ }
135
+ if (remainder > 0) {
136
+ int k1 = 0;
137
+ int k2 = EncodePad;
138
+ int a = (uint8_t)*src++;
139
+ if (remainder == 2) {
140
+ int b = *src++;
141
+ k1 = b >> 4;
142
+ k2 = (b << 2) & 0x3F;
143
+ }
144
+ *dst++ = encode[a >> 2];
145
+ *dst++ = encode[(k1 | a << 4) & 0x3F];
146
+ *dst++ = encode[k2];
147
+ *dst++ = encode[EncodePad];
148
+ }
149
+ }
150
+ return (length + 2) / 3 * 4;
151
+ }
152
+
153
+ } // namespace RNSkia
@@ -0,0 +1,50 @@
1
+ /*
2
+ * Copyright 2006 The Android Open Source Project
3
+ *
4
+ * Use of this source code is governed by a BSD-style license that can be
5
+ * found in the LICENSE file.
6
+ */
7
+ #pragma once
8
+
9
+ #include <cstddef>
10
+
11
+ namespace RNSkia {
12
+
13
+ struct Base64 {
14
+ public:
15
+ enum class Error {
16
+ kNone,
17
+ kBadPadding,
18
+ kBadChar,
19
+ };
20
+
21
+ /**
22
+ Base64 encodes src into dst.
23
+
24
+ Normally this is called once with 'dst' nullptr to get the required size,
25
+ then again with an allocated 'dst' pointer to do the actual encoding.
26
+
27
+ @param dst nullptr or a pointer to a buffer large enough to receive the
28
+ result
29
+
30
+ @return the required length of dst for encoding.
31
+ */
32
+ static size_t Encode(const void *src, size_t length, void *dst);
33
+
34
+ /**
35
+ Base64 decodes src into dst.
36
+
37
+ Normally this is called once with 'dst' nullptr to get the required size,
38
+ then again with an allocated 'dst' pointer to do the actual encoding.
39
+
40
+ @param dst nullptr or a pointer to a buffer large enough to receive the
41
+ result
42
+
43
+ @param dstLength assigned the length dst is required to be. Must not be
44
+ nullptr.
45
+ */
46
+ [[nodiscard]] static Error Decode(const void *src, size_t srcLength,
47
+ void *dst, size_t *dstLength);
48
+ };
49
+
50
+ } // namespace RNSkia
@@ -6,7 +6,7 @@
6
6
 
7
7
  #include <jsi/jsi.h>
8
8
 
9
- #include "SkBase64.h"
9
+ #include "third_party/base64.h"
10
10
 
11
11
  namespace RNJsi {
12
12
  namespace jsi = facebook::jsi;
@@ -31,9 +31,7 @@ public:
31
31
  "Expected SkFont object or null/undefined for the Font property.");
32
32
  }
33
33
  } else {
34
- auto font = std::make_shared<SkFont>(SkFont());
35
- font->setSize(14);
36
- setDerivedValue(font);
34
+ setDerivedValue(nullptr);
37
35
  }
38
36
  }
39
37
 
@@ -41,4 +39,4 @@ private:
41
39
  NodeProp *_fontProp;
42
40
  };
43
41
 
44
- } // namespace RNSkia
42
+ } // namespace RNSkia
@@ -5,6 +5,7 @@
5
5
  #include "RectProp.h"
6
6
 
7
7
  #include <memory>
8
+ #include <vector>
8
9
 
9
10
  #pragma clang diagnostic push
10
11
  #pragma clang diagnostic ignored "-Wdocumentation"
@@ -19,6 +20,10 @@ namespace RNSkia {
19
20
  static PropId PropNameRx = JsiPropId::get("rx");
20
21
  static PropId PropNameRy = JsiPropId::get("ry");
21
22
  static PropId PropNameR = JsiPropId::get("r");
23
+ static PropId PropNameTopLeft = JsiPropId::get("topLeft");
24
+ static PropId PropNameTopRight = JsiPropId::get("topRight");
25
+ static PropId PropNameBottomRight = JsiPropId::get("bottomRight");
26
+ static PropId PropNameBottomLeft = JsiPropId::get("bottomLeft");
22
27
 
23
28
  /**
24
29
  Reads a rect from a given propety in the node. The name of the property is
@@ -64,6 +69,51 @@ public:
64
69
  width.getAsNumber(), height.getAsNumber()),
65
70
  rx.getAsNumber(), ry.getAsNumber()));
66
71
  }
72
+ } else if (value.hasValue(PropNameRect) &&
73
+ value.hasValue(PropNameTopLeft) &&
74
+ value.hasValue(PropNameTopRight) &&
75
+ value.hasValue(PropNameBottomRight) &&
76
+ value.hasValue(PropNameBottomLeft)) {
77
+ auto rect = value.getValue(PropNameRect);
78
+ if (rect.hasValue(PropNameX) && rect.hasValue(PropNameY) &&
79
+ rect.hasValue(PropNameWidth) && rect.hasValue(PropNameHeight)) {
80
+ auto x = rect.getValue(PropNameX);
81
+ auto y = rect.getValue(PropNameY);
82
+ auto width = rect.getValue(PropNameWidth);
83
+ auto height = rect.getValue(PropNameHeight);
84
+ std::vector<SkPoint> points;
85
+ points.reserve(4);
86
+ auto topLeft = value.getValue(PropNameTopLeft);
87
+ auto topLeftX = topLeft.getValue(PropNameX);
88
+ auto topLeftY = topLeft.getValue(PropNameY);
89
+ points.push_back(
90
+ SkPoint::Make(topLeftX.getAsNumber(), topLeftY.getAsNumber()));
91
+
92
+ auto topRight = value.getValue(PropNameTopRight);
93
+ auto topRightX = topRight.getValue(PropNameX);
94
+ auto topRightY = topRight.getValue(PropNameY);
95
+ points.push_back(SkPoint::Make(topRightX.getAsNumber(),
96
+ topRightY.getAsNumber()));
97
+
98
+ auto bottomRight = value.getValue(PropNameBottomRight);
99
+ auto bottomRightX = bottomRight.getValue(PropNameX);
100
+ auto bottomRightY = bottomRight.getValue(PropNameY);
101
+ points.push_back(SkPoint::Make(bottomRightX.getAsNumber(),
102
+ bottomRightY.getAsNumber()));
103
+
104
+ auto bottomLeft = value.getValue(PropNameBottomLeft);
105
+ auto bottomLeftX = bottomLeft.getValue(PropNameX);
106
+ auto bottomLeftY = bottomLeft.getValue(PropNameY);
107
+ points.push_back(SkPoint::Make(bottomLeftX.getAsNumber(),
108
+ bottomLeftY.getAsNumber()));
109
+
110
+ auto rrect = std::make_shared<SkRRect>(SkRRect::MakeEmpty());
111
+ rrect->setRectRadii(
112
+ SkRect::MakeXYWH(x.getAsNumber(), y.getAsNumber(),
113
+ width.getAsNumber(), height.getAsNumber()),
114
+ points.data());
115
+ return rrect;
116
+ }
67
117
  }
68
118
  }
69
119
  }
@@ -92,7 +92,7 @@ sk_sp<SkSurface> SkiaMetalSurfaceFactory::makeOffscreenSurface(int width,
92
92
  // Create a GrBackendTexture from the Metal texture
93
93
  GrMtlTextureInfo info;
94
94
  info.fTexture.retain((__bridge void *)ctx->texture);
95
- GrBackendTexture backendTexture(width, height, GrMipMapped::kNo, info);
95
+ GrBackendTexture backendTexture(width, height, skgpu::Mipmapped::kNo, info);
96
96
 
97
97
  // Create a SkSurface from the GrBackendTexture
98
98
  auto surface = SkSurfaces::WrapBackendTexture(
@@ -2,6 +2,7 @@ import type { PathProps, SkDOM, GroupProps, ImageProps, BlurImageFilterProps, Ma
2
2
  import type { BlendImageFilterProps, BlendProps, DisplacementMapImageFilterProps, DropShadowImageFilterProps, MorphologyImageFilterProps, RuntimeShaderImageFilterProps } from "../types/ImageFilters";
3
3
  import type { CornerPathEffectProps, DashPathEffectProps, DiscretePathEffectProps, Line2DPathEffectProps, Path1DPathEffectProps, Path2DPathEffectProps } from "../types/PathEffects";
4
4
  import type { ParagraphProps } from "../types/Paragraph";
5
+ import { RRectNode } from "./drawings";
5
6
  import type { NodeContext } from "./Node";
6
7
  export declare class JsiSkDOM implements SkDOM {
7
8
  private ctx;
@@ -18,7 +19,7 @@ export declare class JsiSkDOM implements SkDOM {
18
19
  Patch(props: PatchProps): import("../types").RenderNode<PatchProps>;
19
20
  Points(props: PointsProps): import("../types").RenderNode<PointsProps>;
20
21
  Rect(props: RectProps): import("./DrawingNode").JsiDrawingNode<RectProps, import("../..").SkRect>;
21
- RRect(props: RoundedRectProps): import("./DrawingNode").JsiDrawingNode<RoundedRectProps, import("../..").SkRRect>;
22
+ RRect(props: RoundedRectProps): import("./DrawingNode").JsiDrawingNode<RoundedRectProps, import("../..").SkRRect> | RRectNode;
22
23
  Vertices(props: VerticesProps): import("../types").RenderNode<VerticesProps>;
23
24
  Text(props: TextProps): import("../types").RenderNode<TextProps>;
24
25
  TextPath(props: TextPathProps): import("../types").RenderNode<TextPathProps>;
@@ -2,4 +2,4 @@ import type { Skia, SkRect, Vector } from "../../../skia/types";
2
2
  import type { RectDef, RRectDef } from "../../types";
3
3
  export declare const isEdge: (pos: Vector, b: SkRect) => boolean;
4
4
  export declare const processRect: (Skia: Skia, def: RectDef) => SkRect;
5
- export declare const processRRect: (Skia: Skia, def: RRectDef) => import("../../../skia/types").SkRRect;
5
+ export declare const processRRect: (Skia: Skia, def: RRectDef) => import("../../../skia/types").InputRRect;
@@ -1,10 +1,10 @@
1
- import type { SkRRect } from "../../../skia/types";
1
+ import type { InputRRect, SkRRect } from "../../../skia/types";
2
2
  import type { DrawingContext, RoundedRectProps } from "../../types";
3
3
  import { JsiDrawingNode } from "../DrawingNode";
4
4
  import type { NodeContext } from "../Node";
5
- export declare class RRectNode extends JsiDrawingNode<RoundedRectProps, SkRRect> {
5
+ export declare class RRectNode extends JsiDrawingNode<RoundedRectProps, InputRRect> {
6
6
  rect?: SkRRect;
7
7
  constructor(ctx: NodeContext, props: RoundedRectProps);
8
- protected deriveProps(): SkRRect;
8
+ protected deriveProps(): InputRRect;
9
9
  draw({ canvas, paint }: DrawingContext): void;
10
10
  }
@@ -1 +1 @@
1
- {"version":3,"names":["RRectNode","JsiDrawingNode","constructor","ctx","props","NodeType","RRect","deriveProps","processRRect","Skia","draw","canvas","paint","derived","undefined","Error","drawRRect"],"sources":["RRectNode.ts"],"sourcesContent":["import type { SkRRect } from \"../../../skia/types\";\nimport type { DrawingContext, RoundedRectProps } from \"../../types\";\nimport { NodeType } from \"../../types\";\nimport { processRRect } from \"../datatypes\";\nimport { JsiDrawingNode } from \"../DrawingNode\";\nimport type { NodeContext } from \"../Node\";\n\nexport class RRectNode extends JsiDrawingNode<RoundedRectProps, SkRRect> {\n rect?: SkRRect;\n\n constructor(ctx: NodeContext, props: RoundedRectProps) {\n super(ctx, NodeType.RRect, props);\n }\n\n protected deriveProps() {\n return processRRect(this.Skia, this.props);\n }\n\n draw({ canvas, paint }: DrawingContext) {\n if (this.derived === undefined) {\n throw new Error(\"RRectNode: rect is undefined\");\n }\n canvas.drawRRect(this.derived, paint);\n }\n}\n"],"mappings":";;;;;;;AAEA;;AACA;;AACA;;;;AAGO,MAAMA,SAAN,SAAwBC,2BAAxB,CAAkE;EAGvEC,WAAW,CAACC,GAAD,EAAmBC,KAAnB,EAA4C;IACrD,MAAMD,GAAN,EAAWE,eAAA,CAASC,KAApB,EAA2BF,KAA3B;;IADqD;EAEtD;;EAESG,WAAW,GAAG;IACtB,OAAO,IAAAC,uBAAA,EAAa,KAAKC,IAAlB,EAAwB,KAAKL,KAA7B,CAAP;EACD;;EAEDM,IAAI,OAAoC;IAAA,IAAnC;MAAEC,MAAF;MAAUC;IAAV,CAAmC;;IACtC,IAAI,KAAKC,OAAL,KAAiBC,SAArB,EAAgC;MAC9B,MAAM,IAAIC,KAAJ,CAAU,8BAAV,CAAN;IACD;;IACDJ,MAAM,CAACK,SAAP,CAAiB,KAAKH,OAAtB,EAA+BD,KAA/B;EACD;;AAhBsE"}
1
+ {"version":3,"names":["RRectNode","JsiDrawingNode","constructor","ctx","props","NodeType","RRect","deriveProps","processRRect","Skia","draw","canvas","paint","derived","undefined","Error","drawRRect"],"sources":["RRectNode.ts"],"sourcesContent":["import type { InputRRect, SkRRect } from \"../../../skia/types\";\nimport type { DrawingContext, RoundedRectProps } from \"../../types\";\nimport { NodeType } from \"../../types\";\nimport { processRRect } from \"../datatypes\";\nimport { JsiDrawingNode } from \"../DrawingNode\";\nimport type { NodeContext } from \"../Node\";\n\nexport class RRectNode extends JsiDrawingNode<RoundedRectProps, InputRRect> {\n rect?: SkRRect;\n\n constructor(ctx: NodeContext, props: RoundedRectProps) {\n super(ctx, NodeType.RRect, props);\n }\n\n protected deriveProps() {\n return processRRect(this.Skia, this.props);\n }\n\n draw({ canvas, paint }: DrawingContext) {\n if (this.derived === undefined) {\n throw new Error(\"RRectNode: rect is undefined\");\n }\n canvas.drawRRect(this.derived, paint);\n }\n}\n"],"mappings":";;;;;;;AAEA;;AACA;;AACA;;;;AAGO,MAAMA,SAAN,SAAwBC,2BAAxB,CAAqE;EAG1EC,WAAW,CAACC,GAAD,EAAmBC,KAAnB,EAA4C;IACrD,MAAMD,GAAN,EAAWE,eAAA,CAASC,KAApB,EAA2BF,KAA3B;;IADqD;EAEtD;;EAESG,WAAW,GAAG;IACtB,OAAO,IAAAC,uBAAA,EAAa,KAAKC,IAAlB,EAAwB,KAAKL,KAA7B,CAAP;EACD;;EAEDM,IAAI,OAAoC;IAAA,IAAnC;MAAEC,MAAF;MAAUC;IAAV,CAAmC;;IACtC,IAAI,KAAKC,OAAL,KAAiBC,SAArB,EAAgC;MAC9B,MAAM,IAAIC,KAAJ,CAAU,8BAAV,CAAN;IACD;;IACDJ,MAAM,CAACK,SAAP,CAAiB,KAAKH,OAAtB,EAA+BD,KAA/B;EACD;;AAhByE"}
@@ -21,18 +21,8 @@ class TextNode extends _DrawingNode.JsiDrawingNode {
21
21
  font
22
22
  } = this.props;
23
23
 
24
- if (font === null) {
24
+ if (!font) {
25
25
  return null;
26
- } else if (font === undefined) {
27
- console.warn("<Text />: the font property is mandatory on React Native Web");
28
- return null; // return this.Skia.Font(
29
- // this.Skia.FontMgr.System().matchFamilyStyle("System", {
30
- // width: 5,
31
- // weight: 400,
32
- // slant: 0,
33
- // }),
34
- // 14
35
- // );
36
26
  }
37
27
 
38
28
  return font;
@@ -1 +1 @@
1
- {"version":3,"names":["TextNode","JsiDrawingNode","constructor","ctx","props","NodeType","Text","deriveProps","font","undefined","console","warn","draw","canvas","paint","text","x","y","derived","Error","drawText","TextPathNode","TextPath","path","processPath","Skia","initialOffset","ids","getGlyphIDs","widths","getGlyphWidths","rsx","meas","ContourMeasureIter","cont","next","dist","i","length","width","substring","p","t","getPosTan","adjustedX","adjustedY","push","RSXform","TextBlob","MakeFromRSXform","drawTextBlob","TextBlobNode","blob","GlyphsNode","Glyphs","glyphs","reduce","acc","glyph","id","pos","positions","drawGlyphs"],"sources":["Text.ts"],"sourcesContent":["import type {\n SkRSXform,\n SkTextBlob,\n SkPoint,\n SkFont,\n} from \"../../../skia/types\";\nimport type {\n DrawingContext,\n TextBlobProps,\n TextPathProps,\n TextProps,\n} from \"../../types\";\nimport { NodeType } from \"../../types\";\nimport { processPath } from \"../datatypes\";\nimport type { GlyphsProps } from \"../../types/Drawings\";\nimport { JsiDrawingNode } from \"../DrawingNode\";\nimport type { NodeContext } from \"../Node\";\n\nexport class TextNode extends JsiDrawingNode<TextProps, SkFont | null> {\n constructor(ctx: NodeContext, props: TextProps) {\n super(ctx, NodeType.Text, props);\n }\n\n protected deriveProps() {\n const { font } = this.props;\n if (font === null) {\n return null;\n } else if (font === undefined) {\n console.warn(\n \"<Text />: the font property is mandatory on React Native Web\"\n );\n return null;\n // return this.Skia.Font(\n // this.Skia.FontMgr.System().matchFamilyStyle(\"System\", {\n // width: 5,\n // weight: 400,\n // slant: 0,\n // }),\n // 14\n // );\n }\n return font;\n }\n\n draw({ canvas, paint }: DrawingContext) {\n const { text, x, y } = this.props;\n const font = this.derived;\n if (font === undefined) {\n throw new Error(\"TextNode: font hasn't been derived\");\n }\n if (font != null) {\n canvas.drawText(text, x, y, paint, font);\n }\n }\n}\n\nexport class TextPathNode extends JsiDrawingNode<\n TextPathProps,\n SkTextBlob | null\n> {\n constructor(ctx: NodeContext, props: TextPathProps) {\n super(ctx, NodeType.TextPath, props);\n }\n\n deriveProps() {\n const path = processPath(this.Skia, this.props.path);\n const { font, initialOffset } = this.props;\n if (!font) {\n return null;\n }\n let { text } = this.props;\n const ids = font.getGlyphIDs(text);\n const widths = font.getGlyphWidths(ids);\n const rsx: SkRSXform[] = [];\n const meas = this.Skia.ContourMeasureIter(path, false, 1);\n let cont = meas.next();\n let dist = initialOffset;\n for (let i = 0; i < text.length && cont; i++) {\n const width = widths[i];\n dist += width / 2;\n if (dist > cont.length()) {\n // jump to next contour\n cont = meas.next();\n if (!cont) {\n // We have come to the end of the path - terminate the string\n // right here.\n text = text.substring(0, i);\n break;\n }\n dist = width / 2;\n }\n // Gives us the (x, y) coordinates as well as the cos/sin of the tangent\n // line at that position.\n const [p, t] = cont.getPosTan(dist);\n const adjustedX = p.x - (width / 2) * t.x;\n const adjustedY = p.y - (width / 2) * t.y;\n rsx.push(this.Skia.RSXform(t.x, t.y, adjustedX, adjustedY));\n dist += width / 2;\n }\n return this.Skia.TextBlob.MakeFromRSXform(text, rsx, font);\n }\n\n draw({ canvas, paint }: DrawingContext) {\n if (!this.derived) {\n throw new Error(\"TextPathNode: blob is null\");\n }\n canvas.drawTextBlob(this.derived, 0, 0, paint);\n }\n}\n\nexport class TextBlobNode extends JsiDrawingNode<TextBlobProps, null> {\n constructor(ctx: NodeContext, props: TextBlobProps) {\n super(ctx, NodeType.TextBlob, props);\n }\n\n protected deriveProps() {\n return null;\n }\n\n draw({ canvas, paint }: DrawingContext) {\n const { blob, x, y } = this.props;\n canvas.drawTextBlob(blob, x, y, paint);\n }\n}\n\ninterface ProcessedGlyphs {\n glyphs: number[];\n positions: SkPoint[];\n}\n\nexport class GlyphsNode extends JsiDrawingNode<GlyphsProps, ProcessedGlyphs> {\n constructor(ctx: NodeContext, props: GlyphsProps) {\n super(ctx, NodeType.Glyphs, props);\n }\n\n deriveProps() {\n return this.props.glyphs.reduce<ProcessedGlyphs>(\n (acc, glyph) => {\n const { id, pos } = glyph;\n acc.glyphs.push(id);\n acc.positions.push(pos);\n return acc;\n },\n { glyphs: [], positions: [] }\n );\n }\n\n draw({ canvas, paint }: DrawingContext) {\n if (!this.derived) {\n throw new Error(\"GlyphsNode: processedGlyphs is null\");\n }\n const { glyphs, positions } = this.derived;\n const { x, y, font } = this.props;\n if (font) {\n canvas.drawGlyphs(glyphs, positions, x, y, font, paint);\n }\n }\n}\n"],"mappings":";;;;;;;AAYA;;AACA;;AAEA;;AAGO,MAAMA,QAAN,SAAuBC,2BAAvB,CAAgE;EACrEC,WAAW,CAACC,GAAD,EAAmBC,KAAnB,EAAqC;IAC9C,MAAMD,GAAN,EAAWE,eAAA,CAASC,IAApB,EAA0BF,KAA1B;EACD;;EAESG,WAAW,GAAG;IACtB,MAAM;MAAEC;IAAF,IAAW,KAAKJ,KAAtB;;IACA,IAAII,IAAI,KAAK,IAAb,EAAmB;MACjB,OAAO,IAAP;IACD,CAFD,MAEO,IAAIA,IAAI,KAAKC,SAAb,EAAwB;MAC7BC,OAAO,CAACC,IAAR,CACE,8DADF;MAGA,OAAO,IAAP,CAJ6B,CAK7B;MACA;MACA;MACA;MACA;MACA;MACA;MACA;IACD;;IACD,OAAOH,IAAP;EACD;;EAEDI,IAAI,OAAoC;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,MAAM,IAAIC,KAAJ,CAAU,qCAAV,CAAN;IACD;;IACD,MAAM;MAAEoC,MAAF;MAAUM;IAAV,IAAwB,KAAK3C,OAAnC;IACA,MAAM;MAAEF,CAAF;MAAKC,CAAL;MAAQT;IAAR,IAAiB,KAAKJ,KAA5B;;IACA,IAAII,IAAJ,EAAU;MACRK,MAAM,CAACiD,UAAP,CAAkBP,MAAlB,EAA0BM,SAA1B,EAAqC7C,CAArC,EAAwCC,CAAxC,EAA2CT,IAA3C,EAAiDM,KAAjD;IACD;EACF;;AA1B0E"}
1
+ {"version":3,"names":["TextNode","JsiDrawingNode","constructor","ctx","props","NodeType","Text","deriveProps","font","draw","canvas","paint","text","x","y","derived","undefined","Error","drawText","TextPathNode","TextPath","path","processPath","Skia","initialOffset","ids","getGlyphIDs","widths","getGlyphWidths","rsx","meas","ContourMeasureIter","cont","next","dist","i","length","width","substring","p","t","getPosTan","adjustedX","adjustedY","push","RSXform","TextBlob","MakeFromRSXform","drawTextBlob","TextBlobNode","blob","GlyphsNode","Glyphs","glyphs","reduce","acc","glyph","id","pos","positions","drawGlyphs"],"sources":["Text.ts"],"sourcesContent":["import type {\n SkRSXform,\n SkTextBlob,\n SkPoint,\n SkFont,\n} from \"../../../skia/types\";\nimport type {\n DrawingContext,\n TextBlobProps,\n TextPathProps,\n TextProps,\n} from \"../../types\";\nimport { NodeType } from \"../../types\";\nimport { processPath } from \"../datatypes\";\nimport type { GlyphsProps } from \"../../types/Drawings\";\nimport { JsiDrawingNode } from \"../DrawingNode\";\nimport type { NodeContext } from \"../Node\";\n\nexport class TextNode extends JsiDrawingNode<TextProps, SkFont | null> {\n constructor(ctx: NodeContext, props: TextProps) {\n super(ctx, NodeType.Text, props);\n }\n\n protected deriveProps() {\n const { font } = this.props;\n if (!font) {\n return null;\n }\n return font;\n }\n\n draw({ canvas, paint }: DrawingContext) {\n const { text, x, y } = this.props;\n const font = this.derived;\n if (font === undefined) {\n throw new Error(\"TextNode: font hasn't been derived\");\n }\n if (font != null) {\n canvas.drawText(text, x, y, paint, font);\n }\n }\n}\n\nexport class TextPathNode extends JsiDrawingNode<\n TextPathProps,\n SkTextBlob | null\n> {\n constructor(ctx: NodeContext, props: TextPathProps) {\n super(ctx, NodeType.TextPath, props);\n }\n\n deriveProps() {\n const path = processPath(this.Skia, this.props.path);\n const { font, initialOffset } = this.props;\n if (!font) {\n return null;\n }\n let { text } = this.props;\n const ids = font.getGlyphIDs(text);\n const widths = font.getGlyphWidths(ids);\n const rsx: SkRSXform[] = [];\n const meas = this.Skia.ContourMeasureIter(path, false, 1);\n let cont = meas.next();\n let dist = initialOffset;\n for (let i = 0; i < text.length && cont; i++) {\n const width = widths[i];\n dist += width / 2;\n if (dist > cont.length()) {\n // jump to next contour\n cont = meas.next();\n if (!cont) {\n // We have come to the end of the path - terminate the string\n // right here.\n text = text.substring(0, i);\n break;\n }\n dist = width / 2;\n }\n // Gives us the (x, y) coordinates as well as the cos/sin of the tangent\n // line at that position.\n const [p, t] = cont.getPosTan(dist);\n const adjustedX = p.x - (width / 2) * t.x;\n const adjustedY = p.y - (width / 2) * t.y;\n rsx.push(this.Skia.RSXform(t.x, t.y, adjustedX, adjustedY));\n dist += width / 2;\n }\n return this.Skia.TextBlob.MakeFromRSXform(text, rsx, font);\n }\n\n draw({ canvas, paint }: DrawingContext) {\n if (!this.derived) {\n throw new Error(\"TextPathNode: blob is null\");\n }\n canvas.drawTextBlob(this.derived, 0, 0, paint);\n }\n}\n\nexport class TextBlobNode extends JsiDrawingNode<TextBlobProps, null> {\n constructor(ctx: NodeContext, props: TextBlobProps) {\n super(ctx, NodeType.TextBlob, props);\n }\n\n protected deriveProps() {\n return null;\n }\n\n draw({ canvas, paint }: DrawingContext) {\n const { blob, x, y } = this.props;\n canvas.drawTextBlob(blob, x, y, paint);\n }\n}\n\ninterface ProcessedGlyphs {\n glyphs: number[];\n positions: SkPoint[];\n}\n\nexport class GlyphsNode extends JsiDrawingNode<GlyphsProps, ProcessedGlyphs> {\n constructor(ctx: NodeContext, props: GlyphsProps) {\n super(ctx, NodeType.Glyphs, props);\n }\n\n deriveProps() {\n return this.props.glyphs.reduce<ProcessedGlyphs>(\n (acc, glyph) => {\n const { id, pos } = glyph;\n acc.glyphs.push(id);\n acc.positions.push(pos);\n return acc;\n },\n { glyphs: [], positions: [] }\n );\n }\n\n draw({ canvas, paint }: DrawingContext) {\n if (!this.derived) {\n throw new Error(\"GlyphsNode: processedGlyphs is null\");\n }\n const { glyphs, positions } = this.derived;\n const { x, y, font } = this.props;\n if (font) {\n canvas.drawGlyphs(glyphs, positions, x, y, font, paint);\n }\n }\n}\n"],"mappings":";;;;;;;AAYA;;AACA;;AAEA;;AAGO,MAAMA,QAAN,SAAuBC,2BAAvB,CAAgE;EACrEC,WAAW,CAACC,GAAD,EAAmBC,KAAnB,EAAqC;IAC9C,MAAMD,GAAN,EAAWE,eAAA,CAASC,IAApB,EAA0BF,KAA1B;EACD;;EAESG,WAAW,GAAG;IACtB,MAAM;MAAEC;IAAF,IAAW,KAAKJ,KAAtB;;IACA,IAAI,CAACI,IAAL,EAAW;MACT,OAAO,IAAP;IACD;;IACD,OAAOA,IAAP;EACD;;EAEDC,IAAI,OAAoC;IAAA,IAAnC;MAAEC,MAAF;MAAUC;IAAV,CAAmC;IACtC,MAAM;MAAEC,IAAF;MAAQC,CAAR;MAAWC;IAAX,IAAiB,KAAKV,KAA5B;IACA,MAAMI,IAAI,GAAG,KAAKO,OAAlB;;IACA,IAAIP,IAAI,KAAKQ,SAAb,EAAwB;MACtB,MAAM,IAAIC,KAAJ,CAAU,oCAAV,CAAN;IACD;;IACD,IAAIT,IAAI,IAAI,IAAZ,EAAkB;MAChBE,MAAM,CAACQ,QAAP,CAAgBN,IAAhB,EAAsBC,CAAtB,EAAyBC,CAAzB,EAA4BH,KAA5B,EAAmCH,IAAnC;IACD;EACF;;AAtBoE;;;;AAyBhE,MAAMW,YAAN,SAA2BlB,2BAA3B,CAGL;EACAC,WAAW,CAACC,GAAD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AAM,CAACsC,YAAP,CAAoBE,IAApB,EAA0BrC,CAA1B,EAA6BC,CAA7B,EAAgCH,KAAhC;EACD;;AAZmE;;;;AAoB/D,MAAMwC,UAAN,SAAyBlD,2BAAzB,CAAsE;EAC3EC,WAAW,CAACC,GAAD,EAAmBC,KAAnB,EAAuC;IAChD,MAAMD,GAAN,EAAWE,eAAA,CAAS+C,MAApB,EAA4BhD,KAA5B;EACD;;EAEDG,WAAW,GAAG;IACZ,OAAO,KAAKH,KAAL,CAAWiD,MAAX,CAAkBC,MAAlB,CACL,CAACC,GAAD,EAAMC,KAAN,KAAgB;MACd,MAAM;QAAEC,EAAF;QAAMC;MAAN,IAAcF,KAApB;MACAD,GAAG,CAACF,MAAJ,CAAWT,IAAX,CAAgBa,EAAhB;MACAF,GAAG,CAACI,SAAJ,CAAcf,IAAd,CAAmBc,GAAnB;MACA,OAAOH,GAAP;IACD,CANI,EAOL;MAAEF,MAAM,EAAE,EAAV;MAAcM,SAAS,EAAE;IAAzB,CAPK,CAAP;EASD;;EAEDlD,IAAI,QAAoC;IAAA,IAAnC;MAAEC,MAAF;MAAUC;IAAV,CAAmC;;IACtC,IAAI,CAAC,KAAKI,OAAV,EAAmB;MACjB,MAAM,IAAIE,KAAJ,CAAU,qCAAV,CAAN;IACD;;IACD,MAAM;MAAEoC,MAAF;MAAUM;IAAV,IAAwB,KAAK5C,OAAnC;IACA,MAAM;MAAEF,CAAF;MAAKC,CAAL;MAAQN;IAAR,IAAiB,KAAKJ,KAA5B;;IACA,IAAII,IAAJ,EAAU;MACRE,MAAM,CAACkD,UAAP,CAAkBP,MAAlB,EAA0BM,SAA1B,EAAqC9C,CAArC,EAAwCC,CAAxC,EAA2CN,IAA3C,EAAiDG,KAAjD;IACD;EACF;;AA1B0E"}
@@ -1,5 +1,5 @@
1
1
  import type { ReactNode } from "react";
2
- import type { BlendMode, Color, InputMatrix, PaintStyle, SkPaint, SkPath, SkRect, SkRRect, StrokeCap, StrokeJoin, Transforms3d, Vector } from "../../skia/types";
2
+ import type { BlendMode, Color, InputMatrix, InputRRect, PaintStyle, SkPaint, SkPath, SkRect, SkRRect, StrokeCap, StrokeJoin, Transforms3d, Vector } from "../../skia/types";
3
3
  export type SkEnum<T> = Uncapitalize<keyof T extends string ? keyof T : never>;
4
4
  export type PathDef = string | SkPath;
5
5
  export type ClipDef = SkRRect | SkRect | PathDef;
@@ -21,7 +21,7 @@ export type RectDef = RectCtor | {
21
21
  rect: SkRect;
22
22
  };
23
23
  export type RRectDef = RRectCtor | {
24
- rect: SkRRect;
24
+ rect: InputRRect;
25
25
  };
26
26
  export interface PointCircleDef {
27
27
  c?: Vector;
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["Common.ts"],"sourcesContent":["import type { ReactNode } from \"react\";\n\nimport type {\n BlendMode,\n Color,\n InputMatrix,\n PaintStyle,\n SkPaint,\n SkPath,\n SkRect,\n SkRRect,\n StrokeCap,\n StrokeJoin,\n Transforms3d,\n Vector,\n} from \"../../skia/types\";\n\nexport type SkEnum<T> = Uncapitalize<keyof T extends string ? keyof T : never>;\n\nexport type PathDef = string | SkPath;\n\nexport type ClipDef = SkRRect | SkRect | PathDef;\n\nexport type Fit =\n | \"cover\"\n | \"contain\"\n | \"fill\"\n | \"fitHeight\"\n | \"fitWidth\"\n | \"none\"\n | \"scaleDown\";\n\nexport type Radius = number | Vector;\n\nexport interface ChildrenProps {\n children?: ReactNode | ReactNode[];\n}\n\nexport interface RectCtor {\n x?: number;\n y?: number;\n width: number;\n height: number;\n}\n\nexport interface RRectCtor extends RectCtor {\n r?: Radius;\n}\n\nexport type RectDef = RectCtor | { rect: SkRect };\nexport type RRectDef = RRectCtor | { rect: SkRRect };\n\nexport interface PointCircleDef {\n c?: Vector;\n r: number;\n}\n\nexport interface ScalarCircleDef {\n cx: number;\n cy: number;\n r: number;\n}\n\nexport type CircleDef = PointCircleDef | ScalarCircleDef;\n\nexport interface TransformProps {\n transform?: Transforms3d;\n origin?: Vector;\n matrix?: InputMatrix;\n}\n\nexport interface PaintProps extends ChildrenProps {\n color?: Color;\n strokeWidth?: number;\n blendMode?: SkEnum<typeof BlendMode>;\n style?: SkEnum<typeof PaintStyle>;\n strokeJoin?: SkEnum<typeof StrokeJoin>;\n strokeCap?: SkEnum<typeof StrokeCap>;\n strokeMiter?: number;\n opacity?: number;\n antiAlias?: boolean;\n dither?: boolean;\n}\n\nexport interface GroupProps extends PaintProps, TransformProps {\n clip?: ClipDef;\n invertClip?: boolean;\n layer?: SkPaint | boolean;\n}\n"],"mappings":""}
1
+ {"version":3,"names":[],"sources":["Common.ts"],"sourcesContent":["import type { ReactNode } from \"react\";\n\nimport type {\n BlendMode,\n Color,\n InputMatrix,\n InputRRect,\n PaintStyle,\n SkPaint,\n SkPath,\n SkRect,\n SkRRect,\n StrokeCap,\n StrokeJoin,\n Transforms3d,\n Vector,\n} from \"../../skia/types\";\n\nexport type SkEnum<T> = Uncapitalize<keyof T extends string ? keyof T : never>;\n\nexport type PathDef = string | SkPath;\n\nexport type ClipDef = SkRRect | SkRect | PathDef;\n\nexport type Fit =\n | \"cover\"\n | \"contain\"\n | \"fill\"\n | \"fitHeight\"\n | \"fitWidth\"\n | \"none\"\n | \"scaleDown\";\n\nexport type Radius = number | Vector;\n\nexport interface ChildrenProps {\n children?: ReactNode | ReactNode[];\n}\n\nexport interface RectCtor {\n x?: number;\n y?: number;\n width: number;\n height: number;\n}\n\nexport interface RRectCtor extends RectCtor {\n r?: Radius;\n}\n\nexport type RectDef = RectCtor | { rect: SkRect };\nexport type RRectDef = RRectCtor | { rect: InputRRect };\n\nexport interface PointCircleDef {\n c?: Vector;\n r: number;\n}\n\nexport interface ScalarCircleDef {\n cx: number;\n cy: number;\n r: number;\n}\n\nexport type CircleDef = PointCircleDef | ScalarCircleDef;\n\nexport interface TransformProps {\n transform?: Transforms3d;\n origin?: Vector;\n matrix?: InputMatrix;\n}\n\nexport interface PaintProps extends ChildrenProps {\n color?: Color;\n strokeWidth?: number;\n blendMode?: SkEnum<typeof BlendMode>;\n style?: SkEnum<typeof PaintStyle>;\n strokeJoin?: SkEnum<typeof StrokeJoin>;\n strokeCap?: SkEnum<typeof StrokeCap>;\n strokeMiter?: number;\n opacity?: number;\n antiAlias?: boolean;\n dither?: boolean;\n}\n\nexport interface GroupProps extends PaintProps, TransformProps {\n clip?: ClipDef;\n invertClip?: boolean;\n layer?: SkPaint | boolean;\n}\n"],"mappings":""}
@@ -66,7 +66,7 @@ export interface DiffRectProps extends DrawingNodeProps {
66
66
  outer: SkRRect;
67
67
  }
68
68
  export interface TextProps extends DrawingNodeProps {
69
- font?: SkFont | null;
69
+ font: SkFont | null;
70
70
  text: string;
71
71
  x: number;
72
72
  y: number;
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["Drawings.ts"],"sourcesContent":["import type {\n FillType,\n SkImage,\n StrokeOpts,\n Vector,\n Color,\n SkPoint,\n BlendMode,\n PointMode,\n VertexMode,\n SkFont,\n SkRRect,\n SkTextBlob,\n SkPicture,\n SkSVG,\n SkPaint,\n SkRect,\n} from \"../../skia/types\";\n\nimport type {\n CircleDef,\n Fit,\n GroupProps,\n PathDef,\n RectDef,\n RRectDef,\n SkEnum,\n} from \"./Common\";\n\nexport interface DrawingNodeProps extends GroupProps {\n paint?: SkPaint;\n}\n\nexport type ImageProps = DrawingNodeProps &\n RectDef & {\n fit?: Fit;\n image: SkImage | null;\n };\n\nexport type CircleProps = CircleDef & DrawingNodeProps;\n\nexport interface PathProps extends DrawingNodeProps {\n path: PathDef;\n start: number;\n end: number;\n stroke?: StrokeOpts;\n fillType?: SkEnum<typeof FillType>;\n}\n\nexport interface LineProps extends DrawingNodeProps {\n p1: Vector;\n p2: Vector;\n}\n\nexport type OvalProps = RectDef & DrawingNodeProps;\n\nexport type RectProps = RectDef & DrawingNodeProps;\n\nexport type RoundedRectProps = RRectDef & DrawingNodeProps;\n\nexport interface CubicBezierHandle {\n pos: Vector;\n c1: Vector;\n c2: Vector;\n}\n\nexport interface PatchProps extends DrawingNodeProps {\n colors?: Color[];\n patch: [\n CubicBezierHandle,\n CubicBezierHandle,\n CubicBezierHandle,\n CubicBezierHandle\n ];\n texture?: readonly [SkPoint, SkPoint, SkPoint, SkPoint];\n blendMode?: SkEnum<typeof BlendMode>;\n}\n\nexport interface VerticesProps extends DrawingNodeProps {\n colors?: string[];\n vertices: SkPoint[];\n textures?: SkPoint[];\n mode: SkEnum<typeof VertexMode>;\n blendMode?: SkEnum<typeof BlendMode>;\n indices?: number[];\n}\n\nexport interface ImageSVGProps extends DrawingNodeProps {\n svg: SkSVG | null;\n x?: number;\n y?: number;\n width?: number;\n height?: number;\n rect?: SkRect;\n}\n\nexport interface PictureProps extends DrawingNodeProps {\n picture: SkPicture;\n}\n\nexport interface PointsProps extends DrawingNodeProps {\n points: SkPoint[];\n mode: SkEnum<typeof PointMode>;\n}\n\nexport interface DiffRectProps extends DrawingNodeProps {\n inner: SkRRect;\n outer: SkRRect;\n}\n\nexport interface TextProps extends DrawingNodeProps {\n font?: SkFont | null;\n text: string;\n x: number;\n y: number;\n}\n\nexport interface TextPathProps extends DrawingNodeProps {\n font: SkFont | null;\n text: string;\n path: PathDef;\n initialOffset: number;\n}\n\nexport interface TextBlobProps extends DrawingNodeProps {\n blob: SkTextBlob;\n x: number;\n y: number;\n}\n\nexport interface Glyph {\n id: number;\n pos: SkPoint;\n}\n\nexport interface GlyphsProps extends DrawingNodeProps {\n font: SkFont | null;\n x: number;\n y: number;\n glyphs: Glyph[];\n}\n\nexport interface BoxProps extends DrawingNodeProps {\n box: SkRRect | SkRect;\n}\n\nexport interface BoxShadowProps {\n dx?: number;\n dy?: number;\n spread?: number;\n blur: number;\n color?: Color;\n inner?: boolean;\n}\n"],"mappings":""}
1
+ {"version":3,"names":[],"sources":["Drawings.ts"],"sourcesContent":["import type {\n FillType,\n SkImage,\n StrokeOpts,\n Vector,\n Color,\n SkPoint,\n BlendMode,\n PointMode,\n VertexMode,\n SkFont,\n SkRRect,\n SkTextBlob,\n SkPicture,\n SkSVG,\n SkPaint,\n SkRect,\n} from \"../../skia/types\";\n\nimport type {\n CircleDef,\n Fit,\n GroupProps,\n PathDef,\n RectDef,\n RRectDef,\n SkEnum,\n} from \"./Common\";\n\nexport interface DrawingNodeProps extends GroupProps {\n paint?: SkPaint;\n}\n\nexport type ImageProps = DrawingNodeProps &\n RectDef & {\n fit?: Fit;\n image: SkImage | null;\n };\n\nexport type CircleProps = CircleDef & DrawingNodeProps;\n\nexport interface PathProps extends DrawingNodeProps {\n path: PathDef;\n start: number;\n end: number;\n stroke?: StrokeOpts;\n fillType?: SkEnum<typeof FillType>;\n}\n\nexport interface LineProps extends DrawingNodeProps {\n p1: Vector;\n p2: Vector;\n}\n\nexport type OvalProps = RectDef & DrawingNodeProps;\n\nexport type RectProps = RectDef & DrawingNodeProps;\n\nexport type RoundedRectProps = RRectDef & DrawingNodeProps;\n\nexport interface CubicBezierHandle {\n pos: Vector;\n c1: Vector;\n c2: Vector;\n}\n\nexport interface PatchProps extends DrawingNodeProps {\n colors?: Color[];\n patch: [\n CubicBezierHandle,\n CubicBezierHandle,\n CubicBezierHandle,\n CubicBezierHandle\n ];\n texture?: readonly [SkPoint, SkPoint, SkPoint, SkPoint];\n blendMode?: SkEnum<typeof BlendMode>;\n}\n\nexport interface VerticesProps extends DrawingNodeProps {\n colors?: string[];\n vertices: SkPoint[];\n textures?: SkPoint[];\n mode: SkEnum<typeof VertexMode>;\n blendMode?: SkEnum<typeof BlendMode>;\n indices?: number[];\n}\n\nexport interface ImageSVGProps extends DrawingNodeProps {\n svg: SkSVG | null;\n x?: number;\n y?: number;\n width?: number;\n height?: number;\n rect?: SkRect;\n}\n\nexport interface PictureProps extends DrawingNodeProps {\n picture: SkPicture;\n}\n\nexport interface PointsProps extends DrawingNodeProps {\n points: SkPoint[];\n mode: SkEnum<typeof PointMode>;\n}\n\nexport interface DiffRectProps extends DrawingNodeProps {\n inner: SkRRect;\n outer: SkRRect;\n}\n\nexport interface TextProps extends DrawingNodeProps {\n font: SkFont | null;\n text: string;\n x: number;\n y: number;\n}\n\nexport interface TextPathProps extends DrawingNodeProps {\n font: SkFont | null;\n text: string;\n path: PathDef;\n initialOffset: number;\n}\n\nexport interface TextBlobProps extends DrawingNodeProps {\n blob: SkTextBlob;\n x: number;\n y: number;\n}\n\nexport interface Glyph {\n id: number;\n pos: SkPoint;\n}\n\nexport interface GlyphsProps extends DrawingNodeProps {\n font: SkFont | null;\n x: number;\n y: number;\n glyphs: Glyph[];\n}\n\nexport interface BoxProps extends DrawingNodeProps {\n box: SkRRect | SkRect;\n}\n\nexport interface BoxShadowProps {\n dx?: number;\n dy?: number;\n spread?: number;\n blur: number;\n color?: Color;\n inner?: boolean;\n}\n"],"mappings":""}