@nativescript/canvas 2.0.0-alpha.20 → 2.0.0-alpha.21

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 (234) hide show
  1. package/Canvas/common.d.ts +2 -0
  2. package/Canvas/common.js +6 -0
  3. package/Canvas/common.js.map +1 -1
  4. package/Canvas/index.android.d.ts +0 -2
  5. package/Canvas/index.android.js +8 -22
  6. package/Canvas/index.android.js.map +1 -1
  7. package/Canvas/index.d.ts +7 -0
  8. package/Canvas/index.ios.d.ts +0 -2
  9. package/Canvas/index.ios.js +7 -26
  10. package/Canvas/index.ios.js.map +1 -1
  11. package/Canvas2D/CanvasGradient/index.d.ts +1 -3
  12. package/Canvas2D/CanvasGradient/index.js +1 -10
  13. package/Canvas2D/CanvasGradient/index.js.map +1 -1
  14. package/Canvas2D/CanvasPattern/index.d.ts +1 -3
  15. package/Canvas2D/CanvasPattern/index.js +1 -10
  16. package/Canvas2D/CanvasPattern/index.js.map +1 -1
  17. package/Canvas2D/CanvasRenderingContext2D/index.d.ts +0 -2
  18. package/Canvas2D/CanvasRenderingContext2D/index.js +120 -138
  19. package/Canvas2D/CanvasRenderingContext2D/index.js.map +1 -1
  20. package/Canvas2D/DOMMatrix/index.js +3 -3
  21. package/Canvas2D/DOMMatrix/index.js.map +1 -1
  22. package/Canvas2D/ImageData/index.js +5 -5
  23. package/Canvas2D/ImageData/index.js.map +1 -1
  24. package/Canvas2D/Path2D/index.d.ts +0 -2
  25. package/Canvas2D/Path2D/index.js +34 -39
  26. package/Canvas2D/Path2D/index.js.map +1 -1
  27. package/ImageAsset/index.d.ts +2 -2
  28. package/ImageAsset/index.js +33 -37
  29. package/ImageAsset/index.js.map +1 -1
  30. package/ImageBitmap/index.d.ts +0 -2
  31. package/ImageBitmap/index.js +23 -29
  32. package/ImageBitmap/index.js.map +1 -1
  33. package/SVG/SVG.js +1 -1
  34. package/TextDecoder/index.d.ts +0 -2
  35. package/TextDecoder/index.js +3 -12
  36. package/TextDecoder/index.js.map +1 -1
  37. package/TextEncoder/index.d.ts +0 -2
  38. package/TextEncoder/index.js +4 -13
  39. package/TextEncoder/index.js.map +1 -1
  40. package/WebGL/WebGLExtensions/index.d.ts +0 -9
  41. package/WebGL/WebGLExtensions/index.js +17 -74
  42. package/WebGL/WebGLExtensions/index.js.map +1 -1
  43. package/WebGL/WebGLRenderingContext/common.d.ts +0 -2
  44. package/WebGL/WebGLRenderingContext/common.js +0 -10
  45. package/WebGL/WebGLRenderingContext/common.js.map +1 -1
  46. package/WebGL/WebGLRenderingContext/index.js +159 -298
  47. package/WebGL/WebGLRenderingContext/index.js.map +1 -1
  48. package/WebGL2/WebGL2RenderingContext/index.js +107 -195
  49. package/WebGL2/WebGL2RenderingContext/index.js.map +1 -1
  50. package/angular/esm2020/index.mjs +5 -5
  51. package/angular/fesm2015/nativescript-canvas-angular.mjs +4 -4
  52. package/angular/fesm2015/nativescript-canvas-angular.mjs.map +1 -1
  53. package/angular/fesm2020/nativescript-canvas-angular.mjs +4 -4
  54. package/angular/fesm2020/nativescript-canvas-angular.mjs.map +1 -1
  55. package/index.js.map +1 -1
  56. package/package.json +1 -1
  57. package/platforms/android/canvas-release.aar +0 -0
  58. package/platforms/android/include.gradle +15 -0
  59. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/CanvasNative +0 -0
  60. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Headers/CanvasNative-Swift.h +87 -57
  61. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Headers/CanvasNative.h +10 -0
  62. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Headers/canvas_ios.h +142 -0
  63. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Headers/canvas_native.h +2589 -110
  64. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Info.plist +0 -0
  65. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/Project/arm64-apple-ios.swiftsourceinfo +0 -0
  66. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios.abi.json +1174 -89
  67. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios.private.swiftinterface +2 -2
  68. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  69. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios.swiftinterface +2 -2
  70. package/platforms/ios/CanvasNative.xcframework/ios-arm64/dSYMs/CanvasNative.framework.dSYM/Contents/Resources/DWARF/CanvasNative +0 -0
  71. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/CanvasNative +0 -0
  72. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Headers/CanvasNative-Swift.h +174 -114
  73. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Headers/CanvasNative.h +10 -0
  74. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Headers/canvas_ios.h +142 -0
  75. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Headers/canvas_native.h +2589 -110
  76. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Info.plist +0 -0
  77. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/Project/arm64-apple-ios-simulator.swiftsourceinfo +0 -0
  78. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/Project/x86_64-apple-ios-simulator.swiftsourceinfo +0 -0
  79. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.abi.json +1174 -89
  80. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +2 -2
  81. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
  82. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.swiftinterface +2 -2
  83. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.abi.json +1174 -89
  84. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +2 -2
  85. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
  86. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +2 -2
  87. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/_CodeSignature/CodeResources +42 -31
  88. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/dSYMs/CanvasNative.framework.dSYM/Contents/Resources/DWARF/CanvasNative +0 -0
  89. package/platforms/ios/Podfile +3 -0
  90. package/platforms/ios/build.xcconfig +3 -3
  91. package/platforms/ios/src/CanvasModule.h +0 -2
  92. package/platforms/ios/src/CanvasModule.mm +4 -4
  93. package/platforms/ios/src/NSOperationQueueWrapper.h +11 -0
  94. package/platforms/ios/src/NSOperationQueueWrapper.mm +74 -0
  95. package/platforms/ios/src/cpp/Caches.cpp +35 -0
  96. package/platforms/ios/src/cpp/Caches.h +186 -0
  97. package/platforms/ios/src/cpp/CanvasJSIModule.cpp +1582 -0
  98. package/platforms/ios/src/cpp/CanvasJSIModule.h +7 -34
  99. package/platforms/ios/src/cpp/Common.h +30 -0
  100. package/platforms/ios/src/cpp/ConcurrentMap.h +54 -0
  101. package/platforms/ios/src/cpp/Helpers.h +304 -38
  102. package/platforms/ios/src/cpp/ImageAssetImpl.cpp +802 -0
  103. package/platforms/ios/src/cpp/ImageAssetImpl.h +44 -12
  104. package/platforms/ios/src/cpp/ImageBitmapImpl.cpp +189 -0
  105. package/platforms/ios/src/cpp/ImageBitmapImpl.h +22 -16
  106. package/platforms/ios/src/cpp/JSICallback.h +61 -5
  107. package/platforms/ios/src/cpp/JSIReadFileCallback.h +86 -6
  108. package/platforms/ios/src/cpp/JSIRuntime.cpp +21 -0
  109. package/platforms/ios/src/cpp/JSIRuntime.h +7 -0
  110. package/platforms/ios/src/cpp/OneByteStringResource.cpp +25 -0
  111. package/platforms/ios/src/cpp/OneByteStringResource.h +21 -0
  112. package/platforms/ios/src/cpp/RafImpl.cpp +8 -0
  113. package/platforms/ios/src/cpp/RafImpl.h +11 -8
  114. package/platforms/ios/src/cpp/TextDecoderImpl.cpp +188 -0
  115. package/platforms/ios/src/cpp/TextDecoderImpl.h +20 -14
  116. package/platforms/ios/src/cpp/TextEncoderImpl.cpp +139 -0
  117. package/platforms/ios/src/cpp/TextEncoderImpl.h +20 -11
  118. package/platforms/ios/src/cpp/canvas2d/CanvasGradient.cpp +71 -0
  119. package/platforms/ios/src/cpp/canvas2d/CanvasGradient.h +27 -13
  120. package/platforms/ios/src/cpp/canvas2d/CanvasPattern.cpp +89 -0
  121. package/platforms/ios/src/cpp/canvas2d/CanvasPattern.h +26 -13
  122. package/platforms/ios/src/cpp/canvas2d/CanvasRenderingContext2DImpl.cpp +2402 -0
  123. package/platforms/ios/src/cpp/canvas2d/CanvasRenderingContext2DImpl.h +264 -21
  124. package/platforms/ios/src/cpp/canvas2d/ImageDataImpl.cpp +203 -0
  125. package/platforms/ios/src/cpp/canvas2d/ImageDataImpl.h +26 -12
  126. package/platforms/ios/src/cpp/canvas2d/MatrixImpl.cpp +800 -0
  127. package/platforms/ios/src/cpp/canvas2d/MatrixImpl.h +172 -13
  128. package/platforms/ios/src/cpp/canvas2d/Path2D.cpp +449 -0
  129. package/platforms/ios/src/cpp/canvas2d/Path2D.h +41 -12
  130. package/platforms/ios/src/cpp/canvas2d/TextMetricsImpl.cpp +253 -0
  131. package/platforms/ios/src/cpp/canvas2d/TextMetricsImpl.h +50 -12
  132. package/platforms/ios/src/cpp/gl.h +57 -7
  133. package/platforms/ios/src/cpp/gl3stub.c +425 -0
  134. package/platforms/ios/src/cpp/gl3stub.h +665 -0
  135. package/platforms/ios/src/cpp/gles3jni.h +37 -0
  136. package/platforms/ios/src/cpp/include/robin_hood.h +2544 -0
  137. package/platforms/ios/src/cpp/webgl/WebGLActiveInfoImpl.cpp +93 -0
  138. package/platforms/ios/src/cpp/webgl/WebGLActiveInfoImpl.h +33 -13
  139. package/platforms/ios/src/cpp/webgl/WebGLBuffer.h +41 -6
  140. package/platforms/ios/src/cpp/webgl/WebGLFramebuffer.h +46 -10
  141. package/platforms/ios/src/cpp/webgl/WebGLProgram.h +40 -5
  142. package/platforms/ios/src/cpp/webgl/WebGLRenderbuffer.h +40 -6
  143. package/platforms/ios/src/cpp/webgl/WebGLRenderingContext.cpp +6691 -0
  144. package/platforms/ios/src/cpp/webgl/WebGLRenderingContext.h +261 -390
  145. package/platforms/ios/src/cpp/webgl/{WebGLRenderingContextBase.mm → WebGLRenderingContextBase.cpp} +17 -16
  146. package/platforms/ios/src/cpp/webgl/WebGLRenderingContextBase.h +15 -36
  147. package/platforms/ios/src/cpp/webgl/WebGLShader.h +40 -6
  148. package/platforms/ios/src/cpp/webgl/WebGLShaderPrecisionFormatImpl.cpp +50 -0
  149. package/platforms/ios/src/cpp/webgl/WebGLShaderPrecisionFormatImpl.h +66 -11
  150. package/platforms/ios/src/cpp/webgl/WebGLTexture.h +40 -6
  151. package/platforms/ios/src/cpp/webgl/WebGLUniformLocation.h +44 -8
  152. package/platforms/ios/src/cpp/webgl/extensions/ANGLE_instanced_arraysImpl.cpp +126 -0
  153. package/platforms/ios/src/cpp/webgl/extensions/ANGLE_instanced_arraysImpl.h +25 -12
  154. package/platforms/ios/src/cpp/webgl/extensions/EXT_blend_minmaxImpl.cpp +35 -0
  155. package/platforms/ios/src/cpp/webgl/extensions/EXT_blend_minmaxImpl.h +25 -5
  156. package/platforms/ios/src/cpp/webgl/extensions/EXT_color_buffer_half_floatImpl.cpp +41 -0
  157. package/platforms/ios/src/cpp/webgl/extensions/EXT_color_buffer_half_floatImpl.h +25 -5
  158. package/platforms/ios/src/cpp/webgl/extensions/EXT_disjoint_timer_queryImpl.cpp +323 -0
  159. package/platforms/ios/src/cpp/webgl/extensions/EXT_disjoint_timer_queryImpl.h +47 -13
  160. package/platforms/ios/src/cpp/webgl/extensions/EXT_sRGBImpl.h +49 -6
  161. package/platforms/ios/src/cpp/webgl/extensions/EXT_shader_texture_lodImpl.h +37 -15
  162. package/platforms/ios/src/cpp/webgl/extensions/EXT_texture_filter_anisotropicImpl.h +47 -6
  163. package/platforms/ios/src/cpp/webgl/extensions/OES_element_index_uintImpl.h +49 -6
  164. package/platforms/ios/src/cpp/webgl/extensions/OES_fbo_render_mipmap.h +36 -15
  165. package/platforms/ios/src/cpp/webgl/extensions/OES_standard_derivativesImpl.h +44 -6
  166. package/platforms/ios/src/cpp/webgl/extensions/OES_texture_floatImpl.h +38 -15
  167. package/platforms/ios/src/cpp/webgl/extensions/OES_texture_float_linearImpl.h +37 -16
  168. package/platforms/ios/src/cpp/webgl/extensions/OES_texture_half_floatImpl.h +41 -6
  169. package/platforms/ios/src/cpp/webgl/extensions/OES_texture_half_float_linearImpl.h +40 -16
  170. package/platforms/ios/src/cpp/webgl/extensions/OES_vertex_array_objectImpl.cpp +102 -0
  171. package/platforms/ios/src/cpp/webgl/extensions/OES_vertex_array_objectImpl.h +69 -14
  172. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_color_buffer_floatImpl.h +51 -8
  173. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_compressed_texture_atcImpl.h +49 -6
  174. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_compressed_texture_etc1Impl.h +49 -8
  175. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_compressed_texture_etcImpl.h +76 -6
  176. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_compressed_texture_pvrtcImpl.h +57 -6
  177. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_compressed_texture_s3tcImpl.h +53 -6
  178. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_compressed_texture_s3tc_srgbImpl.h +59 -6
  179. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_depth_textureImpl.h +46 -6
  180. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_draw_buffersImpl.cpp +43 -0
  181. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_draw_buffersImpl.h +126 -14
  182. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_lose_contextImpl.cpp +32 -0
  183. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_lose_contextImpl.h +61 -12
  184. package/platforms/ios/src/cpp/webgl2/WebGL2RenderingContext.cpp +4517 -0
  185. package/platforms/ios/src/cpp/webgl2/WebGL2RenderingContext.h +139 -343
  186. package/platforms/ios/src/cpp/webgl2/WebGLQuery.h +40 -4
  187. package/platforms/ios/src/cpp/webgl2/WebGLSampler.h +42 -3
  188. package/platforms/ios/src/cpp/webgl2/WebGLSyncImpl.h +44 -11
  189. package/platforms/ios/src/cpp/webgl2/WebGLTransformFeedback.h +42 -4
  190. package/platforms/ios/src/cpp/webgl2/WebGLVertexArrayObject.h +43 -4
  191. package/platforms/ios/src/module.modulemap +1 -0
  192. package/platforms/ios/src/cpp/CanvasJSIModule.mm +0 -1105
  193. package/platforms/ios/src/cpp/ImageAssetImpl.mm +0 -417
  194. package/platforms/ios/src/cpp/ImageBitmapImpl.mm +0 -126
  195. package/platforms/ios/src/cpp/RafImpl.mm +0 -10
  196. package/platforms/ios/src/cpp/TextDecoderImpl.mm +0 -97
  197. package/platforms/ios/src/cpp/TextEncoderImpl.mm +0 -60
  198. package/platforms/ios/src/cpp/VecMutableBuffer.h +0 -46
  199. package/platforms/ios/src/cpp/canvas-cxx/src/lib.rs.cc +0 -6156
  200. package/platforms/ios/src/cpp/canvas-cxx/src/lib.rs.h +0 -2867
  201. package/platforms/ios/src/cpp/canvas2d/CanvasGradient.mm +0 -42
  202. package/platforms/ios/src/cpp/canvas2d/CanvasPattern.mm +0 -49
  203. package/platforms/ios/src/cpp/canvas2d/CanvasRenderingContext2DImpl.mm +0 -1972
  204. package/platforms/ios/src/cpp/canvas2d/ImageDataImpl.mm +0 -68
  205. package/platforms/ios/src/cpp/canvas2d/MatrixImpl.mm +0 -149
  206. package/platforms/ios/src/cpp/canvas2d/Path2D.mm +0 -335
  207. package/platforms/ios/src/cpp/canvas2d/TextMetricsImpl.mm +0 -68
  208. package/platforms/ios/src/cpp/rust/cxx.cc +0 -793
  209. package/platforms/ios/src/cpp/rust/cxx.h +0 -1111
  210. package/platforms/ios/src/cpp/webgl/WebGLActiveInfoImpl.mm +0 -39
  211. package/platforms/ios/src/cpp/webgl/WebGLRenderingContext.mm +0 -5958
  212. package/platforms/ios/src/cpp/webgl/WebGLShaderPrecisionFormatImpl.mm +0 -40
  213. package/platforms/ios/src/cpp/webgl/extensions/ANGLE_instanced_arraysImpl.mm +0 -108
  214. package/platforms/ios/src/cpp/webgl/extensions/EXT_blend_minmaxImpl.mm +0 -28
  215. package/platforms/ios/src/cpp/webgl/extensions/EXT_color_buffer_half_floatImpl.mm +0 -42
  216. package/platforms/ios/src/cpp/webgl/extensions/EXT_disjoint_timer_queryImpl.mm +0 -295
  217. package/platforms/ios/src/cpp/webgl/extensions/EXT_sRGBImpl.mm +0 -40
  218. package/platforms/ios/src/cpp/webgl/extensions/EXT_texture_filter_anisotropicImpl.mm +0 -37
  219. package/platforms/ios/src/cpp/webgl/extensions/OES_element_index_uintImpl.mm +0 -28
  220. package/platforms/ios/src/cpp/webgl/extensions/OES_standard_derivativesImpl.mm +0 -31
  221. package/platforms/ios/src/cpp/webgl/extensions/OES_texture_half_floatImpl.mm +0 -28
  222. package/platforms/ios/src/cpp/webgl/extensions/OES_vertex_array_objectImpl.mm +0 -127
  223. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_color_buffer_floatImpl.mm +0 -45
  224. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_compressed_texture_atcImpl.mm +0 -45
  225. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_compressed_texture_etc1Impl.mm +0 -31
  226. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_compressed_texture_etcImpl.mm +0 -70
  227. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_compressed_texture_pvrtcImpl.mm +0 -47
  228. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_compressed_texture_s3tcImpl.mm +0 -46
  229. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_compressed_texture_s3tc_srgbImpl.mm +0 -49
  230. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_depth_textureImpl.mm +0 -30
  231. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_draw_buffersImpl.mm +0 -177
  232. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_lose_contextImpl.mm +0 -64
  233. package/platforms/ios/src/cpp/webgl2/WebGL2RenderingContext.mm +0 -4551
  234. /package/platforms/ios/src/cpp/{OnRafCallback.mm → OnRafCallback.cpp} +0 -0
