@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,653 +1,641 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- var common_1 = require("./common");
4
- var CanvasGradient_1 = require("../CanvasGradient");
5
- var Path2D_1 = require("../Path2D");
6
- var ImageData_1 = require("../ImageData");
7
- var TextMetrics_1 = require("../TextMetrics");
8
- var core_1 = require("@nativescript/core");
9
- var ImageAsset_1 = require("../../ImageAsset");
10
- var CanvasPattern_1 = require("../CanvasPattern");
11
- var Canvas_1 = require("../../Canvas");
12
- var CanvasRenderingContext2D = /** @class */ (function (_super) {
13
- __extends(CanvasRenderingContext2D, _super);
14
- function CanvasRenderingContext2D(context) {
15
- var _this = _super.call(this) || this;
16
- _this._shadowColor = 'transparent';
17
- _this.context = context;
18
- return _this;
19
- }
20
- CanvasRenderingContext2D.prototype._fillRuleFromString = function (string) {
1
+ import { CanvasRenderingContext2DBase } from './common';
2
+ import { CanvasGradient } from '../CanvasGradient';
3
+ import { Path2D } from '../Path2D';
4
+ import { ImageData } from '../ImageData';
5
+ import { TextMetrics } from '../TextMetrics';
6
+ import { ImageSource } from '@nativescript/core';
7
+ import { ImageAsset } from '../../ImageAsset';
8
+ import { CanvasPattern } from '../CanvasPattern';
9
+ import { Canvas } from '../../Canvas';
10
+ import lazy from '@nativescript/canvas/utils';
11
+ const FillRule = {
12
+ EvenOdd: lazy(() => org.nativescript.canvas.TNSFillRule.EvenOdd),
13
+ NonZero: lazy(() => org.nativescript.canvas.TNSFillRule.NonZero),
14
+ };
15
+ const TextDirection = {
16
+ Ltr: lazy(() => org.nativescript.canvas.TNSTextDirection.Ltr),
17
+ Rtl: lazy(() => org.nativescript.canvas.TNSTextDirection.Rtl),
18
+ };
19
+ const ImageSmoothingQuality = {
20
+ Low: lazy(() => org.nativescript.canvas.TNSImageSmoothingQuality.Low),
21
+ Medium: lazy(() => org.nativescript.canvas.TNSImageSmoothingQuality.Medium),
22
+ High: lazy(() => org.nativescript.canvas.TNSImageSmoothingQuality.High),
23
+ };
24
+ const LineJoin = {
25
+ Bevel: lazy(() => org.nativescript.canvas.TNSLineJoin.Bevel),
26
+ Miter: lazy(() => org.nativescript.canvas.TNSLineJoin.Miter),
27
+ Round: lazy(() => org.nativescript.canvas.TNSLineJoin.Round),
28
+ };
29
+ const LineCap = {
30
+ Round: lazy(() => org.nativescript.canvas.TNSLineCap.Round),
31
+ Butt: lazy(() => org.nativescript.canvas.TNSLineCap.Butt),
32
+ Square: lazy(() => org.nativescript.canvas.TNSLineCap.Square),
33
+ };
34
+ const TextAlignment = {
35
+ Start: lazy(() => org.nativescript.canvas.TNSTextAlignment.Start),
36
+ Left: lazy(() => org.nativescript.canvas.TNSTextAlignment.Left),
37
+ Center: lazy(() => org.nativescript.canvas.TNSTextAlignment.Center),
38
+ Right: lazy(() => org.nativescript.canvas.TNSTextAlignment.Right),
39
+ End: lazy(() => org.nativescript.canvas.TNSTextAlignment.End),
40
+ };
41
+ const CompositeOperationType = {
42
+ SourceOver: lazy(() => org.nativescript.canvas.TNSCompositeOperationType.SourceOver),
43
+ SourceIn: lazy(() => org.nativescript.canvas.TNSCompositeOperationType.SourceIn),
44
+ SourceOut: lazy(() => org.nativescript.canvas.TNSCompositeOperationType.SourceOut),
45
+ SourceAtop: lazy(() => org.nativescript.canvas.TNSCompositeOperationType.SourceAtop),
46
+ DestinationOver: lazy(() => org.nativescript.canvas.TNSCompositeOperationType.DestinationOver),
47
+ DestinationIn: lazy(() => org.nativescript.canvas.TNSCompositeOperationType.DestinationIn),
48
+ DestinationOut: lazy(() => org.nativescript.canvas.TNSCompositeOperationType.DestinationOut),
49
+ DestinationAtop: lazy(() => org.nativescript.canvas.TNSCompositeOperationType.DestinationAtop),
50
+ Lighter: lazy(() => org.nativescript.canvas.TNSCompositeOperationType.Lighter),
51
+ Copy: lazy(() => org.nativescript.canvas.TNSCompositeOperationType.Copy),
52
+ Xor: lazy(() => org.nativescript.canvas.TNSCompositeOperationType.Xor),
53
+ Multiply: lazy(() => org.nativescript.canvas.TNSCompositeOperationType.Multiply),
54
+ Screen: lazy(() => org.nativescript.canvas.TNSCompositeOperationType.Screen),
55
+ Overlay: lazy(() => org.nativescript.canvas.TNSCompositeOperationType.Overlay),
56
+ Darken: lazy(() => org.nativescript.canvas.TNSCompositeOperationType.Darken),
57
+ Lighten: lazy(() => org.nativescript.canvas.TNSCompositeOperationType.Lighten),
58
+ ColorDodge: lazy(() => org.nativescript.canvas.TNSCompositeOperationType.ColorDodge),
59
+ ColorBurn: lazy(() => org.nativescript.canvas.TNSCompositeOperationType.ColorBurn),
60
+ HardLight: lazy(() => org.nativescript.canvas.TNSCompositeOperationType.HardLight),
61
+ SoftLight: lazy(() => org.nativescript.canvas.TNSCompositeOperationType.SoftLight),
62
+ Difference: lazy(() => org.nativescript.canvas.TNSCompositeOperationType.Difference),
63
+ Exclusion: lazy(() => org.nativescript.canvas.TNSCompositeOperationType.Exclusion),
64
+ Hue: lazy(() => org.nativescript.canvas.TNSCompositeOperationType.Hue),
65
+ Saturation: lazy(() => org.nativescript.canvas.TNSCompositeOperationType.Saturation),
66
+ Color: lazy(() => org.nativescript.canvas.TNSCompositeOperationType.Color),
67
+ Luminosity: lazy(() => org.nativescript.canvas.TNSCompositeOperationType.Luminosity),
68
+ };
69
+ const PatternRepetition = {
70
+ NoRepeat: lazy(() => org.nativescript.canvas.TNSPatternRepetition.NoRepeat),
71
+ Repeat: lazy(() => org.nativescript.canvas.TNSPatternRepetition.Repeat),
72
+ RepeatX: lazy(() => org.nativescript.canvas.TNSPatternRepetition.RepeatX),
73
+ RepeatY: lazy(() => org.nativescript.canvas.TNSPatternRepetition.RepeatY)
74
+ };
75
+ export class CanvasRenderingContext2D extends CanvasRenderingContext2DBase {
76
+ constructor(context) {
77
+ super();
78
+ this.context = context;
79
+ }
80
+ _fillRuleFromString(string) {
21
81
  if (string === 'evenodd') {
22
- return org.nativescript.canvas.TNSFillRule.EvenOdd;
82
+ return FillRule.EvenOdd();
23
83
  }
24
84
  else if (string === 'nonzero') {
25
- return org.nativescript.canvas.TNSFillRule.NonZero;
85
+ return FillRule.NonZero();
26
86
  }
27
87
  return null;
28
- };
29
- Object.defineProperty(CanvasRenderingContext2D.prototype, "native", {
30
- get: function () {
31
- return this.context;
32
- },
33
- enumerable: true,
34
- configurable: true
35
- });
36
- Object.defineProperty(CanvasRenderingContext2D.prototype, "canvas", {
37
- get: function () {
38
- return this._canvas;
39
- },
40
- enumerable: true,
41
- configurable: true
42
- });
43
- Object.defineProperty(CanvasRenderingContext2D.prototype, "shadowColor", {
44
- get: function () {
45
- this.log('shadowColor');
46
- return this.context.getShadowColor();
47
- },
48
- set: function (color) {
49
- this.log('shadowColor value:', color);
50
- this._ensureLayoutBeforeDraw();
51
- if (this.context) {
52
- this.context.setShadowColor(color);
53
- }
54
- },
55
- enumerable: true,
56
- configurable: true
57
- });
58
- Object.defineProperty(CanvasRenderingContext2D.prototype, "font", {
59
- get: function () {
60
- this.log('get font');
61
- return this.context.getFont();
62
- },
63
- set: function (value) {
64
- this.log('set font value:', value);
65
- if (this.context) {
66
- this.context.setFont(value);
67
- }
68
- },
69
- enumerable: true,
70
- configurable: true
71
- });
72
- Object.defineProperty(CanvasRenderingContext2D.prototype, "direction", {
73
- get: function () {
74
- this.log('direction');
75
- return this.context.getDirection() === org.nativescript.canvas.TNSTextDirection.Ltr ? "ltr" : "rtl";
76
- },
77
- set: function (value) {
78
- this.log('direction value:', value);
79
- this._ensureLayoutBeforeDraw();
80
- if (this.context) {
81
- this.context.setDirection(value === "rtl" ? org.nativescript.canvas.TNSTextDirection.Rtl : org.nativescript.canvas.TNSTextDirection.Ltr);
82
- }
83
- },
84
- enumerable: true,
85
- configurable: true
86
- });
87
- Object.defineProperty(CanvasRenderingContext2D.prototype, "globalAlpha", {
88
- get: function () {
89
- this.log('globalAlpha');
90
- return this.context.getGlobalAlpha();
91
- },
92
- set: function (alpha) {
93
- this.log('globalAlpha value:', alpha);
94
- this._ensureLayoutBeforeDraw();
95
- if (this.context) {
96
- this.context.setGlobalAlpha(alpha);
97
- }
98
- },
99
- enumerable: true,
100
- configurable: true
101
- });
102
- Object.defineProperty(CanvasRenderingContext2D.prototype, "imageSmoothingEnabled", {
103
- get: function () {
104
- this.log('imageSmoothingEnabled');
105
- return this.context.getImageSmoothingEnabled();
106
- },
107
- set: function (enabled) {
108
- this.log('imageSmoothingEnabled value:', enabled);
109
- this._ensureLayoutBeforeDraw();
110
- if (this.context) {
111
- this.context.setImageSmoothingEnabled(enabled);
112
- }
113
- },
114
- enumerable: true,
115
- configurable: true
116
- });
117
- Object.defineProperty(CanvasRenderingContext2D.prototype, "imageSmoothingQuality", {
118
- get: function () {
119
- this.log('imageSmoothingQuality');
120
- return this.context.getImageSmoothingQuality().toString();
121
- },
122
- set: function (quality) {
123
- this.log('imageSmoothingQuality value:', quality);
124
- this._ensureLayoutBeforeDraw();
125
- if (this.context) {
126
- switch (quality) {
127
- case 'high':
128
- this.context.setImageSmoothingQuality(org.nativescript.canvas.TNSImageSmoothingQuality.High);
129
- break;
130
- case 'medium':
131
- this.context.setImageSmoothingQuality(org.nativescript.canvas.TNSImageSmoothingQuality.Medium);
132
- break;
133
- default:
134
- this.context.setImageSmoothingQuality(org.nativescript.canvas.TNSImageSmoothingQuality.Low);
135
- break;
136
- }
137
- }
138
- },
139
- enumerable: true,
140
- configurable: true
141
- });
142
- Object.defineProperty(CanvasRenderingContext2D.prototype, "lineDashOffset", {
143
- get: function () {
144
- this.log('lineDashOffset');
145
- return this.context.getLineDashOffset();
146
- },
147
- set: function (offset) {
148
- this.log('lineDashOffset value:', offset);
149
- this._ensureLayoutBeforeDraw();
150
- if (this.context) {
151
- this.context.setLineDashOffset(offset);
152
- }
153
- },
154
- enumerable: true,
155
- configurable: true
156
- });
157
- Object.defineProperty(CanvasRenderingContext2D.prototype, "lineJoin", {
158
- get: function () {
159
- this.log('lineJoin');
160
- return this.context.getLineJoin().toString();
161
- },
162
- set: function (join) {
163
- this.log('lineJoin value:', join);
164
- this._ensureLayoutBeforeDraw();
165
- if (this.context) {
166
- switch (join) {
167
- case 'bevel':
168
- this.context.setLineJoin(org.nativescript.canvas.TNSLineJoin.Bevel);
169
- break;
170
- case 'round':
171
- this.context.setLineJoin(org.nativescript.canvas.TNSLineJoin.Round);
172
- break;
173
- default:
174
- this.context.setLineJoin(org.nativescript.canvas.TNSLineJoin.Miter);
175
- break;
176
- }
177
- }
178
- },
179
- enumerable: true,
180
- configurable: true
181
- });
182
- Object.defineProperty(CanvasRenderingContext2D.prototype, "lineCap", {
183
- get: function () {
184
- this.log('lineCap');
185
- return this.context.getLineCap().toString();
186
- },
187
- set: function (cap) {
188
- this.log('lineCap value:', cap);
189
- this._ensureLayoutBeforeDraw();
190
- if (this.context) {
191
- switch (cap) {
192
- case 'round':
193
- this.context.setLineCap(org.nativescript.canvas.TNSLineCap.Round);
194
- break;
195
- case 'square':
196
- this.context.setLineCap(org.nativescript.canvas.TNSLineCap.Square);
197
- break;
198
- default:
199
- this.context.setLineCap(org.nativescript.canvas.TNSLineCap.Butt);
200
- }
201
- }
202
- },
203
- enumerable: true,
204
- configurable: true
205
- });
206
- Object.defineProperty(CanvasRenderingContext2D.prototype, "miterLimit", {
207
- get: function () {
208
- this.log('miterLimit value:');
209
- return this.context.getMiterLimit();
210
- },
211
- set: function (limit) {
212
- this.log('miterLimit value:', limit);
213
- this._ensureLayoutBeforeDraw();
214
- if (this.context) {
215
- this.context.setMiterLimit(limit);
216
- }
217
- },
218
- enumerable: true,
219
- configurable: true
220
- });
221
- Object.defineProperty(CanvasRenderingContext2D.prototype, "shadowBlur", {
222
- get: function () {
223
- this.log('shadowBlur');
224
- return this.context.getShadowBlur();
225
- },
226
- set: function (blur) {
227
- this.log('shadowBlur value:', blur);
228
- this._ensureLayoutBeforeDraw();
229
- if (this.context) {
230
- this.context.setShadowBlur(blur);
231
- }
232
- },
233
- enumerable: true,
234
- configurable: true
235
- });
236
- Object.defineProperty(CanvasRenderingContext2D.prototype, "shadowOffsetX", {
237
- get: function () {
238
- this.log('shadowOffsetX');
239
- return this.context.getShadowOffsetX();
240
- },
241
- set: function (x) {
242
- this.log('shadowOffsetX value:', x);
243
- this._ensureLayoutBeforeDraw();
244
- if (this.context) {
245
- this.context.setShadowOffsetX(x);
88
+ }
89
+ get native() {
90
+ return this.context;
91
+ }
92
+ get canvas() {
93
+ return this._canvas;
94
+ }
95
+ get shadowColor() {
96
+ this.log('shadowColor');
97
+ return this.context.getShadowColor();
98
+ }
99
+ set shadowColor(color) {
100
+ this.log('shadowColor value:', color);
101
+ this._ensureLayoutBeforeDraw();
102
+ if (this.context) {
103
+ this.context.setShadowColor(color);
104
+ }
105
+ }
106
+ get font() {
107
+ this.log('get font');
108
+ return this.context.getFont();
109
+ }
110
+ set font(value) {
111
+ this.log('set font value:', value);
112
+ if (this.context) {
113
+ this.context.setFont(value);
114
+ }
115
+ }
116
+ get direction() {
117
+ this.log('direction');
118
+ return this.context.getDirection() === TextDirection.Ltr() ? "ltr" : "rtl";
119
+ }
120
+ set direction(value) {
121
+ this.log('direction value:', value);
122
+ this._ensureLayoutBeforeDraw();
123
+ if (this.context) {
124
+ this.context.setDirection(value === "rtl" ? TextDirection.Rtl() : TextDirection.Ltr());
125
+ }
126
+ }
127
+ get globalAlpha() {
128
+ this.log('globalAlpha');
129
+ return this.context.getGlobalAlpha();
130
+ }
131
+ set globalAlpha(alpha) {
132
+ this.log('globalAlpha value:', alpha);
133
+ this._ensureLayoutBeforeDraw();
134
+ if (this.context) {
135
+ this.context.setGlobalAlpha(alpha);
136
+ }
137
+ }
138
+ get imageSmoothingEnabled() {
139
+ this.log('imageSmoothingEnabled');
140
+ return this.context.getImageSmoothingEnabled();
141
+ }
142
+ set imageSmoothingEnabled(enabled) {
143
+ this.log('imageSmoothingEnabled value:', enabled);
144
+ this._ensureLayoutBeforeDraw();
145
+ if (this.context) {
146
+ this.context.setImageSmoothingEnabled(enabled);
147
+ }
148
+ }
149
+ get imageSmoothingQuality() {
150
+ this.log('imageSmoothingQuality');
151
+ return this.context.getImageSmoothingQuality().toString();
152
+ }
153
+ set imageSmoothingQuality(quality) {
154
+ this.log('imageSmoothingQuality value:', quality);
155
+ this._ensureLayoutBeforeDraw();
156
+ if (this.context) {
157
+ switch (quality) {
158
+ case 'high':
159
+ this.context.setImageSmoothingQuality(ImageSmoothingQuality.High());
160
+ break;
161
+ case 'medium':
162
+ this.context.setImageSmoothingQuality(ImageSmoothingQuality.Medium());
163
+ break;
164
+ default:
165
+ this.context.setImageSmoothingQuality(ImageSmoothingQuality.Low());
166
+ break;
246
167
  }
247
- },
248
- enumerable: true,
249
- configurable: true
250
- });
251
- Object.defineProperty(CanvasRenderingContext2D.prototype, "shadowOffsetY", {
252
- get: function () {
253
- this.log('shadowOffsetY');
254
- return this.context.getShadowOffsetY();
255
- },
256
- set: function (y) {
257
- this.log('shadowOffsetY value:', y);
258
- this._ensureLayoutBeforeDraw();
259
- if (this.context) {
260
- this.context.setShadowOffsetY(y);
168
+ }
169
+ }
170
+ get lineDashOffset() {
171
+ this.log('lineDashOffset');
172
+ return this.context.getLineDashOffset();
173
+ }
174
+ set lineDashOffset(offset) {
175
+ this.log('lineDashOffset value:', offset);
176
+ this._ensureLayoutBeforeDraw();
177
+ if (this.context) {
178
+ this.context.setLineDashOffset(offset);
179
+ }
180
+ }
181
+ get lineJoin() {
182
+ this.log('lineJoin');
183
+ return this.context.getLineJoin().toString();
184
+ }
185
+ set lineJoin(join) {
186
+ this.log('lineJoin value:', join);
187
+ this._ensureLayoutBeforeDraw();
188
+ if (this.context) {
189
+ switch (join) {
190
+ case 'bevel':
191
+ this.context.setLineJoin(LineJoin.Bevel());
192
+ break;
193
+ case 'round':
194
+ this.context.setLineJoin(LineJoin.Round());
195
+ break;
196
+ default:
197
+ this.context.setLineJoin(LineJoin.Miter());
198
+ break;
261
199
  }
262
- },
263
- enumerable: true,
264
- configurable: true
265
- });
266
- Object.defineProperty(CanvasRenderingContext2D.prototype, "textAlign", {
267
- get: function () {
268
- this.log('textAlign');
269
- return this.context.getTextAlign().toString();
270
- },
271
- set: function (alignment) {
272
- this.log('textAlign value:', alignment);
273
- this._ensureLayoutBeforeDraw();
274
- if (this.context) {
275
- switch (alignment) {
276
- case 'start':
277
- this.context.setTextAlign(org.nativescript.canvas.TNSTextAlignment.Start);
278
- break;
279
- case 'center':
280
- this.context.setTextAlign(org.nativescript.canvas.TNSTextAlignment.Center);
281
- break;
282
- case 'end':
283
- this.context.setTextAlign(org.nativescript.canvas.TNSTextAlignment.End);
284
- break;
285
- case 'right':
286
- this.context.setTextAlign(org.nativescript.canvas.TNSTextAlignment.Right);
287
- break;
288
- default:
289
- this.context.setTextAlign(org.nativescript.canvas.TNSTextAlignment.Left);
290
- break;
291
- }
200
+ }
201
+ }
202
+ get lineCap() {
203
+ this.log('lineCap');
204
+ return this.context.getLineCap().toString();
205
+ }
206
+ set lineCap(cap) {
207
+ this.log('lineCap value:', cap);
208
+ this._ensureLayoutBeforeDraw();
209
+ if (this.context) {
210
+ switch (cap) {
211
+ case 'round':
212
+ this.context.setLineCap(LineCap.Round());
213
+ break;
214
+ case 'square':
215
+ this.context.setLineCap(LineCap.Square());
216
+ break;
217
+ default:
218
+ this.context.setLineCap(LineCap.Butt());
292
219
  }
293
- },
294
- enumerable: true,
295
- configurable: true
296
- });
297
- Object.defineProperty(CanvasRenderingContext2D.prototype, "globalCompositeOperation", {
298
- get: function () {
299
- this.log('globalCompositeOperation');
300
- return this.context.getGlobalCompositeOperation().toString();
301
- },
302
- set: function (composite) {
303
- this.log('globalCompositeOperation value:', composite);
304
- this._ensureLayoutBeforeDraw();
305
- if (this.context) {
306
- var operation = void 0;
307
- switch (composite.toLowerCase()) {
308
- case 'source-over':
309
- operation = org.nativescript.canvas.TNSCompositeOperationType.SourceOver;
310
- break;
311
- case 'source-in':
312
- operation = org.nativescript.canvas.TNSCompositeOperationType.SourceIn;
313
- break;
314
- case 'source-out':
315
- operation = org.nativescript.canvas.TNSCompositeOperationType.SourceOut;
316
- break;
317
- case 'source-atop':
318
- operation = org.nativescript.canvas.TNSCompositeOperationType.SourceAtop;
319
- break;
320
- case 'destination-over':
321
- operation = org.nativescript.canvas.TNSCompositeOperationType.DestinationOver;
322
- break;
323
- case 'destination-in':
324
- operation = org.nativescript.canvas.TNSCompositeOperationType.DestinationIn;
325
- break;
326
- case 'destination-out':
327
- operation = org.nativescript.canvas.TNSCompositeOperationType.DestinationOut;
328
- break;
329
- case 'destination-atop':
330
- operation = org.nativescript.canvas.TNSCompositeOperationType.DestinationAtop;
331
- break;
332
- case 'lighter':
333
- operation = org.nativescript.canvas.TNSCompositeOperationType.Lighter;
334
- break;
335
- case 'copy':
336
- operation = org.nativescript.canvas.TNSCompositeOperationType.Copy;
337
- break;
338
- case 'xor':
339
- operation = org.nativescript.canvas.TNSCompositeOperationType.Xor;
340
- break;
341
- case 'multiply':
342
- operation = org.nativescript.canvas.TNSCompositeOperationType.Multiply;
343
- break;
344
- case 'screen':
345
- operation = org.nativescript.canvas.TNSCompositeOperationType.Screen;
346
- break;
347
- case 'overlay':
348
- operation = org.nativescript.canvas.TNSCompositeOperationType.Overlay;
349
- break;
350
- case 'darken':
351
- operation = org.nativescript.canvas.TNSCompositeOperationType.Darken;
352
- break;
353
- case 'lighten':
354
- operation = org.nativescript.canvas.TNSCompositeOperationType.Lighten;
355
- break;
356
- case 'color-dodge':
357
- operation = org.nativescript.canvas.TNSCompositeOperationType.ColorDodge;
358
- break;
359
- case 'color-burn':
360
- operation = org.nativescript.canvas.TNSCompositeOperationType.ColorBurn;
361
- break;
362
- case 'hard-light':
363
- operation = org.nativescript.canvas.TNSCompositeOperationType.HardLight;
364
- break;
365
- case 'soft-light':
366
- operation = org.nativescript.canvas.TNSCompositeOperationType.SoftLight;
367
- break;
368
- case 'difference':
369
- operation = org.nativescript.canvas.TNSCompositeOperationType.Difference;
370
- break;
371
- case 'exclusion':
372
- operation = org.nativescript.canvas.TNSCompositeOperationType.Exclusion;
373
- break;
374
- case 'hue':
375
- operation = org.nativescript.canvas.TNSCompositeOperationType.Hue;
376
- break;
377
- case 'saturation':
378
- operation = org.nativescript.canvas.TNSCompositeOperationType.Saturation;
379
- break;
380
- case 'color':
381
- operation = org.nativescript.canvas.TNSCompositeOperationType.Color;
382
- break;
383
- case 'luminosity':
384
- operation = org.nativescript.canvas.TNSCompositeOperationType.Luminosity;
385
- break;
386
- }
387
- this.context.setGlobalCompositeOperation(operation);
220
+ }
221
+ }
222
+ get miterLimit() {
223
+ this.log('miterLimit value:');
224
+ return this.context.getMiterLimit();
225
+ }
226
+ set miterLimit(limit) {
227
+ this.log('miterLimit value:', limit);
228
+ this._ensureLayoutBeforeDraw();
229
+ if (this.context) {
230
+ this.context.setMiterLimit(limit);
231
+ }
232
+ }
233
+ get shadowBlur() {
234
+ this.log('shadowBlur');
235
+ return this.context.getShadowBlur();
236
+ }
237
+ set shadowBlur(blur) {
238
+ this.log('shadowBlur value:', blur);
239
+ this._ensureLayoutBeforeDraw();
240
+ if (this.context) {
241
+ this.context.setShadowBlur(blur);
242
+ }
243
+ }
244
+ get shadowOffsetX() {
245
+ this.log('shadowOffsetX');
246
+ return this.context.getShadowOffsetX();
247
+ }
248
+ set shadowOffsetX(x) {
249
+ this.log('shadowOffsetX value:', x);
250
+ this._ensureLayoutBeforeDraw();
251
+ if (this.context) {
252
+ this.context.setShadowOffsetX(x);
253
+ }
254
+ }
255
+ get shadowOffsetY() {
256
+ this.log('shadowOffsetY');
257
+ return this.context.getShadowOffsetY();
258
+ }
259
+ set shadowOffsetY(y) {
260
+ this.log('shadowOffsetY value:', y);
261
+ this._ensureLayoutBeforeDraw();
262
+ if (this.context) {
263
+ this.context.setShadowOffsetY(y);
264
+ }
265
+ }
266
+ get textAlign() {
267
+ this.log('textAlign');
268
+ return this.context.getTextAlign().toString();
269
+ }
270
+ set textAlign(alignment) {
271
+ this.log('textAlign value:', alignment);
272
+ this._ensureLayoutBeforeDraw();
273
+ if (this.context) {
274
+ switch (alignment) {
275
+ case 'start':
276
+ this.context.setTextAlign(TextAlignment.Start());
277
+ break;
278
+ case 'center':
279
+ this.context.setTextAlign(TextAlignment.Center());
280
+ break;
281
+ case 'end':
282
+ this.context.setTextAlign(TextAlignment.End());
283
+ break;
284
+ case 'right':
285
+ this.context.setTextAlign(TextAlignment.Right());
286
+ break;
287
+ default:
288
+ this.context.setTextAlign(TextAlignment.Left());
289
+ break;
388
290
  }
389
- },
390
- enumerable: true,
391
- configurable: true
392
- });
393
- Object.defineProperty(CanvasRenderingContext2D.prototype, "fillStyle", {
394
- get: function () {
395
- this.log('fillStyle');
291
+ }
292
+ }
293
+ get globalCompositeOperation() {
294
+ this.log('globalCompositeOperation');
295
+ return this.context.getGlobalCompositeOperation().toString();
296
+ }
297
+ set globalCompositeOperation(composite) {
298
+ this.log('globalCompositeOperation value:', composite);
299
+ this._ensureLayoutBeforeDraw();
300
+ if (this.context) {
301
+ let operation;
302
+ switch (composite.toLowerCase()) {
303
+ case 'source-over':
304
+ operation = CompositeOperationType.SourceOver();
305
+ break;
306
+ case 'source-in':
307
+ operation = CompositeOperationType.SourceIn();
308
+ break;
309
+ case 'source-out':
310
+ operation = CompositeOperationType.SourceOut();
311
+ break;
312
+ case 'source-atop':
313
+ operation = CompositeOperationType.SourceAtop();
314
+ break;
315
+ case 'destination-over':
316
+ operation = CompositeOperationType.DestinationOver();
317
+ break;
318
+ case 'destination-in':
319
+ operation = CompositeOperationType.DestinationIn();
320
+ break;
321
+ case 'destination-out':
322
+ operation = CompositeOperationType.DestinationOut();
323
+ break;
324
+ case 'destination-atop':
325
+ operation = CompositeOperationType.DestinationAtop();
326
+ break;
327
+ case 'lighter':
328
+ operation = CompositeOperationType.Lighter();
329
+ break;
330
+ case 'copy':
331
+ operation = CompositeOperationType.Copy();
332
+ break;
333
+ case 'xor':
334
+ operation = CompositeOperationType.Xor();
335
+ break;
336
+ case 'multiply':
337
+ operation = CompositeOperationType.Multiply();
338
+ break;
339
+ case 'screen':
340
+ operation = CompositeOperationType.Screen();
341
+ break;
342
+ case 'overlay':
343
+ operation = CompositeOperationType.Overlay();
344
+ break;
345
+ case 'darken':
346
+ operation = CompositeOperationType.Darken();
347
+ break;
348
+ case 'lighten':
349
+ operation = CompositeOperationType.Lighten();
350
+ break;
351
+ case 'color-dodge':
352
+ operation = CompositeOperationType.ColorDodge();
353
+ break;
354
+ case 'color-burn':
355
+ operation = CompositeOperationType.ColorBurn();
356
+ break;
357
+ case 'hard-light':
358
+ operation = CompositeOperationType.HardLight();
359
+ break;
360
+ case 'soft-light':
361
+ operation = CompositeOperationType.SoftLight();
362
+ break;
363
+ case 'difference':
364
+ operation = CompositeOperationType.Difference();
365
+ break;
366
+ case 'exclusion':
367
+ operation = CompositeOperationType.Exclusion();
368
+ break;
369
+ case 'hue':
370
+ operation = CompositeOperationType.Hue();
371
+ break;
372
+ case 'saturation':
373
+ operation = CompositeOperationType.Saturation();
374
+ break;
375
+ case 'color':
376
+ operation = CompositeOperationType.Color();
377
+ break;
378
+ case 'luminosity':
379
+ operation = CompositeOperationType.Luminosity();
380
+ break;
381
+ }
382
+ this.context.setGlobalCompositeOperation(operation);
383
+ }
384
+ }
385
+ get fillStyle() {
386
+ this.log('fillStyle');
387
+ if (this.context) {
396
388
  switch (this.context.getFillStyle().getStyleType()) {
397
- case 0 /* Color */:
398
- var color = this.context.getFillStyle();
399
- return color.getColor();
400
- case 1 /* Gradient */:
401
- return CanvasGradient_1.CanvasGradient.fromNative(this.context.getFillStyle());
402
- case 2 /* Pattern */:
403
- return new CanvasPattern_1.CanvasPattern(this.context.getFillStyle());
404
- }
405
- },
406
- set: function (color) {
407
- this.log('fillStyle:', color);
408
- if (color === undefined || color === null) {
409
- return;
410
- }
411
- this._ensureLayoutBeforeDraw();
412
- if (typeof color === 'string') {
413
- this.context.setFillStyle(new org.nativescript.canvas.TNSColor(color));
414
- }
415
- else if (color instanceof CanvasGradient_1.CanvasGradient) {
416
- this.context.setFillStyle(color.native);
417
- }
418
- else if (color instanceof CanvasPattern_1.CanvasPattern) {
419
- this.context.setFillStyle(color.native);
420
- }
421
- },
422
- enumerable: true,
423
- configurable: true
424
- });
425
- Object.defineProperty(CanvasRenderingContext2D.prototype, "strokeStyle", {
426
- get: function () {
427
- this.log('strokeStyle');
428
- switch (this.context.getStrokeStyle().getStyleType()) {
429
- case 0 /* Color */:
430
- var color = this.context.getStrokeStyle();
389
+ case org.nativescript.canvas.TNSColorStyleType.Color:
390
+ const color = this.context.getFillStyle();
431
391
  return color.getColor();
432
- case 1 /* Gradient */:
433
- return CanvasGradient_1.CanvasGradient.fromNative(this.context.getStrokeStyle());
434
- case 2 /* Pattern */:
435
- return new CanvasPattern_1.CanvasPattern(this.context.getStrokeStyle());
436
- }
437
- },
438
- set: function (color) {
439
- this.log('strokeStyle:', color);
440
- if (color === undefined || color === null) {
441
- return;
392
+ case org.nativescript.canvas.TNSColorStyleType.Gradient:
393
+ return CanvasGradient.fromNative(this.context.getFillStyle());
394
+ case org.nativescript.canvas.TNSColorStyleType.Pattern:
395
+ return new CanvasPattern(this.context.getFillStyle());
442
396
  }
443
- this._ensureLayoutBeforeDraw();
444
- if (typeof color === 'string') {
445
- this.context.setStrokeStyle(new org.nativescript.canvas.TNSColor(color));
446
- }
447
- else if (color instanceof CanvasGradient_1.CanvasGradient) {
448
- this.context.setStrokeStyle(color.native);
449
- }
450
- else if (color instanceof CanvasPattern_1.CanvasPattern) {
451
- this.context.setStrokeStyle(color.native);
452
- }
453
- },
454
- enumerable: true,
455
- configurable: true
456
- });
457
- Object.defineProperty(CanvasRenderingContext2D.prototype, "lineWidth", {
458
- get: function () {
459
- this.log('lineWidth');
460
- return this.context.getLineWidth();
461
- },
462
- set: function (width) {
463
- this.log('lineWidth value:', width);
464
- this._ensureLayoutBeforeDraw();
465
- if (this.context) {
466
- this.context.setLineWidth(width);
467
- }
468
- },
469
- enumerable: true,
470
- configurable: true
471
- });
472
- CanvasRenderingContext2D.prototype.addHitRegion = function (region) {
473
- };
474
- CanvasRenderingContext2D.prototype.arc = function (x, y, radius, startAngle, endAngle, anticlockwise) {
475
- if (anticlockwise === void 0) { anticlockwise = false; }
397
+ }
398
+ return 'black';
399
+ }
400
+ set fillStyle(color) {
401
+ this.log('fillStyle:', color);
402
+ if (color === undefined || color === null) {
403
+ return;
404
+ }
405
+ this._ensureLayoutBeforeDraw();
406
+ if (typeof color === 'string') {
407
+ this.context.setFillStyle(new org.nativescript.canvas.TNSColor(color));
408
+ }
409
+ else if (color instanceof CanvasGradient) {
410
+ this.context.setFillStyle(color.native);
411
+ }
412
+ else if (color instanceof CanvasPattern) {
413
+ this.context.setFillStyle(color.native);
414
+ }
415
+ }
416
+ get filter() {
417
+ this.log('get filter');
418
+ return this.context.getFilter();
419
+ }
420
+ set filter(value) {
421
+ this.log('set filter', value);
422
+ if (this.context) {
423
+ this.context.setFilter(value);
424
+ }
425
+ }
426
+ get strokeStyle() {
427
+ this.log('strokeStyle');
428
+ switch (this.context.getStrokeStyle().getStyleType()) {
429
+ case 0 /* Color */:
430
+ const color = this.context.getStrokeStyle();
431
+ return color.getColor();
432
+ case 1 /* Gradient */:
433
+ return CanvasGradient.fromNative(this.context.getStrokeStyle());
434
+ case 2 /* Pattern */:
435
+ return new CanvasPattern(this.context.getStrokeStyle());
436
+ }
437
+ }
438
+ set strokeStyle(color) {
439
+ this.log('strokeStyle:', color);
440
+ if (color === undefined || color === null) {
441
+ return;
442
+ }
443
+ this._ensureLayoutBeforeDraw();
444
+ if (typeof color === 'string') {
445
+ this.context.setStrokeStyle(new org.nativescript.canvas.TNSColor(color));
446
+ }
447
+ else if (color instanceof CanvasGradient) {
448
+ this.context.setStrokeStyle(color.native);
449
+ }
450
+ else if (color instanceof CanvasPattern) {
451
+ this.context.setStrokeStyle(color.native);
452
+ }
453
+ }
454
+ get lineWidth() {
455
+ this.log('lineWidth');
456
+ return this.context.getLineWidth();
457
+ }
458
+ set lineWidth(width) {
459
+ this.log('lineWidth value:', width);
460
+ this._ensureLayoutBeforeDraw();
461
+ if (this.context) {
462
+ this.context.setLineWidth(width);
463
+ }
464
+ }
465
+ addHitRegion(region) {
466
+ }
467
+ arc(x, y, radius, startAngle, endAngle, anticlockwise = false) {
476
468
  this.log('arc value:', x, y, radius, startAngle, endAngle, anticlockwise);
477
469
  this._ensureLayoutBeforeDraw();
478
470
  this.context.arc(x, y, radius, startAngle, endAngle, anticlockwise);
479
- };
480
- CanvasRenderingContext2D.prototype.arcTo = function (x1, y1, x2, y2, radius) {
471
+ }
472
+ arcTo(x1, y1, x2, y2, radius) {
481
473
  this.log('arcTo value:', x1, y1, x2, y2, radius);
482
474
  this._ensureLayoutBeforeDraw();
483
475
  this.context.arcTo(x1, y1, x2, y2, radius);
484
- };
485
- CanvasRenderingContext2D.prototype.beginPath = function () {
476
+ }
477
+ beginPath() {
486
478
  this.log('beginPath');
487
479
  this._ensureLayoutBeforeDraw();
488
480
  this.context.beginPath();
489
- };
490
- CanvasRenderingContext2D.prototype.bezierCurveTo = function (cp1x, cp1y, cp2x, cp2y, x, y) {
481
+ }
482
+ bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y) {
491
483
  this.log('bezierCurveTo value:', cp1x, cp1y, cp2x, cp2y, x, y);
492
484
  this._ensureLayoutBeforeDraw();
493
485
  this.context.bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y);
494
- };
495
- CanvasRenderingContext2D.prototype.clearHitRegions = function () {
496
- };
497
- CanvasRenderingContext2D.prototype.clearRect = function (x, y, width, height) {
486
+ }
487
+ clearHitRegions() {
488
+ }
489
+ clearRect(x, y, width, height) {
498
490
  this.log('clearRect value:', x, y, width, height);
499
491
  this._ensureLayoutBeforeDraw();
500
492
  this.context.clearRect(x, y, width, height);
501
- };
502
- CanvasRenderingContext2D.prototype.clip = function () {
503
- var args = [];
504
- for (var _i = 0; _i < arguments.length; _i++) {
505
- args[_i] = arguments[_i];
506
- }
507
- this.log.apply(this, ['clip value:'].concat(args));
493
+ }
494
+ clip(...args) {
495
+ this.log('clip value:', ...args);
508
496
  this._ensureLayoutBeforeDraw();
509
497
  if (typeof args[0] === 'string') {
510
- this.context.clip(args[0]);
498
+ const rule = this._fillRuleFromString(args[0]);
499
+ this.context.clip(rule);
511
500
  }
512
- else if (args[0] instanceof Path2D_1.Path2D && typeof args[1] === 'string') {
513
- this.context.clip(args[0].native, args[1]);
501
+ else if (args[0] instanceof Path2D && typeof args[1] === 'string') {
502
+ const rule = this._fillRuleFromString(args[1]);
503
+ this.context.clip(args[0].native, rule);
514
504
  }
515
- else if (args[0] instanceof Path2D_1.Path2D) {
505
+ else if (args[0] instanceof Path2D) {
516
506
  this.context.clip(args[0].native);
517
507
  }
518
508
  else {
519
509
  this.context.clip();
520
510
  }
521
- };
522
- CanvasRenderingContext2D.prototype.closePath = function () {
511
+ }
512
+ closePath() {
523
513
  this.log('closePath');
524
514
  this._ensureLayoutBeforeDraw();
525
515
  this.context.closePath();
526
- };
527
- CanvasRenderingContext2D.prototype.createImageData = function (width, height) {
516
+ }
517
+ createImageData(width, height) {
528
518
  this.log('createImageData value:', arguments);
529
- if (width instanceof ImageData_1.ImageData) {
530
- return ImageData_1.ImageData.from(width);
519
+ if (width instanceof ImageData) {
520
+ return ImageData.from(width);
531
521
  }
532
522
  else {
533
- return ImageData_1.ImageData.fromNative(this.context.createImageData(width, height));
523
+ return ImageData.fromNative(this.context.createImageData(width, height));
534
524
  }
535
- };
536
- CanvasRenderingContext2D.prototype.createLinearGradient = function (x0, y0, x1, y1) {
525
+ }
526
+ createLinearGradient(x0, y0, x1, y1) {
537
527
  this.log('createLinearGradient value:', x0, y0, x1, y1);
538
528
  this._ensureLayoutBeforeDraw();
539
- return CanvasGradient_1.CanvasGradient.fromNative(this.context.createLinearGradient(x0, y0, x1, y1));
540
- };
541
- CanvasRenderingContext2D.prototype.createPattern = function (image, repetition) {
529
+ return CanvasGradient.fromNative(this.context.createLinearGradient(x0, y0, x1, y1));
530
+ }
531
+ createPattern(image, repetition) {
542
532
  this.log('createPattern value:', image, repetition);
543
533
  this._ensureLayoutBeforeDraw();
544
534
  if (repetition === undefined || typeof repetition !== 'string') {
545
- var e = new Error('The string did not match the expected pattern.');
535
+ const e = new Error('The string did not match the expected pattern.');
546
536
  e.name = 'SyntaxError';
547
537
  throw e;
548
538
  }
549
- var img;
550
- if (image instanceof core_1.ImageSource) {
539
+ let img;
540
+ if (image instanceof ImageSource) {
551
541
  img = image.android;
552
542
  }
553
543
  else if (image instanceof android.graphics.Bitmap) {
554
544
  img = image;
555
545
  }
556
- else if (image instanceof ImageAsset_1.ImageAsset) {
546
+ else if (image instanceof ImageAsset) {
557
547
  img = image.native;
558
548
  }
559
- else if (image instanceof Canvas_1.Canvas) {
549
+ else if (image instanceof Canvas) {
560
550
  img = image.android;
561
551
  }
562
552
  else if (image && typeof image.tagName === 'string' && (image.tagName === 'IMG' || image.tagName === 'IMAGE')) {
563
- if (image._imageSource instanceof core_1.ImageSource) {
553
+ if (image._imageSource instanceof ImageSource) {
564
554
  img = image._imageSource.android;
565
555
  }
566
556
  else if (image._image instanceof android.graphics.Bitmap) {
567
557
  img = image._image;
568
558
  }
569
- else if (image._asset instanceof ImageAsset_1.ImageAsset) {
559
+ else if (image._asset instanceof ImageAsset) {
570
560
  img = image._asset.native;
571
561
  }
572
562
  else if (typeof image.src === 'string') {
573
- img = core_1.ImageSource.fromFileSync(image.src).android;
563
+ img = ImageSource.fromFileSync(image.src).android;
574
564
  }
575
565
  }
576
566
  else if (image &&
577
567
  typeof image.tagName === 'string' &&
578
- image.tagName === 'CANVAS' && image._canvas instanceof Canvas_1.Canvas) {
568
+ image.tagName === 'CANVAS' && image._canvas instanceof Canvas) {
579
569
  img = image._canvas.android;
580
570
  }
571
+ else if (image instanceof ImageBitmap || (image === null || image === void 0 ? void 0 : image.nativeInstance) instanceof org.nativescript.canvas.TNSImageBitmap) {
572
+ img = image.native;
573
+ }
581
574
  if (!img) {
582
575
  return null;
583
576
  }
584
- var rep;
577
+ let rep;
585
578
  switch (repetition) {
586
579
  case 'no-repeat':
587
- rep = org.nativescript.canvas.TNSPatternRepetition.NoRepeat;
580
+ rep = PatternRepetition.NoRepeat();
588
581
  break;
589
582
  case 'repeat-x':
590
- rep = org.nativescript.canvas.TNSPatternRepetition.RepeatX;
583
+ rep = PatternRepetition.RepeatX();
591
584
  break;
592
585
  case 'repeat-y':
593
- rep = org.nativescript.canvas.TNSPatternRepetition.RepeatY;
586
+ rep = PatternRepetition.RepeatY();
594
587
  break;
595
588
  default:
596
- rep = org.nativescript.canvas.TNSPatternRepetition.Repeat;
589
+ rep = PatternRepetition.Repeat();
597
590
  break;
598
591
  }
599
- return new CanvasPattern_1.CanvasPattern(this.context.createPattern(img, rep));
600
- };
601
- CanvasRenderingContext2D.prototype.createRadialGradient = function (x0, y0, r0, x1, y1, r1) {
592
+ return new CanvasPattern(this.context.createPattern(img, rep));
593
+ }
594
+ createRadialGradient(x0, y0, r0, x1, y1, r1) {
602
595
  this.log('createRadialGradient value:', x0, y0, r0, x1, y1, r1);
603
596
  this._ensureLayoutBeforeDraw();
604
- return CanvasGradient_1.CanvasGradient.fromNative(this.context.createRadialGradient(x0, y0, r0, x1, y1, r1));
605
- };
606
- CanvasRenderingContext2D.prototype.drawFocusIfNeeded = function () {
607
- var args = [];
608
- for (var _i = 0; _i < arguments.length; _i++) {
609
- args[_i] = arguments[_i];
610
- }
611
- };
612
- CanvasRenderingContext2D.prototype.drawImage = function () {
613
- var args = [];
614
- for (var _i = 0; _i < arguments.length; _i++) {
615
- args[_i] = arguments[_i];
616
- }
617
- this.log.apply(this, ['drawImage value:'].concat(args));
597
+ return CanvasGradient.fromNative(this.context.createRadialGradient(x0, y0, r0, x1, y1, r1));
598
+ }
599
+ drawFocusIfNeeded(...args) {
600
+ }
601
+ drawImage(...args) {
602
+ this.log('drawImage value:', ...args);
618
603
  this._ensureLayoutBeforeDraw();
619
- var image = args[0];
620
- if (image instanceof ImageAsset_1.ImageAsset) {
604
+ let image = args[0];
605
+ if (image instanceof ImageAsset) {
621
606
  image = image.native;
622
607
  }
623
- else if (image instanceof core_1.ImageSource) {
608
+ else if (image instanceof ImageSource) {
624
609
  image = image.android;
625
610
  }
626
611
  else if (image instanceof android.graphics.Bitmap) {
627
612
  image = image;
628
613
  }
629
- else if (image instanceof Canvas_1.Canvas) {
614
+ else if (image instanceof Canvas) {
630
615
  image = image.android;
631
616
  }
632
617
  else if (image && typeof image.tagName === 'string' && (image.tagName === 'IMG' || image.tagName === 'IMAGE')) {
633
- if (image._imageSource instanceof core_1.ImageSource) {
618
+ if (image._imageSource instanceof ImageSource) {
634
619
  image = image._imageSource.android;
635
620
  }
636
621
  else if (image._image instanceof android.graphics.Bitmap) {
637
622
  image = image._image;
638
623
  }
639
- else if (image._asset instanceof ImageAsset_1.ImageAsset) {
624
+ else if (image._asset instanceof ImageAsset) {
640
625
  image = image._asset.native;
641
626
  }
642
627
  else if (typeof image.src === 'string') {
643
- image = core_1.ImageSource.fromFileSync(image.src).android;
628
+ image = ImageSource.fromFileSync(image.src).android;
644
629
  }
645
630
  }
646
631
  else if (image &&
647
632
  typeof image.tagName === 'string' &&
648
- image.tagName === 'CANVAS' && image._canvas instanceof Canvas_1.Canvas) {
633
+ image.tagName === 'CANVAS' && image._canvas instanceof Canvas) {
649
634
  image = image._canvas.android;
650
635
  }
636
+ else if (image instanceof ImageBitmap || (image === null || image === void 0 ? void 0 : image.nativeInstance) instanceof org.nativescript.canvas.TNSImageBitmap) {
637
+ image = image.native;
638
+ }
651
639
  if (args.length === 3) {
652
640
  this.context.drawImage(image, args[1], args[2]);
653
641
  }
@@ -657,39 +645,36 @@ var CanvasRenderingContext2D = /** @class */ (function (_super) {
657
645
  else if (args.length === 9) {
658
646
  this.context.drawImage(image, args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8]);
659
647
  }
660
- };
661
- CanvasRenderingContext2D.prototype.ellipse = function (x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise) {
662
- if (anticlockwise === void 0) { anticlockwise = false; }
648
+ }
649
+ ellipse(x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise = false) {
663
650
  this.log('ellipse value:', x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise);
664
651
  this._ensureLayoutBeforeDraw();
665
652
  this.context.ellipse(x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise);
666
- };
667
- CanvasRenderingContext2D.prototype.fill = function () {
668
- var args = [];
669
- for (var _i = 0; _i < arguments.length; _i++) {
670
- args[_i] = arguments[_i];
671
- }
672
- this.log.apply(this, ['fill value:'].concat(args));
653
+ }
654
+ fill(...args) {
655
+ this.log('fill value:', ...args);
673
656
  this._ensureLayoutBeforeDraw();
674
657
  if (typeof args[0] === 'string') {
675
- this.context.fill(args[0]);
658
+ const rule = this._fillRuleFromString(args[0]);
659
+ this.context.fill(rule);
676
660
  }
677
- else if (args[0] instanceof Path2D_1.Path2D && typeof args[1] === 'string') {
678
- this.context.fill(args[0].native, args[1]);
661
+ else if (args[0] instanceof Path2D && typeof args[1] === 'string') {
662
+ const rule = this._fillRuleFromString(args[1]);
663
+ this.context.fill(args[0].native, rule);
679
664
  }
680
- else if (args[0] instanceof Path2D_1.Path2D) {
665
+ else if (args[0] instanceof Path2D) {
681
666
  this.context.fill(args[0].native);
682
667
  }
683
668
  else {
684
669
  this.context.fill();
685
670
  }
686
- };
687
- CanvasRenderingContext2D.prototype.fillRect = function (x, y, width, height) {
671
+ }
672
+ fillRect(x, y, width, height) {
688
673
  this.log('fillRect value:', x, y, width, height);
689
674
  this._ensureLayoutBeforeDraw();
690
675
  this.context.fillRect(x, y, width, height);
691
- };
692
- CanvasRenderingContext2D.prototype.fillText = function (text, x, y, maxWidth) {
676
+ }
677
+ fillText(text, x, y, maxWidth) {
693
678
  this.log('fillText value:', text, x, y, maxWidth);
694
679
  this._ensureLayoutBeforeDraw();
695
680
  if (typeof maxWidth === 'number') {
@@ -698,23 +683,19 @@ var CanvasRenderingContext2D = /** @class */ (function (_super) {
698
683
  else {
699
684
  this.context.fillText(text, x, y);
700
685
  }
701
- };
702
- CanvasRenderingContext2D.prototype.getImageData = function (sx, sy, sw, sh) {
686
+ }
687
+ getImageData(sx, sy, sw, sh) {
703
688
  this.log('getImageData value:', sx, sy, sw, sh);
704
689
  this._ensureLayoutBeforeDraw();
705
- return ImageData_1.ImageData.fromNative(this.context.getImageData(sx, sy, sw, sh));
706
- };
707
- CanvasRenderingContext2D.prototype.getLineDash = function () {
690
+ return ImageData.fromNative(this.context.getImageData(sx, sy, sw, sh));
691
+ }
692
+ getLineDash() {
708
693
  this.log('getLineDash');
709
694
  this._ensureLayoutBeforeDraw();
710
695
  return this.context.getLineDash();
711
- };
712
- CanvasRenderingContext2D.prototype.isPointInPath = function () {
713
- var args = [];
714
- for (var _i = 0; _i < arguments.length; _i++) {
715
- args[_i] = arguments[_i];
716
- }
717
- this.log.apply(this, ['isPointInPath value:'].concat(args));
696
+ }
697
+ isPointInPath(...args) {
698
+ this.log('isPointInPath value:', ...args);
718
699
  this._ensureLayoutBeforeDraw();
719
700
  if (args.length === 2) {
720
701
  return this.context.isPointInPath(args[0], args[1]);
@@ -722,112 +703,101 @@ var CanvasRenderingContext2D = /** @class */ (function (_super) {
722
703
  else if (args.length === 3) {
723
704
  return this.context.isPointInPath(args[0], args[1], args[2]);
724
705
  }
725
- else if (args.length === 4 && args[0] instanceof Path2D_1.Path2D) {
706
+ else if (args.length === 4 && args[0] instanceof Path2D) {
726
707
  return this.context.isPointInPath(args[0].native, args[1], args[2], args[3]);
727
708
  }
728
709
  return false;
729
- };
730
- CanvasRenderingContext2D.prototype.isPointInStroke = function () {
731
- var args = [];
732
- for (var _i = 0; _i < arguments.length; _i++) {
733
- args[_i] = arguments[_i];
734
- }
735
- this.log.apply(this, ['isPointInStroke value:'].concat(args));
710
+ }
711
+ isPointInStroke(...args) {
712
+ this.log('isPointInStroke value:', ...args);
736
713
  this._ensureLayoutBeforeDraw();
737
714
  if (args.length === 2) {
738
715
  return this.context.isPointInStroke(args[0], args[1]);
739
716
  }
740
- else if (args.length === 3 && args[0] instanceof Path2D_1.Path2D) {
717
+ else if (args.length === 3 && args[0] instanceof Path2D) {
741
718
  return this.context.isPointInStroke(args[0].native, args[1], args[2]);
742
719
  }
743
720
  return false;
744
- };
745
- CanvasRenderingContext2D.prototype.lineTo = function (x, y) {
721
+ }
722
+ lineTo(x, y) {
746
723
  this.log('lineTo value:', x, y);
747
724
  this._ensureLayoutBeforeDraw();
748
725
  this.context.lineTo(x, y);
749
- };
750
- CanvasRenderingContext2D.prototype.measureText = function (text) {
726
+ }
727
+ measureText(text) {
751
728
  this.log('measureText value:', text);
752
729
  this._ensureLayoutBeforeDraw();
753
- return new TextMetrics_1.TextMetrics(this.context.measureText(text));
754
- };
755
- CanvasRenderingContext2D.prototype.moveTo = function (x, y) {
730
+ return new TextMetrics(this.context.measureText(text));
731
+ }
732
+ moveTo(x, y) {
756
733
  this.log('moveTo value:', x, y);
757
734
  this._ensureLayoutBeforeDraw();
758
735
  this.context.moveTo(x, y);
759
- };
760
- CanvasRenderingContext2D.prototype.putImageData = function () {
761
- var args = [];
762
- for (var _i = 0; _i < arguments.length; _i++) {
763
- args[_i] = arguments[_i];
764
- }
765
- this.log.apply(this, ['putImageData value:'].concat(args));
736
+ }
737
+ putImageData(...args) {
738
+ this.log('putImageData value:', ...args);
766
739
  this._ensureLayoutBeforeDraw();
767
740
  if (!args) {
768
741
  return;
769
742
  }
770
- var data = args[0];
771
- // Would be nice not to update the native backing array each time ... but since buffers don't use pointers ... we are here 😅
743
+ let data = args[0];
772
744
  if (args.length === 3) {
773
- //data.native.updateData(Array.from(data.data));
774
745
  this.context.putImageData(data.native, args[1], args[2]);
775
746
  }
776
747
  else if (args.length === 7) {
777
- // data.native.updateData(Array.from(data.data));
778
748
  this.context.putImageData(data.native, args[1], args[2], args[3], args[4], args[5], args[6]);
779
749
  }
780
- };
781
- CanvasRenderingContext2D.prototype.quadraticCurveTo = function (cpx, cpy, x, y) {
750
+ }
751
+ quadraticCurveTo(cpx, cpy, x, y) {
782
752
  this.log('quadraticCurveTo value:', cpx, cpy, x, y);
783
753
  this._ensureLayoutBeforeDraw();
784
754
  this.context.quadraticCurveTo(cpx, cpy, x, y);
785
- };
786
- CanvasRenderingContext2D.prototype.rect = function (x, y, width, height) {
755
+ }
756
+ rect(x, y, width, height) {
787
757
  this.log('rect value:', x, y, width, height);
788
758
  this._ensureLayoutBeforeDraw();
789
759
  this.context.rect(x, y, width, height);
790
- };
791
- CanvasRenderingContext2D.prototype.removeHitRegion = function (id) {
792
- };
793
- CanvasRenderingContext2D.prototype.resetTransform = function () {
760
+ }
761
+ removeHitRegion(id) {
762
+ }
763
+ resetTransform() {
794
764
  this.log('resetTransform value:');
795
765
  this._ensureLayoutBeforeDraw();
796
766
  this.context.resetTransform();
797
- };
798
- CanvasRenderingContext2D.prototype.restore = function () {
767
+ }
768
+ restore() {
799
769
  this.log('restore');
800
770
  this._ensureLayoutBeforeDraw();
801
771
  this.context.restore();
802
- };
803
- CanvasRenderingContext2D.prototype.rotate = function (angle) {
772
+ }
773
+ rotate(angle) {
804
774
  this.log('rotate value:', angle);
805
775
  this._ensureLayoutBeforeDraw();
806
776
  this.context.rotate(angle);
807
- };
808
- CanvasRenderingContext2D.prototype.save = function () {
777
+ }
778
+ save() {
809
779
  this.log('save');
810
780
  this._ensureLayoutBeforeDraw();
811
781
  this.context.save();
812
- };
813
- CanvasRenderingContext2D.prototype.scale = function (x, y) {
782
+ }
783
+ scale(x, y) {
814
784
  this.log('scale value:', x, y);
815
785
  this._ensureLayoutBeforeDraw();
816
786
  this.context.scale(x, y);
817
- };
818
- CanvasRenderingContext2D.prototype.scrollPathIntoView = function (path) {
819
- };
820
- CanvasRenderingContext2D.prototype.setLineDash = function (segments) {
787
+ }
788
+ scrollPathIntoView(path) {
789
+ }
790
+ setLineDash(segments) {
821
791
  this.log('setLineDash value:', segments);
822
792
  this._ensureLayoutBeforeDraw();
823
793
  this.context.setLineDash(segments);
824
- };
825
- CanvasRenderingContext2D.prototype.setTransform = function (a, b, c, d, e, f) {
794
+ }
795
+ setTransform(a, b, c, d, e, f) {
826
796
  this.log('setTransform value:', a, b, c, d, e, f);
827
797
  this._ensureLayoutBeforeDraw();
828
798
  this.context.setTransform(a, b, c, d, e, f);
829
- };
830
- CanvasRenderingContext2D.prototype.stroke = function (path) {
799
+ }
800
+ stroke(path) {
831
801
  this.log('stroke value:', path);
832
802
  this._ensureLayoutBeforeDraw();
833
803
  if (path) {
@@ -836,13 +806,13 @@ var CanvasRenderingContext2D = /** @class */ (function (_super) {
836
806
  else {
837
807
  this.context.stroke();
838
808
  }
839
- };
840
- CanvasRenderingContext2D.prototype.strokeRect = function (x, y, width, height) {
809
+ }
810
+ strokeRect(x, y, width, height) {
841
811
  this.log('strokeRect value:', x, y, width, height);
842
812
  this._ensureLayoutBeforeDraw();
843
813
  this.context.strokeRect(x, y, width, height);
844
- };
845
- CanvasRenderingContext2D.prototype.strokeText = function (text, x, y, maxWidth) {
814
+ }
815
+ strokeText(text, x, y, maxWidth) {
846
816
  this.log('strokeText value:', text, x, y, maxWidth);
847
817
  this._ensureLayoutBeforeDraw();
848
818
  if (typeof maxWidth === 'number') {
@@ -851,35 +821,29 @@ var CanvasRenderingContext2D = /** @class */ (function (_super) {
851
821
  else {
852
822
  this.context.strokeText(text, x, y);
853
823
  }
854
- };
855
- CanvasRenderingContext2D.prototype.transform = function (a, b, c, d, e, f) {
824
+ }
825
+ transform(a, b, c, d, e, f) {
856
826
  this.log('transform value:', a, b, c, d, e, f);
857
827
  this._ensureLayoutBeforeDraw();
858
828
  this.context.transform(a, b, c, d, e, f);
859
- };
860
- CanvasRenderingContext2D.prototype.translate = function (x, y) {
829
+ }
830
+ translate(x, y) {
861
831
  this.log('translate value:', x, y);
862
832
  this._ensureLayoutBeforeDraw();
863
833
  this.context.translate(x, y);
864
- };
865
- CanvasRenderingContext2D.prototype._ensureLayoutBeforeDraw = function () {
834
+ }
835
+ _ensureLayoutBeforeDraw() {
866
836
  if (this.canvas) {
867
837
  this.canvas._layoutNative();
868
838
  }
869
- };
870
- CanvasRenderingContext2D.prototype.log = function (message) {
871
- var args = [];
872
- for (var _i = 1; _i < arguments.length; _i++) {
873
- args[_i - 1] = arguments[_i];
874
- }
839
+ }
840
+ log(message, ...args) {
875
841
  if (!CanvasRenderingContext2D.isDebug) {
876
842
  return;
877
843
  }
878
844
  console.log(message, args);
879
- };
880
- CanvasRenderingContext2D.isDebug = false;
881
- CanvasRenderingContext2D.colorCache = {};
882
- return CanvasRenderingContext2D;
883
- }(common_1.CanvasRenderingContext2DBase));
884
- exports.CanvasRenderingContext2D = CanvasRenderingContext2D;
845
+ }
846
+ }
847
+ CanvasRenderingContext2D.isDebug = false;
848
+ CanvasRenderingContext2D.colorCache = {};
885
849
  //# sourceMappingURL=index.android.js.map