@nativescript/canvas 1.1.0-alpha.9 → 2.0.0-alpha.0

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 (168) hide show
  1. package/Canvas/common.d.ts +1 -5
  2. package/Canvas/common.js +31 -69
  3. package/Canvas/common.js.map +1 -1
  4. package/Canvas/index.android.d.ts +4 -4
  5. package/Canvas/index.android.js +62 -55
  6. package/Canvas/index.android.js.map +1 -1
  7. package/Canvas/index.d.ts +0 -4
  8. package/Canvas/index.ios.d.ts +0 -2
  9. package/Canvas/index.ios.js +24 -43
  10. package/Canvas/index.ios.js.map +1 -1
  11. package/Canvas2D/CanvasGradient/CanvasGradient.android.d.ts +2 -0
  12. package/Canvas2D/CanvasGradient/CanvasGradient.android.js +10 -1
  13. package/Canvas2D/CanvasGradient/CanvasGradient.android.js.map +1 -1
  14. package/Canvas2D/CanvasPattern/CanvasPattern.android.d.ts +2 -0
  15. package/Canvas2D/CanvasPattern/CanvasPattern.android.js +10 -1
  16. package/Canvas2D/CanvasPattern/CanvasPattern.android.js.map +1 -1
  17. package/Canvas2D/CanvasPattern/CanvasPattern.ios.d.ts +0 -1
  18. package/Canvas2D/CanvasPattern/CanvasPattern.ios.js +0 -3
  19. package/Canvas2D/CanvasPattern/CanvasPattern.ios.js.map +1 -1
  20. package/Canvas2D/CanvasRenderingContext2D/common.d.ts +1 -3
  21. package/Canvas2D/CanvasRenderingContext2D/common.js.map +1 -1
  22. package/Canvas2D/CanvasRenderingContext2D/index.android.d.ts +5 -6
  23. package/Canvas2D/CanvasRenderingContext2D/index.android.js +188 -394
  24. package/Canvas2D/CanvasRenderingContext2D/index.android.js.map +1 -1
  25. package/Canvas2D/CanvasRenderingContext2D/index.d.ts +0 -6
  26. package/Canvas2D/CanvasRenderingContext2D/index.ios.d.ts +0 -3
  27. package/Canvas2D/CanvasRenderingContext2D/index.ios.js +90 -107
  28. package/Canvas2D/CanvasRenderingContext2D/index.ios.js.map +1 -1
  29. package/Canvas2D/DOMMatrix/DOMMatrix.android.d.ts +24 -0
  30. package/Canvas2D/DOMMatrix/DOMMatrix.android.js +81 -46
  31. package/Canvas2D/DOMMatrix/DOMMatrix.android.js.map +1 -1
  32. package/Canvas2D/DOMMatrix/DOMMatrix.d.ts +3 -2
  33. package/Canvas2D/DOMMatrix/common.d.ts +0 -2
  34. package/Canvas2D/DOMMatrix/common.js +0 -7
  35. package/Canvas2D/DOMMatrix/common.js.map +1 -1
  36. package/Canvas2D/ImageData/ImageData.android.d.ts +4 -5
  37. package/Canvas2D/ImageData/ImageData.android.js +48 -29
  38. package/Canvas2D/ImageData/ImageData.android.js.map +1 -1
  39. package/Canvas2D/ImageData/ImageData.d.ts +4 -2
  40. package/Canvas2D/ImageData/common.d.ts +0 -1
  41. package/Canvas2D/ImageData/common.js +0 -3
  42. package/Canvas2D/ImageData/common.js.map +1 -1
  43. package/Canvas2D/Path2D/Path2D.android.d.ts +3 -2
  44. package/Canvas2D/Path2D/Path2D.android.js +45 -25
  45. package/Canvas2D/Path2D/Path2D.android.js.map +1 -1
  46. package/Canvas2D/Path2D/Path2D.d.ts +0 -4
  47. package/Canvas2D/Path2D/Path2D.ios.d.ts +0 -2
  48. package/Canvas2D/Path2D/Path2D.ios.js +1 -9
  49. package/Canvas2D/Path2D/Path2D.ios.js.map +1 -1
  50. package/Canvas2D/Path2D/common.d.ts +1 -4
  51. package/Canvas2D/Path2D/common.js +2 -6
  52. package/Canvas2D/Path2D/common.js.map +1 -1
  53. package/Canvas2D/TextMetrics/TextMetrics.android.js +12 -12
  54. package/Canvas2D/TextMetrics/TextMetrics.android.js.map +1 -1
  55. package/Canvas2D/TextMetrics/common.d.ts +0 -1
  56. package/Canvas2D/TextMetrics/common.js +0 -3
  57. package/Canvas2D/TextMetrics/common.js.map +1 -1
  58. package/ImageAsset/ImageAsset.android.d.ts +11 -12
  59. package/ImageAsset/ImageAsset.android.js +92 -127
  60. package/ImageAsset/ImageAsset.android.js.map +1 -1
  61. package/ImageAsset/ImageAsset.d.ts +8 -12
  62. package/ImageAsset/ImageAsset.ios.js +3 -3
  63. package/ImageAsset/ImageAsset.ios.js.map +1 -1
  64. package/ImageAsset/common.d.ts +0 -1
  65. package/ImageAsset/common.js +0 -3
  66. package/ImageAsset/common.js.map +1 -1
  67. package/ImageBitmap/common.d.ts +0 -2
  68. package/ImageBitmap/common.js +0 -7
  69. package/ImageBitmap/common.js.map +1 -1
  70. package/ImageBitmap/index.android.d.ts +2 -2
  71. package/ImageBitmap/index.android.js +55 -294
  72. package/ImageBitmap/index.android.js.map +1 -1
  73. package/ImageBitmap/index.ios.d.ts +1 -2
  74. package/ImageBitmap/index.ios.js +34 -23
  75. package/ImageBitmap/index.ios.js.map +1 -1
  76. package/TextDecoder/TextDecoder.android.d.ts +2 -1
  77. package/TextDecoder/TextDecoder.android.js +19 -38
  78. package/TextDecoder/TextDecoder.android.js.map +1 -1
  79. package/TextDecoder/common.d.ts +0 -1
  80. package/TextDecoder/common.js +0 -3
  81. package/TextDecoder/common.js.map +1 -1
  82. package/TextEncoder/TextEncoder.android.d.ts +2 -0
  83. package/TextEncoder/TextEncoder.android.js +19 -5
  84. package/TextEncoder/TextEncoder.android.js.map +1 -1
  85. package/TextEncoder/common.d.ts +0 -2
  86. package/TextEncoder/common.js +0 -7
  87. package/TextEncoder/common.js.map +1 -1
  88. package/WebGL/WebGLActiveInfo.d.ts +5 -8
  89. package/WebGL/WebGLActiveInfo.js +8 -24
  90. package/WebGL/WebGLActiveInfo.js.map +1 -1
  91. package/WebGL/WebGLExtensions/index.android.d.ts +9 -0
  92. package/WebGL/WebGLExtensions/index.android.js +94 -57
  93. package/WebGL/WebGLExtensions/index.android.js.map +1 -1
  94. package/WebGL/WebGLProgram.d.ts +1 -0
  95. package/WebGL/WebGLProgram.js +3 -0
  96. package/WebGL/WebGLProgram.js.map +1 -1
  97. package/WebGL/WebGLRenderingContext/index.android.d.ts +10 -13
  98. package/WebGL/WebGLRenderingContext/index.android.js +449 -952
  99. package/WebGL/WebGLRenderingContext/index.android.js.map +1 -1
  100. package/WebGL/WebGLRenderingContext/index.ios.js +4 -3
  101. package/WebGL/WebGLRenderingContext/index.ios.js.map +1 -1
  102. package/WebGL/WebGLShaderPrecisionFormat.d.ts +5 -4
  103. package/WebGL/WebGLShaderPrecisionFormat.js +11 -4
  104. package/WebGL/WebGLShaderPrecisionFormat.js.map +1 -1
  105. package/WebGL2/WebGL2RenderingContext/common.d.ts +1 -1
  106. package/WebGL2/WebGL2RenderingContext/common.js +199 -199
  107. package/WebGL2/WebGL2RenderingContext/common.js.map +1 -1
  108. package/WebGL2/WebGL2RenderingContext/index.android.d.ts +8 -7
  109. package/WebGL2/WebGL2RenderingContext/index.android.js +290 -328
  110. package/WebGL2/WebGL2RenderingContext/index.android.js.map +1 -1
  111. package/WebGL2/WebGL2RenderingContext/index.ios.js +1 -1
  112. package/WebGL2/WebGL2RenderingContext/index.ios.js.map +1 -1
  113. package/angular/esm2020/index.mjs +4 -4
  114. package/angular/fesm2015/nativescript-canvas-angular.mjs +4 -4
  115. package/angular/fesm2020/nativescript-canvas-angular.mjs +4 -4
  116. package/angular/nativescript-canvas-angular.d.ts +5 -0
  117. package/angular/package.json +2 -2
  118. package/helpers.d.ts +5 -0
  119. package/helpers.js +18 -0
  120. package/helpers.js.map +1 -0
  121. package/index.js +6 -0
  122. package/index.js.map +1 -1
  123. package/package.json +1 -1
  124. package/platforms/android/canvas-release.aar +0 -0
  125. package/platforms/android/include.gradle +5 -6
  126. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/CanvasNative +0 -0
  127. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Headers/CanvasNative-Swift.h +33 -89
  128. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Headers/CanvasNative.h +1 -1
  129. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Info.plist +0 -0
  130. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/Project/arm64-apple-ios.swiftsourceinfo +0 -0
  131. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/Project/arm64.swiftsourceinfo +0 -0
  132. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  133. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios.swiftinterface +22 -49
  134. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64.swiftdoc +0 -0
  135. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/{arm64-apple-ios.private.swiftinterface → arm64.swiftinterface} +22 -49
  136. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/module.modulemap +2 -2
  137. package/platforms/ios/CanvasNative.xcframework/ios-arm64/dSYMs/CanvasNative.framework.dSYM/Contents/Resources/DWARF/CanvasNative +0 -0
  138. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/CanvasNative +0 -0
  139. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Headers/CanvasNative-Swift.h +66 -168
  140. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Headers/CanvasNative.h +1 -1
  141. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Info.plist +0 -0
  142. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/Project/arm64-apple-ios-simulator.swiftsourceinfo +0 -0
  143. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/Project/arm64.swiftsourceinfo +0 -0
  144. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/Project/x86_64-apple-ios-simulator.swiftsourceinfo +0 -0
  145. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/Project/x86_64.swiftsourceinfo +0 -0
  146. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
  147. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.swiftinterface +22 -49
  148. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64.swiftdoc +0 -0
  149. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/{arm64-apple-ios-simulator.private.swiftinterface → arm64.swiftinterface} +22 -49
  150. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
  151. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +22 -49
  152. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64.swiftdoc +0 -0
  153. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/{x86_64-apple-ios-simulator.private.swiftinterface → x86_64.swiftinterface} +22 -49
  154. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/module.modulemap +2 -2
  155. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/_CodeSignature/CodeResources +83 -50
  156. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/dSYMs/CanvasNative.framework.dSYM/Contents/Resources/DWARF/CanvasNative +0 -0
  157. package/utils.d.ts +1 -3
  158. package/utils.js +20 -7
  159. package/utils.js.map +1 -1
  160. package/LICENSE +0 -201
  161. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Headers/canvas_native.h +0 -1636
  162. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios.abi.json +0 -75693
  163. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Headers/canvas_native.h +0 -1636
  164. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.abi.json +0 -75693
  165. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.abi.json +0 -75693
  166. package/typings/objc!CanvasNative.d.ts +0 -2036
  167. package/typings/objc!CanvasNative.js +0 -1
  168. package/typings/objc!CanvasNative.js.map +0 -1
