@shopify/react-native-skia 1.5.10 → 1.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (171) hide show
  1. package/android/cpp/jni/include/JniSkiaBaseView.h +6 -5
  2. package/android/cpp/jni/include/JniSkiaDomView.h +6 -4
  3. package/android/cpp/jni/include/JniSkiaManager.h +2 -2
  4. package/android/cpp/jni/include/JniSkiaPictureView.h +6 -4
  5. package/android/cpp/rnskia-android/MainThreadDispatcher.h +3 -0
  6. package/android/cpp/rnskia-android/OpenGLContext.h +44 -9
  7. package/android/cpp/rnskia-android/OpenGLWindowContext.cpp +0 -1
  8. package/android/cpp/rnskia-android/OpenGLWindowContext.h +2 -2
  9. package/android/cpp/rnskia-android/RNSkAndroidPlatformContext.h +61 -3
  10. package/android/cpp/rnskia-android/RNSkAndroidView.h +10 -13
  11. package/android/cpp/rnskia-android/RNSkOpenGLCanvasProvider.cpp +42 -36
  12. package/android/cpp/rnskia-android/RNSkOpenGLCanvasProvider.h +2 -2
  13. package/android/cpp/rnskia-android/gl/Display.h +2 -0
  14. package/android/src/main/java/com/shopify/reactnative/skia/SkiaAHBView.java +113 -0
  15. package/android/src/main/java/com/shopify/reactnative/skia/SkiaBaseView.java +45 -54
  16. package/android/src/main/java/com/shopify/reactnative/skia/SkiaBaseViewManager.java +5 -0
  17. package/android/src/main/java/com/shopify/reactnative/skia/SkiaDomView.java +2 -2
  18. package/android/src/main/java/com/shopify/reactnative/skia/SkiaPictureView.java +2 -2
  19. package/android/src/main/java/com/shopify/reactnative/skia/SkiaSurfaceView.java +42 -0
  20. package/android/src/main/java/com/shopify/reactnative/skia/SkiaTextureView.java +90 -0
  21. package/android/src/main/java/com/shopify/reactnative/skia/SkiaViewAPI.java +16 -0
  22. package/android/src/paper/java/com/facebook/react/viewmanagers/SkiaDomViewManagerDelegate.java +3 -0
  23. package/android/src/paper/java/com/facebook/react/viewmanagers/SkiaDomViewManagerInterface.java +1 -0
  24. package/android/src/paper/java/com/facebook/react/viewmanagers/SkiaPictureViewManagerDelegate.java +3 -1
  25. package/android/src/paper/java/com/facebook/react/viewmanagers/SkiaPictureViewManagerInterface.java +1 -0
  26. package/cpp/api/JsiSkContourMeasure.h +1 -5
  27. package/cpp/api/JsiSkImage.h +11 -0
  28. package/cpp/api/JsiSkImageFactory.h +14 -0
  29. package/cpp/api/JsiSkPicture.h +2 -0
  30. package/cpp/api/JsiSkSurface.h +7 -0
  31. package/cpp/api/JsiTextureInfo.h +53 -0
  32. package/cpp/jsi/ViewProperty.h +48 -0
  33. package/cpp/rnskia/RNSkDomView.cpp +0 -20
  34. package/cpp/rnskia/RNSkDomView.h +4 -9
  35. package/cpp/rnskia/RNSkJsiViewApi.h +3 -3
  36. package/cpp/rnskia/RNSkPictureView.h +11 -28
  37. package/cpp/rnskia/RNSkPlatformContext.h +18 -12
  38. package/cpp/rnskia/RNSkView.h +5 -29
  39. package/ios/RNSkia-iOS/MetalContext.h +101 -15
  40. package/ios/RNSkia-iOS/MetalContext.mm +9 -8
  41. package/ios/RNSkia-iOS/MetalWindowContext.h +39 -0
  42. package/ios/RNSkia-iOS/MetalWindowContext.mm +60 -0
  43. package/ios/RNSkia-iOS/RNSkiOSPlatformContext.h +13 -25
  44. package/ios/RNSkia-iOS/RNSkiOSPlatformContext.mm +88 -2
  45. package/ios/RNSkia-iOS/SkiaCVPixelBufferUtils.mm +9 -2
  46. package/ios/RNSkia-iOS/SkiaDomViewManager.mm +5 -0
  47. package/ios/RNSkia-iOS/SkiaManager.mm +1 -2
  48. package/ios/RNSkia-iOS/SkiaPictureView.mm +1 -0
  49. package/ios/RNSkia-iOS/SkiaPictureViewManager.mm +5 -0
  50. package/ios/RNSkia-iOS/SkiaUIView.h +1 -0
  51. package/ios/RNSkia-iOS/SkiaUIView.mm +21 -14
  52. package/lib/commonjs/skia/types/Image/ColorType.d.ts +21 -0
  53. package/lib/commonjs/skia/types/Image/ColorType.js +29 -0
  54. package/lib/commonjs/skia/types/Image/ColorType.js.map +1 -0
  55. package/lib/commonjs/skia/types/Image/ColorType.web.d.ts +19 -0
  56. package/lib/commonjs/skia/types/Image/ColorType.web.js +27 -0
  57. package/lib/commonjs/skia/types/Image/ColorType.web.js.map +1 -0
  58. package/lib/commonjs/skia/types/Image/Image.d.ts +10 -0
  59. package/lib/commonjs/skia/types/Image/Image.js.map +1 -1
  60. package/lib/commonjs/skia/types/Image/ImageFactory.d.ts +19 -19
  61. package/lib/commonjs/skia/types/Image/ImageFactory.js +1 -21
  62. package/lib/commonjs/skia/types/Image/ImageFactory.js.map +1 -1
  63. package/lib/commonjs/skia/types/Image/index.d.ts +1 -0
  64. package/lib/commonjs/skia/types/Image/index.js +11 -0
  65. package/lib/commonjs/skia/types/Image/index.js.map +1 -1
  66. package/lib/commonjs/skia/types/Matrix4.d.ts +6 -0
  67. package/lib/commonjs/skia/types/Matrix4.js +69 -1
  68. package/lib/commonjs/skia/types/Matrix4.js.map +1 -1
  69. package/lib/commonjs/skia/types/Surface/Surface.d.ts +11 -0
  70. package/lib/commonjs/skia/types/Surface/Surface.js.map +1 -1
  71. package/lib/commonjs/skia/web/JsiSkImage.d.ts +1 -0
  72. package/lib/commonjs/skia/web/JsiSkImage.js +4 -0
  73. package/lib/commonjs/skia/web/JsiSkImage.js.map +1 -1
  74. package/lib/commonjs/skia/web/JsiSkImageFactory.d.ts +1 -0
  75. package/lib/commonjs/skia/web/JsiSkImageFactory.js +3 -0
  76. package/lib/commonjs/skia/web/JsiSkImageFactory.js.map +1 -1
  77. package/lib/commonjs/skia/web/JsiSkSurface.d.ts +1 -0
  78. package/lib/commonjs/skia/web/JsiSkSurface.js +4 -0
  79. package/lib/commonjs/skia/web/JsiSkSurface.js.map +1 -1
  80. package/lib/commonjs/specs/SkiaPictureViewNativeComponent.d.ts +1 -0
  81. package/lib/commonjs/specs/SkiaPictureViewNativeComponent.js.map +1 -1
  82. package/lib/commonjs/views/SkiaDomView.js +3 -1
  83. package/lib/commonjs/views/SkiaDomView.js.map +1 -1
  84. package/lib/commonjs/views/SkiaPictureView.js +5 -1
  85. package/lib/commonjs/views/SkiaPictureView.js.map +1 -1
  86. package/lib/commonjs/views/types.d.ts +2 -0
  87. package/lib/commonjs/views/types.js.map +1 -1
  88. package/lib/module/skia/types/Image/ColorType.d.ts +21 -0
  89. package/lib/module/skia/types/Image/ColorType.js +23 -0
  90. package/lib/module/skia/types/Image/ColorType.js.map +1 -0
  91. package/lib/module/skia/types/Image/ColorType.web.d.ts +19 -0
  92. package/lib/module/skia/types/Image/ColorType.web.js +21 -0
  93. package/lib/module/skia/types/Image/ColorType.web.js.map +1 -0
  94. package/lib/module/skia/types/Image/Image.d.ts +10 -0
  95. package/lib/module/skia/types/Image/Image.js.map +1 -1
  96. package/lib/module/skia/types/Image/ImageFactory.d.ts +19 -19
  97. package/lib/module/skia/types/Image/ImageFactory.js +0 -20
  98. package/lib/module/skia/types/Image/ImageFactory.js.map +1 -1
  99. package/lib/module/skia/types/Image/index.d.ts +1 -0
  100. package/lib/module/skia/types/Image/index.js +1 -0
  101. package/lib/module/skia/types/Image/index.js.map +1 -1
  102. package/lib/module/skia/types/Matrix4.d.ts +6 -0
  103. package/lib/module/skia/types/Matrix4.js +67 -0
  104. package/lib/module/skia/types/Matrix4.js.map +1 -1
  105. package/lib/module/skia/types/Surface/Surface.d.ts +11 -0
  106. package/lib/module/skia/types/Surface/Surface.js.map +1 -1
  107. package/lib/module/skia/web/JsiSkImage.d.ts +1 -0
  108. package/lib/module/skia/web/JsiSkImage.js +4 -0
  109. package/lib/module/skia/web/JsiSkImage.js.map +1 -1
  110. package/lib/module/skia/web/JsiSkImageFactory.d.ts +1 -0
  111. package/lib/module/skia/web/JsiSkImageFactory.js +3 -0
  112. package/lib/module/skia/web/JsiSkImageFactory.js.map +1 -1
  113. package/lib/module/skia/web/JsiSkSurface.d.ts +1 -0
  114. package/lib/module/skia/web/JsiSkSurface.js +4 -0
  115. package/lib/module/skia/web/JsiSkSurface.js.map +1 -1
  116. package/lib/module/specs/SkiaPictureViewNativeComponent.d.ts +1 -0
  117. package/lib/module/specs/SkiaPictureViewNativeComponent.js.map +1 -1
  118. package/lib/module/views/SkiaDomView.js +3 -1
  119. package/lib/module/views/SkiaDomView.js.map +1 -1
  120. package/lib/module/views/SkiaPictureView.js +5 -1
  121. package/lib/module/views/SkiaPictureView.js.map +1 -1
  122. package/lib/module/views/types.d.ts +2 -0
  123. package/lib/module/views/types.js.map +1 -1
  124. package/lib/typescript/lib/commonjs/skia/types/Image/ColorType.d.ts +2 -0
  125. package/lib/typescript/lib/commonjs/skia/types/Image/ColorType.web.d.ts +2 -0
  126. package/lib/typescript/lib/commonjs/skia/types/Image/ImageFactory.d.ts +0 -1
  127. package/lib/typescript/lib/commonjs/skia/types/Matrix4.d.ts +6 -0
  128. package/lib/typescript/lib/commonjs/skia/web/JsiSkImage.d.ts +1 -0
  129. package/lib/typescript/lib/commonjs/skia/web/JsiSkImageFactory.d.ts +1 -0
  130. package/lib/typescript/lib/commonjs/skia/web/JsiSkSurface.d.ts +1 -0
  131. package/lib/typescript/lib/module/mock/index.d.ts +1 -0
  132. package/lib/typescript/lib/module/skia/types/Image/ColorType.d.ts +1 -0
  133. package/lib/typescript/lib/module/skia/types/Image/ColorType.web.d.ts +1 -0
  134. package/lib/typescript/lib/module/skia/types/Image/ImageFactory.d.ts +0 -1
  135. package/lib/typescript/lib/module/skia/types/Image/index.d.ts +1 -0
  136. package/lib/typescript/lib/module/skia/types/Matrix4.d.ts +1 -0
  137. package/lib/typescript/lib/module/skia/web/JsiSkImage.d.ts +1 -0
  138. package/lib/typescript/lib/module/skia/web/JsiSkImageFactory.d.ts +1 -0
  139. package/lib/typescript/lib/module/skia/web/JsiSkSurface.d.ts +1 -0
  140. package/lib/typescript/src/skia/types/Image/ColorType.d.ts +21 -0
  141. package/lib/typescript/src/skia/types/Image/ColorType.web.d.ts +19 -0
  142. package/lib/typescript/src/skia/types/Image/Image.d.ts +10 -0
  143. package/lib/typescript/src/skia/types/Image/ImageFactory.d.ts +19 -19
  144. package/lib/typescript/src/skia/types/Image/index.d.ts +1 -0
  145. package/lib/typescript/src/skia/types/Matrix4.d.ts +6 -0
  146. package/lib/typescript/src/skia/types/Surface/Surface.d.ts +11 -0
  147. package/lib/typescript/src/skia/web/JsiSkImage.d.ts +1 -0
  148. package/lib/typescript/src/skia/web/JsiSkImageFactory.d.ts +1 -0
  149. package/lib/typescript/src/skia/web/JsiSkSurface.d.ts +1 -0
  150. package/lib/typescript/src/specs/SkiaPictureViewNativeComponent.d.ts +1 -0
  151. package/lib/typescript/src/views/types.d.ts +2 -0
  152. package/package.json +1 -1
  153. package/src/renderer/__tests__/e2e/Matrix4.spec.tsx +93 -0
  154. package/src/skia/__tests__/Enums.spec.ts +2 -2
  155. package/src/skia/types/Image/ColorType.ts +21 -0
  156. package/src/skia/types/Image/ColorType.web.ts +19 -0
  157. package/src/skia/types/Image/Image.ts +11 -0
  158. package/src/skia/types/Image/ImageFactory.ts +25 -20
  159. package/src/skia/types/Image/index.ts +1 -0
  160. package/src/skia/types/Matrix4.ts +101 -0
  161. package/src/skia/types/Surface/Surface.ts +12 -0
  162. package/src/skia/web/JsiSkImage.ts +5 -0
  163. package/src/skia/web/JsiSkImageFactory.ts +4 -0
  164. package/src/skia/web/JsiSkSurface.ts +5 -0
  165. package/src/specs/SkiaPictureViewNativeComponent.ts +1 -0
  166. package/src/views/SkiaDomView.tsx +2 -1
  167. package/src/views/SkiaPictureView.tsx +4 -1
  168. package/src/views/types.ts +3 -0
  169. package/cpp/jsi/JsiValueWrapper.h +0 -164
  170. package/ios/RNSkia-iOS/SkiaMetalSurfaceFactory.h +0 -128
  171. package/ios/RNSkia-iOS/SkiaMetalSurfaceFactory.mm +0 -92
