@shopify/react-native-skia 2.0.6 → 2.1.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 +20 -1
- package/cpp/api/JsiSkApi.h +3 -0
- package/cpp/api/JsiSkImageFilterFactory.h +478 -39
- package/cpp/api/JsiSkPath.h +2 -1
- package/cpp/api/JsiSkPathFactory.h +1 -1
- package/cpp/api/JsiSkSkottie.h +590 -0
- package/cpp/api/JsiSkottieFactory.h +65 -0
- package/cpp/api/recorder/Command.h +1 -0
- package/cpp/api/recorder/Convertor.h +16 -0
- package/cpp/api/recorder/Drawings.h +23 -0
- package/cpp/api/recorder/JsiRecorder.h +6 -0
- package/cpp/api/recorder/RNRecorder.h +9 -0
- package/cpp/api/third_party/SkottieUtils.cpp +333 -0
- package/cpp/api/third_party/SkottieUtils.h +172 -0
- package/cpp/skia/modules/jsonreader/SkJSONReader.cpp +980 -0
- package/cpp/skia/modules/jsonreader/SkJSONReader.h +389 -0
- package/cpp/skia/modules/skottie/include/ExternalLayer.h +56 -0
- package/cpp/skia/modules/skottie/include/Skottie.h +313 -0
- package/cpp/skia/modules/skottie/include/SkottieProperty.h +190 -0
- package/cpp/skia/modules/skottie/include/SlotManager.h +113 -0
- package/cpp/skia/modules/skottie/include/TextShaper.h +200 -0
- package/cpp/skia/modules/skottie/src/SkottieValue.h +56 -0
- package/cpp/skia/modules/skottie/src/animator/Animator.h +89 -0
- package/cpp/skia/modules/skottie/src/text/Font.h +82 -0
- package/cpp/skia/modules/skottie/src/text/TextAdapter.h +155 -0
- package/cpp/skia/modules/skottie/src/text/TextAnimator.h +121 -0
- package/cpp/skia/modules/skottie/src/text/TextValue.h +28 -0
- package/cpp/skia/modules/sksg/include/SkSGClipEffect.h +61 -0
- package/cpp/skia/modules/sksg/include/SkSGColorFilter.h +135 -0
- package/cpp/skia/modules/sksg/include/SkSGDraw.h +57 -0
- package/cpp/skia/modules/sksg/include/SkSGEffectNode.h +50 -0
- package/cpp/skia/modules/sksg/include/SkSGGeometryEffect.h +181 -0
- package/cpp/skia/modules/sksg/include/SkSGGeometryNode.h +54 -0
- package/cpp/skia/modules/sksg/include/SkSGGradient.h +108 -0
- package/cpp/skia/modules/sksg/include/SkSGGroup.h +65 -0
- package/cpp/skia/modules/sksg/include/SkSGImage.h +59 -0
- package/cpp/skia/modules/sksg/include/SkSGInvalidationController.h +46 -0
- package/cpp/skia/modules/sksg/include/SkSGMaskEffect.h +65 -0
- package/cpp/skia/modules/sksg/include/SkSGMerge.h +74 -0
- package/cpp/skia/modules/sksg/include/SkSGNode.h +128 -0
- package/cpp/skia/modules/sksg/include/SkSGOpacityEffect.h +54 -0
- package/cpp/skia/modules/sksg/include/SkSGPaint.h +112 -0
- package/cpp/skia/modules/sksg/include/SkSGPath.h +68 -0
- package/cpp/skia/modules/sksg/include/SkSGPlane.h +47 -0
- package/cpp/skia/modules/sksg/include/SkSGRect.h +122 -0
- package/cpp/skia/modules/sksg/include/SkSGRenderEffect.h +283 -0
- package/cpp/skia/modules/sksg/include/SkSGRenderNode.h +157 -0
- package/cpp/skia/modules/sksg/include/SkSGScene.h +47 -0
- package/cpp/skia/modules/sksg/include/SkSGText.h +82 -0
- package/cpp/skia/modules/sksg/include/SkSGTransform.h +127 -0
- package/cpp/skia/src/base/SkArenaAlloc.h +371 -0
- package/lib/commonjs/dom/nodes/datatypes/Gradient.d.ts +15 -15
- package/lib/commonjs/dom/types/Drawings.d.ts +5 -1
- package/lib/commonjs/dom/types/Drawings.js.map +1 -1
- package/lib/commonjs/dom/types/NodeType.d.ts +2 -1
- package/lib/commonjs/dom/types/NodeType.js +2 -0
- package/lib/commonjs/dom/types/NodeType.js.map +1 -1
- package/lib/commonjs/renderer/__tests__/e2e/AdvancedImageFilters.spec.d.ts +1 -0
- package/lib/commonjs/renderer/__tests__/e2e/Camera.spec.d.ts +21 -0
- package/lib/commonjs/renderer/__tests__/e2e/LightingImageFilters.spec.d.ts +1 -0
- package/lib/commonjs/renderer/__tests__/e2e/Skottie.spec.d.ts +1 -0
- package/lib/commonjs/renderer/__tests__/setup.d.ts +5 -0
- package/lib/commonjs/renderer/components/Skottie.d.ts +4 -0
- package/lib/commonjs/renderer/components/Skottie.js +13 -0
- package/lib/commonjs/renderer/components/Skottie.js.map +1 -0
- package/lib/commonjs/renderer/components/index.d.ts +1 -0
- package/lib/commonjs/renderer/components/index.js +11 -0
- package/lib/commonjs/renderer/components/index.js.map +1 -1
- package/lib/commonjs/skia/types/ImageFilter/ImageFilterFactory.d.ts +252 -15
- package/lib/commonjs/skia/types/ImageFilter/ImageFilterFactory.js.map +1 -1
- package/lib/commonjs/skia/types/Matrix4.d.ts +11 -2
- package/lib/commonjs/skia/types/Matrix4.js +42 -1
- package/lib/commonjs/skia/types/Matrix4.js.map +1 -1
- package/lib/commonjs/skia/types/Recorder.d.ts +2 -1
- package/lib/commonjs/skia/types/Recorder.js.map +1 -1
- package/lib/commonjs/skia/types/Skia.d.ts +2 -0
- package/lib/commonjs/skia/types/Skia.js.map +1 -1
- package/lib/commonjs/skia/types/Skottie.d.ts +223 -0
- package/lib/commonjs/skia/types/Skottie.js +73 -0
- package/lib/commonjs/skia/types/Skottie.js.map +1 -0
- package/lib/commonjs/skia/types/index.d.ts +1 -0
- package/lib/commonjs/skia/types/index.js +11 -0
- package/lib/commonjs/skia/types/index.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkImageFilterFactory.d.ts +29 -12
- package/lib/commonjs/skia/web/JsiSkImageFilterFactory.js +88 -19
- package/lib/commonjs/skia/web/JsiSkImageFilterFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkia.js +2 -0
- package/lib/commonjs/skia/web/JsiSkia.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkottieAnimation.d.ts +59 -0
- package/lib/commonjs/skia/web/JsiSkottieAnimation.js +243 -0
- package/lib/commonjs/skia/web/JsiSkottieAnimation.js.map +1 -0
- package/lib/commonjs/skia/web/JsiSkottieFactory.d.ts +9 -0
- package/lib/commonjs/skia/web/JsiSkottieFactory.js +26 -0
- package/lib/commonjs/skia/web/JsiSkottieFactory.js.map +1 -0
- package/lib/commonjs/sksg/Elements.d.ts +2 -1
- package/lib/commonjs/sksg/Elements.js.map +1 -1
- package/lib/commonjs/sksg/Recorder/Core.d.ts +4 -2
- package/lib/commonjs/sksg/Recorder/Core.js +1 -0
- package/lib/commonjs/sksg/Recorder/Core.js.map +1 -1
- package/lib/commonjs/sksg/Recorder/Player.js +2 -0
- package/lib/commonjs/sksg/Recorder/Player.js.map +1 -1
- package/lib/commonjs/sksg/Recorder/ReanimatedRecorder.d.ts +2 -1
- package/lib/commonjs/sksg/Recorder/ReanimatedRecorder.js +4 -0
- package/lib/commonjs/sksg/Recorder/ReanimatedRecorder.js.map +1 -1
- package/lib/commonjs/sksg/Recorder/Recorder.d.ts +2 -1
- package/lib/commonjs/sksg/Recorder/Recorder.js +6 -0
- package/lib/commonjs/sksg/Recorder/Recorder.js.map +1 -1
- package/lib/commonjs/sksg/Recorder/Visitor.js +3 -0
- package/lib/commonjs/sksg/Recorder/Visitor.js.map +1 -1
- package/lib/commonjs/sksg/Recorder/commands/Drawing.d.ts +2 -2
- package/lib/commonjs/sksg/Recorder/commands/Drawing.js +11 -4
- package/lib/commonjs/sksg/Recorder/commands/Drawing.js.map +1 -1
- package/lib/commonjs/sksg/Recorder/commands/ImageFilters.js +1 -1
- package/lib/commonjs/sksg/Recorder/commands/ImageFilters.js.map +1 -1
- package/lib/module/dom/nodes/datatypes/Gradient.d.ts +15 -15
- package/lib/module/dom/types/Drawings.d.ts +5 -1
- package/lib/module/dom/types/Drawings.js.map +1 -1
- package/lib/module/dom/types/NodeType.d.ts +2 -1
- package/lib/module/dom/types/NodeType.js +2 -0
- package/lib/module/dom/types/NodeType.js.map +1 -1
- package/lib/module/renderer/__tests__/e2e/AdvancedImageFilters.spec.d.ts +1 -0
- package/lib/module/renderer/__tests__/e2e/Camera.spec.d.ts +21 -0
- package/lib/module/renderer/__tests__/e2e/LightingImageFilters.spec.d.ts +1 -0
- package/lib/module/renderer/__tests__/e2e/Skottie.spec.d.ts +1 -0
- package/lib/module/renderer/__tests__/setup.d.ts +5 -0
- package/lib/module/renderer/components/Skottie.d.ts +4 -0
- package/lib/module/renderer/components/Skottie.js +5 -0
- package/lib/module/renderer/components/Skottie.js.map +1 -0
- package/lib/module/renderer/components/index.d.ts +1 -0
- package/lib/module/renderer/components/index.js +1 -0
- package/lib/module/renderer/components/index.js.map +1 -1
- package/lib/module/skia/types/ImageFilter/ImageFilterFactory.d.ts +252 -15
- package/lib/module/skia/types/ImageFilter/ImageFilterFactory.js.map +1 -1
- package/lib/module/skia/types/Matrix4.d.ts +11 -2
- package/lib/module/skia/types/Matrix4.js +40 -0
- package/lib/module/skia/types/Matrix4.js.map +1 -1
- package/lib/module/skia/types/Recorder.d.ts +2 -1
- package/lib/module/skia/types/Recorder.js.map +1 -1
- package/lib/module/skia/types/Skia.d.ts +2 -0
- package/lib/module/skia/types/Skia.js.map +1 -1
- package/lib/module/skia/types/Skottie.d.ts +223 -0
- package/lib/module/skia/types/Skottie.js +74 -0
- package/lib/module/skia/types/Skottie.js.map +1 -0
- package/lib/module/skia/types/index.d.ts +1 -0
- package/lib/module/skia/types/index.js +1 -0
- package/lib/module/skia/types/index.js.map +1 -1
- package/lib/module/skia/web/JsiSkImageFilterFactory.d.ts +29 -12
- package/lib/module/skia/web/JsiSkImageFilterFactory.js +88 -19
- package/lib/module/skia/web/JsiSkImageFilterFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkia.js +2 -0
- package/lib/module/skia/web/JsiSkia.js.map +1 -1
- package/lib/module/skia/web/JsiSkottieAnimation.d.ts +59 -0
- package/lib/module/skia/web/JsiSkottieAnimation.js +236 -0
- package/lib/module/skia/web/JsiSkottieAnimation.js.map +1 -0
- package/lib/module/skia/web/JsiSkottieFactory.d.ts +9 -0
- package/lib/module/skia/web/JsiSkottieFactory.js +19 -0
- package/lib/module/skia/web/JsiSkottieFactory.js.map +1 -0
- package/lib/module/sksg/Elements.d.ts +2 -1
- package/lib/module/sksg/Elements.js.map +1 -1
- package/lib/module/sksg/Recorder/Core.d.ts +4 -2
- package/lib/module/sksg/Recorder/Core.js +1 -0
- package/lib/module/sksg/Recorder/Core.js.map +1 -1
- package/lib/module/sksg/Recorder/Player.js +3 -1
- package/lib/module/sksg/Recorder/Player.js.map +1 -1
- package/lib/module/sksg/Recorder/ReanimatedRecorder.d.ts +2 -1
- package/lib/module/sksg/Recorder/ReanimatedRecorder.js +4 -0
- package/lib/module/sksg/Recorder/ReanimatedRecorder.js.map +1 -1
- package/lib/module/sksg/Recorder/Recorder.d.ts +2 -1
- package/lib/module/sksg/Recorder/Recorder.js +6 -0
- package/lib/module/sksg/Recorder/Recorder.js.map +1 -1
- package/lib/module/sksg/Recorder/Visitor.js +3 -0
- package/lib/module/sksg/Recorder/Visitor.js.map +1 -1
- package/lib/module/sksg/Recorder/commands/Drawing.d.ts +2 -2
- package/lib/module/sksg/Recorder/commands/Drawing.js +9 -2
- package/lib/module/sksg/Recorder/commands/Drawing.js.map +1 -1
- package/lib/module/sksg/Recorder/commands/ImageFilters.js +1 -1
- package/lib/module/sksg/Recorder/commands/ImageFilters.js.map +1 -1
- package/lib/typescript/lib/commonjs/renderer/components/Skottie.d.ts +2 -0
- package/lib/typescript/lib/commonjs/skia/types/Matrix4.d.ts +1 -0
- package/lib/typescript/lib/commonjs/skia/types/Skottie.d.ts +6 -0
- package/lib/typescript/lib/commonjs/skia/web/JsiSkImageFilterFactory.d.ts +22 -5
- package/lib/typescript/lib/commonjs/skia/web/JsiSkia.d.ts +2 -0
- package/lib/typescript/lib/commonjs/skia/web/JsiSkottieAnimation.d.ts +48 -0
- package/lib/typescript/lib/commonjs/skia/web/JsiSkottieFactory.d.ts +6 -0
- package/lib/typescript/lib/commonjs/sksg/Recorder/ReanimatedRecorder.d.ts +1 -0
- package/lib/typescript/lib/commonjs/sksg/Recorder/Recorder.d.ts +1 -0
- package/lib/typescript/lib/commonjs/sksg/Recorder/commands/Drawing.d.ts +1 -1
- package/lib/typescript/lib/module/mock/index.d.ts +7 -0
- package/lib/typescript/lib/module/renderer/components/Skottie.d.ts +2 -0
- package/lib/typescript/lib/module/renderer/components/index.d.ts +1 -0
- package/lib/typescript/lib/module/skia/Skia.web.d.ts +1 -0
- package/lib/typescript/lib/module/skia/types/Matrix4.d.ts +1 -0
- package/lib/typescript/lib/module/skia/types/Skottie.d.ts +5 -0
- package/lib/typescript/lib/module/skia/types/index.d.ts +1 -0
- package/lib/typescript/lib/module/skia/web/JsiSkImageFilterFactory.d.ts +22 -5
- package/lib/typescript/lib/module/skia/web/JsiSkia.d.ts +2 -0
- package/lib/typescript/lib/module/skia/web/JsiSkottieAnimation.d.ts +47 -0
- package/lib/typescript/lib/module/skia/web/JsiSkottieFactory.d.ts +5 -0
- package/lib/typescript/lib/module/sksg/Recorder/ReanimatedRecorder.d.ts +1 -0
- package/lib/typescript/lib/module/sksg/Recorder/Recorder.d.ts +1 -0
- package/lib/typescript/lib/module/sksg/Recorder/commands/Drawing.d.ts +1 -1
- package/lib/typescript/src/dom/nodes/datatypes/Gradient.d.ts +15 -15
- package/lib/typescript/src/dom/types/Drawings.d.ts +5 -1
- package/lib/typescript/src/dom/types/NodeType.d.ts +2 -1
- package/lib/typescript/src/renderer/__tests__/e2e/AdvancedImageFilters.spec.d.ts +1 -0
- package/lib/typescript/src/renderer/__tests__/e2e/Camera.spec.d.ts +21 -0
- package/lib/typescript/src/renderer/__tests__/e2e/LightingImageFilters.spec.d.ts +1 -0
- package/lib/typescript/src/renderer/__tests__/e2e/Skottie.spec.d.ts +1 -0
- package/lib/typescript/src/renderer/__tests__/setup.d.ts +5 -0
- package/lib/typescript/src/renderer/components/Skottie.d.ts +4 -0
- package/lib/typescript/src/renderer/components/index.d.ts +1 -0
- package/lib/typescript/src/skia/types/ImageFilter/ImageFilterFactory.d.ts +252 -15
- package/lib/typescript/src/skia/types/Matrix4.d.ts +11 -2
- package/lib/typescript/src/skia/types/Recorder.d.ts +2 -1
- package/lib/typescript/src/skia/types/Skia.d.ts +2 -0
- package/lib/typescript/src/skia/types/Skottie.d.ts +223 -0
- package/lib/typescript/src/skia/types/index.d.ts +1 -0
- package/lib/typescript/src/skia/web/JsiSkImageFilterFactory.d.ts +29 -12
- package/lib/typescript/src/skia/web/JsiSkottieAnimation.d.ts +59 -0
- package/lib/typescript/src/skia/web/JsiSkottieFactory.d.ts +9 -0
- package/lib/typescript/src/sksg/Elements.d.ts +2 -1
- package/lib/typescript/src/sksg/Recorder/Core.d.ts +4 -2
- package/lib/typescript/src/sksg/Recorder/ReanimatedRecorder.d.ts +2 -1
- package/lib/typescript/src/sksg/Recorder/Recorder.d.ts +2 -1
- package/lib/typescript/src/sksg/Recorder/commands/Drawing.d.ts +2 -2
- package/libs/android/arm64-v8a/libjsonreader.a +0 -0
- package/libs/android/armeabi-v7a/libjsonreader.a +0 -0
- package/libs/android/x86/libjsonreader.a +0 -0
- package/libs/android/x86_64/libjsonreader.a +0 -0
- package/libs/apple/libpathops.xcframework/Info.plist +9 -9
- package/libs/apple/libskia.xcframework/Info.plist +14 -14
- package/libs/apple/libskottie.xcframework/Info.plist +13 -13
- package/libs/apple/libskparagraph.xcframework/Info.plist +15 -15
- package/libs/apple/libsksg.xcframework/Info.plist +13 -13
- package/libs/apple/libskshaper.xcframework/Info.plist +15 -15
- package/libs/apple/libskunicode_core.xcframework/Info.plist +9 -9
- package/libs/apple/libskunicode_libgrapheme.xcframework/Info.plist +13 -13
- package/libs/apple/libsvg.xcframework/Info.plist +15 -15
- package/package.json +1 -1
- package/react-native-skia.podspec +4 -2
- package/src/__tests__/snapshots/matrix4/camera-corner.png +0 -0
- package/src/__tests__/snapshots/matrix4/camera-offset.png +0 -0
- package/src/__tests__/snapshots/matrix4/camera-top-left-center.png +0 -0
- package/src/__tests__/snapshots/matrix4/camera-zoom-out.png +0 -0
- package/src/__tests__/snapshots/matrix4/full-rect.png +0 -0
- package/src/__tests__/snapshots/matrix4/rect.png +0 -0
- package/src/__tests__/snapshots/matrix4/scaled-rect.png +0 -0
- package/src/__tests__/snapshots/matrix4/test-perspective.png +0 -0
- package/src/__tests__/snapshots/matrix4/test-perspective2.png +0 -0
- package/src/dom/types/Drawings.ts +6 -0
- package/src/dom/types/NodeType.ts +2 -0
- package/src/renderer/__tests__/e2e/AdvancedImageFilters.spec.tsx +492 -0
- package/src/renderer/__tests__/e2e/Camera.spec.tsx +475 -0
- package/src/renderer/__tests__/e2e/LightingImageFilters.spec.tsx +1478 -0
- package/src/renderer/__tests__/e2e/Skottie.spec.tsx +440 -0
- package/src/renderer/__tests__/e2e/setup/skottie/basic_slots.json +1118 -0
- package/src/renderer/__tests__/e2e/setup/skottie/color-props.json +1 -0
- package/src/renderer/__tests__/e2e/setup/skottie/confetti.json +5899 -0
- package/src/renderer/__tests__/e2e/setup/skottie/drinks.json +43857 -0
- package/src/renderer/__tests__/e2e/setup/skottie/fingerprint.json +1 -0
- package/src/renderer/__tests__/e2e/setup/skottie/lego_loader.json +29540 -0
- package/src/renderer/__tests__/e2e/setup/skottie/new-drop.json +1 -0
- package/src/renderer/__tests__/e2e/setup/skottie/onboarding.json +1 -0
- package/src/renderer/__tests__/e2e/setup/skottie/text-layer.json +1 -0
- package/src/renderer/__tests__/setup.tsx +23 -0
- package/src/renderer/components/Skottie.tsx +8 -0
- package/src/renderer/components/index.ts +1 -0
- package/src/skia/__tests__/assets/Avenir-Heavy.ttf +0 -0
- package/src/skia/types/ImageFilter/ImageFilterFactory.ts +391 -21
- package/src/skia/types/Matrix4.ts +108 -2
- package/src/skia/types/Recorder.ts +2 -0
- package/src/skia/types/Skia.ts +2 -0
- package/src/skia/types/Skottie.ts +266 -0
- package/src/skia/types/index.ts +1 -0
- package/src/skia/web/JsiSkImageFilterFactory.ts +266 -31
- package/src/skia/web/JsiSkia.ts +2 -0
- package/src/skia/web/JsiSkottieAnimation.ts +259 -0
- package/src/skia/web/JsiSkottieFactory.ts +25 -0
- package/src/sksg/Elements.tsx +2 -0
- package/src/sksg/Recorder/Core.ts +3 -0
- package/src/sksg/Recorder/Player.ts +3 -0
- package/src/sksg/Recorder/ReanimatedRecorder.ts +6 -0
- package/src/sksg/Recorder/Recorder.ts +5 -0
- package/src/sksg/Recorder/Visitor.ts +3 -0
- package/src/sksg/Recorder/commands/Drawing.ts +7 -3
- package/src/sksg/Recorder/commands/ImageFilters.ts +1 -1
- package/cpp/skia/include/pathops/SkPathOps.h +0 -17
@@ -1,6 +1,9 @@
|
|
1
1
|
import type { SkColor } from "../Color";
|
2
2
|
import type { SkColorFilter } from "../ColorFilter/ColorFilter";
|
3
|
+
import type { FilterMode, MipmapMode, SkImage } from "../Image/Image";
|
4
|
+
import type { SkMatrix } from "../Matrix";
|
3
5
|
import type { BlendMode } from "../Paint";
|
6
|
+
import type { SkPicture } from "../Picture";
|
4
7
|
import type { SkRect } from "../Rect";
|
5
8
|
import type { SkRuntimeShaderBuilder } from "../RuntimeEffect";
|
6
9
|
import type { SkShader } from "../Shader";
|
@@ -18,8 +21,9 @@ export interface ImageFilterFactory {
|
|
18
21
|
* @param dx - Offset along the X axis
|
19
22
|
* @param dy - Offset along the X axis
|
20
23
|
* @param input - if null, it will use the dynamic source image
|
24
|
+
* @param cropRect - Optional rectangle that crops the input and output
|
21
25
|
*/
|
22
|
-
MakeOffset(dx: number, dy: number, input
|
26
|
+
MakeOffset(dx: number, dy: number, input?: SkImageFilter | null, cropRect?: SkRect | null): SkImageFilter;
|
23
27
|
/**
|
24
28
|
* Spatially displace pixel values of the filtered image
|
25
29
|
*
|
@@ -28,31 +32,36 @@ export interface ImageFilterFactory {
|
|
28
32
|
* @param scale - Scale factor to be used in the displacement
|
29
33
|
* @param in1 - Source image filter to use for the displacement
|
30
34
|
* @param input - if null, it will use the dynamic source image
|
35
|
+
* @param cropRect - Optional rectangle that crops the input and output
|
31
36
|
*/
|
32
|
-
MakeDisplacementMap(channelX: ColorChannel, channelY: ColorChannel, scale: number, in1: SkImageFilter, input
|
37
|
+
MakeDisplacementMap(channelX: ColorChannel, channelY: ColorChannel, scale: number, in1: SkImageFilter, input?: SkImageFilter | null, cropRect?: SkRect | null): SkImageFilter;
|
33
38
|
/**
|
34
39
|
* Transforms a shader into an impage filter
|
35
40
|
*
|
36
41
|
* @param shader - The Shader to be transformed
|
37
|
-
* @param
|
42
|
+
* @param dither - Whether to apply dithering to the shader
|
43
|
+
* @param cropRect - Optional rectangle that crops the input and output
|
38
44
|
*/
|
39
|
-
MakeShader(shader: SkShader,
|
45
|
+
MakeShader(shader: SkShader, dither?: boolean, cropRect?: SkRect | null): SkImageFilter;
|
40
46
|
/**
|
41
47
|
* Create a filter that blurs its input by the separate X and Y sigmas. The provided tile mode
|
42
48
|
* is used when the blur kernel goes outside the input image.
|
43
49
|
*
|
44
50
|
* @param sigmaX - The Gaussian sigma value for blurring along the X axis.
|
45
51
|
* @param sigmaY - The Gaussian sigma value for blurring along the Y axis.
|
46
|
-
* @param mode
|
52
|
+
* @param mode - The tile mode to use when blur kernel goes outside the image
|
47
53
|
* @param input - if null, it will use the dynamic source image (e.g. a saved layer)
|
54
|
+
* @param cropRect - Optional rectangle that crops the input and output
|
48
55
|
*/
|
49
|
-
MakeBlur(sigmaX: number, sigmaY: number, mode: TileMode, input
|
56
|
+
MakeBlur(sigmaX: number, sigmaY: number, mode: TileMode, input?: SkImageFilter | null, cropRect?: SkRect | null): SkImageFilter;
|
50
57
|
/**
|
51
58
|
* Create a filter that applies the color filter to the input filter results.
|
52
|
-
*
|
59
|
+
*
|
60
|
+
* @param colorFilter - The color filter to apply
|
53
61
|
* @param input - if null, it will use the dynamic source image (e.g. a saved layer)
|
62
|
+
* @param cropRect - Optional rectangle that crops the input and output
|
54
63
|
*/
|
55
|
-
MakeColorFilter(
|
64
|
+
MakeColorFilter(colorFilter: SkColorFilter, input?: SkImageFilter | null, cropRect?: SkRect | null): SkImageFilter;
|
56
65
|
/**
|
57
66
|
* Create a filter that composes 'inner' with 'outer', such that the results of 'inner' are
|
58
67
|
* treated as the source bitmap passed to 'outer'.
|
@@ -72,7 +81,7 @@ export interface ImageFilterFactory {
|
|
72
81
|
* @param input The input filter, or will use the source bitmap if this is null.
|
73
82
|
* @param cropRect Optional rectangle that crops the input and output.
|
74
83
|
*/
|
75
|
-
MakeDropShadow: (dx: number, dy: number, sigmaX: number, sigmaY: number, color: SkColor, input
|
84
|
+
MakeDropShadow: (dx: number, dy: number, sigmaX: number, sigmaY: number, color: SkColor, input?: SkImageFilter | null, cropRect?: SkRect | null) => SkImageFilter;
|
76
85
|
/**
|
77
86
|
* Create a filter that renders a drop shadow, in exactly the same manner as ::DropShadow, except
|
78
87
|
* that the resulting image does not include the input content.
|
@@ -85,7 +94,7 @@ export interface ImageFilterFactory {
|
|
85
94
|
* @param input The input filter, or will use the source bitmap if this is null.
|
86
95
|
* @param cropRect Optional rectangle that crops the input and output.
|
87
96
|
*/
|
88
|
-
MakeDropShadowOnly: (dx: number, dy: number, sigmaX: number, sigmaY: number, color: SkColor, input
|
97
|
+
MakeDropShadowOnly: (dx: number, dy: number, sigmaX: number, sigmaY: number, color: SkColor, input?: SkImageFilter | null, cropRect?: SkRect | null) => SkImageFilter;
|
89
98
|
/**
|
90
99
|
* Create a filter that erodes each input pixel's channel values to the minimum channel value
|
91
100
|
* within the given radii along the x and y axes.
|
@@ -94,7 +103,7 @@ export interface ImageFilterFactory {
|
|
94
103
|
* @param input The image filter that is eroded, using source bitmap if this is null.
|
95
104
|
* @param cropRect Optional rectangle that crops the input and output.
|
96
105
|
*/
|
97
|
-
MakeErode: (rx: number, ry: number, input
|
106
|
+
MakeErode: (rx: number, ry: number, input?: SkImageFilter | null, cropRect?: SkRect | null) => SkImageFilter;
|
98
107
|
/**
|
99
108
|
* Create a filter that dilates each input pixel's channel values to the max value within the
|
100
109
|
* given radii along the x and y axes.
|
@@ -103,15 +112,15 @@ export interface ImageFilterFactory {
|
|
103
112
|
* @param input The image filter that is dilated, using source bitmap if this is null.
|
104
113
|
* @param cropRect Optional rectangle that crops the input and output.
|
105
114
|
*/
|
106
|
-
MakeDilate: (rx: number, ry: number, input
|
115
|
+
MakeDilate: (rx: number, ry: number, input?: SkImageFilter | null, cropRect?: SkRect | null) => SkImageFilter;
|
107
116
|
/**
|
108
117
|
* This filter takes an SkBlendMode and uses it to composite the two filters together.
|
109
118
|
* @param mode The blend mode that defines the compositing operation
|
110
119
|
* @param background The Dst pixels used in blending, if null the source bitmap is used.
|
111
120
|
* @param foreground The Src pixels used in blending, if null the source bitmap is used.
|
112
|
-
* @cropRect
|
121
|
+
* @param cropRect Optional rectangle to crop input and output.
|
113
122
|
*/
|
114
|
-
MakeBlend: (mode: BlendMode, background: SkImageFilter, foreground
|
123
|
+
MakeBlend: (mode: BlendMode, background: SkImageFilter, foreground?: SkImageFilter | null, cropRect?: SkRect | null) => SkImageFilter;
|
115
124
|
/**
|
116
125
|
* Create a filter that fills the output with the per-pixel evaluation of the SkShader produced
|
117
126
|
* by the SkRuntimeShaderBuilder. The shader is defined in the image filter's local coordinate
|
@@ -126,5 +135,233 @@ export interface ImageFilterFactory {
|
|
126
135
|
* @param input The image filter that will be provided as input to the runtime
|
127
136
|
* shader. If null the implicit source image is used instead
|
128
137
|
*/
|
129
|
-
MakeRuntimeShader: (builder: SkRuntimeShaderBuilder, childShaderName: string | null, input
|
138
|
+
MakeRuntimeShader: (builder: SkRuntimeShaderBuilder, childShaderName: string | null, input?: SkImageFilter | null) => SkImageFilter;
|
139
|
+
/**
|
140
|
+
* Create a filter that implements a custom blend mode. Each output pixel is the result of
|
141
|
+
* combining the corresponding background and foreground pixels using the 4 coefficients:
|
142
|
+
* k1 * foreground * background + k2 * foreground + k3 * background + k4
|
143
|
+
*
|
144
|
+
* @param k1, k2, k3, k4 The four coefficients used to combine the foreground and background.
|
145
|
+
* @param enforcePMColor If true, the RGB channels will be clamped to the calculated alpha.
|
146
|
+
* @param background The background content, using the source bitmap when this is null.
|
147
|
+
* @param foreground The foreground content, using the source bitmap when this is null.
|
148
|
+
* @param cropRect Optional rectangle that crops the inputs and output.
|
149
|
+
*/
|
150
|
+
MakeArithmetic(k1: number, k2: number, k3: number, k4: number, enforcePMColor: boolean, background?: SkImageFilter | null, foreground?: SkImageFilter | null, cropRect?: SkRect | null): SkImageFilter;
|
151
|
+
/**
|
152
|
+
* Create a filter that applies a crop to the result of the 'input' filter. Pixels within the
|
153
|
+
* crop rectangle are unmodified from what 'input' produced. Pixels outside of crop match the
|
154
|
+
* provided SkTileMode (defaulting to kDecal).
|
155
|
+
*
|
156
|
+
* NOTE: The optional CropRect argument for many of the factories is equivalent to creating the
|
157
|
+
* filter without a CropRect and then wrapping it in ::Crop(rect, kDecal). Explicitly adding
|
158
|
+
* Crop filters lets you control their tiling and use different geometry for the input and the
|
159
|
+
* output of another filter.
|
160
|
+
*
|
161
|
+
* @param rect The cropping rect
|
162
|
+
* @param tileMode The TileMode applied to pixels *outside* of 'crop' @default TileMode.Decal
|
163
|
+
* @param input The input filter that is cropped, uses source image if this is null
|
164
|
+
*/
|
165
|
+
MakeCrop(rect: SkRect, tileMode?: TileMode | null, input?: SkImageFilter | null): SkImageFilter;
|
166
|
+
/**
|
167
|
+
* Create a filter that always produces transparent black.
|
168
|
+
*/
|
169
|
+
MakeEmpty(): SkImageFilter;
|
170
|
+
/**
|
171
|
+
* Create a filter that draws the 'srcRect' portion of image into 'dstRect' using the given
|
172
|
+
* filter quality. Similar to SkCanvas::drawImageRect. The returned image filter evaluates
|
173
|
+
* to transparent black if 'image' is null.
|
174
|
+
*
|
175
|
+
* @param image The image that is output by the filter, subset by 'srcRect'.
|
176
|
+
* @param srcRect The source pixels sampled into 'dstRect', if null the image bounds are used.
|
177
|
+
* @param dstRect The local rectangle to draw the image into, if null the srcRect is used.
|
178
|
+
* @param filterMode The filter mode to use when sampling the image @default FilterMode.Nearest
|
179
|
+
* @param mipmap The mipmap mode to use when sampling the image @default MipmapMode.None
|
180
|
+
*/
|
181
|
+
MakeImage(image: SkImage, srcRect?: SkRect | null, dstRect?: SkRect | null, filterMode?: FilterMode, mipmap?: MipmapMode): SkImageFilter;
|
182
|
+
/**
|
183
|
+
* Create a filter that fills 'lensBounds' with a magnification of the input.
|
184
|
+
*
|
185
|
+
* @param lensBounds The outer bounds of the magnifier effect
|
186
|
+
* @param zoomAmount The amount of magnification applied to the input image
|
187
|
+
* @param inset The size or width of the fish-eye distortion around the magnified content
|
188
|
+
* @param filterMode The filter mode to use when sampling the image @default FilterMode.Nearest
|
189
|
+
* @param mipmap The mipmap mode to use when sampling the image @default MipmapMode.None
|
190
|
+
* @param input The input filter that is magnified; if null the source bitmap is used
|
191
|
+
* @param cropRect Optional rectangle that crops the input and output.
|
192
|
+
*/
|
193
|
+
MakeMagnifier(lensBounds: SkRect, zoomAmount: number, inset: number, filterMode?: FilterMode, mipmap?: MipmapMode, input?: SkImageFilter | null, cropRect?: SkRect | null): SkImageFilter;
|
194
|
+
/**
|
195
|
+
* Create a filter that applies an NxM image processing kernel to the input image. This can be
|
196
|
+
* used to produce effects such as sharpening, blurring, edge detection, etc.
|
197
|
+
* @param kernelSizeX The width of the kernel. Must be greater than zero.
|
198
|
+
* @param kernelSizeY The height of the kernel. Must be greater than zero.
|
199
|
+
* @param kernel The image processing kernel. Must contain kernelSizeX * kernelSizeY elements, in row order.
|
200
|
+
* @param gain A scale factor applied to each pixel after convolution. This can be
|
201
|
+
* used to normalize the kernel, if it does not already sum to 1.
|
202
|
+
* @param bias A bias factor added to each pixel after convolution.
|
203
|
+
* @param kernelOffsetX An offset applied to each pixel coordinate before convolution.
|
204
|
+
* This can be used to center the kernel over the image
|
205
|
+
* (e.g., a 3x3 kernel should have an offset of {1, 1}).
|
206
|
+
* @param kernelOffsetY An offset applied to each pixel coordinate before convolution.
|
207
|
+
* This can be used to center the kernel over the image
|
208
|
+
* (e.g., a 3x3 kernel should have an offset of {1, 1}).
|
209
|
+
* @param tileMode How accesses outside the image are treated. TileMode.Mirror is not supported.
|
210
|
+
* @param convolveAlpha If true, all channels are convolved. If false, only the RGB channels
|
211
|
+
* are convolved, and alpha is copied from the source image.
|
212
|
+
* @param input The input image filter, if null the source bitmap is used instead.
|
213
|
+
* @param cropRect Optional rectangle to which the output processing will be limited.
|
214
|
+
*/
|
215
|
+
MakeMatrixConvolution(kernelSizeX: number, kernelSizeY: number, kernel: number[], gain: number, bias: number, kernelOffsetX: number, kernelOffsetY: number, tileMode: TileMode, convolveAlpha: boolean, input?: SkImageFilter | null, cropRect?: SkRect | null): SkImageFilter;
|
216
|
+
/**
|
217
|
+
* Create a filter that transforms the input image by 'matrix'. This matrix transforms the
|
218
|
+
* local space, which means it effectively happens prior to any transformation coming from the
|
219
|
+
* SkCanvas initiating the filtering.
|
220
|
+
* @param matrix The matrix to apply to the original content.
|
221
|
+
* @param filterMode The filter mode to use when sampling the image @default FilterMode.Nearest
|
222
|
+
* @param mipmap The mipmap mode to use when sampling the image @default MipmapMode.None
|
223
|
+
* @param input The image filter to transform, or null to use the source image.
|
224
|
+
*/
|
225
|
+
MakeMatrixTransform(matrix: SkMatrix, filterMode?: FilterMode, mipmap?: MipmapMode, input?: SkImageFilter | null): SkImageFilter;
|
226
|
+
/**
|
227
|
+
* Create a filter that merges filters together by drawing their results in order
|
228
|
+
* with src-over blending.
|
229
|
+
* @param filters The input filter array to merge. Any null
|
230
|
+
* filter pointers will use the source bitmap instead.
|
231
|
+
* @param cropRect Optional rectangle that crops all input filters and the output.
|
232
|
+
*/
|
233
|
+
MakeMerge(filters: Array<SkImageFilter | null>, cropRect?: SkRect | null): SkImageFilter;
|
234
|
+
/**
|
235
|
+
* Create a filter that produces the SkPicture as its output, clipped to both 'targetRect' and
|
236
|
+
* the picture's internal cull rect.
|
237
|
+
*
|
238
|
+
* If 'pic' is null, the returned image filter produces transparent black.
|
239
|
+
*
|
240
|
+
* @param picture The picture that is drawn for the filter output.
|
241
|
+
* @param targetRect The drawing region for the picture. If null, the picture's bounds are used.
|
242
|
+
*/
|
243
|
+
MakePicture(picture: SkPicture, targetRect?: SkRect | null): SkImageFilter;
|
244
|
+
/**
|
245
|
+
* Create a filter that fills the output with the per-pixel evaluation of the SkShader produced
|
246
|
+
* by the SkRuntimeEffectBuilder. The shader is defined in the image filter's local coordinate
|
247
|
+
* system, so it will automatically be affected by SkCanvas' transform.
|
248
|
+
*
|
249
|
+
* This requires a GPU backend or SkSL to be compiled in.
|
250
|
+
*
|
251
|
+
* @param builder The builder used to produce the runtime shader, that will in turn
|
252
|
+
* fill the result image
|
253
|
+
* @param sampleRadius defines the sampling radius of 'childShaderName' relative to
|
254
|
+
* the runtime shader produced by 'builder'.
|
255
|
+
* If greater than 0, the coordinate passed to childShader.eval() will
|
256
|
+
* be up to 'sampleRadius' away (maximum absolute offset in 'x' or 'y')
|
257
|
+
* from the coordinate passed into the runtime shader.
|
258
|
+
* @param childShaderNames The names of the child shaders defined in the builder that will be
|
259
|
+
* bound to the input params (or the source image if the input param
|
260
|
+
* is null). If any name is null, or appears more than once, factory
|
261
|
+
* fails and returns nullptr.
|
262
|
+
* @param inputs The image filters that will be provided as input to the runtime
|
263
|
+
* shader. If any are null, the implicit source image is used instead.
|
264
|
+
*/
|
265
|
+
MakeRuntimeShaderWithChildren: (builder: SkRuntimeShaderBuilder, sampleRadius: number, childShaderNames: string[], inputs: Array<SkImageFilter | null>) => SkImageFilter;
|
266
|
+
/**
|
267
|
+
* Create a tile image filter.
|
268
|
+
* @param src Defines the pixels to tile
|
269
|
+
* @param dst Defines the pixel region that the tiles will be drawn to
|
270
|
+
* @param input The input that will be tiled, if null the source bitmap is used instead.
|
271
|
+
*/
|
272
|
+
MakeTile(src: SkRect, dst: SkRect, input?: SkImageFilter | null): SkImageFilter;
|
273
|
+
/**
|
274
|
+
* Create a filter that calculates the diffuse illumination from a distant light source,
|
275
|
+
* interpreting the alpha channel of the input as the height profile of the surface (to
|
276
|
+
* approximate normal vectors).
|
277
|
+
* @param direction The direction to the distance light.
|
278
|
+
* @param lightColor The color of the diffuse light source.
|
279
|
+
* @param surfaceScale Scale factor to transform from alpha values to physical height.
|
280
|
+
* @param kd Diffuse reflectance coefficient.
|
281
|
+
* @param input The input filter that defines surface normals (as alpha), or uses the
|
282
|
+
* source bitmap when null.
|
283
|
+
* @param cropRect Optional rectangle that crops the input and output.
|
284
|
+
*/
|
285
|
+
MakeDistantLitDiffuse(direction: SkPoint3, lightColor: SkColor, surfaceScale: number, kd: number, input?: SkImageFilter | null, cropRect?: SkRect | null): SkImageFilter;
|
286
|
+
/**
|
287
|
+
* Create a filter that calculates the diffuse illumination from a point light source, using
|
288
|
+
* alpha channel of the input as the height profile of the surface (to approximate normal
|
289
|
+
* vectors).
|
290
|
+
* @param location The location of the point light.
|
291
|
+
* @param lightColor The color of the diffuse light source.
|
292
|
+
* @param surfaceScale Scale factor to transform from alpha values to physical height.
|
293
|
+
* @param kd Diffuse reflectance coefficient.
|
294
|
+
* @param input The input filter that defines surface normals (as alpha), or uses the
|
295
|
+
* source bitmap when null.
|
296
|
+
* @param cropRect Optional rectangle that crops the input and output.
|
297
|
+
*/
|
298
|
+
MakePointLitDiffuse(location: SkPoint3, lightColor: SkColor, surfaceScale: number, kd: number, input?: SkImageFilter | null, cropRect?: SkRect | null): SkImageFilter;
|
299
|
+
/**
|
300
|
+
* Create a filter that calculates the diffuse illumination from a spot light source, using
|
301
|
+
* alpha channel of the input as the height profile of the surface (to approximate normal
|
302
|
+
* vectors). The spot light is restricted to be within 'cutoffAngle' of the vector between
|
303
|
+
* the location and target.
|
304
|
+
* @param location The location of the spot light.
|
305
|
+
* @param target The location that the spot light is point towards
|
306
|
+
* @param falloffExponent Exponential falloff parameter for illumination outside of cutoffAngle
|
307
|
+
* @param cutoffAngle Maximum angle from lighting direction that receives full light
|
308
|
+
* @param lightColor The color of the diffuse light source.
|
309
|
+
* @param surfaceScale Scale factor to transform from alpha values to physical height.
|
310
|
+
* @param kd Diffuse reflectance coefficient.
|
311
|
+
* @param input The input filter that defines surface normals (as alpha), or uses the
|
312
|
+
* source bitmap when null.
|
313
|
+
* @param cropRect Optional rectangle that crops the input and output.
|
314
|
+
*/
|
315
|
+
MakeSpotLitDiffuse(location: SkPoint3, target: SkPoint3, falloffExponent: number, cutoffAngle: number, lightColor: SkColor, surfaceScale: number, kd: number, input?: SkImageFilter | null, cropRect?: SkRect | null): SkImageFilter;
|
316
|
+
/**
|
317
|
+
* Create a filter that calculates the specular illumination from a distant light source,
|
318
|
+
* interpreting the alpha channel of the input as the height profile of the surface (to
|
319
|
+
* approximate normal vectors).
|
320
|
+
* @param direction The direction to the distance light.
|
321
|
+
* @param lightColor The color of the specular light source.
|
322
|
+
* @param surfaceScale Scale factor to transform from alpha values to physical height.
|
323
|
+
* @param ks Specular reflectance coefficient.
|
324
|
+
* @param shininess The specular exponent determining how shiny the surface is.
|
325
|
+
* @param input The input filter that defines surface normals (as alpha), or uses the
|
326
|
+
* source bitmap when null.
|
327
|
+
* @param cropRect Optional rectangle that crops the input and output.
|
328
|
+
*/
|
329
|
+
MakeDistantLitSpecular(direction: SkPoint3, lightColor: SkColor, surfaceScale: number, ks: number, shininess: number, input?: SkImageFilter | null, cropRect?: SkRect | null): SkImageFilter;
|
330
|
+
/**
|
331
|
+
* Create a filter that calculates the specular illumination from a point light source, using
|
332
|
+
* alpha channel of the input as the height profile of the surface (to approximate normal
|
333
|
+
* vectors).
|
334
|
+
* @param location The location of the point light.
|
335
|
+
* @param lightColor The color of the specular light source.
|
336
|
+
* @param surfaceScale Scale factor to transform from alpha values to physical height.
|
337
|
+
* @param ks Specular reflectance coefficient.
|
338
|
+
* @param shininess The specular exponent determining how shiny the surface is.
|
339
|
+
* @param input The input filter that defines surface normals (as alpha), or uses the
|
340
|
+
* source bitmap when null.
|
341
|
+
* @param cropRect Optional rectangle that crops the input and output.
|
342
|
+
*/
|
343
|
+
MakePointLitSpecular(location: SkPoint3, lightColor: SkColor, surfaceScale: number, ks: number, shininess: number, input?: SkImageFilter | null, cropRect?: SkRect | null): SkImageFilter;
|
344
|
+
/**
|
345
|
+
* Create a filter that calculates the specular illumination from a spot light source, using
|
346
|
+
* alpha channel of the input as the height profile of the surface (to approximate normal
|
347
|
+
* vectors). The spot light is restricted to be within 'cutoffAngle' of the vector between
|
348
|
+
* the location and target.
|
349
|
+
* @param location The location of the spot light.
|
350
|
+
* @param target The location that the spot light is point towards
|
351
|
+
* @param falloffExponent Exponential falloff parameter for illumination outside of cutoffAngle
|
352
|
+
* @param cutoffAngle Maximum angle from lighting direction that receives full light
|
353
|
+
* @param lightColor The color of the specular light source.
|
354
|
+
* @param surfaceScale Scale factor to transform from alpha values to physical height.
|
355
|
+
* @param ks Specular reflectance coefficient.
|
356
|
+
* @param shininess The specular exponent determining how shiny the surface is.
|
357
|
+
* @param input The input filter that defines surface normals (as alpha), or uses the
|
358
|
+
* source bitmap when null.
|
359
|
+
* @param cropRect Optional rectangle that crops the input and output.
|
360
|
+
*/
|
361
|
+
MakeSpotLitSpecular(location: SkPoint3, target: SkPoint3, falloffExponent: number, cutoffAngle: number, lightColor: SkColor, surfaceScale: number, ks: number, shininess: number, input?: SkImageFilter | null, cropRect?: SkRect | null): SkImageFilter;
|
130
362
|
}
|
363
|
+
export type SkPoint3 = {
|
364
|
+
x: number;
|
365
|
+
y: number;
|
366
|
+
z: number;
|
367
|
+
};
|
@@ -3,8 +3,8 @@ type Point = {
|
|
3
3
|
y: number;
|
4
4
|
};
|
5
5
|
type Vec2 = readonly [number, number];
|
6
|
-
type Vec3 = readonly [number, number, number];
|
7
|
-
type Vec4 = readonly [number, number, number, number];
|
6
|
+
export type Vec3 = readonly [number, number, number];
|
7
|
+
export type Vec4 = readonly [number, number, number, number];
|
8
8
|
export type Matrix3 = readonly [
|
9
9
|
number,
|
10
10
|
number,
|
@@ -106,4 +106,13 @@ export declare const convertToAffineMatrix: (m4: Matrix4) => number[];
|
|
106
106
|
* @returns The inverted matrix, or the identity matrix if the input is not invertible
|
107
107
|
*/
|
108
108
|
export declare const invert4: (m: Matrix4) => Matrix4;
|
109
|
+
export interface CameraConfig {
|
110
|
+
eye: Vec3;
|
111
|
+
coa: Vec3;
|
112
|
+
up: Vec3;
|
113
|
+
near: number;
|
114
|
+
far: number;
|
115
|
+
angle: number;
|
116
|
+
}
|
117
|
+
export declare const setupCamera: (area: Vec4, zscale: number, cam: CameraConfig) => Matrix4;
|
109
118
|
export {};
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import type { SharedValue } from "react-native-reanimated";
|
2
|
-
import type { TextProps, AtlasProps, BlurMaskFilterProps, BoxProps, BoxShadowProps, CircleProps, CTMProps, DiffRectProps, GlyphsProps, ImageProps, ImageSVGProps, LineProps, NodeType, OvalProps, PaintProps, ParagraphProps, PatchProps, PathProps, PictureProps, PointsProps, RectProps, RoundedRectProps, TextBlobProps, TextPathProps, VerticesProps } from "../../dom/types";
|
2
|
+
import type { TextProps, AtlasProps, BlurMaskFilterProps, BoxProps, BoxShadowProps, CircleProps, CTMProps, DiffRectProps, GlyphsProps, ImageProps, ImageSVGProps, LineProps, NodeType, OvalProps, PaintProps, ParagraphProps, PatchProps, PathProps, PictureProps, PointsProps, RectProps, RoundedRectProps, TextBlobProps, TextPathProps, VerticesProps, SkottieProps } from "../../dom/types";
|
3
3
|
import type { AnimatedProps } from "../../renderer/processors/Animations/Animations";
|
4
4
|
import type { SkPicture } from "./Picture";
|
5
5
|
export interface BaseRecorder {
|
@@ -44,6 +44,7 @@ export interface BaseRecorder {
|
|
44
44
|
drawPicture(props: AnimatedProps<PictureProps>): void;
|
45
45
|
drawImageSVG(props: AnimatedProps<ImageSVGProps>): void;
|
46
46
|
drawParagraph(props: AnimatedProps<ParagraphProps>): void;
|
47
|
+
drawSkottie(props: AnimatedProps<SkottieProps>): void;
|
47
48
|
drawAtlas(props: AnimatedProps<AtlasProps>): void;
|
48
49
|
}
|
49
50
|
export interface JsiRecorder extends BaseRecorder {
|
@@ -29,6 +29,7 @@ import type { ParagraphBuilderFactory } from "./Paragraph/ParagraphBuilder";
|
|
29
29
|
import type { Video } from "./Video";
|
30
30
|
import type { NativeBufferFactory } from "./NativeBuffer";
|
31
31
|
import type { JsiRecorder } from "./Recorder";
|
32
|
+
import type { SkottieFactory } from "./Skottie";
|
32
33
|
export interface SkiaContext {
|
33
34
|
getSurface(): SkSurface;
|
34
35
|
present(): void;
|
@@ -78,6 +79,7 @@ export interface Skia {
|
|
78
79
|
TextBlob: TextBlobFactory;
|
79
80
|
Surface: SurfaceFactory;
|
80
81
|
ParagraphBuilder: ParagraphBuilderFactory;
|
82
|
+
Skottie: SkottieFactory;
|
81
83
|
Video: (url: string) => Promise<Video> | Video;
|
82
84
|
Context(surface: bigint, width: number, height: number): SkiaContext;
|
83
85
|
NativeBuffer: NativeBufferFactory;
|
@@ -0,0 +1,223 @@
|
|
1
|
+
import type { SkCanvas } from "./Canvas";
|
2
|
+
import type { SkColor } from "./Color";
|
3
|
+
import type { SkData } from "./Data";
|
4
|
+
import type { SkJSIInstance } from "./JsiInstance";
|
5
|
+
import type { StrokeJoin } from "./Paint";
|
6
|
+
import type { TextAlign, TextDirection } from "./Paragraph";
|
7
|
+
import type { SkPoint } from "./Point";
|
8
|
+
import type { SkRect } from "./Rect";
|
9
|
+
import type { SkSize } from "./Size";
|
10
|
+
import type { SkTypeface } from "./Typeface";
|
11
|
+
export declare enum LineBreakType {
|
12
|
+
SoftLineBreak = 0,
|
13
|
+
HardtLineBreak = 1
|
14
|
+
}
|
15
|
+
export declare enum VerticalTextAlign {
|
16
|
+
Top = 0,
|
17
|
+
TopBaseline = 1,
|
18
|
+
VisualTop = 2,// visual top -> text box top
|
19
|
+
VisualCenter = 3,// visual center -> text box center
|
20
|
+
VisualBottom = 4
|
21
|
+
}
|
22
|
+
export declare enum ResizePolicy {
|
23
|
+
None = 0,
|
24
|
+
ScaleToFit = 1,
|
25
|
+
DownscaleToFit = 2
|
26
|
+
}
|
27
|
+
export declare enum InputState {
|
28
|
+
Down = 0,
|
29
|
+
Up = 1,
|
30
|
+
Move = 2,
|
31
|
+
Right = 3,
|
32
|
+
Left = 4
|
33
|
+
}
|
34
|
+
export declare enum ModifierKey {
|
35
|
+
None = 0,
|
36
|
+
Shift = 1,
|
37
|
+
Control = 2,
|
38
|
+
Option = 3,
|
39
|
+
Command = 4,
|
40
|
+
FirstPress = 5
|
41
|
+
}
|
42
|
+
export interface AnimationMarker {
|
43
|
+
name: string;
|
44
|
+
t0: number;
|
45
|
+
t1: number;
|
46
|
+
}
|
47
|
+
export interface ColorProperty {
|
48
|
+
/**
|
49
|
+
* Property identifier, usually the node name.
|
50
|
+
*/
|
51
|
+
key: string;
|
52
|
+
/**
|
53
|
+
* Property value (RGBA, 255-based).
|
54
|
+
*/
|
55
|
+
value: SkColor;
|
56
|
+
}
|
57
|
+
/**
|
58
|
+
* Named opacity property.
|
59
|
+
*/
|
60
|
+
export interface OpacityProperty {
|
61
|
+
/**
|
62
|
+
* Property identifier, usually the node name.
|
63
|
+
*/
|
64
|
+
key: string;
|
65
|
+
/**
|
66
|
+
* Property value (0..100).
|
67
|
+
*/
|
68
|
+
value: number;
|
69
|
+
}
|
70
|
+
/**
|
71
|
+
* Text property value.
|
72
|
+
*/
|
73
|
+
export interface TextValue {
|
74
|
+
/**
|
75
|
+
* The text string payload.
|
76
|
+
*/
|
77
|
+
text: string;
|
78
|
+
/**
|
79
|
+
* Font size.
|
80
|
+
*/
|
81
|
+
size: number;
|
82
|
+
}
|
83
|
+
/**
|
84
|
+
* Named text property.
|
85
|
+
*/
|
86
|
+
export interface TextProperty {
|
87
|
+
/**
|
88
|
+
* Property identifier, usually the node name.
|
89
|
+
*/
|
90
|
+
key: string;
|
91
|
+
/**
|
92
|
+
* Property value.
|
93
|
+
*/
|
94
|
+
value: TextValue;
|
95
|
+
}
|
96
|
+
/**
|
97
|
+
* Transform property value. Maps to AE styled transform.
|
98
|
+
*/
|
99
|
+
export interface TransformValue {
|
100
|
+
/**
|
101
|
+
* Anchor point for transform. x and y value.
|
102
|
+
*/
|
103
|
+
anchor: SkPoint;
|
104
|
+
/**
|
105
|
+
* Position of transform. x and y value.
|
106
|
+
*/
|
107
|
+
position: SkPoint;
|
108
|
+
/**
|
109
|
+
* Scale of transform. x and y value.
|
110
|
+
*/
|
111
|
+
scale: SkPoint;
|
112
|
+
/**
|
113
|
+
* Rotation of transform in degrees.
|
114
|
+
*/
|
115
|
+
rotation: number;
|
116
|
+
/**
|
117
|
+
* Skew to apply during transform.
|
118
|
+
*/
|
119
|
+
skew: number;
|
120
|
+
/**
|
121
|
+
* Direction of skew in degrees.
|
122
|
+
*/
|
123
|
+
skewAxis: number;
|
124
|
+
}
|
125
|
+
/**
|
126
|
+
* Named transform property for Skottie property observer.
|
127
|
+
*/
|
128
|
+
export interface TransformProperty {
|
129
|
+
/**
|
130
|
+
* Property identifier, usually the node name.
|
131
|
+
*/
|
132
|
+
key: string;
|
133
|
+
/**
|
134
|
+
* Property value.
|
135
|
+
*/
|
136
|
+
value: TransformValue;
|
137
|
+
}
|
138
|
+
/**
|
139
|
+
* Collection of slot IDs sorted by value type
|
140
|
+
*/
|
141
|
+
export interface SlotInfo {
|
142
|
+
colorSlotIDs: string[];
|
143
|
+
scalarSlotIDs: string[];
|
144
|
+
vec2SlotIDs: string[];
|
145
|
+
imageSlotIDs: string[];
|
146
|
+
textSlotIDs: string[];
|
147
|
+
}
|
148
|
+
/**
|
149
|
+
* Text property for ManagedAnimation's slot support
|
150
|
+
*/
|
151
|
+
export interface SlottableTextProperty {
|
152
|
+
typeface?: SkTypeface;
|
153
|
+
text?: string;
|
154
|
+
textSize?: number;
|
155
|
+
minTextSize?: number;
|
156
|
+
maxTextSize?: number;
|
157
|
+
strokeWidth?: number;
|
158
|
+
lineHeight?: number;
|
159
|
+
lineShift?: number;
|
160
|
+
ascent?: number;
|
161
|
+
maxLines?: number;
|
162
|
+
horizAlign?: TextAlign;
|
163
|
+
vertAlign?: VerticalTextAlign;
|
164
|
+
strokeJoin?: StrokeJoin;
|
165
|
+
direction?: TextDirection;
|
166
|
+
linebreak?: LineBreakType;
|
167
|
+
resize?: ResizePolicy;
|
168
|
+
boundingBox?: SkRect;
|
169
|
+
fillColor?: SkColor;
|
170
|
+
strokeColor?: SkColor;
|
171
|
+
}
|
172
|
+
export interface SkSkottieAnimation extends SkJSIInstance<"SkottieAnimation"> {
|
173
|
+
/**
|
174
|
+
* Returns the animation duration in seconds.
|
175
|
+
*/
|
176
|
+
duration(): number;
|
177
|
+
/**
|
178
|
+
* Returns the animation frame rate (frames / second).
|
179
|
+
*/
|
180
|
+
fps(): number;
|
181
|
+
/**
|
182
|
+
* Draws current animation frame. Must call seek or seekFrame first.
|
183
|
+
* @param canvas
|
184
|
+
* @param dstRect
|
185
|
+
*/
|
186
|
+
render(canvas: SkCanvas, dstRect?: SkRect): void;
|
187
|
+
/**
|
188
|
+
* Update the animation state to match |t|, specified as a frame index
|
189
|
+
* i.e. relative to duration() * fps().
|
190
|
+
*
|
191
|
+
* Returns the rectangle that was affected by this animation.
|
192
|
+
*
|
193
|
+
* @param frame - Fractional values are allowed and meaningful - e.g.
|
194
|
+
* 0.0 -> first frame
|
195
|
+
* 1.0 -> second frame
|
196
|
+
* 0.5 -> halfway between first and second frame
|
197
|
+
* @param damageRect - will copy damage frame into this if provided.
|
198
|
+
*/
|
199
|
+
seekFrame(frame: number, damageRect?: SkRect): void;
|
200
|
+
size(): SkSize;
|
201
|
+
version(): string;
|
202
|
+
getSlotInfo(): SlotInfo;
|
203
|
+
setColorSlot(key: string, color: SkColor): boolean;
|
204
|
+
setScalarSlot(key: string, scalar: number): boolean;
|
205
|
+
setVec2Slot(key: string, vec2: SkPoint): boolean;
|
206
|
+
setTextSlot(key: string, text: SlottableTextProperty): boolean;
|
207
|
+
setImageSlot(key: string, assetName: string): boolean;
|
208
|
+
getColorSlot(key: string): SkColor | null;
|
209
|
+
getScalarSlot(key: string): number | null;
|
210
|
+
getVec2Slot(key: string): SkPoint | null;
|
211
|
+
getTextSlot(key: string): SlottableTextProperty | null;
|
212
|
+
getColorProps(): ColorProperty[];
|
213
|
+
getTextProps(): TextProperty[];
|
214
|
+
getOpacityProps(): OpacityProperty[];
|
215
|
+
getTransformProps(): TransformProperty[];
|
216
|
+
setColor(key: string, color: SkColor): boolean;
|
217
|
+
setText(key: string, text: string, size: number): boolean;
|
218
|
+
setOpacity(key: string, opacity: number): boolean;
|
219
|
+
setTransform(key: string, anchor: SkPoint, position: SkPoint, scale: SkPoint, rotation: number, skew: number, skewAxis: number): boolean;
|
220
|
+
}
|
221
|
+
export interface SkottieFactory {
|
222
|
+
Make(json: string, assets?: Record<string, SkData>): SkSkottieAnimation;
|
223
|
+
}
|