@@ -6,290 +6,300 @@ import { WebGLFramebuffer } from '../../WebGL/WebGLFramebuffer';
6
6
  import { WebGLActiveInfo } from '../../WebGL/WebGLActiveInfo';
7
7
  import { WebGLBuffer } from '../../WebGL/WebGLBuffer';
8
8
  import { ImageAsset } from '../../ImageAsset';
9
- import { ImageSource } from '@nativescript/core';
10
- import { WebGL2RenderingContextBase } from "./common";
9
+ import { ImageSource, Screen } from '@nativescript/core';
10
+ import { WebGL2RenderingContextBase } from './common';
11
11
  import { Canvas } from '../../Canvas';
12
12
  import { ImageBitmap } from '../../ImageBitmap';
13
+ import { Helpers } from '../../helpers';
14
+ let ctor;
13
15
  export class WebGL2RenderingContext extends WebGL2RenderingContextBase {
14
- constructor(context) {
15
- super(context);
16
+ constructor(context, contextOptions) {
17
+ super(null);
18
+ this._methodCache = new Map();
19
+ const ctx = BigInt(context.getNativeContext().toString());
20
+ let direction = 0;
21
+ if (androidx.core.text.TextUtilsCompat.getLayoutDirectionFromLocale(java.util.Locale.getDefault()) === androidx.core.view.ViewCompat.LAYOUT_DIRECTION_RTL) {
22
+ direction = 1;
23
+ }
24
+ const native = ctor(contextOptions, ctx, Screen.mainScreen.scale, -16777216, Screen.mainScreen.scale * 160, direction);
25
+ this._context = native;
26
+ }
27
+ _getMethod(name) {
28
+ const cached = this._methodCache.get(name);
29
+ if (cached === undefined) {
30
+ const ret = this.native[name];
31
+ this._methodCache.set(name, ret);
32
+ return ret;
33
+ }
34
+ return cached;
16
35
  }
17
36
  /* Transform feedback */
18
- static toPrimitive(value) {
19
- if (value instanceof java.lang.Integer) {
20
- return value.intValue();
21
- }
22
- else if (value instanceof java.lang.Long) {
23
- return value.longValue();
24
- }
25
- else if (value instanceof java.lang.Short) {
26
- return value.shortValue();
27
- }
28
- else if (value instanceof java.lang.Byte) {
29
- return value.byteValue();
30
- }
31
- else if (value instanceof java.lang.Boolean) {
32
- return value.booleanValue();
33
- }
34
- else if (value instanceof java.lang.String) {
35
- return value.toString();
36
- }
37
- else if (value instanceof java.lang.Float) {
38
- return value.floatValue();
39
- }
40
- else if (value instanceof java.lang.Double) {
41
- return value.doubleValue();
42
- }
43
- return value;
44
- }
45
37
  beginQuery(target, query) {
46
38
  this._glCheckError('beginQuery');
47
- const value = query ? query.native : 0;
48
- this.native.beginQuery(target, value);
39
+ const value = query.native;
40
+ const beginQuery = this._getMethod('beginQuery');
41
+ beginQuery(target, value);
49
42
  }
50
43
  beginTransformFeedback(primitiveMode) {
51
44
  this._glCheckError('beginTransformFeedback');
52
- this.native.beginTransformFeedback(primitiveMode);
45
+ const beginTransformFeedback = this._getMethod('beginTransformFeedback');
46
+ beginTransformFeedback(primitiveMode);
53
47
  }
54
48
  bindBufferBase(target, index, buffer) {
55
49
  this._glCheckError('bindBufferBase');
56
- const value = buffer ? buffer.native : 0;
57
- this.native.bindBufferBase(target, index, value);
50
+ const value = buffer ? buffer.native : null;
51
+ const bindBufferBase = this._getMethod('bindBufferBase');
52
+ bindBufferBase(target, index, value);
58
53
  }
59
54
  bindBufferRange(target, index, buffer, offset, size) {
60
55
  this._glCheckError('bindBufferRange');
61
- const value = buffer ? buffer.native : 0;
62
- this.native.bindBufferRange(target, index, value, offset, size);
56
+ const value = buffer ? buffer.native : null;
57
+ const bindBufferRange = this._getMethod('bindBufferRange');
58
+ bindBufferRange(target, index, value, offset, size);
63
59
  }
64
60
  bindSampler(unit, sampler) {
65
61
  this._glCheckError('bindSampler');
66
- const value = sampler ? sampler.native : 0;
67
- this.native.bindSampler(unit, value);
62
+ const value = sampler ? sampler.native : null;
63
+ const bindSampler = this._getMethod('bindSampler');
64
+ bindSampler(unit, value);
68
65
  }
69
66
  bindTransformFeedback(target, transformFeedback) {
70
67
  this._glCheckError('bindTransformFeedback');
71
- const value = transformFeedback ? transformFeedback.native : 0;
72
- this.native.bindTransformFeedback(target, value);
68
+ const value = transformFeedback ? transformFeedback.native : null;
69
+ const bindTransformFeedback = this._getMethod('bindTransformFeedback');
70
+ bindTransformFeedback(target, value);
73
71
  }
74
72
  bindVertexArray(vertexArray) {
75
73
  this._glCheckError('bindVertexArray');
76
- const value = vertexArray ? vertexArray.native : 0;
77
- this.native.bindVertexArray(value);
74
+ const value = vertexArray ? vertexArray.native : null;
75
+ const bindVertexArray = this._getMethod('bindVertexArray');
76
+ bindVertexArray(value);
78
77
  }
79
78
  blitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter) {
80
79
  this._glCheckError('blitFramebuffer');
81
- this.native.blitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
80
+ const blitFramebuffer = this._getMethod('blitFramebuffer');
81
+ blitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
82
82
  }
83
83
  clearBufferfi(buffer, drawbuffer, depth, stencil) {
84
84
  this._glCheckError('clearBufferfi');
85
- const value = buffer ? buffer.native : 0;
86
- this.native.clearBufferfi(value, drawbuffer, depth, stencil);
85
+ const value = buffer.native;
86
+ const clearBufferfi = this._getMethod('clearBufferfi');
87
+ clearBufferfi(value, drawbuffer, depth, stencil);
87
88
  }
88
89
  clearBufferfv(buffer, drawbuffer, values) {
89
90
  this._glCheckError('clearBufferfv');
90
- const value = buffer ? buffer.native : 0;
91
- if (values instanceof Float32Array) {
92
- values = this.toNativeArray(values, 'float');
93
- }
94
- this.native.clearBufferfv(value, drawbuffer, values);
91
+ const clearBufferfv = this._getMethod('clearBufferfv');
92
+ const value = buffer.native;
93
+ clearBufferfv(value, drawbuffer, values);
95
94
  }
96
95
  clearBufferiv(buffer, drawbuffer, values) {
97
96
  this._glCheckError('clearBufferiv');
97
+ const clearBufferiv = this._getMethod('clearBufferiv');
98
98
  const value = buffer ? buffer.native : 0;
99
- if (values instanceof Int32Array) {
100
- values = this.toNativeArray(values, 'int');
101
- }
102
- this.native.clearBufferiv(value, drawbuffer, values);
99
+ clearBufferiv(value, drawbuffer, values);
103
100
  }
104
101
  clearBufferuiv(buffer, drawbuffer, values) {
105
102
  this._glCheckError('clearBufferuiv');
103
+ const clearBufferuiv = this._getMethod('clearBufferuiv');
106
104
  const value = buffer ? buffer.native : 0;
107
- if (values instanceof Uint32Array) {
108
- values = this.toNativeArray(values, 'int');
109
- }
110
- this.native.clearBufferuiv(value, drawbuffer, values);
105
+ clearBufferuiv(value, drawbuffer, values);
111
106
  }
112
107
  clientWaitSync(sync, flags, timeout) {
113
108
  this._glCheckError('clientWaitSync');
114
- const value = sync ? sync.native : 0;
115
- return this.native.clientWaitSync(value, flags, timeout);
109
+ const clientWaitSync = this._getMethod('clientWaitSync');
110
+ const value = sync.native;
111
+ return clientWaitSync(value, flags, timeout);
116
112
  }
117
113
  compressedTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, srcData, srcOffset = 0, srcLengthOverride = 0) {
118
114
  this._glCheckError('compressedTexSubImage3D');
119
- if (typeof srcOffset === 'number') {
120
- this.native.compressedTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, srcData, srcOffset);
121
- }
122
- else if (srcData && srcData.buffer) {
123
- if (srcData instanceof Uint8Array) {
124
- this.native.compressedTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, this.toNativeArray(srcData, 'byte'), srcOffset, srcLengthOverride);
125
- }
126
- }
115
+ const compressedTexSubImage3D = this._getMethod('compressedTexSubImage3D');
116
+ compressedTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, srcData, srcOffset);
127
117
  }
