@nativescript/canvas 1.0.0-debug.0 → 1.1.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (144) hide show
  1. package/Canvas/common.d.ts +35 -13
  2. package/Canvas/common.js +458 -204
  3. package/Canvas/common.js.map +1 -1
  4. package/Canvas/index.android.d.ts +2 -0
  5. package/Canvas/index.android.js +17 -7
  6. package/Canvas/index.android.js.map +1 -1
  7. package/Canvas/index.d.ts +14 -0
  8. package/Canvas/index.ios.d.ts +1 -0
  9. package/Canvas/index.ios.js +10 -2
  10. package/Canvas/index.ios.js.map +1 -1
  11. package/Canvas2D/CanvasGradient/CanvasGradient.android.js.map +1 -1
  12. package/Canvas2D/CanvasRenderingContext2D/index.android.d.ts +3 -0
  13. package/Canvas2D/CanvasRenderingContext2D/index.android.js +53 -35
  14. package/Canvas2D/CanvasRenderingContext2D/index.android.js.map +1 -1
  15. package/Canvas2D/CanvasRenderingContext2D/index.d.ts +6 -0
  16. package/Canvas2D/CanvasRenderingContext2D/index.ios.d.ts +4 -1
  17. package/Canvas2D/CanvasRenderingContext2D/index.ios.js +126 -113
  18. package/Canvas2D/CanvasRenderingContext2D/index.ios.js.map +1 -1
  19. package/Canvas2D/DOMMatrix/DOMMatrix.android.js +3 -0
  20. package/Canvas2D/DOMMatrix/DOMMatrix.android.js.map +1 -1
  21. package/Canvas2D/DOMMatrix/DOMMatrix.ios.js +3 -0
  22. package/Canvas2D/DOMMatrix/DOMMatrix.ios.js.map +1 -1
  23. package/Canvas2D/DOMMatrix/common.d.ts +1 -0
  24. package/Canvas2D/DOMMatrix/common.js +4 -0
  25. package/Canvas2D/DOMMatrix/common.js.map +1 -1
  26. package/Canvas2D/ImageData/ImageData.android.js +11 -0
  27. package/Canvas2D/ImageData/ImageData.android.js.map +1 -1
  28. package/Canvas2D/ImageData/ImageData.ios.js +11 -0
  29. package/Canvas2D/ImageData/ImageData.ios.js.map +1 -1
  30. package/Canvas2D/ImageData/common.d.ts +1 -0
  31. package/Canvas2D/ImageData/common.js +4 -0
  32. package/Canvas2D/ImageData/common.js.map +1 -1
  33. package/Canvas2D/Path2D/common.d.ts +1 -0
  34. package/Canvas2D/Path2D/common.js +4 -0
  35. package/Canvas2D/Path2D/common.js.map +1 -1
  36. package/Canvas2D/TextMetrics/common.d.ts +1 -0
  37. package/Canvas2D/TextMetrics/common.js +4 -0
  38. package/Canvas2D/TextMetrics/common.js.map +1 -1
  39. package/ImageAsset/common.d.ts +1 -0
  40. package/ImageAsset/common.js +4 -0
  41. package/ImageAsset/common.js.map +1 -1
  42. package/ImageBitmap/common.d.ts +1 -0
  43. package/ImageBitmap/common.js +4 -0
  44. package/ImageBitmap/common.js.map +1 -1
  45. package/ImageBitmap/index.android.js +32 -0
  46. package/ImageBitmap/index.android.js.map +1 -1
  47. package/ImageBitmap/index.ios.js +41 -9
  48. package/ImageBitmap/index.ios.js.map +1 -1
  49. package/SVG/Image.js +2 -0
  50. package/SVG/Image.js.map +1 -1
  51. package/SVG/SVG.js +9 -0
  52. package/SVG/SVG.js.map +1 -1
  53. package/TextDecoder/TextDecoder.android.d.ts +1 -0
  54. package/TextDecoder/TextDecoder.android.js +29 -20
  55. package/TextDecoder/TextDecoder.android.js.map +1 -1
  56. package/TextDecoder/TextDecoder.ios.js +12 -16
  57. package/TextDecoder/TextDecoder.ios.js.map +1 -1
  58. package/TextDecoder/common.d.ts +1 -0
  59. package/TextDecoder/common.js +4 -0
  60. package/TextDecoder/common.js.map +1 -1
  61. package/TextEncoder/common.d.ts +1 -0
  62. package/TextEncoder/common.js +4 -0
  63. package/TextEncoder/common.js.map +1 -1
  64. package/WebGL/WebGLExtensions/index.android.js +1 -0
  65. package/WebGL/WebGLExtensions/index.android.js.map +1 -1
  66. package/WebGL/WebGLExtensions/index.ios.js +1 -0
  67. package/WebGL/WebGLExtensions/index.ios.js.map +1 -1
  68. package/WebGL/WebGLRenderingContext/index.android.d.ts +1 -0
  69. package/WebGL/WebGLRenderingContext/index.android.js +394 -111
  70. package/WebGL/WebGLRenderingContext/index.android.js.map +1 -1
  71. package/WebGL/WebGLRenderingContext/index.ios.js +35 -24
  72. package/WebGL/WebGLRenderingContext/index.ios.js.map +1 -1
  73. package/WebGL2/WebGL2RenderingContext/index.android.js +2 -2
  74. package/WebGL2/WebGL2RenderingContext/index.android.js.map +1 -1
  75. package/WebGL2/WebGL2RenderingContext/index.ios.js +39 -29
  76. package/WebGL2/WebGL2RenderingContext/index.ios.js.map +1 -1
  77. package/angular/esm2020/index.mjs +17 -0
  78. package/angular/esm2020/nativescript-canvas-angular.mjs +5 -0
  79. package/angular/fesm2015/nativescript-canvas-angular.mjs +24 -0
  80. package/angular/fesm2015/nativescript-canvas-angular.mjs.map +1 -0
  81. package/angular/fesm2020/nativescript-canvas-angular.mjs +24 -0
  82. package/angular/fesm2020/nativescript-canvas-angular.mjs.map +1 -0
  83. package/angular/index.d.ts +4 -0
  84. package/angular/package.json +20 -8
  85. package/index.d.ts +3 -4
  86. package/index.js +54 -8
  87. package/index.js.map +1 -1
  88. package/package.json +2 -3
  89. package/platforms/android/include.gradle +21 -1
  90. package/platforms/ios/CanvasNative.xcframework/Info.plist +10 -5
  91. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/CanvasNative +0 -0
  92. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Headers/CanvasNative-Swift.h +120 -3
  93. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Headers/canvas_native.h +1122 -471
  94. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Info.plist +0 -0
  95. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/Project/arm64-apple-ios.swiftsourceinfo +0 -0
  96. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios.abi.json +74840 -0
  97. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/{arm64.swiftinterface → arm64-apple-ios.private.swiftinterface} +203 -121
  98. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  99. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios.swiftinterface +203 -121
  100. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/module.modulemap +2 -2
  101. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/TNSCanvas.nib +0 -0
  102. package/platforms/ios/CanvasNative.xcframework/ios-arm64/dSYMs/CanvasNative.framework.dSYM/Contents/Info.plist +20 -0
  103. package/platforms/ios/CanvasNative.xcframework/ios-arm64/dSYMs/CanvasNative.framework.dSYM/Contents/Resources/DWARF/CanvasNative +0 -0
  104. package/platforms/ios/CanvasNative.xcframework/{ios-x86_64-simulator → ios-arm64_x86_64-simulator}/CanvasNative.framework/CanvasNative +0 -0
  105. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Headers/CanvasNative-Swift.h +4116 -0
  106. package/platforms/ios/CanvasNative.xcframework/{ios-x86_64-simulator → ios-arm64_x86_64-simulator}/CanvasNative.framework/Headers/CanvasNative.h +0 -0
  107. package/platforms/ios/CanvasNative.xcframework/{ios-x86_64-simulator → ios-arm64_x86_64-simulator}/CanvasNative.framework/Headers/Utils.h +0 -0
  108. package/platforms/ios/CanvasNative.xcframework/{ios-x86_64-simulator → ios-arm64_x86_64-simulator}/CanvasNative.framework/Headers/canvas_native.h +1122 -471
  109. package/platforms/ios/CanvasNative.xcframework/{ios-x86_64-simulator → ios-arm64_x86_64-simulator}/CanvasNative.framework/Info.plist +0 -0
  110. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/Project/arm64-apple-ios-simulator.swiftsourceinfo +0 -0
  111. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/Project/x86_64-apple-ios-simulator.swiftsourceinfo +0 -0
  112. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.abi.json +74840 -0
  113. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +3270 -0
  114. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
  115. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.swiftinterface +3270 -0
  116. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.abi.json +74840 -0
  117. package/platforms/ios/CanvasNative.xcframework/{ios-x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64.swiftinterface → ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface} +203 -121
  118. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
  119. package/platforms/ios/CanvasNative.xcframework/{ios-x86_64-simulator → ios-arm64_x86_64-simulator}/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +203 -121
  120. package/platforms/ios/CanvasNative.xcframework/{ios-x86_64-simulator → ios-arm64_x86_64-simulator}/CanvasNative.framework/Modules/module.modulemap +2 -2
  121. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/TNSCanvas.nib +0 -0
  122. package/platforms/ios/CanvasNative.xcframework/{ios-x86_64-simulator → ios-arm64_x86_64-simulator}/CanvasNative.framework/_CodeSignature/CodeResources +87 -69
  123. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/dSYMs/CanvasNative.framework.dSYM/Contents/Info.plist +20 -0
  124. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/dSYMs/CanvasNative.framework.dSYM/Contents/Resources/DWARF/CanvasNative +0 -0
  125. package/platforms/ios/Podfile +1 -1
  126. package/typings/objc!CanvasNative.d.ts +2018 -0
  127. package/typings/objc!CanvasNative.js +1 -0
  128. package/typings/objc!CanvasNative.js.map +1 -0
  129. package/utils.d.ts +3 -0
  130. package/utils.js +27 -0
  131. package/utils.js.map +1 -1
  132. package/angular/bundles/nativescript-canvas-angular.umd.js +0 -29
  133. package/angular/bundles/nativescript-canvas-angular.umd.js.map +0 -1
  134. package/angular/esm2015/index.js +0 -12
  135. package/angular/esm2015/nativescript-canvas-angular.js +0 -5
  136. package/angular/fesm2015/nativescript-canvas-angular.js +0 -19
  137. package/angular/fesm2015/nativescript-canvas-angular.js.map +0 -1
  138. package/angular/nativescript-canvas-angular.d.ts +0 -4
  139. package/angular/nativescript-canvas-angular.metadata.json +0 -1
  140. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64.swiftdoc +0 -0
  141. package/platforms/ios/CanvasNative.xcframework/ios-x86_64-simulator/CanvasNative.framework/Headers/CanvasNative-Swift.h +0 -1943
  142. package/platforms/ios/CanvasNative.xcframework/ios-x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
  143. package/platforms/ios/CanvasNative.xcframework/ios-x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64.swiftdoc +0 -0
  144. package/platforms/ios/CanvasNative.xcframework/ios-x86_64-simulator/CanvasNative.framework/TNSCanvas.nib +0 -0