@@ -1,6 +1,7 @@
1
1
  #import "RNSkiOSPlatformContext.h"
2
2
 
3
3
  #import <CoreMedia/CMSampleBuffer.h>
4
+ #include <Metal/Metal.h>
4
5
  #import <React/RCTUtils.h>
5
6
  #include <thread>
6
7
  #include <utility>
@@ -81,8 +82,8 @@ uint64_t RNSkiOSPlatformContext::makeNativeBuffer(sk_sp<SkImage> image) {
81
82
  #else
82
83
  // on iOS, 32_BGRA is the only supported RGB format for CVPixelBuffers.
83
84
  image = image->makeColorTypeAndColorSpace(
84
- MetalContext::getInstance()._context.skContext.get(),
85
- kBGRA_8888_SkColorType, SkColorSpace::MakeSRGB());
85
+ MetalContext::getInstance().getDirectContext(), kBGRA_8888_SkColorType,
86
+ SkColorSpace::MakeSRGB());
86
87
  #endif
87
88
  if (image == nullptr) {
88
89
  throw std::runtime_error(
@@ -155,6 +156,38 @@ uint64_t RNSkiOSPlatformContext::makeNativeBuffer(sk_sp<SkImage> image) {
155
156
  return reinterpret_cast<uint64_t>(pixelBuffer);
156
157
  }
157
158
 
159
+ const TextureInfo RNSkiOSPlatformContext::getTexture(sk_sp<SkImage> image) {
160
+ GrBackendTexture texture;
161
+ TextureInfo result;
162
+ if (!SkImages::GetBackendTextureFromImage(image, &texture, true)) {
163
+ throw std::runtime_error("Couldn't get backend texture");
164
+ }
165
+ if (!texture.isValid()) {
166
+ throw std::runtime_error("Invalid backend texture");
167
+ }
168
+ GrMtlTextureInfo textureInfo;
169
+ if (!GrBackendTextures::GetMtlTextureInfo(texture, &textureInfo)) {
170
+ throw std::runtime_error("Couldn't get Metal texture info");
171
+ }
172
+ result.mtlTexture = textureInfo.fTexture.get();
173
+ return result;
174
+ }
175
+
176
+ const TextureInfo RNSkiOSPlatformContext::getTexture(sk_sp<SkSurface> surface) {
177
+ GrBackendTexture texture = SkSurfaces::GetBackendTexture(
178
+ surface.get(), SkSurfaces::BackendHandleAccess::kFlushRead);
179
+ TextureInfo result;
180
+ if (!texture.isValid()) {
181
+ throw std::runtime_error("Invalid backend texture");
182
+ }
183
+ GrMtlTextureInfo textureInfo;
184
+ if (!GrBackendTextures::GetMtlTextureInfo(texture, &textureInfo)) {
185
+ throw std::runtime_error("Couldn't get Metal texture info");
186
+ }
187
+ result.mtlTexture = textureInfo.fTexture.get();
188
+ return result;
189
+ }
190
+
158
191
  std::shared_ptr<RNSkVideo>
159
192
  RNSkiOSPlatformContext::createVideo(const std::string &url) {
160
193
  return std::make_shared<RNSkiOSVideo>(url, this);
@@ -192,6 +225,59 @@ sk_sp<SkImage> RNSkiOSPlatformContext::makeImageFromNativeBuffer(void *buffer) {
192
225
  #endif
193
226
  }
194
227
 
228
+ sk_sp<SkImage> RNSkiOSPlatformContext::makeImageFromNativeTexture(
229
+ const TextureInfo &texInfo, int width, int height, bool mipMapped) {
230
+ id<MTLTexture> mtlTexture = (__bridge id<MTLTexture>)(texInfo.mtlTexture);
231
+
232
+ SkColorType colorType = mtlPixelFormatToSkColorType(mtlTexture.pixelFormat);
233
+ if (colorType == SkColorType::kUnknown_SkColorType) {
234
+ throw std::runtime_error("Unsupported pixelFormat");
235
+ }
236
+
237
+ GrMtlTextureInfo textureInfo;
238
+ textureInfo.fTexture.retain((__bridge const void *)mtlTexture);
239
+
240
+ GrBackendTexture texture = GrBackendTextures::MakeMtl(
241
+ width, height, mipMapped ? skgpu::Mipmapped::kYes : skgpu::Mipmapped::kNo,
242
+ textureInfo);
243
+
244
+ return SkImages::BorrowTextureFrom(getDirectContext(), texture,
245
+ kTopLeft_GrSurfaceOrigin, colorType,
246
+ kPremul_SkAlphaType, nullptr);
247
+ }
248
+
249
+ SkColorType RNSkiOSPlatformContext::mtlPixelFormatToSkColorType(
250
+ MTLPixelFormat pixelFormat) {
251
+ switch (pixelFormat) {
252
+ case MTLPixelFormatRGBA8Unorm:
253
+ return kRGBA_8888_SkColorType;
254
+ case MTLPixelFormatBGRA8Unorm:
255
+ return kBGRA_8888_SkColorType;
256
+ case MTLPixelFormatRGB10A2Unorm:
257
+ return kRGBA_1010102_SkColorType;
258
+ case MTLPixelFormatR8Unorm:
259
+ return kGray_8_SkColorType;
260
+ case MTLPixelFormatRGBA16Float:
261
+ return kRGBA_F16_SkColorType;
262
+ case MTLPixelFormatRG8Unorm:
263
+ return kR8G8_unorm_SkColorType;
264
+ case MTLPixelFormatR16Float:
265
+ return kA16_float_SkColorType;
266
+ case MTLPixelFormatRG16Float:
267
+ return kR16G16_float_SkColorType;
268
+ case MTLPixelFormatR16Unorm:
269
+ return kA16_unorm_SkColorType;
270
+ case MTLPixelFormatRG16Unorm:
271
+ return kR16G16_unorm_SkColorType;
272
+ case MTLPixelFormatRGBA16Unorm:
273
+ return kR16G16B16A16_unorm_SkColorType;
274
+ case MTLPixelFormatRGBA8Unorm_sRGB:
275
+ return kSRGBA_8888_SkColorType;
276
+ default:
277
+ return kUnknown_SkColorType;
278
+ }
279
+ }
280
+
195
281
  #if !defined(SK_GRAPHITE)
196
282
  GrDirectContext *RNSkiOSPlatformContext::getDirectContext() {
197
283
  return MetalContext::getInstance().getDirectContext();
@@ -6,18 +6,25 @@
6
6
  //
7
7
 
8
8
  #import "SkiaCVPixelBufferUtils.h"
9
- #import "SkiaMetalSurfaceFactory.h"
10
9
 
11
10
  #pragma clang diagnostic push
12
11
  #pragma clang diagnostic ignored "-Wdocumentation"
12
+
13
+ #import "include/core/SkCanvas.h"
13
14
  #import "include/core/SkColorSpace.h"
15
+
16
+ #import <CoreMedia/CMSampleBuffer.h>
17
+ #import <CoreVideo/CVMetalTextureCache.h>
18
+
14
19
  #import <include/gpu/ganesh/GrBackendSurface.h>
20
+ #import <include/gpu/ganesh/GrDirectContext.h>
15
21
  #import <include/gpu/ganesh/SkImageGanesh.h>
22
+ #import <include/gpu/ganesh/SkSurfaceGanesh.h>
16
23
  #import <include/gpu/ganesh/mtl/GrMtlBackendContext.h>
17
24
  #import <include/gpu/ganesh/mtl/GrMtlBackendSurface.h>
18
25
  #import <include/gpu/ganesh/mtl/GrMtlDirectContext.h>
19
- #import <include/gpu/ganesh/mtl/GrMtlTypes.h>
20
26
  #import <include/gpu/ganesh/mtl/SkSurfaceMetal.h>
27
+
21
28
  #pragma clang diagnostic pop
22
29
 
23
30
  #include <TargetConditionals.h>
@@ -31,6 +31,11 @@ RCT_CUSTOM_VIEW_PROPERTY(debug, BOOL, SkiaUIView) {
31
31
  [(SkiaUIView *)view setDebugMode:debug];
32
32
  }
33
33
 
34
+ RCT_CUSTOM_VIEW_PROPERTY(opaque, BOOL, SkiaUIView) {
35
+ bool debug = json != NULL ? [RCTConvert BOOL:json] : false;
36
+ [(SkiaUIView *)view setOpaque:debug];
37
+ }
38
+
34
39
  - (UIView *)view {
35
40
  auto skManager = [[self skiaManager] skManager];
36
41
  // Pass SkManager as a raw pointer to avoid circular dependenciesr
@@ -38,8 +38,7 @@
38
38
  // Create the RNSkiaManager (cross platform)
39
39
  _skManager = std::make_shared<RNSkia::RNSkManager>(
40
40
  jsRuntime, jsInvoker,
41
- std::make_shared<RNSkia::RNSkiOSPlatformContext>(jsRuntime, bridge,
42
- jsInvoker));
41
+ std::make_shared<RNSkia::RNSkiOSPlatformContext>(bridge, jsInvoker));
43
42
  }
44
43
  }
45
44
  return self;
@@ -54,6 +54,7 @@ using namespace facebook::react;
54
54
  [[RCTConvert NSString:RCTNSStringFromString(newProps.nativeId)] intValue];
55
55
  [self setNativeId:nativeId];
56
56
  [self setDebugMode:newProps.debug];
57
+ [self setOpaque:newProps.opaque];
57
58
  }
58
59
 
59
60
  @end
@@ -31,6 +31,11 @@ RCT_CUSTOM_VIEW_PROPERTY(debug, BOOL, SkiaUIView) {
31
31
  [(SkiaUIView *)view setDebugMode:debug];
32
32
  }
33
33
 
34
+ RCT_CUSTOM_VIEW_PROPERTY(opaque, BOOL, SkiaUIView) {
35
+ bool opaque = json != NULL ? [RCTConvert BOOL:json] : false;
36
+ [(SkiaUIView *)view setOpaque:opaque];
37
+ }
38
+
34
39
  - (UIView *)view {
35
40
  auto skManager = [[self skiaManager] skManager];
36
41
  // Pass SkManager as a raw pointer to avoid circular dependenciesr
@@ -32,6 +32,7 @@
32
32
  - (SkiaManager *)skiaManager;
33
33
 
34
34
  - (void)setDebugMode:(bool)debugMode;
35
+ - (void)setOpaque:(bool)opaque;
35
36
  - (void)setNativeId:(size_t)nativeId;
36
37
 
37
38
  @end
@@ -15,6 +15,7 @@
15
15
  std::shared_ptr<RNSkia::RNSkPlatformContext>)>
16
16
  _factory;
17
17
  bool _debugMode;
18
+ bool _opaque;
18
19
  size_t _nativeId;
19
20
  }