128
118
  /* Transform feedback */
129
119
  /* Framebuffers and renderbuffers */
130
120
  copyBufferSubData(readTarget, writeTarget, readOffset, writeOffset, size) {
131
121
  this._glCheckError('copyBufferSubData');
132
- this.native.copyBufferSubData(readTarget, writeTarget, readOffset, writeOffset, size);
122
+ const copyBufferSubData = this._getMethod('copyBufferSubData');
123
+ copyBufferSubData(readTarget, writeTarget, readOffset, writeOffset, size);
133
124
  }
134
125
  copyTexSubImage3D(target, level, xoffset, yoffset, zoffset, x, y, width, height) {
135
126
  this._glCheckError('copyTexSubImage3D');
136
- this.native.copyTexSubImage3D(target, level, xoffset, yoffset, zoffset, x, y, width, height);
127
+ const copyTexSubImage3D = this._getMethod('copyTexSubImage3D');
128
+ copyTexSubImage3D(target, level, xoffset, yoffset, zoffset, x, y, width, height);
137
129
  }
138
130
  createQuery() {
139
131
  this._glCheckError('createQuery');
140
- return new WebGLQuery(this.native.createQuery());
132
+ const createQuery = this._getMethod('createQuery');
133
+ return new WebGLQuery(createQuery());
141
134
  }
142
135
  createSampler() {
143
136
  this._glCheckError('createSampler');
144
- return new WebGLSampler(this.native.createSampler());
137
+ const createSampler = this._getMethod('createSampler');
138
+ return new WebGLSampler(createSampler());
145
139
  }
146
140
  createTransformFeedback() {
147
141
  this._glCheckError('createTransformFeedback');
148
- return new WebGLTransformFeedback(this.native.createTransformFeedback());
142
+ const createTransformFeedback = this._getMethod('createTransformFeedback');
143
+ return new WebGLTransformFeedback(createTransformFeedback());
149
144
  }