@@ -14,10 +14,10 @@ export class CanvasRenderingContext2D extends CanvasRenderingContext2DBase {
14
14
  }
15
15
  _fillRuleFromString(string) {
16
16
  if (string === 'evenodd') {
17
- return TNSFillRule.EvenOdd;
17
+ return 1 /* TNSFillRule.EvenOdd */;
18
18
  }
19
19
  else if (string === 'nonzero') {
20
- return TNSFillRule.NonZero;
20
+ return 0 /* TNSFillRule.NonZero */;
21
21
  }
22
22
  return null;
23
23
  }
@@ -29,13 +29,13 @@ export class CanvasRenderingContext2D extends CanvasRenderingContext2DBase {
29
29
  }
30
30
  get direction() {
31
31
  this.log('direction');
32
- return this.context.getDirection() === 0 /* Ltr */ ? "ltr" : "rtl";
32
+ return this.context.getDirection() === 0 /* TNSTextDirection.Ltr */ ? 'ltr' : 'rtl';
33
33
  }
34
34
  set direction(value) {
35
35
  this.log('direction value:', value);
36
36
  this._ensureLayoutBeforeDraw();
37
37
  if (this.context) {
38
- this.context.setDirection(value === "rtl" ? 1 /* Rtl */ : 0 /* Ltr */);
38
+ this.context.setDirection(value === 'rtl' ? 1 /* TNSTextDirection.Rtl */ : 0 /* TNSTextDirection.Ltr */);
39
39
  }
40
40
  }
