@nativescript/canvas 0.9.22-v6 → 1.0.0-alpha.10

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 (376) hide show
  1. package/Canvas/common.d.ts +17 -24
  2. package/Canvas/common.js +207 -182
  3. package/Canvas/common.js.map +1 -1
  4. package/Canvas/index.android.d.ts +8 -6
  5. package/Canvas/index.android.js +155 -156
  6. package/Canvas/index.android.js.map +1 -1
  7. package/Canvas/index.ios.d.ts +10 -7
  8. package/Canvas/index.ios.js +141 -153
  9. package/Canvas/index.ios.js.map +1 -1
  10. package/Canvas2D/CanvasGradient/CanvasGradient.android.d.ts +2 -2
  11. package/Canvas2D/CanvasGradient/CanvasGradient.android.js +13 -23
  12. package/Canvas2D/CanvasGradient/CanvasGradient.android.js.map +1 -1
  13. package/Canvas2D/CanvasGradient/CanvasGradient.d.ts +1 -1
  14. package/Canvas2D/CanvasGradient/CanvasGradient.ios.d.ts +1 -1
  15. package/Canvas2D/CanvasGradient/CanvasGradient.ios.js +13 -23
  16. package/Canvas2D/CanvasGradient/CanvasGradient.ios.js.map +1 -1
  17. package/Canvas2D/CanvasGradient/common.d.ts +1 -1
  18. package/Canvas2D/CanvasGradient/common.js +2 -8
  19. package/Canvas2D/CanvasGradient/common.js.map +1 -1
  20. package/Canvas2D/CanvasGradient/index.js +2 -7
  21. package/Canvas2D/CanvasGradient/index.js.map +1 -1
  22. package/Canvas2D/CanvasPattern/CanvasPattern.android.js +8 -14
  23. package/Canvas2D/CanvasPattern/CanvasPattern.android.js.map +1 -1
  24. package/Canvas2D/CanvasPattern/CanvasPattern.ios.js +7 -12
  25. package/Canvas2D/CanvasPattern/CanvasPattern.ios.js.map +1 -1
  26. package/Canvas2D/CanvasPattern/common.d.ts +1 -1
  27. package/Canvas2D/CanvasPattern/common.js +6 -14
  28. package/Canvas2D/CanvasPattern/common.js.map +1 -1
  29. package/Canvas2D/CanvasPattern/index.js +2 -7
  30. package/Canvas2D/CanvasPattern/index.js.map +1 -1
  31. package/Canvas2D/CanvasRenderingContext2D/common.d.ts +21 -21
  32. package/Canvas2D/CanvasRenderingContext2D/common.js +9 -21
  33. package/Canvas2D/CanvasRenderingContext2D/common.js.map +1 -1
  34. package/Canvas2D/CanvasRenderingContext2D/index.android.d.ts +40 -21
  35. package/Canvas2D/CanvasRenderingContext2D/index.android.js +602 -638
  36. package/Canvas2D/CanvasRenderingContext2D/index.android.js.map +1 -1
  37. package/Canvas2D/CanvasRenderingContext2D/index.ios.d.ts +40 -21
  38. package/Canvas2D/CanvasRenderingContext2D/index.ios.js +621 -737
  39. package/Canvas2D/CanvasRenderingContext2D/index.ios.js.map +1 -1
  40. package/Canvas2D/DOMMatrix/DOMMatrix.android.d.ts +44 -22
  41. package/Canvas2D/DOMMatrix/DOMMatrix.android.js +141 -231
  42. package/Canvas2D/DOMMatrix/DOMMatrix.android.js.map +1 -1
  43. package/Canvas2D/DOMMatrix/DOMMatrix.d.ts +1 -1
  44. package/Canvas2D/DOMMatrix/DOMMatrix.ios.d.ts +44 -22
  45. package/Canvas2D/DOMMatrix/DOMMatrix.ios.js +141 -225
  46. package/Canvas2D/DOMMatrix/DOMMatrix.ios.js.map +1 -1
  47. package/Canvas2D/DOMMatrix/common.d.ts +23 -7
  48. package/Canvas2D/DOMMatrix/common.js +6 -14
  49. package/Canvas2D/DOMMatrix/common.js.map +1 -1
  50. package/Canvas2D/DOMMatrix/index.js +2 -7
  51. package/Canvas2D/DOMMatrix/index.js.map +1 -1
  52. package/Canvas2D/ImageData/ImageData.android.d.ts +4 -0
  53. package/Canvas2D/ImageData/ImageData.android.js +41 -16
  54. package/Canvas2D/ImageData/ImageData.android.js.map +1 -1
  55. package/Canvas2D/ImageData/ImageData.ios.d.ts +4 -0
  56. package/Canvas2D/ImageData/ImageData.ios.js +41 -16
  57. package/Canvas2D/ImageData/ImageData.ios.js.map +1 -1
  58. package/Canvas2D/ImageData/common.d.ts +5 -5
  59. package/Canvas2D/ImageData/common.js +6 -17
  60. package/Canvas2D/ImageData/common.js.map +1 -1
  61. package/Canvas2D/ImageData/index.js +2 -7
  62. package/Canvas2D/ImageData/index.js.map +1 -1
  63. package/Canvas2D/Path2D/Path2D.android.js +26 -35
  64. package/Canvas2D/Path2D/Path2D.android.js.map +1 -1
  65. package/Canvas2D/Path2D/Path2D.ios.js +26 -35
  66. package/Canvas2D/Path2D/Path2D.ios.js.map +1 -1
  67. package/Canvas2D/Path2D/common.d.ts +1 -1
  68. package/Canvas2D/Path2D/common.js +6 -14
  69. package/Canvas2D/Path2D/common.js.map +1 -1
  70. package/Canvas2D/Path2D/index.js +2 -7
  71. package/Canvas2D/Path2D/index.js.map +1 -1
  72. package/Canvas2D/TextMetrics/TextMetrics.android.d.ts +13 -14
  73. package/Canvas2D/TextMetrics/TextMetrics.android.js +41 -94
  74. package/Canvas2D/TextMetrics/TextMetrics.android.js.map +1 -1
  75. package/Canvas2D/TextMetrics/TextMetrics.d.ts +1 -12
  76. package/Canvas2D/TextMetrics/TextMetrics.ios.d.ts +12 -12
  77. package/Canvas2D/TextMetrics/TextMetrics.ios.js +41 -94
  78. package/Canvas2D/TextMetrics/TextMetrics.ios.js.map +1 -1
  79. package/Canvas2D/TextMetrics/common.d.ts +14 -2
  80. package/Canvas2D/TextMetrics/common.js +6 -14
  81. package/Canvas2D/TextMetrics/common.js.map +1 -1
  82. package/Canvas2D/TextMetrics/index.js +2 -7
  83. package/Canvas2D/TextMetrics/index.js.map +1 -1
  84. package/Canvas2D/index.js +6 -11
  85. package/Canvas2D/index.js.map +1 -1
  86. package/ImageAsset/ImageAsset.android.d.ts +4 -4
  87. package/ImageAsset/ImageAsset.android.js +79 -101
  88. package/ImageAsset/ImageAsset.android.js.map +1 -1
  89. package/ImageAsset/ImageAsset.d.ts +1 -1
  90. package/ImageAsset/ImageAsset.ios.d.ts +5 -4
  91. package/ImageAsset/ImageAsset.ios.js +82 -107
  92. package/ImageAsset/ImageAsset.ios.js.map +1 -1
  93. package/ImageAsset/common.d.ts +1 -1
  94. package/ImageAsset/common.js +8 -16
  95. package/ImageAsset/common.js.map +1 -1
  96. package/ImageAsset/index.js +2 -7
  97. package/ImageAsset/index.js.map +1 -1
  98. package/ImageBitmap/common.d.ts +8 -0
  99. package/ImageBitmap/common.js +9 -0
  100. package/ImageBitmap/common.js.map +1 -0
  101. package/ImageBitmap/index.android.d.ts +12 -0
  102. package/ImageBitmap/index.android.js +332 -0
  103. package/ImageBitmap/index.android.js.map +1 -0
  104. package/ImageBitmap/index.ios.d.ts +12 -0
  105. package/ImageBitmap/index.ios.js +283 -0
  106. package/ImageBitmap/index.ios.js.map +1 -0
  107. package/README.md +26 -27
  108. package/SVG/Circle.d.ts +3 -3
  109. package/SVG/Circle.js +16 -89
  110. package/SVG/Circle.js.map +1 -1
  111. package/SVG/ClipPath.d.ts +1 -0
  112. package/SVG/ClipPath.js +7 -10
  113. package/SVG/ClipPath.js.map +1 -1
  114. package/SVG/Defs.d.ts +1 -4
  115. package/SVG/Defs.js +7 -18
  116. package/SVG/Defs.js.map +1 -1
  117. package/SVG/Ellipse.d.ts +1 -2
  118. package/SVG/Ellipse.js +16 -43
  119. package/SVG/Ellipse.js.map +1 -1
  120. package/SVG/G.d.ts +1 -7
  121. package/SVG/G.js +7 -64
  122. package/SVG/G.js.map +1 -1
  123. package/SVG/Image.d.ts +5 -4
  124. package/SVG/Image.js +28 -74
  125. package/SVG/Image.js.map +1 -1
  126. package/SVG/Line.d.ts +1 -1
  127. package/SVG/Line.js +16 -39
  128. package/SVG/Line.js.map +1 -1
  129. package/SVG/LinearGradient.d.ts +1 -4
  130. package/SVG/LinearGradient.js +11 -54
  131. package/SVG/LinearGradient.js.map +1 -1
  132. package/SVG/Path.d.ts +2 -2
  133. package/SVG/Path.js +10 -81
  134. package/SVG/Path.js.map +1 -1
  135. package/SVG/Pattern.d.ts +1 -9
  136. package/SVG/Pattern.js +7 -89
  137. package/SVG/Pattern.js.map +1 -1
  138. package/SVG/Polygon.d.ts +2 -2
  139. package/SVG/Polygon.js +10 -63
  140. package/SVG/Polygon.js.map +1 -1
  141. package/SVG/Polyline.d.ts +1 -1
  142. package/SVG/Polyline.js +10 -64
  143. package/SVG/Polyline.js.map +1 -1
  144. package/SVG/Rect.d.ts +1 -1
  145. package/SVG/Rect.js +11 -74
  146. package/SVG/Rect.js.map +1 -1
  147. package/SVG/SVG.d.ts +23 -9
  148. package/SVG/SVG.js +162 -55
  149. package/SVG/SVG.js.map +1 -1
  150. package/SVG/SVGItem.d.ts +2 -19
  151. package/SVG/SVGItem.js +6 -191
  152. package/SVG/SVGItem.js.map +1 -1
  153. package/SVG/Stop.d.ts +1 -2
  154. package/SVG/Stop.js +7 -32
  155. package/SVG/Stop.js.map +1 -1
  156. package/SVG/Symbol.d.ts +1 -4
  157. package/SVG/Symbol.js +7 -18
  158. package/SVG/Symbol.js.map +1 -1
  159. package/SVG/Text.d.ts +6 -5
  160. package/SVG/Text.js +18 -19
  161. package/SVG/Text.js.map +1 -1
  162. package/SVG/Use.d.ts +1 -10
  163. package/SVG/Use.js +7 -96
  164. package/SVG/Use.js.map +1 -1
  165. package/SVG/index.js +18 -40
  166. package/SVG/index.js.map +1 -1
  167. package/TextDecoder/TextDecoder.android.d.ts +2 -1
  168. package/TextDecoder/TextDecoder.android.js +39 -40
  169. package/TextDecoder/TextDecoder.android.js.map +1 -1
  170. package/TextDecoder/TextDecoder.ios.d.ts +1 -1
  171. package/TextDecoder/TextDecoder.ios.js +23 -36
  172. package/TextDecoder/TextDecoder.ios.js.map +1 -1
  173. package/TextDecoder/common.d.ts +4 -4
  174. package/TextDecoder/common.js +6 -17
  175. package/TextDecoder/common.js.map +1 -1
  176. package/TextDecoder/index.js +2 -7
  177. package/TextDecoder/index.js.map +1 -1
  178. package/TextEncoder/TextEncoder.android.d.ts +1 -1
  179. package/TextEncoder/TextEncoder.android.js +11 -21
  180. package/TextEncoder/TextEncoder.android.js.map +1 -1
  181. package/TextEncoder/TextEncoder.ios.d.ts +1 -1
  182. package/TextEncoder/TextEncoder.ios.js +11 -21
  183. package/TextEncoder/TextEncoder.ios.js.map +1 -1
  184. package/TextEncoder/common.d.ts +4 -4
  185. package/TextEncoder/common.js +6 -17
  186. package/TextEncoder/common.js.map +1 -1
  187. package/TextEncoder/index.js +2 -7
  188. package/TextEncoder/index.js.map +1 -1
  189. package/WebGL/WebGLActiveInfo.js +8 -10
  190. package/WebGL/WebGLActiveInfo.js.map +1 -1
  191. package/WebGL/WebGLBuffer.d.ts +1 -1
  192. package/WebGL/WebGLBuffer.js +11 -17
  193. package/WebGL/WebGLBuffer.js.map +1 -1
  194. package/WebGL/WebGLExtensions/index.android.js +137 -190
  195. package/WebGL/WebGLExtensions/index.android.js.map +1 -1
  196. package/WebGL/WebGLExtensions/index.ios.js +110 -163
  197. package/WebGL/WebGLExtensions/index.ios.js.map +1 -1
  198. package/WebGL/WebGLFramebuffer.d.ts +1 -1
  199. package/WebGL/WebGLFramebuffer.js +11 -17
  200. package/WebGL/WebGLFramebuffer.js.map +1 -1
  201. package/WebGL/WebGLProgram.d.ts +1 -1
  202. package/WebGL/WebGLProgram.js +11 -17
  203. package/WebGL/WebGLProgram.js.map +1 -1
  204. package/WebGL/WebGLRenderbuffer.d.ts +1 -1
  205. package/WebGL/WebGLRenderbuffer.js +11 -17
  206. package/WebGL/WebGLRenderbuffer.js.map +1 -1
  207. package/WebGL/WebGLRenderingContext/common.d.ts +301 -301
  208. package/WebGL/WebGLRenderingContext/common.js +940 -2140
  209. package/WebGL/WebGLRenderingContext/common.js.map +1 -1
  210. package/WebGL/WebGLRenderingContext/index.android.d.ts +10 -5
  211. package/WebGL/WebGLRenderingContext/index.android.js +1014 -587
  212. package/WebGL/WebGLRenderingContext/index.android.js.map +1 -1
  213. package/WebGL/WebGLRenderingContext/index.d.ts +2 -0
  214. package/WebGL/WebGLRenderingContext/index.ios.d.ts +3 -3
  215. package/WebGL/WebGLRenderingContext/index.ios.js +502 -573
  216. package/WebGL/WebGLRenderingContext/index.ios.js.map +1 -1
  217. package/WebGL/WebGLShader.d.ts +1 -1
  218. package/WebGL/WebGLShader.js +11 -17
  219. package/WebGL/WebGLShader.js.map +1 -1
  220. package/WebGL/WebGLShaderPrecisionFormat.js +8 -10
  221. package/WebGL/WebGLShaderPrecisionFormat.js.map +1 -1
  222. package/WebGL/WebGLTexture.d.ts +1 -1
  223. package/WebGL/WebGLTexture.js +11 -17
  224. package/WebGL/WebGLTexture.js.map +1 -1
  225. package/WebGL/WebGLUniformLocation.d.ts +1 -1
  226. package/WebGL/WebGLUniformLocation.js +11 -17
  227. package/WebGL/WebGLUniformLocation.js.map +1 -1
  228. package/WebGL/index.js +9 -14
  229. package/WebGL/index.js.map +1 -1
  230. package/WebGL2/WebGL2RenderingContext/common.d.ts +265 -265
  231. package/WebGL2/WebGL2RenderingContext/common.js +817 -1885
  232. package/WebGL2/WebGL2RenderingContext/common.js.map +1 -1
  233. package/WebGL2/WebGL2RenderingContext/index.android.d.ts +4 -1
  234. package/WebGL2/WebGL2RenderingContext/index.android.js +359 -293
  235. package/WebGL2/WebGL2RenderingContext/index.android.js.map +1 -1
  236. package/WebGL2/WebGL2RenderingContext/index.ios.d.ts +3 -1
  237. package/WebGL2/WebGL2RenderingContext/index.ios.js +289 -260
  238. package/WebGL2/WebGL2RenderingContext/index.ios.js.map +1 -1
  239. package/WebGL2/WebGLQuery.d.ts +1 -1
  240. package/WebGL2/WebGLQuery.js +11 -17
  241. package/WebGL2/WebGLQuery.js.map +1 -1
  242. package/WebGL2/WebGLSampler.d.ts +1 -1
  243. package/WebGL2/WebGLSampler.js +11 -17
  244. package/WebGL2/WebGLSampler.js.map +1 -1
  245. package/WebGL2/WebGLSync.d.ts +1 -1
  246. package/WebGL2/WebGLSync.js +11 -17
  247. package/WebGL2/WebGLSync.js.map +1 -1
  248. package/WebGL2/WebGLTransformFeedback.d.ts +1 -1
  249. package/WebGL2/WebGLTransformFeedback.js +11 -17
  250. package/WebGL2/WebGLTransformFeedback.js.map +1 -1
  251. package/WebGL2/WebGLVertexArrayObject.d.ts +1 -1
  252. package/WebGL2/WebGLVertexArrayObject.js +11 -17
  253. package/WebGL2/WebGLVertexArrayObject.js.map +1 -1
  254. package/WebGL2/index.js +5 -10
  255. package/WebGL2/index.js.map +1 -1
  256. package/angular/bundles/nativescript-canvas-angular.umd.js +29 -0
  257. package/angular/bundles/nativescript-canvas-angular.umd.js.map +1 -0
  258. package/angular/esm2015/index.js +12 -0
  259. package/angular/esm2015/nativescript-canvas-angular.js +5 -0
  260. package/angular/fesm2015/nativescript-canvas-angular.js +19 -0
  261. package/angular/fesm2015/nativescript-canvas-angular.js.map +1 -0
  262. package/angular/nativescript-canvas-angular.d.ts +4 -0
  263. package/angular/nativescript-canvas-angular.metadata.json +1 -0
  264. package/angular/package.json +14 -0
  265. package/common.js +4 -12
  266. package/common.js.map +1 -1
  267. package/index.d.ts +2 -2
  268. package/index.js +56 -28
  269. package/index.js.map +1 -1
  270. package/package.json +10 -6
  271. package/platforms/android/include.gradle +22 -1
  272. package/platforms/ios/Podfile +2 -4
  273. package/react/index.js +2 -4
  274. package/react/index.js.map +1 -1
  275. package/svelte/index.js +2 -4
  276. package/svelte/index.js.map +1 -1
  277. package/utils.d.ts +4 -0
  278. package/utils.js +46 -22
  279. package/utils.js.map +1 -1
  280. package/vue/index.d.ts +4 -0
  281. package/vue/index.js +6 -0
  282. package/vue/index.js.map +1 -0
  283. package/Canvas/common.metadata.json +0 -1
  284. package/Canvas/index.android.metadata.json +0 -1
  285. package/Canvas/index.ios.metadata.json +0 -1
  286. package/Canvas2D/CanvasGradient/CanvasGradient.android.metadata.json +0 -1
  287. package/Canvas2D/CanvasGradient/CanvasGradient.ios.metadata.json +0 -1
  288. package/Canvas2D/CanvasGradient/common.metadata.json +0 -1
  289. package/Canvas2D/CanvasGradient/index.metadata.json +0 -1
  290. package/Canvas2D/CanvasPattern/CanvasPattern.android.metadata.json +0 -1
  291. package/Canvas2D/CanvasPattern/CanvasPattern.ios.metadata.json +0 -1
  292. package/Canvas2D/CanvasPattern/common.metadata.json +0 -1
  293. package/Canvas2D/CanvasPattern/index.metadata.json +0 -1
  294. package/Canvas2D/CanvasRenderingContext2D/common.metadata.json +0 -1
  295. package/Canvas2D/CanvasRenderingContext2D/index.android.metadata.json +0 -1
  296. package/Canvas2D/CanvasRenderingContext2D/index.ios.metadata.json +0 -1
  297. package/Canvas2D/DOMMatrix/DOMMatrix.android.metadata.json +0 -1
  298. package/Canvas2D/DOMMatrix/DOMMatrix.ios.metadata.json +0 -1
  299. package/Canvas2D/DOMMatrix/common.metadata.json +0 -1
  300. package/Canvas2D/DOMMatrix/index.metadata.json +0 -1
  301. package/Canvas2D/ImageData/ImageData.android.metadata.json +0 -1
  302. package/Canvas2D/ImageData/ImageData.ios.metadata.json +0 -1
  303. package/Canvas2D/ImageData/common.metadata.json +0 -1
  304. package/Canvas2D/ImageData/index.metadata.json +0 -1
  305. package/Canvas2D/Path2D/Path2D.android.metadata.json +0 -1
  306. package/Canvas2D/Path2D/Path2D.ios.metadata.json +0 -1
  307. package/Canvas2D/Path2D/common.metadata.json +0 -1
  308. package/Canvas2D/Path2D/index.metadata.json +0 -1
  309. package/Canvas2D/TextMetrics/TextMetrics.android.metadata.json +0 -1
  310. package/Canvas2D/TextMetrics/TextMetrics.ios.metadata.json +0 -1
  311. package/Canvas2D/TextMetrics/common.metadata.json +0 -1
  312. package/Canvas2D/TextMetrics/index.metadata.json +0 -1
  313. package/Canvas2D/index.metadata.json +0 -1
  314. package/ImageAsset/ImageAsset.android.metadata.json +0 -1
  315. package/ImageAsset/ImageAsset.ios.metadata.json +0 -1
  316. package/ImageAsset/common.metadata.json +0 -1
  317. package/ImageAsset/index.metadata.json +0 -1
  318. package/SVG/Circle.metadata.json +0 -1
  319. package/SVG/ClipPath.metadata.json +0 -1
  320. package/SVG/Defs.metadata.json +0 -1
  321. package/SVG/Ellipse.metadata.json +0 -1
  322. package/SVG/G.metadata.json +0 -1
  323. package/SVG/Image.metadata.json +0 -1
  324. package/SVG/Line.metadata.json +0 -1
  325. package/SVG/LinearGradient.metadata.json +0 -1
  326. package/SVG/Path.metadata.json +0 -1
  327. package/SVG/Pattern.metadata.json +0 -1
  328. package/SVG/Polygon.metadata.json +0 -1
  329. package/SVG/Polyline.metadata.json +0 -1
  330. package/SVG/Rect.metadata.json +0 -1
  331. package/SVG/SVG.metadata.json +0 -1
  332. package/SVG/SVGItem.metadata.json +0 -1
  333. package/SVG/Stop.metadata.json +0 -1
  334. package/SVG/Symbol.metadata.json +0 -1
  335. package/SVG/Text.metadata.json +0 -1
  336. package/SVG/Use.metadata.json +0 -1
  337. package/SVG/index.metadata.json +0 -1
  338. package/TextDecoder/TextDecoder.android.metadata.json +0 -1
  339. package/TextDecoder/TextDecoder.ios.metadata.json +0 -1
  340. package/TextDecoder/common.metadata.json +0 -1
  341. package/TextDecoder/index.metadata.json +0 -1
  342. package/TextEncoder/TextEncoder.android.metadata.json +0 -1
  343. package/TextEncoder/TextEncoder.ios.metadata.json +0 -1
  344. package/TextEncoder/common.metadata.json +0 -1
  345. package/TextEncoder/index.metadata.json +0 -1
  346. package/WebGL/WebGLActiveInfo.metadata.json +0 -1
  347. package/WebGL/WebGLBuffer.metadata.json +0 -1
  348. package/WebGL/WebGLExtensions/index.android.metadata.json +0 -1
  349. package/WebGL/WebGLExtensions/index.ios.metadata.json +0 -1
  350. package/WebGL/WebGLFramebuffer.metadata.json +0 -1
  351. package/WebGL/WebGLProgram.metadata.json +0 -1
  352. package/WebGL/WebGLRenderbuffer.metadata.json +0 -1
  353. package/WebGL/WebGLRenderingContext/common.metadata.json +0 -1
  354. package/WebGL/WebGLRenderingContext/index.android.metadata.json +0 -1
  355. package/WebGL/WebGLRenderingContext/index.ios.metadata.json +0 -1
  356. package/WebGL/WebGLShader.metadata.json +0 -1
  357. package/WebGL/WebGLShaderPrecisionFormat.metadata.json +0 -1
  358. package/WebGL/WebGLTexture.metadata.json +0 -1
  359. package/WebGL/WebGLUniformLocation.metadata.json +0 -1
  360. package/WebGL/index.metadata.json +0 -1
  361. package/WebGL2/WebGL2RenderingContext/common.metadata.json +0 -1
  362. package/WebGL2/WebGL2RenderingContext/index.android.metadata.json +0 -1
  363. package/WebGL2/WebGL2RenderingContext/index.ios.metadata.json +0 -1
  364. package/WebGL2/WebGLQuery.metadata.json +0 -1
  365. package/WebGL2/WebGLSampler.metadata.json +0 -1
  366. package/WebGL2/WebGLSync.metadata.json +0 -1
  367. package/WebGL2/WebGLTransformFeedback.metadata.json +0 -1
  368. package/WebGL2/WebGLVertexArrayObject.metadata.json +0 -1
  369. package/WebGL2/index.metadata.json +0 -1
  370. package/angular/index.js +0 -19
  371. package/angular/index.js.map +0 -1
  372. package/angular/index.metadata.json +0 -1
  373. package/common.metadata.json +0 -1
  374. package/index.metadata.json +0 -1
  375. package/react/index.metadata.json +0 -1
  376. package/utils.metadata.json +0 -1