150
145
  createVertexArray() {
151
146
  this._glCheckError('createVertexArray');
152
- return new WebGLVertexArrayObject(this.native.createVertexArray());
153
- }
154
- deleteQueryWithQuery(query) {
155
- this._glCheckError('deleteQueryWithQuery');
156
- const value = query ? query.native : 0;
157
- this.native.deleteQuery(value);
158
- }
159
- deleteSamplerWithSampler(sampler) {
160
- this._glCheckError('deleteSamplerWithSampler');
161
- const value = sampler ? sampler.native : 0;
162
- this.native.deleteSampler(value);
163
- }
164
- deleteSyncWithSync(sync) {
165
- this._glCheckError('deleteSyncWithSync');
166
- const value = sync ? sync.native : 0;
167
- this.native.deleteSync(value);
147
+ const createVertexArray = this._getMethod('createVertexArray');
148
+ return new WebGLVertexArrayObject(createVertexArray());
149
+ }
150
+ deleteQuery(query) {
151
+ this._glCheckError('deleteQuery');
152
+ const deleteQuery = this._getMethod('deleteQuery');
153
+ const value = query.native;
154
+ deleteQuery(value);
155
+ }
156
+ deleteSampler(sampler) {
157
+ this._glCheckError('deleteSampler');
158
+ const deleteSampler = this._getMethod('deleteSampler');
159
+ const value = sampler.native;
160
+ deleteSampler(value);
161
+ }
162
+ deleteSync(sync) {
163
+ this._glCheckError('deleteSync');
164
+ const deleteSync = this._getMethod('deleteSync');
165
+ const value = sync.native;
166
+ deleteSync(value);
168
167
  }
169
168
  deleteTransformFeedback(transformFeedback) {
170
169
  this._glCheckError('deleteTransformFeedback');
171
- const value = transformFeedback ? transformFeedback.native : 0;
172
- this.native.deleteTransformFeedback(value);
170
+ const deleteTransformFeedback = this._getMethod('deleteTransformFeedback');
171
+ const value = transformFeedback.native;
172
+ deleteTransformFeedback(value);
173
173
  }
174
174
  deleteVertexArray(vertexArray) {
175
175
  this._glCheckError('deleteVertexArray');
176
- const value = vertexArray ? vertexArray.native : 0;
177
- this.native.deleteVertexArray(value);
176
+ const deleteVertexArray = this._getMethod('deleteVertexArray');
177
+ const value = vertexArray.native;
178
+ deleteVertexArray(value);
178
179
  }
179
180
  drawArraysInstanced(mode, first, count, instanceCount) {
180
181
  this._glCheckError('drawArraysInstanced');
181
- this.native.drawArraysInstanced(mode, first, count, instanceCount);
182
+ const drawArraysInstanced = this._getMethod('drawArraysInstanced');
183
+ drawArraysInstanced(mode, first, count, instanceCount);
182
184
  }
183
185
  drawBuffers(buffers) {
184
186
  this._glCheckError('drawBuffers');
185
- this.native.drawBuffers(buffers);
187
+ const drawBuffers = this._getMethod('drawBuffers');
188
+ drawBuffers(buffers);
186
189
  }
187
190
  drawElementsInstanced(mode, count, type, offset, instanceCount) {
188
191
  this._glCheckError('drawElementsInstanced');
189
- this.native.drawElementsInstanced(mode, count, type, offset, instanceCount);
192
+ const drawElementsInstanced = this._getMethod('drawElementsInstanced');
193
+ drawElementsInstanced(mode, count, type, offset, instanceCount);
190
194
  }
191
195
  drawRangeElements(mode, start, end, count, type, offset) {
192
196
  this._glCheckError('drawRangeElements');
193
- this.native.drawRangeElements(mode, start, end, count, type, offset);
197
+ const drawRangeElements = this._getMethod('drawRangeElements');
198
+ drawRangeElements(mode, start, end, count, type, offset);
194
199
  }
195
200
  endQuery(target) {
196
201
  this._glCheckError('endQuery');
197
- this.native.endQuery(target);
202
+ const endQuery = this._getMethod('endQuery');
203
+ endQuery(target);
198
204
  }
199
205
  endTransformFeedback() {
200
206
  this._glCheckError('endTransformFeedback');
201
- this.native.endTransformFeedback();
207
+ const endTransformFeedback = this._getMethod('endTransformFeedback');
208
+ endTransformFeedback();
202
209
  }
203
210
  fenceSync(condition, flags) {
204
211
  this._glCheckError('fenceSync');
205
- this.native.fenceSync(condition, flags);
212
+ const fenceSync = this._getMethod('fenceSync');
213
+ fenceSync(condition, flags);
206
214
  }
207
215
  framebufferTextureLayer(target, attachment, texture, level, layer) {
208
216
  this._glCheckError('framebufferTextureLayer');
209
- const value = texture ? texture.native : 0;
210
- this.native.framebufferTextureLayer(target, attachment, value, level, layer);
217
+ const framebufferTextureLayer = this._getMethod('framebufferTextureLayer');
218
+ const value = texture.native;
219
+ framebufferTextureLayer(target, attachment, value, level, layer);
211
220
  }
212
221
  /* Framebuffers and renderbuffers */
213
222
  /* Uniforms */
214
223
  getActiveUniformBlockName(program, uniformBlockIndex) {
215
224
  this._glCheckError('getActiveUniformBlockName');
216
- const value = program ? program.native : 0;
217
- return this.native.getActiveUniformBlockName(value, uniformBlockIndex);
225
+ const getActiveUniformBlockName = this._getMethod('getActiveUniformBlockName');
226
+ const value = program.native;
227
+ return getActiveUniformBlockName(value, uniformBlockIndex);
218
228
  }
219
229
  getActiveUniformBlockParameter(program, uniformBlockIndex, pname) {
220
230
  this._glCheckError('getActiveUniformBlockParameter');
221
- const value = program ? program.native : 0;
222
- const param = this.native.getActiveUniformBlockParameter(value, uniformBlockIndex, pname);
223
- if (pname === this.UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES) {
224
- return new Uint32Array(this.getJSArray(param));
225
- }
226
- return WebGL2RenderingContext.toPrimitive(param);
231
+ const getActiveUniformBlockParameter = this._getMethod('getActiveUniformBlockParameter');
232
+ const value = program.native;
233
+ return getActiveUniformBlockParameter(value, uniformBlockIndex, pname);
227
234
  }
228
235
  getActiveUniforms(program, uniformIndices, pname) {
229
236
  this._glCheckError('getActiveUniforms');
230
- const value = program ? program.native : 0;
231
- return this.getJSArray(this.native.getActiveUniforms(value, uniformIndices, pname));
237
+ const getActiveUniforms = this._getMethod('getActiveUniforms');
238
+ const value = program.native;
239
+ return getActiveUniforms(value, uniformIndices, pname);
232
240
  }
233
241
  getBufferSubData(target, srcByteOffset, dstData, dstOffset = 0, length = 0) {
234
242
  this._glCheckError('getBufferSubData');
235
- this.native.getBufferSubData(target, srcByteOffset, new Uint8Array(dstData.slice(0)), dstOffset, length);
243
+ const getBufferSubData = this._getMethod('getBufferSubData');
244
+ getBufferSubData(target, srcByteOffset, dstData, dstOffset, length);
236
245
  }
237
246
  getFragDataLocation(program, name) {
238
247
  this._glCheckError('getFragDataLocation');
239
- const value = program ? program.native : 0;
240
- const result = this.native.getFragDataLocation(value, name);
248
+ const getFragDataLocation = this._getMethod('getFragDataLocation');
249
+ const value = program.native;
250
+ const result = getFragDataLocation(value, name);
241
251
  return result !== -1 ? result : null;
242
252
  }
