@nativescript/canvas 2.0.0-webgpu.4 → 2.0.0-webgpu.40

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.
Files changed (211) hide show
  1. package/Canvas/common.d.ts +5 -10
  2. package/Canvas/common.js +61 -144
  3. package/Canvas/common.js.map +1 -1
  4. package/Canvas/index.android.d.ts +6 -5
  5. package/Canvas/index.android.js +63 -42
  6. package/Canvas/index.android.js.map +1 -1
  7. package/Canvas/index.d.ts +13 -3
  8. package/Canvas/index.ios.d.ts +9 -1
  9. package/Canvas/index.ios.js +117 -66
  10. package/Canvas/index.ios.js.map +1 -1
  11. package/Canvas/utils.d.ts +3 -0
  12. package/Canvas/utils.js +85 -0
  13. package/Canvas/utils.js.map +1 -0
  14. package/Canvas2D/CanvasRenderingContext2D/index.d.ts +3 -1
  15. package/Canvas2D/CanvasRenderingContext2D/index.js +2 -4
  16. package/Canvas2D/CanvasRenderingContext2D/index.js.map +1 -1
  17. package/Dom/Group.d.ts +1 -2
  18. package/Dom/Group.js.map +1 -1
  19. package/Dom/Image.js +0 -1
  20. package/Dom/Image.js.map +1 -1
  21. package/Dom/Paint.d.ts +1 -1
  22. package/Dom/shapes/Path.d.ts +1 -1
  23. package/ImageAsset/index.d.ts +4 -2
  24. package/ImageAsset/index.js +151 -37
  25. package/ImageAsset/index.js.map +1 -1
  26. package/ImageBitmap/index.js +107 -20
  27. package/ImageBitmap/index.js.map +1 -1
  28. package/README.md +2 -4
  29. package/WebGL/WebGLRenderingContext/common.d.ts +1 -1
  30. package/WebGL/WebGLRenderingContext/index.js +76 -32
  31. package/WebGL/WebGLRenderingContext/index.js.map +1 -1
  32. package/WebGL2/WebGL2RenderingContext/index.js +5 -5
  33. package/WebGL2/WebGL2RenderingContext/index.js.map +1 -1
  34. package/WebGPU/GPU.js +4 -3
  35. package/WebGPU/GPU.js.map +1 -1
  36. package/WebGPU/GPUAdapter.d.ts +6 -3
  37. package/WebGPU/GPUAdapter.js +31 -0
  38. package/WebGPU/GPUAdapter.js.map +1 -1
  39. package/WebGPU/GPUBindGroup.d.ts +1 -0
  40. package/WebGPU/GPUBindGroup.js +3 -0
  41. package/WebGPU/GPUBindGroup.js.map +1 -1
  42. package/WebGPU/GPUBindGroupLayout.d.ts +1 -0
  43. package/WebGPU/GPUBindGroupLayout.js +3 -0
  44. package/WebGPU/GPUBindGroupLayout.js.map +1 -1
  45. package/WebGPU/GPUBuffer.js +10 -2
  46. package/WebGPU/GPUBuffer.js.map +1 -1
  47. package/WebGPU/GPUCanvasContext.d.ts +5 -3
  48. package/WebGPU/GPUCanvasContext.js +52 -10
  49. package/WebGPU/GPUCanvasContext.js.map +1 -1
  50. package/WebGPU/GPUCommandBuffer.d.ts +1 -0
  51. package/WebGPU/GPUCommandBuffer.js +3 -0
  52. package/WebGPU/GPUCommandBuffer.js.map +1 -1
  53. package/WebGPU/GPUCommandEncoder.d.ts +3 -9
  54. package/WebGPU/GPUCommandEncoder.js +94 -41
  55. package/WebGPU/GPUCommandEncoder.js.map +1 -1
  56. package/WebGPU/GPUComputePassEncoder.d.ts +1 -0
  57. package/WebGPU/GPUComputePassEncoder.js +3 -0
  58. package/WebGPU/GPUComputePassEncoder.js.map +1 -1
  59. package/WebGPU/GPUComputePipeline.d.ts +1 -0
  60. package/WebGPU/GPUComputePipeline.js +3 -0
  61. package/WebGPU/GPUComputePipeline.js.map +1 -1
  62. package/WebGPU/GPUDevice.d.ts +17 -79
  63. package/WebGPU/GPUDevice.js +75 -91
  64. package/WebGPU/GPUDevice.js.map +1 -1
  65. package/WebGPU/GPUExternalTexture.d.ts +1 -0
  66. package/WebGPU/GPUExternalTexture.js +3 -0
  67. package/WebGPU/GPUExternalTexture.js.map +1 -1
  68. package/WebGPU/GPUPipelineLayout.d.ts +1 -0
  69. package/WebGPU/GPUPipelineLayout.js +3 -0
  70. package/WebGPU/GPUPipelineLayout.js.map +1 -1
  71. package/WebGPU/GPUQuerySet.d.ts +1 -0
  72. package/WebGPU/GPUQuerySet.js +3 -0
  73. package/WebGPU/GPUQuerySet.js.map +1 -1
  74. package/WebGPU/GPUQueue.d.ts +1 -0
  75. package/WebGPU/GPUQueue.js +65 -14
  76. package/WebGPU/GPUQueue.js.map +1 -1
  77. package/WebGPU/GPURenderBundle.d.ts +1 -0
  78. package/WebGPU/GPURenderBundle.js +3 -0
  79. package/WebGPU/GPURenderBundle.js.map +1 -1
  80. package/WebGPU/GPURenderBundleEncoder.d.ts +4 -2
  81. package/WebGPU/GPURenderBundleEncoder.js +7 -3
  82. package/WebGPU/GPURenderBundleEncoder.js.map +1 -1
  83. package/WebGPU/GPURenderPassEncoder.d.ts +5 -1
  84. package/WebGPU/GPURenderPassEncoder.js +14 -2
  85. package/WebGPU/GPURenderPassEncoder.js.map +1 -1
  86. package/WebGPU/GPURenderPipeline.d.ts +1 -0
  87. package/WebGPU/GPURenderPipeline.js +3 -0
  88. package/WebGPU/GPURenderPipeline.js.map +1 -1
  89. package/WebGPU/GPUSampler.d.ts +1 -0
  90. package/WebGPU/GPUSampler.js +3 -0
  91. package/WebGPU/GPUSampler.js.map +1 -1
  92. package/WebGPU/GPUShaderModule.d.ts +1 -1
  93. package/WebGPU/GPUShaderModule.js +2 -2
  94. package/WebGPU/GPUShaderModule.js.map +1 -1
  95. package/WebGPU/GPUTexture.d.ts +1 -0
  96. package/WebGPU/GPUTexture.js +3 -0
  97. package/WebGPU/GPUTexture.js.map +1 -1
  98. package/WebGPU/GPUTextureView.d.ts +1 -0
  99. package/WebGPU/GPUTextureView.js +3 -0
  100. package/WebGPU/GPUTextureView.js.map +1 -1
  101. package/WebGPU/Interfaces.d.ts +95 -4
  102. package/WebGPU/Types.d.ts +9 -1
  103. package/WebGPU/Utils.d.ts +6 -0
  104. package/WebGPU/Utils.js +226 -0
  105. package/WebGPU/Utils.js.map +1 -1
  106. package/angular/esm2022/index.mjs +4 -4
  107. package/angular/fesm2022/nativescript-canvas-angular.mjs +4 -4
  108. package/angular/fesm2022/nativescript-canvas-angular.mjs.map +1 -1
  109. package/common.js.map +1 -1
  110. package/index.d.ts +2 -1
  111. package/index.js +3 -2
  112. package/index.js.map +1 -1
  113. package/package.json +1 -1
  114. package/platforms/android/canvas-release.aar +0 -0
  115. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/CanvasNative +0 -0
  116. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Headers/CanvasNative-Swift.h +61 -30
  117. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Headers/CanvasNative.h +1 -0
  118. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Headers/NSCMTLView.h +32 -0
  119. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Headers/canvas_ios.h +144 -176
  120. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Headers/canvas_native.h +342 -72
  121. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Info.plist +0 -0
  122. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/Project/arm64-apple-ios.swiftsourceinfo +0 -0
  123. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios.abi.json +7997 -5995
  124. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios.private.swiftinterface +85 -23
  125. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  126. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios.swiftinterface +85 -23
  127. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/NSCCanvas.nib +0 -0
  128. package/platforms/ios/CanvasNative.xcframework/ios-arm64/dSYMs/CanvasNative.framework.dSYM/Contents/Resources/DWARF/CanvasNative +0 -0
  129. package/platforms/ios/CanvasNative.xcframework/ios-arm64/dSYMs/CanvasNative.framework.dSYM/Contents/Resources/Relocations/aarch64/CanvasNative.yml +681 -644
  130. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/CanvasNative +0 -0
  131. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Headers/CanvasNative-Swift.h +122 -60
  132. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Headers/CanvasNative.h +1 -0
  133. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Headers/NSCMTLView.h +32 -0
  134. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Headers/canvas_ios.h +144 -176
  135. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Headers/canvas_native.h +342 -72
  136. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Info.plist +0 -0
  137. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/Project/arm64-apple-ios-simulator.swiftsourceinfo +0 -0
  138. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/Project/x86_64-apple-ios-simulator.swiftsourceinfo +0 -0
  139. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.abi.json +7997 -5995
  140. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +85 -23
  141. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
  142. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.swiftinterface +85 -23
  143. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.abi.json +7997 -5995
  144. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +85 -23
  145. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
  146. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +85 -23
  147. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/NSCCanvas.nib +0 -0
  148. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/_CodeSignature/CodeResources +40 -29
  149. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/dSYMs/CanvasNative.framework.dSYM/Contents/Resources/DWARF/CanvasNative +0 -0
  150. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/dSYMs/CanvasNative.framework.dSYM/Contents/Resources/Relocations/aarch64/CanvasNative.yml +683 -646
  151. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/dSYMs/CanvasNative.framework.dSYM/Contents/Resources/Relocations/x86_64/CanvasNative.yml +736 -684
  152. package/platforms/ios/src/NSOperationQueueWrapper.h +1 -1
  153. package/platforms/ios/src/NSOperationQueueWrapper.mm +41 -9
  154. package/platforms/ios/src/cpp/AsyncCallback.h +16 -8
  155. package/platforms/ios/src/cpp/CanvasJSIModule.cpp +310 -801
  156. package/platforms/ios/src/cpp/CanvasJSIModule.h +2 -0
  157. package/platforms/ios/src/cpp/ImageAssetImpl.cpp +578 -413
  158. package/platforms/ios/src/cpp/ImageAssetImpl.h +7 -3
  159. package/platforms/ios/src/cpp/ImageBitmapImpl.cpp +60 -3
  160. package/platforms/ios/src/cpp/ImageBitmapImpl.h +10 -3
  161. package/platforms/ios/src/cpp/PromiseCallback.h +1 -2
  162. package/platforms/ios/src/cpp/canvas2d/CanvasRenderingContext2DImpl.cpp +7 -11
  163. package/platforms/ios/src/cpp/canvas2d/CanvasRenderingContext2DImpl.h +3 -3
  164. package/platforms/ios/src/cpp/canvas2d/Path2D.h +5 -5
  165. package/platforms/ios/src/cpp/webgl/WebGLRenderingContext.cpp +106 -1
  166. package/platforms/ios/src/cpp/webgl/WebGLRenderingContextBase.cpp +6 -6
  167. package/platforms/ios/src/cpp/webgpu/GPUAdapterImpl.cpp +26 -23
  168. package/platforms/ios/src/cpp/webgpu/GPUBindGroupImpl.cpp +31 -5
  169. package/platforms/ios/src/cpp/webgpu/GPUBindGroupImpl.h +4 -1
  170. package/platforms/ios/src/cpp/webgpu/GPUBindGroupLayoutImpl.cpp +26 -0
  171. package/platforms/ios/src/cpp/webgpu/GPUBindGroupLayoutImpl.h +3 -0
  172. package/platforms/ios/src/cpp/webgpu/GPUBufferImpl.cpp +41 -7
  173. package/platforms/ios/src/cpp/webgpu/GPUBufferImpl.h +4 -0
  174. package/platforms/ios/src/cpp/webgpu/GPUCanvasContextImpl.cpp +11 -5
  175. package/platforms/ios/src/cpp/webgpu/GPUCommandBufferImpl.cpp +28 -1
  176. package/platforms/ios/src/cpp/webgpu/GPUCommandBufferImpl.h +3 -0
  177. package/platforms/ios/src/cpp/webgpu/GPUCommandEncoderImpl.cpp +75 -79
  178. package/platforms/ios/src/cpp/webgpu/GPUCommandEncoderImpl.h +4 -0
  179. package/platforms/ios/src/cpp/webgpu/GPUComputePassEncoderImpl.cpp +56 -23
  180. package/platforms/ios/src/cpp/webgpu/GPUComputePassEncoderImpl.h +3 -0
  181. package/platforms/ios/src/cpp/webgpu/GPUComputePipelineImpl.cpp +25 -0
  182. package/platforms/ios/src/cpp/webgpu/GPUComputePipelineImpl.h +2 -0
  183. package/platforms/ios/src/cpp/webgpu/GPUDeviceImpl.cpp +1606 -681
  184. package/platforms/ios/src/cpp/webgpu/GPUDeviceImpl.h +2 -0
  185. package/platforms/ios/src/cpp/webgpu/GPUImpl.cpp +2 -1
  186. package/platforms/ios/src/cpp/webgpu/GPUImpl.h +1 -1
  187. package/platforms/ios/src/cpp/webgpu/GPULabel.h +33 -0
  188. package/platforms/ios/src/cpp/webgpu/GPUPipelineLayoutImpl.cpp +26 -0
  189. package/platforms/ios/src/cpp/webgpu/GPUPipelineLayoutImpl.h +3 -1
  190. package/platforms/ios/src/cpp/webgpu/GPUQuerySetImpl.cpp +1 -2
  191. package/platforms/ios/src/cpp/webgpu/GPUQuerySetImpl.h +1 -1
  192. package/platforms/ios/src/cpp/webgpu/GPUQueueImpl.cpp +83 -14
  193. package/platforms/ios/src/cpp/webgpu/GPUQueueImpl.h +3 -0
  194. package/platforms/ios/src/cpp/webgpu/GPURenderBundleEncoderImpl.cpp +66 -34
  195. package/platforms/ios/src/cpp/webgpu/GPURenderBundleEncoderImpl.h +3 -0
  196. package/platforms/ios/src/cpp/webgpu/GPURenderBundleImpl.cpp +25 -0
  197. package/platforms/ios/src/cpp/webgpu/GPURenderBundleImpl.h +3 -0
  198. package/platforms/ios/src/cpp/webgpu/GPURenderPassEncoderImpl.cpp +151 -52
  199. package/platforms/ios/src/cpp/webgpu/GPURenderPassEncoderImpl.h +7 -0
  200. package/platforms/ios/src/cpp/webgpu/GPURenderPipelineImpl.cpp +25 -0
  201. package/platforms/ios/src/cpp/webgpu/GPURenderPipelineImpl.h +3 -0
  202. package/platforms/ios/src/cpp/webgpu/GPUSamplerImpl.cpp +26 -0
  203. package/platforms/ios/src/cpp/webgpu/GPUSamplerImpl.h +4 -1
  204. package/platforms/ios/src/cpp/webgpu/GPUShaderModuleImpl.cpp +24 -0
  205. package/platforms/ios/src/cpp/webgpu/GPUShaderModuleImpl.h +3 -0
  206. package/platforms/ios/src/cpp/webgpu/GPUTextureImpl.cpp +34 -8
  207. package/platforms/ios/src/cpp/webgpu/GPUTextureImpl.h +2 -0
  208. package/platforms/ios/src/cpp/webgpu/GPUTextureViewImpl.cpp +26 -0
  209. package/platforms/ios/src/cpp/webgpu/GPUTextureViewImpl.h +3 -0
  210. package/platforms/ios/src/cpp/webgpu/GPUUtils.h +511 -0
  211. package/utils.d.ts +1 -1
