@nativescript/canvas 2.0.0-rc.2 → 2.0.0-rc.20
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 +13 -6
- package/Canvas/common.js +257 -206
- package/Canvas/common.js.map +1 -1
- package/Canvas/index.android.d.ts +2 -0
- package/Canvas/index.android.js +23 -4
- package/Canvas/index.android.js.map +1 -1
- package/Canvas/index.d.ts +3 -0
- package/Canvas/index.ios.d.ts +2 -0
- package/Canvas/index.ios.js +16 -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/Fonts/FontFace.android.js +7 -3
- package/Fonts/FontFace.android.js.map +1 -1
- package/Fonts/FontFace.ios.d.ts +1 -0
- package/Fonts/FontFace.ios.js +10 -3
- package/Fonts/FontFace.ios.js.map +1 -1
- package/TextDecoder/index.d.ts +1 -0
- package/TextDecoder/index.js +17 -0
- package/TextDecoder/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/GPUCompilationInfo.d.ts +10 -0
- package/WebGPU/GPUCompilationInfo.js +20 -0
- package/WebGPU/GPUCompilationInfo.js.map +1 -0
- package/WebGPU/GPUCompilationMessage.d.ts +11 -0
- package/WebGPU/GPUCompilationMessage.js +30 -0
- package/WebGPU/GPUCompilationMessage.js.map +1 -0
- 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/GPUShaderModule.d.ts +2 -0
- package/WebGPU/GPUShaderModule.js +10 -0
- package/WebGPU/GPUShaderModule.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/WebGPU/index.d.ts +2 -0
- package/WebGPU/index.js +2 -0
- package/WebGPU/index.js.map +1 -1
- package/angular/fesm2022/nativescript-canvas-angular.mjs +5 -5
- package/angular/package.json +0 -2
- package/helpers.d.ts +3 -0
- package/helpers.js +9 -0
- package/helpers.js.map +1 -1
- package/index.js +6 -1
- package/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 +10 -5
- package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Headers/canvas_native.h +294 -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 +11317 -11881
- 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 +294 -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 +11317 -11881
- 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 +11317 -11881
- 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/Caches.h +6 -0
- package/platforms/ios/src/cpp/CanvasJSIModule.cpp +1172 -1011
- package/platforms/ios/src/cpp/CanvasJSIModule.h +6 -0
- package/platforms/ios/src/cpp/Helpers.h +23 -2
- package/platforms/ios/src/cpp/NativeType.h +3 -1
- package/platforms/ios/src/cpp/OnRafCallback.cpp +15 -10
- package/platforms/ios/src/cpp/OnRafCallback.h +1 -0
- package/platforms/ios/src/cpp/PromiseCallback.h +42 -20
- package/platforms/ios/src/cpp/TextDecoderImpl.cpp +142 -0
- package/platforms/ios/src/cpp/TextDecoderImpl.h +2 -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/GPUCompilationInfoImpl.cpp +88 -0
- package/platforms/ios/src/cpp/webgpu/GPUCompilationInfoImpl.h +49 -0
- package/platforms/ios/src/cpp/webgpu/GPUCompilationMessageImpl.cpp +193 -0
- package/platforms/ios/src/cpp/webgpu/GPUCompilationMessageImpl.h +64 -0
- package/platforms/ios/src/cpp/webgpu/GPUDeviceImpl.cpp +69 -34
- package/platforms/ios/src/cpp/webgpu/GPUQueueImpl.cpp +45 -18
- package/platforms/ios/src/cpp/webgpu/GPURenderPassEncoderImpl.cpp +22 -19
- package/platforms/ios/src/cpp/webgpu/GPUShaderModuleImpl.cpp +23 -0
- package/platforms/ios/src/cpp/webgpu/GPUShaderModuleImpl.h +2 -0
- 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
|
@@ -200,6 +200,7 @@ void GPUQueueImpl::CopyExternalImageToTexture(const v8::FunctionCallbackInfo<v8:
|
|
|
200
200
|
"texture")).ToLocalChecked();
|
|
201
201
|
auto texture = GPUTextureImpl::GetPointer(textureVal.As<v8::Object>())->GetTexture();
|
|
202
202
|
|
|
203
|
+
|
|
203
204
|
uint32_t mipLevel = 0;
|
|
204
205
|
CanvasOrigin3d origin{0, 0, 0};
|
|
205
206
|
CanvasTextureAspect aspect = CanvasTextureAspectAll;
|
|
@@ -441,31 +442,57 @@ void GPUQueueImpl::WriteBuffer(const v8::FunctionCallbackInfo<v8::Value> &args)
|
|
|
441
442
|
auto buffer = GPUBufferImpl::GetPointer(bufferValue.As<v8::Object>());
|
|
442
443
|
|
|
443
444
|
auto bufferOffset = (uint64_t) args[1].As<v8::Number>()->Value();
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
445
|
+
|
|
446
|
+
std::shared_ptr<v8::BackingStore> store;
|
|
447
|
+
|
|
448
|
+
uint8_t * data = nullptr;
|
|
449
|
+
|
|
450
|
+
size_t offset = 0;
|
|
451
|
+
size_t data_size = 0;
|
|
452
|
+
|
|
453
|
+
if(args[2]->IsTypedArray()){
|
|
454
|
+
auto dataValue = args[2].As<v8::TypedArray>();
|
|
455
|
+
store = dataValue->Buffer()->GetBackingStore();
|
|
456
|
+
offset = dataValue->ByteOffset();
|
|
457
|
+
data = static_cast<uint8_t *>(store->Data()) + offset;
|
|
458
|
+
data_size = store->ByteLength() - offset;
|
|
459
|
+
}else if(args[2]->IsArrayBuffer()){
|
|
460
|
+
auto dataValue = args[2].As<v8::ArrayBuffer>();
|
|
461
|
+
store = dataValue->GetBackingStore();
|
|
462
|
+
data = static_cast<uint8_t *>(store->Data());
|
|
463
|
+
data_size = store->ByteLength();
|
|
464
|
+
}else {
|
|
465
|
+
return;
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
|
|
454
469
|
|
|
455
470
|
auto dataOffset = (uint64_t) args[3].As<v8::Number>()->Value();
|
|
456
471
|
|
|
457
|
-
int64_t size = -1;
|
|
458
472
|
auto sizeValue = args[4];
|
|
459
473
|
|
|
460
|
-
if (sizeValue->IsNumber()) {
|
|
461
|
-
size = (int64_t) sizeValue->ToNumber(context).ToLocalChecked()->Value();
|
|
462
|
-
}
|
|
463
|
-
|
|
464
474
|
|
|
465
475
|
if (buffer != nullptr) {
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
476
|
+
|
|
477
|
+
|
|
478
|
+
if (sizeValue->IsNumber()) {
|
|
479
|
+
int64_t size = (int64_t) sizeValue->ToNumber(context).ToLocalChecked()->Value();
|
|
480
|
+
|
|
481
|
+
if(size < 0){
|
|
482
|
+
canvas_native_webgpu_queue_write_buffer(ptr->GetGPUQueue(), buffer->GetGPUBuffer(),
|
|
483
|
+
bufferOffset, data, data_size, dataOffset);
|
|
484
|
+
}else {
|
|
485
|
+
canvas_native_webgpu_queue_write_buffer_size(ptr->GetGPUQueue(),
|
|
486
|
+
buffer->GetGPUBuffer(),
|
|
487
|
+
bufferOffset, data, data_size,
|
|
488
|
+
dataOffset,
|
|
489
|
+
size);
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
} else {
|
|
493
|
+
canvas_native_webgpu_queue_write_buffer(ptr->GetGPUQueue(), buffer->GetGPUBuffer(),
|
|
494
|
+
bufferOffset, data, data_size, dataOffset);
|
|
495
|
+
}
|
|
469
496
|
}
|
|
470
497
|
}
|
|
471
498
|
|
|
@@ -586,8 +586,10 @@ void GPURenderPassEncoderImpl::SetBlendConstant(const v8::FunctionCallbackInfo<v
|
|
|
586
586
|
|
|
587
587
|
auto color = ParseColor(isolate, colorVal);
|
|
588
588
|
|
|
589
|
-
|
|
590
|
-
|
|
589
|
+
if (color.tag == CanvasOptionalColorSome) {
|
|
590
|
+
canvas_native_webgpu_render_pass_encoder_set_blend_constant(ptr->GetPass(),
|
|
591
|
+
&color.some);
|
|
592
|
+
}
|
|
591
593
|
}
|
|
592
594
|
|
|
593
595
|
}
|
|
@@ -702,22 +704,23 @@ void GPURenderPassEncoderImpl::SetViewport(const v8::FunctionCallbackInfo<v8::Va
|
|
|
702
704
|
|
|
703
705
|
auto isolate = args.GetIsolate();
|
|
704
706
|
auto context = isolate->GetCurrentContext();
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
canvas_native_webgpu_render_pass_encoder_set_viewport(ptr->GetPass(),x,y,width,height,
|
|
707
|
+
|
|
708
|
+
|
|
709
|
+
auto x = (float) xVal->NumberValue(
|
|
710
|
+
context).FromJust();
|
|
711
|
+
auto y = (float) yVal->NumberValue(
|
|
712
|
+
context).FromJust();
|
|
713
|
+
auto width = (float) widthVal->NumberValue(
|
|
714
|
+
context).FromJust();
|
|
715
|
+
auto height = (float) heightVal->NumberValue(
|
|
716
|
+
context).FromJust();
|
|
717
|
+
|
|
718
|
+
auto minDepth = (float) minDepthVal->NumberValue(
|
|
719
|
+
context).FromJust();
|
|
720
|
+
auto maxDepth = (float) maxDepthVal->NumberValue(
|
|
721
|
+
context).FromJust();
|
|
722
|
+
|
|
723
|
+
canvas_native_webgpu_render_pass_encoder_set_viewport(ptr->GetPass(), x, y, width, height,
|
|
724
|
+
minDepth, maxDepth);
|
|
722
725
|
|
|
723
726
|
}
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
#include "GPUShaderModuleImpl.h"
|
|
6
6
|
#include "Caches.h"
|
|
7
|
+
#include "GPUCompilationInfoImpl.h"
|
|
7
8
|
|
|
8
9
|
GPUShaderModuleImpl::GPUShaderModuleImpl(const CanvasGPUShaderModule *shaderModule) : shaderModule_(
|
|
9
10
|
shaderModule) {}
|
|
@@ -52,6 +53,10 @@ v8::Local<v8::FunctionTemplate> GPUShaderModuleImpl::GetCtor(v8::Isolate *isolat
|
|
|
52
53
|
GetLabel
|
|
53
54
|
);
|
|
54
55
|
|
|
56
|
+
tmpl->Set(
|
|
57
|
+
ConvertToV8String(isolate, "getCompilationInfo"),
|
|
58
|
+
v8::FunctionTemplate::New(isolate, &GetCompilationInfo));
|
|
59
|
+
|
|
55
60
|
cache->GPUShaderModuleTmpl =
|
|
56
61
|
std::make_unique<v8::Persistent<v8::FunctionTemplate>>(isolate, ctorTmpl);
|
|
57
62
|
return ctorTmpl;
|
|
@@ -77,4 +82,22 @@ GPUShaderModuleImpl::GetLabel(v8::Local<v8::Name> name,
|
|
|
77
82
|
info.GetReturnValue().SetEmptyString();
|
|
78
83
|
}
|
|
79
84
|
|
|
85
|
+
void
|
|
86
|
+
GPUShaderModuleImpl::GetCompilationInfo(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
87
|
+
auto isolate = args.GetIsolate();
|
|
88
|
+
auto context = isolate->GetCurrentContext();
|
|
89
|
+
GPUShaderModuleImpl *ptr = GetPointer(args.This());
|
|
90
|
+
auto resolver = v8::Promise::Resolver::New(isolate->GetCurrentContext()).ToLocalChecked();
|
|
91
|
+
args.GetReturnValue().Set(resolver->GetPromise());
|
|
92
|
+
if (ptr == nullptr) {
|
|
93
|
+
resolver->Reject(context, v8::Null(isolate));
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
auto info = new GPUCompilationInfoImpl(
|
|
98
|
+
canvas_native_webgpu_device_create_shader_module_get_compilation_info(
|
|
99
|
+
ptr->GetShaderModule()));
|
|
100
|
+
|
|
101
|
+
resolver->Resolve(context, GPUCompilationInfoImpl::NewInstance(isolate, info));
|
|
102
|
+
}
|
|
80
103
|
|
|
@@ -40,6 +40,8 @@ public:
|
|
|
40
40
|
static void GetLabel(v8::Local<v8::Name> name,
|
|
41
41
|
const v8::PropertyCallbackInfo<v8::Value> &info);
|
|
42
42
|
|
|
43
|
+
static void GetCompilationInfo(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
44
|
+
|
|
43
45
|
private:
|
|
44
46
|
const CanvasGPUShaderModule *shaderModule_;
|
|
45
47
|
};
|
|
@@ -364,6 +364,17 @@ void GPUTextureImpl::CreateView(const v8::FunctionCallbackInfo<v8::Value> &args)
|
|
|
364
364
|
}
|
|
365
365
|
}
|
|
366
366
|
|
|
367
|
+
|
|
368
|
+
v8::Local<v8::Value> usageVal;
|
|
369
|
+
uint32_t usage = 0;
|
|
370
|
+
if (descObj->Get(context, ConvertToV8String(isolate, "usage")).ToLocal(
|
|
371
|
+
&usageVal) && usageVal->IsUint32()) {
|
|
372
|
+
usage = usageVal->Uint32Value(context).FromJust();
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
descriptor->usage = usage;
|
|
376
|
+
|
|
377
|
+
|
|
367
378
|
descriptor->dimension = dimension;
|
|
368
379
|
|
|
369
380
|
|
|
@@ -13,9 +13,9 @@
|
|
|
13
13
|
#include "GPUBufferImpl.h"
|
|
14
14
|
|
|
15
15
|
inline static CanvasStoreOp
|
|
16
|
-
ParseCanvasStoreOp(v8::Isolate *isolate, const v8::Local<v8::Value> &obj){
|
|
16
|
+
ParseCanvasStoreOp(v8::Isolate *isolate, const v8::Local<v8::Value> &obj) {
|
|
17
17
|
auto ret = CanvasStoreOp::CanvasStoreOpStore;
|
|
18
|
-
if(!obj.IsEmpty()){
|
|
18
|
+
if (!obj.IsEmpty()) {
|
|
19
19
|
if (obj->IsUint32()) {
|
|
20
20
|
ret = (CanvasStoreOp) obj->Uint32Value(isolate->GetCurrentContext()).ToChecked();
|
|
21
21
|
} else if (obj->IsString()) {
|
|
@@ -31,9 +31,9 @@ ParseCanvasStoreOp(v8::Isolate *isolate, const v8::Local<v8::Value> &obj){
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
inline static CanvasLoadOp
|
|
34
|
-
ParseCanvasLoadOp(v8::Isolate *isolate, const v8::Local<v8::Value> &obj){
|
|
34
|
+
ParseCanvasLoadOp(v8::Isolate *isolate, const v8::Local<v8::Value> &obj) {
|
|
35
35
|
auto ret = CanvasLoadOp::CanvasLoadOpClear;
|
|
36
|
-
if(!obj.IsEmpty()){
|
|
36
|
+
if (!obj.IsEmpty()) {
|
|
37
37
|
if (obj->IsUint32()) {
|
|
38
38
|
ret = (CanvasLoadOp) obj->Uint32Value(isolate->GetCurrentContext()).ToChecked();
|
|
39
39
|
} else if (obj->IsString()) {
|
|
@@ -687,65 +687,75 @@ ParseExtent3d(v8::Isolate *isolate, const v8::Local<v8::Value> &obj) {
|
|
|
687
687
|
}
|
|
688
688
|
|
|
689
689
|
|
|
690
|
-
inline static
|
|
690
|
+
inline static CanvasOptionalColor
|
|
691
691
|
ParseColor(v8::Isolate *isolate, const v8::Local<v8::Value> &obj) {
|
|
692
692
|
|
|
693
693
|
auto context = isolate->GetCurrentContext();
|
|
694
|
-
|
|
695
|
-
|
|
694
|
+
CanvasOptionalColor ret{
|
|
695
|
+
CanvasOptionalColorNone
|
|
696
696
|
};
|
|
697
697
|
|
|
698
698
|
if (!obj.IsEmpty()) {
|
|
699
699
|
if (obj->IsArray()) {
|
|
700
700
|
auto array = obj.As<v8::Array>();
|
|
701
701
|
v8::Local<v8::Value> r;
|
|
702
|
+
ret.tag = CanvasOptionalColorSome;
|
|
703
|
+
ret.some = CanvasColor{
|
|
704
|
+
0, 0, 0, 0
|
|
705
|
+
};
|
|
702
706
|
if (array->Get(context, 0).ToLocal(&r) &&
|
|
703
707
|
r->IsNumber()) {
|
|
704
|
-
ret.r = r->NumberValue(context).FromJust();
|
|
708
|
+
ret.some.r = r->NumberValue(context).FromJust();
|
|
705
709
|
}
|
|
706
710
|
|
|
707
711
|
v8::Local<v8::Value> g;
|
|
708
712
|
if (array->Get(context, 1).ToLocal(&g) &&
|
|
709
713
|
g->IsNumber()) {
|
|
710
|
-
ret.g = g->NumberValue(context).FromJust();
|
|
714
|
+
ret.some.g = g->NumberValue(context).FromJust();
|
|
711
715
|
}
|
|
712
716
|
|
|
713
717
|
v8::Local<v8::Value> b;
|
|
714
718
|
if (array->Get(context, 2).ToLocal(
|
|
715
719
|
&b) && b->IsNumber()) {
|
|
716
|
-
ret.b = b->NumberValue(context).FromJust();
|
|
720
|
+
ret.some.b = b->NumberValue(context).FromJust();
|
|
717
721
|
}
|
|
718
722
|
|
|
719
723
|
|
|
720
724
|
v8::Local<v8::Value> a;
|
|
721
725
|
if (array->Get(context, 3).ToLocal(
|
|
722
726
|
&a) && a->IsNumber()) {
|
|
723
|
-
ret.a = a->NumberValue(context).FromJust();
|
|
727
|
+
ret.some.a = a->NumberValue(context).FromJust();
|
|
724
728
|
}
|
|
725
729
|
} else if (obj->IsObject()) {
|
|
726
730
|
auto colorObj = obj.As<v8::Object>();
|
|
727
731
|
v8::Local<v8::Value> r;
|
|
732
|
+
|
|
733
|
+
ret.tag = CanvasOptionalColorSome;
|
|
734
|
+
ret.some = CanvasColor{
|
|
735
|
+
0, 0, 0, 0
|
|
736
|
+
};
|
|
737
|
+
|
|
728
738
|
if (colorObj->Get(context, ConvertToV8String(isolate, "r")).ToLocal(&r) &&
|
|
729
739
|
r->IsNumber()) {
|
|
730
|
-
ret.r = r->NumberValue(context).FromJust();
|
|
740
|
+
ret.some.r = r->NumberValue(context).FromJust();
|
|
731
741
|
}
|
|
732
742
|
|
|
733
743
|
v8::Local<v8::Value> g;
|
|
734
744
|
if (colorObj->Get(context, ConvertToV8String(isolate, "g")).ToLocal(&g) &&
|
|
735
745
|
g->IsNumber()) {
|
|
736
|
-
ret.g = g->NumberValue(context).FromJust();
|
|
746
|
+
ret.some.g = g->NumberValue(context).FromJust();
|
|
737
747
|
}
|
|
738
748
|
|
|
739
749
|
v8::Local<v8::Value> b;
|
|
740
750
|
if (colorObj->Get(context, ConvertToV8String(isolate, "b")).ToLocal(
|
|
741
751
|
&b) && b->IsNumber()) {
|
|
742
|
-
ret.b = b->NumberValue(context).FromJust();
|
|
752
|
+
ret.some.b = b->NumberValue(context).FromJust();
|
|
743
753
|
}
|
|
744
754
|
|
|
745
755
|
v8::Local<v8::Value> a;
|
|
746
756
|
if (colorObj->Get(context, ConvertToV8String(isolate, "a")).ToLocal(
|
|
747
757
|
&a) && a->IsNumber()) {
|
|
748
|
-
ret.a = a->NumberValue(context).FromJust();
|
|
758
|
+
ret.some.a = a->NumberValue(context).FromJust();
|
|
749
759
|
}
|
|
750
760
|
}
|
|
751
761
|
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { NgModule, NO_ERRORS_SCHEMA } from '@angular/core';
|
|
2
|
-
import { registerElement } from '@nativescript/angular';
|
|
3
|
-
import * as i0 from "@angular/core";
|
|
4
|
-
registerElement('Canvas', () => require('@nativescript/canvas').Canvas);
|
|
5
|
-
// @ts-ignore
|
|
6
|
-
export class CanvasModule {
|
|
7
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.11", ngImport: i0, type: CanvasModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
8
|
-
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.11", ngImport: i0, type: CanvasModule });
|
|
9
|
-
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.11", ngImport: i0, type: CanvasModule });
|
|
10
|
-
}
|
|
11
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.11", ngImport: i0, type: CanvasModule, decorators: [{
|
|
12
|
-
type: NgModule,
|
|
13
|
-
args: [{
|
|
14
|
-
schemas: [NO_ERRORS_SCHEMA]
|
|
15
|
-
}]
|
|
16
|
-
}] });
|
|
17
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9wYWNrYWdlcy9jYW52YXMvYW5ndWxhci9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUMsUUFBUSxFQUFFLGdCQUFnQixFQUFDLE1BQU0sZUFBZSxDQUFDO0FBQ3pELE9BQU8sRUFBQyxlQUFlLEVBQUMsTUFBTSx1QkFBdUIsQ0FBQzs7QUFFdEQsZUFBZSxDQUFDLFFBQVEsRUFBRSxHQUFHLEVBQUUsQ0FBQyxPQUFPLENBQUMsc0JBQXNCLENBQUMsQ0FBQyxNQUFNLENBQUMsQ0FBQztBQU14RSxhQUFhO0FBQ2IsTUFBTSxPQUFPLFlBQVk7d0dBQVosWUFBWTt5R0FBWixZQUFZO3lHQUFaLFlBQVk7OzRGQUFaLFlBQVk7a0JBSnhCLFFBQVE7bUJBQUM7b0JBQ1IsT0FBTyxFQUFFLENBQUMsZ0JBQWdCLENBQUM7aUJBQzVCIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHtOZ01vZHVsZSwgTk9fRVJST1JTX1NDSEVNQX0gZnJvbSAnQGFuZ3VsYXIvY29yZSc7XG5pbXBvcnQge3JlZ2lzdGVyRWxlbWVudH0gZnJvbSAnQG5hdGl2ZXNjcmlwdC9hbmd1bGFyJztcblxucmVnaXN0ZXJFbGVtZW50KCdDYW52YXMnLCAoKSA9PiByZXF1aXJlKCdAbmF0aXZlc2NyaXB0L2NhbnZhcycpLkNhbnZhcyk7XG5cblxuQE5nTW9kdWxlKHtcbiAgc2NoZW1hczogW05PX0VSUk9SU19TQ0hFTUFdXG59KVxuLy8gQHRzLWlnbm9yZVxuZXhwb3J0IGNsYXNzIENhbnZhc01vZHVsZSB7XG59XG4iXX0=
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Generated bundle index. Do not edit.
|
|
3
|
-
*/
|
|
4
|
-
export * from './index';
|
|
5
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibmF0aXZlc2NyaXB0LWNhbnZhcy1hbmd1bGFyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vcGFja2FnZXMvY2FudmFzL2FuZ3VsYXIvbmF0aXZlc2NyaXB0LWNhbnZhcy1hbmd1bGFyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOztHQUVHO0FBRUgsY0FBYyxTQUFTLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIEdlbmVyYXRlZCBidW5kbGUgaW5kZXguIERvIG5vdCBlZGl0LlxuICovXG5cbmV4cG9ydCAqIGZyb20gJy4vaW5kZXgnO1xuIl19
|