243
253
  getIndexedParameter(target, index) {
244
254
  this._glCheckError('getIndexedParameter');
245
- const param = this.native.getIndexedParameter(target, index);
246
- if (target === this.TRANSFORM_FEEDBACK_BUFFER_BINDING ||
247
- target === this.UNIFORM_BUFFER_BINDING) {
255
+ const getIndexedParameter = this._getMethod('getIndexedParameter');
256
+ const param = getIndexedParameter(target, index);
257
+ if (target === this.TRANSFORM_FEEDBACK_BUFFER_BINDING || target === this.UNIFORM_BUFFER_BINDING) {
248
258
  return new WebGLBuffer(param);
249
259
  }
250
- return WebGL2RenderingContext.toPrimitive(param);
260
+ return param;
251
261
  }
252
262
  getInternalformatParameter(target, internalformat, pname) {
253
263
  this._glCheckError('getInternalformatParameter');
254
- const param = this.native.getInternalformatParameter(target, internalformat, pname);
255
- if (pname === this.SAMPLES) {
256
- return new Int32Array(this.getJSArray(param));
257
- }
258
- return WebGL2RenderingContext.toPrimitive(param);
264
+ const getInternalformatParameter = this._getMethod('getInternalformatParameter');
265
+ return getInternalformatParameter(target, internalformat, pname);
259
266
  }
260
267
  getQueryParameter(query, pname) {
261
268
  this._glCheckError('getQueryParameter');
262
- const value = query ? query.native : 0;
263
- const result = this.native.getQueryParameter(value, pname);
269
+ const getQueryParameter = this._getMethod('getQueryParameter');
270
+ const value = query.native;
271
+ const result = getQueryParameter(value, pname);
264
272
  if (result === 0) {
265
273
  return null;
266
274
  }
267
- return WebGL2RenderingContext.toPrimitive(result);
275
+ return result;
268
276
  }
269
277
  //@ts-ignore
270
278
  getParameter(pname) {
271
279
  this._glCheckError('getParameter');
272
- this._checkArgs('activeTexture', arguments);
273
- const value = this.native.getParameter(pname);
280
+ this._checkArgs('getParameter', arguments);
281
+ const getParameter = this._getMethod('getParameter');
282
+ const value = getParameter(pname);
274
283
  switch (pname) {
275
284
  case this.COPY_READ_BUFFER_BINDING:
276
285
  case this.COPY_WRITE_BUFFER_BINDING:
277
286
  if (value) {
278
- new WebGLBuffer(WebGL2RenderingContext.toPrimitive(value));
287
+ new WebGLBuffer(value);
279
288
  }
280
289
  return null;
281
290
  case this.DRAW_FRAMEBUFFER_BINDING:
282
291
  if (value) {
283
- return new WebGLFramebuffer(WebGL2RenderingContext.toPrimitive(value));
292
+ return new WebGLFramebuffer(value);
284
293
  }
285
294
  return null;
286
295
  default:
287
- return super.getParameter(pname);
296
+ return this._handleGetParameter(pname, value);
288
297
  }
289
298
  }
290
299
  getQuery(target, pname) {
291
300
  this._glCheckError('getQuery');
292
- const query = this.native.getQuery(target, pname);
301
+ const getQuery = this._getMethod('getQuery');
302
+ const query = getQuery(target, pname);
293
303
  if (query) {
294
304
  return new WebGLQuery(query);
295
305
  }
@@ -297,376 +307,328 @@ export class WebGL2RenderingContext extends WebGL2RenderingContextBase {
297
307
  }
298
308
  getSamplerParameter(sampler, pname) {
299
309
  this._glCheckError('getSamplerParameter');
300
- const value = sampler ? sampler.native : 0;
301
- return WebGL2RenderingContext.toPrimitive(this.native.getSamplerParameter(value, pname));
310
+ const getSamplerParameter = this._getMethod('getSamplerParameter');
311
+ const value = sampler.native;
312
+ return getSamplerParameter(value, pname);
302
313
  }
303
314
  getSyncParameter(sync, pname) {
304
315
  this._glCheckError('getSyncParameter');
305
- const value = sync ? sync.native : 0;
306
- return WebGL2RenderingContext.toPrimitive(this.native.getSyncParameter(value, pname));
316
+ const getSyncParameter = this._getMethod('getSyncParameter');
317
+ const value = sync.native;
318
+ return getSyncParameter(value, pname);
307
319
  }
308
320
  getTransformFeedbackVarying(program, index) {
309
321
  this._glCheckError('getTransformFeedbackVarying');
310
- const value = program ? program.native : 0;
311
- const info = this.native.getTransformFeedbackVarying(value, index);
322
+ const value = program.native;
323
+ const getTransformFeedbackVarying = this._getMethod('getTransformFeedbackVarying');
324
+ const info = getTransformFeedbackVarying(value, index);
312
325
  if (info) {
313
- return new WebGLActiveInfo(info.name, info.size, info.size);
326
+ return new WebGLActiveInfo(info);
314
327
  }
315
328
  return null;
316
329
  }
317
330
  getUniformBlockIndex(program, uniformBlockName) {
318
331
  this._glCheckError('getUniformBlockIndex');
319
- const value = program ? program.native : 0;
320
- return this.native.getUniformBlockIndex(value, uniformBlockName);
332
+ const getUniformBlockIndex = this._getMethod('getUniformBlockIndex');
333
+ const value = program.native;
334
+ return getUniformBlockIndex(value, uniformBlockName);
321
335
  }
322
336
  getUniformIndices(program, uniformNames) {
323
337
  this._glCheckError('getUniformIndices');
324
- const value = program ? program.native : 0;
325
- return this.getJSArray(this.native.getUniformIndices(value, uniformNames));
338
+ const getUniformIndices = this._getMethod('getUniformIndices');
339
+ const value = program.native;
340
+ return getUniformIndices(value, uniformNames);
326
341
  }
327
342
  invalidateFramebuffer(target, attachments) {
328
343
  this._glCheckError('invalidateFramebuffer');
329
- this.native.invalidateFramebuffer(target, attachments);
344
+ const invalidateFramebuffer = this._getMethod('invalidateFramebuffer');
345
+ invalidateFramebuffer(target, attachments);
330
346
  }
331
347
  invalidateSubFramebuffer(target, attachments, x, y, width, height) {
332
348
  this._glCheckError('invalidateSubFramebuffer');
333
- this.native.invalidateSubFramebuffer(target, attachments, x, y, width, height);
349
+ const invalidateSubFramebuffer = this._getMethod('invalidateSubFramebuffer');
350
+ invalidateSubFramebuffer(target, attachments, x, y, width, height);
334
351
  }
335
352
  isQuery(query) {
336
353
  this._glCheckError('isQuery');
337
- const value = query ? query.native : 0;
338
- return this.native.isQuery(value);
354
+ const isQuery = this._getMethod('isQuery');
355
+ const value = query.native;
356
+ return isQuery(value);
339
357
  }
340
358
  isSampler(sampler) {
341
359
  this._glCheckError('isSampler');
342
- const value = sampler ? sampler.native : 0;
343
- return this.native.isSampler(value);
360
+ const isSampler = this._getMethod('isSampler');
361
+ const value = sampler.native;
362
+ return isSampler(value);
344
363
  }
345
364
  isSync(sync) {
346
365
  this._glCheckError('isSync');
347
- const value = sync ? sync.native : 0;
348
- return this.native.isSync(value);
366
+ const isSync = this._getMethod('isSync');
367
+ const value = sync.native;
368
+ return isSync(value);
349
369
  }
350
370
  isTransformFeedback(transformFeedback) {
351
371
  this._glCheckError('isTransformFeedback');
352
- const value = transformFeedback ? transformFeedback.native : 0;
353
- return this.native.isTransformFeedback(value);
372
+ const isTransformFeedback = this._getMethod('isTransformFeedback');
373
+ const value = transformFeedback.native;
374
+ return isTransformFeedback(value);
354
375
  }
355
376
  isVertexArray(vertexArray) {
356
377
  this._glCheckError('isVertexArray');
357
- const value = vertexArray ? vertexArray.native : 0;
358
- return this.native.isVertexArray(value);
378
+ const isVertexArray = this._getMethod('isVertexArray');
379
+ const value = vertexArray.native;
380
+ return isVertexArray(value);
359
381
  }
360
382
  pauseTransformFeedback() {
361
383
  this._glCheckError('pauseTransformFeedback');
362
- this.native.pauseTransformFeedback();
384
+ const pauseTransformFeedback = this._getMethod('pauseTransformFeedback');
385
+ pauseTransformFeedback();
363
386
  }
364
387
  readBuffer(src) {
365
388
  this._glCheckError('readBuffer');
366
- this.native.readBuffer(src);
389
+ const readBuffer = this._getMethod('readBuffer');
390
+ readBuffer(src);
367
391
  }
368
392
  renderbufferStorageMultisample(target, samples, internalFormat, width, height) {
369
393
  this._glCheckError('renderbufferStorageMultisample');
370
- this.native.renderbufferStorageMultisample(target, samples, internalFormat, width, height);
394
+ const renderbufferStorageMultisample = this._getMethod('renderbufferStorageMultisample');
395
+ renderbufferStorageMultisample(target, samples, internalFormat, width, height);
371
396
  }
372
397
  resumeTransformFeedback() {
373
398
  this._glCheckError('resumeTransformFeedback');
374
- this.native.resumeTransformFeedback();
399
+ const resumeTransformFeedback = this._getMethod('resumeTransformFeedback');
400
+ resumeTransformFeedback();
375
401
  }
376
402
  samplerParameterf(sampler, pname, param) {
377
403
  this._glCheckError('samplerParameterf');
378
- const value = sampler ? sampler.native : 0;
379
- this.native.samplerParameterf(value, pname, param);
404
+ const samplerParameterf = this._getMethod('samplerParameterf');
405
+ const value = sampler.native;
406
+ samplerParameterf(value, pname, param);
380
407
  }
381
408
  /* Uniforms */
382
409
  /* Sync objects */
383
410
  samplerParameteri(sampler, pname, param) {
384
411
  this._glCheckError('samplerParameteri');
385
- const value = sampler ? sampler.native : 0;
386
- this.native.samplerParameteri(value, pname, param);
412
+ const samplerParameteri = this._getMethod('samplerParameteri');
413
+ const value = sampler.native;
414
+ samplerParameteri(value, pname, param);
387
415
  }
388
416
  texImage3D(target, level, internalformat, width, height, depth, border, format, type, source) {
389
417
  this._glCheckError('texImage3D');
418
+ const texImage3D = this._getMethod('texImage3D');
390
419
  if (typeof source === 'number') {
391
- this.native.texImage3D(target, level, internalformat, width, height, depth, border, format, type, source);
420
+ texImage3D(target, level, internalformat, width, height, depth, border, format, type, source);
392
421
  }
393
422
  else if (source && source.buffer) {
394
- if (source && source.buffer) {
395
- if (source instanceof Uint8Array || source instanceof Uint8ClampedArray) {
396
- this.native.texImage3DByte(target, level, internalformat, width, height, depth, border, format, type, Array.from(source));
397
- }
398
- else if (source instanceof Uint16Array || source instanceof Int16Array) {
399
- this.native.texImage3DShort(target, level, internalformat, width, height, depth, border, format, type, Array.from(source));
400
- }
401
- else if (source instanceof Uint32Array || source instanceof Int32Array) {
402
- this.native.texImage3DInt(target, level, internalformat, width, height, depth, border, format, type, Array.from(source));
403
- }
404
- else if (source instanceof Float32Array) {
405
- this.native.texImage3DFloat(target, level, internalformat, width, height, depth, border, format, type, Array.from(source));
406
- }
407
- else if (source instanceof Float64Array) {
408
- this.native.texImage3DDouble(target, level, internalformat, width, height, depth, border, format, type, Array.from(source));
409
- }
410
- }
411
- else if (source instanceof ArrayBuffer) {
412
- // @ts-ignore
413
- if (source.nativeObject) {
414
- // @ts-ignore
415
- this.native.texImage3D(target, level, internalformat, width, height, depth, border, format, type,
416
- // @ts-ignore
417
- source.nativeObject);
418
- }
419
- else {
420
- this.native.texImage3DByte(target, level, internalformat, width, height, depth, border, format, type, Array.from(new Uint8Array(source)));
421
- }
422
- }
423
+ texImage3D(target, level, internalformat, width, height, depth, border, format, type, source);
423
424
  }
424
425
  else if (source instanceof android.graphics.Bitmap) {
425
- this.native.texImage3D(target, level, internalformat, width, height, depth, border, format, type, source);
426
+ texImage3D(target, level, internalformat, width, height, depth, border, format, type, source);
426
427
  }
427
428
  else if (source instanceof ImageSource) {
428
- this.native.texImage3D(target, level, internalformat, width, height, depth, border, format, type, source.android);
429
+ texImage3D(target, level, internalformat, width, height, depth, border, format, type, source.android);
429
430
  }
430
431
  else if (source instanceof ImageAsset) {
431
- this.native.texImage3D(target, level, internalformat, width, height, depth, border, format, type, source.native);
432
+ texImage3D(target, level, internalformat, width, height, depth, border, format, type, source.native);
432
433
  }
433
- else if (source instanceof ImageBitmap || (source === null || source === void 0 ? void 0 : source.native) instanceof org.nativescript.canvas.TNSImageBitmap) {
434
- this.native.texImage3D(target, level, internalformat, width, height, depth, border, format, type, source.native);
434
+ else if (source instanceof ImageBitmap) {
435
+ texImage3D(target, level, internalformat, width, height, depth, border, format, type, source.native);
435
436
  }
436
- else if (source &&
437
- typeof source.tagName === 'string' &&
438
- (source.tagName === 'IMG' || source.tagName === 'IMAGE')) {
437
+ else if (source && typeof source.tagName === 'string' && (source.tagName === 'IMG' || source.tagName === 'IMAGE')) {
439
438
  if (source._imageSource instanceof ImageSource) {
440
- this.native.texImage3D(target, level, internalformat, width, height, depth, border, format, type, source._imageSource.android);
439
+ texImage3D(target, level, internalformat, width, height, depth, border, format, type, source._imageSource.android);
441
440
  }
442
441
  else if (source._image instanceof android.graphics.Bitmap) {
443
- this.native.texImage3D(target, level, internalformat, width, height, depth, border, format, type, source._image);
442
+ texImage3D(target, level, internalformat, width, height, depth, border, format, type, source._image);
444
443
  }
445
444
  else if (source._asset instanceof ImageAsset) {
446
- this.native.texImage3D(target, level, internalformat, width, height, depth, border, format, type, source._asset.native);
445
+ texImage3D(target, level, internalformat, width, height, depth, border, format, type, source._asset.native);
447
446
  }
448
447
  else if (typeof source.src === 'string') {
449
448
  const result = ImageSource.fromFileSync(source.src);
450
- this.native.texImage3D(target, level, internalformat, width, height, depth, border, format, type, result ? result.android : null);
449
+ texImage3D(target, level, internalformat, width, height, depth, border, format, type, result ? result.android : null);
451
450
  }
452
451
  }
453
- else if (source &&
454
- typeof source.tagName === 'string' &&
455
- source.tagName === 'CANVAS' && source._canvas instanceof Canvas) {
456
- this.native.texImage3D(target, level, internalformat, width, height, depth, border, format, type, source._canvas.android);
452
+ else if (source && typeof source.tagName === 'string' && source.tagName === 'CANVAS' && source._canvas instanceof Canvas) {
453
+ texImage3D(target, level, internalformat, width, height, depth, border, format, type, source._canvas.native);
457
454
  }
458
455
  }
459
456
  texStorage2D(target, levels, internalformat, width, height) {
460
457
  this._glCheckError('texStorage2D');
461
- this.native.texStorage2D(target, levels, internalformat, width, height);
458
+ const texStorage2D = this._getMethod('texStorage2D');
459
+ texStorage2D(target, levels, internalformat, width, height);
462
460
  }
463
461
  texStorage3D(target, levels, internalformat, width, height, depth) {
464
462
  this._glCheckError('texStorage3D');
465
- this.native.texStorage3D(target, levels, internalformat, width, height, depth);
463
+ const texStorage3D = this._getMethod('texStorage3D');
464
+ texStorage3D(target, levels, internalformat, width, height, depth);
466
465
  }
467
466
  texSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, srcData, srcOffset = 0) {
468
467
  this._glCheckError('texSubImage3D');
468
+ const texSubImage3D = this._getMethod('texSubImage3D');
469
469
  if (typeof srcData === 'number') {
470
- this.native.texSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, srcData);
470
+ texSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, srcData);
471
471
  }
472
472
  else if (srcData && srcData.buffer) {
473
- if (srcData instanceof Uint8Array) {
474
- if (srcOffset) {
475
- this.native.texSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, this.toNativeArray(srcData, 'byte'), srcOffset);
476
- }
477
- else {
478
- this.native.texSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, this.toNativeArray(srcData, 'byte'));
479
- }
480
- }
481
- if (srcData && srcData.buffer) {
482
- if (srcData instanceof Uint8Array || srcData instanceof Uint8ClampedArray) {
483
- this.native.texSubImage3DByte(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, Array.from(srcData), srcOffset);
484
- }
485
- else if (srcData instanceof Uint16Array || srcData instanceof Int16Array) {
486
- this.native.texSubImage3DShort(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, Array.from(srcData), srcOffset);
487
- }
488
- else if (srcData instanceof Uint32Array || srcData instanceof Int32Array) {
489
- this.native.texSubImage3DInt(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, Array.from(srcData), srcOffset);
490
- }
491
- else if (srcData instanceof Float32Array) {
492
- this.native.texSubImage3DFloat(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, Array.from(srcData), srcOffset);
493
- }
494
- else if (srcData instanceof Float64Array) {
495
- this.native.texSubImage3DDouble(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, Array.from(srcData), srcOffset);
496
- }
497
- }
498
- else if (srcData instanceof ArrayBuffer) {
499
- // @ts-ignore
500
- if (source.nativeObject) {
501
- this.native.texSubImage3DByte(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type,
502
- // @ts-ignore
503
- source.nativeObject, srcOffset);
504
- }
505
- else {
506
- this.native.texSubImage3DDouble(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, Array.from(new Uint8Array(srcData)), srcOffset);
507
- }
508
- }
473
+ texSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, srcData, srcOffset);
509
474
  }
