@shopify/react-native-skia 0.1.230 → 0.1.231
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.
- package/android/CMakeLists.txt +1 -0
- package/android/cpp/rnskia-android/SkiaOpenGLSurfaceFactory.cpp +2 -2
- package/cpp/api/JsiSkAnimatedImage.h +1 -1
- package/cpp/api/JsiSkDataFactory.h +6 -6
- package/cpp/api/JsiSkImage.h +4 -4
- package/cpp/api/JsiSkPath.h +1 -1
- package/cpp/api/JsiSkRRect.h +30 -3
- package/cpp/api/third_party/base64.cpp +153 -0
- package/cpp/api/third_party/base64.h +50 -0
- package/cpp/jsi/JsiPromises.h +1 -1
- package/cpp/rnskia/dom/props/FontProp.h +4 -1
- package/cpp/rnskia/dom/props/RRectProp.h +50 -0
- package/ios/RNSkia-iOS/SkiaMetalSurfaceFactory.mm +1 -1
- package/lib/commonjs/dom/nodes/JsiSkDOM.d.ts +2 -1
- package/lib/commonjs/dom/nodes/datatypes/Rect.d.ts +1 -1
- package/lib/commonjs/dom/nodes/drawings/RRectNode.d.ts +3 -3
- package/lib/commonjs/dom/nodes/drawings/RRectNode.js.map +1 -1
- package/lib/commonjs/dom/types/Common.d.ts +2 -2
- package/lib/commonjs/dom/types/Common.js.map +1 -1
- package/lib/commonjs/headless/index.d.ts +3 -1
- package/lib/commonjs/headless/index.js +12 -6
- package/lib/commonjs/headless/index.js.map +1 -1
- package/lib/commonjs/skia/types/Canvas.d.ts +4 -4
- package/lib/commonjs/skia/types/Canvas.js.map +1 -1
- package/lib/commonjs/skia/types/Path/Path.d.ts +2 -2
- package/lib/commonjs/skia/types/Path/Path.js.map +1 -1
- package/lib/commonjs/skia/types/RRect.d.ts +9 -0
- package/lib/commonjs/skia/types/RRect.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkCanvas.d.ts +4 -4
- package/lib/commonjs/skia/web/JsiSkCanvas.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPath.d.ts +2 -2
- package/lib/commonjs/skia/web/JsiSkPath.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkRRect.d.ts +2 -2
- package/lib/commonjs/skia/web/JsiSkRRect.js +4 -0
- package/lib/commonjs/skia/web/JsiSkRRect.js.map +1 -1
- package/lib/module/dom/nodes/JsiSkDOM.d.ts +2 -1
- package/lib/module/dom/nodes/datatypes/Rect.d.ts +1 -1
- package/lib/module/dom/nodes/drawings/RRectNode.d.ts +3 -3
- package/lib/module/dom/nodes/drawings/RRectNode.js.map +1 -1
- package/lib/module/dom/types/Common.d.ts +2 -2
- package/lib/module/dom/types/Common.js.map +1 -1
- package/lib/module/headless/index.d.ts +3 -1
- package/lib/module/headless/index.js +5 -3
- package/lib/module/headless/index.js.map +1 -1
- package/lib/module/skia/types/Canvas.d.ts +4 -4
- package/lib/module/skia/types/Canvas.js.map +1 -1
- package/lib/module/skia/types/Path/Path.d.ts +2 -2
- package/lib/module/skia/types/Path/Path.js.map +1 -1
- package/lib/module/skia/types/RRect.d.ts +9 -0
- package/lib/module/skia/types/RRect.js.map +1 -1
- package/lib/module/skia/web/JsiSkCanvas.d.ts +4 -4
- package/lib/module/skia/web/JsiSkCanvas.js.map +1 -1
- package/lib/module/skia/web/JsiSkPath.d.ts +2 -2
- package/lib/module/skia/web/JsiSkPath.js.map +1 -1
- package/lib/module/skia/web/JsiSkRRect.d.ts +2 -2
- package/lib/module/skia/web/JsiSkRRect.js +4 -0
- package/lib/module/skia/web/JsiSkRRect.js.map +1 -1
- package/lib/typescript/src/dom/nodes/JsiSkDOM.d.ts +2 -1
- package/lib/typescript/src/dom/nodes/datatypes/Rect.d.ts +1 -1
- package/lib/typescript/src/dom/nodes/drawings/RRectNode.d.ts +3 -3
- package/lib/typescript/src/dom/types/Common.d.ts +2 -2
- package/lib/typescript/src/headless/index.d.ts +3 -1
- package/lib/typescript/src/skia/types/Canvas.d.ts +4 -4
- package/lib/typescript/src/skia/types/Path/Path.d.ts +2 -2
- package/lib/typescript/src/skia/types/RRect.d.ts +9 -0
- package/lib/typescript/src/skia/web/JsiSkCanvas.d.ts +4 -4
- package/lib/typescript/src/skia/web/JsiSkPath.d.ts +2 -2
- package/lib/typescript/src/skia/web/JsiSkRRect.d.ts +2 -2
- package/libs/android/arm64-v8a/libskia.a +0 -0
- package/libs/android/armeabi-v7a/libskia.a +0 -0
- package/libs/android/x86/libskia.a +0 -0
- package/libs/android/x86_64/libskia.a +0 -0
- package/libs/ios/libskia.xcframework/ios-arm64_arm64e/libskia.a +0 -0
- package/libs/ios/libskia.xcframework/ios-arm64_arm64e_x86_64-simulator/libskia.a +0 -0
- package/libs/ios/libskottie.xcframework/Info.plist +5 -5
- package/libs/ios/libskottie.xcframework/ios-arm64_arm64e/libskottie.a +0 -0
- package/libs/ios/libskottie.xcframework/ios-arm64_arm64e_x86_64-simulator/libskottie.a +0 -0
- package/libs/ios/libskparagraph.xcframework/ios-arm64_arm64e/libskparagraph.a +0 -0
- package/libs/ios/libskparagraph.xcframework/ios-arm64_arm64e_x86_64-simulator/libskparagraph.a +0 -0
- package/libs/ios/libsksg.xcframework/ios-arm64_arm64e/libsksg.a +0 -0
- package/libs/ios/libsksg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsksg.a +0 -0
- package/libs/ios/libskshaper.xcframework/Info.plist +5 -5
- package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e/libskshaper.a +0 -0
- package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e_x86_64-simulator/libskshaper.a +0 -0
- package/libs/ios/libskunicode.xcframework/ios-arm64_arm64e/libskunicode.a +0 -0
- package/libs/ios/libskunicode.xcframework/ios-arm64_arm64e_x86_64-simulator/libskunicode.a +0 -0
- package/libs/ios/libsvg.xcframework/Info.plist +5 -5
- package/libs/ios/libsvg.xcframework/ios-arm64_arm64e/libsvg.a +0 -0
- package/libs/ios/libsvg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsvg.a +0 -0
- package/package.json +1 -1
- package/src/dom/nodes/drawings/RRectNode.ts +2 -2
- package/src/dom/types/Common.ts +2 -1
- package/src/headless/index.ts +7 -3
- package/src/skia/types/Canvas.ts +4 -4
- package/src/skia/types/Path/Path.ts +2 -2
- package/src/skia/types/RRect.ts +11 -0
- package/src/skia/web/JsiSkCanvas.ts +4 -4
- package/src/skia/web/JsiSkPath.ts +2 -2
- package/src/skia/web/JsiSkRRect.ts +23 -2
package/android/CMakeLists.txt
CHANGED
|
@@ -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,
|
|
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 "
|
|
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
|
-
|
|
71
|
-
if (err !=
|
|
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 =
|
|
79
|
-
|
|
80
|
-
if (err !=
|
|
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
|
}
|
package/cpp/api/JsiSkImage.h
CHANGED
|
@@ -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 =
|
|
136
|
+
auto len = Base64::Encode(data->bytes(), data->size(), nullptr);
|
|
137
137
|
auto buffer = std::string(len, 0);
|
|
138
|
-
|
|
139
|
-
|
|
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
|
|
package/cpp/api/JsiSkPath.h
CHANGED
|
@@ -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) {
|
package/cpp/api/JsiSkRRect.h
CHANGED
|
@@ -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
|
-
|
|
65
|
-
|
|
66
|
-
|
|
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
|
package/cpp/jsi/JsiPromises.h
CHANGED
|
@@ -31,7 +31,10 @@ public:
|
|
|
31
31
|
"Expected SkFont object or null/undefined for the Font property.");
|
|
32
32
|
}
|
|
33
33
|
} else {
|
|
34
|
-
auto
|
|
34
|
+
auto fm = SkFontMgr::RefDefault();
|
|
35
|
+
sk_sp<SkTypeface> typeface =
|
|
36
|
+
fm->legacyMakeTypeface(nullptr, SkFontStyle());
|
|
37
|
+
auto font = std::make_shared<SkFont>(SkFont(typeface));
|
|
35
38
|
font->setSize(14);
|
|
36
39
|
setDerivedValue(font);
|
|
37
40
|
}
|
|
@@ -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,
|
|
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").
|
|
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,
|
|
5
|
+
export declare class RRectNode extends JsiDrawingNode<RoundedRectProps, InputRRect> {
|
|
6
6
|
rect?: SkRRect;
|
|
7
7
|
constructor(ctx: NodeContext, props: RoundedRectProps);
|
|
8
|
-
protected deriveProps():
|
|
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,
|
|
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"}
|
|
@@ -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:
|
|
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:
|
|
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":""}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
|
+
import type { SkSurface } from "../skia";
|
|
2
3
|
export * from "../renderer/components";
|
|
3
|
-
export declare const
|
|
4
|
+
export declare const makeOffscreenSurface: (width: number, height: number) => any;
|
|
5
|
+
export declare const drawOffscreen: (surface: SkSurface, element: ReactNode) => import("../skia").SkImage;
|
|
@@ -4,9 +4,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
var _exportNames = {
|
|
7
|
-
|
|
7
|
+
makeOffscreenSurface: true,
|
|
8
|
+
drawOffscreen: true
|
|
8
9
|
};
|
|
9
|
-
exports.
|
|
10
|
+
exports.makeOffscreenSurface = exports.drawOffscreen = void 0;
|
|
10
11
|
|
|
11
12
|
var _web = require("../skia/web");
|
|
12
13
|
|
|
@@ -32,7 +33,7 @@ Object.keys(_components).forEach(function (key) {
|
|
|
32
33
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
33
34
|
let Skia;
|
|
34
35
|
|
|
35
|
-
const
|
|
36
|
+
const makeOffscreenSurface = (width, height) => {
|
|
36
37
|
if (!Skia) {
|
|
37
38
|
Skia = (0, _web.JsiSkApi)(CanvasKit);
|
|
38
39
|
}
|
|
@@ -43,15 +44,20 @@ const draw = (element, width, height) => {
|
|
|
43
44
|
throw new Error("Couldn't create surface!");
|
|
44
45
|
}
|
|
45
46
|
|
|
47
|
+
return surface;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
exports.makeOffscreenSurface = makeOffscreenSurface;
|
|
51
|
+
|
|
52
|
+
const drawOffscreen = (surface, element) => {
|
|
46
53
|
const root = new _Reconciler.SkiaRoot(Skia);
|
|
47
54
|
root.render(element);
|
|
48
55
|
const canvas = surface.getCanvas();
|
|
49
56
|
const ctx = new _types.JsiDrawingContext(Skia, canvas);
|
|
50
57
|
root.dom.render(ctx);
|
|
51
58
|
surface.flush();
|
|
52
|
-
|
|
53
|
-
return image;
|
|
59
|
+
return surface.makeImageSnapshot();
|
|
54
60
|
};
|
|
55
61
|
|
|
56
|
-
exports.
|
|
62
|
+
exports.drawOffscreen = drawOffscreen;
|
|
57
63
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Skia","
|
|
1
|
+
{"version":3,"names":["Skia","makeOffscreenSurface","width","height","JsiSkApi","CanvasKit","surface","Surface","MakeOffscreen","Error","drawOffscreen","element","root","SkiaRoot","render","canvas","getCanvas","ctx","JsiDrawingContext","dom","flush","makeImageSnapshot"],"sources":["index.ts"],"sourcesContent":["// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore\nimport CanvasKitInit from \"canvaskit-wasm/bin/full/canvaskit\";\nimport type { ReactNode } from \"react\";\n\nimport { JsiSkApi } from \"../skia/web\";\nimport { SkiaRoot } from \"../renderer/Reconciler\";\nimport { JsiDrawingContext } from \"../dom/types\";\nimport type { SkSurface } from \"../skia\";\n\nexport * from \"../renderer/components\";\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nlet Skia: any;\n\nexport const makeOffscreenSurface = (width: number, height: number) => {\n if (!Skia) {\n Skia = JsiSkApi(CanvasKit);\n }\n const surface = Skia.Surface.MakeOffscreen(width, height);\n if (surface === null) {\n throw new Error(\"Couldn't create surface!\");\n }\n return surface;\n};\n\nexport const drawOffscreen = (surface: SkSurface, element: ReactNode) => {\n const root = new SkiaRoot(Skia);\n root.render(element);\n const canvas = surface.getCanvas();\n const ctx = new JsiDrawingContext(Skia, canvas);\n root.dom.render(ctx);\n surface.flush();\n return surface.makeImageSnapshot();\n};\n"],"mappings":";;;;;;;;;;;AAKA;;AACA;;AACA;;AAGA;;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AAVA;AACA;AAWA;AACA,IAAIA,IAAJ;;AAEO,MAAMC,oBAAoB,GAAG,CAACC,KAAD,EAAgBC,MAAhB,KAAmC;EACrE,IAAI,CAACH,IAAL,EAAW;IACTA,IAAI,GAAG,IAAAI,aAAA,EAASC,SAAT,CAAP;EACD;;EACD,MAAMC,OAAO,GAAGN,IAAI,CAACO,OAAL,CAAaC,aAAb,CAA2BN,KAA3B,EAAkCC,MAAlC,CAAhB;;EACA,IAAIG,OAAO,KAAK,IAAhB,EAAsB;IACpB,MAAM,IAAIG,KAAJ,CAAU,0BAAV,CAAN;EACD;;EACD,OAAOH,OAAP;AACD,CATM;;;;AAWA,MAAMI,aAAa,GAAG,CAACJ,OAAD,EAAqBK,OAArB,KAA4C;EACvE,MAAMC,IAAI,GAAG,IAAIC,oBAAJ,CAAab,IAAb,CAAb;EACAY,IAAI,CAACE,MAAL,CAAYH,OAAZ;EACA,MAAMI,MAAM,GAAGT,OAAO,CAACU,SAAR,EAAf;EACA,MAAMC,GAAG,GAAG,IAAIC,wBAAJ,CAAsBlB,IAAtB,EAA4Be,MAA5B,CAAZ;EACAH,IAAI,CAACO,GAAL,CAASL,MAAT,CAAgBG,GAAhB;EACAX,OAAO,CAACc,KAAR;EACA,OAAOd,OAAO,CAACe,iBAAR,EAAP;AACD,CARM"}
|
|
@@ -5,7 +5,7 @@ import type { SkPath } from "./Path";
|
|
|
5
5
|
import type { SkImage, MipmapMode, FilterMode, ImageInfo } from "./Image";
|
|
6
6
|
import type { SkSVG } from "./SVG";
|
|
7
7
|
import type { SkColor } from "./Color";
|
|
8
|
-
import type {
|
|
8
|
+
import type { InputRRect } from "./RRect";
|
|
9
9
|
import type { BlendMode } from "./Paint/BlendMode";
|
|
10
10
|
import type { SkPoint, PointMode } from "./Point";
|
|
11
11
|
import type { InputMatrix } from "./Matrix";
|
|
@@ -202,7 +202,7 @@ export interface SkCanvas {
|
|
|
202
202
|
* @param rrect
|
|
203
203
|
* @param paint
|
|
204
204
|
*/
|
|
205
|
-
drawRRect(rrect:
|
|
205
|
+
drawRRect(rrect: InputRRect, paint: SkPaint): void;
|
|
206
206
|
/**
|
|
207
207
|
* Draws RRect outer and inner using clip, Matrix, and Paint paint.
|
|
208
208
|
* outer must contain inner or the drawing is undefined.
|
|
@@ -210,7 +210,7 @@ export interface SkCanvas {
|
|
|
210
210
|
* @param inner
|
|
211
211
|
* @param paint
|
|
212
212
|
*/
|
|
213
|
-
drawDRRect(outer:
|
|
213
|
+
drawDRRect(outer: InputRRect, inner: InputRRect, paint: SkPaint): void;
|
|
214
214
|
/**
|
|
215
215
|
* Draws an oval bounded by the given rectangle using the current clip, current matrix,
|
|
216
216
|
* and the provided paint.
|
|
@@ -367,7 +367,7 @@ export interface SkCanvas {
|
|
|
367
367
|
* @param op
|
|
368
368
|
* @param doAntiAlias
|
|
369
369
|
*/
|
|
370
|
-
clipRRect(rrect:
|
|
370
|
+
clipRRect(rrect: InputRRect, op: ClipOp, doAntiAlias: boolean): void;
|
|
371
371
|
/**
|
|
372
372
|
* Replaces current matrix with m premultiplied with the existing matrix.
|
|
373
373
|
* @param m
|