@@ -1,48 +1,35 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- var common_1 = require("./common");
4
- var WebGLShader_1 = require("../WebGLShader");
5
- var WebGLFramebuffer_1 = require("../WebGLFramebuffer");
6
- var WebGLTexture_1 = require("../WebGLTexture");
7
- var WebGLProgram_1 = require("../WebGLProgram");
8
- var WebGLUniformLocation_1 = require("../WebGLUniformLocation");
9
- var WebGLActiveInfo_1 = require("../WebGLActiveInfo");
10
- var WebGLRenderbuffer_1 = require("../WebGLRenderbuffer");
11
- var WebGLShaderPrecisionFormat_1 = require("../WebGLShaderPrecisionFormat");
12
- var WebGLBuffer_1 = require("../WebGLBuffer");
13
- var core_1 = require("@nativescript/core");
14
- var WebGLExtensions_1 = require("../WebGLExtensions");
15
- var ImageAsset_1 = require("../../ImageAsset");
16
- var Canvas_1 = require("../../Canvas");
17
- var WebGLRenderingContext = /** @class */ (function (_super) {
18
- __extends(WebGLRenderingContext, _super);
19
- function WebGLRenderingContext(context) {
20
- var _this = _super.call(this, context) || this;
21
- _this.context = context;
22
- return _this;
23
- }
24
- Object.defineProperty(WebGLRenderingContext.prototype, "native", {
25
- get: function () {
26
- return this.context;
27
- },
28
- enumerable: true,
29
- configurable: true
30
- });
31
- Object.defineProperty(WebGLRenderingContext.prototype, "drawingBufferHeight", {
32
- get: function () {
33
- return this.context.getDrawingBufferHeight();
34
- },
35
- enumerable: true,
36
- configurable: true
37
- });
38
- Object.defineProperty(WebGLRenderingContext.prototype, "drawingBufferWidth", {
39
- get: function () {
40
- return this.context.getDrawingBufferWidth();
41
- },
42
- enumerable: true,
43
- configurable: true
44
- });
45
- WebGLRenderingContext.toPrimitive = function (value) {
1
+ import { WebGLRenderingContextBase } from './common';
2
+ import { WebGLShader } from '../WebGLShader';
3
+ import { WebGLFramebuffer } from '../WebGLFramebuffer';
4
+ import { WebGLTexture } from '../WebGLTexture';
5
+ import { WebGLProgram } from '../WebGLProgram';
6
+ import { WebGLUniformLocation } from '../WebGLUniformLocation';
7
+ import { WebGLActiveInfo } from '../WebGLActiveInfo';
8
+ import { WebGLRenderbuffer } from '../WebGLRenderbuffer';
9
+ import { WebGLShaderPrecisionFormat } from '../WebGLShaderPrecisionFormat';
10
+ import { WebGLBuffer } from '../WebGLBuffer';
11
+ import { ImageSource } from '@nativescript/core';
12
+ import { ANGLE_instanced_arrays, EXT_blend_minmax, EXT_color_buffer_half_float, EXT_disjoint_timer_query, EXT_shader_texture_lod, EXT_sRGB, EXT_texture_filter_anisotropic, OES_element_index_uint, OES_standard_derivatives, OES_texture_float, OES_texture_float_linear, OES_texture_half_float, OES_texture_half_float_linear, OES_vertex_array_object, WEBGL_color_buffer_float, WEBGL_compressed_texture_atc, WEBGL_compressed_texture_etc, WEBGL_compressed_texture_etc1, WEBGL_compressed_texture_pvrtc, WEBGL_compressed_texture_s3tc, WEBGL_depth_texture, WEBGL_draw_buffers, WEBGL_lose_context, } from '../WebGLExtensions';
13
+ import { ImageAsset } from '../../ImageAsset';
14
+ import { Canvas } from '../../Canvas';
15
+ import { ImageBitmap } from '../../ImageBitmap';
16
+ import { Utils } from '../../utils';
17
+ export class WebGLRenderingContext extends WebGLRenderingContextBase {
18
+ constructor(context) {
19
+ super(context);
20
+ this._lastTexture = { target: 0, texture: 0 };
21
+ this.context = context;
22
+ }
23
+ get native() {
24
+ return this.context;
25
+ }
26
+ get drawingBufferHeight() {
27
+ return this.context.getDrawingBufferHeight();
28
+ }
29
+ get drawingBufferWidth() {
30
+ return this.context.getDrawingBufferWidth();
31
+ }
32
+ static toPrimitive(value) {
46
33
  if (value instanceof java.lang.Integer) {
47
34
  return value.intValue();
48
35
  }
@@ -68,89 +55,89 @@ var WebGLRenderingContext = /** @class */ (function (_super) {
68
55
  return value.doubleValue();
69
56
  }
70
57
  return value;
71
- };
72
- WebGLRenderingContext.prototype.getJSArray = function (value) {
73
- var count = value.length;
74
- var array = [];
75
- for (var i = 0; i < count; i++) {
58
+ }
59
+ getJSArray(value) {
60
+ const count = value.length;
61
+ const array = [];
62
+ for (let i = 0; i < count; i++) {
76
63
  array.push(value[i]);
77
64
  }
78
65
  return array;
79
- };
80
- WebGLRenderingContext.prototype.activeTexture = function (texture) {
66
+ }
67
+ activeTexture(texture) {
81
68
  this._glCheckError('activeTexture');
82
69
  this._checkArgs('activeTexture', arguments);
83
70
  this.context.activeTexture(texture);
84
- };
85
- WebGLRenderingContext.prototype.attachShader = function (program, shader) {
71
+ }
72
+ attachShader(program, shader) {
86
73
  this._glCheckError('attachShader');
87
74
  this._checkArgs('attachShader', arguments);
88
- var value = program ? program.native : 0;
89
- var value2 = shader ? shader.native : 0;
75
+ const value = program ? program.native : 0;
76
+ const value2 = shader ? shader.native : 0;
90
77
  this.context.attachShader(value, value2);
91
- };
92
- WebGLRenderingContext.prototype.bindAttribLocation = function (program, index, name) {
78
+ }
79
+ bindAttribLocation(program, index, name) {
93
80
  this._glCheckError('bindAttribLocation');
94
81
  this._checkArgs('bindAttribLocation', arguments);
95
- var value = program ? program.native : 0;
82
+ const value = program ? program.native : 0;
96
83
  this.context.bindAttribLocation(value, index, name);
97
- };
98
- WebGLRenderingContext.prototype.bindBuffer = function (target, buffer) {
84
+ }
85
+ bindBuffer(target, buffer) {
99
86
  this._glCheckError('bindBuffer');
100
87
  this._checkArgs('bindBuffer', arguments);
101
- var value = buffer ? buffer.native : 0;
88
+ let value = buffer ? buffer.native : 0;
102
89
  this.context.bindBuffer(target, value);
103
- };
104
- WebGLRenderingContext.prototype.bindFramebuffer = function (target, framebuffer) {
90
+ }
91
+ bindFramebuffer(target, framebuffer) {
105
92
  this._glCheckError('bindFramebuffer');
106
93
  this._checkArgs('bindFramebuffer', arguments);
107
- var value = framebuffer ? framebuffer.native : 0;
94
+ const value = framebuffer ? framebuffer.native : 0;
108
95
  this.context.bindFramebuffer(target, value);
109
- };
110
- WebGLRenderingContext.prototype.bindRenderbuffer = function (target, renderbuffer) {
96
+ }
97
+ bindRenderbuffer(target, renderbuffer) {
111
98
  this._glCheckError('bindRenderbuffer');
112
99
  this._checkArgs('bindRenderbuffer', arguments);
113
- var value = renderbuffer ? renderbuffer.native : 0;
100
+ const value = renderbuffer ? renderbuffer.native : 0;
114
101
  this.context.bindRenderbuffer(target, value);
115
- };
116
- WebGLRenderingContext.prototype.bindTexture = function (target, texture) {
102
+ }
103
+ bindTexture(target, texture) {
117
104
  this._glCheckError('bindTexture');
118
105
  this._checkArgs('bindTexture', arguments);
119
- var value = texture ? texture.native : 0;
106
+ const value = texture ? texture.native : 0;
107
+ if (value > 0) {
108
+ this._lastTexture = {
109
+ target,
110
+ texture: value,
111
+ };
112
+ }
120
113
  this.context.bindTexture(target, value);
121
- };
122
- WebGLRenderingContext.prototype.blendColor = function (red, green, blue, alpha) {
114
+ }
115
+ blendColor(red, green, blue, alpha) {
123
116
  this._glCheckError('blendColor');
124
117
  this._checkArgs('blendColor', arguments);
125
118
  this.context.blendColor(red, green, blue, alpha);
126
- };
127
- WebGLRenderingContext.prototype.blendEquationSeparate = function (modeRGB, modeAlpha) {
119
+ }
120
+ blendEquationSeparate(modeRGB, modeAlpha) {
128
121
  this._glCheckError('blendEquationSeparate');
129
122
  this._checkArgs('blendEquationSeparate', arguments);
130
123
  this.context.blendEquationSeparate(modeRGB, modeAlpha);
131
- };
132
- WebGLRenderingContext.prototype.blendEquation = function (mode) {
124
+ }
125
+ blendEquation(mode) {
133
126
  this._glCheckError('blendEquation');
134
127
  this._checkArgs('blendEquation', arguments);
135
128
  this.context.blendEquation(mode);
136
- };
137
- WebGLRenderingContext.prototype.blendFuncSeparate = function (srcRGB, dstRGB, srcAlpha, dstAlpha) {
138
- if (srcRGB === void 0) { srcRGB = this.ONE; }
139
- if (dstRGB === void 0) { dstRGB = this.ZERO; }
140
- if (srcAlpha === void 0) { srcAlpha = this.ONE; }
141
- if (dstAlpha === void 0) { dstAlpha = this.ZERO; }
129
+ }
130
+ blendFuncSeparate(srcRGB = this.ONE, dstRGB = this.ZERO, srcAlpha = this.ONE, dstAlpha = this.ZERO) {
142
131
  this._glCheckError('blendFuncSeparate');
143
132
  this._checkArgs('blendFuncSeparate', arguments);
144
133
  this.context.blendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha);
145
- };
146
- WebGLRenderingContext.prototype.blendFunc = function (sfactor, dfactor) {
147
- if (sfactor === void 0) { sfactor = this.ONE; }
148
- if (dfactor === void 0) { dfactor = this.ZERO; }
134
+ }
135
+ blendFunc(sfactor = this.ONE, dfactor = this.ZERO) {
149
136
  this._glCheckError('blendFunc');
150
137
  this._checkArgs('blendFunc', arguments);
151
138
  this.context.blendFunc(sfactor, dfactor);
152
- };
153
- WebGLRenderingContext.prototype.toNativeArray = function (value, type) {
139
+ }
140
+ toNativeArray(value, type) {
154
141
  // if (value && value.length && typeof type === 'string') {
155
142
  // const size = value.length;
156
143
  // const nativeArray = Array.create(type, size);
@@ -159,16 +146,16 @@ var WebGLRenderingContext = /** @class */ (function (_super) {
159
146
  // }
160
147
  // return nativeArray;
161
148
  // }
162
- var length = 0;
163
- if (value instanceof Int8Array || value instanceof Uint8Array || value instanceof Int16Array || value instanceof Uint16Array || value instanceof Int32Array || value instanceof Uint32Array || value instanceof Float32Array || value instanceof Float64Array) {
149
+ let length = 0;
150
+ if (value instanceof Int8Array || value instanceof Uint8Array || value instanceof Uint8ClampedArray || value instanceof Int16Array || value instanceof Uint16Array || value instanceof Int32Array || value instanceof Uint32Array || value instanceof Float32Array || value instanceof Float64Array) {
164
151
  length = value.length;
165
152
  }
166
153
  else if (Array.isArray(value)) {
167
154
  length = value.length;
168
155
  }
169
- if (length && typeof type === 'string') {
170
- var array = Array.from(value);
171
- var nativeArray = void 0;
156
+ if (typeof type === 'string') {
157
+ const array = Array.from(value);
158
+ let nativeArray;
172
159
  switch (type) {
173
160
  case 'byte':
174
161
  nativeArray = java.nio.ByteBuffer.wrap(array).array();
@@ -195,426 +182,541 @@ var WebGLRenderingContext = /** @class */ (function (_super) {
195
182
  return nativeArray;
196
183
  }
197
184
  return [];
198
- };
199
- WebGLRenderingContext.prototype.bufferData = function (target, srcData, usage) {
185
+ }
186
+ get _isSupported() {
187
+ return Utils.IS_SUPPORTED_TYPED_ARRAYS_VERSION;
188
+ }
189
+ bufferData(target, srcData, usage) {
200
190
  this._glCheckError('bufferData');
201
191
  this._checkArgs('bufferData', arguments);
202
192
  if (typeof srcData === 'number') {
203
193
  this.context.bufferData(target, srcData, usage);
204
194
  }
205
195
  else if (srcData instanceof ArrayBuffer) {
206
- this.context.bufferData(target, this.toNativeArray(new Uint8Array(srcData), 'byte'), usage);
207
- }
208
- else if (srcData && srcData.buffer instanceof ArrayBuffer) {
209
- if (srcData instanceof Uint8Array || srcData instanceof Uint8ClampedArray) {
210
- this.context.bufferData(target, this.toNativeArray(srcData, 'byte'), usage);
196
+ // @ts-ignore
197
+ if (srcData.nativeObject) {
198
+ // @ts-ignore
199
+ this.context.bufferData(target, srcData.nativeObject, usage);
211
200
  }
212
- else if (srcData instanceof Uint16Array || srcData instanceof Int16Array) {
213
- this.context.bufferData(target, this.toNativeArray(srcData, 'short'), usage);
201
+ else {
202
+ if (this._isSupported) {
203
+ this.context.bufferDataByteBuffer(target, srcData, usage);
204
+ }
205
+ else {
206
+ this.context.bufferDataByte(target, Array.from(new Uint8Array(srcData)), usage);
207
+ }
214
208
  }
215
- else if (srcData instanceof Uint32Array || srcData instanceof Int32Array) {
216
- this.context.bufferData(target, this.toNativeArray(srcData, 'int'), usage);
209
+ //this.context.bufferData(target, this.toNativeArray(new Uint8Array(srcData as any) as any, 'byte'), usage);
210
+ }
211
+ else if (srcData && srcData.buffer instanceof ArrayBuffer) {
212
+ // @ts-ignore
213
+ if (srcData.buffer.nativeObject) {
214
+ // @ts-ignore
215
+ this.context.bufferData(target, offset, srcData.buffer.nativeObject);
217
216
  }
218
- else if (srcData instanceof Float32Array) {
219
- this.context.bufferData(target, this.toNativeArray(srcData, 'float'), usage);
217
+ else {
218
+ if (srcData instanceof Uint8Array || srcData instanceof Uint8ClampedArray) {
219
+ if (this._isSupported) {
220
+ this.context.bufferDataByteBuffer(target, srcData, usage);
221
+ }
222
+ else {
223
+ this.context.bufferDataByte(target, Array.from(srcData), usage);
224
+ }
225
+ }
226
+ else if (srcData instanceof Uint16Array || srcData instanceof Int16Array) {
227
+ if (this._isSupported) {
228
+ this.context.bufferDataShortBuffer(target, srcData, usage);
229
+ }
230
+ else {
231
+ this.context.bufferDataShort(target, Array.from(srcData), usage);
232
+ }
233
+ }
234
+ else if (srcData instanceof Uint32Array || srcData instanceof Int32Array) {
235
+ if (this._isSupported) {
236
+ this.context.bufferDataIntBuffer(target, srcData, usage);
237
+ }
238
+ else {
239
+ this.context.bufferDataInt(target, Array.from(srcData), usage);
240
+ }
241
+ }
242
+ else if (srcData instanceof Float32Array) {
243
+ if (this._isSupported) {
244
+ this.context.bufferDataFloatBuffer(target, srcData, usage);
245
+ }
246
+ else {
247
+ this.context.bufferDataFloat(target, Array.from(srcData), usage);
248
+ }
249
+ }
220
250
  }
221
251
  }
222
252
  else if (arguments.length === 3 && !srcData) {
223
253
  this.context.bufferData(target, 0, usage);
224
254
  }
225
- };
226
- WebGLRenderingContext.prototype.bufferSubData = function (target, offset, srcData) {
255
+ }
256
+ bufferSubData(target, offset, srcData) {
227
257
  this._glCheckError('bufferSubData');
228
258
  this._checkArgs('bufferSubData', arguments);
229
259
  if (srcData instanceof ArrayBuffer) {
230
- this.context.bufferSubData(target, offset, this.toNativeArray(new Uint8Array(srcData), 'byte'));
231
- }
232
- else if (srcData && srcData.buffer instanceof ArrayBuffer) {
233
- if (srcData instanceof Uint8Array) {
234
- this.context.bufferSubData(target, offset, this.toNativeArray(srcData, 'byte'));
260
+ //this.context.bufferSubData(target, offset, this.toNativeArray(new Uint8Array(srcData as any) as any, 'byte'));
261
+ // @ts-ignore
262
+ if (srcData.nativeObject) {
263
+ // @ts-ignore
264
+ this.context.bufferSubData(target, offset, srcData.nativeObject);
235
265
  }
236
- else if (srcData instanceof Uint16Array || srcData instanceof Int16Array) {
237
- this.context.bufferSubData(target, offset, this.toNativeArray(srcData, 'short'));
266
+ else {
267
+ if (this._isSupported) {
268
+ this.context.bufferSubDataByteBuffer(target, offset, srcData);
269
+ }
270
+ else {
271
+ this.context.bufferSubDataByte(target, offset, Array.from(new Uint8Array(srcData)));
272
+ }
238
273
  }
239
- else if (srcData instanceof Uint32Array || srcData instanceof Int32Array) {
240
- this.context.bufferSubData(target, offset, this.toNativeArray(srcData, 'int'));
274
+ }
275
+ else if (srcData && srcData.buffer instanceof ArrayBuffer) {
276
+ // @ts-ignore
277
+ if (srcData.buffer.nativeObject) {
278
+ // @ts-ignore
279
+ this.context.bufferSubData(target, offset, srcData.buffer.nativeObject);
241
280
  }
242
- else if (srcData instanceof Float32Array) {
243
- this.context.bufferSubData(target, offset, this.toNativeArray(srcData, 'float'));
281
+ else {
282
+ if (srcData instanceof Uint8Array || srcData instanceof Uint8ClampedArray) {
283
+ if (this._isSupported) {
284
+ this.context.bufferSubDataByteBuffer(target, offset, srcData);
285
+ }
286
+ else {
287
+ this.context.bufferSubDataByte(target, offset, Array.from(srcData));
288
+ }
289
+ }
290
+ else if (srcData instanceof Uint16Array || srcData instanceof Int16Array) {
291
+ if (this._isSupported) {
292
+ this.context.bufferSubDataShortBuffer(target, offset, srcData);
293
+ }
294
+ else {
295
+ this.context.bufferSubDataShort(target, offset, Array.from(srcData));
296
+ }
297
+ }
298
+ else if (srcData instanceof Uint32Array || srcData instanceof Int32Array) {
299
+ if (this._isSupported) {
300
+ this.context.bufferSubDataIntBuffer(target, offset, srcData);
301
+ }
302
+ else {
303
+ this.context.bufferSubDataInt(target, offset, Array.from(srcData));
304
+ }
305
+ }
306
+ else if (srcData instanceof Float32Array) {
307
+ if (this._isSupported) {
308
+ this.context.bufferSubDataFloatBuffer(target, offset, srcData);
309
+ }
310
+ else {
311
+ this.context.bufferSubDataFloat(target, offset, Array.from(srcData));
312
+ }
313
+ }
244
314
  }
245
315
  }
246
- };
247
- WebGLRenderingContext.prototype.checkFramebufferStatus = function (target) {
316
+ }
317
+ checkFramebufferStatus(target) {
248
318
  this._glCheckError('checkFramebufferStatus');
249
319
  this._checkArgs('checkFramebufferStatus', arguments);
250
320
  return this.context.checkFramebufferStatus(target);
251
- };
252
- WebGLRenderingContext.prototype.clearColor = function (red, green, blue, alpha) {
321
+ }
322
+ clearColor(red, green, blue, alpha) {
253
323
  this._glCheckError('clearColor');
254
324
  this._checkArgs('clearColor', arguments);
255
325
  this.context.clearColor(red, green, blue, alpha);
256
- };
257
- WebGLRenderingContext.prototype.clearDepth = function (depth) {
326
+ }
327
+ clearDepth(depth) {
258
328
  this._glCheckError('clearDepth');
259
329
  this._checkArgs('clearDepth', arguments);
260
330
  this.context.clearDepth(depth);
261
- };
262
- WebGLRenderingContext.prototype.clearStencil = function (stencil) {
331
+ }
332
+ clearStencil(stencil) {
263
333
  this._glCheckError('clearStencil');
264
334
  this._checkArgs('clearStencil', arguments);
265
335
  this.context.clearStencil(stencil);
266
- };
267
- WebGLRenderingContext.prototype.clear = function (mask) {
336
+ }
337
+ clear(mask) {
268
338
  this._glCheckError('clear');
269
339
  this._checkArgs('clear', arguments);
270
340
  this.context.clear(mask);
271
- };
272
- WebGLRenderingContext.prototype.colorMask = function (red, green, blue, alpha) {
341
+ }
342
+ colorMask(red, green, blue, alpha) {
273
343
  this._glCheckError('colorMask');
274
344
  this._checkArgs('colorMask', arguments);
275
345
  this.context.colorMask(red, green, blue, alpha);
276
- };
277
- WebGLRenderingContext.prototype.commit = function () {
346
+ }
347
+ commit() {
278
348
  // NOOP
279
349
  this.context.commit();
280
- };
281
- WebGLRenderingContext.prototype.compileShader = function (shader) {
350
+ }
351
+ compileShader(shader) {
282
352
  this._glCheckError('compileShader');
283
353
  this._checkArgs('compileShader', arguments);
284
- var value = shader ? shader.native : 0;
354
+ const value = shader ? shader.native : 0;
285
355
  this.context.compileShader(value);
286
- };
287
- WebGLRenderingContext.prototype.compressedTexImage2D = function (target, level, internalformat, width, height, border, pixels) {
356
+ }
357
+ compressedTexImage2D(target, level, internalformat, width, height, border, pixels) {
288
358
  this._glCheckError('compressedTexImage2D');
289
359
  this._checkArgs('compressedTexImage2D', arguments);
360
+ // @ts-ignore
290
361
  if (pixels && pixels.buffer instanceof ArrayBuffer) {
291
- if (pixels instanceof Uint8Array) {
292
- this.context.compressedTexImage2D(target, level, internalformat, width, height, border, this.toNativeArray(pixels, 'byte'));
293
- }
294
- else if (pixels instanceof Uint16Array || pixels instanceof Int16Array) {
295
- this.context.compressedTexImage2D(target, level, internalformat, width, height, border, this.toNativeArray(pixels, 'short'));
362
+ // @ts-ignore
363
+ if (pixels.buffer.nativeObject) {
364
+ // @ts-ignore
365
+ this.context.compressedTexImage2D(target, level, internalformat, width, height, border, pixels.buffer.nativeObject);
296
366
  }
297
- else if (pixels instanceof Uint32Array || pixels instanceof Int32Array) {
298
- this.context.compressedTexImage2D(target, level, internalformat, width, height, border, this.toNativeArray(pixels, 'int'));
299
- }
300
- else if (pixels instanceof Float32Array) {
301
- this.context.compressedTexImage2D(target, level, internalformat, width, height, border, this.toNativeArray(pixels, 'float'));
367
+ else {
368
+ if (pixels instanceof Uint8Array) {
369
+ // this.context.compressedTexImage2D(target, level, internalformat, width, height, border, this.toNativeArray(pixels as any, 'byte'));
370
+ this.context.compressedTexImage2DByte(target, level, internalformat, width, height, border, Array.from(pixels));
371
+ }
372
+ else if (pixels instanceof Uint16Array || pixels instanceof Int16Array) {
373
+ // this.context.compressedTexImage2D(target, level, internalformat, width, height, border, this.toNativeArray(pixels as any, 'short'));
374
+ this.context.compressedTexImage2DShort(target, level, internalformat, width, height, border, Array.from(pixels));
375
+ }
376
+ else if (pixels instanceof Uint32Array || pixels instanceof Int32Array) {
377
+ // this.context.compressedTexImage2D(target, level, internalformat, width, height, border, this.toNativeArray(pixels as any, 'int'));
378
+ this.context.compressedTexImage2DInt(target, level, internalformat, width, height, border, Array.from(pixels));
379
+ }
380
+ else if (pixels instanceof Float32Array) {
381
+ // this.context.compressedTexImage2D(target, level, internalformat, width, height, border, this.toNativeArray(pixels as any, 'float'));
382
+ this.context.compressedTexImage2DFloat(target, level, internalformat, width, height, border, Array.from(pixels));
383
+ }
302
384
  }
303
385
  }
304
386
  else if (pixels instanceof ArrayBuffer) {
305
- this.context.compressedTexImage2D(target, level, internalformat, width, height, border, this.toNativeArray(new Uint8Array(pixels), 'byte'));
387
+ // this.context.compressedTexImage2D(target, level, internalformat, width, height, border, this.toNativeArray(new Uint8Array(pixels as any) as any, 'byte'));
388
+ // @ts-ignore
389
+ if (pixels.nativeObject) {
390
+ // @ts-ignore
391
+ this.context.compressedTexImage2D(target, level, internalformat, width, height, border, pixels.nativeObject);
392
+ }
393
+ else {
394
+ this.context.compressedTexImage2DByte(target, level, internalformat, width, height, border, Array.from(new Uint8Array(pixels)));
395
+ }
306
396
  }
307
- };
308
- WebGLRenderingContext.prototype.compressedTexSubImage2D = function (target, level, xoffset, yoffset, width, height, format, pixels) {
397
+ }
398
+ compressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, pixels) {
309
399
  this._glCheckError('compressedTexSubImage2D');
310
400
  this._checkArgs('compressedTexSubImage2D', arguments);
311
401
  if (pixels && pixels.buffer instanceof ArrayBuffer) {
312
402
  if (pixels instanceof Uint8Array) {
313
- this.context.compressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, this.toNativeArray(pixels, 'byte'));
403
+ // this.context.compressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, this.toNativeArray(pixels as any, 'byte'));
404
+ this.context.compressedTexSubImage2DByte(target, level, xoffset, yoffset, width, height, format, Array.from(pixels));
314
405
  }
315
406
  else if (pixels instanceof Uint16Array || pixels instanceof Int16Array) {
316
- this.context.compressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, this.toNativeArray(pixels, 'short'));
407
+ // this.context.compressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, this.toNativeArray(pixels as any, 'short'));
408
+ this.context.compressedTexSubImage2DShort(target, level, xoffset, yoffset, width, height, format, Array.from(pixels));
317
409
  }
318
410
  else if (pixels instanceof Uint32Array || pixels instanceof Int32Array) {
319
- this.context.compressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, this.toNativeArray(pixels, 'int'));
411
+ // this.context.compressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, this.toNativeArray(pixels as any, 'int'));
412
+ this.context.compressedTexSubImage2DInt(target, level, xoffset, yoffset, width, height, format, Array.from(pixels));
320
413
  }
321
414
  else if (pixels instanceof Float32Array) {
322
- this.context.compressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, this.toNativeArray(pixels, 'float'));
415
+ // this.context.compressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, this.toNativeArray(pixels as any, 'float'));
416
+ this.context.compressedTexSubImage2DFloat(target, level, xoffset, yoffset, width, height, format, Array.from(pixels));
323
417
  }
324
418
  }
325
419
  else if (pixels instanceof ArrayBuffer) {
326
- this.context.compressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, this.toNativeArray(new Uint8Array(pixels), 'byte'));
420
+ // this.context.compressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, this.toNativeArray(new Uint8Array(pixels as any) as any, 'byte'));
421
+ // @ts-ignore
422
+ if (pixels.nativeObject) {
423
+ // @ts-ignore
424
+ this.context.compressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, pixels.nativeObject);
425
+ }
426
+ else {
427
+ this.context.compressedTexSubImage2DByte(target, level, xoffset, yoffset, width, height, format, Array.from(new Uint8Array(pixels)));
428
+ }
327
429
  }
328
- };
329
- WebGLRenderingContext.prototype.copyTexImage2D = function (target, level, internalformat, x, y, width, height, border) {
430
+ }
431
+ copyTexImage2D(target, level, internalformat, x, y, width, height, border) {
330
432
  this._glCheckError('copyTexImage2D');
331
433
  this._checkArgs('copyTexImage2D', arguments);
332
434
  this.context.copyTexImage2D(target, level, internalformat, x, y, width, height, border);
333
- };
334
- WebGLRenderingContext.prototype.copyTexSubImage2D = function (target, level, xoffset, yoffset, x, y, width, height) {
435
+ }
436
+ copyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height) {
335
437
  this._glCheckError('copyTexSubImage2D');
336
438
  this._checkArgs('copyTexSubImage2D', arguments);
337
439
  this.context.copyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
338
- };
339
- WebGLRenderingContext.prototype.createBuffer = function () {
440
+ }
441
+ createBuffer() {
340
442
  this._glCheckError('createBuffer');
341
443
  this._checkArgs('createBuffer', arguments);
342
- var id = this.context.createBuffer();
343
- return new WebGLBuffer_1.WebGLBuffer(id);
344
- };
345
- WebGLRenderingContext.prototype.createFramebuffer = function () {
444
+ const id = this.context.createBuffer();
445
+ return new WebGLBuffer(id);
446
+ }
447
+ createFramebuffer() {
346
448
  this._glCheckError('createFramebuffer');
347
449
  this._checkArgs('createFramebuffer', arguments);
348
- return new WebGLFramebuffer_1.WebGLFramebuffer(this.context.createFramebuffer());
349
- };
350
- WebGLRenderingContext.prototype.createProgram = function () {
450
+ return new WebGLFramebuffer(this.context.createFramebuffer());
451
+ }
452
+ createProgram() {
351
453
  this._glCheckError('createProgram');
352
454
  this._checkArgs('createProgram', arguments);
353
- return new WebGLProgram_1.WebGLProgram(this.context.createProgram());
354
- };
355
- WebGLRenderingContext.prototype.createRenderbuffer = function () {
455
+ return new WebGLProgram(this.context.createProgram());
456
+ }
457
+ createRenderbuffer() {
356
458
  this._glCheckError('createRenderbuffer');
357
459
  this._checkArgs('createRenderbuffer', arguments);
358
- return new WebGLRenderbuffer_1.WebGLRenderbuffer(this.context.createRenderbuffer());
359
- };
360
- WebGLRenderingContext.prototype.createShader = function (type) {
460
+ return new WebGLRenderbuffer(this.context.createRenderbuffer());
461
+ }
462
+ createShader(type) {
361
463
  this._glCheckError('createShader');
362
464
  this._checkArgs('createShader', arguments);
363
- return new WebGLShader_1.WebGLShader(this.context.createShader(type));
364
- };
365
- WebGLRenderingContext.prototype.createTexture = function () {
465
+ return new WebGLShader(this.context.createShader(type));
466
+ }
467
+ createTexture() {
366
468
  this._glCheckError('createTexture');
367
469
  this._checkArgs('createTexture', arguments);
368
- return new WebGLTexture_1.WebGLTexture(this.context.createTexture());
369
- };
370
- WebGLRenderingContext.prototype.cullFace = function (mode) {
470
+ return new WebGLTexture(this.context.createTexture());
471
+ }
472
+ cullFace(mode) {
371
473
  this._glCheckError('cullFace');
372
474
  this._checkArgs('cullFace', arguments);
373
475
  this.context.cullFace(mode);
374
- };
375
- WebGLRenderingContext.prototype.deleteBuffer = function (buffer) {
476
+ }
477
+ deleteBuffer(buffer) {
376
478
  this._glCheckError('deleteBuffer');
377
479
  this._checkArgs('deleteBuffer', arguments);
378
- var value = buffer ? buffer.native : 0;
480
+ const value = buffer ? buffer.native : 0;
379
481
  this.context.deleteBuffer(value);
380
- };
381
- WebGLRenderingContext.prototype.deleteFramebuffer = function (frameBuffer) {
482
+ }
483
+ deleteFramebuffer(frameBuffer) {
382
484
  this._glCheckError('deleteFramebuffer');
383
485
  this._checkArgs('deleteFramebuffer', arguments);
384
- var value = frameBuffer ? frameBuffer.native : 0;
486
+ const value = frameBuffer ? frameBuffer.native : 0;
385
487
  this.context.deleteFramebuffer(value);
386
- };
387
- WebGLRenderingContext.prototype.deleteProgram = function (program) {
488
+ }
489
+ deleteProgram(program) {
388
490
  this._glCheckError('deleteProgram');
389
491
  this._checkArgs('deleteProgram', arguments);
390
- var value = program ? program.native : 0;
492
+ const value = program ? program.native : 0;
391
493
  this.context.deleteProgram(value);
392
- };
393
- WebGLRenderingContext.prototype.deleteRenderbuffer = function (renderBuffer) {
494
+ }
495
+ deleteRenderbuffer(renderBuffer) {
394
496
  this._glCheckError('deleteRenderbuffer');
395
497
  this._checkArgs('deleteRenderbuffer', arguments);
396
- var value = renderBuffer ? renderBuffer.native : 0;
498
+ const value = renderBuffer ? renderBuffer.native : 0;
397
499
  this.context.deleteRenderbuffer(value);
398
- };
399
- WebGLRenderingContext.prototype.deleteShader = function (shader) {
500
+ }
501
+ deleteShader(shader) {
400
502
  this._glCheckError('deleteShader');
401
503
  this._checkArgs('deleteShader', arguments);
402
- var value = shader ? shader.native : 0;
504
+ const value = shader ? shader.native : 0;
403
505
  this.context.deleteShader(value);
404
- };
405
- WebGLRenderingContext.prototype.deleteTexture = function (texture) {
506
+ }
507
+ deleteTexture(texture) {
406
508
  this._glCheckError('deleteTexture');
407
509
  this._checkArgs('deleteTexture', arguments);
408
- var value = texture ? texture.native : 0;
510
+ const value = texture ? texture.native : 0;
409
511
  this.context.deleteTexture(value);
410
- };
411
- WebGLRenderingContext.prototype.depthFunc = function (func) {
512
+ }
513
+ depthFunc(func) {
412
514
  this._glCheckError('depthFunc');
413
515
  this._checkArgs('depthFunc', arguments);
414
516
  this.context.depthFunc(func);
415
- };
416
- WebGLRenderingContext.prototype.depthMask = function (flag) {
517
+ }
518
+ depthMask(flag) {
417
519
  this._glCheckError('depthMask');
418
520
  this._checkArgs('depthMask', arguments);
419
521
  this.context.depthMask(flag);
420
- };
421
- WebGLRenderingContext.prototype.depthRange = function (zNear, zFar) {
522
+ }
523
+ depthRange(zNear, zFar) {
422
524
  this._glCheckError('depthRange');
423
525
  this._checkArgs('depthRange', arguments);
424
526
  this.context.depthRange(zNear, zFar);
425
- };
426
- WebGLRenderingContext.prototype.detachShader = function (program, shader) {
527
+ }
528
+ detachShader(program, shader) {
427
529
  this._glCheckError('detachShader');
428
530
  this._checkArgs('detachShader', arguments);
429
- var value = program ? program.native : 0;
430
- var value2 = shader ? shader.native : 0;
531
+ const value = program ? program.native : 0;
532
+ const value2 = shader ? shader.native : 0;
431
533
  this.context.detachShader(value, value2);
432
- };
433
- WebGLRenderingContext.prototype.disableVertexAttribArray = function (index) {
534
+ }
535
+ disableVertexAttribArray(index) {
434
536
  this._glCheckError('disableVertexAttribArray');
435
537
  this._checkArgs('disableVertexAttribArray', arguments);
436
538
  this.context.disableVertexAttribArray(index);
437
- };
438
- WebGLRenderingContext.prototype.disable = function (cap) {
539
+ }
540
+ disable(cap) {
439
541
  this._glCheckError('disable');
440
542
  this._checkArgs('disable', arguments);
441
543
  this.context.disable(cap);
442
- };
443
- WebGLRenderingContext.prototype.drawArrays = function (mode, first, count) {
544
+ }
545
+ drawArrays(mode, first, count) {
444
546
  this._glCheckError('drawArrays');
445
547
  this._checkArgs('drawArrays', arguments);
446
548
  this.context.drawArrays(mode, first, count);
447
- };
448
- WebGLRenderingContext.prototype.drawElements = function (mode, count, type, offset) {
549
+ }
550
+ drawElements(mode, count, type, offset) {
449
551
  this._glCheckError('drawElements');
450
552
  this._checkArgs('drawElements', arguments);
451
553
  this.context.drawElements(mode, count, type, offset);
452
- };
453
- WebGLRenderingContext.prototype.enableVertexAttribArray = function (index) {
554
+ }
555
+ enableVertexAttribArray(index) {
454
556
  this._glCheckError('enableVertexAttribArray');
455
557
  this._checkArgs('enableVertexAttribArray', arguments);
456
558
  this.context.enableVertexAttribArray(index);
457
- };
458
- WebGLRenderingContext.prototype.enable = function (cap) {
559
+ }
560
+ enable(cap) {
459
561
  this._glCheckError('enable');
460
562
  this._checkArgs('enable', arguments);
461
563
  this.context.enable(cap);
462
- };
463
- WebGLRenderingContext.prototype.finish = function () {
564
+ }
565
+ finish() {
464
566
  this._glCheckError('finish');
465
567
  this.context.finish();
466
- };
467
- WebGLRenderingContext.prototype.flush = function () {
568
+ }
569
+ flush() {
468
570
  this._glCheckError('flush');
469
571
  this.context.flush();
470
- };
471
- WebGLRenderingContext.prototype.framebufferRenderbuffer = function (target, attachment, renderbuffertarget, renderbuffer) {
572
+ }
573
+ framebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer) {
472
574
  this._glCheckError('framebufferRenderbuffer');
473
575
  this._checkArgs('framebufferRenderbuffer', arguments);
474
- var value = renderbuffer ? renderbuffer.native : 0;
576
+ const value = renderbuffer ? renderbuffer.native : 0;
475
577
  this.context.framebufferRenderbuffer(target, attachment, renderbuffertarget, value);
476
- };
477
- WebGLRenderingContext.prototype.framebufferTexture2D = function (target, attachment, textarget, texture, level) {
578
+ }
579
+ framebufferTexture2D(target, attachment, textarget, texture, level) {
478
580
  this._glCheckError('framebufferTexture2D');
479
581
  this._checkArgs('activeTexture', arguments);
480
- var value = texture ? texture.native : 0;
582
+ const value = texture ? texture.native : 0;
481
583
  this.context.framebufferTexture2D(target, attachment, textarget, value, level);
482
- };
483
- WebGLRenderingContext.prototype.frontFace = function (mode) {
584
+ }
585
+ frontFace(mode) {
484
586
  this._checkArgs('activeTexture', arguments);
485
587
  this._glCheckError('activeTexture');
486
588
  this.context.frontFace(mode);
487
- };
488
- WebGLRenderingContext.prototype.generateMipmap = function (target) {
589
+ }
590
+ generateMipmap(target) {
489
591
  this._checkArgs('activeTexture', arguments);
490
592
  this._glCheckError('activeTexture');
491
593
  this.context.generateMipmap(target);
492
- };
493
- WebGLRenderingContext.prototype.getActiveAttrib = function (program, index) {
594
+ }
595
+ getActiveAttrib(program, index) {
494
596
  this._glCheckError('getActiveAttrib');
495
597
  this._checkArgs('getActiveAttrib', arguments);
496
- var value = program ? program.native : 0;
497
- var attrib = this.context.getActiveAttrib(value, index);
498
- return new WebGLActiveInfo_1.WebGLActiveInfo(attrib.getName(), attrib.getSize(), attrib.getType());
499
- };
500
- WebGLRenderingContext.prototype.getActiveUniform = function (program, index) {
598
+ const value = program ? program.native : 0;
599
+ const attrib = this.context.getActiveAttrib(value, index);
600
+ return new WebGLActiveInfo(attrib.getName(), attrib.getSize(), attrib.getType());
601
+ }
602
+ getActiveUniform(program, index) {
501
603
  this._glCheckError('getActiveUniform');
502
604
  this._checkArgs('getActiveUniform', arguments);
503
- var value = program ? program.native : 0;
504
- var uniform = this.context.getActiveUniform(value, index);
505
- return new WebGLActiveInfo_1.WebGLActiveInfo(uniform.getName(), uniform.getSize(), uniform.getType());
506
- };
507
- WebGLRenderingContext.prototype.getAttachedShaders = function (program) {
605
+ const value = program ? program.native : 0;
606
+ const uniform = this.context.getActiveUniform(value, index);
607
+ return new WebGLActiveInfo(uniform.getName(), uniform.getSize(), uniform.getType());
608
+ }
609
+ getAttachedShaders(program) {
508
610
  this._glCheckError('getAttachedShaders');
509
611
  this._checkArgs('getAttachedShaders', arguments);
510
- var value = program ? program.native : 0;
511
- return this.getJSArray(this.context.getAttachedShaders(value)).map(function (shader) { return new WebGLShader_1.WebGLShader(shader); });
512
- };
513
- WebGLRenderingContext.prototype.getAttribLocation = function (program, name) {
612
+ const value = program ? program.native : 0;
613
+ return this.getJSArray(this.context.getAttachedShaders(value)).map((shader) => new WebGLShader(shader));
614
+ }
615
+ getAttribLocation(program, name) {
514
616
  this._glCheckError('getAttribLocation');
515
617
  this._checkArgs('getAttribLocation', arguments);
516
- var value = program ? program.native : 0;
618
+ const value = program ? program.native : 0;
517
619
  return this.context.getAttribLocation(value, name);
518
- };
519
- WebGLRenderingContext.prototype.getBufferParameter = function (target, pname) {
620
+ }
621
+ getBufferParameter(target, pname) {
520
622
  this._glCheckError('getBufferParameter');
521
623
  this._checkArgs('getBufferParameter', arguments);
522
624
  return this.context.getBufferParameter(target, pname);
523
- };
524
- WebGLRenderingContext.prototype.getContextAttributes = function () {
525
- var attributes = this.context.getContextAttributes();
625
+ }
626
+ getContextAttributes() {
627
+ const attributes = this.context.getContextAttributes();
526
628
  if (!attributes) {
527
629
  return null;
528
630
  }
529
- var keys = attributes.keySet().toArray();
530
- var length = keys.length;
531
- var contextAttributes = {};
532
- for (var i = 0; i < length; i++) {
533
- var key = keys[i];
631
+ const keys = attributes.keySet().toArray();
632
+ const length = keys.length;
633
+ const contextAttributes = {};
634
+ for (let i = 0; i < length; i++) {
635
+ const key = keys[i];
534
636
  contextAttributes[key] = attributes.get(key);
535
637
  }
536
638
  return contextAttributes;
537
- };
538
- WebGLRenderingContext.prototype.getError = function () {
639
+ }
640
+ getError() {
539
641
  return this.context.getError();
540
- };
541
- WebGLRenderingContext.prototype.getExtension = function (name) {
642
+ }
643
+ getExtension(name) {
542
644
  this._glCheckError('getExtension');
543
645
  this._checkArgs('getExtension', arguments);
544
646
  if (name === 'EXT_disjoint_timer_query_webgl2') {
545
647
  return null;
546
648
  }
547
- var ext = this.context.getExtension(name);
649
+ const ext = this.context.getExtension(name);
548
650
  if (ext) {
549
- var clazz = ext && ext.getClass();
550
- var classObjName = clazz && clazz.getName();
651
+ const clazz = ext && ext.getClass();
652
+ const classObjName = clazz && clazz.getName();
551
653
  switch (classObjName) {
552
654
  case 'org.nativescript.canvas.extensions.ANGLE_instanced_arrays':
553
- return new WebGLExtensions_1.ANGLE_instanced_arrays(ext);
655
+ return new ANGLE_instanced_arrays(ext);
554
656
  case 'org.nativescript.canvas.extensions.EXT_blend_minmax':
555
- return new WebGLExtensions_1.EXT_blend_minmax(ext);
657
+ return new EXT_blend_minmax(ext);
556
658
  case 'org.nativescript.canvas.extensions.EXT_color_buffer_half_float':
557
- return new WebGLExtensions_1.EXT_color_buffer_half_float(ext);
659
+ return new EXT_color_buffer_half_float(ext);
558
660
  case 'org.nativescript.canvas.extensions.EXT_disjoint_timer_query':
559
- return new WebGLExtensions_1.EXT_disjoint_timer_query(ext);
661
+ return new EXT_disjoint_timer_query(ext);
560
662
  case 'org.nativescript.canvas.extensions.EXT_sRGB':
561
- return new WebGLExtensions_1.EXT_sRGB(ext);
663
+ return new EXT_sRGB(ext);
562
664
  case 'org.nativescript.canvas.extensions.EXT_shader_texture_lod':
563
- return new WebGLExtensions_1.EXT_shader_texture_lod(ext);
665
+ return new EXT_shader_texture_lod(ext);
564
666
  case 'org.nativescript.canvas.extensions.EXT_texture_filter_anisotropic':
565
- return new WebGLExtensions_1.EXT_texture_filter_anisotropic(ext);
667
+ return new EXT_texture_filter_anisotropic(ext);
566
668
  case 'org.nativescript.canvas.extensions.OES_element_index_uint':
567
- return new WebGLExtensions_1.OES_element_index_uint(ext);
669
+ return new OES_element_index_uint(ext);
568
670
  case 'org.nativescript.canvas.extensions.OES_standard_derivatives':
569
- return new WebGLExtensions_1.OES_standard_derivatives(ext);
671
+ return new OES_standard_derivatives(ext);
570
672
  case 'org.nativescript.canvas.extensions.OES_texture_float':
571
- return new WebGLExtensions_1.OES_texture_float(ext);
673
+ return new OES_texture_float(ext);
572
674
  case 'org.nativescript.canvas.extensions.OES_texture_float_linear':
573
- return new WebGLExtensions_1.OES_texture_float_linear(ext);
675
+ return new OES_texture_float_linear(ext);
574
676
  case 'org.nativescript.canvas.extensions.OES_texture_half_float':
575
- return new WebGLExtensions_1.OES_texture_half_float(ext);
677
+ return new OES_texture_half_float(ext);
576
678
  case 'org.nativescript.canvas.extensions.OES_texture_half_float_linear':
577
- return new WebGLExtensions_1.OES_texture_half_float_linear(ext);
679
+ return new OES_texture_half_float_linear(ext);
578
680
  case 'org.nativescript.canvas.extensions.OES_vertex_array_object':
579
- return new WebGLExtensions_1.OES_vertex_array_object(ext);
681
+ return new OES_vertex_array_object(ext);
580
682
  case 'org.nativescript.canvas.extensions.WEBGL_color_buffer_float':
581
- return new WebGLExtensions_1.WEBGL_color_buffer_float(ext);
683
+ return new WEBGL_color_buffer_float(ext);
582
684
  case 'org.nativescript.canvas.extensions.WEBGL_compressed_texture_atc':
583
- return new WebGLExtensions_1.WEBGL_compressed_texture_atc(ext);
685
+ return new WEBGL_compressed_texture_atc(ext);
584
686
  case 'org.nativescript.canvas.extensions.WEBGL_compressed_texture_etc':
585
- return new WebGLExtensions_1.WEBGL_compressed_texture_etc(ext);
687
+ return new WEBGL_compressed_texture_etc(ext);
586
688
  case 'org.nativescript.canvas.extensions.WEBGL_compressed_texture_etc1':
587
- return new WebGLExtensions_1.WEBGL_compressed_texture_etc1(ext);
689
+ return new WEBGL_compressed_texture_etc1(ext);
588
690
  case 'org.nativescript.canvas.extensions.WEBGL_compressed_texture_pvrtc':
589
- return new WebGLExtensions_1.WEBGL_compressed_texture_pvrtc(ext);
691
+ return new WEBGL_compressed_texture_pvrtc(ext);
590
692
  case 'org.nativescript.canvas.extensions.WEBGL_compressed_texture_s3tc':
591
- return new WebGLExtensions_1.WEBGL_compressed_texture_s3tc(ext);
693
+ return new WEBGL_compressed_texture_s3tc(ext);
592
694
  case 'org.nativescript.canvas.extensions.WEBGL_lose_context':
593
- return new WebGLExtensions_1.WEBGL_lose_context(ext);
695
+ return new WEBGL_lose_context(ext);
594
696
  case 'org.nativescript.canvas.extensions.WEBGL_depth_texture':
595
- return new WebGLExtensions_1.WEBGL_depth_texture(ext);
697
+ return new WEBGL_depth_texture(ext);
596
698
  case 'org.nativescript.canvas.extensions.WEBGL_draw_buffers':
597
- return new WebGLExtensions_1.WEBGL_draw_buffers(ext);
699
+ return new WEBGL_draw_buffers(ext);
598
700
  }
599
701
  }
600
702
  return null;
601
- };
602
- WebGLRenderingContext.prototype.getFramebufferAttachmentParameter = function (target, attachment, pname) {
703
+ }
704
+ getFramebufferAttachmentParameter(target, attachment, pname) {
603
705
  this._glCheckError('getFramebufferAttachmentParameter');
604
706
  this._checkArgs('getFramebufferAttachmentParameter', arguments);
605
- var param = this.context.getFramebufferAttachmentParameter(target, attachment, pname);
707
+ const param = this.context.getFramebufferAttachmentParameter(target, attachment, pname);
606
708
  if (param.isRenderbuffer()) {
607
- return new WebGLRenderbuffer_1.WebGLRenderbuffer(param.getValue());
709
+ return new WebGLRenderbuffer(param.getValue());
608
710
  }
609
711
  else if (param.isTexture()) {
610
- return new WebGLTexture_1.WebGLTexture(param.getValue());
712
+ return new WebGLTexture(param.getValue());
611
713
  }
612
714
  return WebGLRenderingContext.toPrimitive(param.getValue());
613
- };
614
- WebGLRenderingContext.prototype.getParameter = function (pname) {
715
+ }
716
+ getParameter(pname) {
615
717
  this._glCheckError('getParameter');
616
718
  this._checkArgs('activeTexture', arguments);
617
- var value = this.context.getParameter(pname);
719
+ const value = this.context.getParameter(pname);
618
720
  switch (pname) {
619
721
  case this.COLOR_WRITEMASK:
620
722
  case this.COLOR_CLEAR_VALUE:
@@ -625,16 +727,25 @@ var WebGLRenderingContext = /** @class */ (function (_super) {
625
727
  return new Float32Array(this.getJSArray(value));
626
728
  case this.ARRAY_BUFFER_BINDING:
627
729
  case this.ELEMENT_ARRAY_BUFFER_BINDING:
628
- return new WebGLBuffer_1.WebGLBuffer(WebGLRenderingContext.toPrimitive(value));
730
+ if (value) {
731
+ new WebGLBuffer(WebGLRenderingContext.toPrimitive(value));
732
+ }
733
+ return null;
629
734
  case this.CURRENT_PROGRAM:
630
- return new WebGLProgram_1.WebGLProgram(WebGLRenderingContext.toPrimitive(value));
735
+ if (value) {
736
+ return new WebGLProgram(WebGLRenderingContext.toPrimitive(value));
737
+ }
738
+ return null;
631
739
  case this.COMPRESSED_TEXTURE_FORMATS:
632
740
  return new Uint32Array(this.getJSArray(value));
633
741
  case this.RENDERBUFFER_BINDING:
634
- return new WebGLRenderbuffer_1.WebGLRenderbuffer(WebGLRenderingContext.toPrimitive(value));
742
+ if (value) {
743
+ return new WebGLRenderbuffer(WebGLRenderingContext.toPrimitive(value));
744
+ }
745
+ return null;
635
746
  case this.FRAMEBUFFER_BINDING:
636
747
  if (value) {
637
- return new WebGLFramebuffer_1.WebGLFramebuffer(WebGLRenderingContext.toPrimitive(value));
748
+ return new WebGLFramebuffer(WebGLRenderingContext.toPrimitive(value));
638
749
  }
639
750
  return null;
640
751
  case this.VIEWPORT:
@@ -644,7 +755,7 @@ var WebGLRenderingContext = /** @class */ (function (_super) {
644
755
  case this.TEXTURE_BINDING_CUBE_MAP:
645
756
  case this.TEXTURE_BINDING_2D:
646
757
  if (value) {
647
- return new WebGLTexture_1.WebGLTexture(WebGLRenderingContext.toPrimitive(value));
758
+ return new WebGLTexture(WebGLRenderingContext.toPrimitive(value));
648
759
  }
649
760
  return null;
650
761
  case this.VERSION:
@@ -657,156 +768,156 @@ var WebGLRenderingContext = /** @class */ (function (_super) {
657
768
  default:
658
769
  return WebGLRenderingContext.toPrimitive(value);
659
770
  }
660
- };
661
- WebGLRenderingContext.prototype.getProgramInfoLog = function (program) {
771
+ }
772
+ getProgramInfoLog(program) {
662
773
  this._glCheckError('getProgramInfoLog');
663
774
  this._checkArgs('getProgramInfoLog', arguments);
664
- var value = program ? program.native : 0;
775
+ const value = program ? program.native : 0;
665
776
  return this.context.getProgramInfoLog(value);
666
- };
667
- WebGLRenderingContext.prototype.getProgramParameter = function (program, pname) {
777
+ }
778
+ getProgramParameter(program, pname) {
668
779
  this._glCheckError('getProgramParameter');
669
780
  this._checkArgs('getProgramParameter', arguments);
670
- var value = program ? program.native : 0;
671
- var result = this.context.getProgramParameter(value, pname);
781
+ const value = program ? program.native : 0;
782
+ const result = this.context.getProgramParameter(value, pname);
672
783
  return WebGLRenderingContext.toPrimitive(result);
673
- };
674
- WebGLRenderingContext.prototype.getRenderbufferParameter = function (target, pname) {
784
+ }
785
+ getRenderbufferParameter(target, pname) {
675
786
  this._glCheckError('getRenderbufferParameter');
676
787
  this._checkArgs('getRenderbufferParameter', arguments);
677
788
  return this.context.getRenderbufferParameter(target, pname);
678
- };
679
- WebGLRenderingContext.prototype.getShaderInfoLog = function (shader) {
789
+ }
790
+ getShaderInfoLog(shader) {
680
791
  this._glCheckError('getShaderInfoLog');
681
792
  this._checkArgs('getShaderInfoLog', arguments);
682
- var value = shader ? shader.native : 0;
793
+ const value = shader ? shader.native : 0;
683
794
  return this.context.getShaderInfoLog(value);
684
- };
685
- WebGLRenderingContext.prototype.getShaderParameter = function (shader, pname) {
795
+ }
796
+ getShaderParameter(shader, pname) {
686
797
  this._glCheckError('getShaderParameter');
687
798
  this._checkArgs('getShaderParameter', arguments);
688
- var value = shader ? shader.native : 0;
689
- var result = this.context.getShaderParameter(value, pname);
799
+ const value = shader ? shader.native : 0;
800
+ const result = this.context.getShaderParameter(value, pname);
690
801
  return WebGLRenderingContext.toPrimitive(result);
691
- };
692
- WebGLRenderingContext.prototype.getShaderPrecisionFormat = function (shaderType, precisionType) {
802
+ }
803
+ getShaderPrecisionFormat(shaderType, precisionType) {
693
804
  this._glCheckError('getShaderPrecisionFormat');
694
805
  this._checkArgs('getShaderPrecisionFormat', arguments);
695
- var precision = this.context.getShaderPrecisionFormat(shaderType, precisionType);
696
- return new WebGLShaderPrecisionFormat_1.WebGLShaderPrecisionFormat(precision.getRangeMin(), precision.getRangeMax(), precision.getPrecision());
697
- };
698
- WebGLRenderingContext.prototype.getShaderSource = function (shader) {
806
+ const precision = this.context.getShaderPrecisionFormat(shaderType, precisionType);
807
+ return new WebGLShaderPrecisionFormat(precision.getRangeMin(), precision.getRangeMax(), precision.getPrecision());
808
+ }
809
+ getShaderSource(shader) {
699
810
  this._glCheckError('getShaderSource');
700
811
  this._checkArgs('getShaderSource', arguments);
701
- var value = shader ? shader.native : 0;
812
+ const value = shader ? shader.native : 0;
702
813
  return this.context.getShaderSource(value);
703
- };
704
- WebGLRenderingContext.prototype.getSupportedExtensions = function () {
814
+ }
815
+ getSupportedExtensions() {
705
816
  this._glCheckError('getSupportedExtensions');
706
817
  return this.getJSArray(this.context.getSupportedExtensions());
707
- };
708
- WebGLRenderingContext.prototype.getTexParameter = function (target, pname) {
818
+ }
819
+ getTexParameter(target, pname) {
709
820
  this._glCheckError('getTexParameter');
710
821
  this._checkArgs('getTexParameter', arguments);
711
822
  return this.context.getTexParameter(target, pname);
712
- };
713
- WebGLRenderingContext.prototype.getUniformLocation = function (program, name) {
823
+ }
824
+ getUniformLocation(program, name) {
714
825
  this._glCheckError('getUniformLocation');
715
826
  this._checkArgs('getUniformLocation', arguments);
716
- var value = program ? program.native : 0;
717
- var id = this.context.getUniformLocation(value, name);
827
+ const value = program ? program.native : 0;
828
+ const id = this.context.getUniformLocation(value, name);
718
829
  if (id === -1) {
719
830
  return null;
720
831
  }
721
- return new WebGLUniformLocation_1.WebGLUniformLocation(id);
722
- };
723
- WebGLRenderingContext.prototype.getUniform = function (program, location) {
832
+ return new WebGLUniformLocation(id);
833
+ }
834
+ getUniform(program, location) {
724
835
  this._glCheckError('getUniform');
725
836
  this._checkArgs('getUniform', arguments);
726
- var value = program ? program.native : 0;
727
- var value2 = location ? location.native : 0;
728
- var uniform = this.context.getUniform(value, value2);
837
+ const value = program ? program.native : 0;
838
+ const value2 = location ? location.native : 0;
839
+ const uniform = this.context.getUniform(value, value2);
729
840
  if (uniform && uniform.length) {
730
841
  return this.getJSArray(uniform);
731
842
  }
732
843
  return WebGLRenderingContext.toPrimitive(uniform);
733
- };
734
- WebGLRenderingContext.prototype.getVertexAttribOffset = function (index, pname) {
844
+ }
845
+ getVertexAttribOffset(index, pname) {
735
846
  this._glCheckError('getVertexAttribOffset');
736
847
  this._checkArgs('getVertexAttribOffset', arguments);
737
848
  return this.context.getVertexAttribOffset(index, pname);
738
- };
739
- WebGLRenderingContext.prototype.getVertexAttrib = function (index, pname) {
849
+ }
850
+ getVertexAttrib(index, pname) {
740
851
  this._glCheckError('getVertexAttrib');
741
852
  this._checkArgs('getVertexAttrib', arguments);
742
- var value = this.context.getVertexAttrib(index, pname);
853
+ const value = this.context.getVertexAttrib(index, pname);
743
854
  if (pname === this.CURRENT_VERTEX_ATTRIB) {
744
855
  return new Float32Array(this.getJSArray(value));
745
856
  }
746
857
  return WebGLRenderingContext.toPrimitive(value);
747
- };
748
- WebGLRenderingContext.prototype.hint = function (target, mode) {
858
+ }
859
+ hint(target, mode) {
749
860
  this._glCheckError('hint');
750
861
  this._checkArgs('hint', arguments);
751
862
  this.context.hint(target, mode);
752
- };
753
- WebGLRenderingContext.prototype.isBuffer = function (buffer) {
863
+ }
864
+ isBuffer(buffer) {
754
865
  this._glCheckError('isBuffer');
755
866
  this._checkArgs('isBuffer', arguments);
756
- var value = buffer ? buffer.native : 0;
867
+ const value = buffer ? buffer.native : 0;
757
868
  return this.context.isBuffer(value);
758
- };
759
- WebGLRenderingContext.prototype.isContextLost = function () {
869
+ }
870
+ isContextLost() {
760
871
  this._glCheckError('isContextLost');
761
872
  return this.context.isContextLost();
762
- };
763
- WebGLRenderingContext.prototype.isEnabled = function (cap) {
873
+ }
874
+ isEnabled(cap) {
764
875
  this._glCheckError('isEnabled');
765
876
  this._checkArgs('isEnabled', arguments);
766
877
  return this.context.isEnabled(cap);
767
- };
768
- WebGLRenderingContext.prototype.isFramebuffer = function (framebuffer) {
878
+ }
879
+ isFramebuffer(framebuffer) {
769
880
  this._glCheckError('isFramebuffer');
770
881
  this._checkArgs('isFramebuffer', arguments);
771
- var value = framebuffer ? framebuffer.native : 0;
882
+ const value = framebuffer ? framebuffer.native : 0;
772
883
  return this.context.isFramebuffer(value);
773
- };
774
- WebGLRenderingContext.prototype.isProgram = function (program) {
884
+ }
885
+ isProgram(program) {
775
886
  this._glCheckError('isProgram');
776
887
  this._checkArgs('isProgram', arguments);
777
- var value = program ? program.native : 0;
888
+ const value = program ? program.native : 0;
778
889
  return this.context.isProgram(value);
779
- };
780
- WebGLRenderingContext.prototype.isRenderbuffer = function (renderbuffer) {
890
+ }
891
+ isRenderbuffer(renderbuffer) {
781
892
  this._glCheckError('isRenderbuffer');
782
893
  this._checkArgs('isRenderbuffer', arguments);
783
- var value = renderbuffer ? renderbuffer.native : 0;
894
+ const value = renderbuffer ? renderbuffer.native : 0;
784
895
  return this.context.isRenderbuffer(value);
785
- };
786
- WebGLRenderingContext.prototype.isShader = function (shader) {
896
+ }
897
+ isShader(shader) {
787
898
  this._glCheckError('isShader');
788
899
  this._checkArgs('isShader', arguments);
789
- var value = shader ? shader.native : 0;
900
+ const value = shader ? shader.native : 0;
790
901
  return this.context.isShader(value);
791
- };
792
- WebGLRenderingContext.prototype.isTexture = function (texture) {
902
+ }
903
+ isTexture(texture) {
793
904
  this._glCheckError('isTexture');
794
905
  this._checkArgs('isTexture', arguments);
795
- var value = texture ? texture.native : 0;
906
+ const value = texture ? texture.native : 0;
796
907
  return this.context.isTexture(value);
797
- };
798
- WebGLRenderingContext.prototype.lineWidth = function (width) {
908
+ }
909
+ lineWidth(width) {
799
910
  this._glCheckError('lineWidth');
800
911
  this._checkArgs('lineWidth', arguments);
801
912
  this.context.lineWidth(width);
802
- };
803
- WebGLRenderingContext.prototype.linkProgram = function (program) {
913
+ }
914
+ linkProgram(program) {
804
915
  this._glCheckError('linkProgram');
805
916
  this._checkArgs('linkProgram', arguments);
806
- var value = program ? program.native : 0;
917
+ const value = program ? program.native : 0;
807
918
  this.context.linkProgram(value);
808
- };
809
- WebGLRenderingContext.prototype.pixelStorei = function (pname, param) {
919
+ }
920
+ pixelStorei(pname, param) {
810
921
  this._glCheckError('pixelStorei');
811
922
  this._checkArgs('pixelStorei', arguments);
812
923
  if (pname === this.UNPACK_FLIP_Y_WEBGL || pname === this.UNPACK_PREMULTIPLY_ALPHA_WEBGL) {
@@ -824,34 +935,74 @@ var WebGLRenderingContext = /** @class */ (function (_super) {
824
935
  else {
825
936
  this.context.pixelStorei(pname, param);
826
937
  }
827
- };
828
- WebGLRenderingContext.prototype.polygonOffset = function (factor, units) {
938
+ }
939
+ polygonOffset(factor, units) {
829
940
  this._glCheckError('polygonOffset');
830
941
  this._checkArgs('polygonOffset', arguments);
831
942
  this.context.polygonOffset(factor, units);
832
- };
833
- WebGLRenderingContext.prototype.readPixels = function (x, y, width, height, format, type, pixels) {
943
+ }
944
+ readPixels(x, y, width, height, format, type, pixels) {
834
945
  this._glCheckError('readPixels');
835
946
  this._checkArgs('readPixels', arguments);
947
+ // @ts-ignore
836
948
  if (pixels && pixels.buffer instanceof ArrayBuffer) {
837
- if (pixels instanceof Uint8Array) {
838
- this.context.readPixels(x, y, width, height, format, type, this.toNativeArray(pixels, 'byte'));
839
- }
840
- else if (pixels instanceof Uint16Array || pixels instanceof Int16Array) {
841
- this.context.readPixels(x, y, width, height, format, type, this.toNativeArray(pixels, 'short'));
949
+ // @ts-ignore
950
+ if (pixels.buffer.nativeObject) {
951
+ // @ts-ignore
952
+ this.context.readPixels(x, y, width, height, format, type, pixels.buffer.nativeObject);
842
953
  }
843
- else if (pixels instanceof Uint32Array || pixels instanceof Int32Array) {
844
- this.context.readPixels(x, y, width, height, format, type, this.toNativeArray(pixels, 'int'));
845
- }
846
- else if (pixels instanceof Float32Array) {
847
- this.context.readPixels(x, y, width, height, format, type, this.toNativeArray(pixels, 'float'));
954
+ else {
955
+ if (pixels instanceof Uint8Array) {
956
+ if (this._isSupported) {
957
+ this.context.readPixelsByteBuffer(x, y, width, height, format, type, pixels);
958
+ }
959
+ else {
960
+ this.context.readPixelsByte(x, y, width, height, format, type, Array.from(pixels));
961
+ }
962
+ }
963
+ else if (pixels instanceof Uint16Array || pixels instanceof Int16Array) {
964
+ if (this._isSupported) {
965
+ this.context.readPixelsShortBuffer(x, y, width, height, format, type, pixels);
966
+ }
967
+ else {
968
+ this.context.readPixelsShort(x, y, width, height, format, type, Array.from(pixels));
969
+ }
970
+ }
971
+ else if (pixels instanceof Uint32Array || pixels instanceof Int32Array) {
972
+ if (this._isSupported) {
973
+ this.context.readPixelsIntBuffer(x, y, width, height, format, type, pixels);
974
+ }
975
+ else {
976
+ this.context.readPixelsInt(x, y, width, height, format, type, Array.from(pixels));
977
+ }
978
+ }
979
+ else if (pixels instanceof Float32Array) {
980
+ if (this._isSupported) {
981
+ this.context.readPixelsFloatBuffer(x, y, width, height, format, type, pixels);
982
+ }
983
+ else {
984
+ this.context.readPixelsFloat(x, y, width, height, format, type, Array.from(pixels));
985
+ }
986
+ }
848
987
  }
849
988
  }
850
989
  else if (pixels instanceof ArrayBuffer) {
851
- this.context.readPixels(x, y, width, height, format, type, this.toNativeArray(new Uint8Array(pixels), 'byte'));
990
+ // @ts-ignore
991
+ if (pixels.nativeObject) {
992
+ // @ts-ignore
993
+ this.context.readPixels(x, y, width, height, format, type, pixels.nativeObject);
994
+ }
995
+ else {
996
+ if (this._isSupported) {
997
+ this.context.readPixelsByteBuffer(x, y, width, height, format, type, pixels);
998
+ }
999
+ else {
1000
+ this.context.readPixelsByte(x, y, width, height, format, type, Array.from(new Uint8Array(pixels)));
1001
+ }
1002
+ }
852
1003
  }
853
- };
854
- WebGLRenderingContext.prototype.renderbufferStorage = function (target, internalFormat, width, height) {
1004
+ }
1005
+ renderbufferStorage(target, internalFormat, width, height) {
855
1006
  this._glCheckError('renderbufferStorage');
856
1007
  this._checkArgs('renderbufferStorage', arguments);
857
1008
  if (internalFormat === this.DEPTH_STENCIL) {
@@ -860,73 +1011,95 @@ var WebGLRenderingContext = /** @class */ (function (_super) {
860
1011
  internalFormat = 0x88f0;
861
1012
  }
862
1013
  this.context.renderbufferStorage(target, internalFormat, width, height);
863
- };
864
- WebGLRenderingContext.prototype.sampleCoverage = function (value, invert) {
1014
+ }
1015
+ sampleCoverage(value, invert) {
865
1016
  this._glCheckError('sampleCoverage');
866
1017
  this._checkArgs('sampleCoverage', arguments);
867
1018
  this.context.sampleCoverage(value, invert);
868
- };
869
- WebGLRenderingContext.prototype.scissor = function (x, y, width, height) {
1019
+ }
1020
+ scissor(x, y, width, height) {
870
1021
  this._glCheckError('scissor');
871
1022
  this._checkArgs('scissor', arguments);
872
1023
  this.context.scissor(x, y, width, height);
873
- };
874
- WebGLRenderingContext.prototype.shaderSource = function (shader, source) {
1024
+ }
1025
+ shaderSource(shader, source) {
875
1026
  this._glCheckError('shaderSource');
876
1027
  this._checkArgs('shaderSource', arguments);
877
- var value = shader ? shader.native : 0;
1028
+ const value = shader ? shader.native : 0;
878
1029
  this.context.shaderSource(value, source);
879
- };
880
- WebGLRenderingContext.prototype.stencilFuncSeparate = function (face, func, ref, mask) {
1030
+ }
1031
+ stencilFuncSeparate(face, func, ref, mask) {
881
1032
  this._glCheckError('stencilFuncSeparate');
882
1033
  this._checkArgs('stencilFuncSeparate', arguments);
883
1034
  this.context.stencilFuncSeparate(face, func, ref, mask);
884
- };
885
- WebGLRenderingContext.prototype.stencilFunc = function (func, ref, mask) {
1035
+ }
1036
+ stencilFunc(func, ref, mask) {
886
1037
  this._glCheckError('stencilFunc');
887
1038
  this._checkArgs('stencilFunc', arguments);
888
1039
  this.context.stencilFunc(func, ref, mask);
889
- };
890
- WebGLRenderingContext.prototype.stencilMaskSeparate = function (face, mask) {
1040
+ }
1041
+ stencilMaskSeparate(face, mask) {
891
1042
  this._glCheckError('stencilMaskSeparate');
892
1043
  this._checkArgs('stencilMaskSeparate', arguments);
893
1044
  this.context.stencilMaskSeparate(face, mask);
894
- };
895
- WebGLRenderingContext.prototype.stencilMask = function (mask) {
1045
+ }
1046
+ stencilMask(mask) {
896
1047
  this._glCheckError('stencilMask');
897
1048
  this._checkArgs('stencilMask', arguments);
898
1049
  this.context.stencilMask(mask);
899
- };
900
- WebGLRenderingContext.prototype.stencilOpSeparate = function (face, fail, zfail, zpass) {
1050
+ }
1051
+ stencilOpSeparate(face, fail, zfail, zpass) {
901
1052
  this._glCheckError('stencilOpSeparate');
902
1053
  this._checkArgs('stencilOpSeparate', arguments);
903
1054
  this.context.stencilOpSeparate(face, fail, zfail, zpass);
904
- };
905
- WebGLRenderingContext.prototype.stencilOp = function (fail, zfail, zpass) {
1055
+ }
1056
+ stencilOp(fail, zfail, zpass) {
906
1057
  this._glCheckError('stencilOp');
907
1058
  this._checkArgs('stencilOp', arguments);
908
1059
  this.context.stencilOp(fail, zfail, zpass);
909
- };
910
- WebGLRenderingContext.prototype.texImage2D = function (target, level, internalformat, width, height, border, format, type, pixels) {
1060
+ }
1061
+ texImage2D(target, level, internalformat, width, height, border, format, type, pixels) {
911
1062
  this._glCheckError('texImage2D');
912
1063
  this._checkArgs('texImage2D', arguments);
913
- /* TODO */
914
- // this.blendFunc(this.SRC_ALPHA, this.ONE_MINUS_SRC_ALPHA);
915
- // this.enable(this.BLEND);
916
- /* TODO */
917
1064
  if (arguments.length === 9) {
918
1065
  if (pixels && pixels.buffer instanceof ArrayBuffer) {
919
- if (pixels instanceof Uint8Array) {
920
- this.context.texImage2D(target, level, internalformat, width, height, border, format, type, this.toNativeArray(pixels, 'byte'));
921
- }
922
- else if (pixels instanceof Uint16Array || pixels instanceof Int16Array) {
923
- this.context.texImage2D(target, level, internalformat, width, height, border, format, type, this.toNativeArray(pixels, 'short'));
924
- }
925
- else if (pixels instanceof Uint32Array || pixels instanceof Int32Array) {
926
- this.context.texImage2D(target, level, internalformat, width, height, border, format, type, this.toNativeArray(pixels, 'int'));
1066
+ if (pixels.buffer.nativeObject) {
1067
+ // @ts-ignore
1068
+ this.context.texImage2D(target, level, internalformat, width, height, border, format, type, pixels.buffer.nativeObject);
927
1069
  }
928
- else if (pixels instanceof Float32Array) {
929
- this.context.texImage2D(target, level, internalformat, width, height, border, format, type, this.toNativeArray(pixels, 'float'));
1070
+ else {
1071
+ if (pixels instanceof Uint8Array) {
1072
+ if (this._isSupported) {
1073
+ this.context.texImage2DByteBuffer(target, level, internalformat, width, height, border, format, type, pixels);
1074
+ }
1075
+ else {
1076
+ this.context.texImage2DByte(target, level, internalformat, width, height, border, format, type, Array.from(pixels));
1077
+ }
1078
+ }
1079
+ else if (pixels instanceof Uint16Array || pixels instanceof Int16Array) {
1080
+ if (this._isSupported) {
1081
+ this.context.texSubImage2DShortBuffer(target, level, internalformat, width, height, border, format, type, pixels);
1082
+ }
1083
+ else {
1084
+ this.context.texSubImage2DShort(target, level, internalformat, width, height, border, format, type, Array.from(pixels));
1085
+ }
1086
+ }
1087
+ else if (pixels instanceof Uint32Array || pixels instanceof Int32Array) {
1088
+ if (this._isSupported) {
1089
+ this.context.texImage2DIntBuffer(target, level, internalformat, width, height, border, format, type, pixels);
1090
+ }
1091
+ else {
1092
+ this.context.texImage2DInt(target, level, internalformat, width, height, border, format, type, Array.from(pixels));
1093
+ }
1094
+ }
1095
+ else if (pixels instanceof Float32Array) {
1096
+ if (this._isSupported) {
1097
+ this.context.texImage2DFloatBuffer(target, level, internalformat, width, height, border, format, type, pixels);
1098
+ }
1099
+ else {
1100
+ this.context.texImage2DFloat(target, level, internalformat, width, height, border, format, type, Array.from(pixels));
1101
+ }
1102
+ }
930
1103
  }
931
1104
  }
932
1105
  else if (pixels instanceof ArrayBuffer) {
@@ -936,7 +1109,12 @@ var WebGLRenderingContext = /** @class */ (function (_super) {
936
1109
  this.context.texImage2D(target, level, internalformat, width, height, border, format, type, pixels.nativeObject);
937
1110
  }
938
1111
  else {
939
- this.context.texImage2D(target, level, internalformat, width, height, border, format, type, this.toNativeArray(new Uint8Array(pixels), 'byte'));
1112
+ if (this._isSupported) {
1113
+ this.context.texImage2DByteBuffer(target, level, internalformat, width, height, border, format, type, pixels);
1114
+ }
1115
+ else {
1116
+ this.context.texImage2DByte(target, level, internalformat, width, height, border, format, type, Array.from(new Uint8Array(pixels)));
1117
+ }
940
1118
  }
941
1119
  }
942
1120
  else {
@@ -944,304 +1122,555 @@ var WebGLRenderingContext = /** @class */ (function (_super) {
944
1122
  }
945
1123
  }
946
1124
  else if (arguments.length === 6) {
947
- if (border && typeof border.tagName === 'string' && (border.tagName === 'VID' || border.tagName === 'VIDEO') && typeof border._video && typeof border._video.getCurrentFrame === 'function') {
1125
+ if (border && typeof border.tagName === 'string' && (border.tagName === 'VID' || border.tagName === 'VIDEO') && border._video && typeof border._video.getCurrentFrame === 'function') {
948
1126
  border._video.getCurrentFrame(this.context, this, target, level, internalformat, width, height);
949
1127
  }
950
1128
  else if (border && typeof border.getCurrentFrame === 'function') {
951
1129
  border.getCurrentFrame(this.context, this, target, level, internalformat, width, height);
952
1130
  }
953
- else if (border instanceof ImageAsset_1.ImageAsset) {
1131
+ else if (border instanceof ImageAsset) {
1132
+ this.context.texImage2D(target, level, internalformat, width, height, border.native);
1133
+ }
1134
+ else if (border instanceof ImageBitmap || (border === null || border === void 0 ? void 0 : border.native) instanceof org.nativescript.canvas.TNSImageBitmap) {
954
1135
  this.context.texImage2D(target, level, internalformat, width, height, border.native);
955
1136
  }
956
1137
  else if (border instanceof android.graphics.Bitmap) {
957
1138
  this.context.texImage2D(target, level, internalformat, width, height, border);
958
1139
  }
959
- else if (border instanceof core_1.ImageSource) {
1140
+ else if (border instanceof ImageSource) {
960
1141
  this.context.texImage2D(target, level, internalformat, width, height, border.android);
961
1142
  }
962
1143
  else if (border && typeof border.tagName === 'string' && (border.tagName === 'IMG' || border.tagName === 'IMAGE')) {
963
- if (border._asset instanceof ImageAsset_1.ImageAsset) {
1144
+ if (border._asset instanceof ImageAsset) {
964
1145
  this.context.texImage2D(target, level, internalformat, width, height, border._asset.native);
965
1146
  }
966
- else if (border._imageSource instanceof core_1.ImageSource) {
1147
+ else if (border._imageSource instanceof ImageSource) {
967
1148
  this.context.texImage2D(target, level, internalformat, width, height, border._imageSource.android);
968
1149
  }
969
1150
  else if (border._image instanceof android.graphics.Bitmap) {
970
1151
  this.context.texImage2D(target, level, internalformat, width, height, border._image);
971
1152
  }
972
1153
  else if (typeof border.src === 'string') {
973
- this.context.texImage2D(target, level, internalformat, width, height, core_1.ImageSource.fromFileSync(border.src).android);
1154
+ this.context.texImage2D(target, level, internalformat, width, height, ImageSource.fromFileSync(border.src).android);
974
1155
  }
975
1156
  }
976
- else if (border && typeof border.tagName === 'string' && border.tagName === 'CANVAS' && border._canvas instanceof Canvas_1.Canvas) {
1157
+ else if (border && typeof border.tagName === 'string' && border.tagName === 'CANVAS' && border._canvas instanceof Canvas) {
977
1158
  this.context.texImage2D(target, level, internalformat, width, height, border._canvas.android);
978
1159
  }
979
1160
  }
980
- // this.blendFunc(this.SRC_ALPHA, this.ZERO);
981
- // this.disable(this.BLEND);
982
- };
983
- WebGLRenderingContext.prototype.texParameterf = function (target, pname, param) {
1161
+ }
1162
+ texParameterf(target, pname, param) {
984
1163
  this._glCheckError('texParameterf');
985
1164
  this._checkArgs('texParameterf', arguments);
986
1165
  this.context.texParameterf(target, pname, param);
987
- };
988
- WebGLRenderingContext.prototype.texParameteri = function (target, pname, param) {
1166
+ }
1167
+ texParameteri(target, pname, param) {
989
1168
  this._glCheckError('texParameteri');
990
1169
  this._checkArgs('texParameteri', arguments);
991
1170
  this.context.texParameteri(target, pname, param);
992
- };
993
- WebGLRenderingContext.prototype.texSubImage2D = function (target, level, xoffset, yoffset, width, height, format, type, pixels) {
1171
+ }
1172
+ texSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels) {
994
1173
  this._glCheckError('texSubImage2D');
995
1174
  this._checkArgs('texSubImage2D', arguments);
996
1175
  if (arguments.length === 9) {
997
1176
  if (pixels && pixels.buffer) {
998
- if (pixels instanceof Uint8Array) {
999
- this.context.texSubImage2D(target, level, xoffset, yoffset, width, height, format, type, this.toNativeArray(pixels, 'byte'));
1000
- }
1001
- else if (pixels instanceof Uint16Array || pixels instanceof Int16Array) {
1002
- this.context.texSubImage2D(target, level, xoffset, yoffset, width, height, format, type, this.toNativeArray(pixels, 'short'));
1177
+ if (pixels.buffer.nativeObject) {
1178
+ this.context.texSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels.buffer.nativeObject);
1003
1179
  }
1004
- else if (pixels instanceof Uint32Array || pixels instanceof Int32Array) {
1005
- this.context.texSubImage2D(target, level, xoffset, yoffset, width, height, format, type, this.toNativeArray(pixels, 'int'));
1006
- }
1007
- else if (pixels instanceof Float32Array) {
1008
- this.context.texSubImage2D(target, level, xoffset, yoffset, width, height, format, type, this.toNativeArray(pixels, 'float'));
1180
+ else {
1181
+ if (pixels instanceof Uint8Array) {
1182
+ if (this._isSupported) {
1183
+ this.context.texSubImage2DByteBuffer(target, level, xoffset, yoffset, width, height, format, type, pixels);
1184
+ }
1185
+ else {
1186
+ this.context.texSubImage2DByte(target, level, xoffset, yoffset, width, height, format, type, Array.from(pixels));
1187
+ }
1188
+ }
1189
+ else if (pixels instanceof Uint16Array || pixels instanceof Int16Array) {
1190
+ if (this._isSupported) {
1191
+ this.context.texSubImage2DShortBuffer(target, level, xoffset, yoffset, width, height, format, type, pixels);
1192
+ }
1193
+ else {
1194
+ this.context.texSubImage2DShort(target, level, xoffset, yoffset, width, height, format, type, Array.from(pixels));
1195
+ }
1196
+ }
1197
+ else if (pixels instanceof Uint32Array || pixels instanceof Int32Array) {
1198
+ if (this._isSupported) {
1199
+ this.context.texSubImage2DIntBuffer(target, level, xoffset, yoffset, width, height, format, type, pixels);
1200
+ }
1201
+ else {
1202
+ this.context.texSubImage2DInt(target, level, xoffset, yoffset, width, height, format, type, Array.from(pixels));
1203
+ }
1204
+ }
1205
+ else if (pixels instanceof Float32Array) {
1206
+ if (this._isSupported) {
1207
+ this.context.texSubImage2DByte(target, level, xoffset, yoffset, width, height, format, type, pixels);
1208
+ }
1209
+ else {
1210
+ this.context.texSubImage2D(target, level, xoffset, yoffset, width, height, format, type, Array.from(pixels));
1211
+ }
1212
+ }
1009
1213
  }
1010
1214
  }
1011
1215
  else if (pixels instanceof ArrayBuffer) {
1012
- this.context.texSubImage2D(target, level, xoffset, yoffset, width, height, format, type, this.toNativeArray(new Uint8Array(pixels), 'byte'));
1216
+ // @ts-ignore
1217
+ if (pixels.nativeObject) {
1218
+ // @ts-ignore
1219
+ this.context.texSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels.nativeObject);
1220
+ }
1221
+ else {
1222
+ if (this._isSupported) {
1223
+ this.context.texSubImage2DByteBuffer(target, level, xoffset, yoffset, width, height, format, type, pixels);
1224
+ }
1225
+ else {
1226
+ this.context.texSubImage2DByte(target, level, xoffset, yoffset, width, height, format, type, Array.from(new Uint8Array(pixels)));
1227
+ }
1228
+ }
1013
1229
  }
1014
1230
  }
1015
1231
  else if (arguments.length === 7) {
1016
1232
  if (format instanceof android.graphics.Bitmap) {
1017
1233
  this.context.texSubImage2D(target, level, xoffset, yoffset, width, height, format);
1018
1234
  }
1019
- else if (format instanceof core_1.ImageSource) {
1235
+ else if (format instanceof ImageSource) {
1020
1236
  this.context.texSubImage2D(target, level, xoffset, yoffset, width, height, format.android);
1021
1237
  }
1022
- else if (format instanceof ImageAsset_1.ImageAsset) {
1238
+ else if (format instanceof ImageAsset) {
1239
+ this.context.texSubImage2D(target, level, xoffset, yoffset, width, height, format.native);
1240
+ }
1241
+ else if (format instanceof ImageBitmap || (format === null || format === void 0 ? void 0 : format.native) instanceof org.nativescript.canvas.TNSImageBitmap) {
1023
1242
  this.context.texSubImage2D(target, level, xoffset, yoffset, width, height, format.native);
1024
1243
  }
1025
1244
  else if (format && typeof format.tagName === 'string' && (format.tagName === 'IMG' || format.tagName === 'IMAGE')) {
1026
- if (format._imageSource instanceof core_1.ImageSource) {
1245
+ if (format._imageSource instanceof ImageSource) {
1027
1246
  this.context.texSubImage2D(target, level, xoffset, yoffset, width, height, format._imageSource.android);
1028
1247
  }
1029
1248
  else if (format._image instanceof android.graphics.Bitmap) {
1030
1249
  this.context.texSubImage2D(target, level, xoffset, yoffset, width, height, format._image);
1031
1250
  }
1032
- else if (format._asset instanceof ImageAsset_1.ImageAsset) {
1251
+ else if (format._asset instanceof ImageAsset) {
1033
1252
  this.context.texSubImage2D(target, level, xoffset, yoffset, width, height, format._asset.native);
1034
1253
  }
1035
1254
  else if (typeof format.src === 'string') {
1036
- var result = core_1.ImageSource.fromFileSync(format.src);
1255
+ const result = ImageSource.fromFileSync(format.src);
1037
1256
  this.context.texSubImage2D(target, level, xoffset, yoffset, width, height, result ? result.android : null);
1038
1257
  }
1039
- else if (format && typeof format.tagName === 'string' && format.tagName === 'CANVAS' && format._canvas instanceof Canvas_1.Canvas) {
1258
+ else if (format && typeof format.tagName === 'string' && format.tagName === 'CANVAS' && format._canvas instanceof Canvas) {
1040
1259
  this.context.texSubImage2D(target, level, xoffset, yoffset, width, height, format._canvas.android);
1041
1260
  }
1042
1261
  }
1043
1262
  }
1044
- };
1045
- WebGLRenderingContext.prototype.uniform1f = function (location, v0) {
1263
+ }
1264
+ uniform1f(location, v0) {
1046
1265
  this._glCheckError('uniform1f');
1047
1266
  this._checkArgs('uniform1f', arguments);
1048
- var loc = location ? location.native : 0;
1267
+ const loc = location ? location.native : 0;
1049
1268
  this.context.uniform1f(loc, v0);
1050
- };
1051
- WebGLRenderingContext.prototype.uniform1iv = function (location, value) {
1269
+ }
1270
+ uniform1iv(location, value) {
1052
1271
  this._glCheckError('uniform1iv');
1053
1272
  this._checkArgs('uniform1iv', arguments);
1054
- value = Array.from(value); // this.toNativeArray(value, 'int');
1055
- var loc = location ? location.native : 0;
1056
- this.context.uniform1iv(loc, value);
1057
- };
1058
- WebGLRenderingContext.prototype.uniform1fv = function (location, value) {
1273
+ const loc = location ? location.native : 0;
1274
+ if (this._isSupported) {
1275
+ if (!Array.isArray(value)) {
1276
+ this.context.uniform1ivBuffer(loc, value);
1277
+ }
1278
+ else {
1279
+ this.context.uniform1iv(loc, value);
1280
+ }
1281
+ }
1282
+ else {
1283
+ if (!Array.isArray(value)) {
1284
+ this.context.uniform1iv(loc, Array.from(value));
1285
+ }
1286
+ else {
1287
+ this.context.uniform1iv(loc, value);
1288
+ }
1289
+ }
1290
+ }
1291
+ uniform1fv(location, value) {
1059
1292
  this._glCheckError('uniform1fv');
1060
1293
  this._checkArgs('uniform1fv', arguments);
1061
- value = Array.from(value); // this.toNativeArray(value, 'float');
1062
- var loc = location ? location.native : 0;
1063
- this.context.uniform1fv(loc, value);
1064
- };
1065
- WebGLRenderingContext.prototype.uniform1i = function (location, v0) {
1294
+ const loc = location ? location.native : 0;
1295
+ if (this._isSupported) {
1296
+ if (!Array.isArray(value)) {
1297
+ this.context.uniform1fvBuffer(loc, value);
1298
+ }
1299
+ else {
1300
+ this.context.uniform1fv(loc, value);
1301
+ }
1302
+ }
1303
+ else {
1304
+ if (!Array.isArray(value)) {
1305
+ this.context.uniform1fv(loc, Array.from(value));
1306
+ }
1307
+ else {
1308
+ this.context.uniform1fv(loc, value);
1309
+ }
1310
+ }
1311
+ }
1312
+ uniform1i(location, v0) {
1066
1313
  this._glCheckError('uniform1i');
1067
1314
  this._checkArgs('uniform1i', arguments);
1068
- var loc = location ? location.native : 0;
1315
+ const loc = location ? location.native : 0;
1069
1316
  this.context.uniform1i(loc, Number(v0));
1070
- };
1071
- WebGLRenderingContext.prototype.uniform2f = function (location, v0, v1) {
1317
+ }
1318
+ uniform2f(location, v0, v1) {
1072
1319
  this._glCheckError('uniform2f');
1073
1320
  this._checkArgs('uniform2f', arguments);
1074
- var loc = location ? location.native : 0;
1321
+ const loc = location ? location.native : 0;
1075
1322
  this.context.uniform2f(loc, v0, v1);
1076
- };
1077
- WebGLRenderingContext.prototype.uniform2iv = function (location, value) {
1323
+ }
1324
+ uniform2iv(location, value) {
1078
1325
  this._glCheckError('uniform2iv');
1079
1326
  this._checkArgs('uniform2iv', arguments);
1080
- value = Array.from(value); // this.toNativeArray(value, 'int');
1081
- var loc = location ? location.native : 0;
1082
- this.context.uniform2iv(loc, value);
1083
- };
1084
- WebGLRenderingContext.prototype.uniform2fv = function (location, value) {
1327
+ const loc = location ? location.native : 0;
1328
+ if (this._isSupported) {
1329
+ if (!Array.isArray(value)) {
1330
+ this.context.uniform2ivBuffer(loc, value);
1331
+ }
1332
+ else {
1333
+ this.context.uniform2iv(loc, value);
1334
+ }
1335
+ }
1336
+ else {
1337
+ if (!Array.isArray(value)) {
1338
+ this.context.uniform2iv(loc, Array.from(value));
1339
+ }
1340
+ else {
1341
+ this.context.uniform2iv(loc, value);
1342
+ }
1343
+ }
1344
+ }
1345
+ uniform2fv(location, value) {
1085
1346
  this._glCheckError('uniform2fv');
1086
1347
  this._checkArgs('uniform2fv', arguments);
1087
- value = Array.from(value); // this.toNativeArray(value, 'float');
1088
- var loc = location ? location.native : 0;
1089
- this.context.uniform2fv(loc, value);
1090
- };
1091
- WebGLRenderingContext.prototype.uniform2i = function (location, v0, v1) {
1348
+ const loc = location ? location.native : 0;
1349
+ if (this._isSupported) {
1350
+ if (!Array.isArray(value)) {
1351
+ this.context.uniform2fvBuffer(loc, value);
1352
+ }
1353
+ else {
1354
+ this.context.uniform2fv(loc, value);
1355
+ }
1356
+ }
1357
+ else {
1358
+ if (!Array.isArray(value)) {
1359
+ this.context.uniform2fv(loc, Array.from(value));
1360
+ }
1361
+ else {
1362
+ this.context.uniform2fv(loc, value);
1363
+ }
1364
+ }
1365
+ }
1366
+ uniform2i(location, v0, v1) {
1092
1367
  this._glCheckError('uniform2i');
1093
1368
  this._checkArgs('uniform2i', arguments);
1094
- var loc = location ? location.native : 0;
1369
+ const loc = location ? location.native : 0;
1095
1370
  this.context.uniform2i(loc, v0, v1);
1096
- };
1097
- WebGLRenderingContext.prototype.uniform3f = function (location, v0, v1, v2) {
1371
+ }
1372
+ uniform3f(location, v0, v1, v2) {
1098
1373
  this._glCheckError('uniform3f');
1099
1374
  this._checkArgs('uniform3f', arguments);
1100
- var loc = location ? location.native : 0;
1375
+ const loc = location ? location.native : 0;
1101
1376
  this.context.uniform3f(loc, v0, v1, v2);
1102
- };
1103
- WebGLRenderingContext.prototype.uniform3iv = function (location, value) {
1377
+ }
1378
+ uniform3iv(location, value) {
1104
1379
  this._glCheckError('uniform3iv');
1105
1380
  this._checkArgs('uniform3iv', arguments);
1106
- value = Array.from(value); // this.toNativeArray(value, 'int');
1107
- var loc = location ? location.native : 0;
1108
- this.context.uniform3iv(loc, value);
1109
- };
1110
- WebGLRenderingContext.prototype.uniform3fv = function (location, value) {
1381
+ const loc = location ? location.native : 0;
1382
+ if (this._isSupported) {
1383
+ if (!Array.isArray(value)) {
1384
+ this.context.uniform3ivBuffer(loc, value);
1385
+ }
1386
+ else {
1387
+ this.context.uniform3iv(loc, value);
1388
+ }
1389
+ }
1390
+ else {
1391
+ if (!Array.isArray(value)) {
1392
+ this.context.uniform3iv(loc, Array.from(value));
1393
+ }
1394
+ else {
1395
+ this.context.uniform3iv(loc, value);
1396
+ }
1397
+ }
1398
+ }
1399
+ uniform3fv(location, value) {
1111
1400
  this._glCheckError('uniform3fv');
1112
1401
  this._checkArgs('uniform3fv', arguments);
1113
- value = Array.from(value); // this.toNativeArray(value, 'float');
1114
- var loc = location ? location.native : 0;
1115
- this.context.uniform3fv(loc, value);
1116
- };
1117
- WebGLRenderingContext.prototype.uniform3i = function (location, v0, v1, v2) {
1402
+ const loc = location ? location.native : 0;
1403
+ if (this._isSupported) {
1404
+ if (!Array.isArray(value)) {
1405
+ this.context.uniform3fvBuffer(loc, value);
1406
+ }
1407
+ else {
1408
+ this.context.uniform3fv(loc, value);
1409
+ }
1410
+ }
1411
+ else {
1412
+ if (!Array.isArray(value)) {
1413
+ this.context.uniform3fv(loc, Array.from(value));
1414
+ }
1415
+ else {
1416
+ this.context.uniform3fv(loc, value);
1417
+ }
1418
+ }
1419
+ }
1420
+ uniform3i(location, v0, v1, v2) {
1118
1421
  this._glCheckError('uniform3i');
1119
1422
  this._checkArgs('uniform3i', arguments);
1120
- var loc = location ? location.native : 0;
1423
+ const loc = location ? location.native : 0;
1121
1424
  this.context.uniform3i(loc, v0, v1, v2);
1122
- };
1123
- WebGLRenderingContext.prototype.uniform4f = function (location, v0, v1, v2, v3) {
1425
+ }
1426
+ uniform4f(location, v0, v1, v2, v3) {
1124
1427
  this._glCheckError('uniform4f');
1125
1428
  this._checkArgs('uniform4f', arguments);
1126
- var loc = location ? location.native : 0;
1429
+ const loc = location ? location.native : 0;
1127
1430
  this.context.uniform4f(loc, v0, v1, v2, v3);
1128
- };
1129
- WebGLRenderingContext.prototype.uniform4iv = function (location, value) {
1431
+ }
1432
+ uniform4iv(location, value) {
1130
1433
  this._glCheckError('uniform4iv');
1131
1434
  this._checkArgs('uniform4iv', arguments);
1132
- value = Array.from(value); // this.toNativeArray(value, 'int');
1133
- var loc = location ? location.native : 0;
1134
- this.context.uniform4iv(loc, value);
1135
- };
1136
- WebGLRenderingContext.prototype.uniform4fv = function (location, value) {
1435
+ const loc = location ? location.native : 0;
1436
+ if (this._isSupported) {
1437
+ if (!Array.isArray(value)) {
1438
+ this.context.uniform4ivBuffer(loc, value);
1439
+ }
1440
+ else {
1441
+ this.context.uniform4iv(loc, value);
1442
+ }
1443
+ }
1444
+ else {
1445
+ if (!Array.isArray(value)) {
1446
+ this.context.uniform4iv(loc, Array.from(value));
1447
+ }
1448
+ else {
1449
+ this.context.uniform4iv(loc, value);
1450
+ }
1451
+ }
1452
+ }
1453
+ uniform4fv(location, value) {
1137
1454
  this._glCheckError('uniform4fv');
1138
1455
  this._checkArgs('uniform4fv', arguments);
1139
- value = Array.from(value); // this.toNativeArray(value, 'float');
1140
- var loc = location ? location.native : 0;
1141
- this.context.uniform4fv(loc, value);
1142
- };
1143
- WebGLRenderingContext.prototype.uniform4i = function (location, v0, v1, v2, v3) {
1456
+ const loc = location ? location.native : 0;
1457
+ if (this._isSupported) {
1458
+ if (!Array.isArray(value)) {
1459
+ this.context.uniform4fvBuffer(loc, value);
1460
+ }
1461
+ else {
1462
+ this.context.uniform4fv(loc, value);
1463
+ }
1464
+ }
1465
+ else {
1466
+ if (!Array.isArray(value)) {
1467
+ this.context.uniform4fv(loc, Array.from(value));
1468
+ }
1469
+ else {
1470
+ this.context.uniform4fv(loc, value);
1471
+ }
1472
+ }
1473
+ }
1474
+ uniform4i(location, v0, v1, v2, v3) {
1144
1475
  this._glCheckError('uniform4i');
1145
1476
  this._checkArgs('uniform4i', arguments);
1146
- var loc = location ? location.native : 0;
1477
+ const loc = location ? location.native : 0;
1147
1478
  this.context.uniform4i(loc, v0, v1, v2, v3);
1148
- };
1149
- WebGLRenderingContext.prototype.uniformMatrix2fv = function (location, transpose, value) {
1479
+ }
1480
+ uniformMatrix2fv(location, transpose, value) {
1150
1481
  this._glCheckError('uniformMatrix2fv');
1151
1482
  this._checkArgs('uniformMatrix2fv', arguments);
1152
- value = Array.from(value); // this.toNativeArray(value, 'float');
1153
- var loc = location ? location.native : 0;
1154
- this.context.uniformMatrix2fv(loc, transpose, value);
1155
- };
1156
- WebGLRenderingContext.prototype.uniformMatrix3fv = function (location, transpose, value) {
1483
+ const loc = location ? location.native : 0;
1484
+ if (this._isSupported) {
1485
+ if (!Array.isArray(value)) {
1486
+ this.context.uniformMatrix2fvBuffer(loc, transpose, value);
1487
+ }
1488
+ else {
1489
+ this.context.uniformMatrix2fv(loc, transpose, value);
1490
+ }
1491
+ }
1492
+ else {
1493
+ if (!Array.isArray(value)) {
1494
+ this.context.uniformMatrix2fv(loc, transpose, Array.from(value));
1495
+ }
1496
+ else {
1497
+ this.context.uniformMatrix2fv(loc, transpose, value);
1498
+ }
1499
+ }
1500
+ }
1501
+ uniformMatrix3fv(location, transpose, value) {
1157
1502
  this._glCheckError('uniformMatrix3fv');
1158
1503
  this._checkArgs('uniformMatrix3fv', arguments);
1159
- value = Array.from(value); // this.toNativeArray(value, 'float');
1160
- var loc = location ? location.native : 0;
1161
- this.context.uniformMatrix3fv(loc, transpose, value);
1162
- };
1163
- WebGLRenderingContext.prototype.uniformMatrix4fv = function (location, transpose, value) {
1504
+ const loc = location ? location.native : 0;
1505
+ if (this._isSupported) {
1506
+ if (!Array.isArray(value)) {
1507
+ this.context.uniformMatrix3fvBuffer(loc, transpose, value);
1508
+ }
1509
+ else {
1510
+ this.context.uniformMatrix3fv(loc, transpose, value);
1511
+ }
1512
+ }
1513
+ else {
1514
+ if (!Array.isArray(value)) {
1515
+ this.context.uniformMatrix3fv(loc, transpose, Array.from(value));
1516
+ }
1517
+ else {
1518
+ this.context.uniformMatrix3fv(loc, transpose, value);
1519
+ }
1520
+ }
1521
+ }
1522
+ uniformMatrix4fv(location, transpose, value) {
1164
1523
  this._glCheckError('uniformMatrix4fv');
1165
1524
  this._checkArgs('uniformMatrix4fv', arguments);
1166
- value = Array.from(value); // this.toNativeArray(value, 'float');
1167
- var loc = location ? location.native : 0;
1168
- this.context.uniformMatrix4fv(loc, transpose, value);
1169
- };
1170
- WebGLRenderingContext.prototype.useProgram = function (program) {
1525
+ const loc = location ? location.native : 0;
1526
+ if (this._isSupported) {
1527
+ if (!Array.isArray(value)) {
1528
+ this.context.uniformMatrix4fvBuffer(loc, transpose, value);
1529
+ }
1530
+ else {
1531
+ this.context.uniformMatrix4fv(loc, transpose, value);
1532
+ }
1533
+ }
1534
+ else {
1535
+ if (!Array.isArray(value)) {
1536
+ this.context.uniformMatrix4fv(loc, transpose, Array.from(value));
1537
+ }
1538
+ else {
1539
+ this.context.uniformMatrix4fv(loc, transpose, value);
1540
+ }
1541
+ }
1542
+ }
1543
+ useProgram(program) {
1171
1544
  this._glCheckError('useProgram');
1172
1545
  this._checkArgs('useProgram', arguments);
1173
- var value = program ? program.native : 0;
1546
+ const value = program ? program.native : 0;
1174
1547
  this.context.useProgram(value);
1175
- };
1176
- WebGLRenderingContext.prototype.validateProgram = function (program) {
1548
+ }
1549
+ validateProgram(program) {
1177
1550
  this._glCheckError('validateProgram');
1178
1551
  this._checkArgs('validateProgram', arguments);
1179
- var value = program ? program.native : 0;
1552
+ const value = program ? program.native : 0;
1180
1553
  this.context.validateProgram(value);
1181
- };
1182
- WebGLRenderingContext.prototype.vertexAttrib1f = function (index, v0) {
1554
+ }
1555
+ vertexAttrib1f(index, v0) {
1183
1556
  this._glCheckError('vertexAttrib1f');
1184
1557
  this._checkArgs('vertexAttrib1f', arguments);
1185
1558
  this.context.vertexAttrib1f(index, v0);
1186
- };
1187
- WebGLRenderingContext.prototype.vertexAttrib1fv = function (index, value) {
1559
+ }
1560
+ vertexAttrib1fv(index, value) {
1188
1561
  this._glCheckError('vertexAttrib1fv');
1189
1562
  this._checkArgs('vertexAttrib1fv', arguments);
1190
- value = Array.from(value); // this.toNativeArray(value, 'float');
1191
- this.context.vertexAttrib1fv(index, value);
1192
- };
1193
- WebGLRenderingContext.prototype.vertexAttrib2f = function (index, v0, v1) {
1563
+ if (this._isSupported) {
1564
+ if (!Array.isArray(value)) {
1565
+ this.context.vertexAttrib1fvBuffer(index, value);
1566
+ }
1567
+ else {
1568
+ this.context.vertexAttrib1fv(index, value);
1569
+ }
1570
+ }
1571
+ else {
1572
+ if (!Array.isArray(value)) {
1573
+ this.context.vertexAttrib1fv(index, Array.from(value));
1574
+ }
1575
+ else {
1576
+ this.context.vertexAttrib1fv(index, value);
1577
+ }
1578
+ }
1579
+ }
1580
+ vertexAttrib2f(index, v0, v1) {
1194
1581
  this._glCheckError('vertexAttrib2f');
1195
1582
  this._checkArgs('vertexAttrib2f', arguments);
1196
1583
  this.context.vertexAttrib2f(index, v0, v1);
1197
- };
1198
- WebGLRenderingContext.prototype.vertexAttrib2fv = function (index, value) {
1584
+ }
1585
+ vertexAttrib2fv(index, value) {
1199
1586
  this._glCheckError('vertexAttrib2fv');
1200
1587
  this._checkArgs('vertexAttrib2fv', arguments);
1201
- value = Array.from(value); // this.toNativeArray(value, 'float');
1202
- this.context.vertexAttrib2fv(index, value);
1203
- };
1204
- WebGLRenderingContext.prototype.vertexAttrib3f = function (index, v0, v1, v2) {
1588
+ if (this._isSupported) {
1589
+ if (!Array.isArray(value)) {
1590
+ this.context.vertexAttrib2fvBuffer(index, value);
1591
+ }
1592
+ else {
1593
+ this.context.vertexAttrib2fv(index, value);
1594
+ }
1595
+ }
1596
+ else {
1597
+ if (!Array.isArray(value)) {
1598
+ this.context.vertexAttrib2fv(index, Array.from(value));
1599
+ }
1600
+ else {
1601
+ this.context.vertexAttrib2fv(index, value);
1602
+ }
1603
+ }
1604
+ }
1605
+ vertexAttrib3f(index, v0, v1, v2) {
1205
1606
  this._glCheckError('vertexAttrib3f');
1206
1607
  this._checkArgs('vertexAttrib3f', arguments);
1207
1608
  this.context.vertexAttrib3f(index, v0, v1, v2);
1208
- };
1209
- WebGLRenderingContext.prototype.vertexAttrib3fv = function (index, value) {
1609
+ }
1610
+ vertexAttrib3fv(index, value) {
1210
1611
  this._glCheckError('vertexAttrib3fv');
1211
1612
  this._checkArgs('vertexAttrib3fv', arguments);
1212
- value = Array.from(value); // this.toNativeArray(value, 'float');
1213
- this.context.vertexAttrib3fv(index, value);
1214
- };
1215
- WebGLRenderingContext.prototype.vertexAttrib4f = function (index, v0, v1, v2, v3) {
1613
+ if (this._isSupported) {
1614
+ if (!Array.isArray(value)) {
1615
+ this.context.vertexAttrib3fvBuffer(index, value);
1616
+ }
1617
+ else {
1618
+ this.context.vertexAttrib3fv(index, value);
1619
+ }
1620
+ }
1621
+ else {
1622
+ if (!Array.isArray(value)) {
1623
+ this.context.vertexAttrib3fv(index, Array.from(value));
1624
+ }
1625
+ else {
1626
+ this.context.vertexAttrib3fv(index, value);
1627
+ }
1628
+ }
1629
+ }
1630
+ vertexAttrib4f(index, v0, v1, v2, v3) {
1216
1631
  this._glCheckError('vertexAttrib4f');
1217
1632
  this._checkArgs('vertexAttrib4f', arguments);
1218
1633
  this.context.vertexAttrib4f(index, v0, v1, v2, v3);
1219
- };
1220
- WebGLRenderingContext.prototype.vertexAttrib4fv = function (index, value) {
1634
+ }
1635
+ vertexAttrib4fv(index, value) {
1221
1636
  this._glCheckError('vertexAttrib4fv');
1222
1637
  this._checkArgs('vertexAttrib4fv', arguments);
1223
- value = Array.from(value); // this.toNativeArray(value, 'float');
1224
- this.context.vertexAttrib4fv(index, value);
1225
- };
1226
- WebGLRenderingContext.prototype.vertexAttribPointer = function (index, size, type, normalized, stride, offset) {
1638
+ if (this._isSupported) {
1639
+ if (!Array.isArray(value)) {
1640
+ this.context.vertexAttrib4fvBuffer(index, value);
1641
+ }
1642
+ else {
1643
+ this.context.vertexAttrib4fv(index, value);
1644
+ }
1645
+ }
1646
+ else {
1647
+ if (!Array.isArray(value)) {
1648
+ this.context.vertexAttrib4fv(index, Array.from(value));
1649
+ }
1650
+ else {
1651
+ this.context.vertexAttrib4fv(index, value);
1652
+ }
1653
+ }
1654
+ }
1655
+ vertexAttribPointer(index, size, type, normalized, stride, offset) {
1227
1656
  this._glCheckError('vertexAttribPointer');
1228
1657
  this._checkArgs('vertexAttribPointer', arguments);
1229
1658
  this.context.vertexAttribPointer(index, size, type, normalized, stride, offset);
1230
- };
1231
- WebGLRenderingContext.prototype.viewport = function (x, y, width, height) {
1659
+ }
1660
+ viewport(x, y, width, height) {
1232
1661
  this._glCheckError('viewport');
1233
1662
  this._checkArgs('viewport', arguments);
1234
1663
  this.context.viewport(x, y, width, height);
1235
- };
1236
- WebGLRenderingContext.prototype._glCheckError = function (message) {
1664
+ }
1665
+ _glCheckError(message) {
1237
1666
  if (!WebGLRenderingContext.isDebug) {
1238
1667
  return;
1239
1668
  }
1240
1669
  if (WebGLRenderingContext.filter === 'both' || WebGLRenderingContext.filter === 'error') {
1241
1670
  console.log(message, this.getError());
1242
1671
  }
1243
- };
1244
- WebGLRenderingContext.prototype._checkArgs = function (message, args) {
1672
+ }
1673
+ _checkArgs(message, args) {
1245
1674
  if (!WebGLRenderingContext.isDebug) {
1246
1675
  return;
1247
1676
  }
@@ -1250,10 +1679,8 @@ var WebGLRenderingContext = /** @class */ (function (_super) {
1250
1679
  console.dir(args);
1251
1680
  console.log('/**** ', message, ' ****/');
1252
1681
  }
1253
- };
1254
- WebGLRenderingContext.isDebug = false;
1255
- WebGLRenderingContext.filter = 'both';
1256
- return WebGLRenderingContext;
1257
- }(common_1.WebGLRenderingContextBase));
1258
- exports.WebGLRenderingContext = WebGLRenderingContext;
1682
+ }
1683
+ }
1684
+ WebGLRenderingContext.isDebug = false;
1685
+ WebGLRenderingContext.filter = 'both';
1259
1686
  //# sourceMappingURL=index.android.js.map