@shopify/react-native-skia 1.12.1 → 1.12.2
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/apple/MetalContext.h +129 -0
- package/apple/MetalContext.mm +34 -0
- package/apple/MetalWindowContext.h +39 -0
- package/apple/MetalWindowContext.mm +64 -0
- package/apple/RNSkApplePlatformContext.h +79 -0
- package/apple/RNSkApplePlatformContext.mm +303 -0
- package/apple/RNSkAppleVideo.h +51 -0
- package/apple/RNSkAppleVideo.mm +137 -0
- package/apple/RNSkAppleView.h +37 -0
- package/apple/RNSkAppleView.mm +35 -0
- package/apple/RNSkMetalCanvasProvider.h +38 -0
- package/apple/RNSkMetalCanvasProvider.mm +108 -0
- package/apple/RNSkiaModule.h +20 -0
- package/apple/RNSkiaModule.mm +55 -0
- package/apple/SkiaCVPixelBufferUtils.h +119 -0
- package/apple/SkiaCVPixelBufferUtils.mm +344 -0
- package/apple/SkiaManager.h +25 -0
- package/apple/SkiaManager.mm +62 -0
- package/apple/SkiaPictureView.h +7 -0
- package/apple/SkiaPictureView.mm +66 -0
- package/apple/SkiaPictureViewManager.h +8 -0
- package/apple/SkiaPictureViewManager.mm +55 -0
- package/apple/SkiaUIView.h +45 -0
- package/apple/SkiaUIView.mm +172 -0
- package/apple/ViewScreenshotService.h +25 -0
- package/apple/ViewScreenshotService.mm +89 -0
- package/lib/commonjs/skia/web/Host.d.ts +3 -3
- package/lib/commonjs/skia/web/Host.js +16 -4
- package/lib/commonjs/skia/web/Host.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkCanvas.js +15 -15
- package/lib/commonjs/skia/web/JsiSkCanvas.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkColorFilterFactory.js +1 -1
- package/lib/commonjs/skia/web/JsiSkColorFilterFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkFont.js +2 -2
- package/lib/commonjs/skia/web/JsiSkFont.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkImage.js +6 -6
- package/lib/commonjs/skia/web/JsiSkImage.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkImageFactory.js +2 -2
- package/lib/commonjs/skia/web/JsiSkImageFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkImageFilterFactory.js +3 -3
- package/lib/commonjs/skia/web/JsiSkImageFilterFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkMaskFilterFactory.js +1 -1
- package/lib/commonjs/skia/web/JsiSkMaskFilterFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPaint.js +3 -3
- package/lib/commonjs/skia/web/JsiSkPaint.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPath.js +4 -4
- package/lib/commonjs/skia/web/JsiSkPath.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPathEffectFactory.js +1 -1
- package/lib/commonjs/skia/web/JsiSkPathEffectFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPathFactory.js +1 -1
- package/lib/commonjs/skia/web/JsiSkPathFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPicture.js +1 -1
- package/lib/commonjs/skia/web/JsiSkPicture.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkShaderFactory.js +5 -5
- package/lib/commonjs/skia/web/JsiSkShaderFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkVerticesFactory.js +1 -1
- package/lib/commonjs/skia/web/JsiSkVerticesFactory.js.map +1 -1
- package/lib/module/skia/web/Host.d.ts +3 -3
- package/lib/module/skia/web/Host.js +16 -4
- package/lib/module/skia/web/Host.js.map +1 -1
- package/lib/module/skia/web/JsiSkCanvas.js +15 -15
- package/lib/module/skia/web/JsiSkCanvas.js.map +1 -1
- package/lib/module/skia/web/JsiSkColorFilterFactory.js +1 -1
- package/lib/module/skia/web/JsiSkColorFilterFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkFont.js +2 -2
- package/lib/module/skia/web/JsiSkFont.js.map +1 -1
- package/lib/module/skia/web/JsiSkImage.js +6 -6
- package/lib/module/skia/web/JsiSkImage.js.map +1 -1
- package/lib/module/skia/web/JsiSkImageFactory.js +2 -2
- package/lib/module/skia/web/JsiSkImageFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkImageFilterFactory.js +3 -3
- package/lib/module/skia/web/JsiSkImageFilterFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkMaskFilterFactory.js +1 -1
- package/lib/module/skia/web/JsiSkMaskFilterFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkPaint.js +3 -3
- package/lib/module/skia/web/JsiSkPaint.js.map +1 -1
- package/lib/module/skia/web/JsiSkPath.js +4 -4
- package/lib/module/skia/web/JsiSkPath.js.map +1 -1
- package/lib/module/skia/web/JsiSkPathEffectFactory.js +1 -1
- package/lib/module/skia/web/JsiSkPathEffectFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkPathFactory.js +1 -1
- package/lib/module/skia/web/JsiSkPathFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkPicture.js +1 -1
- package/lib/module/skia/web/JsiSkPicture.js.map +1 -1
- package/lib/module/skia/web/JsiSkShaderFactory.js +5 -5
- package/lib/module/skia/web/JsiSkShaderFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkVerticesFactory.js +1 -1
- package/lib/module/skia/web/JsiSkVerticesFactory.js.map +1 -1
- package/lib/typescript/lib/commonjs/skia/web/Host.d.ts +2 -2
- package/lib/typescript/lib/module/skia/web/Host.d.ts +2 -2
- package/lib/typescript/src/skia/web/Host.d.ts +3 -3
- package/package.json +2 -2
- package/src/skia/__tests__/Enums.spec.ts +34 -0
- package/src/skia/web/Host.ts +24 -7
- package/src/skia/web/JsiSkCanvas.ts +17 -17
- package/src/skia/web/JsiSkColorFilterFactory.ts +1 -1
- package/src/skia/web/JsiSkFont.ts +2 -2
- package/src/skia/web/JsiSkImage.ts +14 -10
- package/src/skia/web/JsiSkImageFactory.ts +2 -2
- package/src/skia/web/JsiSkImageFilterFactory.ts +4 -4
- package/src/skia/web/JsiSkMaskFilterFactory.ts +1 -1
- package/src/skia/web/JsiSkPaint.ts +3 -3
- package/src/skia/web/JsiSkPath.ts +4 -4
- package/src/skia/web/JsiSkPathEffectFactory.ts +1 -1
- package/src/skia/web/JsiSkPathFactory.ts +1 -1
- package/src/skia/web/JsiSkPicture.ts +3 -3
- package/src/skia/web/JsiSkShaderFactory.ts +5 -5
- package/src/skia/web/JsiSkVerticesFactory.ts +1 -1
@@ -0,0 +1,172 @@
|
|
1
|
+
#import <React/RCTBridge.h>
|
2
|
+
|
3
|
+
#import "RNSkiaModule.h"
|
4
|
+
#import "SkiaUIView.h"
|
5
|
+
|
6
|
+
#include <utility>
|
7
|
+
#include <vector>
|
8
|
+
|
9
|
+
#import "RNSkManager.h"
|
10
|
+
|
11
|
+
@implementation SkiaUIView {
|
12
|
+
std::shared_ptr<RNSkBaseAppleView> _impl;
|
13
|
+
RNSkia::RNSkManager *_manager;
|
14
|
+
std::function<std::shared_ptr<RNSkBaseAppleView>(
|
15
|
+
std::shared_ptr<RNSkia::RNSkPlatformContext>)>
|
16
|
+
_factory;
|
17
|
+
bool _debugMode;
|
18
|
+
bool _opaque;
|
19
|
+
size_t _nativeId;
|
20
|
+
}
|
21
|
+
|
22
|
+
#pragma mark Initialization and destruction
|
23
|
+
|
24
|
+
- (instancetype)initWithManager:(RNSkia::RNSkManager *)manager
|
25
|
+
factory:
|
26
|
+
(std::function<std::shared_ptr<RNSkBaseAppleView>(
|
27
|
+
std::shared_ptr<RNSkia::RNSkPlatformContext>)>)
|
28
|
+
factory {
|
29
|
+
self = [super init];
|
30
|
+
if (self) {
|
31
|
+
[self initCommon:manager factory:factory];
|
32
|
+
}
|
33
|
+
// Listen to notifications about module invalidation
|
34
|
+
[[NSNotificationCenter defaultCenter]
|
35
|
+
addObserver:self
|
36
|
+
selector:@selector(willInvalidateModules)
|
37
|
+
name:RCTBridgeWillInvalidateModulesNotification
|
38
|
+
object:nil];
|
39
|
+
return self;
|
40
|
+
}
|
41
|
+
|
42
|
+
- (void)initCommon:(RNSkia::RNSkManager *)manager
|
43
|
+
factory:(std::function<std::shared_ptr<RNSkBaseAppleView>(
|
44
|
+
std::shared_ptr<RNSkia::RNSkPlatformContext>)>)factory {
|
45
|
+
_manager = manager;
|
46
|
+
_nativeId = 0;
|
47
|
+
_debugMode = false;
|
48
|
+
_factory = factory;
|
49
|
+
}
|
50
|
+
|
51
|
+
- (void)willInvalidateModules {
|
52
|
+
_impl = nullptr;
|
53
|
+
_manager = nullptr;
|
54
|
+
}
|
55
|
+
|
56
|
+
#pragma mark Lifecycle
|
57
|
+
|
58
|
+
#if !TARGET_OS_OSX
|
59
|
+
- (void)willMoveToSuperview:(UIView *)newSuperView {
|
60
|
+
#else
|
61
|
+
- (void)viewWillMoveToSuperview:(NSView *)newSuperView {
|
62
|
+
#endif // !TARGET_OS_OSX
|
63
|
+
if (newSuperView != nullptr) {
|
64
|
+
// Create implementation view when the parent view is set
|
65
|
+
if (_impl == nullptr && _manager != nullptr) {
|
66
|
+
_impl = _factory(_manager->getPlatformContext());
|
67
|
+
if (_impl == nullptr) {
|
68
|
+
throw std::runtime_error(
|
69
|
+
"Expected Skia view implementation, got nullptr.");
|
70
|
+
}
|
71
|
+
[self.layer addSublayer:_impl->getLayer()];
|
72
|
+
if (_nativeId != 0) {
|
73
|
+
_manager->setSkiaView(_nativeId, _impl->getDrawView());
|
74
|
+
}
|
75
|
+
_impl->getDrawView()->setShowDebugOverlays(_debugMode);
|
76
|
+
}
|
77
|
+
}
|
78
|
+
}
|
79
|
+
|
80
|
+
- (void)removeFromSuperview {
|
81
|
+
// Cleanup when removed from view hierarchy
|
82
|
+
if (_impl != nullptr) {
|
83
|
+
[_impl->getLayer() removeFromSuperlayer];
|
84
|
+
|
85
|
+
if (_nativeId != 0 && _manager != nullptr) {
|
86
|
+
_manager->setSkiaView(_nativeId, nullptr);
|
87
|
+
}
|
88
|
+
|
89
|
+
_impl = nullptr;
|
90
|
+
}
|
91
|
+
|
92
|
+
[super removeFromSuperview];
|
93
|
+
}
|
94
|
+
|
95
|
+
- (void)dealloc {
|
96
|
+
[self unregisterView];
|
97
|
+
[[NSNotificationCenter defaultCenter]
|
98
|
+
removeObserver:self
|
99
|
+
name:RCTBridgeWillInvalidateModulesNotification
|
100
|
+
object:nil];
|
101
|
+
}
|
102
|
+
|
103
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
104
|
+
- (void)prepareForRecycle {
|
105
|
+
[super prepareForRecycle];
|
106
|
+
[self unregisterView];
|
107
|
+
}
|
108
|
+
|
109
|
+
- (void)finalizeUpdates:(RNComponentViewUpdateMask)updateMask {
|
110
|
+
[super finalizeUpdates:updateMask];
|
111
|
+
if (updateMask == RNComponentViewUpdateMaskAll) {
|
112
|
+
// this flag is only set when the view is inserted and we want to set the
|
113
|
+
// manager here since the view could be recycled or the app could be
|
114
|
+
// refreshed and we would have a stale manager then
|
115
|
+
_manager = [SkiaManager latestActiveSkManager].get();
|
116
|
+
}
|
117
|
+
}
|
118
|
+
#endif // RCT_NEW_ARCH_ENABLED
|
119
|
+
|
120
|
+
- (void)unregisterView {
|
121
|
+
if (_manager != nullptr && _nativeId != 0) {
|
122
|
+
_manager->unregisterSkiaView(_nativeId);
|
123
|
+
}
|
124
|
+
}
|
125
|
+
|
126
|
+
#pragma Render
|
127
|
+
|
128
|
+
- (void)drawRect:(CGRect)rect {
|
129
|
+
// We override drawRect to ensure we to direct rendering when the
|
130
|
+
// underlying OS view needs to render:
|
131
|
+
if (_impl != nullptr) {
|
132
|
+
_impl->getDrawView()->redraw();
|
133
|
+
}
|
134
|
+
}
|
135
|
+
|
136
|
+
#pragma mark Layout
|
137
|
+
|
138
|
+
- (void)layoutSubviews {
|
139
|
+
[super layoutSubviews];
|
140
|
+
if (_impl != nullptr) {
|
141
|
+
_impl->setSize(self.bounds.size.width, self.bounds.size.height);
|
142
|
+
}
|
143
|
+
}
|
144
|
+
|
145
|
+
#pragma mark Properties
|
146
|
+
|
147
|
+
- (void)setDebugMode:(bool)debugMode {
|
148
|
+
_debugMode = debugMode;
|
149
|
+
if (_impl != nullptr) {
|
150
|
+
_impl->getDrawView()->setShowDebugOverlays(debugMode);
|
151
|
+
}
|
152
|
+
}
|
153
|
+
|
154
|
+
- (void)setOpaque:(bool)opaque {
|
155
|
+
_opaque = opaque;
|
156
|
+
}
|
157
|
+
|
158
|
+
- (void)setNativeId:(size_t)nativeId {
|
159
|
+
_nativeId = nativeId;
|
160
|
+
|
161
|
+
if (_impl != nullptr) {
|
162
|
+
_manager->registerSkiaView(nativeId, _impl->getDrawView());
|
163
|
+
}
|
164
|
+
}
|
165
|
+
|
166
|
+
#pragma mark External API
|
167
|
+
|
168
|
+
- (std::shared_ptr<RNSkBaseAppleView>)impl {
|
169
|
+
return _impl;
|
170
|
+
}
|
171
|
+
|
172
|
+
@end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
#pragma once
|
2
|
+
|
3
|
+
#import <CoreFoundation/CoreFoundation.h>
|
4
|
+
#if !TARGET_OS_OSX
|
5
|
+
#import <UIKit/UIKit.h>
|
6
|
+
#else
|
7
|
+
#import <Appkit/Appkit.h>
|
8
|
+
#endif // !TARGET_OS_OSX
|
9
|
+
|
10
|
+
#import <React/RCTUIManager.h>
|
11
|
+
|
12
|
+
#pragma clang diagnostic push
|
13
|
+
#pragma clang diagnostic ignored "-Wdocumentation"
|
14
|
+
|
15
|
+
#include "include/core/SkImage.h"
|
16
|
+
|
17
|
+
#pragma clang diagnostic pop
|
18
|
+
|
19
|
+
@interface ViewScreenshotService : NSObject {
|
20
|
+
}
|
21
|
+
|
22
|
+
- (instancetype)initWithUiManager:(RCTUIManager *)uiManager;
|
23
|
+
- (sk_sp<SkImage>)screenshotOfViewWithTag:(NSNumber *)viewTag;
|
24
|
+
|
25
|
+
@end
|
@@ -0,0 +1,89 @@
|
|
1
|
+
#import "ViewScreenshotService.h"
|
2
|
+
#import <QuartzCore/QuartzCore.h>
|
3
|
+
|
4
|
+
#pragma clang diagnostic push
|
5
|
+
#pragma clang diagnostic ignored "-Wdocumentation"
|
6
|
+
|
7
|
+
#include "include/core/SkData.h"
|
8
|
+
|
9
|
+
#pragma clang diagnostic pop
|
10
|
+
|
11
|
+
@implementation ViewScreenshotService {
|
12
|
+
RCTUIManager *_uiManager;
|
13
|
+
}
|
14
|
+
|
15
|
+
- (instancetype)initWithUiManager:(RCTUIManager *)uiManager {
|
16
|
+
if (self = [super init]) {
|
17
|
+
_uiManager = uiManager;
|
18
|
+
}
|
19
|
+
return self;
|
20
|
+
}
|
21
|
+
|
22
|
+
- (sk_sp<SkImage>)screenshotOfViewWithTag:(NSNumber *)viewTag {
|
23
|
+
#if !TARGET_OS_OSX
|
24
|
+
// Find view corresponding to the tag
|
25
|
+
auto view = [_uiManager viewForReactTag:viewTag];
|
26
|
+
if (view == NULL) {
|
27
|
+
RCTFatal(RCTErrorWithMessage(@"Could not find view with tag"));
|
28
|
+
return nullptr;
|
29
|
+
}
|
30
|
+
|
31
|
+
// Get size
|
32
|
+
CGSize size = view.frame.size;
|
33
|
+
|
34
|
+
// Setup context
|
35
|
+
UIGraphicsImageRendererFormat *format =
|
36
|
+
[UIGraphicsImageRendererFormat defaultFormat];
|
37
|
+
format.opaque = NO;
|
38
|
+
format.preferredRange = UIGraphicsImageRendererFormatRangeStandard;
|
39
|
+
|
40
|
+
UIGraphicsImageRenderer *renderer =
|
41
|
+
[[UIGraphicsImageRenderer alloc] initWithSize:size format:format];
|
42
|
+
|
43
|
+
// Render to context - this is now the only part of this function that shows
|
44
|
+
// up in the profiler!
|
45
|
+
UIImage *image = [renderer
|
46
|
+
imageWithActions:^(UIGraphicsImageRendererContext *_Nonnull context) {
|
47
|
+
[view drawViewHierarchyInRect:(CGRect){CGPointZero, size}
|
48
|
+
afterScreenUpdates:YES];
|
49
|
+
}];
|
50
|
+
|
51
|
+
// Convert from UIImage -> CGImage -> SkImage
|
52
|
+
CGImageRef cgImage = image.CGImage;
|
53
|
+
|
54
|
+
// Get some info about the image
|
55
|
+
auto width = CGImageGetWidth(cgImage);
|
56
|
+
auto height = CGImageGetHeight(cgImage);
|
57
|
+
auto bytesPerRow = CGImageGetBytesPerRow(cgImage);
|
58
|
+
|
59
|
+
// Convert from UIImage -> SkImage, start by getting the pixels directly from
|
60
|
+
// the CGImage:
|
61
|
+
auto dataRef = CGDataProviderCopyData(CGImageGetDataProvider(cgImage));
|
62
|
+
auto length = CFDataGetLength(dataRef);
|
63
|
+
void *data = CFDataGetMutableBytePtr((CFMutableDataRef)dataRef);
|
64
|
+
|
65
|
+
// Now we'll capture the data in an SkData object and control releasing it:
|
66
|
+
auto skData = SkData::MakeWithProc(
|
67
|
+
data, length,
|
68
|
+
[](const void *ptr, void *context) {
|
69
|
+
CFDataRef dataRef = (CFDataRef)context;
|
70
|
+
CFRelease(dataRef);
|
71
|
+
},
|
72
|
+
(void *)dataRef);
|
73
|
+
|
74
|
+
// Make SkImageInfo
|
75
|
+
// We're using kBGRA_8888_SkColorType since this is what we get when the
|
76
|
+
// UIGraphicsImageRenderer uses the standard format (the extended is using
|
77
|
+
// 64bits so it is not suitable for us).
|
78
|
+
SkImageInfo info =
|
79
|
+
SkImageInfo::Make(static_cast<int>(width), static_cast<int>(height),
|
80
|
+
kBGRA_8888_SkColorType, kPremul_SkAlphaType);
|
81
|
+
|
82
|
+
// ... and then create the SkImage itself!
|
83
|
+
return SkImages::RasterFromData(info, skData, bytesPerRow);
|
84
|
+
#else
|
85
|
+
return nullptr;
|
86
|
+
#endif // !TARGET_OS_OSX
|
87
|
+
}
|
88
|
+
|
89
|
+
@end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import type { CanvasKit, EmbindEnumEntity
|
1
|
+
import type { CanvasKit, EmbindEnumEntity } from "canvaskit-wasm";
|
2
2
|
import type { SkJSIInstance } from "../types";
|
3
3
|
export declare const throwNotImplementedOnRNWeb: <T>() => T;
|
4
4
|
export declare abstract class Host {
|
@@ -14,5 +14,5 @@ export declare abstract class BaseHostObject<T, N extends string> extends Host i
|
|
14
14
|
export declare abstract class HostObject<T, N extends string> extends BaseHostObject<T, N> {
|
15
15
|
static fromValue<T>(value: SkJSIInstance<string>): T;
|
16
16
|
}
|
17
|
-
export declare const getEnum: (
|
18
|
-
export declare const optEnum: (
|
17
|
+
export declare const getEnum: (CanvasKit: CanvasKit, name: keyof CanvasKit, v: number) => EmbindEnumEntity;
|
18
|
+
export declare const optEnum: (CanvasKit: CanvasKit, name: keyof CanvasKit, v: number | undefined) => EmbindEnumEntity | undefined;
|
@@ -37,10 +37,22 @@ class HostObject extends BaseHostObject {
|
|
37
37
|
}
|
38
38
|
}
|
39
39
|
exports.HostObject = HostObject;
|
40
|
-
const getEnum = (
|
41
|
-
|
42
|
-
|
40
|
+
const getEnum = (CanvasKit, name, v) => {
|
41
|
+
const e = CanvasKit[name];
|
42
|
+
if (typeof e !== "function") {
|
43
|
+
throw new Error(`${name} is not an number`);
|
44
|
+
}
|
45
|
+
const result = Object.values(e).find(({
|
46
|
+
value
|
47
|
+
}) => value === v);
|
48
|
+
if (!result) {
|
49
|
+
throw new Error(`Enum ${name} does not have value ${v} on React Native Web`);
|
50
|
+
}
|
51
|
+
return result;
|
52
|
+
};
|
43
53
|
exports.getEnum = getEnum;
|
44
|
-
const optEnum = (
|
54
|
+
const optEnum = (CanvasKit, name, v) => {
|
55
|
+
return v === undefined ? undefined : getEnum(CanvasKit, name, v);
|
56
|
+
};
|
45
57
|
exports.optEnum = optEnum;
|
46
58
|
//# sourceMappingURL=Host.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["throwNotImplementedOnRNWeb","jest","fn","Error","exports","Host","constructor","CanvasKit","_defineProperty","BaseHostObject","ref","typename","__typename__","HostObject","fromValue","value","getEnum","
|
1
|
+
{"version":3,"names":["throwNotImplementedOnRNWeb","jest","fn","Error","exports","Host","constructor","CanvasKit","_defineProperty","BaseHostObject","ref","typename","__typename__","HostObject","fromValue","value","getEnum","name","v","e","result","Object","values","find","optEnum","undefined"],"sources":["Host.ts"],"sourcesContent":["import type { CanvasKit, EmbindEnumEntity } from \"canvaskit-wasm\";\n\nimport type { SkJSIInstance } from \"../types\";\n\nexport const throwNotImplementedOnRNWeb = <T>(): T => {\n if (typeof jest !== \"undefined\") {\n return jest.fn() as unknown as T;\n }\n throw new Error(\"Not implemented on React Native Web\");\n};\n\nexport abstract class Host {\n readonly CanvasKit: CanvasKit;\n\n constructor(CanvasKit: CanvasKit) {\n this.CanvasKit = CanvasKit;\n }\n}\n\nexport abstract class BaseHostObject<T, N extends string>\n extends Host\n implements SkJSIInstance<N>\n{\n readonly __typename__: N;\n ref: T;\n\n constructor(CanvasKit: CanvasKit, ref: T, typename: N) {\n super(CanvasKit);\n this.ref = ref;\n this.__typename__ = typename;\n }\n\n abstract dispose(): void;\n}\n\nexport abstract class HostObject<T, N extends string> extends BaseHostObject<\n T,\n N\n> {\n static fromValue<T>(value: SkJSIInstance<string>) {\n return (value as HostObject<T, string>).ref;\n }\n}\n\nexport const getEnum = (\n CanvasKit: CanvasKit,\n name: keyof CanvasKit,\n v: number\n): EmbindEnumEntity => {\n const e = CanvasKit[name];\n if (typeof e !== \"function\") {\n throw new Error(`${name} is not an number`);\n }\n const result = Object.values(e).find(({ value }) => value === v);\n if (!result) {\n throw new Error(\n `Enum ${name} does not have value ${v} on React Native Web`\n );\n }\n return result;\n};\n\nexport const optEnum = (\n CanvasKit: CanvasKit,\n name: keyof CanvasKit,\n v: number | undefined\n): EmbindEnumEntity | undefined => {\n return v === undefined ? undefined : getEnum(CanvasKit, name, v);\n};\n"],"mappings":";;;;;;;;;AAIO,MAAMA,0BAA0B,GAAGA,CAAA,KAAY;EACpD,IAAI,OAAOC,IAAI,KAAK,WAAW,EAAE;IAC/B,OAAOA,IAAI,CAACC,EAAE,CAAC,CAAC;EAClB;EACA,MAAM,IAAIC,KAAK,CAAC,qCAAqC,CAAC;AACxD,CAAC;AAACC,OAAA,CAAAJ,0BAAA,GAAAA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CAAqB,KACY;EACjC,OAAOA,CAAC,KAAKO,SAAS,GAAGA,SAAS,GAAGT,OAAO,CAACT,SAAS,EAAEU,IAAI,EAAEC,CAAC,CAAC;AAClE,CAAC;AAACd,OAAA,CAAAoB,OAAA,GAAAA,OAAA","ignoreList":[]}
|
@@ -42,16 +42,16 @@ class JsiSkCanvas extends _Host.HostObject {
|
|
42
42
|
this.ref.drawImageCubic(_JsiSkImage.JsiSkImage.fromValue(img), left, top, B, C, paint ? _JsiSkPaint.JsiSkPaint.fromValue(paint) : paint);
|
43
43
|
}
|
44
44
|
drawImageOptions(img, left, top, fm, mm, paint) {
|
45
|
-
this.ref.drawImageOptions(_JsiSkImage.JsiSkImage.fromValue(img), left, top, (0, _Host.getEnum)(this.CanvasKit
|
45
|
+
this.ref.drawImageOptions(_JsiSkImage.JsiSkImage.fromValue(img), left, top, (0, _Host.getEnum)(this.CanvasKit, "FilterMode", fm), (0, _Host.getEnum)(this.CanvasKit, "MipmapMode", mm), paint ? _JsiSkPaint.JsiSkPaint.fromValue(paint) : paint);
|
46
46
|
}
|
47
47
|
drawImageNine(img, center, dest, filter, paint) {
|
48
|
-
this.ref.drawImageNine(_JsiSkImage.JsiSkImage.fromValue(img), Array.from(_JsiSkRect.JsiSkRect.fromValue(this.CanvasKit, center)), _JsiSkRect.JsiSkRect.fromValue(this.CanvasKit, dest), (0, _Host.getEnum)(this.CanvasKit
|
48
|
+
this.ref.drawImageNine(_JsiSkImage.JsiSkImage.fromValue(img), Array.from(_JsiSkRect.JsiSkRect.fromValue(this.CanvasKit, center)), _JsiSkRect.JsiSkRect.fromValue(this.CanvasKit, dest), (0, _Host.getEnum)(this.CanvasKit, "FilterMode", filter), paint ? _JsiSkPaint.JsiSkPaint.fromValue(paint) : paint);
|
49
49
|
}
|
50
50
|
drawImageRectCubic(img, src, dest, B, C, paint) {
|
51
51
|
this.ref.drawImageRectCubic(_JsiSkImage.JsiSkImage.fromValue(img), _JsiSkRect.JsiSkRect.fromValue(this.CanvasKit, src), _JsiSkRect.JsiSkRect.fromValue(this.CanvasKit, dest), B, C, paint ? _JsiSkPaint.JsiSkPaint.fromValue(paint) : paint);
|
52
52
|
}
|
53
53
|
drawImageRectOptions(img, src, dest, fm, mm, paint) {
|
54
|
-
this.ref.drawImageRectOptions(_JsiSkImage.JsiSkImage.fromValue(img), _JsiSkRect.JsiSkRect.fromValue(this.CanvasKit, src), _JsiSkRect.JsiSkRect.fromValue(this.CanvasKit, dest), (0, _Host.getEnum)(this.CanvasKit
|
54
|
+
this.ref.drawImageRectOptions(_JsiSkImage.JsiSkImage.fromValue(img), _JsiSkRect.JsiSkRect.fromValue(this.CanvasKit, src), _JsiSkRect.JsiSkRect.fromValue(this.CanvasKit, dest), (0, _Host.getEnum)(this.CanvasKit, "FilterMode", fm), (0, _Host.getEnum)(this.CanvasKit, "MipmapMode", mm), paint ? _JsiSkPaint.JsiSkPaint.fromValue(paint) : paint);
|
55
55
|
}
|
56
56
|
drawPaint(paint) {
|
57
57
|
this.ref.drawPaint(_JsiSkPaint.JsiSkPaint.fromValue(paint));
|
@@ -63,19 +63,19 @@ class JsiSkCanvas extends _Host.HostObject {
|
|
63
63
|
this.ref.drawCircle(cx, cy, radius, _JsiSkPaint.JsiSkPaint.fromValue(paint));
|
64
64
|
}
|
65
65
|
drawVertices(verts, mode, paint) {
|
66
|
-
this.ref.drawVertices(_JsiSkVertices.JsiSkVertices.fromValue(verts), (0, _Host.getEnum)(this.CanvasKit
|
66
|
+
this.ref.drawVertices(_JsiSkVertices.JsiSkVertices.fromValue(verts), (0, _Host.getEnum)(this.CanvasKit, "BlendMode", mode), _JsiSkPaint.JsiSkPaint.fromValue(paint));
|
67
67
|
}
|
68
68
|
drawPatch(cubics, colors, texs, mode, paint) {
|
69
69
|
this.ref.drawPatch(cubics.map(({
|
70
70
|
x,
|
71
71
|
y
|
72
|
-
}) => [x, y]).flat(), colors, texs ? texs.flatMap(p => Array.from(_JsiSkPoint.JsiSkPoint.fromValue(p))) : texs, mode ? (0, _Host.getEnum)(this.CanvasKit
|
72
|
+
}) => [x, y]).flat(), colors, texs ? texs.flatMap(p => Array.from(_JsiSkPoint.JsiSkPoint.fromValue(p))) : texs, mode ? (0, _Host.getEnum)(this.CanvasKit, "BlendMode", mode) : null, paint ? _JsiSkPaint.JsiSkPaint.fromValue(paint) : undefined);
|
73
73
|
}
|
74
74
|
restoreToCount(saveCount) {
|
75
75
|
this.ref.restoreToCount(saveCount);
|
76
76
|
}
|
77
77
|
drawPoints(mode, points, paint) {
|
78
|
-
this.ref.drawPoints((0, _Host.getEnum)(this.CanvasKit
|
78
|
+
this.ref.drawPoints((0, _Host.getEnum)(this.CanvasKit, "PointMode", mode), points.map(({
|
79
79
|
x,
|
80
80
|
y
|
81
81
|
}) => [x, y]).flat(), _JsiSkPaint.JsiSkPaint.fromValue(paint));
|
@@ -130,19 +130,19 @@ class JsiSkCanvas extends _Host.HostObject {
|
|
130
130
|
this.ref.translate(dx, dy);
|
131
131
|
}
|
132
132
|
drawColor(color, blendMode) {
|
133
|
-
this.ref.drawColor(color, blendMode ? (0, _Host.getEnum)(this.CanvasKit
|
133
|
+
this.ref.drawColor(color, blendMode ? (0, _Host.getEnum)(this.CanvasKit, "BlendMode", blendMode) : undefined);
|
134
134
|
}
|
135
135
|
clear(color) {
|
136
136
|
this.ref.clear(color);
|
137
137
|
}
|
138
138
|
clipPath(path, op, doAntiAlias) {
|
139
|
-
this.ref.clipPath(_JsiSkPath.JsiSkPath.fromValue(path), (0, _Host.getEnum)(this.CanvasKit
|
139
|
+
this.ref.clipPath(_JsiSkPath.JsiSkPath.fromValue(path), (0, _Host.getEnum)(this.CanvasKit, "PathOp", op), doAntiAlias);
|
140
140
|
}
|
141
141
|
clipRect(rect, op, doAntiAlias) {
|
142
|
-
this.ref.clipRect(_JsiSkRect.JsiSkRect.fromValue(this.CanvasKit, rect), (0, _Host.getEnum)(this.CanvasKit
|
142
|
+
this.ref.clipRect(_JsiSkRect.JsiSkRect.fromValue(this.CanvasKit, rect), (0, _Host.getEnum)(this.CanvasKit, "PathOp", op), doAntiAlias);
|
143
143
|
}
|
144
144
|
clipRRect(rrect, op, doAntiAlias) {
|
145
|
-
this.ref.clipRRect(_JsiSkRRect.JsiSkRRect.fromValue(this.CanvasKit, rrect), (0, _Host.getEnum)(this.CanvasKit
|
145
|
+
this.ref.clipRRect(_JsiSkRRect.JsiSkRRect.fromValue(this.CanvasKit, rrect), (0, _Host.getEnum)(this.CanvasKit, "PathOp", op), doAntiAlias);
|
146
146
|
}
|
147
147
|
concat(m) {
|
148
148
|
this.ref.concat(Array.isArray(m) ? m : _JsiSkMatrix.JsiSkMatrix.fromValue(m));
|
@@ -169,19 +169,19 @@ class JsiSkCanvas extends _Host.HostObject {
|
|
169
169
|
ckSampling = sampling;
|
170
170
|
} else if (sampling) {
|
171
171
|
ckSampling = {
|
172
|
-
filter: (0, _Host.getEnum)(this.CanvasKit
|
173
|
-
mipmap: sampling.mipmap ? (0, _Host.getEnum)(this.CanvasKit
|
172
|
+
filter: (0, _Host.getEnum)(this.CanvasKit, "FilterMode", sampling.filter),
|
173
|
+
mipmap: sampling.mipmap ? (0, _Host.getEnum)(this.CanvasKit, "MipmapMode", sampling.mipmap) : this.CanvasKit.MipmapMode.None
|
174
174
|
};
|
175
175
|
}
|
176
|
-
this.ref.drawAtlas(_JsiSkImage.JsiSkImage.fromValue(atlas), src, dst, _JsiSkPaint.JsiSkPaint.fromValue(paint), blendMode ? (0, _Host.getEnum)(this.CanvasKit
|
176
|
+
this.ref.drawAtlas(_JsiSkImage.JsiSkImage.fromValue(atlas), src, dst, _JsiSkPaint.JsiSkPaint.fromValue(paint), blendMode ? (0, _Host.getEnum)(this.CanvasKit, "BlendMode", blendMode) : this.CanvasKit.BlendMode.DstOver, cls, ckSampling);
|
177
177
|
}
|
178
178
|
readPixels(srcX, srcY, imageInfo) {
|
179
179
|
const pxInfo = {
|
180
180
|
width: imageInfo.width,
|
181
181
|
height: imageInfo.height,
|
182
182
|
colorSpace: this.CanvasKit.ColorSpace.SRGB,
|
183
|
-
alphaType: (0, _Host.getEnum)(this.CanvasKit
|
184
|
-
colorType: (0, _Host.getEnum)(this.CanvasKit
|
183
|
+
alphaType: (0, _Host.getEnum)(this.CanvasKit, "AlphaType", imageInfo.alphaType),
|
184
|
+
colorType: (0, _Host.getEnum)(this.CanvasKit, "ColorType", imageInfo.colorType)
|
185
185
|
};
|
186
186
|
return this.ref.readPixels(srcX, srcY, pxInfo);
|
187
187
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_types","require","_Host","_JsiSkPaint","_JsiSkRect","_JsiSkRRect","_JsiSkImage","_JsiSkVertices","_JsiSkPath","_JsiSkFont","_JsiSkTextBlob","_JsiSkPicture","_JsiSkMatrix","_JsiSkImageFilter","_JsiSkPoint","_JsiSkRSXform","_defineProperty","e","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","JsiSkCanvas","HostObject","constructor","CanvasKit","ref","delete","drawRect","rect","paint","JsiSkRect","fromValue","JsiSkPaint","drawImage","image","x","y","JsiSkImage","drawImageRect","img","src","dest","fastSample","drawImageCubic","left","top","B","C","drawImageOptions","fm","mm","getEnum","FilterMode","MipmapMode","drawImageNine","center","filter","Array","from","drawImageRectCubic","drawImageRectOptions","drawPaint","drawLine","x0","y0","x1","y1","drawCircle","cx","cy","radius","drawVertices","verts","mode","JsiSkVertices","BlendMode","drawPatch","cubics","colors","texs","map","flat","flatMap","p","JsiSkPoint","undefined","restoreToCount","saveCount","drawPoints","points","PointMode","drawArc","oval","startAngle","sweepAngle","useCenter","drawRRect","rrect","JsiSkRRect","drawDRRect","outer","inner","drawOval","drawPath","path","JsiSkPath","drawText","str","font","JsiSkFont","drawTextBlob","blob","JsiSkTextBlob","drawGlyphs","glyphs","positions","drawSvg","svg","_width","_height","MakeImageFromCanvasImageSource","save","saveLayer","bounds","backdrop","flags","JsiSkImageFilter","restore","rotate","rotationInDegrees","rx","ry","scale","sx","sy","skew","translate","dx","dy","drawColor","color","blendMode","clear","clipPath","op","doAntiAlias","PathOp","clipRect","clipRRect","concat","m","isArray","JsiSkMatrix","drawPicture","skp","JsiSkPicture","drawAtlas","atlas","srcs","dsts","sampling","s","dst","JsiSkRSXform","cls","Uint32Array","length","g","b","a","ColorAsInt","ckSampling","Linear","mipmap","None","isCubicSampling","DstOver","readPixels","srcX","srcY","imageInfo","pxInfo","width","height","colorSpace","ColorSpace","SRGB","alphaType","AlphaType","colorType","ColorType","exports"],"sources":["JsiSkCanvas.ts"],"sourcesContent":["import type {\n Canvas,\n CanvasKit,\n CubicResampler as CKCubicResampler,\n FilterOptions as CKFilterOptions,\n} from \"canvaskit-wasm\";\n\nimport {\n type BlendMode,\n type ClipOp,\n type FilterMode,\n type MipmapMode,\n type PointMode,\n type SaveLayerFlag,\n type ImageInfo,\n type SkCanvas,\n type SkColor,\n type SkFont,\n type SkImage,\n type SkImageFilter,\n type SkMatrix,\n type SkPaint,\n type SkPath,\n type SkPicture,\n type SkPoint,\n type SkRect,\n type InputRRect,\n type SkSVG,\n type SkTextBlob,\n type SkVertices,\n type SkRSXform,\n type CubicResampler,\n type FilterOptions,\n isCubicSampling,\n} from \"../types\";\n\nimport { getEnum, HostObject } from \"./Host\";\nimport { JsiSkPaint } from \"./JsiSkPaint\";\nimport { JsiSkRect } from \"./JsiSkRect\";\nimport { JsiSkRRect } from \"./JsiSkRRect\";\nimport { JsiSkImage } from \"./JsiSkImage\";\nimport { JsiSkVertices } from \"./JsiSkVertices\";\nimport { JsiSkPath } from \"./JsiSkPath\";\nimport { JsiSkFont } from \"./JsiSkFont\";\nimport { JsiSkTextBlob } from \"./JsiSkTextBlob\";\nimport { JsiSkPicture } from \"./JsiSkPicture\";\nimport { JsiSkMatrix } from \"./JsiSkMatrix\";\nimport { JsiSkImageFilter } from \"./JsiSkImageFilter\";\nimport { JsiSkPoint } from \"./JsiSkPoint\";\nimport { JsiSkRSXform } from \"./JsiSkRSXform\";\nimport type { JsiSkSVG } from \"./JsiSkSVG\";\n\nexport class JsiSkCanvas\n extends HostObject<Canvas, \"Canvas\">\n implements SkCanvas\n{\n constructor(CanvasKit: CanvasKit, ref: Canvas) {\n super(CanvasKit, ref, \"Canvas\");\n }\n\n dispose = () => {\n this.ref.delete();\n };\n\n drawRect(rect: SkRect, paint: SkPaint) {\n this.ref.drawRect(\n JsiSkRect.fromValue(this.CanvasKit, rect),\n JsiSkPaint.fromValue(paint)\n );\n }\n\n drawImage(image: SkImage, x: number, y: number, paint?: SkPaint) {\n this.ref.drawImage(\n JsiSkImage.fromValue(image),\n x,\n y,\n paint ? JsiSkPaint.fromValue(paint) : paint\n );\n }\n\n drawImageRect(\n img: SkImage,\n src: SkRect,\n dest: SkRect,\n paint: SkPaint,\n fastSample?: boolean\n ) {\n this.ref.drawImageRect(\n JsiSkImage.fromValue(img),\n JsiSkRect.fromValue(this.CanvasKit, src),\n JsiSkRect.fromValue(this.CanvasKit, dest),\n JsiSkPaint.fromValue(paint),\n fastSample\n );\n }\n\n drawImageCubic(\n img: SkImage,\n left: number,\n top: number,\n B: number,\n C: number,\n paint?: SkPaint | null\n ) {\n this.ref.drawImageCubic(\n JsiSkImage.fromValue(img),\n left,\n top,\n B,\n C,\n paint ? JsiSkPaint.fromValue(paint) : paint\n );\n }\n\n drawImageOptions(\n img: SkImage,\n left: number,\n top: number,\n fm: FilterMode,\n mm: MipmapMode,\n paint?: SkPaint | null\n ) {\n this.ref.drawImageOptions(\n JsiSkImage.fromValue(img),\n left,\n top,\n getEnum(this.CanvasKit.FilterMode, fm),\n getEnum(this.CanvasKit.MipmapMode, mm),\n paint ? JsiSkPaint.fromValue(paint) : paint\n );\n }\n\n drawImageNine(\n img: SkImage,\n center: SkRect,\n dest: SkRect,\n filter: FilterMode,\n paint?: SkPaint | null\n ) {\n this.ref.drawImageNine(\n JsiSkImage.fromValue(img),\n Array.from(JsiSkRect.fromValue(this.CanvasKit, center)),\n JsiSkRect.fromValue(this.CanvasKit, dest),\n getEnum(this.CanvasKit.FilterMode, filter),\n paint ? JsiSkPaint.fromValue(paint) : paint\n );\n }\n\n drawImageRectCubic(\n img: SkImage,\n src: SkRect,\n dest: SkRect,\n B: number,\n C: number,\n paint?: SkPaint | null\n ) {\n this.ref.drawImageRectCubic(\n JsiSkImage.fromValue(img),\n JsiSkRect.fromValue(this.CanvasKit, src),\n JsiSkRect.fromValue(this.CanvasKit, dest),\n B,\n C,\n paint ? JsiSkPaint.fromValue(paint) : paint\n );\n }\n\n drawImageRectOptions(\n img: SkImage,\n src: SkRect,\n dest: SkRect,\n fm: FilterMode,\n mm: MipmapMode,\n paint?: SkPaint | null\n ) {\n this.ref.drawImageRectOptions(\n JsiSkImage.fromValue(img),\n JsiSkRect.fromValue(this.CanvasKit, src),\n JsiSkRect.fromValue(this.CanvasKit, dest),\n getEnum(this.CanvasKit.FilterMode, fm),\n getEnum(this.CanvasKit.MipmapMode, mm),\n paint ? JsiSkPaint.fromValue(paint) : paint\n );\n }\n\n drawPaint(paint: SkPaint) {\n this.ref.drawPaint(JsiSkPaint.fromValue(paint));\n }\n\n drawLine(x0: number, y0: number, x1: number, y1: number, paint: SkPaint) {\n this.ref.drawLine(x0, y0, x1, y1, JsiSkPaint.fromValue(paint));\n }\n\n drawCircle(cx: number, cy: number, radius: number, paint: SkPaint) {\n this.ref.drawCircle(cx, cy, radius, JsiSkPaint.fromValue(paint));\n }\n\n drawVertices(verts: SkVertices, mode: BlendMode, paint: SkPaint) {\n this.ref.drawVertices(\n JsiSkVertices.fromValue(verts),\n getEnum(this.CanvasKit.BlendMode, mode),\n JsiSkPaint.fromValue(paint)\n );\n }\n\n drawPatch(\n cubics: SkPoint[],\n colors?: SkColor[] | null,\n texs?: SkPoint[] | null,\n mode?: BlendMode | null,\n paint?: SkPaint\n ) {\n this.ref.drawPatch(\n cubics.map(({ x, y }) => [x, y]).flat(),\n colors,\n texs ? texs.flatMap((p) => Array.from(JsiSkPoint.fromValue(p))) : texs,\n mode ? getEnum(this.CanvasKit.BlendMode, mode) : null,\n paint ? JsiSkPaint.fromValue(paint) : undefined\n );\n }\n\n restoreToCount(saveCount: number) {\n this.ref.restoreToCount(saveCount);\n }\n\n drawPoints(mode: PointMode, points: SkPoint[], paint: SkPaint) {\n this.ref.drawPoints(\n getEnum(this.CanvasKit.PointMode, mode),\n points.map(({ x, y }) => [x, y]).flat(),\n JsiSkPaint.fromValue(paint)\n );\n }\n\n drawArc(\n oval: SkRect,\n startAngle: number,\n sweepAngle: number,\n useCenter: boolean,\n paint: SkPaint\n ) {\n this.ref.drawArc(\n JsiSkRect.fromValue(this.CanvasKit, oval),\n startAngle,\n sweepAngle,\n useCenter,\n JsiSkPaint.fromValue(paint)\n );\n }\n\n drawRRect(rrect: InputRRect, paint: SkPaint) {\n this.ref.drawRRect(\n JsiSkRRect.fromValue(this.CanvasKit, rrect),\n JsiSkPaint.fromValue(paint)\n );\n }\n\n drawDRRect(outer: InputRRect, inner: InputRRect, paint: SkPaint) {\n this.ref.drawDRRect(\n JsiSkRRect.fromValue(this.CanvasKit, outer),\n JsiSkRRect.fromValue(this.CanvasKit, inner),\n JsiSkPaint.fromValue(paint)\n );\n }\n\n drawOval(oval: SkRect, paint: SkPaint) {\n this.ref.drawOval(\n JsiSkRect.fromValue(this.CanvasKit, oval),\n JsiSkPaint.fromValue(paint)\n );\n }\n\n drawPath(path: SkPath, paint: SkPaint) {\n this.ref.drawPath(JsiSkPath.fromValue(path), JsiSkPaint.fromValue(paint));\n }\n\n drawText(str: string, x: number, y: number, paint: SkPaint, font: SkFont) {\n this.ref.drawText(\n str,\n x,\n y,\n JsiSkPaint.fromValue(paint),\n JsiSkFont.fromValue(font)\n );\n }\n\n drawTextBlob(blob: SkTextBlob, x: number, y: number, paint: SkPaint) {\n this.ref.drawTextBlob(\n JsiSkTextBlob.fromValue(blob),\n x,\n y,\n JsiSkPaint.fromValue(paint)\n );\n }\n\n drawGlyphs(\n glyphs: number[],\n positions: SkPoint[],\n x: number,\n y: number,\n font: SkFont,\n paint: SkPaint\n ) {\n this.ref.drawGlyphs(\n glyphs,\n positions.map((p) => [p.x, p.y]).flat(),\n x,\n y,\n JsiSkFont.fromValue(font),\n JsiSkPaint.fromValue(paint)\n );\n }\n\n drawSvg(svg: SkSVG, _width?: number, _height?: number) {\n const image = this.CanvasKit.MakeImageFromCanvasImageSource(\n (svg as JsiSkSVG).ref\n );\n this.ref.drawImage(image, 0, 0);\n }\n\n save() {\n return this.ref.save();\n }\n\n saveLayer(\n paint?: SkPaint,\n bounds?: SkRect | null,\n backdrop?: SkImageFilter | null,\n flags?: SaveLayerFlag\n ) {\n return this.ref.saveLayer(\n paint ? JsiSkPaint.fromValue(paint) : undefined,\n bounds ? JsiSkRect.fromValue(this.CanvasKit, bounds) : bounds,\n backdrop ? JsiSkImageFilter.fromValue(backdrop) : backdrop,\n flags\n );\n }\n\n restore() {\n this.ref.restore();\n }\n\n rotate(rotationInDegrees: number, rx: number, ry: number) {\n this.ref.rotate(rotationInDegrees, rx, ry);\n }\n\n scale(sx: number, sy: number) {\n this.ref.scale(sx, sy);\n }\n\n skew(sx: number, sy: number) {\n this.ref.skew(sx, sy);\n }\n\n translate(dx: number, dy: number) {\n this.ref.translate(dx, dy);\n }\n\n drawColor(color: SkColor, blendMode?: BlendMode) {\n this.ref.drawColor(\n color,\n blendMode ? getEnum(this.CanvasKit.BlendMode, blendMode) : undefined\n );\n }\n\n clear(color: SkColor) {\n this.ref.clear(color);\n }\n\n clipPath(path: SkPath, op: ClipOp, doAntiAlias: boolean) {\n this.ref.clipPath(\n JsiSkPath.fromValue(path),\n getEnum(this.CanvasKit.PathOp, op),\n doAntiAlias\n );\n }\n\n clipRect(rect: SkRect, op: ClipOp, doAntiAlias: boolean) {\n this.ref.clipRect(\n JsiSkRect.fromValue(this.CanvasKit, rect),\n getEnum(this.CanvasKit.PathOp, op),\n doAntiAlias\n );\n }\n\n clipRRect(rrect: InputRRect, op: ClipOp, doAntiAlias: boolean) {\n this.ref.clipRRect(\n JsiSkRRect.fromValue(this.CanvasKit, rrect),\n getEnum(this.CanvasKit.PathOp, op),\n doAntiAlias\n );\n }\n\n concat(m: SkMatrix | number[]) {\n this.ref.concat(Array.isArray(m) ? m : JsiSkMatrix.fromValue(m));\n }\n\n drawPicture(skp: SkPicture) {\n this.ref.drawPicture(JsiSkPicture.fromValue(skp));\n }\n\n drawAtlas(\n atlas: SkImage,\n srcs: SkRect[],\n dsts: SkRSXform[],\n paint: SkPaint,\n blendMode?: BlendMode,\n colors?: SkColor[],\n sampling?: CubicResampler | FilterOptions\n ) {\n const src = srcs.flatMap((s) =>\n Array.from(JsiSkRect.fromValue(this.CanvasKit, s))\n );\n const dst = dsts.flatMap((s) => Array.from(JsiSkRSXform.fromValue(s)));\n let cls: Uint32Array | undefined;\n if (colors) {\n cls = new Uint32Array(colors.length);\n for (let i = 0; i < colors.length; i++) {\n const [r, g, b, a] = colors[i];\n cls[i] = this.CanvasKit.ColorAsInt(r * 255, g * 255, b * 255, a * 255);\n }\n }\n let ckSampling: CKCubicResampler | CKFilterOptions = {\n filter: this.CanvasKit.FilterMode.Linear,\n mipmap: this.CanvasKit.MipmapMode.None,\n };\n if (sampling && isCubicSampling(sampling)) {\n ckSampling = sampling;\n } else if (sampling) {\n ckSampling = {\n filter: getEnum(this.CanvasKit.FilterMode, sampling.filter),\n mipmap: sampling.mipmap\n ? getEnum(this.CanvasKit.MipmapMode, sampling.mipmap)\n : this.CanvasKit.MipmapMode.None,\n };\n }\n this.ref.drawAtlas(\n JsiSkImage.fromValue(atlas),\n src,\n dst,\n JsiSkPaint.fromValue(paint),\n blendMode\n ? getEnum(this.CanvasKit.BlendMode, blendMode)\n : this.CanvasKit.BlendMode.DstOver,\n cls,\n ckSampling\n );\n }\n\n readPixels(srcX: number, srcY: number, imageInfo: ImageInfo) {\n const pxInfo = {\n width: imageInfo.width,\n height: imageInfo.height,\n colorSpace: this.CanvasKit.ColorSpace.SRGB,\n alphaType: getEnum(this.CanvasKit.AlphaType, imageInfo.alphaType),\n colorType: getEnum(this.CanvasKit.ColorType, imageInfo.colorType),\n };\n return this.ref.readPixels(srcX, srcY, pxInfo);\n }\n}\n"],"mappings":";;;;;;AAOA,IAAAA,MAAA,GAAAC,OAAA;AA6BA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAL,OAAA;AACA,IAAAM,cAAA,GAAAN,OAAA;AACA,IAAAO,UAAA,GAAAP,OAAA;AACA,IAAAQ,UAAA,GAAAR,OAAA;AACA,IAAAS,cAAA,GAAAT,OAAA;AACA,IAAAU,aAAA,GAAAV,OAAA;AACA,IAAAW,YAAA,GAAAX,OAAA;AACA,IAAAY,iBAAA,GAAAZ,OAAA;AACA,IAAAa,WAAA,GAAAb,OAAA;AACA,IAAAc,aAAA,GAAAd,OAAA;AAA8C,SAAAe,gBAAAC,CAAA,EAAAC,CAAA,EAAAC,CAAA,YAAAD,CAAA,GAAAE,cAAA,CAAAF,CAAA,MAAAD,CAAA,GAAAI,MAAA,CAAAC,cAAA,CAAAL,CAAA,EAAAC,CAAA,IAAAK,KAAA,EAAAJ,CAAA,EAAAK,UAAA,MAAAC,YAAA,MAAAC,QAAA,UAAAT,CAAA,CAAAC,CAAA,IAAAC,CAAA,EAAAF,CAAA;AAAA,SAAAG,eAAAD,CAAA,QAAAQ,CAAA,GAAAC,YAAA,CAAAT,CAAA,uCAAAQ,CAAA,GAAAA,CAAA,GAAAA,CAAA;AAAA,SAAAC,aAAAT,CAAA,EAAAD,CAAA,2BAAAC,CAAA,KAAAA,CAAA,SAAAA,CAAA,MAAAF,CAAA,GAAAE,CAAA,CAAAU,MAAA,CAAAC,WAAA,kBAAAb,CAAA,QAAAU,CAAA,GAAAV,CAAA,CAAAc,IAAA,CAAAZ,CAAA,EAAAD,C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H;EAEAM,UAAUA,CAACC,IAAY,EAAEC,IAAY,EAAEC,SAAoB,EAAE;IAC3D,MAAMC,MAAM,GAAG;MACbC,KAAK,EAAEF,SAAS,CAACE,KAAK;MACtBC,MAAM,EAAEH,SAAS,CAACG,MAAM;MACxBC,UAAU,EAAE,IAAI,CAAChK,SAAS,CAACiK,UAAU,CAACC,IAAI;MAC1CC,SAAS,EAAE,IAAAxI,aAAO,EAAC,IAAI,CAAC3B,SAAS,CAACoK,SAAS,EAAER,SAAS,CAACO,SAAS,CAAC;MACjEE,SAAS,EAAE,IAAA1I,aAAO,EAAC,IAAI,CAAC3B,SAAS,CAACsK,SAAS,EAAEV,SAAS,CAACS,SAAS;IAClE,CAAC;IACD,OAAO,IAAI,CAACpK,GAAG,CAACwJ,UAAU,CAACC,IAAI,EAAEC,IAAI,EAAEE,MAAM,CAAC;EAChD;AACF;AAACU,OAAA,CAAA1K,WAAA,GAAAA,WAAA","ignoreList":[]}
|
1
|
+
{"version":3,"names":["_types","require","_Host","_JsiSkPaint","_JsiSkRect","_JsiSkRRect","_JsiSkImage","_JsiSkVertices","_JsiSkPath","_JsiSkFont","_JsiSkTextBlob","_JsiSkPicture","_JsiSkMatrix","_JsiSkImageFilter","_JsiSkPoint","_JsiSkRSXform","_defineProperty","e","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","JsiSkCanvas","HostObject","constructor","CanvasKit","ref","delete","drawRect","rect","paint","JsiSkRect","fromValue","JsiSkPaint","drawImage","image","x","y","JsiSkImage","drawImageRect","img","src","dest","fastSample","drawImageCubic","left","top","B","C","drawImageOptions","fm","mm","getEnum","drawImageNine","center","filter","Array","from","drawImageRectCubic","drawImageRectOptions","drawPaint","drawLine","x0","y0","x1","y1","drawCircle","cx","cy","radius","drawVertices","verts","mode","JsiSkVertices","drawPatch","cubics","colors","texs","map","flat","flatMap","p","JsiSkPoint","undefined","restoreToCount","saveCount","drawPoints","points","drawArc","oval","startAngle","sweepAngle","useCenter","drawRRect","rrect","JsiSkRRect","drawDRRect","outer","inner","drawOval","drawPath","path","JsiSkPath","drawText","str","font","JsiSkFont","drawTextBlob","blob","JsiSkTextBlob","drawGlyphs","glyphs","positions","drawSvg","svg","_width","_height","MakeImageFromCanvasImageSource","save","saveLayer","bounds","backdrop","flags","JsiSkImageFilter","restore","rotate","rotationInDegrees","rx","ry","scale","sx","sy","skew","translate","dx","dy","drawColor","color","blendMode","clear","clipPath","op","doAntiAlias","clipRect","clipRRect","concat","m","isArray","JsiSkMatrix","drawPicture","skp","JsiSkPicture","drawAtlas","atlas","srcs","dsts","sampling","s","dst","JsiSkRSXform","cls","Uint32Array","length","g","b","a","ColorAsInt","ckSampling","FilterMode","Linear","mipmap","MipmapMode","None","isCubicSampling","BlendMode","DstOver","readPixels","srcX","srcY","imageInfo","pxInfo","width","height","colorSpace","ColorSpace","SRGB","alphaType","colorType","exports"],"sources":["JsiSkCanvas.ts"],"sourcesContent":["import type {\n Canvas,\n CanvasKit,\n CubicResampler as CKCubicResampler,\n FilterOptions as CKFilterOptions,\n} from \"canvaskit-wasm\";\n\nimport {\n type BlendMode,\n type ClipOp,\n type FilterMode,\n type MipmapMode,\n type PointMode,\n type SaveLayerFlag,\n type ImageInfo,\n type SkCanvas,\n type SkColor,\n type SkFont,\n type SkImage,\n type SkImageFilter,\n type SkMatrix,\n type SkPaint,\n type SkPath,\n type SkPicture,\n type SkPoint,\n type SkRect,\n type InputRRect,\n type SkSVG,\n type SkTextBlob,\n type SkVertices,\n type SkRSXform,\n type CubicResampler,\n type FilterOptions,\n isCubicSampling,\n} from \"../types\";\n\nimport { getEnum, HostObject } from \"./Host\";\nimport { JsiSkPaint } from \"./JsiSkPaint\";\nimport { JsiSkRect } from \"./JsiSkRect\";\nimport { JsiSkRRect } from \"./JsiSkRRect\";\nimport { JsiSkImage } from \"./JsiSkImage\";\nimport { JsiSkVertices } from \"./JsiSkVertices\";\nimport { JsiSkPath } from \"./JsiSkPath\";\nimport { JsiSkFont } from \"./JsiSkFont\";\nimport { JsiSkTextBlob } from \"./JsiSkTextBlob\";\nimport { JsiSkPicture } from \"./JsiSkPicture\";\nimport { JsiSkMatrix } from \"./JsiSkMatrix\";\nimport { JsiSkImageFilter } from \"./JsiSkImageFilter\";\nimport { JsiSkPoint } from \"./JsiSkPoint\";\nimport { JsiSkRSXform } from \"./JsiSkRSXform\";\nimport type { JsiSkSVG } from \"./JsiSkSVG\";\n\nexport class JsiSkCanvas\n extends HostObject<Canvas, \"Canvas\">\n implements SkCanvas\n{\n constructor(CanvasKit: CanvasKit, ref: Canvas) {\n super(CanvasKit, ref, \"Canvas\");\n }\n\n dispose = () => {\n this.ref.delete();\n };\n\n drawRect(rect: SkRect, paint: SkPaint) {\n this.ref.drawRect(\n JsiSkRect.fromValue(this.CanvasKit, rect),\n JsiSkPaint.fromValue(paint)\n );\n }\n\n drawImage(image: SkImage, x: number, y: number, paint?: SkPaint) {\n this.ref.drawImage(\n JsiSkImage.fromValue(image),\n x,\n y,\n paint ? JsiSkPaint.fromValue(paint) : paint\n );\n }\n\n drawImageRect(\n img: SkImage,\n src: SkRect,\n dest: SkRect,\n paint: SkPaint,\n fastSample?: boolean\n ) {\n this.ref.drawImageRect(\n JsiSkImage.fromValue(img),\n JsiSkRect.fromValue(this.CanvasKit, src),\n JsiSkRect.fromValue(this.CanvasKit, dest),\n JsiSkPaint.fromValue(paint),\n fastSample\n );\n }\n\n drawImageCubic(\n img: SkImage,\n left: number,\n top: number,\n B: number,\n C: number,\n paint?: SkPaint | null\n ) {\n this.ref.drawImageCubic(\n JsiSkImage.fromValue(img),\n left,\n top,\n B,\n C,\n paint ? JsiSkPaint.fromValue(paint) : paint\n );\n }\n\n drawImageOptions(\n img: SkImage,\n left: number,\n top: number,\n fm: FilterMode,\n mm: MipmapMode,\n paint?: SkPaint | null\n ) {\n this.ref.drawImageOptions(\n JsiSkImage.fromValue(img),\n left,\n top,\n getEnum(this.CanvasKit, \"FilterMode\", fm),\n getEnum(this.CanvasKit, \"MipmapMode\", mm),\n paint ? JsiSkPaint.fromValue(paint) : paint\n );\n }\n\n drawImageNine(\n img: SkImage,\n center: SkRect,\n dest: SkRect,\n filter: FilterMode,\n paint?: SkPaint | null\n ) {\n this.ref.drawImageNine(\n JsiSkImage.fromValue(img),\n Array.from(JsiSkRect.fromValue(this.CanvasKit, center)),\n JsiSkRect.fromValue(this.CanvasKit, dest),\n getEnum(this.CanvasKit, \"FilterMode\", filter),\n paint ? JsiSkPaint.fromValue(paint) : paint\n );\n }\n\n drawImageRectCubic(\n img: SkImage,\n src: SkRect,\n dest: SkRect,\n B: number,\n C: number,\n paint?: SkPaint | null\n ) {\n this.ref.drawImageRectCubic(\n JsiSkImage.fromValue(img),\n JsiSkRect.fromValue(this.CanvasKit, src),\n JsiSkRect.fromValue(this.CanvasKit, dest),\n B,\n C,\n paint ? JsiSkPaint.fromValue(paint) : paint\n );\n }\n\n drawImageRectOptions(\n img: SkImage,\n src: SkRect,\n dest: SkRect,\n fm: FilterMode,\n mm: MipmapMode,\n paint?: SkPaint | null\n ) {\n this.ref.drawImageRectOptions(\n JsiSkImage.fromValue(img),\n JsiSkRect.fromValue(this.CanvasKit, src),\n JsiSkRect.fromValue(this.CanvasKit, dest),\n getEnum(this.CanvasKit, \"FilterMode\", fm),\n getEnum(this.CanvasKit, \"MipmapMode\", mm),\n paint ? JsiSkPaint.fromValue(paint) : paint\n );\n }\n\n drawPaint(paint: SkPaint) {\n this.ref.drawPaint(JsiSkPaint.fromValue(paint));\n }\n\n drawLine(x0: number, y0: number, x1: number, y1: number, paint: SkPaint) {\n this.ref.drawLine(x0, y0, x1, y1, JsiSkPaint.fromValue(paint));\n }\n\n drawCircle(cx: number, cy: number, radius: number, paint: SkPaint) {\n this.ref.drawCircle(cx, cy, radius, JsiSkPaint.fromValue(paint));\n }\n\n drawVertices(verts: SkVertices, mode: BlendMode, paint: SkPaint) {\n this.ref.drawVertices(\n JsiSkVertices.fromValue(verts),\n getEnum(this.CanvasKit, \"BlendMode\", mode),\n JsiSkPaint.fromValue(paint)\n );\n }\n\n drawPatch(\n cubics: SkPoint[],\n colors?: SkColor[] | null,\n texs?: SkPoint[] | null,\n mode?: BlendMode | null,\n paint?: SkPaint\n ) {\n this.ref.drawPatch(\n cubics.map(({ x, y }) => [x, y]).flat(),\n colors,\n texs ? texs.flatMap((p) => Array.from(JsiSkPoint.fromValue(p))) : texs,\n mode ? getEnum(this.CanvasKit, \"BlendMode\", mode) : null,\n paint ? JsiSkPaint.fromValue(paint) : undefined\n );\n }\n\n restoreToCount(saveCount: number) {\n this.ref.restoreToCount(saveCount);\n }\n\n drawPoints(mode: PointMode, points: SkPoint[], paint: SkPaint) {\n this.ref.drawPoints(\n getEnum(this.CanvasKit, \"PointMode\", mode),\n points.map(({ x, y }) => [x, y]).flat(),\n JsiSkPaint.fromValue(paint)\n );\n }\n\n drawArc(\n oval: SkRect,\n startAngle: number,\n sweepAngle: number,\n useCenter: boolean,\n paint: SkPaint\n ) {\n this.ref.drawArc(\n JsiSkRect.fromValue(this.CanvasKit, oval),\n startAngle,\n sweepAngle,\n useCenter,\n JsiSkPaint.fromValue(paint)\n );\n }\n\n drawRRect(rrect: InputRRect, paint: SkPaint) {\n this.ref.drawRRect(\n JsiSkRRect.fromValue(this.CanvasKit, rrect),\n JsiSkPaint.fromValue(paint)\n );\n }\n\n drawDRRect(outer: InputRRect, inner: InputRRect, paint: SkPaint) {\n this.ref.drawDRRect(\n JsiSkRRect.fromValue(this.CanvasKit, outer),\n JsiSkRRect.fromValue(this.CanvasKit, inner),\n JsiSkPaint.fromValue(paint)\n );\n }\n\n drawOval(oval: SkRect, paint: SkPaint) {\n this.ref.drawOval(\n JsiSkRect.fromValue(this.CanvasKit, oval),\n JsiSkPaint.fromValue(paint)\n );\n }\n\n drawPath(path: SkPath, paint: SkPaint) {\n this.ref.drawPath(JsiSkPath.fromValue(path), JsiSkPaint.fromValue(paint));\n }\n\n drawText(str: string, x: number, y: number, paint: SkPaint, font: SkFont) {\n this.ref.drawText(\n str,\n x,\n y,\n JsiSkPaint.fromValue(paint),\n JsiSkFont.fromValue(font)\n );\n }\n\n drawTextBlob(blob: SkTextBlob, x: number, y: number, paint: SkPaint) {\n this.ref.drawTextBlob(\n JsiSkTextBlob.fromValue(blob),\n x,\n y,\n JsiSkPaint.fromValue(paint)\n );\n }\n\n drawGlyphs(\n glyphs: number[],\n positions: SkPoint[],\n x: number,\n y: number,\n font: SkFont,\n paint: SkPaint\n ) {\n this.ref.drawGlyphs(\n glyphs,\n positions.map((p) => [p.x, p.y]).flat(),\n x,\n y,\n JsiSkFont.fromValue(font),\n JsiSkPaint.fromValue(paint)\n );\n }\n\n drawSvg(svg: SkSVG, _width?: number, _height?: number) {\n const image = this.CanvasKit.MakeImageFromCanvasImageSource(\n (svg as JsiSkSVG).ref\n );\n this.ref.drawImage(image, 0, 0);\n }\n\n save() {\n return this.ref.save();\n }\n\n saveLayer(\n paint?: SkPaint,\n bounds?: SkRect | null,\n backdrop?: SkImageFilter | null,\n flags?: SaveLayerFlag\n ) {\n return this.ref.saveLayer(\n paint ? JsiSkPaint.fromValue(paint) : undefined,\n bounds ? JsiSkRect.fromValue(this.CanvasKit, bounds) : bounds,\n backdrop ? JsiSkImageFilter.fromValue(backdrop) : backdrop,\n flags\n );\n }\n\n restore() {\n this.ref.restore();\n }\n\n rotate(rotationInDegrees: number, rx: number, ry: number) {\n this.ref.rotate(rotationInDegrees, rx, ry);\n }\n\n scale(sx: number, sy: number) {\n this.ref.scale(sx, sy);\n }\n\n skew(sx: number, sy: number) {\n this.ref.skew(sx, sy);\n }\n\n translate(dx: number, dy: number) {\n this.ref.translate(dx, dy);\n }\n\n drawColor(color: SkColor, blendMode?: BlendMode) {\n this.ref.drawColor(\n color,\n blendMode ? getEnum(this.CanvasKit, \"BlendMode\", blendMode) : undefined\n );\n }\n\n clear(color: SkColor) {\n this.ref.clear(color);\n }\n\n clipPath(path: SkPath, op: ClipOp, doAntiAlias: boolean) {\n this.ref.clipPath(\n JsiSkPath.fromValue(path),\n getEnum(this.CanvasKit, \"PathOp\", op),\n doAntiAlias\n );\n }\n\n clipRect(rect: SkRect, op: ClipOp, doAntiAlias: boolean) {\n this.ref.clipRect(\n JsiSkRect.fromValue(this.CanvasKit, rect),\n getEnum(this.CanvasKit, \"PathOp\", op),\n doAntiAlias\n );\n }\n\n clipRRect(rrect: InputRRect, op: ClipOp, doAntiAlias: boolean) {\n this.ref.clipRRect(\n JsiSkRRect.fromValue(this.CanvasKit, rrect),\n getEnum(this.CanvasKit, \"PathOp\", op),\n doAntiAlias\n );\n }\n\n concat(m: SkMatrix | number[]) {\n this.ref.concat(Array.isArray(m) ? m : JsiSkMatrix.fromValue(m));\n }\n\n drawPicture(skp: SkPicture) {\n this.ref.drawPicture(JsiSkPicture.fromValue(skp));\n }\n\n drawAtlas(\n atlas: SkImage,\n srcs: SkRect[],\n dsts: SkRSXform[],\n paint: SkPaint,\n blendMode?: BlendMode,\n colors?: SkColor[],\n sampling?: CubicResampler | FilterOptions\n ) {\n const src = srcs.flatMap((s) =>\n Array.from(JsiSkRect.fromValue(this.CanvasKit, s))\n );\n const dst = dsts.flatMap((s) => Array.from(JsiSkRSXform.fromValue(s)));\n let cls: Uint32Array | undefined;\n if (colors) {\n cls = new Uint32Array(colors.length);\n for (let i = 0; i < colors.length; i++) {\n const [r, g, b, a] = colors[i];\n cls[i] = this.CanvasKit.ColorAsInt(r * 255, g * 255, b * 255, a * 255);\n }\n }\n let ckSampling: CKCubicResampler | CKFilterOptions = {\n filter: this.CanvasKit.FilterMode.Linear,\n mipmap: this.CanvasKit.MipmapMode.None,\n };\n if (sampling && isCubicSampling(sampling)) {\n ckSampling = sampling;\n } else if (sampling) {\n ckSampling = {\n filter: getEnum(this.CanvasKit, \"FilterMode\", sampling.filter),\n mipmap: sampling.mipmap\n ? getEnum(this.CanvasKit, \"MipmapMode\", sampling.mipmap)\n : this.CanvasKit.MipmapMode.None,\n };\n }\n this.ref.drawAtlas(\n JsiSkImage.fromValue(atlas),\n src,\n dst,\n JsiSkPaint.fromValue(paint),\n blendMode\n ? getEnum(this.CanvasKit, \"BlendMode\", blendMode)\n : this.CanvasKit.BlendMode.DstOver,\n cls,\n ckSampling\n );\n }\n\n readPixels(srcX: number, srcY: number, imageInfo: ImageInfo) {\n const pxInfo = {\n width: imageInfo.width,\n height: imageInfo.height,\n colorSpace: this.CanvasKit.ColorSpace.SRGB,\n alphaType: getEnum(this.CanvasKit, \"AlphaType\", imageInfo.alphaType),\n colorType: getEnum(this.CanvasKit, \"ColorType\", imageInfo.colorType),\n };\n return this.ref.readPixels(srcX, srcY, pxInfo);\n }\n}\n"],"mappings":";;;;;;AAOA,IAAAA,MAAA,GAAAC,OAAA;AA6BA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAL,OAAA;AACA,IAAAM,cAAA,GAAAN,OAAA;AACA,IAAAO,UAAA,GAAAP,OAAA;AACA,IAAAQ,UAAA,GAAAR,OAAA;AACA,IAAAS,cAAA,GAAAT,OAAA;AACA,IAAAU,aAAA,GAAAV,OAAA;AACA,IAAAW,YAAA,GAAAX,OAAA;AACA,IAAAY,iBAAA,GAAAZ,OAAA;AACA,IAAAa,WAAA,GAAAb,OAAA;AACA,IAAAc,aAAA,GAAAd,OAAA;AAA8C,SAAAe,gBAAAC,CAAA,EAAAC,CAAA,EAAAC,CAAA,YAAAD,CAAA,GAAAE,cAAA,CAAAF,CAAA,MAAAD,CAAA,GAAAI,MAAA,CAAAC,cAAA,CAAAL,CAAA,EAAAC,CAAA,IAAAK,KAAA,EAAAJ,CAAA,EAAAK,UAAA,MAAAC,YAAA,MAAAC,QAAA,UAAAT,CAAA,CAAAC,CAAA,IAAAC,CAAA,EAAAF,CAAA;AAAA,SAAAG,eAAA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ChBlH,sBAAU,CAACN,SAAS,CAACyH,KAAK,CAAC,EAC3BhH,GAAG,EACHqH,GAAG,EACH7H,sBAAU,CAACD,SAAS,CAACF,KAAK,CAAC,EAC3B4G,SAAS,GACL,IAAAtF,aAAO,EAAC,IAAI,CAAC3B,SAAS,EAAE,WAAW,EAAEiH,SAAS,CAAC,GAC/C,IAAI,CAACjH,SAAS,CAACqJ,SAAS,CAACC,OAAO,EACpCf,GAAG,EACHO,UACF,CAAC;EACH;EAEAS,UAAUA,CAACC,IAAY,EAAEC,IAAY,EAAEC,SAAoB,EAAE;IAC3D,MAAMC,MAAM,GAAG;MACbC,KAAK,EAAEF,SAAS,CAACE,KAAK;MACtBC,MAAM,EAAEH,SAAS,CAACG,MAAM;MACxBC,UAAU,EAAE,IAAI,CAAC9J,SAAS,CAAC+J,UAAU,CAACC,IAAI;MAC1CC,SAAS,EAAE,IAAAtI,aAAO,EAAC,IAAI,CAAC3B,SAAS,EAAE,WAAW,EAAE0J,SAAS,CAACO,SAAS,CAAC;MACpEC,SAAS,EAAE,IAAAvI,aAAO,EAAC,IAAI,CAAC3B,SAAS,EAAE,WAAW,EAAE0J,SAAS,CAACQ,SAAS;IACrE,CAAC;IACD,OAAO,IAAI,CAACjK,GAAG,CAACsJ,UAAU,CAACC,IAAI,EAAEC,IAAI,EAAEE,MAAM,CAAC;EAChD;AACF;AAACQ,OAAA,CAAAtK,WAAA,GAAAA,WAAA","ignoreList":[]}
|
@@ -14,7 +14,7 @@ class JsiSkColorFilterFactory extends _Host.Host {
|
|
14
14
|
return new _JsiSkColorFilter.JsiSkColorFilter(this.CanvasKit, this.CanvasKit.ColorFilter.MakeMatrix(cMatrix));
|
15
15
|
}
|
16
16
|
MakeBlend(color, mode) {
|
17
|
-
return new _JsiSkColorFilter.JsiSkColorFilter(this.CanvasKit, this.CanvasKit.ColorFilter.MakeBlend(color, (0, _Host.getEnum)(this.CanvasKit
|
17
|
+
return new _JsiSkColorFilter.JsiSkColorFilter(this.CanvasKit, this.CanvasKit.ColorFilter.MakeBlend(color, (0, _Host.getEnum)(this.CanvasKit, "BlendMode", mode)));
|
18
18
|
}
|
19
19
|
MakeCompose(outer, inner) {
|
20
20
|
return new _JsiSkColorFilter.JsiSkColorFilter(this.CanvasKit, this.CanvasKit.ColorFilter.MakeCompose(_JsiSkColorFilter.JsiSkColorFilter.fromValue(outer), _JsiSkColorFilter.JsiSkColorFilter.fromValue(inner)));
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_Host","require","_JsiSkColorFilter","JsiSkColorFilterFactory","Host","constructor","CanvasKit","MakeMatrix","cMatrix","JsiSkColorFilter","ColorFilter","MakeBlend","color","mode","getEnum","
|
1
|
+
{"version":3,"names":["_Host","require","_JsiSkColorFilter","JsiSkColorFilterFactory","Host","constructor","CanvasKit","MakeMatrix","cMatrix","JsiSkColorFilter","ColorFilter","MakeBlend","color","mode","getEnum","MakeCompose","outer","inner","fromValue","MakeLerp","t","dst","src","MakeLinearToSRGBGamma","MakeSRGBToLinearGamma","MakeLumaColorFilter","MakeLuma","exports"],"sources":["JsiSkColorFilterFactory.ts"],"sourcesContent":["import type { CanvasKit } from \"canvaskit-wasm\";\n\nimport type {\n ColorFilterFactory,\n SkColorFilter,\n InputColorMatrix,\n SkColor,\n BlendMode,\n} from \"../types\";\n\nimport { getEnum, Host } from \"./Host\";\nimport { JsiSkColorFilter } from \"./JsiSkColorFilter\";\n\nexport class JsiSkColorFilterFactory\n extends Host\n implements ColorFilterFactory\n{\n constructor(CanvasKit: CanvasKit) {\n super(CanvasKit);\n }\n\n MakeMatrix(cMatrix: InputColorMatrix) {\n return new JsiSkColorFilter(\n this.CanvasKit,\n this.CanvasKit.ColorFilter.MakeMatrix(cMatrix)\n );\n }\n\n MakeBlend(color: SkColor, mode: BlendMode) {\n return new JsiSkColorFilter(\n this.CanvasKit,\n this.CanvasKit.ColorFilter.MakeBlend(\n color,\n getEnum(this.CanvasKit, \"BlendMode\", mode)\n )\n );\n }\n\n MakeCompose(outer: SkColorFilter, inner: SkColorFilter) {\n return new JsiSkColorFilter(\n this.CanvasKit,\n this.CanvasKit.ColorFilter.MakeCompose(\n JsiSkColorFilter.fromValue(outer),\n JsiSkColorFilter.fromValue(inner)\n )\n );\n }\n\n MakeLerp(t: number, dst: SkColorFilter, src: SkColorFilter) {\n return new JsiSkColorFilter(\n this.CanvasKit,\n this.CanvasKit.ColorFilter.MakeLerp(\n t,\n JsiSkColorFilter.fromValue(dst),\n JsiSkColorFilter.fromValue(src)\n )\n );\n }\n\n MakeLinearToSRGBGamma() {\n return new JsiSkColorFilter(\n this.CanvasKit,\n this.CanvasKit.ColorFilter.MakeLinearToSRGBGamma()\n );\n }\n\n MakeSRGBToLinearGamma() {\n return new JsiSkColorFilter(\n this.CanvasKit,\n this.CanvasKit.ColorFilter.MakeSRGBToLinearGamma()\n );\n }\n\n MakeLumaColorFilter(): SkColorFilter {\n return new JsiSkColorFilter(\n this.CanvasKit,\n this.CanvasKit.ColorFilter.MakeLuma()\n );\n }\n}\n"],"mappings":";;;;;;AAUA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAD,OAAA;AAEO,MAAME,uBAAuB,SAC1BC,UAAI,CAEd;EACEC,WAAWA,CAACC,SAAoB,EAAE;IAChC,KAAK,CAACA,SAAS,CAAC;EAClB;EAEAC,UAAUA,CAACC,OAAyB,EAAE;IACpC,OAAO,IAAIC,kCAAgB,CACzB,IAAI,CAACH,SAAS,EACd,IAAI,CAACA,SAAS,CAACI,WAAW,CAACH,UAAU,CAACC,OAAO,CAC/C,CAAC;EACH;EAEAG,SAASA,CAACC,KAAc,EAAEC,IAAe,EAAE;IACzC,OAAO,IAAIJ,kCAAgB,CACzB,IAAI,CAACH,SAAS,EACd,IAAI,CAACA,SAAS,CAACI,WAAW,CAACC,SAAS,CAClCC,KAAK,EACL,IAAAE,aAAO,EAAC,IAAI,CAACR,SAAS,EAAE,WAAW,EAAEO,IAAI,CAC3C,CACF,CAAC;EACH;EAEAE,WAAWA,CAACC,KAAoB,EAAEC,KAAoB,EAAE;IACtD,OAAO,IAAIR,kCAAgB,CACzB,IAAI,CAACH,SAAS,EACd,IAAI,CAACA,SAAS,CAACI,WAAW,CAACK,WAAW,CACpCN,kCAAgB,CAACS,SAAS,CAACF,KAAK,CAAC,EACjCP,kCAAgB,CAACS,SAAS,CAACD,KAAK,CAClC,CACF,CAAC;EACH;EAEAE,QAAQA,CAACC,CAAS,EAAEC,GAAkB,EAAEC,GAAkB,EAAE;IAC1D,OAAO,IAAIb,kCAAgB,CACzB,IAAI,CAACH,SAAS,EACd,IAAI,CAACA,SAAS,CAACI,WAAW,CAACS,QAAQ,CACjCC,CAAC,EACDX,kCAAgB,CAACS,SAAS,CAACG,GAAG,CAAC,EAC/BZ,kCAAgB,CAACS,SAAS,CAACI,GAAG,CAChC,CACF,CAAC;EACH;EAEAC,qBAAqBA,CAAA,EAAG;IACtB,OAAO,IAAId,kCAAgB,CACzB,IAAI,CAACH,SAAS,EACd,IAAI,CAACA,SAAS,CAACI,WAAW,CAACa,qBAAqB,CAAC,CACnD,CAAC;EACH;EAEAC,qBAAqBA,CAAA,EAAG;IACtB,OAAO,IAAIf,kCAAgB,CACzB,IAAI,CAACH,SAAS,EACd,IAAI,CAACA,SAAS,CAACI,WAAW,CAACc,qBAAqB,CAAC,CACnD,CAAC;EACH;EAEAC,mBAAmBA,CAAA,EAAkB;IACnC,OAAO,IAAIhB,kCAAgB,CACzB,IAAI,CAACH,SAAS,EACd,IAAI,CAACA,SAAS,CAACI,WAAW,CAACgB,QAAQ,CAAC,CACtC,CAAC;EACH;AACF;AAACC,OAAA,CAAAxB,uBAAA,GAAAA,uBAAA","ignoreList":[]}
|
@@ -65,13 +65,13 @@ class JsiSkFont extends _Host.HostObject {
|
|
65
65
|
return tf ? new _JsiSkTypeface.JsiSkTypeface(this.CanvasKit, tf) : null;
|
66
66
|
}
|
67
67
|
setEdging(edging) {
|
68
|
-
this.ref.setEdging((0, _Host.getEnum)(this.CanvasKit
|
68
|
+
this.ref.setEdging((0, _Host.getEnum)(this.CanvasKit, "FontEdging", edging));
|
69
69
|
}
|
70
70
|
setEmbeddedBitmaps(embeddedBitmaps) {
|
71
71
|
this.ref.setEmbeddedBitmaps(embeddedBitmaps);
|
72
72
|
}
|
73
73
|
setHinting(hinting) {
|
74
|
-
this.ref.setHinting((0, _Host.getEnum)(this.CanvasKit
|
74
|
+
this.ref.setHinting((0, _Host.getEnum)(this.CanvasKit, "FontHinting", hinting));
|
75
75
|
}
|
76
76
|
setLinearMetrics(linearMetrics) {
|
77
77
|
this.ref.setLinearMetrics(linearMetrics);
|