@shopify/react-native-skia 2.1.1 → 2.2.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.
- package/android/CMakeLists.txt +1 -1
- package/android/cpp/rnskia-android/OpenGLWindowContext.h +1 -1
- package/android/cpp/rnskia-android/RNSkAndroidPlatformContext.h +1 -1
- package/android/cpp/rnskia-android/RNSkAndroidVideo.cpp +1 -1
- package/android/cpp/rnskia-android/RNSkOpenGLCanvasProvider.cpp +1 -1
- package/android/cpp/rnskia-android/RNSkOpenGLCanvasProvider.h +1 -1
- package/android/src/main/java/com/shopify/reactnative/skia/SkiaPictureViewManager.java +6 -0
- package/apple/MetalContext.h +2 -2
- package/apple/MetalWindowContext.h +2 -2
- package/apple/MetalWindowContext.mm +7 -4
- package/apple/RNSkApplePlatformContext.mm +1 -1
- package/apple/RNSkAppleView.h +7 -1
- package/apple/RNSkMetalCanvasProvider.h +4 -1
- package/apple/RNSkMetalCanvasProvider.mm +9 -4
- package/apple/SkiaPictureView.mm +4 -0
- package/apple/SkiaUIView.h +1 -0
- package/apple/SkiaUIView.mm +9 -0
- package/cpp/api/JsiSkImage.h +1 -1
- package/cpp/api/JsiSkSurface.h +1 -1
- package/cpp/api/JsiSkiaContext.h +1 -1
- package/cpp/api/recorder/ImageFilters.h +3 -3
- package/cpp/api/recorder/Paint.h +4 -0
- package/cpp/rnskia/{DawnContext.h → RNDawnContext.h} +3 -3
- package/cpp/rnskia/{DawnWindowContext.cpp → RNDawnWindowContext.cpp} +3 -3
- package/cpp/rnskia/{DawnWindowContext.h → RNDawnWindowContext.h} +2 -2
- package/cpp/rnskia/RNSkPlatformContext.h +1 -1
- package/lib/commonjs/dom/types/Drawings.d.ts +1 -1
- package/lib/commonjs/dom/types/Drawings.js.map +1 -1
- package/lib/commonjs/renderer/Canvas.d.ts +2 -1
- package/lib/commonjs/renderer/Canvas.js +2 -0
- package/lib/commonjs/renderer/Canvas.js.map +1 -1
- package/lib/commonjs/renderer/components/ImageFilter.js.map +1 -1
- package/lib/commonjs/skia/types/Matrix4.d.ts +4 -0
- package/lib/commonjs/skia/types/Matrix4.js +18 -1
- package/lib/commonjs/skia/types/Matrix4.js.map +1 -1
- package/lib/commonjs/sksg/Recorder/Player.js +9 -3
- package/lib/commonjs/sksg/Recorder/Player.js.map +1 -1
- package/lib/commonjs/sksg/Recorder/commands/ImageFilters.js +2 -2
- package/lib/commonjs/sksg/Recorder/commands/ImageFilters.js.map +1 -1
- package/lib/commonjs/specs/SkiaPictureViewNativeComponent.d.ts +1 -0
- package/lib/commonjs/specs/SkiaPictureViewNativeComponent.js.map +1 -1
- package/lib/module/dom/types/Drawings.d.ts +1 -1
- package/lib/module/dom/types/Drawings.js.map +1 -1
- package/lib/module/renderer/Canvas.d.ts +2 -1
- package/lib/module/renderer/Canvas.js +2 -0
- package/lib/module/renderer/Canvas.js.map +1 -1
- package/lib/module/renderer/components/ImageFilter.js.map +1 -1
- package/lib/module/skia/types/Matrix4.d.ts +4 -0
- package/lib/module/skia/types/Matrix4.js +16 -0
- package/lib/module/skia/types/Matrix4.js.map +1 -1
- package/lib/module/sksg/Recorder/Player.js +9 -3
- package/lib/module/sksg/Recorder/Player.js.map +1 -1
- package/lib/module/sksg/Recorder/commands/ImageFilters.js +2 -2
- package/lib/module/sksg/Recorder/commands/ImageFilters.js.map +1 -1
- package/lib/module/specs/SkiaPictureViewNativeComponent.d.ts +1 -0
- package/lib/module/specs/SkiaPictureViewNativeComponent.js.map +1 -1
- package/lib/typescript/lib/commonjs/renderer/Canvas.d.ts +2 -1
- package/lib/typescript/lib/commonjs/skia/types/Matrix4.d.ts +1 -0
- package/lib/typescript/lib/module/mock/index.d.ts +1 -0
- package/lib/typescript/lib/module/renderer/Canvas.d.ts +2 -1
- package/lib/typescript/lib/module/skia/types/Matrix4.d.ts +1 -0
- package/lib/typescript/src/dom/types/Drawings.d.ts +1 -1
- package/lib/typescript/src/renderer/Canvas.d.ts +2 -1
- package/lib/typescript/src/skia/types/Matrix4.d.ts +4 -0
- package/lib/typescript/src/specs/SkiaPictureViewNativeComponent.d.ts +1 -0
- package/libs/android/arm64-v8a/libskia.a +0 -0
- package/libs/android/armeabi-v7a/libskia.a +0 -0
- package/libs/android/x86/libskia.a +0 -0
- package/libs/android/x86_64/libskia.a +0 -0
- package/libs/apple/libpathops.xcframework/Info.plist +15 -15
- package/libs/apple/libskia.xcframework/Info.plist +11 -11
- package/libs/apple/libskia.xcframework/ios-arm64_arm64e/libskia.a +0 -0
- package/libs/apple/libskia.xcframework/ios-arm64_arm64e_x86_64-simulator/libskia.a +0 -0
- package/libs/apple/libskia.xcframework/macos-arm64_x86_64/libskia.a +0 -0
- package/libs/apple/libskia.xcframework/tvos-arm64_arm64e/libskia.a +0 -0
- package/libs/apple/libskia.xcframework/tvos-arm64_arm64e_x86_64-simulator/libskia.a +0 -0
- package/libs/apple/libskottie.xcframework/Info.plist +16 -16
- package/libs/apple/libskparagraph.xcframework/Info.plist +8 -8
- package/libs/apple/libsksg.xcframework/Info.plist +6 -6
- package/libs/apple/libskshaper.xcframework/Info.plist +10 -10
- package/libs/apple/libskunicode_core.xcframework/Info.plist +10 -10
- package/libs/apple/libskunicode_libgrapheme.xcframework/Info.plist +14 -14
- package/libs/apple/libsvg.xcframework/Info.plist +15 -15
- package/package.json +1 -1
- package/react-native-skia.podspec +5 -5
- package/src/dom/types/Drawings.ts +1 -1
- package/src/renderer/Canvas.tsx +3 -0
- package/src/renderer/__tests__/FitBox.spec.tsx +556 -4
- package/src/renderer/__tests__/e2e/ImageFilter.spec.tsx +4 -4
- package/src/renderer/__tests__/e2e/Paint.spec.tsx +18 -0
- package/src/renderer/__tests__/e2e/Skottie.spec.tsx +24 -1
- package/src/renderer/__tests__/setup.tsx +2 -0
- package/src/renderer/components/ImageFilter.tsx +1 -1
- package/src/skia/types/Matrix4.ts +16 -0
- package/src/sksg/Recorder/Player.ts +7 -7
- package/src/sksg/Recorder/commands/ImageFilters.ts +3 -6
- package/src/specs/SkiaPictureViewNativeComponent.ts +1 -0
- /package/cpp/rnskia/{DawnUtils.h → RNDawnUtils.h} +0 -0
- /package/cpp/rnskia/{ImageProvider.h → RNImageProvider.h} +0 -0
- /package/cpp/rnskia/{WindowContext.h → RNWindowContext.h} +0 -0
package/android/CMakeLists.txt
CHANGED
@@ -85,7 +85,7 @@ if(SK_GRAPHITE)
|
|
85
85
|
add_definitions(-DSK_GRAPHITE)
|
86
86
|
set(BACKEND_SOURCES
|
87
87
|
#TODO: is this source needed to be added?
|
88
|
-
"${PROJECT_SOURCE_DIR}/../cpp/rnskia/
|
88
|
+
"${PROJECT_SOURCE_DIR}/../cpp/rnskia/RNDawnWindowContext.cpp"
|
89
89
|
)
|
90
90
|
else()
|
91
91
|
add_definitions(-DSK_GL -DSK_GANESH)
|
@@ -5,6 +5,7 @@ import com.facebook.react.viewmanagers.SkiaPictureViewManagerDelegate;
|
|
5
5
|
import com.facebook.react.viewmanagers.SkiaPictureViewManagerInterface;
|
6
6
|
|
7
7
|
import androidx.annotation.NonNull;
|
8
|
+
import androidx.annotation.Nullable;
|
8
9
|
|
9
10
|
public class SkiaPictureViewManager extends SkiaBaseViewManager<SkiaPictureView> implements SkiaPictureViewManagerInterface<SkiaPictureView> {
|
10
11
|
|
@@ -30,4 +31,9 @@ public class SkiaPictureViewManager extends SkiaBaseViewManager<SkiaPictureView>
|
|
30
31
|
public SkiaPictureView createViewInstance(@NonNull ThemedReactContext reactContext) {
|
31
32
|
return new SkiaPictureView(reactContext);
|
32
33
|
}
|
34
|
+
|
35
|
+
@Override
|
36
|
+
public void setColorSpace(SkiaPictureView view, @Nullable String value) {
|
37
|
+
// nothing to do here at the moment
|
38
|
+
}
|
33
39
|
}
|
package/apple/MetalContext.h
CHANGED
@@ -113,10 +113,10 @@ public:
|
|
113
113
|
}
|
114
114
|
|
115
115
|
std::unique_ptr<RNSkia::WindowContext> MakeWindow(CALayer *window, int width,
|
116
|
-
int height) {
|
116
|
+
int height, bool useP3ColorSpace = true) {
|
117
117
|
auto device = MetalSharedContext::getInstance().getDevice();
|
118
118
|
return std::make_unique<MetalWindowContext>(
|
119
|
-
_directContext.get(), device, _commandQueue, window, width, height);
|
119
|
+
_directContext.get(), device, _commandQueue, window, width, height, useP3ColorSpace);
|
120
120
|
}
|
121
121
|
|
122
122
|
GrDirectContext *getDirectContext() { return _directContext.get(); }
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
#import <MetalKit/MetalKit.h>
|
4
4
|
|
5
|
-
#include "
|
5
|
+
#include "RNWindowContext.h"
|
6
6
|
|
7
7
|
class SkiaMetalContext;
|
8
8
|
|
@@ -10,7 +10,7 @@ class MetalWindowContext : public RNSkia::WindowContext {
|
|
10
10
|
public:
|
11
11
|
MetalWindowContext(GrDirectContext *directContext, id<MTLDevice> device,
|
12
12
|
id<MTLCommandQueue> commandQueue, CALayer *layer,
|
13
|
-
int width, int height);
|
13
|
+
int width, int height, bool useP3ColorSpace = true);
|
14
14
|
~MetalWindowContext() = default;
|
15
15
|
|
16
16
|
sk_sp<SkSurface> getSurface() override;
|
@@ -6,7 +6,8 @@
|
|
6
6
|
MetalWindowContext::MetalWindowContext(GrDirectContext *directContext,
|
7
7
|
id<MTLDevice> device,
|
8
8
|
id<MTLCommandQueue> commandQueue,
|
9
|
-
CALayer *layer, int width, int height
|
9
|
+
CALayer *layer, int width, int height,
|
10
|
+
bool useP3ColorSpace)
|
10
11
|
: _directContext(directContext), _commandQueue(commandQueue) {
|
11
12
|
#pragma clang diagnostic push
|
12
13
|
#pragma clang diagnostic ignored "-Wunguarded-availability-new"
|
@@ -24,9 +25,11 @@ MetalWindowContext::MetalWindowContext(GrDirectContext *directContext,
|
|
24
25
|
_layer.contentsGravity = kCAGravityBottomLeft;
|
25
26
|
_layer.drawableSize = CGSizeMake(width, height);
|
26
27
|
BOOL supportsWideColor = NO;
|
27
|
-
if (
|
28
|
-
|
29
|
-
|
28
|
+
if (useP3ColorSpace) {
|
29
|
+
if (@available(iOS 10.0, *)) {
|
30
|
+
supportsWideColor =
|
31
|
+
[UIScreen mainScreen].traitCollection.displayGamut == UIDisplayGamutP3;
|
32
|
+
}
|
30
33
|
}
|
31
34
|
if (supportsWideColor) {
|
32
35
|
CGColorSpaceRef colorSpace =
|
package/apple/RNSkAppleView.h
CHANGED
@@ -10,6 +10,7 @@ class RNSkBaseAppleView {
|
|
10
10
|
public:
|
11
11
|
virtual CALayer *getLayer() = 0;
|
12
12
|
virtual void setSize(int width, int height) = 0;
|
13
|
+
virtual void setUseP3ColorSpace(bool useP3ColorSpace) = 0;
|
13
14
|
virtual std::shared_ptr<RNSkia::RNSkView> getDrawView() = 0;
|
14
15
|
};
|
15
16
|
|
@@ -18,7 +19,7 @@ public:
|
|
18
19
|
RNSkAppleView(std::shared_ptr<RNSkia::RNSkPlatformContext> context)
|
19
20
|
: T(context,
|
20
21
|
std::make_shared<RNSkMetalCanvasProvider>(
|
21
|
-
std::bind(&RNSkia::RNSkView::requestRedraw, this), context)) {}
|
22
|
+
std::bind(&RNSkia::RNSkView::requestRedraw, this), context, true)) {}
|
22
23
|
|
23
24
|
CALayer *getLayer() override {
|
24
25
|
return std::static_pointer_cast<RNSkMetalCanvasProvider>(
|
@@ -31,6 +32,11 @@ public:
|
|
31
32
|
->setSize(width, height);
|
32
33
|
}
|
33
34
|
|
35
|
+
void setUseP3ColorSpace(bool useP3ColorSpace) override {
|
36
|
+
std::static_pointer_cast<RNSkMetalCanvasProvider>(this->getCanvasProvider())
|
37
|
+
->setUseP3ColorSpace(useP3ColorSpace);
|
38
|
+
}
|
39
|
+
|
34
40
|
std::shared_ptr<RNSkia::RNSkView> getDrawView() override {
|
35
41
|
return this->shared_from_this();
|
36
42
|
}
|
@@ -16,7 +16,8 @@
|
|
16
16
|
class RNSkMetalCanvasProvider : public RNSkia::RNSkCanvasProvider {
|
17
17
|
public:
|
18
18
|
RNSkMetalCanvasProvider(std::function<void()> requestRedraw,
|
19
|
-
std::shared_ptr<RNSkia::RNSkPlatformContext> context
|
19
|
+
std::shared_ptr<RNSkia::RNSkPlatformContext> context,
|
20
|
+
bool useP3ColorSpace = true);
|
20
21
|
|
21
22
|
~RNSkMetalCanvasProvider();
|
22
23
|
|
@@ -26,6 +27,7 @@ public:
|
|
26
27
|
bool renderToCanvas(const std::function<void(SkCanvas *)> &cb) override;
|
27
28
|
|
28
29
|
void setSize(int width, int height);
|
30
|
+
void setUseP3ColorSpace(bool useP3ColorSpace);
|
29
31
|
CALayer *getLayer();
|
30
32
|
|
31
33
|
private:
|
@@ -35,4 +37,5 @@ private:
|
|
35
37
|
#pragma clang diagnostic ignored "-Wunguarded-availability-new"
|
36
38
|
CAMetalLayer *_layer;
|
37
39
|
#pragma clang diagnostic pop
|
40
|
+
bool _useP3ColorSpace = true;
|
38
41
|
};
|
@@ -3,7 +3,7 @@
|
|
3
3
|
#import "RNSkLog.h"
|
4
4
|
|
5
5
|
#if defined(SK_GRAPHITE)
|
6
|
-
#import "
|
6
|
+
#import "RNDawnContext.h"
|
7
7
|
#else
|
8
8
|
#import "MetalContext.h"
|
9
9
|
#endif
|
@@ -23,8 +23,9 @@
|
|
23
23
|
|
24
24
|
RNSkMetalCanvasProvider::RNSkMetalCanvasProvider(
|
25
25
|
std::function<void()> requestRedraw,
|
26
|
-
std::shared_ptr<RNSkia::RNSkPlatformContext> context
|
27
|
-
|
26
|
+
std::shared_ptr<RNSkia::RNSkPlatformContext> context,
|
27
|
+
bool useP3ColorSpace)
|
28
|
+
: RNSkCanvasProvider(requestRedraw), _context(context), _useP3ColorSpace(useP3ColorSpace) {
|
28
29
|
#pragma clang diagnostic push
|
29
30
|
#pragma clang diagnostic ignored "-Wunguarded-availability-new"
|
30
31
|
_layer = [CAMetalLayer layer];
|
@@ -100,9 +101,13 @@ void RNSkMetalCanvasProvider::setSize(int width, int height) {
|
|
100
101
|
_ctx = RNSkia::DawnContext::getInstance().MakeWindow((__bridge void *)_layer,
|
101
102
|
w, h);
|
102
103
|
#else
|
103
|
-
_ctx = MetalContext::getInstance().MakeWindow(_layer, w, h);
|
104
|
+
_ctx = MetalContext::getInstance().MakeWindow(_layer, w, h, _useP3ColorSpace);
|
104
105
|
#endif
|
105
106
|
_requestRedraw();
|
106
107
|
}
|
107
108
|
|
108
109
|
CALayer *RNSkMetalCanvasProvider::getLayer() { return _layer; }
|
110
|
+
|
111
|
+
void RNSkMetalCanvasProvider::setUseP3ColorSpace(bool useP3ColorSpace) {
|
112
|
+
_useP3ColorSpace = useP3ColorSpace;
|
113
|
+
}
|
package/apple/SkiaPictureView.mm
CHANGED
@@ -55,6 +55,10 @@ using namespace facebook::react;
|
|
55
55
|
[self setNativeId:nativeId];
|
56
56
|
[self setDebugMode:newProps.debug];
|
57
57
|
[self setOpaque:newProps.opaque];
|
58
|
+
if (newProps.colorSpace == "" || newProps.colorSpace == "srgb") {
|
59
|
+
bool useP3 = false;
|
60
|
+
[self setUseP3ColorSpace:useP3];
|
61
|
+
}
|
58
62
|
}
|
59
63
|
|
60
64
|
@end
|
package/apple/SkiaUIView.h
CHANGED
package/apple/SkiaUIView.mm
CHANGED
@@ -16,6 +16,7 @@
|
|
16
16
|
_factory;
|
17
17
|
bool _debugMode;
|
18
18
|
bool _opaque;
|
19
|
+
bool _useP3ColorSpace;
|
19
20
|
size_t _nativeId;
|
20
21
|
}
|
21
22
|
|
@@ -73,6 +74,7 @@
|
|
73
74
|
_manager->setSkiaView(_nativeId, _impl->getDrawView());
|
74
75
|
}
|
75
76
|
_impl->getDrawView()->setShowDebugOverlays(_debugMode);
|
77
|
+
_impl->setUseP3ColorSpace(_useP3ColorSpace);
|
76
78
|
}
|
77
79
|
}
|
78
80
|
}
|
@@ -163,6 +165,13 @@
|
|
163
165
|
}
|
164
166
|
}
|
165
167
|
|
168
|
+
- (void)setUseP3ColorSpace:(bool)useP3ColorSpace {
|
169
|
+
_useP3ColorSpace = useP3ColorSpace;
|
170
|
+
if (_impl != nullptr) {
|
171
|
+
_impl->setUseP3ColorSpace(_useP3ColorSpace);
|
172
|
+
}
|
173
|
+
}
|
174
|
+
|
166
175
|
#pragma mark External API
|
167
176
|
|
168
177
|
- (std::shared_ptr<RNSkBaseAppleView>)impl {
|
package/cpp/api/JsiSkImage.h
CHANGED
package/cpp/api/JsiSkSurface.h
CHANGED
package/cpp/api/JsiSkiaContext.h
CHANGED
@@ -290,7 +290,7 @@ public:
|
|
290
290
|
};
|
291
291
|
|
292
292
|
struct ImageFilterCmdProps {
|
293
|
-
sk_sp<SkImageFilter>
|
293
|
+
sk_sp<SkImageFilter> filter;
|
294
294
|
};
|
295
295
|
|
296
296
|
class ImageFilterCmd : public Command {
|
@@ -301,11 +301,11 @@ public:
|
|
301
301
|
ImageFilterCmd(jsi::Runtime &runtime, const jsi::Object &object,
|
302
302
|
Variables &variables)
|
303
303
|
: Command(CommandType::PushImageFilter, "skImageFilter") {
|
304
|
-
convertProperty(runtime, object, "
|
304
|
+
convertProperty(runtime, object, "filter", props.filter, variables);
|
305
305
|
}
|
306
306
|
|
307
307
|
void pushImageFilter(DrawingCtx *ctx) {
|
308
|
-
ctx->imageFilters.push_back(props.
|
308
|
+
ctx->imageFilters.push_back(props.filter);
|
309
309
|
}
|
310
310
|
};
|
311
311
|
|
package/cpp/api/recorder/Paint.h
CHANGED
@@ -3,9 +3,9 @@
|
|
3
3
|
#include <memory>
|
4
4
|
#include <mutex>
|
5
5
|
|
6
|
-
#include "
|
7
|
-
#include "
|
8
|
-
#include "
|
6
|
+
#include "RNDawnWindowContext.h"
|
7
|
+
#include "RNImageProvider.h"
|
8
|
+
#include "RNDawnUtils.h"
|
9
9
|
|
10
10
|
#include "include/core/SkData.h"
|
11
11
|
#include "include/gpu/graphite/BackendTexture.h"
|
@@ -1,6 +1,6 @@
|
|
1
|
-
#include "
|
1
|
+
#include "RNDawnWindowContext.h"
|
2
2
|
|
3
|
-
#include "
|
3
|
+
#include "RNDawnContext.h"
|
4
4
|
|
5
5
|
namespace RNSkia {
|
6
6
|
|
@@ -16,4 +16,4 @@ void DawnWindowContext::present() {
|
|
16
16
|
_surface.Present();
|
17
17
|
}
|
18
18
|
|
19
|
-
} // namespace RNSkia
|
19
|
+
} // namespace RNSkia
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":[],"sources":["Drawings.ts"],"sourcesContent":["import type {\n FillType,\n SkImage,\n StrokeOpts,\n Vector,\n Color,\n SkPoint,\n BlendMode,\n PointMode,\n VertexMode,\n SkFont,\n SkRRect,\n SkTextBlob,\n SkPicture,\n SkSVG,\n SkPaint,\n SkRect,\n SkRSXform,\n SkColor,\n SamplingOptions,\n SkSkottieAnimation,\n SkImageFilter,\n} from \"../../skia/types\";\n\nimport type {\n CircleDef,\n Fit,\n GroupProps,\n PathDef,\n RectDef,\n RRectDef,\n SkEnum,\n} from \"./Common\";\n\nexport interface DrawingNodeProps extends GroupProps {\n paint?: SkPaint;\n}\n\nexport type ImageProps = DrawingNodeProps &\n RectDef & {\n fit?: Fit;\n image: SkImage | null;\n sampling?: SamplingOptions;\n };\n\nexport type CircleProps = CircleDef & DrawingNodeProps;\n\nexport interface PathProps extends DrawingNodeProps {\n path: PathDef;\n start: number;\n end: number;\n stroke?: StrokeOpts;\n fillType?: SkEnum<typeof FillType>;\n}\n\nexport interface LineProps extends DrawingNodeProps {\n p1: Vector;\n p2: Vector;\n}\n\nexport type OvalProps = RectDef & DrawingNodeProps;\n\nexport type RectProps = RectDef & DrawingNodeProps;\n\nexport type RoundedRectProps = RRectDef & DrawingNodeProps;\n\nexport interface AtlasProps extends DrawingNodeProps {\n image: SkImage | null;\n sprites: SkRect[];\n transforms: SkRSXform[];\n colors?: SkColor[];\n sampling?: SamplingOptions;\n}\n\nexport interface CubicBezierHandle {\n pos: Vector;\n c1: Vector;\n c2: Vector;\n}\n\nexport interface PatchProps extends DrawingNodeProps {\n colors?: Color[];\n patch: [\n CubicBezierHandle,\n CubicBezierHandle,\n CubicBezierHandle,\n CubicBezierHandle\n ];\n texture?: readonly [SkPoint, SkPoint, SkPoint, SkPoint];\n blendMode?: SkEnum<typeof BlendMode>;\n}\n\nexport interface VerticesProps extends DrawingNodeProps {\n colors?: string[];\n vertices: SkPoint[];\n textures?: SkPoint[];\n mode: SkEnum<typeof VertexMode>;\n blendMode?: SkEnum<typeof BlendMode>;\n indices?: number[];\n}\n\nexport interface ImageSVGProps extends DrawingNodeProps {\n svg: SkSVG | null;\n x?: number;\n y?: number;\n width?: number;\n height?: number;\n rect?: SkRect;\n}\n\nexport interface SkottieProps extends DrawingNodeProps {\n animation: SkSkottieAnimation;\n frame: number;\n}\n\nexport interface PictureProps extends DrawingNodeProps {\n picture: SkPicture;\n}\n\nexport interface PointsProps extends DrawingNodeProps {\n points: SkPoint[];\n mode: SkEnum<typeof PointMode>;\n}\n\nexport interface DiffRectProps extends DrawingNodeProps {\n inner: SkRRect;\n outer: SkRRect;\n}\n\nexport interface TextProps extends DrawingNodeProps {\n font: SkFont | null;\n text: string;\n x: number;\n y: number;\n}\n\nexport interface TextPathProps extends DrawingNodeProps {\n font: SkFont | null;\n text: string;\n path: PathDef;\n initialOffset: number;\n}\n\nexport interface TextBlobProps extends DrawingNodeProps {\n blob: SkTextBlob;\n x: number;\n y: number;\n}\n\nexport interface Glyph {\n id: number;\n pos: SkPoint;\n}\n\nexport interface GlyphsProps extends DrawingNodeProps {\n font: SkFont | null;\n x: number;\n y: number;\n glyphs: Glyph[];\n}\n\nexport interface BoxProps extends DrawingNodeProps {\n box: SkRRect | SkRect;\n}\n\nexport interface BoxShadowProps {\n dx?: number;\n dy?: number;\n spread?: number;\n blur: number;\n color?: Color;\n inner?: boolean;\n}\n\nexport interface ImageFilterProps extends GroupProps {\n
|
1
|
+
{"version":3,"names":[],"sources":["Drawings.ts"],"sourcesContent":["import type {\n FillType,\n SkImage,\n StrokeOpts,\n Vector,\n Color,\n SkPoint,\n BlendMode,\n PointMode,\n VertexMode,\n SkFont,\n SkRRect,\n SkTextBlob,\n SkPicture,\n SkSVG,\n SkPaint,\n SkRect,\n SkRSXform,\n SkColor,\n SamplingOptions,\n SkSkottieAnimation,\n SkImageFilter,\n} from \"../../skia/types\";\n\nimport type {\n CircleDef,\n Fit,\n GroupProps,\n PathDef,\n RectDef,\n RRectDef,\n SkEnum,\n} from \"./Common\";\n\nexport interface DrawingNodeProps extends GroupProps {\n paint?: SkPaint;\n}\n\nexport type ImageProps = DrawingNodeProps &\n RectDef & {\n fit?: Fit;\n image: SkImage | null;\n sampling?: SamplingOptions;\n };\n\nexport type CircleProps = CircleDef & DrawingNodeProps;\n\nexport interface PathProps extends DrawingNodeProps {\n path: PathDef;\n start: number;\n end: number;\n stroke?: StrokeOpts;\n fillType?: SkEnum<typeof FillType>;\n}\n\nexport interface LineProps extends DrawingNodeProps {\n p1: Vector;\n p2: Vector;\n}\n\nexport type OvalProps = RectDef & DrawingNodeProps;\n\nexport type RectProps = RectDef & DrawingNodeProps;\n\nexport type RoundedRectProps = RRectDef & DrawingNodeProps;\n\nexport interface AtlasProps extends DrawingNodeProps {\n image: SkImage | null;\n sprites: SkRect[];\n transforms: SkRSXform[];\n colors?: SkColor[];\n sampling?: SamplingOptions;\n}\n\nexport interface CubicBezierHandle {\n pos: Vector;\n c1: Vector;\n c2: Vector;\n}\n\nexport interface PatchProps extends DrawingNodeProps {\n colors?: Color[];\n patch: [\n CubicBezierHandle,\n CubicBezierHandle,\n CubicBezierHandle,\n CubicBezierHandle\n ];\n texture?: readonly [SkPoint, SkPoint, SkPoint, SkPoint];\n blendMode?: SkEnum<typeof BlendMode>;\n}\n\nexport interface VerticesProps extends DrawingNodeProps {\n colors?: string[];\n vertices: SkPoint[];\n textures?: SkPoint[];\n mode: SkEnum<typeof VertexMode>;\n blendMode?: SkEnum<typeof BlendMode>;\n indices?: number[];\n}\n\nexport interface ImageSVGProps extends DrawingNodeProps {\n svg: SkSVG | null;\n x?: number;\n y?: number;\n width?: number;\n height?: number;\n rect?: SkRect;\n}\n\nexport interface SkottieProps extends DrawingNodeProps {\n animation: SkSkottieAnimation;\n frame: number;\n}\n\nexport interface PictureProps extends DrawingNodeProps {\n picture: SkPicture;\n}\n\nexport interface PointsProps extends DrawingNodeProps {\n points: SkPoint[];\n mode: SkEnum<typeof PointMode>;\n}\n\nexport interface DiffRectProps extends DrawingNodeProps {\n inner: SkRRect;\n outer: SkRRect;\n}\n\nexport interface TextProps extends DrawingNodeProps {\n font: SkFont | null;\n text: string;\n x: number;\n y: number;\n}\n\nexport interface TextPathProps extends DrawingNodeProps {\n font: SkFont | null;\n text: string;\n path: PathDef;\n initialOffset: number;\n}\n\nexport interface TextBlobProps extends DrawingNodeProps {\n blob: SkTextBlob;\n x: number;\n y: number;\n}\n\nexport interface Glyph {\n id: number;\n pos: SkPoint;\n}\n\nexport interface GlyphsProps extends DrawingNodeProps {\n font: SkFont | null;\n x: number;\n y: number;\n glyphs: Glyph[];\n}\n\nexport interface BoxProps extends DrawingNodeProps {\n box: SkRRect | SkRect;\n}\n\nexport interface BoxShadowProps {\n dx?: number;\n dy?: number;\n spread?: number;\n blur: number;\n color?: Color;\n inner?: boolean;\n}\n\nexport interface ImageFilterProps extends GroupProps {\n filter: SkImageFilter;\n}\n"],"mappings":"","ignoreList":[]}
|
@@ -14,6 +14,7 @@ export interface CanvasProps extends ViewProps {
|
|
14
14
|
debug?: boolean;
|
15
15
|
opaque?: boolean;
|
16
16
|
onSize?: SharedValue<SkSize>;
|
17
|
+
colorSpace?: "p3" | "srgb";
|
17
18
|
ref?: React.Ref<CanvasRef>;
|
18
19
|
}
|
19
|
-
export declare const Canvas: ({ debug, opaque, children, onSize, onLayout: _onLayout, ref, ...viewProps }: CanvasProps) => React.JSX.Element;
|
20
|
+
export declare const Canvas: ({ debug, opaque, children, onSize, onLayout: _onLayout, colorSpace, ref, ...viewProps }: CanvasProps) => React.JSX.Element;
|
@@ -42,6 +42,7 @@ const Canvas = ({
|
|
42
42
|
children,
|
43
43
|
onSize,
|
44
44
|
onLayout: _onLayout,
|
45
|
+
colorSpace = "p3",
|
45
46
|
ref,
|
46
47
|
...viewProps
|
47
48
|
}) => {
|
@@ -84,6 +85,7 @@ const Canvas = ({
|
|
84
85
|
nativeID: `${nativeId}`,
|
85
86
|
debug: debug,
|
86
87
|
opaque: opaque,
|
88
|
+
colorSpace: colorSpace,
|
87
89
|
onLayout: onLayout
|
88
90
|
}, viewProps));
|
89
91
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_SkiaViewNativeId","_SkiaPictureViewNativeComponent","_interopRequireDefault","_Reconciler","_skia","e","__esModule","default","_getRequireWildcardCache","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","_extends","assign","bind","arguments","length","apply","useCanvasRef","useRef","exports","useOnSizeEvent","resultValue","onLayout","useCallback","event","width","height","nativeEvent","layout","value","Canvas","debug","opaque","children","onSize","_onLayout","ref","viewProps","nativeId","useMemo","SkiaViewNativeId","current","root","SkiaSGRoot","Skia","useLayoutEffect","render","useEffect","unmount","useImperativeHandle","makeImageSnapshot","rect","SkiaViewApi","makeImageSnapshotAsync","redraw","requestRedraw","getNativeId","createElement","collapsable","nativeID"],"sources":["Canvas.tsx"],"sourcesContent":["import type { FC } from \"react\";\nimport React, {\n useCallback,\n useEffect,\n useImperativeHandle,\n useLayoutEffect,\n useMemo,\n useRef,\n} from \"react\";\nimport type { LayoutChangeEvent, ViewProps } from \"react-native\";\nimport type { SharedValue } from \"react-native-reanimated\";\n\nimport { SkiaViewNativeId } from \"../views/SkiaViewNativeId\";\nimport SkiaPictureViewNativeComponent from \"../specs/SkiaPictureViewNativeComponent\";\nimport type { SkImage, SkRect, SkSize } from \"../skia/types\";\nimport { SkiaSGRoot } from \"../sksg/Reconciler\";\nimport { Skia } from \"../skia\";\nimport type { SkiaBaseViewProps } from \"../views\";\n\nexport interface CanvasRef extends FC<CanvasProps> {\n makeImageSnapshot(rect?: SkRect): SkImage;\n makeImageSnapshotAsync(rect?: SkRect): Promise<SkImage>;\n redraw(): void;\n getNativeId(): number;\n}\n\nexport const useCanvasRef = () => useRef<CanvasRef>(null);\n\n//const NativeSkiaPictureView = SkiaPictureViewNativeComponent;\n\n// TODO: no need to go through the JS thread for this\nconst useOnSizeEvent = (\n resultValue: SkiaBaseViewProps[\"onSize\"],\n onLayout?: (event: LayoutChangeEvent) => void\n) => {\n return useCallback(\n (event: LayoutChangeEvent) => {\n if (onLayout) {\n onLayout(event);\n }\n const { width, height } = event.nativeEvent.layout;\n\n if (resultValue) {\n resultValue.value = { width, height };\n }\n },\n [onLayout, resultValue]\n );\n};\n\nexport interface CanvasProps extends ViewProps {\n debug?: boolean;\n opaque?: boolean;\n onSize?: SharedValue<SkSize>;\n ref?: React.Ref<CanvasRef>;\n}\n\nexport const Canvas = ({\n debug,\n opaque,\n children,\n onSize,\n onLayout: _onLayout,\n ref,\n ...viewProps\n}: CanvasProps) => {\n const onLayout = useOnSizeEvent(onSize, _onLayout);\n // Native ID\n const nativeId = useMemo(() => {\n return SkiaViewNativeId.current++;\n }, []);\n\n // Root\n const root = useMemo(() => new SkiaSGRoot(Skia, nativeId), [nativeId]);\n\n // Render effects\n useLayoutEffect(() => {\n root.render(children);\n }, [children, root]);\n\n useEffect(() => {\n return () => {\n root.unmount();\n };\n }, [root]);\n\n // Component methods\n useImperativeHandle(\n ref,\n () =>\n ({\n makeImageSnapshot: (rect?: SkRect) => {\n return SkiaViewApi.makeImageSnapshot(nativeId, rect);\n },\n makeImageSnapshotAsync: (rect?: SkRect) => {\n return SkiaViewApi.makeImageSnapshotAsync(nativeId, rect);\n },\n redraw: () => {\n SkiaViewApi.requestRedraw(nativeId);\n },\n getNativeId: () => {\n return nativeId;\n },\n } as CanvasRef)\n );\n return (\n <SkiaPictureViewNativeComponent\n collapsable={false}\n nativeID={`${nativeId}`}\n debug={debug}\n opaque={opaque}\n onLayout={onLayout}\n {...viewProps}\n />\n );\n};\n"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,uBAAA,C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AP,OAAA,GAAAF,CAAA,EAAAM,CAAA,IAAAA,CAAA,CAAAa,GAAA,CAAAnB,CAAA,EAAAS,CAAA,GAAAA,CAAA;AAAA,SAAAW,SAAA,WAAAA,QAAA,GAAAR,MAAA,CAAAS,MAAA,GAAAT,MAAA,CAAAS,MAAA,CAAAC,IAAA,eAAAb,CAAA,aAAAT,CAAA,MAAAA,CAAA,GAAAuB,SAAA,CAAAC,MAAA,EAAAxB,CAAA,UAAAM,CAAA,GAAAiB,SAAA,CAAAvB,CAAA,YAAAK,CAAA,IAAAC,CAAA,OAAAU,cAAA,CAAAC,IAAA,CAAAX,CAAA,EAAAD,CAAA,MAAAI,CAAA,CAAAJ,CAAA,IAAAC,CAAA,CAAAD,CAAA,aAAAI,CAAA,KAAAW,QAAA,CAAAK,KAAA,OAAAF,SAAA;AAUxB,MAAMG,YAAY,GAAGA,CAAA,KAAM,IAAAC,aAAM,EAAY,IAAI,CAAC;;AAEzD;;AAEA;AAAAC,OAAA,CAAAF,YAAA,GAAAA,YAAA;AACA,MAAMG,cAAc,GAAGA,CACrBC,WAAwC,EACxCC,QAA6C,KAC1C;EACH,OAAO,IAAAC,kBAAW,EACfC,KAAwB,IAAK;IAC5B,IAAIF,QAAQ,EAAE;MACZA,QAAQ,CAACE,KAAK,CAAC;IACjB;IACA,MAAM;MAAEC,KAAK;MAAEC;IAAO,CAAC,GAAGF,KAAK,CAACG,WAAW,CAACC,MAAM;IAElD,IAAIP,WAAW,EAAE;MACfA,WAAW,CAACQ,KAAK,GAAG;QAAEJ,KAAK;QAAEC;MAAO,CAAC;IACvC;EACF,CAAC,EACD,CAACJ,QAAQ,EAAED,WAAW,CACxB,CAAC;AACH,CAAC;
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_SkiaViewNativeId","_SkiaPictureViewNativeComponent","_interopRequireDefault","_Reconciler","_skia","e","__esModule","default","_getRequireWildcardCache","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","_extends","assign","bind","arguments","length","apply","useCanvasRef","useRef","exports","useOnSizeEvent","resultValue","onLayout","useCallback","event","width","height","nativeEvent","layout","value","Canvas","debug","opaque","children","onSize","_onLayout","colorSpace","ref","viewProps","nativeId","useMemo","SkiaViewNativeId","current","root","SkiaSGRoot","Skia","useLayoutEffect","render","useEffect","unmount","useImperativeHandle","makeImageSnapshot","rect","SkiaViewApi","makeImageSnapshotAsync","redraw","requestRedraw","getNativeId","createElement","collapsable","nativeID"],"sources":["Canvas.tsx"],"sourcesContent":["import type { FC } from \"react\";\nimport React, {\n useCallback,\n useEffect,\n useImperativeHandle,\n useLayoutEffect,\n useMemo,\n useRef,\n} from \"react\";\nimport type { LayoutChangeEvent, ViewProps } from \"react-native\";\nimport type { SharedValue } from \"react-native-reanimated\";\n\nimport { SkiaViewNativeId } from \"../views/SkiaViewNativeId\";\nimport SkiaPictureViewNativeComponent from \"../specs/SkiaPictureViewNativeComponent\";\nimport type { SkImage, SkRect, SkSize } from \"../skia/types\";\nimport { SkiaSGRoot } from \"../sksg/Reconciler\";\nimport { Skia } from \"../skia\";\nimport type { SkiaBaseViewProps } from \"../views\";\n\nexport interface CanvasRef extends FC<CanvasProps> {\n makeImageSnapshot(rect?: SkRect): SkImage;\n makeImageSnapshotAsync(rect?: SkRect): Promise<SkImage>;\n redraw(): void;\n getNativeId(): number;\n}\n\nexport const useCanvasRef = () => useRef<CanvasRef>(null);\n\n//const NativeSkiaPictureView = SkiaPictureViewNativeComponent;\n\n// TODO: no need to go through the JS thread for this\nconst useOnSizeEvent = (\n resultValue: SkiaBaseViewProps[\"onSize\"],\n onLayout?: (event: LayoutChangeEvent) => void\n) => {\n return useCallback(\n (event: LayoutChangeEvent) => {\n if (onLayout) {\n onLayout(event);\n }\n const { width, height } = event.nativeEvent.layout;\n\n if (resultValue) {\n resultValue.value = { width, height };\n }\n },\n [onLayout, resultValue]\n );\n};\n\nexport interface CanvasProps extends ViewProps {\n debug?: boolean;\n opaque?: boolean;\n onSize?: SharedValue<SkSize>;\n colorSpace?: \"p3\" | \"srgb\";\n ref?: React.Ref<CanvasRef>;\n}\n\nexport const Canvas = ({\n debug,\n opaque,\n children,\n onSize,\n onLayout: _onLayout,\n colorSpace = \"p3\",\n ref,\n ...viewProps\n}: CanvasProps) => {\n const onLayout = useOnSizeEvent(onSize, _onLayout);\n // Native ID\n const nativeId = useMemo(() => {\n return SkiaViewNativeId.current++;\n }, []);\n\n // Root\n const root = useMemo(() => new SkiaSGRoot(Skia, nativeId), [nativeId]);\n\n // Render effects\n useLayoutEffect(() => {\n root.render(children);\n }, [children, root]);\n\n useEffect(() => {\n return () => {\n root.unmount();\n };\n }, [root]);\n\n // Component methods\n useImperativeHandle(\n ref,\n () =>\n ({\n makeImageSnapshot: (rect?: SkRect) => {\n return SkiaViewApi.makeImageSnapshot(nativeId, rect);\n },\n makeImageSnapshotAsync: (rect?: SkRect) => {\n return SkiaViewApi.makeImageSnapshotAsync(nativeId, rect);\n },\n redraw: () => {\n SkiaViewApi.requestRedraw(nativeId);\n },\n getNativeId: () => {\n return nativeId;\n },\n } as CanvasRef)\n );\n return (\n <SkiaPictureViewNativeComponent\n collapsable={false}\n nativeID={`${nativeId}`}\n debug={debug}\n opaque={opaque}\n colorSpace={colorSpace}\n onLayout={onLayout}\n {...viewProps}\n />\n );\n};\n"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAWA,IAAAC,iBAAA,GAAAD,OAAA;AACA,IAAAE,+BAAA,GAAAC,sBAAA,CAAAH,OAAA;AAEA,IAAAI,WAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AAA+B,SAAAG,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,yBAAAH,CAAA,6BAAAI,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAA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IAAAO,sBAAe,EAAC,MAAM;IACpBH,IAAI,CAACI,MAAM,CAACd,QAAQ,CAAC;EACvB,CAAC,EAAE,CAACA,QAAQ,EAAEU,IAAI,CAAC,CAAC;EAEpB,IAAAK,gBAAS,EAAC,MAAM;IACd,OAAO,MAAM;MACXL,IAAI,CAACM,OAAO,CAAC,CAAC;IAChB,CAAC;EACH,CAAC,EAAE,CAACN,IAAI,CAAC,CAAC;;EAEV;EACA,IAAAO,0BAAmB,EACjBb,GAAG,EACH,OACG;IACCc,iBAAiB,EAAGC,IAAa,IAAK;MACpC,OAAOC,WAAW,CAACF,iBAAiB,CAACZ,QAAQ,EAAEa,IAAI,CAAC;IACtD,CAAC;IACDE,sBAAsB,EAAGF,IAAa,IAAK;MACzC,OAAOC,WAAW,CAACC,sBAAsB,CAACf,QAAQ,EAAEa,IAAI,CAAC;IAC3D,CAAC;IACDG,MAAM,EAAEA,CAAA,KAAM;MACZF,WAAW,CAACG,aAAa,CAACjB,QAAQ,CAAC;IACrC,CAAC;IACDkB,WAAW,EAAEA,CAAA,KAAM;MACjB,OAAOlB,QAAQ;IACjB;EACF,CAAC,CACL,CAAC;EACD,oBACExD,MAAA,CAAAU,OAAA,CAAAiE,aAAA,CAACvE,+BAAA,CAAAM,OAA8B,EAAAkB,QAAA;IAC7BgD,WAAW,EAAE,KAAM;IACnBC,QAAQ,EAAE,GAAGrB,QAAQ,EAAG;IACxBR,KAAK,EAAEA,KAAM;IACbC,MAAM,EAAEA,MAAO;IACfI,UAAU,EAAEA,UAAW;IACvBd,QAAQ,EAAEA;EAAS,GACfgB,SAAS,CACd,CAAC;AAEN,CAAC;AAACnB,OAAA,CAAAW,MAAA,GAAAA,MAAA","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireDefault","require","e","__esModule","default","ImageFilter","props","createElement","exports"],"sources":["ImageFilter.tsx"],"sourcesContent":["import React from \"react\";\n\nimport type { ImageFilterProps } from \"../../dom/types\";\nimport type { SkiaProps } from \"../processors\";\n\nexport const ImageFilter = (props: SkiaProps<ImageFilterProps>) => {\n return <skImageFilter {...props} />;\n}
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","e","__esModule","default","ImageFilter","props","createElement","exports"],"sources":["ImageFilter.tsx"],"sourcesContent":["import React from \"react\";\n\nimport type { ImageFilterProps } from \"../../dom/types\";\nimport type { SkiaProps } from \"../processors\";\n\nexport const ImageFilter = (props: SkiaProps<ImageFilterProps>) => {\n return <skImageFilter {...props} />;\n};\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA0B,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAKnB,MAAMG,WAAW,GAAIC,KAAkC,IAAK;EACjE,oBAAOP,MAAA,CAAAK,OAAA,CAAAG,aAAA,kBAAmBD,KAAQ,CAAC;AACrC,CAAC;AAACE,OAAA,CAAAH,WAAA,GAAAA,WAAA","ignoreList":[]}
|
@@ -96,6 +96,10 @@ export declare const processTransform3d: (transforms: Transforms3d) => Matrix4;
|
|
96
96
|
* @worklet
|
97
97
|
*/
|
98
98
|
export declare const convertToColumnMajor: (rowMajorMatrix: Matrix4) => Matrix4;
|
99
|
+
/**
|
100
|
+
* @worklet
|
101
|
+
*/
|
102
|
+
export declare const convertToColumnMajor3: (rowMajorMatrix: Matrix3 | number[]) => Matrix3;
|
99
103
|
/**
|
100
104
|
* @worklet
|
101
105
|
*/
|
@@ -3,7 +3,7 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.translate = exports.toMatrix3 = exports.setupCamera = exports.scale = exports.rotateZ = exports.rotateY = exports.rotateX = exports.processTransform3d = exports.pivot = exports.perspective = exports.multiply4 = exports.matrixVecMul4 = exports.mapPoint3d = exports.invert4 = exports.convertToColumnMajor = exports.convertToAffineMatrix = exports.Matrix4 = void 0;
|
6
|
+
exports.translate = exports.toMatrix3 = exports.setupCamera = exports.scale = exports.rotateZ = exports.rotateY = exports.rotateX = exports.processTransform3d = exports.pivot = exports.perspective = exports.multiply4 = exports.matrixVecMul4 = exports.mapPoint3d = exports.invert4 = exports.convertToColumnMajor3 = exports.convertToColumnMajor = exports.convertToAffineMatrix = exports.Matrix4 = void 0;
|
7
7
|
const exhaustiveCheck = a => {
|
8
8
|
"worklet";
|
9
9
|
|
@@ -277,6 +277,23 @@ const convertToColumnMajor = rowMajorMatrix => {
|
|
277
277
|
* @worklet
|
278
278
|
*/
|
279
279
|
exports.convertToColumnMajor = convertToColumnMajor;
|
280
|
+
const convertToColumnMajor3 = rowMajorMatrix => {
|
281
|
+
"worklet";
|
282
|
+
|
283
|
+
const colMajorMatrix = new Array(9);
|
284
|
+
const size = 3;
|
285
|
+
for (let row = 0; row < size; row++) {
|
286
|
+
for (let col = 0; col < size; col++) {
|
287
|
+
colMajorMatrix[col * size + row] = rowMajorMatrix[row * size + col];
|
288
|
+
}
|
289
|
+
}
|
290
|
+
return colMajorMatrix;
|
291
|
+
};
|
292
|
+
|
293
|
+
/**
|
294
|
+
* @worklet
|
295
|
+
*/
|
296
|
+
exports.convertToColumnMajor3 = convertToColumnMajor3;
|
280
297
|
const convertToAffineMatrix = m4 => {
|
281
298
|
"worklet";
|
282
299
|
|