@shopify/react-native-skia 2.9.1-next.1 → 2.10.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 -5
- package/android/cpp/jni/JniWebGPUView.cpp +52 -7
- package/android/src/main/java/com/shopify/reactnative/skia/WebGPUSurfaceView.java +3 -1
- package/android/src/main/java/com/shopify/reactnative/skia/WebGPUTextureView.java +11 -5
- package/android/src/main/java/com/shopify/reactnative/skia/WebGPUView.java +10 -7
- package/android/src/main/java/com/shopify/reactnative/skia/WebGPUViewAPI.java +7 -2
- package/android/src/main/java/com/shopify/reactnative/skia/WebGPUViewManager.java +1 -1
- package/apple/WebGPUMetalView.mm +49 -6
- package/cpp/api/JsiNativeBuffer.h +15 -10
- package/cpp/api/JsiSkAnimatedImage.h +21 -19
- package/cpp/api/JsiSkAnimatedImageFactory.h +13 -14
- package/cpp/api/JsiSkApi.h +246 -92
- package/cpp/api/JsiSkCanvas.h +76 -58
- package/cpp/api/JsiSkColor.h +7 -5
- package/cpp/api/JsiSkColorFilter.h +15 -8
- package/cpp/api/JsiSkColorFilterFactory.h +45 -45
- package/cpp/api/JsiSkContourMeasure.h +24 -21
- package/cpp/api/JsiSkContourMeasureIter.h +18 -21
- package/cpp/api/JsiSkData.h +13 -7
- package/cpp/api/JsiSkDataFactory.h +22 -21
- package/cpp/api/JsiSkFont.h +56 -44
- package/cpp/api/JsiSkFontMgr.h +22 -13
- package/cpp/api/JsiSkFontMgrFactory.h +12 -10
- package/cpp/api/JsiSkFontStyle.h +14 -12
- package/cpp/api/JsiSkImage.h +45 -34
- package/cpp/api/JsiSkImageFactory.h +47 -52
- package/cpp/api/JsiSkImageFilter.h +21 -11
- package/cpp/api/JsiSkImageFilterFactory.h +96 -96
- package/cpp/api/JsiSkImageInfo.h +22 -19
- package/cpp/api/JsiSkMaskFilter.h +21 -11
- package/cpp/api/JsiSkMaskFilterFactory.h +16 -13
- package/cpp/api/JsiSkMatrix.h +31 -31
- package/cpp/api/JsiSkNativeObjects.h +419 -0
- package/cpp/api/JsiSkPaint.h +59 -39
- package/cpp/api/JsiSkParagraph.h +39 -32
- package/cpp/api/JsiSkParagraphBuilder.h +24 -21
- package/cpp/api/JsiSkParagraphBuilderFactory.h +13 -12
- package/cpp/api/JsiSkParagraphStyle.h +20 -10
- package/cpp/api/JsiSkPath.h +95 -70
- package/cpp/api/JsiSkPathBuilder.h +83 -67
- package/cpp/api/JsiSkPathBuilderFactory.h +16 -17
- package/cpp/api/JsiSkPathEffect.h +21 -11
- package/cpp/api/JsiSkPathEffectFactory.h +33 -32
- package/cpp/api/JsiSkPathFactory.h +79 -103
- package/cpp/api/JsiSkPicture.h +24 -13
- package/cpp/api/JsiSkPictureFactory.h +21 -26
- package/cpp/api/JsiSkPictureRecorder.h +21 -22
- package/cpp/api/JsiSkPoint.h +19 -22
- package/cpp/api/JsiSkRRect.h +22 -29
- package/cpp/api/JsiSkRSXform.h +26 -30
- package/cpp/api/JsiSkRect.h +28 -30
- package/cpp/api/JsiSkRuntimeEffect.h +39 -30
- package/cpp/api/JsiSkRuntimeEffectFactory.h +12 -12
- package/cpp/api/JsiSkRuntimeShaderBuilder.h +25 -18
- package/cpp/api/JsiSkSVG.h +13 -13
- package/cpp/api/JsiSkSVGFactory.h +17 -20
- package/cpp/api/JsiSkShader.h +15 -8
- package/cpp/api/JsiSkShaderFactory.h +41 -48
- package/cpp/api/JsiSkSkottie.h +49 -39
- package/cpp/api/JsiSkStrutStyle.h +18 -8
- package/cpp/api/JsiSkSurface.h +24 -24
- package/cpp/api/JsiSkSurfaceFactory.h +15 -16
- package/cpp/api/JsiSkTextBlob.h +15 -8
- package/cpp/api/JsiSkTextBlobFactory.h +25 -28
- package/cpp/api/JsiSkTextStyle.h +34 -24
- package/cpp/api/JsiSkTypeface.h +19 -12
- package/cpp/api/JsiSkTypefaceFactory.h +12 -12
- package/cpp/api/JsiSkTypefaceFontProvider.h +30 -25
- package/cpp/api/JsiSkTypefaceFontProviderFactory.h +14 -12
- package/cpp/api/JsiSkVertices.h +21 -18
- package/cpp/api/JsiSkiaContext.h +17 -17
- package/cpp/api/JsiSkottieFactory.h +16 -17
- package/cpp/api/JsiVideo.h +27 -25
- package/cpp/api/recorder/Convertor.h +31 -61
- package/cpp/api/recorder/DataTypes.h +8 -16
- package/cpp/api/recorder/JsiRecorder.h +83 -55
- package/cpp/api/recorder/RNRecorder.h +1 -1
- package/cpp/jsi/BoxedNativeObject.h +146 -0
- package/cpp/{jsi2 → jsi}/EnumMapper.h +4 -1
- package/cpp/{jsi2 → jsi}/NativeObject.h +120 -146
- package/cpp/jsi/RuntimeAwareCache.cpp +1 -1
- package/cpp/jsi/RuntimeAwareCache.h +26 -8
- package/cpp/jsi/ViewProperty.h +5 -11
- package/cpp/rnskia/RNSkJsiViewApi.h +20 -11
- package/cpp/rnskia/RNSkManager.cpp +29 -25
- package/cpp/rnskia/RNSkPictureView.h +1 -1
- package/cpp/rnwgpu/ArrayBuffer.h +5 -6
- package/cpp/rnwgpu/Canvas.h +4 -2
- package/cpp/rnwgpu/SurfaceRegistry.h +469 -131
- package/cpp/rnwgpu/api/GPU.cpp +4 -4
- package/cpp/rnwgpu/api/GPU.h +1 -1
- package/cpp/rnwgpu/api/GPUAdapter.cpp +12 -6
- package/cpp/rnwgpu/api/GPUAdapter.h +5 -4
- package/cpp/rnwgpu/api/GPUAdapterInfo.h +1 -1
- package/cpp/rnwgpu/api/GPUBindGroup.h +1 -1
- package/cpp/rnwgpu/api/GPUBindGroupLayout.h +1 -1
- package/cpp/rnwgpu/api/GPUBuffer.cpp +12 -2
- package/cpp/rnwgpu/api/GPUBuffer.h +4 -3
- package/cpp/rnwgpu/api/GPUCanvasContext.cpp +33 -19
- package/cpp/rnwgpu/api/GPUCanvasContext.h +4 -2
- package/cpp/rnwgpu/api/GPUCommandBuffer.h +1 -1
- package/cpp/rnwgpu/api/GPUCommandEncoder.h +1 -1
- package/cpp/rnwgpu/api/GPUCompilationInfo.h +1 -1
- package/cpp/rnwgpu/api/GPUCompilationMessage.h +1 -1
- package/cpp/rnwgpu/api/GPUComputePassEncoder.h +1 -1
- package/cpp/rnwgpu/api/GPUComputePipeline.h +1 -1
- package/cpp/rnwgpu/api/GPUDevice.cpp +38 -24
- package/cpp/rnwgpu/api/GPUDevice.h +12 -10
- package/cpp/rnwgpu/api/GPUDeviceLostInfo.h +1 -1
- package/cpp/rnwgpu/api/GPUError.h +1 -1
- package/cpp/rnwgpu/api/GPUExtent3D.h +1 -1
- package/cpp/rnwgpu/api/GPUExternalTexture.h +1 -1
- package/cpp/rnwgpu/api/GPUInternalError.h +1 -1
- package/cpp/rnwgpu/api/GPUOrigin2D.h +1 -1
- package/cpp/rnwgpu/api/GPUOrigin3D.h +1 -1
- package/cpp/rnwgpu/api/GPUOutOfMemoryError.h +1 -1
- package/cpp/rnwgpu/api/GPUPipelineLayout.h +1 -1
- package/cpp/rnwgpu/api/GPUQuerySet.h +1 -1
- package/cpp/rnwgpu/api/GPUQueue.cpp +6 -2
- package/cpp/rnwgpu/api/GPUQueue.h +4 -4
- package/cpp/rnwgpu/api/GPURenderBundle.h +1 -1
- package/cpp/rnwgpu/api/GPURenderBundleEncoder.h +1 -1
- package/cpp/rnwgpu/api/GPURenderPassEncoder.h +1 -1
- package/cpp/rnwgpu/api/GPURenderPipeline.h +1 -1
- package/cpp/rnwgpu/api/GPUSampler.h +1 -1
- package/cpp/rnwgpu/api/GPUShaderModule.cpp +8 -3
- package/cpp/rnwgpu/api/GPUShaderModule.h +4 -4
- package/cpp/rnwgpu/api/GPUSharedFence.h +1 -1
- package/cpp/rnwgpu/api/GPUSharedTextureMemory.h +1 -1
- package/cpp/rnwgpu/api/GPUSupportedLimits.h +1 -1
- package/cpp/rnwgpu/api/GPUTexture.h +1 -1
- package/cpp/rnwgpu/api/GPUTextureView.h +1 -1
- package/cpp/rnwgpu/api/GPUUncapturedErrorEvent.h +1 -1
- package/cpp/rnwgpu/api/GPUValidationError.h +1 -1
- package/cpp/rnwgpu/api/ImageBitmap.h +1 -1
- package/cpp/rnwgpu/api/RNWebGPU.h +21 -1
- package/cpp/rnwgpu/api/descriptors/GPUBindGroupDescriptor.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUBindGroupEntry.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUBindGroupLayoutDescriptor.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUBindGroupLayoutEntry.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUBlendComponent.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUBlendState.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUBufferBinding.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUBufferBindingLayout.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUBufferDescriptor.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUCanvasConfiguration.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUColor.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUColorTargetState.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUCommandBufferDescriptor.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUCommandEncoderDescriptor.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUComputePassDescriptor.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUComputePassTimestampWrites.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUComputePipelineDescriptor.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUDawnTogglesDescriptor.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUDepthStencilState.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUDeviceDescriptor.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUExternalTextureBindingLayout.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUExternalTextureDescriptor.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUFragmentState.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUImageCopyBuffer.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUImageCopyExternalImage.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUImageCopyTexture.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUImageCopyTextureTagged.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUImageDataLayout.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUMultisampleState.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUPipelineLayoutDescriptor.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUPrimitiveState.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUProgrammableStage.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUQuerySetDescriptor.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUQueueDescriptor.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPURenderBundleDescriptor.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPURenderBundleEncoderDescriptor.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPURenderPassColorAttachment.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPURenderPassDepthStencilAttachment.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPURenderPassDescriptor.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPURenderPassTimestampWrites.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPURenderPipelineDescriptor.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPURequestAdapterOptions.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUSamplerBindingLayout.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUSamplerDescriptor.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUShaderModuleCompilationHint.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUShaderModuleDescriptor.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUSharedFenceDescriptor.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUSharedFenceState.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUSharedTextureMemoryDescriptor.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUStencilFaceState.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUStorageTextureBindingLayout.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUTextureBindingLayout.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUTextureDescriptor.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUTextureViewDescriptor.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUUncapturedErrorEventInit.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUVertexAttribute.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUVertexBufferLayout.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUVertexState.h +1 -1
- package/cpp/rnwgpu/api/descriptors/Unions.h +1 -1
- package/cpp/rnwgpu/async/AsyncTaskHandle.cpp +20 -21
- package/cpp/rnwgpu/async/RuntimeContext.cpp +5 -0
- package/cpp/rnwgpu/async/RuntimeContext.h +15 -2
- package/lib/commonjs/external/reanimated/renderHelpers.d.ts +15 -0
- package/lib/commonjs/external/reanimated/renderHelpers.js +30 -1
- package/lib/commonjs/external/reanimated/renderHelpers.js.map +1 -1
- package/lib/commonjs/skia/NativeSetup.js +4 -0
- package/lib/commonjs/skia/NativeSetup.js.map +1 -1
- package/lib/commonjs/skia/SkiaWorkletSerialization.d.ts +1 -0
- package/lib/commonjs/skia/SkiaWorkletSerialization.js +66 -0
- package/lib/commonjs/skia/SkiaWorkletSerialization.js.map +1 -0
- package/lib/commonjs/sksg/Container.native.js +20 -1
- package/lib/commonjs/sksg/Container.native.js.map +1 -1
- package/lib/commonjs/views/WebGPUCanvas.d.ts +1 -0
- package/lib/commonjs/views/WebGPUCanvas.js +13 -0
- package/lib/commonjs/views/WebGPUCanvas.js.map +1 -1
- package/lib/module/external/reanimated/renderHelpers.d.ts +15 -0
- package/lib/module/external/reanimated/renderHelpers.js +29 -0
- package/lib/module/external/reanimated/renderHelpers.js.map +1 -1
- package/lib/module/skia/NativeSetup.js +4 -0
- package/lib/module/skia/NativeSetup.js.map +1 -1
- package/lib/module/skia/SkiaWorkletSerialization.d.ts +1 -0
- package/lib/module/skia/SkiaWorkletSerialization.js +59 -0
- package/lib/module/skia/SkiaWorkletSerialization.js.map +1 -0
- package/lib/module/sksg/Container.native.js +21 -2
- package/lib/module/sksg/Container.native.js.map +1 -1
- package/lib/module/views/WebGPUCanvas.d.ts +1 -0
- package/lib/module/views/WebGPUCanvas.js +14 -1
- package/lib/module/views/WebGPUCanvas.js.map +1 -1
- package/lib/typescript/lib/commonjs/external/reanimated/renderHelpers.d.ts +2 -0
- package/lib/typescript/lib/commonjs/skia/SkiaWorkletSerialization.d.ts +2 -0
- package/lib/typescript/lib/module/external/reanimated/renderHelpers.d.ts +15 -0
- package/lib/typescript/lib/module/skia/SkiaWorkletSerialization.d.ts +1 -0
- package/lib/typescript/src/external/reanimated/renderHelpers.d.ts +15 -0
- package/lib/typescript/src/skia/SkiaWorkletSerialization.d.ts +1 -0
- package/lib/typescript/src/views/WebGPUCanvas.d.ts +1 -0
- package/package.json +12 -8
- package/react-native-skia.podspec +1 -2
- package/src/external/reanimated/renderHelpers.ts +30 -0
- package/src/skia/NativeSetup.ts +5 -0
- package/src/skia/SkiaWorkletSerialization.ts +67 -0
- package/src/sksg/Container.native.ts +40 -2
- package/src/views/WebGPUCanvas.tsx +17 -1
- package/cpp/api/JsiSkHostObjects.h +0 -257
- package/cpp/dawn/include/dawn/dawn_proc.h +0 -53
- package/cpp/dawn/include/dawn/dawn_proc_table.h +0 -330
- package/cpp/dawn/include/dawn/dawn_thread_dispatch_proc.h +0 -47
- package/cpp/dawn/include/dawn/dawn_version.h +0 -41
- package/cpp/dawn/include/dawn/native/D3D11Backend.h +0 -65
- package/cpp/dawn/include/dawn/native/D3D12Backend.h +0 -86
- package/cpp/dawn/include/dawn/native/D3DBackend.h +0 -56
- package/cpp/dawn/include/dawn/native/DawnNative.h +0 -369
- package/cpp/dawn/include/dawn/native/MetalBackend.h +0 -56
- package/cpp/dawn/include/dawn/native/NullBackend.h +0 -39
- package/cpp/dawn/include/dawn/native/OpenGLBackend.h +0 -89
- package/cpp/dawn/include/dawn/native/VulkanBackend.h +0 -183
- package/cpp/dawn/include/dawn/native/WebGPUBackend.h +0 -49
- package/cpp/dawn/include/dawn/native/dawn_native_export.h +0 -49
- package/cpp/dawn/include/dawn/platform/DawnPlatform.h +0 -210
- package/cpp/dawn/include/dawn/platform/dawn_platform_export.h +0 -49
- package/cpp/dawn/include/dawn/replay/Replay.h +0 -99
- package/cpp/dawn/include/dawn/replay/dawn_replay_export.h +0 -49
- package/cpp/dawn/include/dawn/webgpu_cpp_print.h +0 -2844
- package/cpp/dawn/include/tint/tint.h +0 -90
- package/cpp/dawn/include/webgpu/webgpu.h +0 -4987
- package/cpp/dawn/include/webgpu/webgpu_cpp.h +0 -10080
- package/cpp/dawn/include/webgpu/webgpu_cpp_chained_struct.h +0 -57
- package/cpp/dawn/include/webgpu/webgpu_enum_class_bitmasks.h +0 -161
- package/cpp/dawn/include/webgpu/webgpu_glfw.h +0 -88
- package/cpp/jsi/JsiHostObject.cpp +0 -137
- package/cpp/jsi/JsiHostObject.h +0 -385
- package/cpp/skia/src/gpu/graphite/ContextOptionsPriv.h +0 -45
- package/cpp/skia/src/gpu/graphite/ResourceTypes.h +0 -360
- package/cpp/skia/src/gpu/graphite/TextureProxyView.h +0 -105
- package/libs/.graphite +0 -1
- /package/cpp/{jsi2 → jsi}/JSIConverter.h +0 -0
- /package/cpp/{jsi2 → jsi}/Promise.cpp +0 -0
- /package/cpp/{jsi2 → jsi}/Promise.h +0 -0
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
|
|
6
6
|
#include <jsi/jsi.h>
|
|
7
7
|
|
|
8
|
-
#include "JsiSkHostObjects.h"
|
|
9
8
|
#include "JsiSkImageFilter.h"
|
|
9
|
+
#include "JsiSkNativeObjects.h"
|
|
10
10
|
#include "JsiSkPicture.h"
|
|
11
11
|
#include "JsiSkRuntimeShaderBuilder.h"
|
|
12
12
|
|
|
@@ -28,8 +28,11 @@ inline bool hasOptionalArgument(const jsi::Value *arguments, size_t count,
|
|
|
28
28
|
!arguments[index].isUndefined());
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
class JsiSkImageFilterFactory
|
|
31
|
+
class JsiSkImageFilterFactory
|
|
32
|
+
: public JsiSkNativeObject<JsiSkImageFilterFactory> {
|
|
32
33
|
public:
|
|
34
|
+
static constexpr const char *CLASS_NAME = "ImageFilterFactory";
|
|
35
|
+
|
|
33
36
|
JSI_HOST_FUNCTION(MakeBlur) {
|
|
34
37
|
float sigmaX = arguments[0].asNumber();
|
|
35
38
|
float sigmaY = arguments[1].asNumber();
|
|
@@ -45,8 +48,7 @@ public:
|
|
|
45
48
|
auto filter = std::make_shared<JsiSkImageFilter>(
|
|
46
49
|
getContext(), SkImageFilters::Blur(sigmaX, sigmaY, (SkTileMode)tileMode,
|
|
47
50
|
imageFilter, cropRect));
|
|
48
|
-
return
|
|
49
|
-
getContext());
|
|
51
|
+
return makeJsiObject(runtime, std::move(filter));
|
|
50
52
|
}
|
|
51
53
|
|
|
52
54
|
JSI_HOST_FUNCTION(MakeColorFilter) {
|
|
@@ -62,8 +64,7 @@ public:
|
|
|
62
64
|
auto filter = std::make_shared<JsiSkImageFilter>(
|
|
63
65
|
getContext(),
|
|
64
66
|
SkImageFilters::ColorFilter(std::move(cf), std::move(input), cropRect));
|
|
65
|
-
return
|
|
66
|
-
getContext());
|
|
67
|
+
return makeJsiObject(runtime, std::move(filter));
|
|
67
68
|
}
|
|
68
69
|
|
|
69
70
|
JSI_HOST_FUNCTION(MakeOffset) {
|
|
@@ -79,8 +80,7 @@ public:
|
|
|
79
80
|
}
|
|
80
81
|
auto filter = std::make_shared<JsiSkImageFilter>(
|
|
81
82
|
getContext(), SkImageFilters::Offset(x, y, std::move(input), cropRect));
|
|
82
|
-
return
|
|
83
|
-
getContext());
|
|
83
|
+
return makeJsiObject(runtime, std::move(filter));
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
JSI_HOST_FUNCTION(MakeDisplacementMap) {
|
|
@@ -102,8 +102,7 @@ public:
|
|
|
102
102
|
getContext(), SkImageFilters::DisplacementMap(
|
|
103
103
|
fXChannelSelector, fYChannelSelector, scale,
|
|
104
104
|
std::move(in2), std::move(input), cropRect));
|
|
105
|
-
return
|
|
106
|
-
getContext());
|
|
105
|
+
return makeJsiObject(runtime, std::move(filter));
|
|
107
106
|
}
|
|
108
107
|
|
|
109
108
|
JSI_HOST_FUNCTION(MakeShader) {
|
|
@@ -120,8 +119,7 @@ public:
|
|
|
120
119
|
auto filter = std::make_shared<JsiSkImageFilter>(
|
|
121
120
|
getContext(),
|
|
122
121
|
SkImageFilters::Shader(std::move(shader), dither, cropRect));
|
|
123
|
-
return
|
|
124
|
-
getContext());
|
|
122
|
+
return makeJsiObject(runtime, std::move(filter));
|
|
125
123
|
}
|
|
126
124
|
|
|
127
125
|
JSI_HOST_FUNCTION(MakeCompose) {
|
|
@@ -136,8 +134,7 @@ public:
|
|
|
136
134
|
auto filter = std::make_shared<JsiSkImageFilter>(
|
|
137
135
|
getContext(),
|
|
138
136
|
SkImageFilters::Compose(std::move(outer), std::move(inner)));
|
|
139
|
-
return
|
|
140
|
-
getContext());
|
|
137
|
+
return makeJsiObject(runtime, std::move(filter));
|
|
141
138
|
}
|
|
142
139
|
|
|
143
140
|
JSI_HOST_FUNCTION(MakeBlend) {
|
|
@@ -159,8 +156,7 @@ public:
|
|
|
159
156
|
getContext(),
|
|
160
157
|
SkImageFilters::Blend(std::move(mode), std::move(background),
|
|
161
158
|
std::move(foreground), cropRect));
|
|
162
|
-
return
|
|
163
|
-
getContext());
|
|
159
|
+
return makeJsiObject(runtime, std::move(filter));
|
|
164
160
|
}
|
|
165
161
|
|
|
166
162
|
JSI_HOST_FUNCTION(MakeDropShadow) {
|
|
@@ -180,8 +176,7 @@ public:
|
|
|
180
176
|
auto filter = std::make_shared<JsiSkImageFilter>(
|
|
181
177
|
getContext(), SkImageFilters::DropShadow(dx, dy, sigmaX, sigmaY, color,
|
|
182
178
|
std::move(input), cropRect));
|
|
183
|
-
return
|
|
184
|
-
getContext());
|
|
179
|
+
return makeJsiObject(runtime, std::move(filter));
|
|
185
180
|
}
|
|
186
181
|
|
|
187
182
|
JSI_HOST_FUNCTION(MakeDropShadowOnly) {
|
|
@@ -202,8 +197,7 @@ public:
|
|
|
202
197
|
getContext(),
|
|
203
198
|
SkImageFilters::DropShadowOnly(dx, dy, sigmaX, sigmaY, color,
|
|
204
199
|
std::move(input), cropRect));
|
|
205
|
-
return
|
|
206
|
-
getContext());
|
|
200
|
+
return makeJsiObject(runtime, std::move(filter));
|
|
207
201
|
}
|
|
208
202
|
|
|
209
203
|
JSI_HOST_FUNCTION(MakeErode) {
|
|
@@ -220,8 +214,7 @@ public:
|
|
|
220
214
|
auto filter = std::make_shared<JsiSkImageFilter>(
|
|
221
215
|
getContext(),
|
|
222
216
|
SkImageFilters::Erode(rx, ry, std::move(input), cropRect));
|
|
223
|
-
return
|
|
224
|
-
getContext());
|
|
217
|
+
return makeJsiObject(runtime, std::move(filter));
|
|
225
218
|
}
|
|
226
219
|
|
|
227
220
|
JSI_HOST_FUNCTION(MakeDilate) {
|
|
@@ -238,8 +231,7 @@ public:
|
|
|
238
231
|
auto filter = std::make_shared<JsiSkImageFilter>(
|
|
239
232
|
getContext(),
|
|
240
233
|
SkImageFilters::Dilate(rx, ry, std::move(input), cropRect));
|
|
241
|
-
return
|
|
242
|
-
getContext());
|
|
234
|
+
return makeJsiObject(runtime, std::move(filter));
|
|
243
235
|
}
|
|
244
236
|
|
|
245
237
|
JSI_HOST_FUNCTION(MakeRuntimeShader) {
|
|
@@ -259,8 +251,7 @@ public:
|
|
|
259
251
|
auto filter = std::make_shared<JsiSkImageFilter>(
|
|
260
252
|
getContext(),
|
|
261
253
|
SkImageFilters::RuntimeShader(*rtb, childName, std::move(input)));
|
|
262
|
-
return
|
|
263
|
-
getContext());
|
|
254
|
+
return makeJsiObject(runtime, std::move(filter));
|
|
264
255
|
}
|
|
265
256
|
|
|
266
257
|
JSI_HOST_FUNCTION(MakeArithmetic) {
|
|
@@ -285,8 +276,7 @@ public:
|
|
|
285
276
|
getContext(), SkImageFilters::Arithmetic(
|
|
286
277
|
k1, k2, k3, k4, enforcePMColor, std::move(background),
|
|
287
278
|
std::move(foreground), cropRect));
|
|
288
|
-
return
|
|
289
|
-
getContext());
|
|
279
|
+
return makeJsiObject(runtime, std::move(filter));
|
|
290
280
|
}
|
|
291
281
|
|
|
292
282
|
JSI_HOST_FUNCTION(MakeCrop) {
|
|
@@ -302,15 +292,13 @@ public:
|
|
|
302
292
|
auto filter = std::make_shared<JsiSkImageFilter>(
|
|
303
293
|
getContext(),
|
|
304
294
|
SkImageFilters::Crop(rect, tileMode, std::move(imageFilter)));
|
|
305
|
-
return
|
|
306
|
-
getContext());
|
|
295
|
+
return makeJsiObject(runtime, std::move(filter));
|
|
307
296
|
}
|
|
308
297
|
|
|
309
298
|
JSI_HOST_FUNCTION(MakeEmpty) {
|
|
310
299
|
auto filter = std::make_shared<JsiSkImageFilter>(getContext(),
|
|
311
300
|
SkImageFilters::Empty());
|
|
312
|
-
return
|
|
313
|
-
getContext());
|
|
301
|
+
return makeJsiObject(runtime, std::move(filter));
|
|
314
302
|
}
|
|
315
303
|
|
|
316
304
|
inline SkPoint3 SkPoint3FromValue(jsi::Runtime &runtime,
|
|
@@ -339,8 +327,7 @@ public:
|
|
|
339
327
|
getContext(),
|
|
340
328
|
SkImageFilters::DistantLitDiffuse(direction, lightColor, surfaceScale,
|
|
341
329
|
kd, std::move(input), cropRect));
|
|
342
|
-
return
|
|
343
|
-
getContext());
|
|
330
|
+
return makeJsiObject(runtime, std::move(filter));
|
|
344
331
|
}
|
|
345
332
|
|
|
346
333
|
JSI_HOST_FUNCTION(MakePointLitDiffuse) {
|
|
@@ -360,8 +347,7 @@ public:
|
|
|
360
347
|
getContext(),
|
|
361
348
|
SkImageFilters::PointLitDiffuse(location, lightColor, surfaceScale, kd,
|
|
362
349
|
std::move(input), cropRect));
|
|
363
|
-
return
|
|
364
|
-
getContext());
|
|
350
|
+
return makeJsiObject(runtime, std::move(filter));
|
|
365
351
|
}
|
|
366
352
|
|
|
367
353
|
JSI_HOST_FUNCTION(MakeSpotLitDiffuse) {
|
|
@@ -385,8 +371,7 @@ public:
|
|
|
385
371
|
SkImageFilters::SpotLitDiffuse(location, target, falloffExponent,
|
|
386
372
|
cutoffAngle, lightColor, surfaceScale,
|
|
387
373
|
kd, std::move(input), cropRect));
|
|
388
|
-
return
|
|
389
|
-
getContext());
|
|
374
|
+
return makeJsiObject(runtime, std::move(filter));
|
|
390
375
|
}
|
|
391
376
|
|
|
392
377
|
JSI_HOST_FUNCTION(MakeDistantLitSpecular) {
|
|
@@ -407,8 +392,7 @@ public:
|
|
|
407
392
|
getContext(), SkImageFilters::DistantLitSpecular(
|
|
408
393
|
direction, lightColor, surfaceScale, ks, shininess,
|
|
409
394
|
std::move(input), cropRect));
|
|
410
|
-
return
|
|
411
|
-
getContext());
|
|
395
|
+
return makeJsiObject(runtime, std::move(filter));
|
|
412
396
|
}
|
|
413
397
|
|
|
414
398
|
JSI_HOST_FUNCTION(MakePointLitSpecular) {
|
|
@@ -429,8 +413,7 @@ public:
|
|
|
429
413
|
getContext(), SkImageFilters::PointLitSpecular(
|
|
430
414
|
location, lightColor, surfaceScale, ks, shininess,
|
|
431
415
|
std::move(input), cropRect));
|
|
432
|
-
return
|
|
433
|
-
getContext());
|
|
416
|
+
return makeJsiObject(runtime, std::move(filter));
|
|
434
417
|
}
|
|
435
418
|
|
|
436
419
|
JSI_HOST_FUNCTION(MakeSpotLitSpecular) {
|
|
@@ -455,8 +438,7 @@ public:
|
|
|
455
438
|
SkImageFilters::SpotLitSpecular(
|
|
456
439
|
location, target, falloffExponent, cutoffAngle, lightColor,
|
|
457
440
|
surfaceScale, ks, shininess, std::move(input), cropRect));
|
|
458
|
-
return
|
|
459
|
-
getContext());
|
|
441
|
+
return makeJsiObject(runtime, std::move(filter));
|
|
460
442
|
}
|
|
461
443
|
|
|
462
444
|
JSI_HOST_FUNCTION(MakeImage) {
|
|
@@ -485,8 +467,7 @@ public:
|
|
|
485
467
|
getContext(),
|
|
486
468
|
SkImageFilters::Image(std::move(image), srcRect, dstRect,
|
|
487
469
|
SkSamplingOptions(filterMode, mipmap)));
|
|
488
|
-
return
|
|
489
|
-
getContext());
|
|
470
|
+
return makeJsiObject(runtime, std::move(filter));
|
|
490
471
|
}
|
|
491
472
|
|
|
492
473
|
JSI_HOST_FUNCTION(MakeMagnifier) {
|
|
@@ -514,8 +495,7 @@ public:
|
|
|
514
495
|
SkImageFilters::Magnifier(lensBounds, zoomAmount, inset,
|
|
515
496
|
SkSamplingOptions(filterMode, mipmap), input,
|
|
516
497
|
cropRect));
|
|
517
|
-
return
|
|
518
|
-
getContext());
|
|
498
|
+
return makeJsiObject(runtime, std::move(filter));
|
|
519
499
|
}
|
|
520
500
|
|
|
521
501
|
JSI_HOST_FUNCTION(MakeMatrixConvolution) {
|
|
@@ -545,8 +525,7 @@ public:
|
|
|
545
525
|
getContext(), SkImageFilters::MatrixConvolution(
|
|
546
526
|
kernelSize, kernel.data(), gain, bias, kernelOffset,
|
|
547
527
|
tileMode, convolveAlpha, std::move(input), cropRect));
|
|
548
|
-
return
|
|
549
|
-
getContext());
|
|
528
|
+
return makeJsiObject(runtime, std::move(filter));
|
|
550
529
|
}
|
|
551
530
|
|
|
552
531
|
JSI_HOST_FUNCTION(MakeMatrixTransform) {
|
|
@@ -567,8 +546,7 @@ public:
|
|
|
567
546
|
getContext(),
|
|
568
547
|
SkImageFilters::MatrixTransform(
|
|
569
548
|
matrix, SkSamplingOptions(filterMode, mipmap), std::move(input)));
|
|
570
|
-
return
|
|
571
|
-
getContext());
|
|
549
|
+
return makeJsiObject(runtime, std::move(filter));
|
|
572
550
|
}
|
|
573
551
|
|
|
574
552
|
JSI_HOST_FUNCTION(MakeMerge) {
|
|
@@ -590,8 +568,7 @@ public:
|
|
|
590
568
|
auto filter = std::make_shared<JsiSkImageFilter>(
|
|
591
569
|
getContext(),
|
|
592
570
|
SkImageFilters::Merge(filters.data(), filtersCount, cropRect));
|
|
593
|
-
return
|
|
594
|
-
getContext());
|
|
571
|
+
return makeJsiObject(runtime, std::move(filter));
|
|
595
572
|
}
|
|
596
573
|
|
|
597
574
|
JSI_HOST_FUNCTION(MakePicture) {
|
|
@@ -604,8 +581,7 @@ public:
|
|
|
604
581
|
}
|
|
605
582
|
auto filter = std::make_shared<JsiSkImageFilter>(
|
|
606
583
|
getContext(), SkImageFilters::Picture(std::move(picture), targetRect));
|
|
607
|
-
return
|
|
608
|
-
getContext());
|
|
584
|
+
return makeJsiObject(runtime, std::move(filter));
|
|
609
585
|
}
|
|
610
586
|
|
|
611
587
|
JSI_HOST_FUNCTION(MakeRuntimeShaderWithChildren) {
|
|
@@ -641,8 +617,7 @@ public:
|
|
|
641
617
|
getContext(), SkImageFilters::RuntimeShader(*rtb, maxSampleRadius,
|
|
642
618
|
childNamesStringView.data(),
|
|
643
619
|
inputs.data(), length));
|
|
644
|
-
return
|
|
645
|
-
getContext());
|
|
620
|
+
return makeJsiObject(runtime, std::move(filter));
|
|
646
621
|
}
|
|
647
622
|
|
|
648
623
|
JSI_HOST_FUNCTION(MakeTile) {
|
|
@@ -654,49 +629,74 @@ public:
|
|
|
654
629
|
}
|
|
655
630
|
auto filter = std::make_shared<JsiSkImageFilter>(
|
|
656
631
|
getContext(), SkImageFilters::Tile(src, dst, std::move(input)));
|
|
657
|
-
return
|
|
658
|
-
getContext());
|
|
632
|
+
return makeJsiObject(runtime, std::move(filter));
|
|
659
633
|
}
|
|
660
634
|
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
635
|
+
static void definePrototype(jsi::Runtime &runtime, jsi::Object &prototype) {
|
|
636
|
+
installHostMethod(runtime, prototype, "MakeBlur",
|
|
637
|
+
&JsiSkImageFilterFactory::MakeBlur);
|
|
638
|
+
installHostMethod(runtime, prototype, "MakeOffset",
|
|
639
|
+
&JsiSkImageFilterFactory::MakeOffset);
|
|
640
|
+
installHostMethod(runtime, prototype, "MakeColorFilter",
|
|
641
|
+
&JsiSkImageFilterFactory::MakeColorFilter);
|
|
642
|
+
installHostMethod(runtime, prototype, "MakeShader",
|
|
643
|
+
&JsiSkImageFilterFactory::MakeShader);
|
|
644
|
+
installHostMethod(runtime, prototype, "MakeDisplacementMap",
|
|
645
|
+
&JsiSkImageFilterFactory::MakeDisplacementMap);
|
|
646
|
+
installHostMethod(runtime, prototype, "MakeCompose",
|
|
647
|
+
&JsiSkImageFilterFactory::MakeCompose);
|
|
648
|
+
installHostMethod(runtime, prototype, "MakeErode",
|
|
649
|
+
&JsiSkImageFilterFactory::MakeErode);
|
|
650
|
+
installHostMethod(runtime, prototype, "MakeDilate",
|
|
651
|
+
&JsiSkImageFilterFactory::MakeDilate);
|
|
652
|
+
installHostMethod(runtime, prototype, "MakeBlend",
|
|
653
|
+
&JsiSkImageFilterFactory::MakeBlend);
|
|
654
|
+
installHostMethod(runtime, prototype, "MakeDropShadow",
|
|
655
|
+
&JsiSkImageFilterFactory::MakeDropShadow);
|
|
656
|
+
installHostMethod(runtime, prototype, "MakeDropShadowOnly",
|
|
657
|
+
&JsiSkImageFilterFactory::MakeDropShadowOnly);
|
|
658
|
+
installHostMethod(runtime, prototype, "MakeRuntimeShader",
|
|
659
|
+
&JsiSkImageFilterFactory::MakeRuntimeShader);
|
|
660
|
+
installHostMethod(runtime, prototype, "MakeArithmetic",
|
|
661
|
+
&JsiSkImageFilterFactory::MakeArithmetic);
|
|
662
|
+
installHostMethod(runtime, prototype, "MakeCrop",
|
|
663
|
+
&JsiSkImageFilterFactory::MakeCrop);
|
|
664
|
+
installHostMethod(runtime, prototype, "MakeEmpty",
|
|
665
|
+
&JsiSkImageFilterFactory::MakeEmpty);
|
|
666
|
+
installHostMethod(runtime, prototype, "MakeImage",
|
|
667
|
+
&JsiSkImageFilterFactory::MakeImage);
|
|
668
|
+
installHostMethod(runtime, prototype, "MakeMagnifier",
|
|
669
|
+
&JsiSkImageFilterFactory::MakeMagnifier);
|
|
670
|
+
installHostMethod(runtime, prototype, "MakeMatrixConvolution",
|
|
671
|
+
&JsiSkImageFilterFactory::MakeMatrixConvolution);
|
|
672
|
+
installHostMethod(runtime, prototype, "MakeMatrixTransform",
|
|
673
|
+
&JsiSkImageFilterFactory::MakeMatrixTransform);
|
|
674
|
+
installHostMethod(runtime, prototype, "MakeMerge",
|
|
675
|
+
&JsiSkImageFilterFactory::MakeMerge);
|
|
676
|
+
installHostMethod(runtime, prototype, "MakePicture",
|
|
677
|
+
&JsiSkImageFilterFactory::MakePicture);
|
|
678
|
+
installHostMethod(runtime, prototype, "MakeRuntimeShaderWithChildren",
|
|
679
|
+
&JsiSkImageFilterFactory::MakeRuntimeShaderWithChildren);
|
|
680
|
+
installHostMethod(runtime, prototype, "MakeTile",
|
|
681
|
+
&JsiSkImageFilterFactory::MakeTile);
|
|
682
|
+
installHostMethod(runtime, prototype, "MakeDistantLitDiffuse",
|
|
683
|
+
&JsiSkImageFilterFactory::MakeDistantLitDiffuse);
|
|
684
|
+
installHostMethod(runtime, prototype, "MakePointLitDiffuse",
|
|
685
|
+
&JsiSkImageFilterFactory::MakePointLitDiffuse);
|
|
686
|
+
installHostMethod(runtime, prototype, "MakeSpotLitDiffuse",
|
|
687
|
+
&JsiSkImageFilterFactory::MakeSpotLitDiffuse);
|
|
688
|
+
installHostMethod(runtime, prototype, "MakeDistantLitSpecular",
|
|
689
|
+
&JsiSkImageFilterFactory::MakeDistantLitSpecular);
|
|
690
|
+
installHostMethod(runtime, prototype, "MakePointLitSpecular",
|
|
691
|
+
&JsiSkImageFilterFactory::MakePointLitSpecular);
|
|
692
|
+
installHostMethod(runtime, prototype, "MakeSpotLitSpecular",
|
|
693
|
+
&JsiSkImageFilterFactory::MakeSpotLitSpecular);
|
|
696
694
|
}
|
|
697
695
|
|
|
696
|
+
size_t getMemoryPressure() override { return 2048; }
|
|
697
|
+
|
|
698
698
|
explicit JsiSkImageFilterFactory(std::shared_ptr<RNSkPlatformContext> context)
|
|
699
|
-
:
|
|
699
|
+
: JsiSkNativeObject<JsiSkImageFilterFactory>(std::move(context)) {}
|
|
700
700
|
};
|
|
701
701
|
|
|
702
702
|
} // namespace RNSkia
|
package/cpp/api/JsiSkImageInfo.h
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
#include <jsi/jsi.h>
|
|
7
7
|
|
|
8
|
-
#include "
|
|
8
|
+
#include "JsiSkNativeObjects.h"
|
|
9
9
|
|
|
10
10
|
#pragma clang diagnostic push
|
|
11
11
|
#pragma clang diagnostic ignored "-Wdocumentation"
|
|
@@ -18,11 +18,14 @@ namespace RNSkia {
|
|
|
18
18
|
|
|
19
19
|
namespace jsi = facebook::jsi;
|
|
20
20
|
|
|
21
|
-
class JsiSkImageInfo
|
|
21
|
+
class JsiSkImageInfo
|
|
22
|
+
: public JsiSkWrappingSharedPtrNativeObject<JsiSkImageInfo, SkImageInfo> {
|
|
22
23
|
public:
|
|
24
|
+
static constexpr const char *CLASS_NAME = "ImageInfo";
|
|
25
|
+
|
|
23
26
|
JsiSkImageInfo(std::shared_ptr<RNSkPlatformContext> context,
|
|
24
27
|
const SkImageInfo &imageInfo)
|
|
25
|
-
:
|
|
28
|
+
: JsiSkWrappingSharedPtrNativeObject<JsiSkImageInfo, SkImageInfo>(
|
|
26
29
|
std::move(context), std::make_shared<SkImageInfo>(imageInfo)) {}
|
|
27
30
|
|
|
28
31
|
/**
|
|
@@ -31,8 +34,9 @@ public:
|
|
|
31
34
|
static std::shared_ptr<SkImageInfo> fromValue(jsi::Runtime &runtime,
|
|
32
35
|
const jsi::Value &obj) {
|
|
33
36
|
const auto &object = obj.asObject(runtime);
|
|
34
|
-
|
|
35
|
-
|
|
37
|
+
auto imageInfo = tryGetJsiObject<JsiSkImageInfo>(runtime, object);
|
|
38
|
+
if (imageInfo) {
|
|
39
|
+
return imageInfo->getObject();
|
|
36
40
|
} else {
|
|
37
41
|
auto width = object.getProperty(runtime, "width").asNumber();
|
|
38
42
|
auto height = object.getProperty(runtime, "height").asNumber();
|
|
@@ -52,10 +56,8 @@ public:
|
|
|
52
56
|
static jsi::Value toValue(jsi::Runtime &runtime,
|
|
53
57
|
std::shared_ptr<RNSkPlatformContext> context,
|
|
54
58
|
const SkImageInfo &imageInfo) {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
return JSI_CREATE_HOST_OBJECT_WITH_MEMORY_PRESSURE(runtime, imageInfoObj,
|
|
58
|
-
context);
|
|
59
|
+
return makeJsiObject(runtime, std::make_shared<JsiSkImageInfo>(
|
|
60
|
+
std::move(context), imageInfo));
|
|
59
61
|
}
|
|
60
62
|
|
|
61
63
|
JSI_PROPERTY_GET(width) { return static_cast<double>(getObject()->width()); }
|
|
@@ -69,18 +71,19 @@ public:
|
|
|
69
71
|
return static_cast<double>(getObject()->alphaType());
|
|
70
72
|
}
|
|
71
73
|
|
|
72
|
-
size_t getMemoryPressure()
|
|
74
|
+
size_t getMemoryPressure() override {
|
|
73
75
|
return std::max(sizeof(SkImageInfo), kMinMemoryPressure);
|
|
74
76
|
}
|
|
75
77
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
78
|
+
static void definePrototype(jsi::Runtime &runtime, jsi::Object &prototype) {
|
|
79
|
+
installCommon(runtime, prototype);
|
|
80
|
+
installHostGetter(runtime, prototype, "width", &JsiSkImageInfo::get_width);
|
|
81
|
+
installHostGetter(runtime, prototype, "height",
|
|
82
|
+
&JsiSkImageInfo::get_height);
|
|
83
|
+
installHostGetter(runtime, prototype, "colorType",
|
|
84
|
+
&JsiSkImageInfo::get_colorType);
|
|
85
|
+
installHostGetter(runtime, prototype, "alphaType",
|
|
86
|
+
&JsiSkImageInfo::get_alphaType);
|
|
87
|
+
}
|
|
85
88
|
};
|
|
86
89
|
} // namespace RNSkia
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
#include <jsi/jsi.h>
|
|
7
7
|
|
|
8
|
-
#include "
|
|
8
|
+
#include "JsiSkNativeObjects.h"
|
|
9
9
|
|
|
10
10
|
#pragma clang diagnostic push
|
|
11
11
|
#pragma clang diagnostic ignored "-Wdocumentation"
|
|
@@ -18,19 +18,29 @@ namespace RNSkia {
|
|
|
18
18
|
|
|
19
19
|
namespace jsi = facebook::jsi;
|
|
20
20
|
|
|
21
|
-
class JsiSkMaskFilter
|
|
21
|
+
class JsiSkMaskFilter
|
|
22
|
+
: public JsiSkWrappingSkPtrNativeObject<JsiSkMaskFilter, SkMaskFilter> {
|
|
22
23
|
public:
|
|
24
|
+
static constexpr const char *CLASS_NAME = "MaskFilter";
|
|
25
|
+
|
|
23
26
|
JsiSkMaskFilter(std::shared_ptr<RNSkPlatformContext> context,
|
|
24
27
|
sk_sp<SkMaskFilter> maskFilter)
|
|
25
|
-
:
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
size_t getMemoryPressure()
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
28
|
+
: JsiSkWrappingSkPtrNativeObject<JsiSkMaskFilter, SkMaskFilter>(
|
|
29
|
+
std::move(context), std::move(maskFilter)) {}
|
|
30
|
+
|
|
31
|
+
size_t getMemoryPressure() override { return 2048; }
|
|
32
|
+
|
|
33
|
+
static void definePrototype(jsi::Runtime &runtime, jsi::Object &prototype) {
|
|
34
|
+
installCommon(runtime, prototype);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
Returns the underlying object from a host object of this type
|
|
39
|
+
*/
|
|
40
|
+
static sk_sp<SkMaskFilter> fromValue(jsi::Runtime &runtime,
|
|
41
|
+
const jsi::Value &obj) {
|
|
42
|
+
return objectFromValue(runtime, obj);
|
|
43
|
+
}
|
|
34
44
|
};
|
|
35
45
|
|
|
36
46
|
} // namespace RNSkia
|
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
#include <jsi/jsi.h>
|
|
7
7
|
|
|
8
8
|
#include "JsiSkColorFilter.h"
|
|
9
|
-
#include "
|
|
9
|
+
#include "JsiSkMaskFilter.h"
|
|
10
|
+
#include "JsiSkNativeObjects.h"
|
|
10
11
|
|
|
11
12
|
#pragma clang diagnostic push
|
|
12
13
|
#pragma clang diagnostic ignored "-Wdocumentation"
|
|
@@ -19,29 +20,31 @@ namespace RNSkia {
|
|
|
19
20
|
|
|
20
21
|
namespace jsi = facebook::jsi;
|
|
21
22
|
|
|
22
|
-
class JsiSkMaskFilterFactory
|
|
23
|
+
class JsiSkMaskFilterFactory
|
|
24
|
+
: public JsiSkNativeObject<JsiSkMaskFilterFactory> {
|
|
23
25
|
public:
|
|
26
|
+
static constexpr const char *CLASS_NAME = "MaskFilterFactory";
|
|
27
|
+
|
|
24
28
|
JSI_HOST_FUNCTION(MakeBlur) {
|
|
25
29
|
int blurStyle = arguments[0].asNumber();
|
|
26
30
|
float sigma = arguments[1].asNumber();
|
|
27
31
|
bool respectCTM = arguments[2].getBool();
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
32
|
+
return makeJsiObject(
|
|
33
|
+
runtime,
|
|
34
|
+
std::make_shared<JsiSkMaskFilter>(
|
|
35
|
+
getContext(),
|
|
36
|
+
SkMaskFilter::MakeBlur((SkBlurStyle)blurStyle, sigma, respectCTM)));
|
|
33
37
|
}
|
|
34
38
|
|
|
35
|
-
size_t getMemoryPressure()
|
|
39
|
+
size_t getMemoryPressure() override { return 1024; }
|
|
36
40
|
|
|
37
|
-
|
|
38
|
-
|
|
41
|
+
static void definePrototype(jsi::Runtime &runtime, jsi::Object &prototype) {
|
|
42
|
+
installHostMethod(runtime, prototype, "MakeBlur",
|
|
43
|
+
&JsiSkMaskFilterFactory::MakeBlur);
|
|
39
44
|
}
|
|
40
45
|
|
|
41
|
-
JSI_EXPORT_FUNCTIONS(JSI_EXPORT_FUNC(JsiSkMaskFilterFactory, MakeBlur))
|
|
42
|
-
|
|
43
46
|
explicit JsiSkMaskFilterFactory(std::shared_ptr<RNSkPlatformContext> context)
|
|
44
|
-
:
|
|
47
|
+
: JsiSkNativeObject<JsiSkMaskFilterFactory>(std::move(context)) {}
|
|
45
48
|
};
|
|
46
49
|
|
|
47
50
|
} // namespace RNSkia
|