@@ -342,25 +342,24 @@ SWIFT_CLASS_NAMED("CanvasHelpers")
342
342
  + (NSMutableData * _Nonnull)getBytesFromUIImage:(UIImage * _Nonnull)image SWIFT_WARN_UNUSED_RESULT;
343
343
  + (int64_t)createPattern:(int64_t)context :(UIImage * _Nonnull)image :(NSString * _Nonnull)repetition SWIFT_WARN_UNUSED_RESULT;
344
344
  + (BOOL)loadImageAssetWithContext:(int64_t)asset :(UIImage * _Nonnull)image SWIFT_WARN_UNUSED_RESULT;
345
+ + (BOOL)loadImageAssetWithPath:(int64_t)asset :(NSString * _Nonnull)path SWIFT_WARN_UNUSED_RESULT;
345
346
  + (BOOL)drawImageWithContext:(int64_t)context image:(UIImage * _Nonnull)image dx:(float)dx dy:(float)dy SWIFT_WARN_UNUSED_RESULT;
346
347
  + (BOOL)drawImageWithContext:(int64_t)context image:(UIImage * _Nonnull)image dx:(float)dx dy:(float)dy dw:(float)dw dh:(float)dh SWIFT_WARN_UNUSED_RESULT;
347
348
  + (BOOL)drawImageWithContext:(int64_t)context image:(UIImage * _Nonnull)image sx:(float)sx sy:(float)sy sw:(float)sw sh:(float)sh dx:(float)dx dy:(float)dy dw:(float)dw dh:(float)dh SWIFT_WARN_UNUSED_RESULT;
