@nativescript/canvas 2.0.0-alpha.30 → 2.0.0-alpha.32
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/Canvas/common.d.ts +14 -0
- package/Canvas/common.js +19 -8
- package/Canvas/common.js.map +1 -1
- package/Canvas/index.android.d.ts +1 -0
- package/Canvas/index.android.js +36 -7
- package/Canvas/index.android.js.map +1 -1
- package/Canvas/index.ios.d.ts +2 -1
- package/Canvas/index.ios.js +64 -34
- package/Canvas/index.ios.js.map +1 -1
- package/Canvas2D/CanvasRenderingContext2D/index.js +1 -1
- package/Canvas2D/CanvasRenderingContext2D/index.js.map +1 -1
- package/package.json +1 -1
- package/platforms/android/canvas-release.aar +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/CanvasNative +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Headers/CanvasNative-Swift.h +1 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Headers/canvas_native.h +70 -4
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/Project/arm64-apple-ios.swiftsourceinfo +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios.abi.json +209 -187
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios.private.swiftinterface +1 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios.swiftinterface +1 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/dSYMs/CanvasNative.framework.dSYM/Contents/Resources/DWARF/CanvasNative +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/CanvasNative +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Headers/CanvasNative-Swift.h +2 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Headers/canvas_native.h +70 -4
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/Project/arm64-apple-ios-simulator.swiftsourceinfo +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/Project/x86_64-apple-ios-simulator.swiftsourceinfo +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.abi.json +209 -187
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +1 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.swiftinterface +1 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.abi.json +209 -187
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +1 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +1 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/_CodeSignature/CodeResources +24 -24
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/dSYMs/CanvasNative.framework.dSYM/Contents/Resources/DWARF/CanvasNative +0 -0
- package/platforms/ios/src/cpp/Caches.h +4 -0
- package/platforms/ios/src/cpp/CanvasJSIModule.cpp +37 -0
- package/platforms/ios/src/cpp/CanvasJSIModule.h +10 -1
- package/platforms/ios/src/cpp/URLImpl.cpp +464 -0
- package/platforms/ios/src/cpp/URLImpl.h +119 -0
- package/platforms/ios/src/cpp/canvas2d/CanvasRenderingContext2DImpl.cpp +20 -12
|
@@ -81,6 +81,7 @@ import _StringProcessing
|
|
|
81
81
|
@objc @_Concurrency.MainActor(unsafe) public func setListener(_ listener: (any CanvasNative.NSCCanvasListener)?)
|
|
82
82
|
@_Concurrency.MainActor(unsafe) @objc override dynamic public func layoutSubviews()
|
|
83
83
|
@objc deinit
|
|
84
|
+
@objc @_Concurrency.MainActor(unsafe) public static func getBoundingClientRect(_ canvas: CanvasNative.NSCCanvas, _ buffer: Swift.UnsafeMutableRawPointer)
|
|
84
85
|
}
|
|
85
86
|
@_inheritsConvenienceInitializers @objcMembers @objc(TNSRender) public class NSCRender : ObjectiveC.NSObject {
|
|
86
87
|
@objc override dynamic public init()
|
|
@@ -81,6 +81,7 @@ import _StringProcessing
|
|
|
81
81
|
@objc @_Concurrency.MainActor(unsafe) public func setListener(_ listener: (any CanvasNative.NSCCanvasListener)?)
|
|
82
82
|
@_Concurrency.MainActor(unsafe) @objc override dynamic public func layoutSubviews()
|
|
83
83
|
@objc deinit
|
|
84
|
+
@objc @_Concurrency.MainActor(unsafe) public static func getBoundingClientRect(_ canvas: CanvasNative.NSCCanvas, _ buffer: Swift.UnsafeMutableRawPointer)
|
|
84
85
|
}
|
|
85
86
|
@_inheritsConvenienceInitializers @objcMembers @objc(TNSRender) public class NSCRender : ObjectiveC.NSObject {
|
|
86
87
|
@objc override dynamic public init()
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<dict>
|
|
7
7
|
<key>Headers/CanvasNative-Swift.h</key>
|
|
8
8
|
<data>
|
|
9
|
-
|
|
9
|
+
+VCFMd8HrKLciD+OwsTVcdS0fAA=
|
|
10
10
|
</data>
|
|
11
11
|
<key>Headers/CanvasNative.h</key>
|
|
12
12
|
<data>
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
</data>
|
|
19
19
|
<key>Headers/canvas_native.h</key>
|
|
20
20
|
<data>
|
|
21
|
-
|
|
21
|
+
NxfB7FhSGtuOu9Ck2Y6OAxEspDk=
|
|
22
22
|
</data>
|
|
23
23
|
<key>Info.plist</key>
|
|
24
24
|
<data>
|
|
@@ -26,19 +26,19 @@
|
|
|
26
26
|
</data>
|
|
27
27
|
<key>Modules/CanvasNative.swiftmodule/Project/arm64-apple-ios-simulator.swiftsourceinfo</key>
|
|
28
28
|
<data>
|
|
29
|
-
|
|
29
|
+
MINThIl7ndWVb8bIShypUSh/3go=
|
|
30
30
|
</data>
|
|
31
31
|
<key>Modules/CanvasNative.swiftmodule/Project/x86_64-apple-ios-simulator.swiftsourceinfo</key>
|
|
32
32
|
<data>
|
|
33
|
-
|
|
33
|
+
9Z9FjgTKHinlXDE6k355GJQ+hDk=
|
|
34
34
|
</data>
|
|
35
35
|
<key>Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.abi.json</key>
|
|
36
36
|
<data>
|
|
37
|
-
|
|
37
|
+
a05xfoh8i4smP+ATcF26KP9w8IY=
|
|
38
38
|
</data>
|
|
39
39
|
<key>Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface</key>
|
|
40
40
|
<data>
|
|
41
|
-
|
|
41
|
+
8Srz3VbLpqZAT9Vj0TTcMmNnFpo=
|
|
42
42
|
</data>
|
|
43
43
|
<key>Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.swiftdoc</key>
|
|
44
44
|
<data>
|
|
@@ -46,19 +46,19 @@
|
|
|
46
46
|
</data>
|
|
47
47
|
<key>Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.swiftinterface</key>
|
|
48
48
|
<data>
|
|
49
|
-
|
|
49
|
+
8Srz3VbLpqZAT9Vj0TTcMmNnFpo=
|
|
50
50
|
</data>
|
|
51
51
|
<key>Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.swiftmodule</key>
|
|
52
52
|
<data>
|
|
53
|
-
|
|
53
|
+
xwUL0+sPWQOnLRbmCRAaufNhlQg=
|
|
54
54
|
</data>
|
|
55
55
|
<key>Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.abi.json</key>
|
|
56
56
|
<data>
|
|
57
|
-
|
|
57
|
+
a05xfoh8i4smP+ATcF26KP9w8IY=
|
|
58
58
|
</data>
|
|
59
59
|
<key>Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface</key>
|
|
60
60
|
<data>
|
|
61
|
-
|
|
61
|
+
oGaFzJw2skR8h7F5PnUt0p1T0do=
|
|
62
62
|
</data>
|
|
63
63
|
<key>Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.swiftdoc</key>
|
|
64
64
|
<data>
|
|
@@ -66,11 +66,11 @@
|
|
|
66
66
|
</data>
|
|
67
67
|
<key>Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.swiftinterface</key>
|
|
68
68
|
<data>
|
|
69
|
-
|
|
69
|
+
oGaFzJw2skR8h7F5PnUt0p1T0do=
|
|
70
70
|
</data>
|
|
71
71
|
<key>Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.swiftmodule</key>
|
|
72
72
|
<data>
|
|
73
|
-
|
|
73
|
+
a6dK/jYfYD3OMc+7AAdKioPdSzM=
|
|
74
74
|
</data>
|
|
75
75
|
<key>Modules/module.modulemap</key>
|
|
76
76
|
<data>
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
<dict>
|
|
88
88
|
<key>hash2</key>
|
|
89
89
|
<data>
|
|
90
|
-
|
|
90
|
+
fXm+b+Qm+nCs5qVchcJ5cPoIgOfKloO3YiRF6o4KNRg=
|
|
91
91
|
</data>
|
|
92
92
|
</dict>
|
|
93
93
|
<key>Headers/CanvasNative.h</key>
|
|
@@ -108,35 +108,35 @@
|
|
|
108
108
|
<dict>
|
|
109
109
|
<key>hash2</key>
|
|
110
110
|
<data>
|
|
111
|
-
|
|
111
|
+
ORK71+iLrkjjzu3hwV2vt58kg+ICPAC0ZSPhcqy7oTI=
|
|
112
112
|
</data>
|
|
113
113
|
</dict>
|
|
114
114
|
<key>Modules/CanvasNative.swiftmodule/Project/arm64-apple-ios-simulator.swiftsourceinfo</key>
|
|
115
115
|
<dict>
|
|
116
116
|
<key>hash2</key>
|
|
117
117
|
<data>
|
|
118
|
-
|
|
118
|
+
++sX4p8tBMeuVFks8jongrvmbBm+PZ6z4HxEPAbLomw=
|
|
119
119
|
</data>
|
|
120
120
|
</dict>
|
|
121
121
|
<key>Modules/CanvasNative.swiftmodule/Project/x86_64-apple-ios-simulator.swiftsourceinfo</key>
|
|
122
122
|
<dict>
|
|
123
123
|
<key>hash2</key>
|
|
124
124
|
<data>
|
|
125
|
-
|
|
125
|
+
rGTM5TkLTVTN8jNFgTOABzilyBCnblKehhohqojojIQ=
|
|
126
126
|
</data>
|
|
127
127
|
</dict>
|
|
128
128
|
<key>Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.abi.json</key>
|
|
129
129
|
<dict>
|
|
130
130
|
<key>hash2</key>
|
|
131
131
|
<data>
|
|
132
|
-
|
|
132
|
+
ivLUd4vcB85bDIQrO24DZdQEiDa/wuC/s4UqLJoeDAs=
|
|
133
133
|
</data>
|
|
134
134
|
</dict>
|
|
135
135
|
<key>Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface</key>
|
|
136
136
|
<dict>
|
|
137
137
|
<key>hash2</key>
|
|
138
138
|
<data>
|
|
139
|
-
|
|
139
|
+
NYLgbQSiXcqEGePfly2vWkVlmvpletiSTJhSSvYELy0=
|
|
140
140
|
</data>
|
|
141
141
|
</dict>
|
|
142
142
|
<key>Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.swiftdoc</key>
|
|
@@ -150,28 +150,28 @@
|
|
|
150
150
|
<dict>
|
|
151
151
|
<key>hash2</key>
|
|
152
152
|
<data>
|
|
153
|
-
|
|
153
|
+
NYLgbQSiXcqEGePfly2vWkVlmvpletiSTJhSSvYELy0=
|
|
154
154
|
</data>
|
|
155
155
|
</dict>
|
|
156
156
|
<key>Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.swiftmodule</key>
|
|
157
157
|
<dict>
|
|
158
158
|
<key>hash2</key>
|
|
159
159
|
<data>
|
|
160
|
-
|
|
160
|
+
pTosagdcfbOSk+kqEUxvwO8uiO0kDuxEPJAEzFGZvNw=
|
|
161
161
|
</data>
|
|
162
162
|
</dict>
|
|
163
163
|
<key>Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.abi.json</key>
|
|
164
164
|
<dict>
|
|
165
165
|
<key>hash2</key>
|
|
166
166
|
<data>
|
|
167
|
-
|
|
167
|
+
ivLUd4vcB85bDIQrO24DZdQEiDa/wuC/s4UqLJoeDAs=
|
|
168
168
|
</data>
|
|
169
169
|
</dict>
|
|
170
170
|
<key>Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface</key>
|
|
171
171
|
<dict>
|
|
172
172
|
<key>hash2</key>
|
|
173
173
|
<data>
|
|
174
|
-
|
|
174
|
+
1OljxijU01/Dy6xtdgZ9TjaT8i0/oF9cLMQx2FhpL8w=
|
|
175
175
|
</data>
|
|
176
176
|
</dict>
|
|
177
177
|
<key>Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.swiftdoc</key>
|
|
@@ -185,14 +185,14 @@
|
|
|
185
185
|
<dict>
|
|
186
186
|
<key>hash2</key>
|
|
187
187
|
<data>
|
|
188
|
-
|
|
188
|
+
1OljxijU01/Dy6xtdgZ9TjaT8i0/oF9cLMQx2FhpL8w=
|
|
189
189
|
</data>
|
|
190
190
|
</dict>
|
|
191
191
|
<key>Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.swiftmodule</key>
|
|
192
192
|
<dict>
|
|
193
193
|
<key>hash2</key>
|
|
194
194
|
<data>
|
|
195
|
-
|
|
195
|
+
RzFPk/lsBdJedrAgG+Vzkgv6bq2WCg3BdPLGfDgwZtM=
|
|
196
196
|
</data>
|
|
197
197
|
</dict>
|
|
198
198
|
<key>Modules/module.modulemap</key>
|
|
Binary file
|
|
@@ -177,6 +177,10 @@ public:
|
|
|
177
177
|
std::unique_ptr<v8::Persistent<v8::FunctionTemplate>> WebGLUniformLocationTmpl = std::unique_ptr<v8::Persistent<v8::FunctionTemplate>>(
|
|
178
178
|
nullptr);
|
|
179
179
|
|
|
180
|
+
std::unique_ptr<v8::Persistent<v8::FunctionTemplate>> URLTmpl = std::unique_ptr<v8::Persistent<v8::FunctionTemplate>>(
|
|
181
|
+
nullptr);
|
|
182
|
+
|
|
183
|
+
|
|
180
184
|
private:
|
|
181
185
|
static std::shared_ptr<ConcurrentMap<v8::Isolate *,
|
|
182
186
|
std::shared_ptr<Caches>>>
|
|
@@ -34,6 +34,7 @@ void CanvasJSIModule::install(v8::Isolate *isolate) {
|
|
|
34
34
|
CanvasPattern::Init(canvasMod, isolate);
|
|
35
35
|
MatrixImpl::Init(canvasMod, isolate);
|
|
36
36
|
TextMetricsImpl::Init(canvasMod, isolate);
|
|
37
|
+
URLImpl::Init(canvasMod, isolate);
|
|
37
38
|
v8Global->Set(context, ConvertToV8String(isolate, "CanvasModule"), canvasMod);
|
|
38
39
|
canvasMod->Set(context, ConvertToV8String(isolate, "create2DContext"),
|
|
39
40
|
v8::FunctionTemplate::New(isolate, &Create2DContext)->GetFunction(
|
|
@@ -56,6 +57,11 @@ void CanvasJSIModule::install(v8::Isolate *isolate) {
|
|
|
56
57
|
v8::FunctionTemplate::New(isolate, &CreateWebGL2Context)->GetFunction(
|
|
57
58
|
context).ToLocalChecked());
|
|
58
59
|
|
|
60
|
+
|
|
61
|
+
canvasMod->Set(context, ConvertToV8String(isolate, "__addFontFamily"),
|
|
62
|
+
v8::FunctionTemplate::New(isolate, &AddFontFamily)->GetFunction(
|
|
63
|
+
context).ToLocalChecked());
|
|
64
|
+
|
|
59
65
|
global->Set(context,
|
|
60
66
|
ConvertToV8String(isolate, "CanvasModule"), canvasMod);
|
|
61
67
|
|
|
@@ -63,6 +69,37 @@ void CanvasJSIModule::install(v8::Isolate *isolate) {
|
|
|
63
69
|
}
|
|
64
70
|
|
|
65
71
|
|
|
72
|
+
void CanvasJSIModule::AddFontFamily(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
73
|
+
auto isolate = args.GetIsolate();
|
|
74
|
+
auto context = isolate->GetCurrentContext();
|
|
75
|
+
auto aliasValue = args[0];
|
|
76
|
+
auto familyValue = args[1];
|
|
77
|
+
|
|
78
|
+
// todo improve
|
|
79
|
+
if (familyValue->IsArray()) {
|
|
80
|
+
auto family = familyValue.As<v8::Array>();
|
|
81
|
+
auto len = family->Length();
|
|
82
|
+
std::vector<std::string> buf;
|
|
83
|
+
std::vector<const char *> buffer;
|
|
84
|
+
buf.reserve(len);
|
|
85
|
+
|
|
86
|
+
for (uint32_t i = 0; i < len; i++) {
|
|
87
|
+
buf.emplace_back(
|
|
88
|
+
ConvertFromV8String(isolate, family->Get(context, i).ToLocalChecked()));
|
|
89
|
+
buffer.emplace_back(buf[0].c_str());
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
if (aliasValue->IsString()) {
|
|
93
|
+
auto alias = ConvertFromV8String(isolate, aliasValue);
|
|
94
|
+
canvas_native_font_add_family(alias.c_str(), buffer.data(), buffer.size());
|
|
95
|
+
} else {
|
|
96
|
+
canvas_native_font_add_family(nullptr, buffer.data(), buffer.size());
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
}
|
|
102
|
+
|
|
66
103
|
void CanvasJSIModule::Create2DContext(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
67
104
|
auto isolate = args.GetIsolate();
|
|
68
105
|
auto context = isolate->GetCurrentContext();
|
|
@@ -19,15 +19,24 @@
|
|
|
19
19
|
#include "webgl/WebGLRenderingContext.h"
|
|
20
20
|
#include "webgl2/WebGL2RenderingContext.h"
|
|
21
21
|
|
|
22
|
+
#include "URLImpl.h"
|
|
22
23
|
|
|
23
24
|
class CanvasJSIModule {
|
|
24
25
|
public:
|
|
25
|
-
static void install(v8::Isolate *
|
|
26
|
+
static void install(v8::Isolate *isolate);
|
|
27
|
+
|
|
26
28
|
static void CreateImageBitmap(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
29
|
+
|
|
27
30
|
static void Create2DContext(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
31
|
+
|
|
28
32
|
static void Create2DContextWithPointer(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
33
|
+
|
|
29
34
|
static void ReadFile(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
35
|
+
|
|
30
36
|
static void CreateWebGLContext(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
37
|
+
|
|
31
38
|
static void CreateWebGL2Context(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
39
|
+
|
|
40
|
+
static void AddFontFamily(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
32
41
|
};
|
|
33
42
|
|