510
475
  else if (srcData instanceof android.graphics.Bitmap) {
511
- this.native.texSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, srcData);
476
+ texSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, srcData);
512
477
  }
513
478
  else if (srcData instanceof ImageSource) {
514
- this.native.texSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, srcData.android);
479
+ texSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, srcData.android);
515
480
  }
516
481
  else if (srcData instanceof ImageAsset) {
517
- this.native.texSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, srcData.native);
482
+ texSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, srcData.native);
518
483
  }
519
- else if (srcData instanceof ImageBitmap || (srcData === null || srcData === void 0 ? void 0 : srcData.native) instanceof org.nativescript.canvas.TNSImageBitmap) {
520
- this.native.texSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, srcData.native);
484
+ else if (srcData instanceof ImageBitmap) {
485
+ texSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, srcData.native);
521
486
  }
522
- else if (srcData &&
523
- typeof srcData.tagName === 'string' &&
524
- (srcData.tagName === 'IMG' || srcData.tagName === 'IMAGE')) {
487
+ else if (srcData && typeof srcData.tagName === 'string' && (srcData.tagName === 'IMG' || srcData.tagName === 'IMAGE')) {
525
488
  if (srcData._imageSource instanceof ImageSource) {
526
- this.native.texSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, srcData._imageSource.android);
489
+ texSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, srcData._imageSource.android);
527
490
  }