348
- + (int64_t)initWebGPUWithViewLayer:(int64_t)instance :(int64_t)view :(uint32_t)width :(uint32_t)height SWIFT_METHOD_FAMILY(none) SWIFT_WARN_UNUSED_RESULT;
349
- + (int64_t)initWebGPUWithView:(int64_t)instance :(int64_t)view :(uint32_t)width :(uint32_t)height SWIFT_METHOD_FAMILY(none) SWIFT_WARN_UNUSED_RESULT;
350
- + (int64_t)initGLWithView:(int64_t)view :(BOOL)alpha :(BOOL)antialias :(BOOL)depth :(BOOL)fail_if_major_performance_caveat :(int32_t)power_preference :(BOOL)premultiplied_alpha :(BOOL)preserve_drawing_buffer :(BOOL)stencil :(BOOL)desynchronized :(BOOL)xr_compatible :(int32_t)version :(BOOL)is_canvas SWIFT_METHOD_FAMILY(none) SWIFT_WARN_UNUSED_RESULT;
351
- + (int64_t)initSharedGLWithView:(int64_t)view :(BOOL)alpha :(BOOL)antialias :(BOOL)depth :(BOOL)fail_if_major_performance_caveat :(int32_t)power_preference :(BOOL)premultiplied_alpha :(BOOL)preserve_drawing_buffer :(BOOL)stencil :(BOOL)desynchronized :(BOOL)xr_compatible :(int32_t)version :(BOOL)is_canvas :(int64_t)shared_context SWIFT_METHOD_FAMILY(none) SWIFT_WARN_UNUSED_RESULT;
352
- + (int64_t)initGLWithWidthAndHeight:(int32_t)width :(int32_t)height :(BOOL)alpha :(BOOL)antialias :(BOOL)depth :(BOOL)fail_if_major_performance_caveat :(int32_t)power_preference :(BOOL)premultiplied_alpha :(BOOL)preserve_drawing_buffer :(BOOL)stencil :(BOOL)desynchronized :(BOOL)xr_compatible :(int32_t)version :(BOOL)is_canvas SWIFT_METHOD_FAMILY(none) SWIFT_WARN_UNUSED_RESULT;
353
- + (int64_t)initSharedGLWidthAndHeight:(int32_t)width :(int32_t)height :(BOOL)alpha :(BOOL)antialias :(BOOL)depth :(BOOL)fail_if_major_performance_caveat :(int32_t)power_preference :(BOOL)premultiplied_alpha :(BOOL)preserve_drawing_buffer :(BOOL)stencil :(BOOL)desynchronized :(BOOL)xr_compatible :(int32_t)version :(BOOL)is_canvas :(int64_t)shared_context SWIFT_METHOD_FAMILY(none) SWIFT_WARN_UNUSED_RESULT;
349
+ + (int64_t)initWebGPUWithViewLayer:(int64_t)instance :(NSCCanvas * _Nonnull)view :(uint32_t)width :(uint32_t)height SWIFT_METHOD_FAMILY(none) SWIFT_WARN_UNUSED_RESULT;
350
+ + (int64_t)initWebGPUWithView:(int64_t)instance :(NSCCanvas * _Nonnull)view :(uint32_t)width :(uint32_t)height SWIFT_METHOD_FAMILY(none) SWIFT_WARN_UNUSED_RESULT;
351
+ + (void)resizeWebGPUWithView:(int64_t)context :(NSCCanvas * _Nonnull)view :(uint32_t)width :(uint32_t)height;
352
+ + (int64_t)initWebGLWithView:(NSCCanvas * _Nonnull)view :(BOOL)alpha :(BOOL)antialias :(BOOL)depth :(BOOL)fail_if_major_performance_caveat :(int32_t)power_preference :(BOOL)premultiplied_alpha :(BOOL)preserve_drawing_buffer :(BOOL)stencil :(BOOL)desynchronized :(BOOL)xr_compatible :(int32_t)version SWIFT_METHOD_FAMILY(none) SWIFT_WARN_UNUSED_RESULT;
353
+ + (int64_t)initWebGLWithWidthAndHeight:(int32_t)width :(int32_t)height :(BOOL)alpha :(BOOL)antialias :(BOOL)depth :(BOOL)fail_if_major_performance_caveat :(int32_t)power_preference :(BOOL)premultiplied_alpha :(BOOL)preserve_drawing_buffer :(BOOL)stencil :(BOOL)desynchronized :(BOOL)xr_compatible :(int32_t)version SWIFT_METHOD_FAMILY(none) SWIFT_WARN_UNUSED_RESULT;
354
354
  + (void)resize2DContext:(int64_t)context :(float)width :(float)height;
