@nativescript/canvas 2.0.0-webgpu.15 → 2.0.0-webgpu.17
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/ImageBitmap/index.js +92 -2
- package/ImageBitmap/index.js.map +1 -1
- package/WebGPU/GPUCanvasContext.js +0 -1
- package/WebGPU/GPUCanvasContext.js.map +1 -1
- package/WebGPU/GPUDevice.js +4 -2
- package/WebGPU/GPUDevice.js.map +1 -1
- package/angular/esm2022/index.mjs +4 -4
- package/angular/fesm2022/nativescript-canvas-angular.mjs +4 -4
- 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/Modules/CanvasNative.swiftmodule/Project/arm64-apple-ios.swiftsourceinfo +0 -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/dSYMs/CanvasNative.framework.dSYM/Contents/Resources/Relocations/aarch64/CanvasNative.yml +110 -110
- 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/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/_CodeSignature/CodeResources +4 -4
- 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 +595 -595
- package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/dSYMs/CanvasNative.framework.dSYM/Contents/Resources/Relocations/x86_64/CanvasNative.yml +561 -561
- package/platforms/ios/src/cpp/CanvasJSIModule.cpp +2 -1
- package/platforms/ios/src/cpp/ImageBitmapImpl.cpp +38 -0
- package/platforms/ios/src/cpp/ImageBitmapImpl.h +4 -0
|
@@ -145,6 +145,7 @@ void CanvasJSIModule::install(v8::Isolate *isolate) {
|
|
|
145
145
|
Path2D::Init(canvasMod, isolate);
|
|
146
146
|
ImageDataImpl::Init(canvasMod, isolate);
|
|
147
147
|
ImageAssetImpl::Init(canvasMod, isolate);
|
|
148
|
+
ImageBitmapImpl::Init(canvasMod, isolate);
|
|
148
149
|
CanvasGradient::Init(canvasMod, isolate);
|
|
149
150
|
CanvasPattern::Init(canvasMod, isolate);
|
|
150
151
|
MatrixImpl::Init(canvasMod, isolate);
|
|
@@ -1248,7 +1249,7 @@ void CanvasJSIModule::ReadFile(const v8::FunctionCallbackInfo<v8::Value> &args)
|
|
|
1248
1249
|
auto ret = canvas_native_helper_read_file(file.c_str());
|
|
1249
1250
|
|
|
1250
1251
|
if (!canvas_native_helper_read_file_has_error(ret)) {
|
|
1251
|
-
auto buf =
|
|
1252
|
+
auto buf = canvas_native_helper_read_file_take_data(ret);
|
|
1252
1253
|
|
|
1253
1254
|
jsi_callback->SetData(buf);
|
|
1254
1255
|
|
|
@@ -26,6 +26,23 @@ void ImageBitmapImpl::Init(v8::Local<v8::Object> canvasModule, v8::Isolate *isol
|
|
|
26
26
|
canvasModule->Set(context, ConvertToV8String(isolate, "ImageBitmap"), func);
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
+
|
|
30
|
+
void ImageBitmapImpl::FromAsset(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
31
|
+
auto asset = args[0];
|
|
32
|
+
auto type = GetNativeType(asset);
|
|
33
|
+
auto isolate = args.GetIsolate();
|
|
34
|
+
if (type == NativeType::ImageAsset){
|
|
35
|
+
auto ptr = ImageAssetImpl::GetPointer(asset.As<v8::Object>());
|
|
36
|
+
auto ret = canvas_native_image_asset_reference(ptr->GetImageAsset());
|
|
37
|
+
auto bitmap = new ImageBitmapImpl(ret);
|
|
38
|
+
auto data = v8::External::New(isolate, bitmap);
|
|
39
|
+
auto object = ImageBitmapImpl::NewInstance(isolate, data);
|
|
40
|
+
args.GetReturnValue().Set(object);
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
args.GetReturnValue().SetNull();
|
|
44
|
+
}
|
|
45
|
+
|
|
29
46
|
ImageBitmapImpl *ImageBitmapImpl::GetPointer(v8::Local<v8::Object> object) {
|
|
30
47
|
auto ptr = object->GetAlignedPointerFromInternalField(0);
|
|
31
48
|
if (ptr == nullptr) {
|
|
@@ -45,7 +62,10 @@ v8::Local<v8::FunctionTemplate> ImageBitmapImpl::GetCtor(v8::Isolate *isolate) {
|
|
|
45
62
|
ctorTmpl->InstanceTemplate()->SetInternalFieldCount(2);
|
|
46
63
|
ctorTmpl->SetClassName(ConvertToV8String(isolate, "ImageBitmap"));
|
|
47
64
|
|
|
65
|
+
ctorTmpl->Set(ConvertToV8String(isolate, "fromAsset"), v8::FunctionTemplate::New(isolate, FromAsset));
|
|
66
|
+
|
|
48
67
|
auto tmpl = ctorTmpl->InstanceTemplate();
|
|
68
|
+
|
|
49
69
|
tmpl->SetInternalFieldCount(2);
|
|
50
70
|
tmpl->SetAccessor(
|
|
51
71
|
ConvertToV8String(isolate, "width"), GetWidth);
|
|
@@ -60,6 +80,10 @@ v8::Local<v8::FunctionTemplate> ImageBitmapImpl::GetCtor(v8::Isolate *isolate) {
|
|
|
60
80
|
ConvertToV8String(isolate, "__addr"),
|
|
61
81
|
GetAddr);
|
|
62
82
|
|
|
83
|
+
tmpl->Set(
|
|
84
|
+
ConvertToV8String(isolate, "__getRef"),
|
|
85
|
+
v8::FunctionTemplate::New(isolate, GetReference));
|
|
86
|
+
|
|
63
87
|
cache->ImageBitmapTmpl =
|
|
64
88
|
std::make_unique<v8::Persistent<v8::FunctionTemplate>>(isolate, ctorTmpl);
|
|
65
89
|
return ctorTmpl;
|
|
@@ -203,6 +227,20 @@ ImageBitmapImpl::GetAddr(v8::Local<v8::String> name,
|
|
|
203
227
|
info.GetReturnValue().SetEmptyString();
|
|
204
228
|
}
|
|
205
229
|
|
|
230
|
+
void
|
|
231
|
+
ImageBitmapImpl::GetReference(const v8::FunctionCallbackInfo<v8::Value> &args) {
|
|
232
|
+
auto ptr = GetPointer(args.This());
|
|
233
|
+
if (ptr != nullptr) {
|
|
234
|
+
auto isolate = args.GetIsolate();
|
|
235
|
+
auto reference = canvas_native_image_asset_reference(ptr->GetImageAsset());
|
|
236
|
+
auto ret = std::to_string(canvas_native_image_asset_get_addr(reference));
|
|
237
|
+
args.GetReturnValue().Set(ConvertToV8String(isolate, ret));
|
|
238
|
+
return;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
args.GetReturnValue().SetEmptyString();
|
|
242
|
+
}
|
|
243
|
+
|
|
206
244
|
const ImageAsset *ImageBitmapImpl::GetImageAsset() {
|
|
207
245
|
return this->bitmap_;
|
|
208
246
|
}
|
|
@@ -60,11 +60,15 @@ public:
|
|
|
60
60
|
static void GetHeight(v8::Local<v8::String> name,
|
|
61
61
|
const v8::PropertyCallbackInfo<v8::Value> &info);
|
|
62
62
|
|
|
63
|
+
static void GetReference(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
64
|
+
|
|
63
65
|
static void GetAddr(v8::Local<v8::String> name,
|
|
64
66
|
const v8::PropertyCallbackInfo<v8::Value> &info);
|
|
65
67
|
|
|
66
68
|
static void Close(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
67
69
|
|
|
70
|
+
static void FromAsset(const v8::FunctionCallbackInfo<v8::Value> &args);
|
|
71
|
+
|
|
68
72
|
private:
|
|
69
73
|
const ImageAsset *bitmap_;
|
|
70
74
|
bool closed_ = false;
|