20
21
 
@@ -61,18 +62,7 @@
61
62
  #pragma mark Lifecycle
62
63
 
63
64
  - (void)willMoveToSuperview:(UIView *)newWindow {
64
- if (newWindow == NULL) {
65
- // Remove implementation view when the parent view is not set
66
- if (_impl != nullptr) {
67
- [_impl->getLayer() removeFromSuperlayer];
68
-
69
- if (_nativeId != 0 && _manager != nullptr) {
70
- _manager->setSkiaView(_nativeId, nullptr);
71
- }
72
-
73
- _impl = nullptr;
74
- }
75
- } else {
65
+ if (newWindow != nullptr) {
76
66
  // Create implementation view when the parent view is set
77
67
  if (_impl == nullptr && _manager != nullptr) {
78
68
  _impl = _factory(_manager->getPlatformContext());
@@ -89,6 +79,21 @@
89
79
  }
90
80
  }
91
81
 
82
+ - (void)removeFromSuperview {
83
+ // Cleanup when removed from view hierarchy
84
+ if (_impl != nullptr) {
85
+ [_impl->getLayer() removeFromSuperlayer];
86
+
87
+ if (_nativeId != 0 && _manager != nullptr) {
88
+ _manager->setSkiaView(_nativeId, nullptr);
89
+ }
90
+
91
+ _impl = nullptr;
92
+ }
93
+
94
+ [super removeFromSuperview];
95
+ }
96
+
92
97
  - (void)dealloc {
93
98
  [self unregisterView];
94
99
  [[NSNotificationCenter defaultCenter]
@@ -118,8 +123,6 @@
118
123
  if (_manager != nullptr && _nativeId != 0) {
119
124
  _manager->unregisterSkiaView(_nativeId);
120
125
  }
121
-
122
- assert(_impl == nullptr);
123
126
  }
124
127
 
125
128
  #pragma Render
@@ -150,6 +153,10 @@
150
153
  }
151
154
  }
152
155
 
156
+ - (void)setOpaque:(bool)opaque {
157
+ _opaque = opaque;
158
+ }
159
+
153
160
  - (void)setNativeId:(size_t)nativeId {
154
161
  _nativeId = nativeId;
155
162
 
@@ -0,0 +1,21 @@
1
+ export declare enum ColorType {
2
+ Unknown = 0,// uninitialized
3
+ Alpha_8 = 1,// pixel with alpha in 8-bit byte
4
+ RGB_565 = 2,// pixel with 5 bits red, 6 bits green, 5 bits blue, in 16-bit word
5
+ ARGB_4444 = 3,// pixel with 4 bits for alpha, red, green, blue; in 16-bit word
6
+ RGBA_8888 = 4,// pixel with 8 bits for red, green, blue, alpha; in 32-bit word
7
+ RGB_888x = 5,// pixel with 8 bits each for red, green, blue; in 32-bit word
8
+ BGRA_8888 = 6,// pixel with 8 bits for blue, green, red, alpha; in 32-bit word
9
+ RGBA_1010102 = 7,// 10 bits for red, green, blue; 2 bits for alpha; in 32-bit word
10
+ BGRA_1010102 = 8,// 10 bits for blue, green, red; 2 bits for alpha; in 32-bit word
11
+ RGB_101010x = 9,// pixel with 10 bits each for red, green, blue; in 32-bit word
12
+ BGR_101010x = 10,// pixel with 10 bits each for blue, green, red; in 32-bit word
13
+ BGR_101010x_XR = 11,// pixel with 10 bits each for blue, green, red; in 32-bit word, extended range
14
+ BGRA_10101010_XR = 12,// pixel with 10 bits each for blue, green, red, alpha; in 64-bit word, extended range
15
+ RGBA_10x6 = 13,// pixel with 10 used bits (most significant) followed by 6 unused
16
+ Gray_8 = 14,// pixel with grayscale level in 8-bit byte
17
+ RGBA_F16Norm = 15,// pixel with half floats in [0,1] for red, green, blue, alpha; in 64-bit word
18
+ RGBA_F16 = 16,// pixel with half floats for red, green, blue, alpha; in 64-bit word
19
+ RGB_F16F16F16x = 17,// pixel with half floats for red, green, blue; in 64-bit word
20
+ RGBA_F32 = 18
21
+ }
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.ColorType = void 0;
7
+ let ColorType = exports.ColorType = /*#__PURE__*/function (ColorType) {
8
+ ColorType[ColorType["Unknown"] = 0] = "Unknown";
9
+ ColorType[ColorType["Alpha_8"] = 1] = "Alpha_8";
10
+ ColorType[ColorType["RGB_565"] = 2] = "RGB_565";
11
+ ColorType[ColorType["ARGB_4444"] = 3] = "ARGB_4444";
12
+ ColorType[ColorType["RGBA_8888"] = 4] = "RGBA_8888";
13
+ ColorType[ColorType["RGB_888x"] = 5] = "RGB_888x";
14
+ ColorType[ColorType["BGRA_8888"] = 6] = "BGRA_8888";
15
+ ColorType[ColorType["RGBA_1010102"] = 7] = "RGBA_1010102";
16
+ ColorType[ColorType["BGRA_1010102"] = 8] = "BGRA_1010102";
17
+ ColorType[ColorType["RGB_101010x"] = 9] = "RGB_101010x";
18
+ ColorType[ColorType["BGR_101010x"] = 10] = "BGR_101010x";
19
+ ColorType[ColorType["BGR_101010x_XR"] = 11] = "BGR_101010x_XR";
20
+ ColorType[ColorType["BGRA_10101010_XR"] = 12] = "BGRA_10101010_XR";
21
+ ColorType[ColorType["RGBA_10x6"] = 13] = "RGBA_10x6";
22
+ ColorType[ColorType["Gray_8"] = 14] = "Gray_8";
23
+ ColorType[ColorType["RGBA_F16Norm"] = 15] = "RGBA_F16Norm";
24
+ ColorType[ColorType["RGBA_F16"] = 16] = "RGBA_F16";
25
+ ColorType[ColorType["RGB_F16F16F16x"] = 17] = "RGB_F16F16F16x";
26
+ ColorType[ColorType["RGBA_F32"] = 18] = "RGBA_F32";
27
+ return ColorType;
28
+ }({}); // pixel using C float for red, green, blue, alpha; in 128-bit word
29
+ //# sourceMappingURL=ColorType.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["ColorType","exports"],"sources":["ColorType.ts"],"sourcesContent":["export enum ColorType {\n Unknown, // uninitialized\n Alpha_8, // pixel with alpha in 8-bit byte\n RGB_565, // pixel with 5 bits red, 6 bits green, 5 bits blue, in 16-bit word\n ARGB_4444, // pixel with 4 bits for alpha, red, green, blue; in 16-bit word\n RGBA_8888, // pixel with 8 bits for red, green, blue, alpha; in 32-bit word\n RGB_888x, // pixel with 8 bits each for red, green, blue; in 32-bit word\n BGRA_8888, // pixel with 8 bits for blue, green, red, alpha; in 32-bit word\n RGBA_1010102, // 10 bits for red, green, blue; 2 bits for alpha; in 32-bit word\n BGRA_1010102, // 10 bits for blue, green, red; 2 bits for alpha; in 32-bit word\n RGB_101010x, // pixel with 10 bits each for red, green, blue; in 32-bit word\n BGR_101010x, // pixel with 10 bits each for blue, green, red; in 32-bit word\n BGR_101010x_XR, // pixel with 10 bits each for blue, green, red; in 32-bit word, extended range\n BGRA_10101010_XR, // pixel with 10 bits each for blue, green, red, alpha; in 64-bit word, extended range\n RGBA_10x6, // pixel with 10 used bits (most significant) followed by 6 unused\n Gray_8, // pixel with grayscale level in 8-bit byte\n RGBA_F16Norm, // pixel with half floats in [0,1] for red, green, blue, alpha; in 64-bit word\n RGBA_F16, // pixel with half floats for red, green, blue, alpha; in 64-bit word\n RGB_F16F16F16x, // pixel with half floats for red, green, blue; in 64-bit word\n RGBA_F32, // pixel using C float for red, green, blue, alpha; in 128-bit word\n}\n"],"mappings":";;;;;;IAAYA,SAAS,GAAAC,OAAA,CAAAD,SAAA,0BAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAAA,OAATA,SAAS;AAAA,OAmBT","ignoreList":[]}
@@ -0,0 +1,19 @@
1
+ export declare enum ColorTypeCanvasKit {
2
+ Unknown = 0,// uninitialized
3
+ Alpha_8 = 1,// pixel with alpha in 8-bit byte
4
+ RGB_565 = 2,// pixel with 5 bits red, 6 bits green, 5 bits blue, in 16-bit word
5
+ ARGB_4444 = 3,// pixel with 4 bits for alpha, red, green, blue; in 16-bit word
6
+ RGBA_8888 = 4,// pixel with 8 bits for red, green, blue, alpha; in 32-bit word
7
+ RGB_888x = 5,// pixel with 8 bits each for red, green, blue; in 32-bit word
8
+ BGRA_8888 = 6,// pixel with 8 bits for blue, green, red, alpha; in 32-bit word
9
+ RGBA_1010102 = 7,// 10 bits for red, green, blue; 2 bits for alpha; in 32-bit word
10
+ BGRA_1010102 = 8,// 10 bits for blue, green, red; 2 bits for alpha; in 32-bit word
11
+ RGB_101010x = 9,// pixel with 10 bits each for red, green, blue; in 32-bit word
12
+ BGR_101010x = 10,// pixel with 10 bits each for blue, green, red; in 32-bit word
13
+ BGR_101010x_XR = 11,// pixel with 10 bits each for blue, green, red; in 32-bit word, extended range
14
+ RGBA_10x6 = 12,// pixel with 10 used bits (most significant) followed by 6 unused
15
+ Gray_8 = 13,// pixel with grayscale level in 8-bit byte
16
+ RGBA_F16Norm = 14,// pixel with half floats in [0,1] for red, green, blue, alpha; in 64-bit word
17
+ RGBA_F16 = 15,// pixel with half floats for red, green, blue, alpha; in 64-bit word
18
+ RGBA_F32 = 16
19
+ }
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.ColorTypeCanvasKit = void 0;
7
+ let ColorTypeCanvasKit = exports.ColorTypeCanvasKit = /*#__PURE__*/function (ColorTypeCanvasKit) {
8
+ ColorTypeCanvasKit[ColorTypeCanvasKit["Unknown"] = 0] = "Unknown";
9
+ ColorTypeCanvasKit[ColorTypeCanvasKit["Alpha_8"] = 1] = "Alpha_8";
10
+ ColorTypeCanvasKit[ColorTypeCanvasKit["RGB_565"] = 2] = "RGB_565";
11
+ ColorTypeCanvasKit[ColorTypeCanvasKit["ARGB_4444"] = 3] = "ARGB_4444";
12
+ ColorTypeCanvasKit[ColorTypeCanvasKit["RGBA_8888"] = 4] = "RGBA_8888";
13
+ ColorTypeCanvasKit[ColorTypeCanvasKit["RGB_888x"] = 5] = "RGB_888x";
14
+ ColorTypeCanvasKit[ColorTypeCanvasKit["BGRA_8888"] = 6] = "BGRA_8888";
15
+ ColorTypeCanvasKit[ColorTypeCanvasKit["RGBA_1010102"] = 7] = "RGBA_1010102";
16
+ ColorTypeCanvasKit[ColorTypeCanvasKit["BGRA_1010102"] = 8] = "BGRA_1010102";
17
+ ColorTypeCanvasKit[ColorTypeCanvasKit["RGB_101010x"] = 9] = "RGB_101010x";
18
+ ColorTypeCanvasKit[ColorTypeCanvasKit["BGR_101010x"] = 10] = "BGR_101010x";
19
+ ColorTypeCanvasKit[ColorTypeCanvasKit["BGR_101010x_XR"] = 11] = "BGR_101010x_XR";
20
+ ColorTypeCanvasKit[ColorTypeCanvasKit["RGBA_10x6"] = 12] = "RGBA_10x6";
21
+ ColorTypeCanvasKit[ColorTypeCanvasKit["Gray_8"] = 13] = "Gray_8";
22
+ ColorTypeCanvasKit[ColorTypeCanvasKit["RGBA_F16Norm"] = 14] = "RGBA_F16Norm";
23
+ ColorTypeCanvasKit[ColorTypeCanvasKit["RGBA_F16"] = 15] = "RGBA_F16";
24
+ ColorTypeCanvasKit[ColorTypeCanvasKit["RGBA_F32"] = 16] = "RGBA_F32";
25
+ return ColorTypeCanvasKit;
26
+ }({}); // pixel using C float for red, green, blue, alpha; in 128-bit word
27
+ //# sourceMappingURL=ColorType.web.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["ColorTypeCanvasKit","exports"],"sources":["ColorType.web.ts"],"sourcesContent":["export enum ColorTypeCanvasKit {\n Unknown, // uninitialized\n Alpha_8, // pixel with alpha in 8-bit byte\n RGB_565, // pixel with 5 bits red, 6 bits green, 5 bits blue, in 16-bit word\n ARGB_4444, // pixel with 4 bits for alpha, red, green, blue; in 16-bit word\n RGBA_8888, // pixel with 8 bits for red, green, blue, alpha; in 32-bit word\n RGB_888x, // pixel with 8 bits each for red, green, blue; in 32-bit word\n BGRA_8888, // pixel with 8 bits for blue, green, red, alpha; in 32-bit word\n RGBA_1010102, // 10 bits for red, green, blue; 2 bits for alpha; in 32-bit word\n BGRA_1010102, // 10 bits for blue, green, red; 2 bits for alpha; in 32-bit word\n RGB_101010x, // pixel with 10 bits each for red, green, blue; in 32-bit word\n BGR_101010x, // pixel with 10 bits each for blue, green, red; in 32-bit word\n BGR_101010x_XR, // pixel with 10 bits each for blue, green, red; in 32-bit word, extended range\n RGBA_10x6, // pixel with 10 used bits (most significant) followed by 6 unused\n Gray_8, // pixel with grayscale level in 8-bit byte\n RGBA_F16Norm, // pixel with half floats in [0,1] for red, green, blue, alpha; in 64-bit word\n RGBA_F16, // pixel with half floats for red, green, blue, alpha; in 64-bit word\n RGBA_F32, // pixel using C float for red, green, blue, alpha; in 128-bit word\n}\n"],"mappings":";;;;;;IAAYA,kBAAkB,GAAAC,OAAA,CAAAD,kBAAA,0BAAlBA,kBAAkB;EAAlBA,kBAAkB,CAAlBA,kBAAkB;EAAlBA,kBAAkB,CAAlBA,kBAAkB;EAAlBA,kBAAkB,CAAlBA,kBAAkB;EAAlBA,kBAAkB,CAAlBA,kBAAkB;EAAlBA,kBAAkB,CAAlBA,kBAAkB;EAAlBA,kBAAkB,CAAlBA,kBAAkB;EAAlBA,kBAAkB,CAAlBA,kBAAkB;EAAlBA,kBAAkB,CAAlBA,kBAAkB;EAAlBA,kBAAkB,CAAlBA,kBAAkB;EAAlBA,kBAAkB,CAAlBA,kBAAkB;EAAlBA,kBAAkB,CAAlBA,kBAAkB;EAAlBA,kBAAkB,CAAlBA,kBAAkB;EAAlBA,kBAAkB,CAAlBA,kBAAkB;EAAlBA,kBAAkB,CAAlBA,kBAAkB;EAAlBA,kBAAkB,CAAlBA,kBAAkB;EAAlBA,kBAAkB,CAAlBA,kBAAkB;EAAlBA,kBAAkB,CAAlBA,kBAAkB;EAAA,OAAlBA,kBAAkB;AAAA,OAiBlB","ignoreList":[]}
@@ -38,6 +38,16 @@ export interface SkImage extends SkJSIInstance<"Image"> {
38
38
  * Returns the ImageInfo describing the image.
39
39
  */
40
40
  getImageInfo(): ImageInfo;
41
+ /**
42
+ * Returns the backend texture of the image.
43
+ * The returned object can be used to create a Skia Image object.
44
+ * The returned object is backend specific and should be used with caution.
45
+ * It is the caller's responsibility to ensure that the texture is not used after the image is deleted.
46
+ * The returned object may be null if the image does not have a backend texture.
47
+ *
48
+ * @return backend texture of the image or null
49
+ */
50
+ getNativeTextureUnstable(): unknown;
41
51
  /**
42
52
  * Returns this image as a shader with the specified tiling. It will use cubic sampling.
43
53
  * @param tx - tile mode in the x direction.
@@ -1 +1 @@
1
- {"version":3,"names":["FilterMode","exports","MipmapMode","ImageFormat"],"sources":["Image.ts"],"sourcesContent":["import type { SkMatrix } from \"../Matrix\";\nimport type { SkJSIInstance } from \"../JsiInstance\";\nimport type { TileMode } from \"../ImageFilter\";\nimport type { SkShader } from \"../Shader\";\n\nimport type { ImageInfo } from \"./ImageFactory\";\n\nexport interface CubicResampler {\n B: number;\n C: number;\n}\n\nexport interface FilterOptions {\n filter: FilterMode;\n mipmap?: MipmapMode;\n}\n\nexport enum FilterMode {\n Nearest,\n Linear,\n}\n\nexport enum MipmapMode {\n None,\n Nearest,\n Linear,\n}\n\nexport enum ImageFormat {\n JPEG = 3,\n PNG = 4,\n WEBP = 6,\n}\n\nexport interface SkImage extends SkJSIInstance<\"Image\"> {\n /**\n * Returns the possibly scaled height of the image.\n */\n height(): number;\n\n /**\n * Returns the possibly scaled width of the image.\n */\n width(): number;\n\n /**\n * Returns the ImageInfo describing the image.\n */\n getImageInfo(): ImageInfo;\n\n /**\n * Returns this image as a shader with the specified tiling. It will use cubic sampling.\n * @param tx - tile mode in the x direction.\n * @param ty - tile mode in the y direction.\n * @param fm - The filter mode. (default nearest)\n * @param mm - The mipmap mode. Note: for settings other than None, the image must have mipmaps (default none)\n * calculated with makeCopyWithDefaultMipmaps;\n * @param localMatrix\n */\n makeShaderOptions(\n tx: TileMode,\n ty: TileMode,\n fm: FilterMode,\n mm: MipmapMode,\n localMatrix?: SkMatrix\n ): SkShader;\n\n /**\n * Returns this image as a shader with the specified tiling. It will use cubic sampling.\n * @param tx - tile mode in the x direction.\n * @param ty - tile mode in the y direction.\n * @param B - See CubicResampler in SkSamplingOptions.h for more information\n * @param C - See CubicResampler in SkSamplingOptions.h for more information\n * @param localMatrix\n */\n makeShaderCubic(\n tx: TileMode,\n ty: TileMode,\n B: number,\n C: number,\n localMatrix?: SkMatrix\n ): SkShader;\n\n /** Encodes Image pixels, returning result as UInt8Array. Returns existing\n encoded data if present; otherwise, SkImage is encoded with\n SkEncodedImageFormat::kPNG. Skia must be built with SK_ENCODE_PNG to encode\n SkImage.\n\n Returns nullptr if existing encoded data is missing or invalid, and\n encoding fails.\n\n @param fmt - PNG is the default value.\n @param quality - a value from 0 to 100; 100 is the least lossy. May be ignored.\n\n @return Uint8Array with data\n */\n encodeToBytes(fmt?: ImageFormat, quality?: number): Uint8Array;\n\n /** Encodes Image pixels, returning result as a base64 encoded string. Returns existing\n encoded data if present; otherwise, SkImage is encoded with\n SkEncodedImageFormat::kPNG. Skia must be built with SK_ENCODE_PNG to encode\n SkImage.\n\n Returns nullptr if existing encoded data is missing or invalid, and\n encoding fails.\n\n @param fmt - PNG is the default value.\n @param quality - a value from 0 to 100; 100 is the least lossy. May be ignored.\n\n @return base64 encoded string of data\n */\n encodeToBase64(fmt?: ImageFormat, quality?: number): string;\n\n /** Read Image pixels\n *\n * @param srcX - optional x-axis upper left corner of the rectangle to read from\n * @param srcY - optional y-axis upper left corner of the rectangle to read from\n * @param imageInfo - optional describes the pixel format and dimensions of the data to read into\n * @return Float32Array or Uint8Array with data or null if the read failed.\n */\n readPixels(\n srcX?: number,\n srcY?: number,\n imageInfo?: ImageInfo\n ): Float32Array | Uint8Array | null;\n\n /**\n * Returns raster image or lazy image. Copies SkImage backed by GPU texture\n * into CPU memory if needed. Returns original SkImage if decoded in raster\n * bitmap, or if encoded in a stream.\n */\n makeNonTextureImage(): SkImage;\n}\n"],"mappings":";;;;;;IAiBYA,UAAU,GAAAC,OAAA,CAAAD,UAAA,0BAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAA,OAAVA,UAAU;AAAA;AAAA,IAKVE,UAAU,GAAAD,OAAA,CAAAC,UAAA,0BAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAA,OAAVA,UAAU;AAAA;AAAA,IAMVC,WAAW,GAAAF,OAAA,CAAAE,WAAA,0BAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAA,OAAXA,WAAW;AAAA","ignoreList":[]}
1
+ {"version":3,"names":["FilterMode","exports","MipmapMode","ImageFormat"],"sources":["Image.ts"],"sourcesContent":["import type { SkMatrix } from \"../Matrix\";\nimport type { SkJSIInstance } from \"../JsiInstance\";\nimport type { TileMode } from \"../ImageFilter\";\nimport type { SkShader } from \"../Shader\";\n\nimport type { ImageInfo } from \"./ImageFactory\";\n\nexport interface CubicResampler {\n B: number;\n C: number;\n}\n\nexport interface FilterOptions {\n filter: FilterMode;\n mipmap?: MipmapMode;\n}\n\nexport enum FilterMode {\n Nearest,\n Linear,\n}\n\nexport enum MipmapMode {\n None,\n Nearest,\n Linear,\n}\n\nexport enum ImageFormat {\n JPEG = 3,\n PNG = 4,\n WEBP = 6,\n}\n\nexport interface SkImage extends SkJSIInstance<\"Image\"> {\n /**\n * Returns the possibly scaled height of the image.\n */\n height(): number;\n\n /**\n * Returns the possibly scaled width of the image.\n */\n width(): number;\n\n /**\n * Returns the ImageInfo describing the image.\n */\n getImageInfo(): ImageInfo;\n\n /**\n * Returns the backend texture of the image.\n * The returned object can be used to create a Skia Image object.\n * The returned object is backend specific and should be used with caution.\n * It is the caller's responsibility to ensure that the texture is not used after the image is deleted.\n * The returned object may be null if the image does not have a backend texture.\n *\n * @return backend texture of the image or null\n */\n getNativeTextureUnstable(): unknown;\n\n /**\n * Returns this image as a shader with the specified tiling. It will use cubic sampling.\n * @param tx - tile mode in the x direction.\n * @param ty - tile mode in the y direction.\n * @param fm - The filter mode. (default nearest)\n * @param mm - The mipmap mode. Note: for settings other than None, the image must have mipmaps (default none)\n * calculated with makeCopyWithDefaultMipmaps;\n * @param localMatrix\n */\n makeShaderOptions(\n tx: TileMode,\n ty: TileMode,\n fm: FilterMode,\n mm: MipmapMode,\n localMatrix?: SkMatrix\n ): SkShader;\n\n /**\n * Returns this image as a shader with the specified tiling. It will use cubic sampling.\n * @param tx - tile mode in the x direction.\n * @param ty - tile mode in the y direction.\n * @param B - See CubicResampler in SkSamplingOptions.h for more information\n * @param C - See CubicResampler in SkSamplingOptions.h for more information\n * @param localMatrix\n */\n makeShaderCubic(\n tx: TileMode,\n ty: TileMode,\n B: number,\n C: number,\n localMatrix?: SkMatrix\n ): SkShader;\n\n /** Encodes Image pixels, returning result as UInt8Array. Returns existing\n encoded data if present; otherwise, SkImage is encoded with\n SkEncodedImageFormat::kPNG. Skia must be built with SK_ENCODE_PNG to encode\n SkImage.\n\n Returns nullptr if existing encoded data is missing or invalid, and\n encoding fails.\n\n @param fmt - PNG is the default value.\n @param quality - a value from 0 to 100; 100 is the least lossy. May be ignored.\n\n @return Uint8Array with data\n */\n encodeToBytes(fmt?: ImageFormat, quality?: number): Uint8Array;\n\n /** Encodes Image pixels, returning result as a base64 encoded string. Returns existing\n encoded data if present; otherwise, SkImage is encoded with\n SkEncodedImageFormat::kPNG. Skia must be built with SK_ENCODE_PNG to encode\n SkImage.\n\n Returns nullptr if existing encoded data is missing or invalid, and\n encoding fails.\n\n @param fmt - PNG is the default value.\n @param quality - a value from 0 to 100; 100 is the least lossy. May be ignored.\n\n @return base64 encoded string of data\n */\n encodeToBase64(fmt?: ImageFormat, quality?: number): string;\n\n /** Read Image pixels\n *\n * @param srcX - optional x-axis upper left corner of the rectangle to read from\n * @param srcY - optional y-axis upper left corner of the rectangle to read from\n * @param imageInfo - optional describes the pixel format and dimensions of the data to read into\n * @return Float32Array or Uint8Array with data or null if the read failed.\n */\n readPixels(\n srcX?: number,\n srcY?: number,\n imageInfo?: ImageInfo\n ): Float32Array | Uint8Array | null;\n\n /**\n * Returns raster image or lazy image. Copies SkImage backed by GPU texture\n * into CPU memory if needed. Returns original SkImage if decoded in raster\n * bitmap, or if encoded in a stream.\n */\n makeNonTextureImage(): SkImage;\n}\n"],"mappings":";;;;;;IAiBYA,UAAU,GAAAC,OAAA,CAAAD,UAAA,0BAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAA,OAAVA,UAAU;AAAA;AAAA,IAKVE,UAAU,GAAAD,OAAA,CAAAC,UAAA,0BAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAA,OAAVA,UAAU;AAAA;AAAA,IAMVC,WAAW,GAAAF,OAAA,CAAAE,WAAA,0BAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAA,OAAXA,WAAW;AAAA","ignoreList":[]}
@@ -1,5 +1,6 @@
1
1
  import type { SkData } from "../Data";
2
2
  import type { NativeBuffer } from "../NativeBuffer";
3
+ import type { ColorType } from "./ColorType";
3
4
  import type { SkImage } from "./Image";
4
5
  export declare enum AlphaType {
5
6
  Unknown = 0,
@@ -7,25 +8,6 @@ export declare enum AlphaType {
7
8
  Premul = 2,
8
9
  Unpremul = 3
9
10
  }
10
- export declare enum ColorType {
11
- Unknown = 0,// uninitialized
12
- Alpha_8 = 1,// pixel with alpha in 8-bit byte
13
- RGB_565 = 2,// pixel with 5 bits red, 6 bits green, 5 bits blue, in 16-bit word
14
- ARGB_4444 = 3,// pixel with 4 bits for alpha, red, green, blue; in 16-bit word
15
- RGBA_8888 = 4,// pixel with 8 bits for red, green, blue, alpha; in 32-bit word
16
- RGB_888x = 5,// pixel with 8 bits each for red, green, blue; in 32-bit word
17
- BGRA_8888 = 6,// pixel with 8 bits for blue, green, red, alpha; in 32-bit word
18
- RGBA_1010102 = 7,// 10 bits for red, green, blue; 2 bits for alpha; in 32-bit word
19
- BGRA_1010102 = 8,// 10 bits for blue, green, red; 2 bits for alpha; in 32-bit word
20
- RGB_101010x = 9,// pixel with 10 bits each for red, green, blue; in 32-bit word
21
- BGR_101010x = 10,// pixel with 10 bits each for blue, green, red; in 32-bit word
22
- BGR_101010x_XR = 11,// pixel with 10 bits each for blue, green, red; in 32-bit word, extended range
23
- RGBA_10x6 = 12,// pixel with 10 used bits (most significant) followed by 6 unused
24
- Gray_8 = 13,// pixel with grayscale level in 8-bit byte
25
- RGBA_F16Norm = 14,// pixel with half floats in [0,1] for red, green, blue, alpha; in 64-bit word
26
- RGBA_F16 = 15,// pixel with half floats for red, green, blue, alpha; in 64-bit word
27
- RGBA_F32 = 16
28
- }
29
11
  export interface ImageInfo {
30
12
  alphaType: AlphaType;
31
13
  colorType: ColorType;
@@ -59,6 +41,24 @@ export interface ImageFactory {
59
41
  * native buffer is invalid.
60
42
  */
61
43
  MakeImageFromNativeBuffer: (nativeBuffer: NativeBuffer) => SkImage;
44
+ /**
45
+ *
46
+ * Return an Image backed by a given native texture.
47
+ *
48
+ * The native texture must be a valid owning reference.
49
+ *
50
+ * This API might be used to integrate with other libraries using gpu textures,
51
+ * or to transfer images between different threads.
52
+ *
53
+ * @param texture A native texture handle
54
+ * @param width The width of the texture
55
+ * @param height The height of the texture
56
+ * @param mipmapped Whether the texture is mipmapped
57
+ * @throws Throws an error if the Image could not be created, for example when the given native texture is invalid.
58
+ *
59
+ * @returns Returns a valid SkImage, if the texture is invalid, an error is thrown.
60
+ */
61
+ MakeImageFromNativeTextureUnstable: (texture: unknown, width: number, height: number, mipmapped?: boolean) => SkImage;
62
62
  /**
63
63
  * Returns an image that will be a screenshot of the view represented by
64
64
  * the view tag
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.ColorType = exports.AlphaType = void 0;
6
+ exports.AlphaType = void 0;
7
7
  let AlphaType = exports.AlphaType = /*#__PURE__*/function (AlphaType) {
8
8
  AlphaType[AlphaType["Unknown"] = 0] = "Unknown";
9
9
  AlphaType[AlphaType["Opaque"] = 1] = "Opaque";
@@ -11,24 +11,4 @@ let AlphaType = exports.AlphaType = /*#__PURE__*/function (AlphaType) {
11
11
  AlphaType[AlphaType["Unpremul"] = 3] = "Unpremul";
12
12
  return AlphaType;
13
13
  }({});
14
- let ColorType = exports.ColorType = /*#__PURE__*/function (ColorType) {
15
- ColorType[ColorType["Unknown"] = 0] = "Unknown";
16
- ColorType[ColorType["Alpha_8"] = 1] = "Alpha_8";
17
- ColorType[ColorType["RGB_565"] = 2] = "RGB_565";
18
- ColorType[ColorType["ARGB_4444"] = 3] = "ARGB_4444";
19
- ColorType[ColorType["RGBA_8888"] = 4] = "RGBA_8888";
20
- ColorType[ColorType["RGB_888x"] = 5] = "RGB_888x";
21
- ColorType[ColorType["BGRA_8888"] = 6] = "BGRA_8888";
22
- ColorType[ColorType["RGBA_1010102"] = 7] = "RGBA_1010102";
23
- ColorType[ColorType["BGRA_1010102"] = 8] = "BGRA_1010102";
24
- ColorType[ColorType["RGB_101010x"] = 9] = "RGB_101010x";
25
- ColorType[ColorType["BGR_101010x"] = 10] = "BGR_101010x";
26
- ColorType[ColorType["BGR_101010x_XR"] = 11] = "BGR_101010x_XR";
27
- ColorType[ColorType["RGBA_10x6"] = 12] = "RGBA_10x6";
28
- ColorType[ColorType["Gray_8"] = 13] = "Gray_8";
29
- ColorType[ColorType["RGBA_F16Norm"] = 14] = "RGBA_F16Norm";
30
- ColorType[ColorType["RGBA_F16"] = 15] = "RGBA_F16";
31
- ColorType[ColorType["RGBA_F32"] = 16] = "RGBA_F32";
32
- return ColorType;
33
- }({}); // pixel using C float for red, green, blue, alpha; in 128-bit word
34
14
  //# sourceMappingURL=ImageFactory.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["AlphaType","exports","ColorType"],"sources":["ImageFactory.ts"],"sourcesContent":["import type { SkData } from \"../Data\";\nimport type { NativeBuffer } from \"../NativeBuffer\";\n\nimport type { SkImage } from \"./Image\";\n\nexport enum AlphaType {\n Unknown,\n Opaque,\n Premul,\n Unpremul,\n}\n\nexport enum ColorType {\n Unknown, // uninitialized\n Alpha_8, // pixel with alpha in 8-bit byte\n RGB_565, // pixel with 5 bits red, 6 bits green, 5 bits blue, in 16-bit word\n ARGB_4444, // pixel with 4 bits for alpha, red, green, blue; in 16-bit word\n RGBA_8888, // pixel with 8 bits for red, green, blue, alpha; in 32-bit word\n RGB_888x, // pixel with 8 bits each for red, green, blue; in 32-bit word\n BGRA_8888, // pixel with 8 bits for blue, green, red, alpha; in 32-bit word\n RGBA_1010102, // 10 bits for red, green, blue; 2 bits for alpha; in 32-bit word\n BGRA_1010102, // 10 bits for blue, green, red; 2 bits for alpha; in 32-bit word\n RGB_101010x, // pixel with 10 bits each for red, green, blue; in 32-bit word\n BGR_101010x, // pixel with 10 bits each for blue, green, red; in 32-bit word\n BGR_101010x_XR, // pixel with 10 bits each for blue, green, red; in 32-bit word, extended range\n RGBA_10x6, // pixel with 10 used bits (most significant) followed by 6 unused\n Gray_8, // pixel with grayscale level in 8-bit byte\n RGBA_F16Norm, // pixel with half floats in [0,1] for red, green, blue, alpha; in 64-bit word\n RGBA_F16, // pixel with half floats for red, green, blue, alpha; in 64-bit word\n RGBA_F32, // pixel using C float for red, green, blue, alpha; in 128-bit word\n}\n\nexport interface ImageInfo {\n alphaType: AlphaType;\n // TODO: add support for color space\n // colorSpace: ColorSpace;\n colorType: ColorType;\n height: number;\n width: number;\n}\n\nexport interface ImageFactory {\n /**\n * Return an Image backed by the encoded data, but attempt to defer decoding until the image\n * is actually used/drawn. This deferral allows the system to cache the result, either on the\n * CPU or on the GPU, depending on where the image is drawn.\n * This decoding uses the codecs that have been compiled into CanvasKit. If the bytes are\n * invalid (or an unrecognized codec), null will be returned. See Image.h for more details.\n * @param data - Data object with bytes of data\n * @returns If the encoded format is not supported, or subset is outside of the bounds of the decoded\n * image, nullptr is returned.\n */\n MakeImageFromEncoded: (encoded: SkData) => SkImage | null;\n\n /**\n * Return an Image backed by a given native buffer.\n * The native buffer must be a valid owning reference.\n *\n * For instance, this API is used by\n * [react-native-vision-camera](https://github.com/mrousavy/react-native-vision-camera)\n * to render a Skia Camera preview.\n *\n * - On Android; This is an `AHardwareBuffer*`\n * - On iOS, this is a `CVPixelBufferRef`\n * @param nativeBuffer A strong `uintptr_t` pointer to the native buffer\n * @throws Throws an error if the Image could not be created, for example when the given\n * native buffer is invalid.\n */\n MakeImageFromNativeBuffer: (nativeBuffer: NativeBuffer) => SkImage;\n\n /**\n * Returns an image that will be a screenshot of the view represented by\n * the view tag\n * @param viewTag - The tag of the view to make an image from.\n * @returns Returns a valid SkImage, if the view tag is invalid, nullptr is returned.\n */\n MakeImageFromViewTag: (viewTag: number) => Promise<SkImage | null>;\n\n /**\n * Returns an image with the given pixel data and format.\n * Note that we will always make a copy of the pixel data, because of inconsistencies in\n * behavior between GPU and CPU (i.e. the pixel data will be turned into a GPU texture and\n * not modifiable after creation).\n *\n * @param info\n * @param data - bytes representing the pixel data.\n * @param bytesPerRow\n */\n MakeImage(info: ImageInfo, data: SkData, bytesPerRow: number): SkImage | null;\n}\n"],"mappings":";;;;;;IAKYA,SAAS,GAAAC,OAAA,CAAAD,SAAA,0BAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAAA,OAATA,SAAS;AAAA;AAAA,IAOTE,SAAS,GAAAD,OAAA,CAAAC,SAAA,0BAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAAA,OAATA,SAAS;AAAA,OAiBT","ignoreList":[]}
1
+ {"version":3,"names":["AlphaType","exports"],"sources":["ImageFactory.ts"],"sourcesContent":["import type { SkData } from \"../Data\";\nimport type { NativeBuffer } from \"../NativeBuffer\";\n\nimport type { ColorType } from \"./ColorType\";\nimport type { SkImage } from \"./Image\";\n\nexport enum AlphaType {\n Unknown,\n Opaque,\n Premul,\n Unpremul,\n}\n\nexport interface ImageInfo {\n alphaType: AlphaType;\n // TODO: add support for color space\n // colorSpace: ColorSpace;\n colorType: ColorType;\n height: number;\n width: number;\n}\n\nexport interface ImageFactory {\n /**\n * Return an Image backed by the encoded data, but attempt to defer decoding until the image\n * is actually used/drawn. This deferral allows the system to cache the result, either on the\n * CPU or on the GPU, depending on where the image is drawn.\n * This decoding uses the codecs that have been compiled into CanvasKit. If the bytes are\n * invalid (or an unrecognized codec), null will be returned. See Image.h for more details.\n * @param data - Data object with bytes of data\n * @returns If the encoded format is not supported, or subset is outside of the bounds of the decoded\n * image, nullptr is returned.\n */\n MakeImageFromEncoded: (encoded: SkData) => SkImage | null;\n\n /**\n * Return an Image backed by a given native buffer.\n * The native buffer must be a valid owning reference.\n *\n * For instance, this API is used by\n * [react-native-vision-camera](https://github.com/mrousavy/react-native-vision-camera)\n * to render a Skia Camera preview.\n *\n * - On Android; This is an `AHardwareBuffer*`\n * - On iOS, this is a `CVPixelBufferRef`\n * @param nativeBuffer A strong `uintptr_t` pointer to the native buffer\n * @throws Throws an error if the Image could not be created, for example when the given\n * native buffer is invalid.\n */\n MakeImageFromNativeBuffer: (nativeBuffer: NativeBuffer) => SkImage;\n\n /**\n *\n * Return an Image backed by a given native texture.\n *\n * The native texture must be a valid owning reference.\n *\n * This API might be used to integrate with other libraries using gpu textures,\n * or to transfer images between different threads.\n *\n * @param texture A native texture handle\n * @param width The width of the texture\n * @param height The height of the texture\n * @param mipmapped Whether the texture is mipmapped\n * @throws Throws an error if the Image could not be created, for example when the given native texture is invalid.\n *\n * @returns Returns a valid SkImage, if the texture is invalid, an error is thrown.\n */\n MakeImageFromNativeTextureUnstable: (\n texture: unknown,\n width: number,\n height: number,\n mipmapped?: boolean\n ) => SkImage;\n\n /**\n * Returns an image that will be a screenshot of the view represented by\n * the view tag\n * @param viewTag - The tag of the view to make an image from.\n * @returns Returns a valid SkImage, if the view tag is invalid, nullptr is returned.\n */\n MakeImageFromViewTag: (viewTag: number) => Promise<SkImage | null>;\n\n /**\n * Returns an image with the given pixel data and format.\n * Note that we will always make a copy of the pixel data, because of inconsistencies in\n * behavior between GPU and CPU (i.e. the pixel data will be turned into a GPU texture and\n * not modifiable after creation).\n *\n * @param info\n * @param data - bytes representing the pixel data.\n * @param bytesPerRow\n */\n MakeImage(info: ImageInfo, data: SkData, bytesPerRow: number): SkImage | null;\n}\n"],"mappings":";;;;;;IAMYA,SAAS,GAAAC,OAAA,CAAAD,SAAA,0BAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAAA,OAATA,SAAS;AAAA","ignoreList":[]}
@@ -1,2 +1,3 @@
1
1
  export * from "./Image";
2
2
  export * from "./ImageFactory";
3
+ export * from "./ColorType";
@@ -25,4 +25,15 @@ Object.keys(_ImageFactory).forEach(function (key) {
25
25
  }
26
26
  });
27
27
  });
28
+ var _ColorType = require("./ColorType");
29
+ Object.keys(_ColorType).forEach(function (key) {
30
+ if (key === "default" || key === "__esModule") return;
31
+ if (key in exports && exports[key] === _ColorType[key]) return;
32
+ Object.defineProperty(exports, key, {
33
+ enumerable: true,
34
+ get: function () {
35
+ return _ColorType[key];
36
+ }
37
+ });
38
+ });
28
39
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_Image","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_ImageFactory"],"sources":["index.ts"],"sourcesContent":["export * from \"./Image\";\nexport * from \"./ImageFactory\";\n"],"mappings":";;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,MAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,MAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,MAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,aAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,aAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,aAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,aAAA,CAAAL,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
1
+ {"version":3,"names":["_Image","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_ImageFactory","_ColorType"],"sources":["index.ts"],"sourcesContent":["export * from \"./Image\";\nexport * from \"./ImageFactory\";\nexport * from \"./ColorType\";\n"],"mappings":";;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,MAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,MAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,MAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,aAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,aAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,aAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,aAAA,CAAAL,GAAA;IAAA;EAAA;AAAA;AACA,IAAAM,UAAA,GAAAV,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAQ,UAAA,EAAAP,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAM,UAAA,CAAAN,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAE,UAAA,CAAAN,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
@@ -100,4 +100,10 @@ export declare const convertToColumnMajor: (rowMajorMatrix: Matrix4) => Matrix4;
100
100
  * @worklet
101
101
  */
102
102
  export declare const convertToAffineMatrix: (m4: Matrix4) => number[];
103
+ /**
104
+ * Inverts a 4x4 matrix
105
+ * @worklet
106
+ * @returns The inverted matrix, or the identity matrix if the input is not invertible
107
+ */
108
+ export declare const invert4: (m: Matrix4) => Matrix4;
103
109
  export {};