355
355
  + (void)flush2DContext:(int64_t)context;
356
- + (BOOL)flushGL:(int64_t)context SWIFT_WARN_UNUSED_RESULT;
357
- + (void)releaseGL:(int64_t)context;
358
- + (int64_t)getGLPointer:(int64_t)context SWIFT_WARN_UNUSED_RESULT;
359
- + (void)releaseGLPointer:(int64_t)context;
360
- + (int64_t)create2DContext:(int64_t)context :(int32_t)width :(int32_t)height :(BOOL)alpha :(float)density :(int32_t)samples :(int32_t)font_color :(float)ppi :(int32_t)direction SWIFT_WARN_UNUSED_RESULT;
361
- + (void)updateGLSurfaceWithView:(int64_t)view :(int32_t)width :(int32_t)height :(int64_t)context;
362
- + (void)test2D:(int64_t)context;
363
- + (NSString * _Nonnull)testToDataURL:(int64_t)context SWIFT_WARN_UNUSED_RESULT;
356
+ + (void)flush2DContextAndSyncCPU:(int64_t)context;
357
+ + (void)presentDrawable:(int64_t)context;
358
+ + (BOOL)flushWebGL:(int64_t)context SWIFT_WARN_UNUSED_RESULT;
359
+ + (void)releaseWebGL:(int64_t)context;
360
+ + (int64_t)create2DContext:(NSCCanvas * _Nonnull)view :(int32_t)width :(int32_t)height :(BOOL)alpha :(float)density :(int32_t)fontColor :(float)ppi :(int32_t)direction SWIFT_WARN_UNUSED_RESULT;
361
+ + (int64_t)create2DContextMetal:(NSCCanvas * _Nonnull)view :(BOOL)alpha :(float)density :(int32_t)fontColor :(float)ppi :(int32_t)direction SWIFT_WARN_UNUSED_RESULT;
362
+ + (void)updateWebGLSurfaceWithView:(int64_t)view :(int32_t)width :(int32_t)height :(int64_t)context;
364
363
  + (void)writeFile:(NSData * _Nonnull)data :(NSString * _Nonnull)path :(void (^ _Nonnull)(NSString * _Nullable, NSString * _Nullable))callback;
365
364
  + (void)readFile:(NSString * _Nonnull)path :(void (^ _Nonnull)(NSString * _Nullable, NSData * _Nullable))callback;
366
365
  + (void)deleteFile:(NSString * _Nonnull)path :(void (^ _Nonnull)(NSError * _Nullable, BOOL))callback;
@@ -381,15 +380,20 @@ enum CanvasFit : NSInteger;
381
380
 
382
381
  SWIFT_CLASS_NAMED("NSCCanvas")
383
382
  @interface NSCCanvas : UIView
383
+ SWIFT_CLASS_PROPERTY(@property (nonatomic, class) BOOL forceGL;)
384
+ + (BOOL)forceGL SWIFT_WARN_UNUSED_RESULT;
385
+ + (void)setForceGL:(BOOL)value;
384
386
  @property (nonatomic) enum CanvasFit fit;
387
+ @property (nonatomic) BOOL weblikeScale;
385
388
  SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, strong) NSMutableDictionary * _Nonnull store;)
386
389
  + (NSMutableDictionary * _Nonnull)store SWIFT_WARN_UNUSED_RESULT;
387
390
  + (NSMapTable<NSString *, NSCCanvas *> * _Nonnull)getViews SWIFT_WARN_UNUSED_RESULT;
388
- - (void * _Nonnull)getViewPtr SWIFT_WARN_UNUSED_RESULT;
391
+ - (void * _Nonnull)getGlViewPtr SWIFT_WARN_UNUSED_RESULT;
389
392
  - (void * _Nonnull)getMtlViewPtr SWIFT_WARN_UNUSED_RESULT;
393
+ - (void * _Nonnull)getMtlLayerPtr SWIFT_WARN_UNUSED_RESULT;
390
394
  @property (nonatomic) BOOL autoScale;
391
- @property (nonatomic, readonly) int64_t nativeGL;
392
395
  @property (nonatomic, readonly) int64_t nativeContext;
396
+ @property (nonatomic, readonly) BOOL is2D;
393
397
  @property (nonatomic, readonly) CGFloat drawingBufferWidth;
394
398
  @property (nonatomic, readonly) CGFloat drawingBufferHeight;
395
399
  @property (nonatomic, readonly) float width;
@@ -399,15 +403,17 @@ SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, strong) NSMutableDic
399
403
  - (int64_t)create2DContext:(BOOL)alpha :(BOOL)antialias :(BOOL)depth :(BOOL)failIfMajorPerformanceCaveat :(int32_t)powerPreference :(BOOL)premultipliedAlpha :(BOOL)preserveDrawingBuffer :(BOOL)stencil :(BOOL)desynchronized :(BOOL)xrCompatible :(int32_t)fontColor SWIFT_WARN_UNUSED_RESULT;
400
404
  - (UIImage * _Nullable)snapshot:(BOOL)flip SWIFT_WARN_UNUSED_RESULT;
401
405
  - (BOOL)render;
402
- - (void)context2DTest:(int64_t)context;
403
- - (NSString * _Nonnull)context2DTestToDataURL:(int64_t)context SWIFT_WARN_UNUSED_RESULT;
404
406
  @property (nonatomic, copy) void (^ _Nullable touchEventListener)(NSString * _Nonnull, UIGestureRecognizer * _Nonnull);
