@nativescript/canvas 2.0.0-rc.10 → 2.0.0-rc.11
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/index.android.js +6 -4
- package/Canvas/index.android.js.map +1 -1
- package/Canvas/index.ios.js +4 -3
- package/Canvas/index.ios.js.map +1 -1
- package/Canvas/utils.js +2 -1
- package/Canvas/utils.js.map +1 -1
- package/Canvas2D/CanvasRenderingContext2D/index.d.ts +1 -0
- package/Canvas2D/CanvasRenderingContext2D/index.js +158 -6
- package/Canvas2D/CanvasRenderingContext2D/index.js.map +1 -1
- package/Canvas2D/DOMMatrix/index.js +280 -2
- package/Canvas2D/DOMMatrix/index.js.map +1 -1
- package/Canvas2D/Path2D/index.js.map +1 -1
- package/WebGL/WebGLRenderingContext/index.js +0 -1
- package/WebGL/WebGLRenderingContext/index.js.map +1 -1
- package/WebGPU/GPUCanvasContext.d.ts +0 -1
- package/WebGPU/GPUCanvasContext.js +6 -18
- package/WebGPU/GPUCanvasContext.js.map +1 -1
- package/WebGPU/GPUCommandEncoder.d.ts +1 -1
- package/WebGPU/GPUCommandEncoder.js +1 -1
- package/WebGPU/GPUCommandEncoder.js.map +1 -1
- package/WebGPU/GPUDevice.d.ts +2 -2
- package/WebGPU/GPUDevice.js.map +1 -1
- package/WebGPU/GPUQueue.js +1 -4
- package/WebGPU/GPUQueue.js.map +1 -1
- package/WebGPU/GPURenderPassEncoder.d.ts +1 -1
- package/WebGPU/GPURenderPassEncoder.js +2 -2
- package/WebGPU/GPURenderPassEncoder.js.map +1 -1
- package/WebGPU/Interfaces.d.ts +1 -0
- package/WebGPU/Types.d.ts +3 -3
- package/WebGPU/Utils.d.ts +1 -1
- package/WebGPU/Utils.js +67 -93
- package/WebGPU/Utils.js.map +1 -1
- package/angular/fesm2022/nativescript-canvas-angular.mjs +5 -5
- package/angular/package.json +0 -2
- package/package.json +1 -1
- package/platforms/android/canvas-release.aar +0 -0
- package/platforms/ios/CanvasNative.xcframework/Info.plist +5 -5
- 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 +10 -5
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Headers/canvas_native.h +249 -47
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Info.plist +0 -0
- 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 +12361 -10901
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios.private.swiftinterface +55 -49
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios.swiftinterface +55 -49
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/dSYMs/CanvasNative.framework.dSYM/Contents/Resources/DWARF/CanvasNative +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/dSYMs/CanvasNative.framework.dSYM/Contents/Resources/Relocations/aarch64/CanvasNative.yml +954 -994
- 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 +20 -10
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Headers/canvas_native.h +249 -47
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Info.plist +0 -0
- 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 +12361 -10901
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +55 -49
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.swiftinterface +55 -49
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.abi.json +12361 -10901
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +55 -49
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +55 -49
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/_CodeSignature/CodeResources +29 -29
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/dSYMs/CanvasNative.framework.dSYM/Contents/Resources/DWARF/CanvasNative +0 -0
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/dSYMs/CanvasNative.framework.dSYM/Contents/Resources/Relocations/aarch64/CanvasNative.yml +955 -993
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/dSYMs/CanvasNative.framework.dSYM/Contents/Resources/Relocations/x86_64/CanvasNative.yml +824 -1037
- package/platforms/ios/src/cpp/CanvasJSIModule.cpp +1166 -1175
- package/platforms/ios/src/cpp/OnRafCallback.cpp +15 -10
- package/platforms/ios/src/cpp/OnRafCallback.h +1 -0
- package/platforms/ios/src/cpp/canvas2d/CanvasRenderingContext2DImpl.cpp +59 -15
- package/platforms/ios/src/cpp/canvas2d/Path2D.cpp +1 -1
- package/platforms/ios/src/cpp/webgpu/GPUAdapterImpl.cpp +4 -8
- package/platforms/ios/src/cpp/webgpu/GPUCanvasContextImpl.cpp +431 -326
- package/platforms/ios/src/cpp/webgpu/GPUCanvasContextImpl.h +98 -42
- package/platforms/ios/src/cpp/webgpu/GPUCommandEncoderImpl.cpp +1150 -1144
- package/platforms/ios/src/cpp/webgpu/GPUDeviceImpl.cpp +69 -34
- package/platforms/ios/src/cpp/webgpu/GPUQueueImpl.cpp +45 -19
- package/platforms/ios/src/cpp/webgpu/GPURenderPassEncoderImpl.cpp +22 -19
- package/platforms/ios/src/cpp/webgpu/GPUTextureImpl.cpp +11 -0
- package/platforms/ios/src/cpp/webgpu/GPUUtils.h +25 -15
- package/angular/esm2022/index.mjs +0 -17
- package/angular/esm2022/nativescript-canvas-angular.mjs +0 -5
|
@@ -5,21 +5,26 @@
|
|
|
5
5
|
#include "OnRafCallback.h"
|
|
6
6
|
#include "canvas2d/CanvasRenderingContext2DImpl.h"
|
|
7
7
|
#include "webgl/WebGLRenderingContextBase.h"
|
|
8
|
+
#include "webgpu/GPUCanvasContextImpl.h"
|
|
8
9
|
|
|
9
10
|
OnRafCallback::OnRafCallback(intptr_t context, uint32_t version) : context_(context),
|
|
10
|
-
|
|
11
|
+
version_(version) {}
|
|
11
12
|
|
|
12
13
|
void OnRafCallback::OnFrame(int64_t ts) const {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
if (this->version_ == 0) {
|
|
15
|
+
CanvasRenderingContext2DImpl::Flush(this->context_);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
if (this->version_ == 1 || this->version_ == 2) {
|
|
19
|
+
WebGLRenderingContextBase::Flush(this->context_);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
if(this->version_ == 3){
|
|
23
|
+
GPUCanvasContextImpl::Flush(this->context_);
|
|
24
|
+
}
|
|
20
25
|
}
|
|
21
26
|
|
|
22
27
|
void OnRafCallbackOnFrame(intptr_t callback, int64_t ts) {
|
|
23
|
-
|
|
24
|
-
|
|
28
|
+
auto ptr = reinterpret_cast<OnRafCallback *>(reinterpret_cast<intptr_t *>(callback));
|
|
29
|
+
ptr->OnFrame(ts);
|
|
25
30
|
}
|
|
@@ -1147,11 +1147,8 @@ void CanvasRenderingContext2DImpl::GetGlobalCompositeOperation(v8::Local<v8::Str
|
|
|
1147
1147
|
info.GetReturnValue().Set(0);
|
|
1148
1148
|
return;
|
|
1149
1149
|
}
|
|
1150
|
-
auto operation =
|
|
1151
|
-
|
|
1152
|
-
ConvertToV8String(info.GetIsolate(), operation));
|
|
1153
|
-
|
|
1154
|
-
canvas_native_string_destroy((char *) operation);
|
|
1150
|
+
auto operation = canvas_native_context_get_global_composition_int(ptr->GetContext());
|
|
1151
|
+
info.GetReturnValue().Set(operation);
|
|
1155
1152
|
}
|
|
1156
1153
|
|
|
1157
1154
|
void CanvasRenderingContext2DImpl::SetGlobalCompositeOperation(v8::Local<v8::String> property,
|
|
@@ -1162,8 +1159,15 @@ void CanvasRenderingContext2DImpl::SetGlobalCompositeOperation(v8::Local<v8::Str
|
|
|
1162
1159
|
return;
|
|
1163
1160
|
}
|
|
1164
1161
|
auto isolate = info.GetIsolate();
|
|
1165
|
-
|
|
1166
|
-
|
|
1162
|
+
|
|
1163
|
+
uint32_t operation = 0;
|
|
1164
|
+
auto context = isolate->GetCurrentContext();
|
|
1165
|
+
if (value->Uint32Value(context).To(&operation)) {
|
|
1166
|
+
canvas_native_context_set_global_composition_int(ptr->GetContext(), operation);
|
|
1167
|
+
}
|
|
1168
|
+
|
|
1169
|
+
// auto operation = ConvertFromV8String(isolate, value);
|
|
1170
|
+
// canvas_native_context_set_global_composition(ptr->GetContext(), operation.c_str());
|
|
1167
1171
|
}
|
|
1168
1172
|
|
|
1169
1173
|
|
|
@@ -1220,10 +1224,33 @@ void CanvasRenderingContext2DImpl::SetFillStyle(v8::Local<v8::String> property,
|
|
|
1220
1224
|
auto isolate = info.GetIsolate();
|
|
1221
1225
|
|
|
1222
1226
|
if (value->IsString()) {
|
|
1223
|
-
auto style = ConvertFromV8String(isolate, value);
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
+
// auto style = ConvertFromV8String(isolate, value);
|
|
1228
|
+
|
|
1229
|
+
auto val = value.As<v8::String>();
|
|
1230
|
+
int len = val->Utf8Length(isolate) + 1;
|
|
1231
|
+
char buffer [len];
|
|
1232
|
+
val->WriteUtf8(isolate, buffer, len, nullptr, v8::String::WriteOptions::PRESERVE_ONE_BYTE_NULL);
|
|
1233
|
+
|
|
1234
|
+
// v8::String::Utf8Value result(isolate, value);
|
|
1235
|
+
|
|
1236
|
+
// const char *val = *result;
|
|
1237
|
+
|
|
1238
|
+
// if (buffer == nullptr) {
|
|
1239
|
+
// return;
|
|
1240
|
+
// }
|
|
1241
|
+
|
|
1242
|
+
canvas_native_paint_style_set_fill_color_with_c_string(ptr->GetContext(), buffer);
|
|
1243
|
+
}else if(value->IsStringObject()){
|
|
1244
|
+
|
|
1245
|
+
auto val = value.As<v8::StringObject>()->ValueOf();
|
|
1246
|
+
|
|
1247
|
+
int len = val->Utf8Length(isolate) + 1;
|
|
1248
|
+
char buffer [len];
|
|
1249
|
+
val->WriteUtf8(isolate, buffer, len, nullptr, v8::String::WriteOptions::PRESERVE_ONE_BYTE_NULL);
|
|
1250
|
+
|
|
1251
|
+
canvas_native_paint_style_set_fill_color_with_c_string(ptr->GetContext(), buffer);
|
|
1252
|
+
|
|
1253
|
+
} else if (value->IsObject()) {
|
|
1227
1254
|
|
|
1228
1255
|
auto type = GetNativeType(value);
|
|
1229
1256
|
|
|
@@ -1300,10 +1327,27 @@ void CanvasRenderingContext2DImpl::SetStrokeStyle(v8::Local<v8::String> property
|
|
|
1300
1327
|
auto isolate = info.GetIsolate();
|
|
1301
1328
|
|
|
1302
1329
|
if (value->IsString()) {
|
|
1303
|
-
auto style = ConvertFromV8String(isolate, value);
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1330
|
+
// auto style = ConvertFromV8String(isolate, value);
|
|
1331
|
+
|
|
1332
|
+
auto val = value.As<v8::String>();
|
|
1333
|
+
|
|
1334
|
+
int len = val->Utf8Length(isolate) + 1;
|
|
1335
|
+
char buffer [len];
|
|
1336
|
+
val->WriteUtf8(isolate, buffer, len, nullptr, v8::String::WriteOptions::PRESERVE_ONE_BYTE_NULL);
|
|
1337
|
+
|
|
1338
|
+
|
|
1339
|
+
canvas_native_paint_style_set_stroke_color_with_c_string(ptr->GetContext(), buffer);
|
|
1340
|
+
|
|
1341
|
+
}else if(value->IsStringObject()){
|
|
1342
|
+
auto val = value.As<v8::StringObject>()->ValueOf();
|
|
1343
|
+
|
|
1344
|
+
int len = val->Utf8Length(isolate) + 1;
|
|
1345
|
+
char buffer [len];
|
|
1346
|
+
val->WriteUtf8(isolate, buffer, len, nullptr, v8::String::WriteOptions::PRESERVE_ONE_BYTE_NULL);
|
|
1347
|
+
|
|
1348
|
+
|
|
1349
|
+
canvas_native_paint_style_set_stroke_color_with_c_string(ptr->GetContext(), buffer);
|
|
1350
|
+
} else if (value->IsObject()) {
|
|
1307
1351
|
|
|
1308
1352
|
auto type = GetNativeType(value);
|
|
1309
1353
|
|
|
@@ -355,7 +355,7 @@ void Path2D::RoundRect(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
|
355
355
|
auto array = radii.As<v8::Array>();
|
|
356
356
|
auto size = array->Length();
|
|
357
357
|
|
|
358
|
-
if (size
|
|
358
|
+
if (size >= 1) {
|
|
359
359
|
std::vector<float> store;
|
|
360
360
|
store.reserve(size);
|
|
361
361
|
for (int i = 0;
|
|
@@ -209,11 +209,8 @@ void GPUAdapterImpl::RequestDevice(const v8::FunctionCallbackInfo<v8::Value> &ar
|
|
|
209
209
|
|
|
210
210
|
v8::Local<v8::Value> requiredFeaturesValue;
|
|
211
211
|
|
|
212
|
-
options->Get(context, ConvertToV8String(isolate, "requiredFeatures")).ToLocal(
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
if (!requiredFeaturesValue.IsEmpty() && requiredFeaturesValue->IsArray()) {
|
|
212
|
+
if ( options->Get(context, ConvertToV8String(isolate, "requiredFeatures")).ToLocal(
|
|
213
|
+
&requiredFeaturesValue) && requiredFeaturesValue->IsArray()) {
|
|
217
214
|
v8::Local<v8::Array> requiredFeatures = requiredFeaturesValue.As<v8::Array>();
|
|
218
215
|
auto len = requiredFeatures->Length();
|
|
219
216
|
for (int i = 0; i < len; i++) {
|
|
@@ -229,10 +226,9 @@ void GPUAdapterImpl::RequestDevice(const v8::FunctionCallbackInfo<v8::Value> &ar
|
|
|
229
226
|
|
|
230
227
|
v8::Local<v8::Value> limitsValue;
|
|
231
228
|
|
|
232
|
-
options->Get(context, ConvertToV8String(isolate, "requiredLimits")).ToLocal(
|
|
233
|
-
&limitsValue);
|
|
234
229
|
|
|
235
|
-
if (
|
|
230
|
+
if (options->Get(context, ConvertToV8String(isolate, "requiredLimits")).ToLocal(
|
|
231
|
+
&limitsValue) && limitsValue->IsObject()) {
|
|
236
232
|
auto limits_ptr = GPUSupportedLimitsImpl::GetPointer(limitsValue.As<v8::Object>());
|
|
237
233
|
if (limits_ptr != nullptr) {
|
|
238
234
|
limits = limits_ptr->GetLimits();
|