528
491
  else if (srcData._image instanceof android.graphics.Bitmap) {
529
- this.native.texSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, srcData._image);
492
+ texSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, srcData._image);
530
493
  }
531
494
  else if (srcData._asset instanceof ImageAsset) {
532
- this.native.texSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, srcData._asset.native);
495
+ texSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, srcData._asset.native);
533
496
  }
534
497
  else if (typeof srcData.src === 'string') {
535
498
  const result = ImageSource.fromFileSync(srcData.src);
536
- this.native.texSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, result ? result.android : null);
499
+ texSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, result ? result.android : null);
537
500
  }
538
501
  }
539
- else if (srcData &&
540
- typeof srcData.tagName === 'string' &&
541
- srcData.tagName === 'CANVAS' && srcData._canvas instanceof TNSCanvas) {
542
- this.native.texSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, srcData._canvas.android);
502
+ else if (srcData && typeof srcData.tagName === 'string' && srcData.tagName === 'CANVAS' && srcData._canvas instanceof TNSCanvas) {
503
+ texSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, srcData._canvas.native);
543
504
  }
544
505
  }
545
506
  transformFeedbackVaryings(program, varyings, bufferMode) {
546
507
  this._glCheckError('transformFeedbackVaryings');
547
- const value = program ? program.native : 0;
548
- this.native.transformFeedbackVaryings(value, varyings, bufferMode);
508
+ const transformFeedbackVaryings = this._getMethod('transformFeedbackVaryings');
509
+ const value = program.native;
510
+ transformFeedbackVaryings(value, varyings, bufferMode);
549
511
  }
550
512
  uniform1ui(location, v0) {
551
513
  this._glCheckError('uniform1ui');
552
- const value = location ? location.native : 0;
553
- this.native.uniform1ui(value, v0);
514
+ const value = location.native;
515
+ const uniform1ui = this._getMethod('uniform1ui');
516
+ uniform1ui(value, v0);
554
517
  }
555
518
  uniform1uiv(location, data) {
556
519
  this._glCheckError('uniform1uiv');
557
- const value = location ? location.native : 0;
558
- this.native.uniform1uiv(value, Array.from(data));
520
+ const uniform1uiv = this._getMethod('uniform1uiv');
521
+ const value = location.native;
522
+ uniform1uiv(value, data);
559
523
  }
560
524
  uniform2ui(location, v0, v1) {
561
525
  this._glCheckError('uniform2ui');
562
- const value = location ? location.native : 0;
563
- this.native.uniform2ui(value, v0, v1);
526
+ const uniform2ui = this._getMethod('uniform2ui');
527
+ const value = location.native;
528
+ uniform2ui(value, v0, v1);
564
529
  }
565
530
  uniform2uiv(location, data) {
566
531
  this._glCheckError('uniform2uiv');
567
- const value = location ? location.native : 0;
568
- this.native.uniform2uiv(value, Array.from(data));
532
+ const uniform2uiv = this._getMethod('uniform2uiv');
533
+ const value = location.native;
534
+ uniform2uiv(value, data);
569
535
  }
570
536
  /* Sync objects */
571
537
  /* Miscellaneous constants */
572
538
  uniform3ui(location, v0, v1, v2) {
573
539
  this._glCheckError('uniform3ui');
574
- const value = location ? location.native : 0;
575
- this.native.uniform3ui(value, v0, v1, v2);
540
+ const uniform3ui = this._getMethod('uniform3ui');
541
+ const value = location.native;
542
+ uniform3ui(value, v0, v1, v2);
576
543
  }