41
41
  get font() {
@@ -84,9 +84,9 @@ export class CanvasRenderingContext2D extends CanvasRenderingContext2DBase {
84
84
  get imageSmoothingQuality() {
85
85
  this.log('get imageSmoothingQuality');
86
86
  switch (this.context.imageSmoothingQuality) {
87
- case 2 /* High */:
87
+ case 2 /* TNSImageSmoothingQuality.High */:
88
88
  return 'high';
89
- case 1 /* Medium */:
89
+ case 1 /* TNSImageSmoothingQuality.Medium */:
90
90
  return 'medium';
91
91
  default:
92
92
  return 'low';
@@ -98,13 +98,13 @@ export class CanvasRenderingContext2D extends CanvasRenderingContext2DBase {
98
98
  if (this.context) {
99
99
  switch (quality) {
100
100
  case 'high':
101
- this.context.imageSmoothingQuality = 2 /* High */;
101
+ this.context.imageSmoothingQuality = 2 /* TNSImageSmoothingQuality.High */;
102
102
  break;
103
103
  case 'medium':
104
- this.context.imageSmoothingQuality = 1 /* Medium */;
104
+ this.context.imageSmoothingQuality = 1 /* TNSImageSmoothingQuality.Medium */;
105
105
  break;
106
106
  case 'low':
107
- this.context.imageSmoothingQuality = 0 /* Low */;
107
+ this.context.imageSmoothingQuality = 0 /* TNSImageSmoothingQuality.Low */;
108
108
  break;
109
109
  }
110
110
  }
@@ -123,9 +123,9 @@ export class CanvasRenderingContext2D extends CanvasRenderingContext2DBase {
123
123
  get lineJoin() {
124
124
  this.log('get lineJoin');
125
125
  switch (this.context.lineJoin) {
126
- case 1 /* Bevel */:
126
+ case 1 /* TNSLineJoin.Bevel */:
127
127
  return 'bevel';
128
- case 0 /* Round */:
128
+ case 0 /* TNSLineJoin.Round */:
129
129
  return 'round';
130
130
  default:
131
131
  return 'miter';
@@ -137,13 +137,13 @@ export class CanvasRenderingContext2D extends CanvasRenderingContext2DBase {
137
137
  if (this.context) {
138
138
  switch (join) {
139
139
  case 'bevel':
140
- this.context.lineJoin = 1 /* Bevel */;
140
+ this.context.lineJoin = 1 /* TNSLineJoin.Bevel */;
141
141
  break;
142
142
  case 'round':
143
- this.context.lineJoin = 0 /* Round */;
143
+ this.context.lineJoin = 0 /* TNSLineJoin.Round */;
144
144
  break;
145
145
  case 'miter':
146
- this.context.lineJoin = 2 /* Miter */;
146
+ this.context.lineJoin = 2 /* TNSLineJoin.Miter */;
147
147
  break;
148
148
  }
149
149
  }
@@ -151,9 +151,9 @@ export class CanvasRenderingContext2D extends CanvasRenderingContext2DBase {
151
151
  get lineCap() {
152
152
  this.log('get lineCap');
153
153
  switch (this.context.lineCap) {
154
- case 1 /* Round */:
154
+ case 1 /* TNSLineCap.Round */:
155
155
  return 'round';
156
- case 2 /* Square */:
156
+ case 2 /* TNSLineCap.Square */:
157
157
  return 'square';
158
158
  default:
159
159
  return 'butt';
@@ -165,13 +165,13 @@ export class CanvasRenderingContext2D extends CanvasRenderingContext2DBase {
165
165
  if (this.context) {
166
166
  switch (cap) {
167
167
  case 'round':
168
- this.context.lineCap = 1 /* Round */;
168
+ this.context.lineCap = 1 /* TNSLineCap.Round */;
169
169
  break;
170
170
  case 'square':
171
- this.context.lineCap = 2 /* Square */;
171
+ this.context.lineCap = 2 /* TNSLineCap.Square */;
172
172
  break;
173
173
  case 'butt':
174
- this.context.lineCap = 0 /* Butt */;
174
+ this.context.lineCap = 0 /* TNSLineCap.Butt */;
175
175
  }
176
176
  }
177
177
  }
@@ -222,13 +222,13 @@ export class CanvasRenderingContext2D extends CanvasRenderingContext2DBase {
222
222
  get textAlign() {
223
223
  this.log('get textAlign');
224
224
  switch (this.context.textAlign) {
225
- case 0 /* Start */:
225
+ case 0 /* TNSTextAlignment.Start */:
226
226
  return 'start';
227
- case 2 /* Center */:
227
+ case 2 /* TNSTextAlignment.Center */:
228
228
  return 'center';
229
- case 4 /* End */:
229
+ case 4 /* TNSTextAlignment.End */:
230
230
  return 'end';
231
- case 3 /* Right */:
231
+ case 3 /* TNSTextAlignment.Right */:
232
232
  return 'right';
233
233
  default:
234
234
  return 'left';
@@ -240,19 +240,19 @@ export class CanvasRenderingContext2D extends CanvasRenderingContext2DBase {
240
240
  if (this.context) {
241
241
  switch (alignment) {
242
242
  case 'start':
243
- this.context.textAlign = 0 /* Start */;
243
+ this.context.textAlign = 0 /* TNSTextAlignment.Start */;
244
244
  break;
245
245
  case 'center':
246
- this.context.textAlign = 2 /* Center */;
246
+ this.context.textAlign = 2 /* TNSTextAlignment.Center */;
247
247
  break;
248
248
  case 'end':
249
- this.context.textAlign = 4 /* End */;
249
+ this.context.textAlign = 4 /* TNSTextAlignment.End */;
250
250
  break;
251
251
  case 'right':
252
- this.context.textAlign = 3 /* Right */;
252
+ this.context.textAlign = 3 /* TNSTextAlignment.Right */;
253
253
  break;
254
254
  case 'left':
255
- this.context.textAlign = 1 /* Left */;
255
+ this.context.textAlign = 1 /* TNSTextAlignment.Left */;
256
256
  break;
257
257
  }
258
258
  }
@@ -260,57 +260,57 @@ export class CanvasRenderingContext2D extends CanvasRenderingContext2DBase {
260
260
  get globalCompositeOperation() {
261
261
  this.log('get globalCompositeOperation');
262
262
  switch (this.context.globalCompositeOperation) {
263
- case 0 /* SourceOver */:
263
+ case 0 /* TNSCompositeOperationType.SourceOver */:
264
264
  return 'source-over';
265
- case 1 /* SourceIn */:
265
+ case 1 /* TNSCompositeOperationType.SourceIn */:
266
266
  return 'source-in';
267
- case 2 /* SourceOut */:
267
+ case 2 /* TNSCompositeOperationType.SourceOut */:
268
268
  return 'source-out';
269
- case 3 /* SourceAtop */:
269
+ case 3 /* TNSCompositeOperationType.SourceAtop */:
270
270
  return 'source-atop';
271
- case 4 /* DestinationOver */:
271
+ case 4 /* TNSCompositeOperationType.DestinationOver */:
272
272
  return 'destination-over';
273
- case 5 /* DestinationIn */:
273
+ case 5 /* TNSCompositeOperationType.DestinationIn */:
274
274
  return 'destination-in';
275
- case 6 /* DestinationOut */:
275
+ case 6 /* TNSCompositeOperationType.DestinationOut */:
276
276
  return 'destination-out';
277
- case 7 /* DestinationAtop */:
277
+ case 7 /* TNSCompositeOperationType.DestinationAtop */:
278
278
  return 'destination-atop';
279
- case 8 /* Lighter */:
279
+ case 8 /* TNSCompositeOperationType.Lighter */:
280
280
  return 'lighter';
281
- case 9 /* Copy */:
281
+ case 9 /* TNSCompositeOperationType.Copy */:
282
282
  return 'copy';
283
- case 10 /* Xor */:
283
+ case 10 /* TNSCompositeOperationType.Xor */:
284
284
  return 'xor';
285
- case 11 /* Multiply */:
285
+ case 11 /* TNSCompositeOperationType.Multiply */:
286
286
  return 'multiply';
287
- case 12 /* Screen */:
287
+ case 12 /* TNSCompositeOperationType.Screen */:
288
288
  return 'screen';
289
- case 13 /* Overlay */:
289
+ case 13 /* TNSCompositeOperationType.Overlay */:
290
290
  return 'overlay';
291
- case 14 /* Darken */:
291
+ case 14 /* TNSCompositeOperationType.Darken */:
292
292
  return 'darken';
293
- case 15 /* Lighten */:
293
+ case 15 /* TNSCompositeOperationType.Lighten */:
294
294
  return 'lighten';
295
- case 16 /* ColorDodge */:
295
+ case 16 /* TNSCompositeOperationType.ColorDodge */:
296
296
  return 'color-dodge';
297
- case 17 /* ColorBurn */:
297
+ case 17 /* TNSCompositeOperationType.ColorBurn */:
298
298
  return 'color-burn';
299
- case 18 /* HardLight */:
299
+ case 18 /* TNSCompositeOperationType.HardLight */:
300
300
  return 'hard-light';
301
- case 19 /* SoftLight */:
301
+ case 19 /* TNSCompositeOperationType.SoftLight */:
302
302
  return 'soft-light';
303
- case 20 /* Difference */:
303
+ case 20 /* TNSCompositeOperationType.Difference */:
304
304
  return 'difference';
305
- case 21 /* Exclusion */:
305
+ case 21 /* TNSCompositeOperationType.Exclusion */:
306
306
  return 'exclusion';
307
- case 22 /* Hue */:
307
+ case 22 /* TNSCompositeOperationType.Hue */:
308
308
  return 'hue';
309
- case 23 /* Saturation */:
309
+ case 23 /* TNSCompositeOperationType.Saturation */:
310
310
  return 'saturation';
311
- case 24 /* Color */:
311
+ case 24 /* TNSCompositeOperationType.Color */:
312
312
  return 'color';
313
- case 25 /* Luminosity */:
313
+ case 25 /* TNSCompositeOperationType.Luminosity */:
314
314
  return 'luminosity';
315
315
  }
316
316
  }
@@ -320,82 +320,82 @@ export class CanvasRenderingContext2D extends CanvasRenderingContext2DBase {
320
320
  if (this.context) {
321
321
  switch (composite.toLowerCase()) {
322
322
  case 'source-over':
323
- this.context.globalCompositeOperation = 0 /* SourceOver */;
323
+ this.context.globalCompositeOperation = 0 /* TNSCompositeOperationType.SourceOver */;
324
324
  break;
325
325
  case 'source-in':
326
- this.context.globalCompositeOperation = 1 /* SourceIn */;
326
+ this.context.globalCompositeOperation = 1 /* TNSCompositeOperationType.SourceIn */;
327
327
  break;
328
328
  case 'source-out':
329
- this.context.globalCompositeOperation = 2 /* SourceOut */;
329
+ this.context.globalCompositeOperation = 2 /* TNSCompositeOperationType.SourceOut */;
330
330
  break;
331
331
  case 'source-atop':
332
- this.context.globalCompositeOperation = 3 /* SourceAtop */;
332
+ this.context.globalCompositeOperation = 3 /* TNSCompositeOperationType.SourceAtop */;
333
333
  break;
334
334
  case 'destination-over':
335
- this.context.globalCompositeOperation = 4 /* DestinationOver */;
335
+ this.context.globalCompositeOperation = 4 /* TNSCompositeOperationType.DestinationOver */;
336
336
  break;
337
337
  case 'destination-in':
338
- this.context.globalCompositeOperation = 5 /* DestinationIn */;
338
+ this.context.globalCompositeOperation = 5 /* TNSCompositeOperationType.DestinationIn */;
339
339
  break;
340
340
  case 'destination-out':
341
- this.context.globalCompositeOperation = 6 /* DestinationOut */;
341
+ this.context.globalCompositeOperation = 6 /* TNSCompositeOperationType.DestinationOut */;
342
342
  break;
343
343
  case 'destination-atop':
344
- this.context.globalCompositeOperation = 7 /* DestinationAtop */;
344
+ this.context.globalCompositeOperation = 7 /* TNSCompositeOperationType.DestinationAtop */;
345
345
  break;
346
346
  case 'lighter':
347
- this.context.globalCompositeOperation = 8 /* Lighter */;
347
+ this.context.globalCompositeOperation = 8 /* TNSCompositeOperationType.Lighter */;
348
348
  break;
349
349
  case 'copy':
350
- this.context.globalCompositeOperation = 9 /* Copy */;
350
+ this.context.globalCompositeOperation = 9 /* TNSCompositeOperationType.Copy */;
351
351
  break;
352
352
  case 'xor':
353
- this.context.globalCompositeOperation = 10 /* Xor */;
353
+ this.context.globalCompositeOperation = 10 /* TNSCompositeOperationType.Xor */;
354
354
  break;
355
355
  case 'multiply':
356
- this.context.globalCompositeOperation = 11 /* Multiply */;
356
+ this.context.globalCompositeOperation = 11 /* TNSCompositeOperationType.Multiply */;
357
357
  break;
358
358
  case 'screen':
359
- this.context.globalCompositeOperation = 12 /* Screen */;
359
+ this.context.globalCompositeOperation = 12 /* TNSCompositeOperationType.Screen */;
360
360
  break;
361
361
  case 'overlay':
362
- this.context.globalCompositeOperation = 13 /* Overlay */;
362
+ this.context.globalCompositeOperation = 13 /* TNSCompositeOperationType.Overlay */;
363
363
  break;
364
364
  case 'darken':
365
- this.context.globalCompositeOperation = 14 /* Darken */;
365
+ this.context.globalCompositeOperation = 14 /* TNSCompositeOperationType.Darken */;
366
366
  break;
367
367
  case 'lighten':
368
- this.context.globalCompositeOperation = 15 /* Lighten */;
368
+ this.context.globalCompositeOperation = 15 /* TNSCompositeOperationType.Lighten */;
369
369
  break;
370
370
  case 'color-dodge':
371
- this.context.globalCompositeOperation = 16 /* ColorDodge */;
371
+ this.context.globalCompositeOperation = 16 /* TNSCompositeOperationType.ColorDodge */;
372
372
  break;
373
373
  case 'color-burn':
374
- this.context.globalCompositeOperation = 17 /* ColorBurn */;
374
+ this.context.globalCompositeOperation = 17 /* TNSCompositeOperationType.ColorBurn */;
375
375
  break;
376
376
  case 'hard-light':
377
- this.context.globalCompositeOperation = 18 /* HardLight */;
377
+ this.context.globalCompositeOperation = 18 /* TNSCompositeOperationType.HardLight */;
378
378
  break;
379
379
  case 'soft-light':
380
- this.context.globalCompositeOperation = 19 /* SoftLight */;
380
+ this.context.globalCompositeOperation = 19 /* TNSCompositeOperationType.SoftLight */;
381
381
  break;
382
382
  case 'difference':
383
- this.context.globalCompositeOperation = 20 /* Difference */;
383
+ this.context.globalCompositeOperation = 20 /* TNSCompositeOperationType.Difference */;
384
384
  break;
385
385
  case 'exclusion':
386
- this.context.globalCompositeOperation = 21 /* Exclusion */;
386
+ this.context.globalCompositeOperation = 21 /* TNSCompositeOperationType.Exclusion */;
387
387
  break;
388
388
  case 'hue':
389
- this.context.globalCompositeOperation = 22 /* Hue */;
389
+ this.context.globalCompositeOperation = 22 /* TNSCompositeOperationType.Hue */;
390
390
  break;
391
391
  case 'saturation':
392
- this.context.globalCompositeOperation = 23 /* Saturation */;
392
+ this.context.globalCompositeOperation = 23 /* TNSCompositeOperationType.Saturation */;
393
393
  break;
394
394
  case 'color':
395
- this.context.globalCompositeOperation = 24 /* Color */;
395
+ this.context.globalCompositeOperation = 24 /* TNSCompositeOperationType.Color */;
396
396
  break;
397
397
  case 'luminosity':
398
- this.context.globalCompositeOperation = 25 /* Luminosity */;
398
+ this.context.globalCompositeOperation = 25 /* TNSCompositeOperationType.Luminosity */;
399
399
  break;
400
400
  }
401
401
  }
@@ -413,12 +413,12 @@ export class CanvasRenderingContext2D extends CanvasRenderingContext2DBase {
413
413
  get fillStyle() {
414
414
  this.log('get fillStyle');
415
415
  switch (this.context.fillStyle.getStyleType()) {
416
- case 0 /* Color */:
416
+ case 0 /* CanvasColorStyleType.Color */:
417
417
  const color = this.context.fillStyle;
418
418
  return color.color;
419
- case 1 /* Gradient */:
419
+ case 1 /* CanvasColorStyleType.Gradient */:
420
420
  return CanvasGradient.fromNative(this.context.fillStyle);
421
- case 2 /* Pattern */:
421
+ case 2 /* CanvasColorStyleType.Pattern */:
422
422
  return new CanvasPattern(this.context.fillStyle);
423
423
  }
424
424
  }
@@ -429,7 +429,7 @@ export class CanvasRenderingContext2D extends CanvasRenderingContext2DBase {
429
429
  }
430
430
  this._ensureLayoutBeforeDraw();
431
431
  if (typeof color === 'string') {
432
- this.context.fillStyle = TNSColor.alloc().init(color);
432
+ this.context.setFillStyleWithString(color);
433
433
  }
434
434
  else if (color instanceof CanvasGradient) {
435
435
  this.context.fillStyle = color.native;
@@ -441,12 +441,12 @@ export class CanvasRenderingContext2D extends CanvasRenderingContext2DBase {
441
441
  get strokeStyle() {
442
442
  this.log('get strokeStyle');
443
443
  switch (this.context.strokeStyle.getStyleType()) {
444
- case 0 /* Color */:
444
+ case 0 /* CanvasColorStyleType.Color */:
445
445
  const color = this.context.strokeStyle;
446
446
  return color.color;
447
- case 1 /* Gradient */:
447
+ case 1 /* CanvasColorStyleType.Gradient */:
448
448
  return CanvasGradient.fromNative(this.context.strokeStyle);
449
- case 2 /* Pattern */:
449
+ case 2 /* CanvasColorStyleType.Pattern */:
450
450
  return new CanvasPattern(this.context.strokeStyle);
451
451
  }
452
452
  }
@@ -457,7 +457,7 @@ export class CanvasRenderingContext2D extends CanvasRenderingContext2DBase {
457
457
  }
458
458
  this._ensureLayoutBeforeDraw();
459
459
  if (typeof color === 'string') {
460
- this.context.strokeStyle = TNSColor.alloc().init(color);
460
+ this.context.setStrokeStyleWithString(color);
461
461
  }
462
462
  else if (color instanceof CanvasGradient) {
463
463
  this.context.strokeStyle = color.native;
@@ -477,8 +477,7 @@ export class CanvasRenderingContext2D extends CanvasRenderingContext2DBase {
477
477
  this.context.lineWidth = width;
478
478
  }
479
479
  }
480
- addHitRegion(region) {
481
- }
480
+ addHitRegion(region) { }
482
481
  arc(x, y, radius, startAngle, endAngle, anticlockwise = false) {
483
482
  this.log('arc', x, y, radius, startAngle, anticlockwise);
484
483
  this._ensureLayoutBeforeDraw();
@@ -499,8 +498,7 @@ export class CanvasRenderingContext2D extends CanvasRenderingContext2DBase {
499
498
  this._ensureLayoutBeforeDraw();
500
499
  this.context.bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y);
501
500
  }
502
- clearHitRegions() {
503
- }
501
+ clearHitRegions() { }
504
502
  clearRect(x, y, width, height) {
505
503
  this.log('clearRect', x, y, width, height);
506
504
  this._ensureLayoutBeforeDraw();
@@ -579,34 +577,38 @@ export class CanvasRenderingContext2D extends CanvasRenderingContext2DBase {
579
577
  img = ImageSource.fromFileSync(image.src).ios;
580
578
  }
581
579
  }
582
- else if (image &&
583
- typeof image.tagName === 'string' &&
584
- image.tagName === 'CANVAS') {
580
+ else if (image && typeof image.tagName === 'string' && image.tagName === 'CANVAS') {
585
581
  if (image._canvas instanceof Canvas) {
586
582
  img = image._canvas.ios;
587
583
  }
588
584
  }
585
+ else if (image instanceof ImageBitmap || (image === null || image === void 0 ? void 0 : image.native) instanceof TNSImageBitmap) {
586
+ img = image.native;
587
+ }
589
588
  if (!img) {
590
589
  return null;
591
590
  }
592
591
  let rep;
593
592
  switch (repetition) {
594
593
  case 'no-repeat':
595
- rep = 3 /* NoRepeat */;
594
+ rep = 3 /* TNSPatternRepetition.NoRepeat */;
596
595
  break;
597
596
  case 'repeat-x':
598
- rep = 1 /* RepeatX */;
597
+ rep = 1 /* TNSPatternRepetition.RepeatX */;
599
598
  break;
600
599
  case 'repeat-y':
601
- rep = 2 /* RepeatY */;
600
+ rep = 2 /* TNSPatternRepetition.RepeatY */;
602
601
  break;
603
602
  default:
604
- rep = 0 /* Repeat */;
603
+ rep = 0 /* TNSPatternRepetition.Repeat */;
605
604
  break;
606
605
  }
607
606
  if (img instanceof TNSImageAsset) {
608
607
  return new CanvasPattern(this.context.createPattern(img, rep));
609
608
  }
609
+ else if (img instanceof TNSImageBitmap) {
610
+ return new CanvasPattern(this.context.createPattern(img, rep));
611
+ }
610
612
  else if (img instanceof UIImage) {
611
613
  return new CanvasPattern(this.context.createPattern(img, rep));
612
614
  }
@@ -620,8 +622,12 @@ export class CanvasRenderingContext2D extends CanvasRenderingContext2DBase {
620
622
  this._ensureLayoutBeforeDraw();
621
623
  return CanvasGradient.fromNative(this.context.createRadialGradient(x0, y0, r0, x1, y1, r1));
622
624
  }
623
- drawFocusIfNeeded(...args) {
625
+ createConicGradient(startAngle, x, y) {
626
+ this.log('createConicGradient value:', startAngle, x, y);
627
+ this._ensureLayoutBeforeDraw();
628
+ return CanvasGradient.fromNative(this.context.createConicGradient(startAngle, x, y));
624
629
  }
630
+ drawFocusIfNeeded(...args) { }
625
631
  drawImage(...args) {
626
632
  this.log('drawImage', ...args);
627
633
  this._ensureLayoutBeforeDraw();
@@ -638,9 +644,7 @@ export class CanvasRenderingContext2D extends CanvasRenderingContext2DBase {
638
644
  else if (image instanceof ImageAsset || image instanceof UIImage) {
639
645
  // NOOP
640
646
  }
641
- else if (image &&
642
- typeof image.tagName === 'string' &&
643
- (image.tagName === 'IMG' || image.tagName === 'IMAGE')) {
647
+ else if (image && typeof image.tagName === 'string' && (image.tagName === 'IMG' || image.tagName === 'IMAGE')) {
644
648
  width = image.width;
645
649
  height = image.height;
646
650
  if (image._imageSource instanceof ImageSource) {
@@ -656,11 +660,12 @@ export class CanvasRenderingContext2D extends CanvasRenderingContext2DBase {
656
660
  image = ImageSource.fromFileSync(image.src).ios;
657
661
  }
658
662
  }
659
- else if (image &&
660
- typeof image.tagName === 'string' &&
661
- image.tagName === 'CANVAS' && image._canvas instanceof Canvas) {
663
+ else if (image && typeof image.tagName === 'string' && image.tagName === 'CANVAS' && image._canvas instanceof Canvas) {
662
664
  image = image._canvas;
663
665
  }
666
+ else if (image instanceof ImageBitmap || (image === null || image === void 0 ? void 0 : image.native) instanceof TNSImageBitmap) {
667
+ image = image.native;
668
+ }
664
669
  if (args.length === 3) {
665
670
  if (image instanceof ImageAsset) {
666
671
  this.context.drawImage(image.native, args[1], args[2]);
@@ -727,10 +732,10 @@ export class CanvasRenderingContext2D extends CanvasRenderingContext2DBase {
727
732
  this.log('fillText', text, x, y, maxWidth);
728
733
  this._ensureLayoutBeforeDraw();
729
734
  if (typeof maxWidth === 'number') {
730
- this.context.fillText(text, x, y, maxWidth);
735
+ this.context.fillText(text + '', x, y, maxWidth);
731
736
  }
732
737
  else {
733
- this.context.fillText(text, x, y);
738
+ this.context.fillText(text + '', x, y);
734
739
  }
735
740
  }
736
741
  getImageData(sx, sy, sw, sh) {
@@ -807,8 +812,17 @@ export class CanvasRenderingContext2D extends CanvasRenderingContext2DBase {
807
812
  this._ensureLayoutBeforeDraw();
808
813
  this.context.rect(x, y, width, height);
809
814
  }
810
- removeHitRegion(id) {
815
+ roundRect(x, y, width, height, radii) {
816
+ this.log('rect value:', x, y, width, height);
817
+ this._ensureLayoutBeforeDraw();
818
+ if (Array.isArray(radii)) {
819
+ this.context.roundRect(x, y, width, height, radii);
820
+ }
821
+ else if (typeof radii === 'number') {
822
+ this.context.roundRectWithXYWidthHeightRadii(x, y, width, height, radii);
823
+ }
811
824
  }
825
+ removeHitRegion(id) { }
812
826
  resetTransform() {
813
827
  this.log('resetTransform');
814
828
  this._ensureLayoutBeforeDraw();
@@ -836,8 +850,7 @@ export class CanvasRenderingContext2D extends CanvasRenderingContext2DBase {
836
850
  this.context.scale(x, y);
837
851
  }
838
852
  }
839
- scrollPathIntoView(path) {
840
- }
853
+ scrollPathIntoView(path) { }
841
854
  setLineDash(segments) {
842
855
  this.log('setLineDash', segments);
843
856
  this._ensureLayoutBeforeDraw();
@@ -867,10 +880,10 @@ export class CanvasRenderingContext2D extends CanvasRenderingContext2DBase {
867
880
  this.log('strokeText', text, x, y, maxWidth);
868
881
  this._ensureLayoutBeforeDraw();
869
882
  if (typeof maxWidth === 'number') {
870
- this.context.strokeText(text, x, y, maxWidth);
883
+ this.context.strokeText(text + '', x, y, maxWidth);
871
884
  }
872
885
  else {
873
- this.context.strokeText(text, x, y);
886
+ this.context.strokeText(text + '', x, y);
874
887
  }
875
888
  }
876
889
  transform(a, b, c, d, e, f) {