@@ -4,29 +4,84 @@
4
4
 
5
5
  #pragma once
6
6
 
7
- #include "canvas-cxx/src/lib.rs.h"
8
- #include "rust/cxx.h"
9
- #import <NativeScript/JSIRuntime.h>
10
7
  #include "gl.h"
11
- #include "../../webgl2/WebGLVertexArrayObject.h"
8
+ #include "WebGLVertexArrayObject.h"
12
9
  #include "Helpers.h"
13
10
  #include <vector>
14
11
 
15
- using namespace facebook;
16
- using namespace org::nativescript::canvas;
17
-
18
- class JSI_EXPORT OES_vertex_array_objectImpl : public jsi::HostObject {
12
+ class OES_vertex_array_objectImpl {
19
13
  public:
20
- OES_vertex_array_objectImpl(rust::Box<OES_vertex_array_object> object);
14
+ OES_vertex_array_objectImpl(OES_vertex_array_object* object);
15
+ ~OES_vertex_array_objectImpl(){
16
+ canvas_native_webgl_OES_vertex_array_object_destroy(this->GetVertexArrayObject());
17
+ this->object_ = nullptr;
18
+ }
19
+
20
+ static v8::Local<v8::FunctionTemplate> GetCtor(v8::Isolate *isolate) {
21
+ auto cache = Caches::Get(isolate);
22
+ auto ctor = cache->OES_vertex_array_objectTmpl.get();
23
+ if (ctor != nullptr) {
24
+ return ctor->Get(isolate);
25
+ }
26
+
27
+ v8::Local<v8::FunctionTemplate> ctorTmpl = v8::FunctionTemplate::New(isolate);
28
+ ctorTmpl->InstanceTemplate()->SetInternalFieldCount(1);
29
+ ctorTmpl->SetClassName(ConvertToV8String(isolate, "OES_vertex_array_object"));
21
30
 
22
- OES_vertex_array_object &GetVertexArrayObject() {
23
- return *this->object_;
31
+ auto tmpl = ctorTmpl->InstanceTemplate();
32
+ tmpl->SetInternalFieldCount(1);
33
+ tmpl->Set(ConvertToV8String(isolate, "ext_name"),
34
+ ConvertToV8String(isolate, "OES_vertex_array_object"));
35
+ tmpl->Set(ConvertToV8String(isolate, "VERTEX_ARRAY_BINDING_OES"),
36
+ v8::Number::New(isolate, (double) GL_VERTEX_ARRAY_BINDING_OES));
37
+ tmpl->Set(ConvertToV8String(isolate, "createVertexArrayOES"),
38
+ v8::FunctionTemplate::New(isolate, &CreateVertexArrayOES));
39
+ tmpl->Set(ConvertToV8String(isolate, "deleteVertexArrayOES"),
40
+ v8::FunctionTemplate::New(isolate, &DeleteVertexArrayOES));
41
+ tmpl->Set(ConvertToV8String(isolate, "isVertexArrayOES"),
42
+ v8::FunctionTemplate::New(isolate, &IsVertexArrayOES));
43
+ tmpl->Set(ConvertToV8String(isolate, "bindVertexArrayOES"),
44
+ v8::FunctionTemplate::New(isolate, &BindVertexArrayOES));
45
+
46
+
47
+ cache->OES_vertex_array_objectTmpl =
48
+ std::make_unique<v8::Persistent<v8::FunctionTemplate>>(isolate, ctorTmpl);
49
+ return ctorTmpl;
24
50
  }
25
51
 
26
- jsi::Value get(jsi::Runtime &, const jsi::PropNameID &name) override;
52
+ static v8::Local<v8::Object>
53
+ NewInstance(v8::Isolate *isolate, OES_vertex_array_objectImpl *vertexArrayObject) {
54
+ auto context = isolate->GetCurrentContext();
55
+ v8::EscapableHandleScope scope(isolate);
56
+ auto object = OES_vertex_array_objectImpl::GetCtor(isolate)->GetFunction(
57
+ context).ToLocalChecked()->NewInstance(context).ToLocalChecked();
58
+ SetNativeType(isolate, object, NativeType::OES_vertex_array_object);
59
+ auto ext = v8::External::New(isolate, vertexArrayObject);
60
+ object->SetInternalField(0, ext);
61
+ return scope.Escape(object);
62
+ }
27
63
 
28
- std::vector<jsi::PropNameID> getPropertyNames(jsi::Runtime &rt) override;
64
+ static OES_vertex_array_objectImpl *GetPointer(const v8::Local<v8::Object> &object) {
65
+ auto ptr = object->GetInternalField(0).As<v8::External>()->Value();
66
+ if (ptr == nullptr) {
67
+ return nullptr;
68
+ }
69
+ return static_cast<OES_vertex_array_objectImpl *>(ptr);
70
+ }
71
+
72
+ static void CreateVertexArrayOES(const v8::FunctionCallbackInfo<v8::Value> &args);
73
+
74
+ static void DeleteVertexArrayOES(const v8::FunctionCallbackInfo<v8::Value> &args);
75
+
76
+ static void IsVertexArrayOES(const v8::FunctionCallbackInfo<v8::Value> &args);
77
+
78
+ static void BindVertexArrayOES(const v8::FunctionCallbackInfo<v8::Value> &args);
79
+
80
+
81
+ OES_vertex_array_object * GetVertexArrayObject() {
82
+ return this->object_;
83
+ }
29
84
 
30
85
  private:
31
- rust::Box<OES_vertex_array_object> object_;
86
+ OES_vertex_array_object* object_;
32
87
  };
@@ -4,17 +4,60 @@
4
4
 
5
5
  #define once
6
6
 
7
- #include "rust/cxx.h"
8
- #import <NativeScript/JSIRuntime.h>
9
7
  #include "gl.h"
10
8
  #include <vector>
9
+ #include "Helpers.h"
10
+ #include "Common.h"
11
+ #include "Caches.h"
11
12
 
12
- using namespace facebook;
13
-
14
- class JSI_EXPORT WEBGL_color_buffer_floatImpl : public jsi::HostObject {
13
+ class WEBGL_color_buffer_floatImpl {
15
14
  public:
16
- std::string ext_name_ = "WEBGL_color_buffer_float";
17
- jsi::Value get(jsi::Runtime &, const jsi::PropNameID &name) override;
15
+ static v8::Local<v8::FunctionTemplate> GetCtor(v8::Isolate *isolate) {
16
+ auto cache = Caches::Get(isolate);
17
+ auto ctor = cache->WEBGL_color_buffer_floatTmpl.get();
18
+ if (ctor != nullptr) {
19
+ return ctor->Get(isolate);
20
+ }
21
+
22
+ v8::Local<v8::FunctionTemplate> ctorTmpl = v8::FunctionTemplate::New(isolate);
23
+ ctorTmpl->InstanceTemplate()->SetInternalFieldCount(1);
24
+ ctorTmpl->SetClassName(ConvertToV8String(isolate, "WEBGL_color_buffer_float"));
25
+
26
+ auto tmpl = ctorTmpl->InstanceTemplate();
27
+ tmpl->SetInternalFieldCount(1);
28
+ tmpl->Set(ConvertToV8String(isolate, "ext_name"),
29
+ ConvertToV8String(isolate, "WEBGL_color_buffer_float"));
30
+
31
+ tmpl->Set(ConvertToV8String(isolate, "RGBA32F_EXT"),
32
+ v8::Number::New(isolate, (double) GL_RGBA32F_EXT));
33
+ tmpl->Set(ConvertToV8String(isolate, "RGB32F_EXT"),
34
+ v8::Number::New(isolate, (double) GL_RGB32F_EXT));
35
+ tmpl->Set(ConvertToV8String(isolate, "FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT"),
36
+ v8::Number::New(isolate, (double) GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT));
37
+ tmpl->Set(ConvertToV8String(isolate, "UNSIGNED_NORMALIZED_EXT"),
38
+ v8::Number::New(isolate, (double) GL_UNSIGNED_NORMALIZED_EXT));
39
+ cache->WEBGL_color_buffer_floatTmpl =
40
+ std::make_unique<v8::Persistent<v8::FunctionTemplate>>(isolate, ctorTmpl);
41
+ return ctorTmpl;
42
+ }
43
+
44
+ static v8::Local<v8::Object>
45
+ NewInstance(v8::Isolate *isolate, WEBGL_color_buffer_floatImpl *buffer) {
46
+ auto context = isolate->GetCurrentContext();
47
+ v8::EscapableHandleScope scope(isolate);
48
+ auto object = WEBGL_color_buffer_floatImpl::GetCtor(isolate)->GetFunction(
49
+ context).ToLocalChecked()->NewInstance(context).ToLocalChecked();
50
+ SetNativeType(isolate, object, NativeType::WEBGL_color_buffer_float);
51
+ auto ext = v8::External::New(isolate, buffer);
52
+ object->SetInternalField(0, ext);
53
+ return scope.Escape(object);
54
+ }
18
55
 
19
- std::vector<jsi::PropNameID> getPropertyNames(jsi::Runtime &rt) override;
56
+ static WEBGL_color_buffer_floatImpl *GetPointer(const v8::Local<v8::Object> &object) {
57
+ auto ptr = object->GetInternalField(0).As<v8::External>()->Value();
58
+ if (ptr == nullptr) {
59
+ return nullptr;
60
+ }
61
+ return static_cast<WEBGL_color_buffer_floatImpl *>(ptr);
62
+ }
20
63
  };
@@ -4,15 +4,58 @@
4
4
 
5
5
  #pragma once
6
6
 
7
- #include "rust/cxx.h"
8
- #import <NativeScript/JSIRuntime.h>
9
7
  #include "gl.h"
10
8
  #include <vector>
9
+ #include "Helpers.h"
10
+ #include "Common.h"
11
+ #include "Caches.h"
11
12
 
12
- using namespace facebook;
13
+ class WEBGL_compressed_texture_atcImpl {
14
+ public:
15
+ static v8::Local<v8::FunctionTemplate> GetCtor(v8::Isolate *isolate) {
16
+ auto cache = Caches::Get(isolate);
17
+ auto ctor = cache->WEBGL_compressed_texture_atcTmpl.get();
18
+ if (ctor != nullptr) {
19
+ return ctor->Get(isolate);
20
+ }
13
21
 
14
- class JSI_EXPORT WEBGL_compressed_texture_atcImpl : public jsi::HostObject {
15
- jsi::Value get(jsi::Runtime &, const jsi::PropNameID &name) override;
22
+ v8::Local<v8::FunctionTemplate> ctorTmpl = v8::FunctionTemplate::New(isolate);
23
+ ctorTmpl->InstanceTemplate()->SetInternalFieldCount(1);
24
+ ctorTmpl->SetClassName(ConvertToV8String(isolate, "WEBGL_compressed_texture_atc"));
16
25
 
17
- std::vector<jsi::PropNameID> getPropertyNames(jsi::Runtime &rt) override;
26
+ auto tmpl = ctorTmpl->InstanceTemplate();
27
+ tmpl->SetInternalFieldCount(1);
28
+ tmpl->Set(ConvertToV8String(isolate, "ext_name"),
29
+ ConvertToV8String(isolate, "WEBGL_compressed_texture_atc"));
30
+ tmpl->Set(ConvertToV8String(isolate, "COMPRESSED_RGB_ATC_WEBGL"),
31
+ v8::Number::New(isolate, (double) GL_ATC_RGB_AMD));
32
+ tmpl->Set(ConvertToV8String(isolate, "COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL"),
33
+ v8::Number::New(isolate, (double) GL_ATC_RGBA_EXPLICIT_ALPHA_AMD));
34
+ tmpl->Set(ConvertToV8String(isolate, "COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL"),
35
+ v8::Number::New(isolate, (double) GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD));
36
+
37
+ cache->WEBGL_compressed_texture_atcTmpl =
38
+ std::make_unique<v8::Persistent<v8::FunctionTemplate>>(isolate, ctorTmpl);
39
+ return ctorTmpl;
40
+ }
41
+
42
+ static v8::Local<v8::Object>
43
+ NewInstance(v8::Isolate *isolate, WEBGL_compressed_texture_atcImpl *compressedTextureAtc) {
44
+ auto context = isolate->GetCurrentContext();
45
+ v8::EscapableHandleScope scope(isolate);
46
+ auto object = WEBGL_compressed_texture_atcImpl::GetCtor(isolate)->GetFunction(
47
+ context).ToLocalChecked()->NewInstance(context).ToLocalChecked();
48
+ SetNativeType(isolate, object, NativeType::WEBGL_compressed_texture_atc);
49
+ auto ext = v8::External::New(isolate, compressedTextureAtc);
50
+ object->SetInternalField(0, ext);
51
+ return scope.Escape(object);
52
+ }
53
+
54
+ static WEBGL_compressed_texture_atcImpl *GetPointer(const v8::Local<v8::Object> &object) {
55
+ auto ptr = object->GetInternalField(0).As<v8::External>()->Value();
56
+ if (ptr == nullptr) {
57
+ return nullptr;
58
+ }
59
+ return static_cast<WEBGL_compressed_texture_atcImpl *>(ptr);
60
+ }
18
61
  };
@@ -4,15 +4,56 @@
4
4
 
5
5
  #pragma once
6
6
 
7
- #import "rust/cxx.h"
8
- #import <NativeScript/JSIRuntime.h>
9
- #import "gl.h"
10
- #import <vector>
7
+ #include "gl.h"
8
+ #include <vector>
9
+ #include "Common.h"
10
+ #include "Caches.h"
11
+ #include "Helpers.h"
11
12
 
12
- using namespace facebook;
13
+ class WEBGL_compressed_texture_etc1Impl {
14
+ public:
15
+ static v8::Local<v8::FunctionTemplate> GetCtor(v8::Isolate *isolate) {
16
+ auto cache = Caches::Get(isolate);
17
+ auto ctor = cache->WEBGL_compressed_texture_etc1Tmpl.get();
18
+ if (ctor != nullptr) {
19
+ return ctor->Get(isolate);
20
+ }
13
21
 
14
- class JSI_EXPORT WEBGL_compressed_texture_etc1Impl : public jsi::HostObject {
15
- jsi::Value get(jsi::Runtime &, const jsi::PropNameID &name) override;
22
+ v8::Local<v8::FunctionTemplate> ctorTmpl = v8::FunctionTemplate::New(isolate);
23
+ ctorTmpl->InstanceTemplate()->SetInternalFieldCount(1);
24
+ ctorTmpl->SetClassName(ConvertToV8String(isolate, "WEBGL_compressed_texture_etc1"));
16
25
 
17
- std::vector<jsi::PropNameID> getPropertyNames(jsi::Runtime &rt) override;
26
+ auto tmpl = ctorTmpl->InstanceTemplate();
27
+ tmpl->SetInternalFieldCount(1);
28
+
29
+
30
+ tmpl->Set(ConvertToV8String(isolate, "ext_name"),
31
+ ConvertToV8String(isolate, "WEBGL_compressed_texture_etc1"));
32
+ tmpl->Set(ConvertToV8String(isolate, "COMPRESSED_RGB_ETC1_WEBGL"),
33
+ v8::Number::New(isolate, GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG));
34
+
35
+ cache->WEBGL_compressed_texture_etc1Tmpl =
36
+ std::make_unique<v8::Persistent<v8::FunctionTemplate>>(isolate, ctorTmpl);
37
+ return ctorTmpl;
38
+ }
39
+
40
+ static v8::Local<v8::Object>
41
+ NewInstance(v8::Isolate *isolate, WEBGL_compressed_texture_etc1Impl *compressedTextureEtc1) {
42
+ auto context = isolate->GetCurrentContext();
43
+ v8::EscapableHandleScope scope(isolate);
44
+ auto object = WEBGL_compressed_texture_etc1Impl::GetCtor(isolate)->GetFunction(
45
+ context).ToLocalChecked()->NewInstance(context).ToLocalChecked();
46
+ SetNativeType(isolate, object, NativeType::WEBGL_compressed_texture_etc1);
47
+ auto ext = v8::External::New(isolate, compressedTextureEtc1);
48
+ object->SetInternalField(0, ext);
49
+ return scope.Escape(object);
50
+ }
51
+
52
+ static WEBGL_compressed_texture_etc1Impl *GetPointer(const v8::Local<v8::Object> &object) {
53
+ auto ptr = object->GetInternalField(0).As<v8::External>()->Value();
54
+ if (ptr == nullptr) {
55
+ return nullptr;
56
+ }
57
+ return static_cast<WEBGL_compressed_texture_etc1Impl *>(ptr);
58
+ }
18
59
  };
@@ -4,15 +4,85 @@
4
4
 
5
5
  #pragma once
6
6
 
7
- #include "rust/cxx.h"
8
- #import <NativeScript/JSIRuntime.h>
9
7
  #include "gl.h"
10
8
  #include <vector>
9
+ #include "Helpers.h"
10
+ #include "Common.h"
11
+ #include "Caches.h"
11
12
 
12
- using namespace facebook;
13
+ class WEBGL_compressed_texture_etcImpl {
14
+ public:
15
+ static v8::Local<v8::FunctionTemplate> GetCtor(v8::Isolate *isolate) {
16
+ auto cache = Caches::Get(isolate);
17
+ auto ctor = cache->WEBGL_compressed_texture_etcTmpl.get();
18
+ if (ctor != nullptr) {
19
+ return ctor->Get(isolate);
20
+ }
13
21
 
14
- class JSI_EXPORT WEBGL_compressed_texture_etcImpl: public jsi::HostObject{
15
- jsi::Value get(jsi::Runtime &, const jsi::PropNameID &name) override;
22
+ v8::Local<v8::FunctionTemplate> ctorTmpl = v8::FunctionTemplate::New(isolate);
23
+ ctorTmpl->InstanceTemplate()->SetInternalFieldCount(1);
24
+ ctorTmpl->SetClassName(ConvertToV8String(isolate, "WEBGL_compressed_texture_etc"));
16
25
 
17
- std::vector<jsi::PropNameID> getPropertyNames(jsi::Runtime &rt) override;
26
+ auto tmpl = ctorTmpl->InstanceTemplate();
27
+ tmpl->SetInternalFieldCount(1);
28
+
29
+ tmpl->Set(ConvertToV8String(isolate, "COMPRESSED_R11_EAC"),
30
+ v8::Number::New(isolate, (double) GL_COMPRESSED_R11_EAC));
31
+
32
+ tmpl->Set(ConvertToV8String(isolate, "COMPRESSED_SIGNED_R11_EAC"),
33
+ v8::Number::New(isolate, (double) GL_COMPRESSED_SIGNED_R11_EAC));
34
+
35
+ tmpl->Set(ConvertToV8String(isolate, "COMPRESSED_RG11_EAC"),
36
+ v8::Number::New(isolate, (double) GL_COMPRESSED_RG11_EAC));
37
+
38
+ tmpl->Set(ConvertToV8String(isolate, "COMPRESSED_SIGNED_RG11_EAC"),
39
+ v8::Number::New(isolate, (double) GL_COMPRESSED_SIGNED_RG11_EAC));
40
+
41
+ tmpl->Set(ConvertToV8String(isolate, "COMPRESSED_RGB8_ETC2"),
42
+ v8::Number::New(isolate, (double) GL_COMPRESSED_RGB8_ETC2));
43
+
44
+ tmpl->Set(ConvertToV8String(isolate, "COMPRESSED_RGBA8_ETC2_EAC"),
45
+ v8::Number::New(isolate, (double) GL_COMPRESSED_RGBA8_ETC2_EAC));
46
+
47
+ tmpl->Set(ConvertToV8String(isolate, "COMPRESSED_SRGB8_ETC2"),
48
+ v8::Number::New(isolate, (double) GL_COMPRESSED_SRGB8_ETC2));
49
+
50
+ tmpl->Set(ConvertToV8String(isolate, "COMPRESSED_SRGB8_ALPHA8_ETC2_EAC"),
51
+ v8::Number::New(isolate, (double) GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC));
52
+
53
+ tmpl->Set(ConvertToV8String(isolate, "COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2"),
54
+ v8::Number::New(isolate, (double) GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2));
55
+
56
+ tmpl->Set(ConvertToV8String(isolate, "COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2"),
57
+ v8::Number::New(isolate, (double) GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2));
58
+
59
+ tmpl->Set(ConvertToV8String(isolate, "ext_name"),
60
+ ConvertToV8String(isolate, "WEBGL_compressed_texture_etc"));
61
+
62
+ cache->WEBGL_compressed_texture_etcTmpl =
63
+ std::make_unique<v8::Persistent<v8::FunctionTemplate>>(isolate, ctorTmpl);
64
+ return ctorTmpl;
65
+ }
66
+
67
+ static v8::Local<v8::Object>
68
+ NewInstance(v8::Isolate *isolate, WEBGL_compressed_texture_etcImpl *compressedTextureEtc) {
69
+ auto context = isolate->GetCurrentContext();
70
+ v8::EscapableHandleScope scope(isolate);
71
+ auto object = WEBGL_compressed_texture_etcImpl::GetCtor(isolate)->GetFunction(
72
+ context).ToLocalChecked()->NewInstance(context).ToLocalChecked();
73
+ SetNativeType(isolate, object, NativeType::WEBGL_compressed_texture_etc);
74
+ auto ext = v8::External::New(isolate, compressedTextureEtc);
75
+ object->SetInternalField(0, ext);
76
+ object->Set(context, ConvertToV8String(isolate, "ext_name"),
77
+ ConvertToV8String(isolate, "WEBGL_compressed_texture_etc"));
78
+ return scope.Escape(object);
79
+ }
80
+
81
+ static WEBGL_compressed_texture_etcImpl *GetPointer(const v8::Local<v8::Object> &object) {
82
+ auto ptr = object->GetInternalField(0).As<v8::External>()->Value();
83
+ if (ptr == nullptr) {
84
+ return nullptr;
85
+ }
86
+ return static_cast<WEBGL_compressed_texture_etcImpl *>(ptr);
87
+ }
18
88
  };
@@ -4,15 +4,66 @@
4
4
 
5
5
  #pragma once
6
6
 
7
- #include "rust/cxx.h"
8
- #import <NativeScript/JSIRuntime.h>
9
7
  #include "gl.h"
10
8
  #include <vector>
9
+ #include "Helpers.h"
10
+ #include "Common.h"
11
+ #include "Caches.h"
11
12
 
12
- using namespace facebook;
13
13
 
14
- class JSI_EXPORT WEBGL_compressed_texture_pvrtcImpl : public jsi::HostObject {
15
- jsi::Value get(jsi::Runtime &, const jsi::PropNameID &name) override;
14
+ class WEBGL_compressed_texture_pvrtcImpl {
15
+ public:
16
+ static v8::Local<v8::FunctionTemplate> GetCtor(v8::Isolate *isolate) {
17
+ auto cache = Caches::Get(isolate);
18
+ auto ctor = cache->WEBGL_compressed_texture_pvrtcTmpl.get();
19
+ if (ctor != nullptr) {
20
+ return ctor->Get(isolate);
21
+ }
16
22
 
17
- std::vector<jsi::PropNameID> getPropertyNames(jsi::Runtime &rt) override;
23
+ v8::Local<v8::FunctionTemplate> ctorTmpl = v8::FunctionTemplate::New(isolate);
24
+ ctorTmpl->InstanceTemplate()->SetInternalFieldCount(1);
25
+ ctorTmpl->SetClassName(ConvertToV8String(isolate, "WEBGL_compressed_texture_pvrtc"));
26
+
27
+ auto tmpl = ctorTmpl->InstanceTemplate();
28
+ tmpl->SetInternalFieldCount(1);
29
+
30
+ tmpl->Set(ConvertToV8String(isolate, "COMPRESSED_RGB_PVRTC_4BPPV1_IMG"),
31
+ v8::Number::New(isolate, (double) GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG));
32
+
33
+ tmpl->Set(ConvertToV8String(isolate, "COMPRESSED_RGBA_PVRTC_4BPPV1_IMG"),
34
+ v8::Number::New(isolate, (double) GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG));
35
+
36
+ tmpl->Set(ConvertToV8String(isolate, "COMPRESSED_RGB_PVRTC_2BPPV1_IMG"),
37
+ v8::Number::New(isolate, (double) GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG));
38
+
39
+ tmpl->Set(ConvertToV8String(isolate, "COMPRESSED_RGBA_PVRTC_2BPPV1_IMG"),
40
+ v8::Number::New(isolate, (double) GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG));
41
+
42
+ tmpl->Set(ConvertToV8String(isolate, "ext_name"),
43
+ ConvertToV8String(isolate, "WEBGL_compressed_texture_pvrtc"));
44
+
45
+ cache->WEBGL_compressed_texture_pvrtcTmpl =
46
+ std::make_unique<v8::Persistent<v8::FunctionTemplate>>(isolate, ctorTmpl);
47
+ return ctorTmpl;
48
+ }
49
+
50
+ static v8::Local<v8::Object>
51
+ NewInstance(v8::Isolate *isolate, WEBGL_compressed_texture_pvrtcImpl *compressedTexturePvrtc) {
52
+ auto context = isolate->GetCurrentContext();
53
+ v8::EscapableHandleScope scope(isolate);
54
+ auto object = WEBGL_compressed_texture_pvrtcImpl::GetCtor(isolate)->GetFunction(
55
+ context).ToLocalChecked()->NewInstance(context).ToLocalChecked();
56
+ SetNativeType(isolate, object, NativeType::WEBGL_compressed_texture_pvrtc);
57
+ auto ext = v8::External::New(isolate, compressedTexturePvrtc);
58
+ object->SetInternalField(0, ext);
59
+ return scope.Escape(object);
60
+ }
61
+
62
+ static WEBGL_compressed_texture_pvrtcImpl *GetPointer(const v8::Local<v8::Object> &object) {
63
+ auto ptr = object->GetInternalField(0).As<v8::External>()->Value();
64
+ if (ptr == nullptr) {
65
+ return nullptr;
66
+ }
67
+ return static_cast<WEBGL_compressed_texture_pvrtcImpl *>(ptr);
68
+ }
18
69
  };
@@ -4,15 +4,62 @@
4
4
 
5
5
  #pragma once
6
6
 
7
- #include "rust/cxx.h"
8
- #import <NativeScript/JSIRuntime.h>
9
7
  #include "gl.h"
10
8
  #include <vector>
9
+ #include "Helpers.h"
10
+ #include "Common.h"
11
+ #include "Caches.h"
11
12
 
12
- using namespace facebook;
13
+ class WEBGL_compressed_texture_s3tcImpl {
14
+ public:
15
+ static v8::Local<v8::FunctionTemplate> GetCtor(v8::Isolate *isolate) {
16
+ auto cache = Caches::Get(isolate);
17
+ auto ctor = cache->WEBGL_compressed_texture_s3tcTmpl.get();
18
+ if (ctor != nullptr) {
19
+ return ctor->Get(isolate);
20
+ }
13
21
 
14
- class JSI_EXPORT WEBGL_compressed_texture_s3tcImpl : public jsi::HostObject {
15
- jsi::Value get(jsi::Runtime &, const jsi::PropNameID &name) override;
22
+ v8::Local<v8::FunctionTemplate> ctorTmpl = v8::FunctionTemplate::New(isolate);
23
+ ctorTmpl->InstanceTemplate()->SetInternalFieldCount(1);
24
+ ctorTmpl->SetClassName(ConvertToV8String(isolate, "WEBGL_compressed_texture_s3tc"));
16
25
 
17
- std::vector<jsi::PropNameID> getPropertyNames(jsi::Runtime &rt) override;
26
+ auto tmpl = ctorTmpl->InstanceTemplate();
27
+ tmpl->SetInternalFieldCount(1);
28
+
29
+ tmpl->Set(ConvertToV8String(isolate, "COMPRESSED_RGB_S3TC_DXT1_EXT"),
30
+ v8::Number::New(isolate, (double) GL_COMPRESSED_RGB_S3TC_DXT1_EXT));
31
+ tmpl->Set(ConvertToV8String(isolate, "COMPRESSED_RGBA_S3TC_DXT1_EXT"),
32
+ v8::Number::New(isolate, (double) GL_COMPRESSED_RGBA_S3TC_DXT1_EXT));
33
+ tmpl->Set(ConvertToV8String(isolate, "COMPRESSED_RGBA_S3TC_DXT3_EXT"),
34
+ v8::Number::New(isolate, (double) GL_COMPRESSED_RGBA_S3TC_DXT3_EXT));
35
+ tmpl->Set(ConvertToV8String(isolate, "COMPRESSED_RGBA_S3TC_DXT5_EXT"),
36
+ v8::Number::New(isolate, (double) GL_COMPRESSED_RGBA_S3TC_DXT5_EXT));
37
+
38
+ tmpl->Set(ConvertToV8String(isolate, "ext_name"),
39
+ ConvertToV8String(isolate, "WEBGL_compressed_texture_s3tc"));
40
+
41
+ cache->WEBGL_compressed_texture_s3tcTmpl =
42
+ std::make_unique<v8::Persistent<v8::FunctionTemplate>>(isolate, ctorTmpl);
43
+ return ctorTmpl;
44
+ }
45
+
46
+ static v8::Local<v8::Object>
47
+ NewInstance(v8::Isolate *isolate, WEBGL_compressed_texture_s3tcImpl *textureS3Tc) {
48
+ auto context = isolate->GetCurrentContext();
49
+ v8::EscapableHandleScope scope(isolate);
50
+ auto object = WEBGL_compressed_texture_s3tcImpl::GetCtor(isolate)->GetFunction(
51
+ context).ToLocalChecked()->NewInstance(context).ToLocalChecked();
52
+ SetNativeType(isolate, object, NativeType::WEBGL_compressed_texture_s3tc);
53
+ auto ext = v8::External::New(isolate, textureS3Tc);
54
+ object->SetInternalField(0, ext);
55
+ return scope.Escape(object);
56
+ }
57
+
58
+ static WEBGL_compressed_texture_s3tcImpl *GetPointer(const v8::Local<v8::Object> &object) {
59
+ auto ptr = object->GetInternalField(0).As<v8::External>()->Value();
60
+ if (ptr == nullptr) {
61
+ return nullptr;
62
+ }
63
+ return static_cast<WEBGL_compressed_texture_s3tcImpl *>(ptr);
64
+ }
18
65
  };
@@ -4,16 +4,69 @@
4
4
 
5
5
  #pragma once
6
6
 
7
- #include "rust/cxx.h"
8
- #import <NativeScript/JSIRuntime.h>
9
7
  #include "gl.h"
10
8
  #include <vector>
9
+ #include "Caches.h"
10
+ #include "Common.h"
11
+ #include "Helpers.h"
11
12
 
12
- using namespace facebook;
13
+ class WEBGL_compressed_texture_s3tc_srgbImpl {
14
+ public:
15
+ static v8::Local<v8::FunctionTemplate> GetCtor(v8::Isolate *isolate) {
16
+ auto cache = Caches::Get(isolate);
17
+ auto ctor = cache->WEBGL_compressed_texture_s3tc_srgbTmpl.get();
18
+ if (ctor != nullptr) {
19
+ return ctor->Get(isolate);
20
+ }
13
21
 
14
- class JSI_EXPORT WEBGL_compressed_texture_s3tc_srgbImpl : public jsi::HostObject {
15
- jsi::Value get(jsi::Runtime &, const jsi::PropNameID &name) override;
22
+ v8::Local<v8::FunctionTemplate> ctorTmpl = v8::FunctionTemplate::New(isolate);
23
+ ctorTmpl->InstanceTemplate()->SetInternalFieldCount(1);
24
+ ctorTmpl->SetClassName(ConvertToV8String(isolate, "WEBGL_compressed_texture_s3tc_srgb"));
16
25
 
17
- std::vector<jsi::PropNameID> getPropertyNames(jsi::Runtime &rt) override;
26
+ auto tmpl = ctorTmpl->InstanceTemplate();
27
+ tmpl->SetInternalFieldCount(1);
28
+
29
+ tmpl->Set(ConvertToV8String(isolate, "COMPRESSED_SRGB_S3TC_DXT1_EXT"),
30
+ v8::Number::New(isolate, (double) GL_COMPRESSED_SRGB_S3TC_DXT1_EXT));
31
+
32
+ tmpl->Set(ConvertToV8String(isolate, "COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT"),
33
+ v8::Number::New(isolate, (double) GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT));
34
+
35
+ tmpl->Set(ConvertToV8String(isolate, "COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT"),
36
+ v8::Number::New(isolate, (double) GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT));
37
+
38
+ tmpl->Set(ConvertToV8String(isolate, "COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT"),
39
+ v8::Number::New(isolate, (double) GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT));
40
+
41
+ tmpl->Set(ConvertToV8String(isolate, "ext_name"),
42
+ ConvertToV8String(isolate, "WEBGL_compressed_texture_s3tc_srgb"));
43
+
44
+ cache->WEBGL_compressed_texture_s3tc_srgbTmpl =
45
+ std::make_unique<v8::Persistent<v8::FunctionTemplate>>(isolate, ctorTmpl);
46
+ return ctorTmpl;
47
+ }
48
+
49
+ static v8::Local<v8::Object>
50
+ NewInstance(v8::Isolate *isolate,
51
+ WEBGL_compressed_texture_s3tc_srgbImpl *compressedTextureS3TcSrgb) {
52
+ auto context = isolate->GetCurrentContext();
53
+ v8::EscapableHandleScope scope(isolate);
54
+ auto object = WEBGL_compressed_texture_s3tc_srgbImpl::GetCtor(isolate)->GetFunction(
55
+ context).ToLocalChecked()->NewInstance(context).ToLocalChecked();
56
+ SetNativeType(isolate, object, NativeType::WEBGL_compressed_texture_s3tc_srgb);
57
+ auto ext = v8::External::New(isolate, compressedTextureS3TcSrgb);
58
+ object->SetInternalField(0, ext);
59
+ object->Set(context, ConvertToV8String(isolate, "ext_name"),
60
+ ConvertToV8String(isolate, "WEBGL_compressed_texture_s3tc_srgb"));
61
+ return scope.Escape(object);
62
+ }
63
+
64
+ static WEBGL_compressed_texture_s3tc_srgbImpl *GetPointer(const v8::Local<v8::Object> &object) {
65
+ auto ptr = object->GetInternalField(0).As<v8::External>()->Value();
66
+ if (ptr == nullptr) {
67
+ return nullptr;
68
+ }
69
+ return static_cast<WEBGL_compressed_texture_s3tc_srgbImpl *>(ptr);
70
+ }
18
71
  };
19
72