577
544
  uniform3uiv(location, data) {
578
545
  this._glCheckError('uniform3uiv');
579
- const value = location ? location.native : 0;
580
- this.native.uniform3uiv(value, Array.from(data));
546
+ const uniform3uiv = this._getMethod('uniform3uiv');
547
+ const value = location.native;
548
+ uniform3uiv(value, Array.from(data));
581
549
  }
582
550
  uniform4ui(location, v0, v1, v2, v3) {
583
551
  this._glCheckError('uniform4ui');
584
- const value = location ? location.native : 0;
585
- this.native.uniform4ui(value, v0, v1, v2, v3);
552
+ const uniform4ui = this._getMethod('uniform4ui');
553
+ const value = location.native;
554
+ uniform4ui(value, v0, v1, v2, v3);
586
555
  }
587
556
  uniform4uiv(location, data) {
588
557
  this._glCheckError('uniform4uiv');
589
- const value = location ? location.native : 0;
590
- this.native.uniform4uiv(value, Array.from(data));
558
+ const uniform4uiv = this._getMethod('uniform4uiv');
559
+ const value = location.native;
560
+ uniform4uiv(value, Array.from(data));
591
561
  }
592
562
  uniformBlockBinding(program, uniformBlockIndex, uniformBlockBinding) {
593
563
  this._glCheckError('uniformBlockBinding');
594
- const value = program ? program.native : 0;
595
- this.native.uniformBlockBinding(value, uniformBlockIndex, uniformBlockBinding);
564
+ const uniformBlockBindingFunc = this._getMethod('uniformBlockBinding');
565
+ const value = program.native;
566
+ uniformBlockBindingFunc(value, uniformBlockIndex, uniformBlockBinding);
596
567
  }
597
568
  uniformMatrix2x3fv(location, transpose, data) {
598
- if (data instanceof Float32Array) {
599
- data = Array.from(data); //this.toNativeArray(data as any, 'float');
600
- }
601
569
  this._glCheckError('uniformMatrix2x3fv');
602
- const value = location ? location.native : 0;
603
- this.native.uniformMatrix2x3fv(value, transpose, data);
570
+ const uniformMatrix2x3fv = this._getMethod('uniformMatrix2x3fv');
571
+ const value = location.native;
572
+ uniformMatrix2x3fv(value, transpose, data);
604
573
  }
605
574
  uniformMatrix2x4fv(location, transpose, data) {
606
- if (data instanceof Float32Array) {
607
- data = Array.from(data); //this.toNativeArray(data as any, 'float');
608
- }
609
575
  this._glCheckError('uniformMatrix2x4fv');
610
- const value = location ? location.native : 0;
611
- this.native.uniformMatrix2x4fv(value, transpose, data);
576
+ const uniformMatrix2x4fv = this._getMethod('uniformMatrix2x4fv');
577
+ const value = location.native;
578
+ uniformMatrix2x4fv(value, transpose, data);
612
579
  }
613
580
  uniformMatrix3x2fv(location, transpose, data) {
614
- if (data instanceof Float32Array) {
615
- data = Array.from(data); //this.toNativeArray(data as any, 'float');
616
- }
617
581
  this._glCheckError('uniformMatrix3x2fv');
618
- const value = location ? location.native : 0;
619
- this.native.uniformMatrix3x2fv(value, transpose, data);
582
+ const uniformMatrix3x2fv = this._getMethod('uniformMatrix3x2fv');
583
+ const value = location.native;
584
+ uniformMatrix3x2fv(value, transpose, data);
620
585
  }
621
586
  uniformMatrix3x4fv(location, transpose, data) {
622
- if (data instanceof Float32Array) {
623
- data = Array.from(data); //this.toNativeArray(data as any, 'float');
624
- }
625
587
  this._glCheckError('uniformMatrix3x4fv');
626
- const value = location ? location.native : 0;
627
- this.native.uniformMatrix3x4fv(value, transpose, data);
588
+ const uniformMatrix3x4fv = this._getMethod('uniformMatrix3x4fv');
589
+ const value = location.native;
590
+ uniformMatrix3x4fv(value, transpose, data);
628
591
  }
629
592
  uniformMatrix4x2fv(location, transpose, data) {
630
- if (data instanceof Float32Array) {
631
- data = Array.from(data); //this.toNativeArray(data as any, 'float');
632
- }
633
593
  this._glCheckError('uniformMatrix4x2fv');
634
- const value = location ? location.native : 0;
635
- this.native.uniformMatrix4x2fv(value, transpose, data);
594
+ const uniformMatrix4x2fv = this._getMethod('uniformMatrix4x2fv');
595
+ const value = location.native;
596
+ uniformMatrix4x2fv(value, transpose, data);
636
597
  }
637
598
  uniformMatrix4x3fv(location, transpose, data) {
638
- if (data instanceof Float32Array) {
639
- data = Array.from(data); //this.toNativeArray(data as any, 'float');
640
- }
641
599
  this._glCheckError('uniformMatrix4x3fv');
642
- const value = location ? location.native : 0;
643
- this.native.uniformMatrix4x3fv(value, transpose, data);
600
+ const uniformMatrix4x3fv = this._getMethod('uniformMatrix4x3fv');
601
+ const value = location.native;
602
+ uniformMatrix4x3fv(value, transpose, data);
644
603
  }
645
604
  vertexAttribDivisor(index, divisor) {
646
605
  this._glCheckError('vertexAttribDivisor');
647
- this.native.vertexAttribDivisor(index, divisor);
606
+ const vertexAttribDivisor = this._getMethod('vertexAttribDivisor');
607
+ vertexAttribDivisor(index, divisor);
648
608
  }
649
609
  vertexAttribI4i(index, v0, v1, v2, v3) {
650
610
  this._glCheckError('vertexAttribI4i');
651
- this.native.vertexAttribI4i(index, v0, v1, v2, v3);
611
+ const vertexAttribI4i = this._getMethod('vertexAttribI4i');
612
+ vertexAttribI4i(index, v0, v1, v2, v3);
652
613
  }
653
614
  vertexAttribI4iv(index, value) {
654
- if (value instanceof Int32Array) {
655
- value = Array.from(value); //this.toNativeArray(value as any, 'int');
656
- }
657
615
  this._glCheckError('vertexAttribI4iv');
658
- this.native.vertexAttribI4uiv(index, value);
616
+ const vertexAttribI4iv = this._getMethod('vertexAttribI4iv');
617
+ vertexAttribI4iv(index, value);
659
618
  }
660
619
  vertexAttribI4ui(index, v0, v1, v2, v3) {
661
620
  this._glCheckError('vertexAttribI4ui');
662
- this.native.vertexAttribI4ui(index, v0, v1, v2, v3);
621
+ const vertexAttribI4ui = this._getMethod('vertexAttribI4ui');
622
+ vertexAttribI4ui(index, v0, v1, v2, v3);
663
623
  }
664
624
  vertexAttribI4uiv(index, value) {
665
- if (value instanceof Uint32Array) {
666
- value = Array.from(value); //this.toNativeArray(value as any, 'int');
667
- }
668
625
  this._glCheckError('vertexAttribI4uiv');
669
- this.native.vertexAttribI4uiv(index, value);
626
+ const vertexAttribI4uiv = this._getMethod('vertexAttribI4uiv');
627
+ vertexAttribI4uiv(index, value);
670
628
  }
671
629
  }
630
+ (() => {
631
+ Helpers.initialize();
632
+ ctor = global.CanvasJSIModule.createWebGL2Context;
633
+ })();
672
634
  //# sourceMappingURL=index.android.js.map