405
407
  - (nullable instancetype)initWithCoder:(NSCoder * _Nonnull)coder SWIFT_UNAVAILABLE;
406
408
  - (nonnull instancetype)initWithFrame:(CGRect)frame OBJC_DESIGNATED_INITIALIZER;
409
+ @property (nonatomic) BOOL ignoreTouchEvents;
407
410
  - (void)setListener:(id <NSCCanvasListener> _Nullable)listener;
408
411
  @property (nonatomic) NSInteger surfaceWidth;
409
412
  @property (nonatomic) NSInteger surfaceHeight;
410
413
  - (void)forceLayout:(CGFloat)width :(CGFloat)height;
414
+ - (void)context2DTest:(int64_t)context;
415
+ - (void)context2DPathTest:(int64_t)context;
416
+ - (void)context2DConic:(int64_t)context;
411
417
  - (void)layoutSubviews;
412
418
  + (void)getBoundingClientRect:(UIView * _Nonnull)view :(void * _Nonnull)buffer;
413
419
  @end
@@ -442,11 +448,27 @@ SWIFT_CLASS_NAMED("NSCCanvasRenderingContext2D")
442
448
  - (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER;
443
449
  @end
444
450
 
451
+ @class NSCRender;
452
+ @class AVPlayer;
453
+ @class AVPlayerItemVideoOutput;
454
+
455
+ SWIFT_CLASS_NAMED("NSCCanvasUtils")
456
+ @interface NSCCanvasUtils : NSObject
457
+ + (CVOpenGLESTextureCacheRef _Nullable)createTextureCache SWIFT_WARN_UNUSED_RESULT;
458
+ + (CVOpenGLESTextureRef _Nullable)createImage:(CVOpenGLESTextureCacheRef _Nonnull)texturecache :(CVImageBufferRef _Nonnull)buffer :(CFDictionaryRef _Nullable)textureAttributes :(GLenum)target :(GLint)internalFormat :(GLsizei)width :(GLsizei)height :(GLenum)format :(GLenum)type :(NSInteger)planeIndex SWIFT_WARN_UNUSED_RESULT;
459
+ + (NSCRender * _Nonnull)setupRender SWIFT_WARN_UNUSED_RESULT;
460
+ + (void)drawFrame:(AVPlayer * _Nonnull)player :(AVPlayerItemVideoOutput * _Nonnull)output :(CGSize)videoSize :(int32_t)internalFormat :(int32_t)format :(BOOL)flipYWebGL;
461
+ + (BOOL)writeToFile:(NSData * _Nonnull)data :(NSString * _Nonnull)path error:(NSError * _Nullable * _Nullable)error;
462
+ - (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER;
463
+ @end
464
+
445
465
 
446
466
  SWIFT_CLASS_NAMED("NSCImageAsset")
447
467
  @interface NSCImageAsset : NSObject
448
468
  + (BOOL)loadImageFromImageSync:(int64_t)context :(UIImage * _Nonnull)image SWIFT_WARN_UNUSED_RESULT;
449
469
  + (void)loadImageFromImage:(int64_t)context :(UIImage * _Nonnull)image :(void (^ _Nonnull)(BOOL))callback;
470
+ + (BOOL)loadImageFromPathSync:(int64_t)asset :(NSString * _Nonnull)path SWIFT_WARN_UNUSED_RESULT;
471
+ + (void)loadImageFromPath:(int64_t)asset :(NSString * _Nonnull)path :(void (^ _Nonnull)(BOOL))callback;
450
472
  - (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER;
451
473
  @end
452
474
 
@@ -462,11 +484,28 @@ SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, strong) dispatch_que
462
484
  SWIFT_CLASS_NAMED("NSCRender")
463
485
  @interface NSCRender : NSObject
464
486
  - (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER;
465
- - (void)texImage2D:(int32_t)target :(int32_t)level :(int32_t)internalFormat :(int32_t)format :(int32_t)type :(NSCCanvas * _Nonnull)source :(NSCCanvas * _Nonnull)dest :(BOOL)flipYWebGL;
466
- - (void)createSurface;
467
487
  @end
468
488
 
469
489
 
490
+ SWIFT_CLASS_NAMED("NSCVideoFrame")
491
+ @interface NSCVideoFrame : NSObject
492
+ - (nonnull instancetype)init SWIFT_UNAVAILABLE;
493
+ + (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable");
494
+ @end
495
+
496
+ typedef SWIFT_ENUM_NAMED(NSInteger, NSCVideoFrameFormat, "NSCVideoFrameFormat", open) {
497
+ NSCVideoFrameFormatI420 = 0,
498
+ NSCVideoFrameFormatI420A = 1,
499
+ NSCVideoFrameFormatI422 = 2,
500
+ NSCVideoFrameFormatI444 = 3,
501
+ NSCVideoFrameFormatNV12 = 4,
502
+ NSCVideoFrameFormatRGBA = 5,
503
+ NSCVideoFrameFormatRGBX = 6,
504
+ NSCVideoFrameFormatBGRA = 7,
505
+ NSCVideoFrameFormatBGRX = 8,
506
+ };
507
+
508
+
470
509
  SWIFT_CLASS_NAMED("NSCWebGLRenderingContext")
471
510
  @interface NSCWebGLRenderingContext : NSObject
472
511
  + (void)texImage2D:(int64_t)context :(int32_t)target :(int32_t)level :(int32_t)internalformat :(int32_t)format :(int32_t)type :(uint8_t * _Nonnull)data :(NSUInteger)size :(CGSize)dimensions :(BOOL)flipY;
@@ -474,17 +513,9 @@ SWIFT_CLASS_NAMED("NSCWebGLRenderingContext")
474
513
  - (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER;
475
514
  @end
476
515
 
477
- @class AVPlayer;
478
- @class AVPlayerItemVideoOutput;
479
516
 
480
- SWIFT_CLASS_NAMED("Utils")
481
- @interface Utils : NSObject
482
- + (CVOpenGLESTextureCacheRef _Nullable)createTextureCache SWIFT_WARN_UNUSED_RESULT;
483
- + (CVOpenGLESTextureRef _Nullable)createImage:(CVOpenGLESTextureCacheRef _Nonnull)texturecache :(CVImageBufferRef _Nonnull)buffer :(CFDictionaryRef _Nullable)textureAttributes :(GLenum)target :(GLint)internalFormat :(GLsizei)width :(GLsizei)height :(GLenum)format :(GLenum)type :(NSInteger)planeIndex SWIFT_WARN_UNUSED_RESULT;
484
- + (NSCRender * _Nonnull)setupRender SWIFT_WARN_UNUSED_RESULT;
485
- + (void)drawFrame:(AVPlayer * _Nonnull)player :(AVPlayerItemVideoOutput * _Nonnull)output :(CGSize)videoSize :(NSCRender * _Nonnull)render :(int32_t)internalFormat :(int32_t)format :(BOOL)flipYWebGL;
486
- + (BOOL)writeToFile:(NSData * _Nonnull)data :(NSString * _Nonnull)path error:(NSError * _Nullable * _Nullable)error;
487
- - (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER;
517
+ @interface UIView (SWIFT_EXTENSION(CanvasNative))
518
+ - (void)getBoundingClientRect:(void * _Nonnull)buffer;
488
519
  @end
489
520
 
490
521
  #endif
@@ -839,25 +870,24 @@ SWIFT_CLASS_NAMED("CanvasHelpers")
839
870
  + (NSMutableData * _Nonnull)getBytesFromUIImage:(UIImage * _Nonnull)image SWIFT_WARN_UNUSED_RESULT;
840
871
  + (int64_t)createPattern:(int64_t)context :(UIImage * _Nonnull)image :(NSString * _Nonnull)repetition SWIFT_WARN_UNUSED_RESULT;
841
872
  + (BOOL)loadImageAssetWithContext:(int64_t)asset :(UIImage * _Nonnull)image SWIFT_WARN_UNUSED_RESULT;
873
+ + (BOOL)loadImageAssetWithPath:(int64_t)asset :(NSString * _Nonnull)path SWIFT_WARN_UNUSED_RESULT;
842
874
  + (BOOL)drawImageWithContext:(int64_t)context image:(UIImage * _Nonnull)image dx:(float)dx dy:(float)dy SWIFT_WARN_UNUSED_RESULT;
843
875
  + (BOOL)drawImageWithContext:(int64_t)context image:(UIImage * _Nonnull)image dx:(float)dx dy:(float)dy dw:(float)dw dh:(float)dh SWIFT_WARN_UNUSED_RESULT;
844
876
  + (BOOL)drawImageWithContext:(int64_t)context image:(UIImage * _Nonnull)image sx:(float)sx sy:(float)sy sw:(float)sw sh:(float)sh dx:(float)dx dy:(float)dy dw:(float)dw dh:(float)dh SWIFT_WARN_UNUSED_RESULT;
845
- + (int64_t)initWebGPUWithViewLayer:(int64_t)instance :(int64_t)view :(uint32_t)width :(uint32_t)height SWIFT_METHOD_FAMILY(none) SWIFT_WARN_UNUSED_RESULT;
846
- + (int64_t)initWebGPUWithView:(int64_t)instance :(int64_t)view :(uint32_t)width :(uint32_t)height SWIFT_METHOD_FAMILY(none) SWIFT_WARN_UNUSED_RESULT;
847
- + (int64_t)initGLWithView:(int64_t)view :(BOOL)alpha :(BOOL)antialias :(BOOL)depth :(BOOL)fail_if_major_performance_caveat :(int32_t)power_preference :(BOOL)premultiplied_alpha :(BOOL)preserve_drawing_buffer :(BOOL)stencil :(BOOL)desynchronized :(BOOL)xr_compatible :(int32_t)version :(BOOL)is_canvas SWIFT_METHOD_FAMILY(none) SWIFT_WARN_UNUSED_RESULT;
848
- + (int64_t)initSharedGLWithView:(int64_t)view :(BOOL)alpha :(BOOL)antialias :(BOOL)depth :(BOOL)fail_if_major_performance_caveat :(int32_t)power_preference :(BOOL)premultiplied_alpha :(BOOL)preserve_drawing_buffer :(BOOL)stencil :(BOOL)desynchronized :(BOOL)xr_compatible :(int32_t)version :(BOOL)is_canvas :(int64_t)shared_context SWIFT_METHOD_FAMILY(none) SWIFT_WARN_UNUSED_RESULT;
849
- + (int64_t)initGLWithWidthAndHeight:(int32_t)width :(int32_t)height :(BOOL)alpha :(BOOL)antialias :(BOOL)depth :(BOOL)fail_if_major_performance_caveat :(int32_t)power_preference :(BOOL)premultiplied_alpha :(BOOL)preserve_drawing_buffer :(BOOL)stencil :(BOOL)desynchronized :(BOOL)xr_compatible :(int32_t)version :(BOOL)is_canvas SWIFT_METHOD_FAMILY(none) SWIFT_WARN_UNUSED_RESULT;
850
- + (int64_t)initSharedGLWidthAndHeight:(int32_t)width :(int32_t)height :(BOOL)alpha :(BOOL)antialias :(BOOL)depth :(BOOL)fail_if_major_performance_caveat :(int32_t)power_preference :(BOOL)premultiplied_alpha :(BOOL)preserve_drawing_buffer :(BOOL)stencil :(BOOL)desynchronized :(BOOL)xr_compatible :(int32_t)version :(BOOL)is_canvas :(int64_t)shared_context SWIFT_METHOD_FAMILY(none) SWIFT_WARN_UNUSED_RESULT;
877
+ + (int64_t)initWebGPUWithViewLayer:(int64_t)instance :(NSCCanvas * _Nonnull)view :(uint32_t)width :(uint32_t)height SWIFT_METHOD_FAMILY(none) SWIFT_WARN_UNUSED_RESULT;
878
+ + (int64_t)initWebGPUWithView:(int64_t)instance :(NSCCanvas * _Nonnull)view :(uint32_t)width :(uint32_t)height SWIFT_METHOD_FAMILY(none) SWIFT_WARN_UNUSED_RESULT;
879
+ + (void)resizeWebGPUWithView:(int64_t)context :(NSCCanvas * _Nonnull)view :(uint32_t)width :(uint32_t)height;
880
+ + (int64_t)initWebGLWithView:(NSCCanvas * _Nonnull)view :(BOOL)alpha :(BOOL)antialias :(BOOL)depth :(BOOL)fail_if_major_performance_caveat :(int32_t)power_preference :(BOOL)premultiplied_alpha :(BOOL)preserve_drawing_buffer :(BOOL)stencil :(BOOL)desynchronized :(BOOL)xr_compatible :(int32_t)version SWIFT_METHOD_FAMILY(none) SWIFT_WARN_UNUSED_RESULT;
881
+ + (int64_t)initWebGLWithWidthAndHeight:(int32_t)width :(int32_t)height :(BOOL)alpha :(BOOL)antialias :(BOOL)depth :(BOOL)fail_if_major_performance_caveat :(int32_t)power_preference :(BOOL)premultiplied_alpha :(BOOL)preserve_drawing_buffer :(BOOL)stencil :(BOOL)desynchronized :(BOOL)xr_compatible :(int32_t)version SWIFT_METHOD_FAMILY(none) SWIFT_WARN_UNUSED_RESULT;
851
882
  + (void)resize2DContext:(int64_t)context :(float)width :(float)height;
852
883
  + (void)flush2DContext:(int64_t)context;
853
- + (BOOL)flushGL:(int64_t)context SWIFT_WARN_UNUSED_RESULT;
854
- + (void)releaseGL:(int64_t)context;
855
- + (int64_t)getGLPointer:(int64_t)context SWIFT_WARN_UNUSED_RESULT;
856
- + (void)releaseGLPointer:(int64_t)context;
857
- + (int64_t)create2DContext:(int64_t)context :(int32_t)width :(int32_t)height :(BOOL)alpha :(float)density :(int32_t)samples :(int32_t)font_color :(float)ppi :(int32_t)direction SWIFT_WARN_UNUSED_RESULT;
858
- + (void)updateGLSurfaceWithView:(int64_t)view :(int32_t)width :(int32_t)height :(int64_t)context;
859
- + (void)test2D:(int64_t)context;
860
- + (NSString * _Nonnull)testToDataURL:(int64_t)context SWIFT_WARN_UNUSED_RESULT;
884
+ + (void)flush2DContextAndSyncCPU:(int64_t)context;
885
+ + (void)presentDrawable:(int64_t)context;
886
+ + (BOOL)flushWebGL:(int64_t)context SWIFT_WARN_UNUSED_RESULT;
887
+ + (void)releaseWebGL:(int64_t)context;
888
+ + (int64_t)create2DContext:(NSCCanvas * _Nonnull)view :(int32_t)width :(int32_t)height :(BOOL)alpha :(float)density :(int32_t)fontColor :(float)ppi :(int32_t)direction SWIFT_WARN_UNUSED_RESULT;
889
+ + (int64_t)create2DContextMetal:(NSCCanvas * _Nonnull)view :(BOOL)alpha :(float)density :(int32_t)fontColor :(float)ppi :(int32_t)direction SWIFT_WARN_UNUSED_RESULT;
890
+ + (void)updateWebGLSurfaceWithView:(int64_t)view :(int32_t)width :(int32_t)height :(int64_t)context;
861
891
  + (void)writeFile:(NSData * _Nonnull)data :(NSString * _Nonnull)path :(void (^ _Nonnull)(NSString * _Nullable, NSString * _Nullable))callback;
862
892
  + (void)readFile:(NSString * _Nonnull)path :(void (^ _Nonnull)(NSString * _Nullable, NSData * _Nullable))callback;
863
893
  + (void)deleteFile:(NSString * _Nonnull)path :(void (^ _Nonnull)(NSError * _Nullable, BOOL))callback;
@@ -878,15 +908,20 @@ enum CanvasFit : NSInteger;
878
908
 
879
909
  SWIFT_CLASS_NAMED("NSCCanvas")
880
910
  @interface NSCCanvas : UIView
911
+ SWIFT_CLASS_PROPERTY(@property (nonatomic, class) BOOL forceGL;)
912
+ + (BOOL)forceGL SWIFT_WARN_UNUSED_RESULT;
913
+ + (void)setForceGL:(BOOL)value;
881
914
  @property (nonatomic) enum CanvasFit fit;
915
+ @property (nonatomic) BOOL weblikeScale;
882
916
  SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, strong) NSMutableDictionary * _Nonnull store;)
883
917
  + (NSMutableDictionary * _Nonnull)store SWIFT_WARN_UNUSED_RESULT;
884
918
  + (NSMapTable<NSString *, NSCCanvas *> * _Nonnull)getViews SWIFT_WARN_UNUSED_RESULT;
885
- - (void * _Nonnull)getViewPtr SWIFT_WARN_UNUSED_RESULT;
919
+ - (void * _Nonnull)getGlViewPtr SWIFT_WARN_UNUSED_RESULT;
886
920
  - (void * _Nonnull)getMtlViewPtr SWIFT_WARN_UNUSED_RESULT;
921
+ - (void * _Nonnull)getMtlLayerPtr SWIFT_WARN_UNUSED_RESULT;
887
922
  @property (nonatomic) BOOL autoScale;
888
- @property (nonatomic, readonly) int64_t nativeGL;
889
923
  @property (nonatomic, readonly) int64_t nativeContext;
924
+ @property (nonatomic, readonly) BOOL is2D;
890
925
  @property (nonatomic, readonly) CGFloat drawingBufferWidth;
891
926
  @property (nonatomic, readonly) CGFloat drawingBufferHeight;
892
927
  @property (nonatomic, readonly) float width;
@@ -896,15 +931,17 @@ SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, strong) NSMutableDic
896
931
  - (int64_t)create2DContext:(BOOL)alpha :(BOOL)antialias :(BOOL)depth :(BOOL)failIfMajorPerformanceCaveat :(int32_t)powerPreference :(BOOL)premultipliedAlpha :(BOOL)preserveDrawingBuffer :(BOOL)stencil :(BOOL)desynchronized :(BOOL)xrCompatible :(int32_t)fontColor SWIFT_WARN_UNUSED_RESULT;
897
932
  - (UIImage * _Nullable)snapshot:(BOOL)flip SWIFT_WARN_UNUSED_RESULT;
898
933
  - (BOOL)render;
899
- - (void)context2DTest:(int64_t)context;
900
- - (NSString * _Nonnull)context2DTestToDataURL:(int64_t)context SWIFT_WARN_UNUSED_RESULT;
901
934
  @property (nonatomic, copy) void (^ _Nullable touchEventListener)(NSString * _Nonnull, UIGestureRecognizer * _Nonnull);
902
935
  - (nullable instancetype)initWithCoder:(NSCoder * _Nonnull)coder SWIFT_UNAVAILABLE;
903
936
  - (nonnull instancetype)initWithFrame:(CGRect)frame OBJC_DESIGNATED_INITIALIZER;
937
+ @property (nonatomic) BOOL ignoreTouchEvents;
904
938
  - (void)setListener:(id <NSCCanvasListener> _Nullable)listener;
905
939
  @property (nonatomic) NSInteger surfaceWidth;
906
940
  @property (nonatomic) NSInteger surfaceHeight;
907
941
  - (void)forceLayout:(CGFloat)width :(CGFloat)height;
942
+ - (void)context2DTest:(int64_t)context;
943
+ - (void)context2DPathTest:(int64_t)context;
944
+ - (void)context2DConic:(int64_t)context;
908
945
  - (void)layoutSubviews;
909
946
  + (void)getBoundingClientRect:(UIView * _Nonnull)view :(void * _Nonnull)buffer;
910
947
  @end
@@ -939,11 +976,27 @@ SWIFT_CLASS_NAMED("NSCCanvasRenderingContext2D")
939
976
  - (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER;
940
977
  @end
941
978
 
979
+ @class NSCRender;
980
+ @class AVPlayer;
981
+ @class AVPlayerItemVideoOutput;
982
+
983
+ SWIFT_CLASS_NAMED("NSCCanvasUtils")
984
+ @interface NSCCanvasUtils : NSObject
985
+ + (CVOpenGLESTextureCacheRef _Nullable)createTextureCache SWIFT_WARN_UNUSED_RESULT;
986
+ + (CVOpenGLESTextureRef _Nullable)createImage:(CVOpenGLESTextureCacheRef _Nonnull)texturecache :(CVImageBufferRef _Nonnull)buffer :(CFDictionaryRef _Nullable)textureAttributes :(GLenum)target :(GLint)internalFormat :(GLsizei)width :(GLsizei)height :(GLenum)format :(GLenum)type :(NSInteger)planeIndex SWIFT_WARN_UNUSED_RESULT;
987
+ + (NSCRender * _Nonnull)setupRender SWIFT_WARN_UNUSED_RESULT;
988
+ + (void)drawFrame:(AVPlayer * _Nonnull)player :(AVPlayerItemVideoOutput * _Nonnull)output :(CGSize)videoSize :(int32_t)internalFormat :(int32_t)format :(BOOL)flipYWebGL;
989
+ + (BOOL)writeToFile:(NSData * _Nonnull)data :(NSString * _Nonnull)path error:(NSError * _Nullable * _Nullable)error;
990
+ - (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER;
991
+ @end
992
+
942
993
 
943
994
  SWIFT_CLASS_NAMED("NSCImageAsset")
944
995
  @interface NSCImageAsset : NSObject
945
996
  + (BOOL)loadImageFromImageSync:(int64_t)context :(UIImage * _Nonnull)image SWIFT_WARN_UNUSED_RESULT;
946
997
  + (void)loadImageFromImage:(int64_t)context :(UIImage * _Nonnull)image :(void (^ _Nonnull)(BOOL))callback;
998
+ + (BOOL)loadImageFromPathSync:(int64_t)asset :(NSString * _Nonnull)path SWIFT_WARN_UNUSED_RESULT;
999
+ + (void)loadImageFromPath:(int64_t)asset :(NSString * _Nonnull)path :(void (^ _Nonnull)(BOOL))callback;
947
1000
  - (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER;
948
1001
  @end
949
1002
 
@@ -959,11 +1012,28 @@ SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, strong) dispatch_que
959
1012
  SWIFT_CLASS_NAMED("NSCRender")
960
1013
  @interface NSCRender : NSObject
961
1014
  - (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER;
962
- - (void)texImage2D:(int32_t)target :(int32_t)level :(int32_t)internalFormat :(int32_t)format :(int32_t)type :(NSCCanvas * _Nonnull)source :(NSCCanvas * _Nonnull)dest :(BOOL)flipYWebGL;
963
- - (void)createSurface;
964
1015
  @end
965
1016
 
966
1017
 
1018
+ SWIFT_CLASS_NAMED("NSCVideoFrame")
1019
+ @interface NSCVideoFrame : NSObject
1020
+ - (nonnull instancetype)init SWIFT_UNAVAILABLE;
1021
+ + (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable");
1022
+ @end
1023
+
1024
+ typedef SWIFT_ENUM_NAMED(NSInteger, NSCVideoFrameFormat, "NSCVideoFrameFormat", open) {
1025
+ NSCVideoFrameFormatI420 = 0,
1026
+ NSCVideoFrameFormatI420A = 1,
1027
+ NSCVideoFrameFormatI422 = 2,
1028
+ NSCVideoFrameFormatI444 = 3,
1029
+ NSCVideoFrameFormatNV12 = 4,
1030
+ NSCVideoFrameFormatRGBA = 5,
1031
+ NSCVideoFrameFormatRGBX = 6,
1032
+ NSCVideoFrameFormatBGRA = 7,
1033
+ NSCVideoFrameFormatBGRX = 8,
1034
+ };
1035
+
1036
+
967
1037
  SWIFT_CLASS_NAMED("NSCWebGLRenderingContext")
968
1038
  @interface NSCWebGLRenderingContext : NSObject
969
1039
  + (void)texImage2D:(int64_t)context :(int32_t)target :(int32_t)level :(int32_t)internalformat :(int32_t)format :(int32_t)type :(uint8_t * _Nonnull)data :(NSUInteger)size :(CGSize)dimensions :(BOOL)flipY;
@@ -971,17 +1041,9 @@ SWIFT_CLASS_NAMED("NSCWebGLRenderingContext")
971
1041
  - (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER;
972
1042
  @end
973
1043
 
974
- @class AVPlayer;
975
- @class AVPlayerItemVideoOutput;
976
1044
 
977
- SWIFT_CLASS_NAMED("Utils")
978
- @interface Utils : NSObject
979
- + (CVOpenGLESTextureCacheRef _Nullable)createTextureCache SWIFT_WARN_UNUSED_RESULT;
980
- + (CVOpenGLESTextureRef _Nullable)createImage:(CVOpenGLESTextureCacheRef _Nonnull)texturecache :(CVImageBufferRef _Nonnull)buffer :(CFDictionaryRef _Nullable)textureAttributes :(GLenum)target :(GLint)internalFormat :(GLsizei)width :(GLsizei)height :(GLenum)format :(GLenum)type :(NSInteger)planeIndex SWIFT_WARN_UNUSED_RESULT;
981
- + (NSCRender * _Nonnull)setupRender SWIFT_WARN_UNUSED_RESULT;
982
- + (void)drawFrame:(AVPlayer * _Nonnull)player :(AVPlayerItemVideoOutput * _Nonnull)output :(CGSize)videoSize :(NSCRender * _Nonnull)render :(int32_t)internalFormat :(int32_t)format :(BOOL)flipYWebGL;
983
- + (BOOL)writeToFile:(NSData * _Nonnull)data :(NSString * _Nonnull)path error:(NSError * _Nullable * _Nullable)error;
984
- - (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER;
1045
+ @interface UIView (SWIFT_EXTENSION(CanvasNative))
1046
+ - (void)getBoundingClientRect:(void * _Nonnull)buffer;
985
1047
  @end
986
1048
 
987
1049
  #endif
@@ -13,6 +13,7 @@ extern "C" {
13
13
 
14
14
  #import "canvas_native.h"
15
15
  #import "canvas_ios.h"
16
+ #import "NSCMTLView.h"
16
17
 
17
18
  //! Project version number for CanvasNative.
18
19
 
@@ -0,0 +1,32 @@
1
+ //
2
+ // NSCMTLView.h
3
+ // CanvasNative
4
+ //
5
+ // Created by Osei Fortune on 08/10/2024.
6
+ //
7
+ #ifndef NSCMTLView_h
8
+ #define NSCMTLView_h
9
+
10
+ #import <Foundation/Foundation.h>
11
+ #import <UIKit/UIKit.h>
12
+ #import <MetalKit/MetalKit.h>
13
+ typedef enum {
14
+ kNone,
15
+ kPending,
16
+ kInvalidating
17
+ } NSCSurfaceState;
18
+
19
+ @interface NSCMTLView : UIView
20
+ @property(weak, nonatomic) UIView* canvas;
21
+ @property id<MTLCommandQueue> queue;
22
+ @property int state;
23
+ @property (nonatomic) CGSize drawableSize;
24
+ @property NSUInteger sampleCount;
25
+ -(void) present;
26
+ -(void) setup;
27
+ -(void*) getDevicePtr;
28
+ -(void*) getQueuePtr;
29
+ @end
30
+
31
+
32
+ #endif /* NSCMTLView_h */