@shopify/react-native-skia 0.1.225 → 0.1.228
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/cpp/rnskia-android/SkiaOpenGLSurfaceFactory.h +3 -3
- package/cpp/api/JsiSkCanvas.h +2 -1
- package/cpp/api/JsiSkMatrix.h +35 -13
- package/cpp/api/JsiSkPictureRecorder.h +10 -3
- package/cpp/api/JsiSkTypeface.h +1 -0
- package/cpp/rnskia/dom/props/MatrixProp.h +19 -0
- package/cpp/rnskia/dom/props/TransformProp.h +76 -9
- package/lib/commonjs/animation/spring/runSpring.d.ts +3 -0
- package/lib/commonjs/animation/spring/runSpring.js +3 -0
- package/lib/commonjs/animation/spring/runSpring.js.map +1 -1
- package/lib/commonjs/animation/spring/useSpring.d.ts +3 -0
- package/lib/commonjs/animation/spring/useSpring.js +3 -0
- package/lib/commonjs/animation/spring/useSpring.js.map +1 -1
- package/lib/commonjs/animation/timing/runTiming.d.ts +3 -0
- package/lib/commonjs/animation/timing/runTiming.js +3 -0
- package/lib/commonjs/animation/timing/runTiming.js.map +1 -1
- package/lib/commonjs/animation/timing/useLoop.d.ts +3 -0
- package/lib/commonjs/animation/timing/useLoop.js +3 -0
- package/lib/commonjs/animation/timing/useLoop.js.map +1 -1
- package/lib/commonjs/animation/timing/useTiming.d.ts +3 -0
- package/lib/commonjs/animation/timing/useTiming.js +3 -0
- package/lib/commonjs/animation/timing/useTiming.js.map +1 -1
- package/lib/commonjs/dom/nodes/JsiSkDOM.js +2 -0
- package/lib/commonjs/dom/nodes/JsiSkDOM.js.map +1 -1
- package/lib/commonjs/dom/nodes/datatypes/Fitting.d.ts +5 -5
- package/lib/commonjs/dom/nodes/datatypes/Fitting.js.map +1 -1
- package/lib/commonjs/dom/nodes/datatypes/Gradient.d.ts +235 -75
- package/lib/commonjs/dom/nodes/datatypes/Gradient.js.map +1 -1
- package/lib/commonjs/dom/types/Common.d.ts +3 -3
- package/lib/commonjs/dom/types/Common.js.map +1 -1
- package/lib/commonjs/external/reanimated/interpolators.d.ts +1 -0
- package/lib/commonjs/external/reanimated/interpolators.js +24 -5
- package/lib/commonjs/external/reanimated/interpolators.js.map +1 -1
- package/lib/commonjs/external/reanimated/moduleWrapper.d.ts +2 -1
- package/lib/commonjs/external/reanimated/moduleWrapper.js +9 -7
- package/lib/commonjs/external/reanimated/moduleWrapper.js.map +1 -1
- package/lib/commonjs/renderer/Canvas.js +34 -28
- package/lib/commonjs/renderer/Canvas.js.map +1 -1
- package/lib/commonjs/renderer/components/Drawing.d.ts +5 -0
- package/lib/commonjs/renderer/components/Drawing.js +5 -0
- package/lib/commonjs/renderer/components/Drawing.js.map +1 -1
- package/lib/commonjs/renderer/components/shapes/FitBox.d.ts +5 -5
- package/lib/commonjs/skia/core/Matrix.d.ts +2 -2
- package/lib/commonjs/skia/core/Matrix.js.map +1 -1
- package/lib/commonjs/skia/core/Picture.d.ts +2 -2
- package/lib/commonjs/skia/core/Picture.js +12 -2
- package/lib/commonjs/skia/core/Picture.js.map +1 -1
- package/lib/commonjs/skia/core/Vector.d.ts +0 -5
- package/lib/commonjs/skia/core/Vector.js +1 -17
- package/lib/commonjs/skia/core/Vector.js.map +1 -1
- package/lib/commonjs/skia/types/Canvas.d.ts +1 -1
- package/lib/commonjs/skia/types/Canvas.js.map +1 -1
- package/lib/commonjs/skia/types/Matrix.d.ts +4 -20
- package/lib/commonjs/skia/types/Matrix.js +4 -70
- package/lib/commonjs/skia/types/Matrix.js.map +1 -1
- package/lib/commonjs/skia/types/Matrix4.d.ts +90 -0
- package/lib/commonjs/skia/types/Matrix4.js +312 -0
- package/lib/commonjs/skia/types/Matrix4.js.map +1 -0
- package/lib/commonjs/skia/types/Path/Path.d.ts +1 -1
- package/lib/commonjs/skia/types/Path/Path.js.map +1 -1
- package/lib/commonjs/skia/types/Picture/PictureRecorder.d.ts +1 -1
- package/lib/commonjs/skia/types/Picture/PictureRecorder.js.map +1 -1
- package/lib/commonjs/skia/types/Rect.d.ts +1 -0
- package/lib/commonjs/skia/types/Rect.js +18 -0
- package/lib/commonjs/skia/types/Rect.js.map +1 -1
- package/lib/commonjs/skia/types/index.d.ts +1 -0
- package/lib/commonjs/skia/types/index.js +13 -0
- package/lib/commonjs/skia/types/index.js.map +1 -1
- package/lib/commonjs/skia/web/Host.d.ts +2 -3
- package/lib/commonjs/skia/web/Host.js +4 -12
- package/lib/commonjs/skia/web/Host.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkCanvas.d.ts +1 -1
- package/lib/commonjs/skia/web/JsiSkCanvas.js +13 -13
- 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/JsiSkMatrix.d.ts +2 -2
- package/lib/commonjs/skia/web/JsiSkMatrix.js +6 -1
- package/lib/commonjs/skia/web/JsiSkMatrix.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 +5 -5
- 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/JsiSkPictureRecorder.d.ts +1 -1
- package/lib/commonjs/skia/web/JsiSkPictureRecorder.js +1 -1
- package/lib/commonjs/skia/web/JsiSkPictureRecorder.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 +3 -3
- package/lib/commonjs/skia/web/JsiSkVerticesFactory.js.map +1 -1
- package/lib/commonjs/values/api.d.ts +23 -2
- package/lib/commonjs/values/api.js +44 -1
- package/lib/commonjs/values/api.js.map +1 -1
- package/lib/commonjs/values/hooks/useClockValue.d.ts +3 -0
- package/lib/commonjs/values/hooks/useClockValue.js +3 -0
- package/lib/commonjs/values/hooks/useClockValue.js.map +1 -1
- package/lib/commonjs/values/hooks/useComputedValue.d.ts +3 -0
- package/lib/commonjs/values/hooks/useComputedValue.js +3 -0
- package/lib/commonjs/values/hooks/useComputedValue.js.map +1 -1
- package/lib/commonjs/values/hooks/useValue.d.ts +3 -0
- package/lib/commonjs/values/hooks/useValue.js +3 -0
- package/lib/commonjs/values/hooks/useValue.js.map +1 -1
- package/lib/commonjs/values/hooks/useValueEffect.d.ts +3 -0
- package/lib/commonjs/values/hooks/useValueEffect.js +3 -0
- package/lib/commonjs/values/hooks/useValueEffect.js.map +1 -1
- package/lib/commonjs/values/types.d.ts +4 -4
- package/lib/commonjs/values/types.js.map +1 -1
- package/lib/commonjs/views/SkiaView.d.ts +5 -0
- package/lib/commonjs/views/SkiaView.js +9 -0
- package/lib/commonjs/views/SkiaView.js.map +1 -1
- package/lib/module/animation/spring/runSpring.d.ts +3 -0
- package/lib/module/animation/spring/runSpring.js +3 -0
- package/lib/module/animation/spring/runSpring.js.map +1 -1
- package/lib/module/animation/spring/useSpring.d.ts +3 -0
- package/lib/module/animation/spring/useSpring.js +3 -0
- package/lib/module/animation/spring/useSpring.js.map +1 -1
- package/lib/module/animation/timing/runTiming.d.ts +3 -0
- package/lib/module/animation/timing/runTiming.js +3 -0
- package/lib/module/animation/timing/runTiming.js.map +1 -1
- package/lib/module/animation/timing/useLoop.d.ts +3 -0
- package/lib/module/animation/timing/useLoop.js +3 -0
- package/lib/module/animation/timing/useLoop.js.map +1 -1
- package/lib/module/animation/timing/useTiming.d.ts +3 -0
- package/lib/module/animation/timing/useTiming.js +3 -0
- package/lib/module/animation/timing/useTiming.js.map +1 -1
- package/lib/module/dom/nodes/JsiSkDOM.js +2 -0
- package/lib/module/dom/nodes/JsiSkDOM.js.map +1 -1
- package/lib/module/dom/nodes/datatypes/Fitting.d.ts +5 -5
- package/lib/module/dom/nodes/datatypes/Fitting.js.map +1 -1
- package/lib/module/dom/nodes/datatypes/Gradient.d.ts +235 -75
- package/lib/module/dom/nodes/datatypes/Gradient.js.map +1 -1
- package/lib/module/dom/types/Common.d.ts +3 -3
- package/lib/module/dom/types/Common.js.map +1 -1
- package/lib/module/external/reanimated/interpolators.d.ts +1 -0
- package/lib/module/external/reanimated/interpolators.js +22 -6
- package/lib/module/external/reanimated/interpolators.js.map +1 -1
- package/lib/module/external/reanimated/moduleWrapper.d.ts +2 -1
- package/lib/module/external/reanimated/moduleWrapper.js +7 -6
- package/lib/module/external/reanimated/moduleWrapper.js.map +1 -1
- package/lib/module/renderer/Canvas.js +35 -29
- package/lib/module/renderer/Canvas.js.map +1 -1
- package/lib/module/renderer/components/Drawing.d.ts +5 -0
- package/lib/module/renderer/components/Drawing.js +6 -0
- package/lib/module/renderer/components/Drawing.js.map +1 -1
- package/lib/module/renderer/components/shapes/FitBox.d.ts +5 -5
- package/lib/module/skia/core/Matrix.d.ts +2 -2
- package/lib/module/skia/core/Matrix.js.map +1 -1
- package/lib/module/skia/core/Picture.d.ts +2 -2
- package/lib/module/skia/core/Picture.js +12 -3
- package/lib/module/skia/core/Picture.js.map +1 -1
- package/lib/module/skia/core/Vector.d.ts +0 -5
- package/lib/module/skia/core/Vector.js +0 -13
- package/lib/module/skia/core/Vector.js.map +1 -1
- package/lib/module/skia/types/Canvas.d.ts +1 -1
- package/lib/module/skia/types/Canvas.js.map +1 -1
- package/lib/module/skia/types/Matrix.d.ts +4 -20
- package/lib/module/skia/types/Matrix.js +3 -71
- package/lib/module/skia/types/Matrix.js.map +1 -1
- package/lib/module/skia/types/Matrix4.d.ts +90 -0
- package/lib/module/skia/types/Matrix4.js +274 -0
- package/lib/module/skia/types/Matrix4.js.map +1 -0
- package/lib/module/skia/types/Path/Path.d.ts +1 -1
- package/lib/module/skia/types/Path/Path.js.map +1 -1
- package/lib/module/skia/types/Picture/PictureRecorder.d.ts +1 -1
- package/lib/module/skia/types/Picture/PictureRecorder.js.map +1 -1
- package/lib/module/skia/types/Rect.d.ts +1 -0
- package/lib/module/skia/types/Rect.js +9 -0
- package/lib/module/skia/types/Rect.js.map +1 -1
- 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/Host.d.ts +2 -3
- package/lib/module/skia/web/Host.js +2 -7
- package/lib/module/skia/web/Host.js.map +1 -1
- package/lib/module/skia/web/JsiSkCanvas.d.ts +1 -1
- package/lib/module/skia/web/JsiSkCanvas.js +14 -14
- package/lib/module/skia/web/JsiSkCanvas.js.map +1 -1
- package/lib/module/skia/web/JsiSkColorFilterFactory.js +2 -2
- package/lib/module/skia/web/JsiSkColorFilterFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkFont.js +3 -3
- package/lib/module/skia/web/JsiSkFont.js.map +1 -1
- package/lib/module/skia/web/JsiSkImage.js +7 -7
- package/lib/module/skia/web/JsiSkImage.js.map +1 -1
- package/lib/module/skia/web/JsiSkImageFactory.js +3 -3
- package/lib/module/skia/web/JsiSkImageFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkImageFilterFactory.js +4 -4
- package/lib/module/skia/web/JsiSkImageFilterFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkMaskFilterFactory.js +2 -2
- package/lib/module/skia/web/JsiSkMaskFilterFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkMatrix.d.ts +2 -2
- package/lib/module/skia/web/JsiSkMatrix.js +6 -1
- package/lib/module/skia/web/JsiSkMatrix.js.map +1 -1
- package/lib/module/skia/web/JsiSkPaint.js +4 -4
- package/lib/module/skia/web/JsiSkPaint.js.map +1 -1
- package/lib/module/skia/web/JsiSkPath.js +6 -6
- package/lib/module/skia/web/JsiSkPath.js.map +1 -1
- package/lib/module/skia/web/JsiSkPathEffectFactory.js +2 -2
- package/lib/module/skia/web/JsiSkPathEffectFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkPathFactory.js +2 -2
- package/lib/module/skia/web/JsiSkPathFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkPicture.js +2 -2
- package/lib/module/skia/web/JsiSkPicture.js.map +1 -1
- package/lib/module/skia/web/JsiSkPictureRecorder.d.ts +1 -1
- package/lib/module/skia/web/JsiSkPictureRecorder.js +1 -1
- package/lib/module/skia/web/JsiSkPictureRecorder.js.map +1 -1
- package/lib/module/skia/web/JsiSkShaderFactory.js +6 -6
- package/lib/module/skia/web/JsiSkShaderFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkVerticesFactory.js +2 -2
- package/lib/module/skia/web/JsiSkVerticesFactory.js.map +1 -1
- package/lib/module/values/api.d.ts +23 -2
- package/lib/module/values/api.js +44 -1
- package/lib/module/values/api.js.map +1 -1
- package/lib/module/values/hooks/useClockValue.d.ts +3 -0
- package/lib/module/values/hooks/useClockValue.js +3 -0
- package/lib/module/values/hooks/useClockValue.js.map +1 -1
- package/lib/module/values/hooks/useComputedValue.d.ts +3 -0
- package/lib/module/values/hooks/useComputedValue.js +3 -0
- package/lib/module/values/hooks/useComputedValue.js.map +1 -1
- package/lib/module/values/hooks/useValue.d.ts +3 -0
- package/lib/module/values/hooks/useValue.js +3 -0
- package/lib/module/values/hooks/useValue.js.map +1 -1
- package/lib/module/values/hooks/useValueEffect.d.ts +3 -0
- package/lib/module/values/hooks/useValueEffect.js +3 -0
- package/lib/module/values/hooks/useValueEffect.js.map +1 -1
- package/lib/module/values/types.d.ts +4 -4
- package/lib/module/values/types.js.map +1 -1
- package/lib/module/views/SkiaView.d.ts +5 -0
- package/lib/module/views/SkiaView.js +10 -0
- package/lib/module/views/SkiaView.js.map +1 -1
- package/lib/typescript/src/animation/spring/runSpring.d.ts +3 -0
- package/lib/typescript/src/animation/spring/useSpring.d.ts +3 -0
- package/lib/typescript/src/animation/timing/runTiming.d.ts +3 -0
- package/lib/typescript/src/animation/timing/useLoop.d.ts +3 -0
- package/lib/typescript/src/animation/timing/useTiming.d.ts +3 -0
- package/lib/typescript/src/dom/nodes/datatypes/Fitting.d.ts +5 -5
- package/lib/typescript/src/dom/nodes/datatypes/Gradient.d.ts +235 -75
- package/lib/typescript/src/dom/types/Common.d.ts +3 -3
- package/lib/typescript/src/external/reanimated/interpolators.d.ts +1 -0
- package/lib/typescript/src/external/reanimated/moduleWrapper.d.ts +2 -1
- package/lib/typescript/src/renderer/components/Drawing.d.ts +5 -0
- package/lib/typescript/src/renderer/components/shapes/FitBox.d.ts +5 -5
- package/lib/typescript/src/skia/core/Matrix.d.ts +2 -2
- package/lib/typescript/src/skia/core/Picture.d.ts +2 -2
- package/lib/typescript/src/skia/core/Vector.d.ts +0 -5
- package/lib/typescript/src/skia/types/Canvas.d.ts +1 -1
- package/lib/typescript/src/skia/types/Matrix.d.ts +4 -20
- package/lib/typescript/src/skia/types/Matrix4.d.ts +90 -0
- package/lib/typescript/src/skia/types/Path/Path.d.ts +1 -1
- package/lib/typescript/src/skia/types/Picture/PictureRecorder.d.ts +1 -1
- package/lib/typescript/src/skia/types/Rect.d.ts +1 -0
- package/lib/typescript/src/skia/types/index.d.ts +1 -0
- package/lib/typescript/src/skia/web/Host.d.ts +2 -3
- package/lib/typescript/src/skia/web/JsiSkCanvas.d.ts +1 -1
- package/lib/typescript/src/skia/web/JsiSkMatrix.d.ts +2 -2
- package/lib/typescript/src/skia/web/JsiSkPictureRecorder.d.ts +1 -1
- package/lib/typescript/src/values/api.d.ts +23 -2
- package/lib/typescript/src/values/hooks/useClockValue.d.ts +3 -0
- package/lib/typescript/src/values/hooks/useComputedValue.d.ts +3 -0
- package/lib/typescript/src/values/hooks/useValue.d.ts +3 -0
- package/lib/typescript/src/values/hooks/useValueEffect.d.ts +3 -0
- package/lib/typescript/src/values/types.d.ts +4 -4
- package/lib/typescript/src/views/SkiaView.d.ts +5 -0
- package/package.json +2 -1
- package/src/animation/spring/runSpring.ts +3 -0
- package/src/animation/spring/useSpring.ts +3 -0
- package/src/animation/timing/runTiming.ts +3 -0
- package/src/animation/timing/useLoop.ts +3 -0
- package/src/animation/timing/useTiming.ts +3 -0
- package/src/dom/nodes/JsiSkDOM.ts +4 -0
- package/src/dom/nodes/datatypes/Fitting.ts +10 -2
- package/src/dom/nodes/datatypes/Gradient.ts +2 -2
- package/src/dom/types/Common.ts +5 -3
- package/src/external/reanimated/interpolators.ts +30 -7
- package/src/external/reanimated/moduleWrapper.ts +6 -0
- package/src/renderer/Canvas.tsx +41 -30
- package/src/renderer/components/Drawing.tsx +5 -0
- package/src/skia/core/Matrix.ts +2 -2
- package/src/skia/core/Picture.ts +11 -3
- package/src/skia/core/Vector.ts +0 -4
- package/src/skia/types/Canvas.ts +1 -1
- package/src/skia/types/Matrix.ts +7 -85
- package/src/skia/types/Matrix4.ts +344 -0
- package/src/skia/types/Path/Path.ts +1 -1
- package/src/skia/types/Picture/PictureRecorder.ts +1 -1
- package/src/skia/types/Rect.ts +14 -0
- package/src/skia/types/index.ts +1 -0
- package/src/skia/web/Host.ts +4 -3
- package/src/skia/web/JsiSkCanvas.ts +24 -17
- package/src/skia/web/JsiSkColorFilterFactory.ts +5 -2
- package/src/skia/web/JsiSkFont.ts +3 -3
- package/src/skia/web/JsiSkImage.ts +14 -11
- package/src/skia/web/JsiSkImageFactory.ts +3 -3
- package/src/skia/web/JsiSkImageFilterFactory.ts +5 -5
- package/src/skia/web/JsiSkMaskFilterFactory.ts +6 -2
- package/src/skia/web/JsiSkMatrix.ts +14 -3
- package/src/skia/web/JsiSkPaint.ts +4 -4
- package/src/skia/web/JsiSkPath.ts +9 -6
- package/src/skia/web/JsiSkPathEffectFactory.ts +2 -2
- package/src/skia/web/JsiSkPathFactory.ts +2 -2
- package/src/skia/web/JsiSkPicture.ts +4 -4
- package/src/skia/web/JsiSkPictureRecorder.ts +6 -2
- package/src/skia/web/JsiSkShaderFactory.ts +6 -6
- package/src/skia/web/JsiSkVerticesFactory.ts +2 -2
- package/src/values/api.ts +55 -2
- package/src/values/hooks/useClockValue.ts +3 -0
- package/src/values/hooks/useComputedValue.ts +3 -0
- package/src/values/hooks/useValue.ts +3 -0
- package/src/values/hooks/useValueEffect.ts +3 -0
- package/src/values/types.ts +6 -6
- package/src/views/SkiaView.tsx +11 -0
package/src/skia/web/Host.ts
CHANGED
|
@@ -41,10 +41,11 @@ export abstract class HostObject<T, N extends string> extends BaseHostObject<
|
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
export const
|
|
44
|
+
export const getEnum = (e: EmbindEnum, v: number): EmbindEnumEntity =>
|
|
45
45
|
Object.values(e).find(({ value }) => value === v);
|
|
46
|
-
|
|
46
|
+
|
|
47
47
|
export const optEnum = (
|
|
48
|
+
e: EmbindEnum,
|
|
48
49
|
value: number | undefined
|
|
49
50
|
): EmbindEnumEntity | undefined =>
|
|
50
|
-
value === undefined ? undefined :
|
|
51
|
+
value === undefined ? undefined : getEnum(e, value);
|
|
@@ -25,7 +25,7 @@ import type {
|
|
|
25
25
|
SkVertices,
|
|
26
26
|
} from "../types";
|
|
27
27
|
|
|
28
|
-
import {
|
|
28
|
+
import { getEnum, HostObject } from "./Host";
|
|
29
29
|
import { JsiSkPaint } from "./JsiSkPaint";
|
|
30
30
|
import { JsiSkRect } from "./JsiSkRect";
|
|
31
31
|
import { JsiSkRRect } from "./JsiSkRRect";
|
|
@@ -113,8 +113,8 @@ export class JsiSkCanvas
|
|
|
113
113
|
JsiSkImage.fromValue(img),
|
|
114
114
|
left,
|
|
115
115
|
top,
|
|
116
|
-
|
|
117
|
-
|
|
116
|
+
getEnum(this.CanvasKit.FilterMode, fm),
|
|
117
|
+
getEnum(this.CanvasKit.MipmapMode, mm),
|
|
118
118
|
paint ? JsiSkPaint.fromValue(paint) : paint
|
|
119
119
|
);
|
|
120
120
|
}
|
|
@@ -130,7 +130,7 @@ export class JsiSkCanvas
|
|
|
130
130
|
JsiSkImage.fromValue(img),
|
|
131
131
|
Array.from(JsiSkRect.fromValue(this.CanvasKit, center)),
|
|
132
132
|
JsiSkRect.fromValue(this.CanvasKit, dest),
|
|
133
|
-
|
|
133
|
+
getEnum(this.CanvasKit.FilterMode, filter),
|
|
134
134
|
paint ? JsiSkPaint.fromValue(paint) : paint
|
|
135
135
|
);
|
|
136
136
|
}
|
|
@@ -165,8 +165,8 @@ export class JsiSkCanvas
|
|
|
165
165
|
JsiSkImage.fromValue(img),
|
|
166
166
|
JsiSkRect.fromValue(this.CanvasKit, src),
|
|
167
167
|
JsiSkRect.fromValue(this.CanvasKit, dest),
|
|
168
|
-
|
|
169
|
-
|
|
168
|
+
getEnum(this.CanvasKit.FilterMode, fm),
|
|
169
|
+
getEnum(this.CanvasKit.MipmapMode, mm),
|
|
170
170
|
paint ? JsiSkPaint.fromValue(paint) : paint
|
|
171
171
|
);
|
|
172
172
|
}
|
|
@@ -186,7 +186,7 @@ export class JsiSkCanvas
|
|
|
186
186
|
drawVertices(verts: SkVertices, mode: BlendMode, paint: SkPaint) {
|
|
187
187
|
this.ref.drawVertices(
|
|
188
188
|
JsiSkVertices.fromValue(verts),
|
|
189
|
-
|
|
189
|
+
getEnum(this.CanvasKit.BlendMode, mode),
|
|
190
190
|
JsiSkPaint.fromValue(paint)
|
|
191
191
|
);
|
|
192
192
|
}
|
|
@@ -202,7 +202,7 @@ export class JsiSkCanvas
|
|
|
202
202
|
cubics.map(({ x, y }) => [x, y]).flat(),
|
|
203
203
|
colors,
|
|
204
204
|
texs ? texs.flatMap((p) => Array.from(JsiSkPoint.fromValue(p))) : texs,
|
|
205
|
-
mode ?
|
|
205
|
+
mode ? getEnum(this.CanvasKit.BlendMode, mode) : null,
|
|
206
206
|
paint ? JsiSkPaint.fromValue(paint) : undefined
|
|
207
207
|
);
|
|
208
208
|
}
|
|
@@ -213,7 +213,7 @@ export class JsiSkCanvas
|
|
|
213
213
|
|
|
214
214
|
drawPoints(mode: PointMode, points: SkPoint[], paint: SkPaint) {
|
|
215
215
|
this.ref.drawPoints(
|
|
216
|
-
|
|
216
|
+
getEnum(this.CanvasKit.PointMode, mode),
|
|
217
217
|
points.map(({ x, y }) => [x, y]).flat(),
|
|
218
218
|
JsiSkPaint.fromValue(paint)
|
|
219
219
|
);
|
|
@@ -341,7 +341,10 @@ export class JsiSkCanvas
|
|
|
341
341
|
}
|
|
342
342
|
|
|
343
343
|
drawColor(color: SkColor, blendMode?: BlendMode) {
|
|
344
|
-
this.ref.drawColor(
|
|
344
|
+
this.ref.drawColor(
|
|
345
|
+
color,
|
|
346
|
+
blendMode ? getEnum(this.CanvasKit.BlendMode, blendMode) : undefined
|
|
347
|
+
);
|
|
345
348
|
}
|
|
346
349
|
|
|
347
350
|
clear(color: SkColor) {
|
|
@@ -349,13 +352,17 @@ export class JsiSkCanvas
|
|
|
349
352
|
}
|
|
350
353
|
|
|
351
354
|
clipPath(path: SkPath, op: ClipOp, doAntiAlias: boolean) {
|
|
352
|
-
this.ref.clipPath(
|
|
355
|
+
this.ref.clipPath(
|
|
356
|
+
JsiSkPath.fromValue(path),
|
|
357
|
+
getEnum(this.CanvasKit.PathOp, op),
|
|
358
|
+
doAntiAlias
|
|
359
|
+
);
|
|
353
360
|
}
|
|
354
361
|
|
|
355
362
|
clipRect(rect: SkRect, op: ClipOp, doAntiAlias: boolean) {
|
|
356
363
|
this.ref.clipRect(
|
|
357
364
|
JsiSkRect.fromValue(this.CanvasKit, rect),
|
|
358
|
-
|
|
365
|
+
getEnum(this.CanvasKit.PathOp, op),
|
|
359
366
|
doAntiAlias
|
|
360
367
|
);
|
|
361
368
|
}
|
|
@@ -363,13 +370,13 @@ export class JsiSkCanvas
|
|
|
363
370
|
clipRRect(rrect: SkRRect, op: ClipOp, doAntiAlias: boolean) {
|
|
364
371
|
this.ref.clipRRect(
|
|
365
372
|
JsiSkRRect.fromValue(this.CanvasKit, rrect),
|
|
366
|
-
|
|
373
|
+
getEnum(this.CanvasKit.PathOp, op),
|
|
367
374
|
doAntiAlias
|
|
368
375
|
);
|
|
369
376
|
}
|
|
370
377
|
|
|
371
|
-
concat(m: SkMatrix) {
|
|
372
|
-
this.ref.concat(JsiSkMatrix.fromValue(m));
|
|
378
|
+
concat(m: SkMatrix | number[]) {
|
|
379
|
+
this.ref.concat(Array.isArray(m) ? m : JsiSkMatrix.fromValue(m));
|
|
373
380
|
}
|
|
374
381
|
|
|
375
382
|
drawPicture(skp: SkPicture) {
|
|
@@ -381,8 +388,8 @@ export class JsiSkCanvas
|
|
|
381
388
|
width: imageInfo.width,
|
|
382
389
|
height: imageInfo.height,
|
|
383
390
|
colorSpace: this.CanvasKit.ColorSpace.SRGB,
|
|
384
|
-
alphaType:
|
|
385
|
-
colorType:
|
|
391
|
+
alphaType: getEnum(this.CanvasKit.AlphaType, imageInfo.alphaType),
|
|
392
|
+
colorType: getEnum(this.CanvasKit.ColorType, imageInfo.colorType),
|
|
386
393
|
};
|
|
387
394
|
return this.ref.readPixels(srcX, srcY, pxInfo);
|
|
388
395
|
}
|
|
@@ -8,7 +8,7 @@ import type {
|
|
|
8
8
|
BlendMode,
|
|
9
9
|
} from "../types";
|
|
10
10
|
|
|
11
|
-
import {
|
|
11
|
+
import { getEnum, Host } from "./Host";
|
|
12
12
|
import { JsiSkColorFilter } from "./JsiSkColorFilter";
|
|
13
13
|
|
|
14
14
|
export class JsiSkColorFilterFactory
|
|
@@ -29,7 +29,10 @@ export class JsiSkColorFilterFactory
|
|
|
29
29
|
MakeBlend(color: SkColor, mode: BlendMode) {
|
|
30
30
|
return new JsiSkColorFilter(
|
|
31
31
|
this.CanvasKit,
|
|
32
|
-
this.CanvasKit.ColorFilter.MakeBlend(
|
|
32
|
+
this.CanvasKit.ColorFilter.MakeBlend(
|
|
33
|
+
color,
|
|
34
|
+
getEnum(this.CanvasKit.BlendMode, mode)
|
|
35
|
+
)
|
|
33
36
|
);
|
|
34
37
|
}
|
|
35
38
|
|
|
@@ -10,7 +10,7 @@ import type {
|
|
|
10
10
|
SkTypeface,
|
|
11
11
|
} from "../types";
|
|
12
12
|
|
|
13
|
-
import { HostObject, NotImplementedOnRNWeb,
|
|
13
|
+
import { HostObject, NotImplementedOnRNWeb, getEnum } from "./Host";
|
|
14
14
|
import { JsiSkPaint } from "./JsiSkPaint";
|
|
15
15
|
import { JsiSkPoint } from "./JsiSkPoint";
|
|
16
16
|
import { JsiSkRect } from "./JsiSkRect";
|
|
@@ -100,7 +100,7 @@ export class JsiSkFont extends HostObject<Font, "Font"> implements SkFont {
|
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
setEdging(edging: FontEdging) {
|
|
103
|
-
this.ref.setEdging(
|
|
103
|
+
this.ref.setEdging(getEnum(this.CanvasKit.FontEdging, edging));
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
setEmbeddedBitmaps(embeddedBitmaps: boolean) {
|
|
@@ -108,7 +108,7 @@ export class JsiSkFont extends HostObject<Font, "Font"> implements SkFont {
|
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
setHinting(hinting: FontHinting) {
|
|
111
|
-
this.ref.setHinting(
|
|
111
|
+
this.ref.setHinting(getEnum(this.CanvasKit.FontHinting, hinting));
|
|
112
112
|
}
|
|
113
113
|
|
|
114
114
|
setLinearMetrics(linearMetrics: boolean) {
|
|
@@ -15,7 +15,7 @@ import type {
|
|
|
15
15
|
ImageInfo,
|
|
16
16
|
} from "../types";
|
|
17
17
|
|
|
18
|
-
import {
|
|
18
|
+
import { getEnum, HostObject } from "./Host";
|
|
19
19
|
import { JsiSkMatrix } from "./JsiSkMatrix";
|
|
20
20
|
import { JsiSkShader } from "./JsiSkShader";
|
|
21
21
|
|
|
@@ -77,10 +77,10 @@ export class JsiSkImage extends HostObject<Image, "Image"> implements SkImage {
|
|
|
77
77
|
return new JsiSkShader(
|
|
78
78
|
this.CanvasKit,
|
|
79
79
|
this.ref.makeShaderOptions(
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
80
|
+
getEnum(this.CanvasKit.TileMode, tx),
|
|
81
|
+
getEnum(this.CanvasKit.TileMode, ty),
|
|
82
|
+
getEnum(this.CanvasKit.FilterMode, fm),
|
|
83
|
+
getEnum(this.CanvasKit.MipmapMode, mm),
|
|
84
84
|
localMatrix ? JsiSkMatrix.fromValue(localMatrix) : undefined
|
|
85
85
|
)
|
|
86
86
|
);
|
|
@@ -96,8 +96,8 @@ export class JsiSkImage extends HostObject<Image, "Image"> implements SkImage {
|
|
|
96
96
|
return new JsiSkShader(
|
|
97
97
|
this.CanvasKit,
|
|
98
98
|
this.ref.makeShaderCubic(
|
|
99
|
-
|
|
100
|
-
|
|
99
|
+
getEnum(this.CanvasKit.TileMode, tx),
|
|
100
|
+
getEnum(this.CanvasKit.TileMode, ty),
|
|
101
101
|
B,
|
|
102
102
|
C,
|
|
103
103
|
localMatrix ? JsiSkMatrix.fromValue(localMatrix) : undefined
|
|
@@ -108,9 +108,12 @@ export class JsiSkImage extends HostObject<Image, "Image"> implements SkImage {
|
|
|
108
108
|
encodeToBytes(fmt?: ImageFormat, quality?: number) {
|
|
109
109
|
let result: Uint8Array | null;
|
|
110
110
|
if (fmt && quality) {
|
|
111
|
-
result = this.ref.encodeToBytes(
|
|
111
|
+
result = this.ref.encodeToBytes(
|
|
112
|
+
getEnum(this.CanvasKit.ImageFormat, fmt),
|
|
113
|
+
quality
|
|
114
|
+
);
|
|
112
115
|
} else if (fmt) {
|
|
113
|
-
result = this.ref.encodeToBytes(
|
|
116
|
+
result = this.ref.encodeToBytes(getEnum(this.CanvasKit.ImageFormat, fmt));
|
|
114
117
|
} else {
|
|
115
118
|
result = this.ref.encodeToBytes();
|
|
116
119
|
}
|
|
@@ -131,11 +134,11 @@ export class JsiSkImage extends HostObject<Image, "Image"> implements SkImage {
|
|
|
131
134
|
colorSpace: this.CanvasKit.ColorSpace.SRGB,
|
|
132
135
|
width: imageInfo?.width ?? info.width,
|
|
133
136
|
height: imageInfo?.height ?? info.height,
|
|
134
|
-
alphaType:
|
|
137
|
+
alphaType: getEnum(
|
|
135
138
|
this.CanvasKit.AlphaType,
|
|
136
139
|
(imageInfo ?? info).alphaType
|
|
137
140
|
),
|
|
138
|
-
colorType:
|
|
141
|
+
colorType: getEnum(
|
|
139
142
|
this.CanvasKit.ColorType,
|
|
140
143
|
(imageInfo ?? info).colorType
|
|
141
144
|
),
|
|
@@ -3,7 +3,7 @@ import type { CanvasKit } from "canvaskit-wasm";
|
|
|
3
3
|
import type { SkData, ImageInfo, SkImage } from "../types";
|
|
4
4
|
import type { ImageFactory } from "../types/Image/ImageFactory";
|
|
5
5
|
|
|
6
|
-
import { Host,
|
|
6
|
+
import { Host, getEnum } from "./Host";
|
|
7
7
|
import { JsiSkImage } from "./JsiSkImage";
|
|
8
8
|
import { JsiSkData } from "./JsiSkData";
|
|
9
9
|
|
|
@@ -33,9 +33,9 @@ export class JsiSkImageFactory extends Host implements ImageFactory {
|
|
|
33
33
|
// see toSkImageInfo() from canvaskit
|
|
34
34
|
const image = this.CanvasKit.MakeImage(
|
|
35
35
|
{
|
|
36
|
-
alphaType:
|
|
36
|
+
alphaType: getEnum(this.CanvasKit.AlphaType, info.alphaType),
|
|
37
37
|
colorSpace: this.CanvasKit.ColorSpace.SRGB,
|
|
38
|
-
colorType:
|
|
38
|
+
colorType: getEnum(this.CanvasKit.ColorType, info.colorType),
|
|
39
39
|
height: info.height,
|
|
40
40
|
width: info.width,
|
|
41
41
|
},
|
|
@@ -13,7 +13,7 @@ import type {
|
|
|
13
13
|
TileMode,
|
|
14
14
|
} from "../types";
|
|
15
15
|
|
|
16
|
-
import { Host, NotImplementedOnRNWeb,
|
|
16
|
+
import { Host, NotImplementedOnRNWeb, getEnum } from "./Host";
|
|
17
17
|
import { JsiSkImageFilter } from "./JsiSkImageFilter";
|
|
18
18
|
import { JsiSkColorFilter } from "./JsiSkColorFilter";
|
|
19
19
|
|
|
@@ -42,8 +42,8 @@ export class JsiSkImageFilterFactory
|
|
|
42
42
|
const inputFilter =
|
|
43
43
|
input === null ? null : JsiSkImageFilter.fromValue<ImageFilter>(input);
|
|
44
44
|
const filter = this.CanvasKit.ImageFilter.MakeDisplacementMap(
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
getEnum(this.CanvasKit.ColorChannel, channelX),
|
|
46
|
+
getEnum(this.CanvasKit.ColorChannel, channelY),
|
|
47
47
|
scale,
|
|
48
48
|
JsiSkImageFilter.fromValue(in1),
|
|
49
49
|
inputFilter
|
|
@@ -69,7 +69,7 @@ export class JsiSkImageFilterFactory
|
|
|
69
69
|
this.CanvasKit.ImageFilter.MakeBlur(
|
|
70
70
|
sigmaX,
|
|
71
71
|
sigmaY,
|
|
72
|
-
|
|
72
|
+
getEnum(this.CanvasKit.TileMode, mode),
|
|
73
73
|
input === null ? null : JsiSkImageFilter.fromValue(input)
|
|
74
74
|
)
|
|
75
75
|
);
|
|
@@ -199,7 +199,7 @@ export class JsiSkImageFilterFactory
|
|
|
199
199
|
);
|
|
200
200
|
}
|
|
201
201
|
const filter = this.CanvasKit.ImageFilter.MakeBlend(
|
|
202
|
-
|
|
202
|
+
getEnum(this.CanvasKit.BlendMode, mode),
|
|
203
203
|
JsiSkImageFilter.fromValue(background),
|
|
204
204
|
inputFilter
|
|
205
205
|
);
|
|
@@ -3,7 +3,7 @@ import type { CanvasKit } from "canvaskit-wasm";
|
|
|
3
3
|
import type { BlurStyle } from "../types";
|
|
4
4
|
import type { MaskFilterFactory } from "../types/MaskFilter";
|
|
5
5
|
|
|
6
|
-
import { Host,
|
|
6
|
+
import { Host, getEnum } from "./Host";
|
|
7
7
|
import { JsiSkMaskFilter } from "./JsiSkMaskFilter";
|
|
8
8
|
|
|
9
9
|
export class JsiSkMaskFilterFactory extends Host implements MaskFilterFactory {
|
|
@@ -14,7 +14,11 @@ export class JsiSkMaskFilterFactory extends Host implements MaskFilterFactory {
|
|
|
14
14
|
MakeBlur(style: BlurStyle, sigma: number, respectCTM: boolean) {
|
|
15
15
|
return new JsiSkMaskFilter(
|
|
16
16
|
this.CanvasKit,
|
|
17
|
-
this.CanvasKit.MaskFilter.MakeBlur(
|
|
17
|
+
this.CanvasKit.MaskFilter.MakeBlur(
|
|
18
|
+
getEnum(this.CanvasKit.BlurStyle, style),
|
|
19
|
+
sigma,
|
|
20
|
+
respectCTM
|
|
21
|
+
)
|
|
18
22
|
);
|
|
19
23
|
}
|
|
20
24
|
}
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import type { CanvasKit, Matrix3x3 } from "canvaskit-wasm";
|
|
2
2
|
|
|
3
|
-
import type
|
|
3
|
+
import { toMatrix3, type Matrix3, type Matrix4, type SkMatrix } from "../types";
|
|
4
4
|
|
|
5
5
|
import { HostObject } from "./Host";
|
|
6
6
|
|
|
7
|
+
const isMatrixHostObject = (
|
|
8
|
+
obj: SkMatrix | number[] | Matrix4 | Matrix3
|
|
9
|
+
): obj is SkMatrix => !Array.isArray(obj);
|
|
10
|
+
|
|
7
11
|
export class JsiSkMatrix
|
|
8
12
|
extends HostObject<Matrix3x3, "Matrix">
|
|
9
13
|
implements SkMatrix
|
|
@@ -24,8 +28,15 @@ export class JsiSkMatrix
|
|
|
24
28
|
// Do nothing - the matrix is represenetd by a Float32Array
|
|
25
29
|
};
|
|
26
30
|
|
|
27
|
-
concat(matrix: SkMatrix) {
|
|
28
|
-
this.preMultiply(
|
|
31
|
+
concat(matrix: SkMatrix | number[] | Matrix4 | Matrix3) {
|
|
32
|
+
this.preMultiply(
|
|
33
|
+
// eslint-disable-next-line no-nested-ternary
|
|
34
|
+
isMatrixHostObject(matrix)
|
|
35
|
+
? JsiSkMatrix.fromValue(matrix)
|
|
36
|
+
: matrix.length === 16
|
|
37
|
+
? toMatrix3(matrix as Matrix4)
|
|
38
|
+
: [...matrix]
|
|
39
|
+
);
|
|
29
40
|
return this;
|
|
30
41
|
}
|
|
31
42
|
|
|
@@ -14,7 +14,7 @@ import type {
|
|
|
14
14
|
SkPathEffect,
|
|
15
15
|
} from "../types";
|
|
16
16
|
|
|
17
|
-
import { HostObject,
|
|
17
|
+
import { HostObject, getEnum } from "./Host";
|
|
18
18
|
import { JsiSkColorFilter } from "./JsiSkColorFilter";
|
|
19
19
|
import { JsiSkImageFilter } from "./JsiSkImageFilter";
|
|
20
20
|
import { JsiSkMaskFilter } from "./JsiSkMaskFilter";
|
|
@@ -75,7 +75,7 @@ export class JsiSkPaint extends HostObject<Paint, "Paint"> implements SkPaint {
|
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
setBlendMode(blendMode: BlendMode) {
|
|
78
|
-
this.ref.setBlendMode(
|
|
78
|
+
this.ref.setBlendMode(getEnum(this.CanvasKit.BlendMode, blendMode));
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
setColor(color: SkColor) {
|
|
@@ -103,11 +103,11 @@ export class JsiSkPaint extends HostObject<Paint, "Paint"> implements SkPaint {
|
|
|
103
103
|
}
|
|
104
104
|
|
|
105
105
|
setStrokeCap(cap: StrokeCap) {
|
|
106
|
-
this.ref.setStrokeCap(
|
|
106
|
+
this.ref.setStrokeCap(getEnum(this.CanvasKit.StrokeCap, cap));
|
|
107
107
|
}
|
|
108
108
|
|
|
109
109
|
setStrokeJoin(join: StrokeJoin) {
|
|
110
|
-
this.ref.setStrokeJoin(
|
|
110
|
+
this.ref.setStrokeJoin(getEnum(this.CanvasKit.StrokeJoin, join));
|
|
111
111
|
}
|
|
112
112
|
|
|
113
113
|
setStrokeMiter(limit: number) {
|
|
@@ -13,7 +13,7 @@ import type {
|
|
|
13
13
|
StrokeOpts,
|
|
14
14
|
} from "../types";
|
|
15
15
|
|
|
16
|
-
import {
|
|
16
|
+
import { getEnum, HostObject, optEnum } from "./Host";
|
|
17
17
|
import { JsiSkPoint } from "./JsiSkPoint";
|
|
18
18
|
import { JsiSkRect } from "./JsiSkRect";
|
|
19
19
|
import { JsiSkRRect } from "./JsiSkRRect";
|
|
@@ -149,7 +149,7 @@ export class JsiSkPath extends HostObject<Path, "Path"> implements SkPath {
|
|
|
149
149
|
}
|
|
150
150
|
|
|
151
151
|
setFillType(fill: FillType) {
|
|
152
|
-
this.ref.setFillType(
|
|
152
|
+
this.ref.setFillType(getEnum(this.CanvasKit.FillType, fill));
|
|
153
153
|
return this;
|
|
154
154
|
}
|
|
155
155
|
|
|
@@ -167,8 +167,8 @@ export class JsiSkPath extends HostObject<Path, "Path"> implements SkPath {
|
|
|
167
167
|
// eslint-disable-next-line camelcase
|
|
168
168
|
miter_limit: opts.width,
|
|
169
169
|
precision: opts.width,
|
|
170
|
-
join: optEnum(opts.join),
|
|
171
|
-
cap: optEnum(opts.cap),
|
|
170
|
+
join: optEnum(this.CanvasKit.StrokeJoin, opts.join),
|
|
171
|
+
cap: optEnum(this.CanvasKit.StrokeCap, opts.cap),
|
|
172
172
|
}
|
|
173
173
|
);
|
|
174
174
|
return result === null ? result : this;
|
|
@@ -315,7 +315,10 @@ export class JsiSkPath extends HostObject<Path, "Path"> implements SkPath {
|
|
|
315
315
|
}
|
|
316
316
|
|
|
317
317
|
op(path: SkPath, op: PathOp) {
|
|
318
|
-
return this.ref.op(
|
|
318
|
+
return this.ref.op(
|
|
319
|
+
JsiSkPath.fromValue(path),
|
|
320
|
+
getEnum(this.CanvasKit.PathOp, op)
|
|
321
|
+
);
|
|
319
322
|
}
|
|
320
323
|
|
|
321
324
|
simplify() {
|
|
@@ -337,7 +340,7 @@ export class JsiSkPath extends HostObject<Path, "Path"> implements SkPath {
|
|
|
337
340
|
}
|
|
338
341
|
|
|
339
342
|
transform(m3: SkMatrix) {
|
|
340
|
-
this.ref.transform(JsiSkMatrix.fromValue(m3));
|
|
343
|
+
this.ref.transform(Array.isArray(m3) ? m3 : JsiSkMatrix.fromValue(m3));
|
|
341
344
|
return this;
|
|
342
345
|
}
|
|
343
346
|
|
|
@@ -8,7 +8,7 @@ import type {
|
|
|
8
8
|
SkPathEffect,
|
|
9
9
|
} from "../types";
|
|
10
10
|
|
|
11
|
-
import {
|
|
11
|
+
import { getEnum, Host, NotImplementedOnRNWeb } from "./Host";
|
|
12
12
|
import { JsiSkMatrix } from "./JsiSkMatrix";
|
|
13
13
|
import { JsiSkPath } from "./JsiSkPath";
|
|
14
14
|
import { JsiSkPathEffect } from "./JsiSkPathEffect";
|
|
@@ -69,7 +69,7 @@ export class JsiSkPathEffectFactory extends Host implements PathEffectFactory {
|
|
|
69
69
|
JsiSkPath.fromValue(path),
|
|
70
70
|
advance,
|
|
71
71
|
phase,
|
|
72
|
-
|
|
72
|
+
getEnum(this.CanvasKit.Path1DEffect, style)
|
|
73
73
|
);
|
|
74
74
|
if (pe === null) {
|
|
75
75
|
return null;
|
|
@@ -3,7 +3,7 @@ import type { CanvasKit } from "canvaskit-wasm";
|
|
|
3
3
|
import type { PathCommand, PathOp, SkFont, SkPath } from "../types";
|
|
4
4
|
import type { PathFactory } from "../types/Path/PathFactory";
|
|
5
5
|
|
|
6
|
-
import { Host,
|
|
6
|
+
import { Host, getEnum, NotImplementedOnRNWeb } from "./Host";
|
|
7
7
|
import { JsiSkPath } from "./JsiSkPath";
|
|
8
8
|
|
|
9
9
|
export class JsiSkPathFactory extends Host implements PathFactory {
|
|
@@ -27,7 +27,7 @@ export class JsiSkPathFactory extends Host implements PathFactory {
|
|
|
27
27
|
const path = this.CanvasKit.Path.MakeFromOp(
|
|
28
28
|
JsiSkPath.fromValue(one),
|
|
29
29
|
JsiSkPath.fromValue(two),
|
|
30
|
-
|
|
30
|
+
getEnum(this.CanvasKit.PathOp, op)
|
|
31
31
|
);
|
|
32
32
|
if (path === null) {
|
|
33
33
|
return null;
|
|
@@ -9,7 +9,7 @@ import type {
|
|
|
9
9
|
SkMatrix,
|
|
10
10
|
} from "../types";
|
|
11
11
|
|
|
12
|
-
import { HostObject,
|
|
12
|
+
import { HostObject, getEnum } from "./Host";
|
|
13
13
|
import { JsiSkShader } from "./JsiSkShader";
|
|
14
14
|
import { JsiSkMatrix } from "./JsiSkMatrix";
|
|
15
15
|
import { JsiSkRect } from "./JsiSkRect";
|
|
@@ -36,9 +36,9 @@ export class JsiSkPicture
|
|
|
36
36
|
return new JsiSkShader(
|
|
37
37
|
this.CanvasKit,
|
|
38
38
|
this.ref.makeShader(
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
getEnum(this.CanvasKit.TileMode, tmx),
|
|
40
|
+
getEnum(this.CanvasKit.TileMode, tmy),
|
|
41
|
+
getEnum(this.CanvasKit.FilterMode, mode),
|
|
42
42
|
localMatrix ? JsiSkMatrix.fromValue(localMatrix) : undefined,
|
|
43
43
|
tileRect ? JsiSkRect.fromValue(this.CanvasKit, tileRect) : undefined
|
|
44
44
|
)
|
|
@@ -20,10 +20,14 @@ export class JsiSkPictureRecorder
|
|
|
20
20
|
this.ref.delete();
|
|
21
21
|
};
|
|
22
22
|
|
|
23
|
-
beginRecording(bounds
|
|
23
|
+
beginRecording(bounds?: SkRect) {
|
|
24
24
|
return new JsiSkCanvas(
|
|
25
25
|
this.CanvasKit,
|
|
26
|
-
this.ref.beginRecording(
|
|
26
|
+
this.ref.beginRecording(
|
|
27
|
+
bounds
|
|
28
|
+
? JsiSkRect.fromValue(this.CanvasKit, bounds)
|
|
29
|
+
: Float32Array.of(0, 0, 2_000_000, 2_000_000)
|
|
30
|
+
)
|
|
27
31
|
);
|
|
28
32
|
}
|
|
29
33
|
|
|
@@ -10,7 +10,7 @@ import type {
|
|
|
10
10
|
} from "../types";
|
|
11
11
|
import type { ShaderFactory } from "../types/Shader/ShaderFactory";
|
|
12
12
|
|
|
13
|
-
import { Host,
|
|
13
|
+
import { Host, getEnum } from "./Host";
|
|
14
14
|
import { JsiSkMatrix } from "./JsiSkMatrix";
|
|
15
15
|
import { JsiSkPoint } from "./JsiSkPoint";
|
|
16
16
|
import { JsiSkShader } from "./JsiSkShader";
|
|
@@ -36,7 +36,7 @@ export class JsiSkShaderFactory extends Host implements ShaderFactory {
|
|
|
36
36
|
JsiSkPoint.fromValue(end),
|
|
37
37
|
colors,
|
|
38
38
|
pos,
|
|
39
|
-
|
|
39
|
+
getEnum(this.CanvasKit.TileMode, mode),
|
|
40
40
|
localMatrix === undefined
|
|
41
41
|
? undefined
|
|
42
42
|
: JsiSkMatrix.fromValue(localMatrix),
|
|
@@ -61,7 +61,7 @@ export class JsiSkShaderFactory extends Host implements ShaderFactory {
|
|
|
61
61
|
radius,
|
|
62
62
|
colors,
|
|
63
63
|
pos,
|
|
64
|
-
|
|
64
|
+
getEnum(this.CanvasKit.TileMode, mode),
|
|
65
65
|
localMatrix === undefined
|
|
66
66
|
? undefined
|
|
67
67
|
: JsiSkMatrix.fromValue(localMatrix),
|
|
@@ -90,7 +90,7 @@ export class JsiSkShaderFactory extends Host implements ShaderFactory {
|
|
|
90
90
|
endRadius,
|
|
91
91
|
colors,
|
|
92
92
|
pos,
|
|
93
|
-
|
|
93
|
+
getEnum(this.CanvasKit.TileMode, mode),
|
|
94
94
|
localMatrix === undefined
|
|
95
95
|
? undefined
|
|
96
96
|
: JsiSkMatrix.fromValue(localMatrix),
|
|
@@ -117,7 +117,7 @@ export class JsiSkShaderFactory extends Host implements ShaderFactory {
|
|
|
117
117
|
cy,
|
|
118
118
|
colors,
|
|
119
119
|
pos,
|
|
120
|
-
|
|
120
|
+
getEnum(this.CanvasKit.TileMode, mode),
|
|
121
121
|
localMatrix === undefined || localMatrix === null
|
|
122
122
|
? undefined
|
|
123
123
|
: JsiSkMatrix.fromValue(localMatrix),
|
|
@@ -174,7 +174,7 @@ export class JsiSkShaderFactory extends Host implements ShaderFactory {
|
|
|
174
174
|
return new JsiSkShader(
|
|
175
175
|
this.CanvasKit,
|
|
176
176
|
this.CanvasKit.Shader.MakeBlend(
|
|
177
|
-
|
|
177
|
+
getEnum(this.CanvasKit.BlendMode, mode),
|
|
178
178
|
JsiSkShader.fromValue(one),
|
|
179
179
|
JsiSkShader.fromValue(two)
|
|
180
180
|
)
|
|
@@ -2,8 +2,8 @@ import type { CanvasKit } from "canvaskit-wasm";
|
|
|
2
2
|
|
|
3
3
|
import type { SkColor, SkPoint, VertexMode } from "../types";
|
|
4
4
|
|
|
5
|
-
import { ckEnum } from "./Host";
|
|
6
5
|
import { JsiSkVertices } from "./JsiSkVertices";
|
|
6
|
+
import { getEnum } from "./Host";
|
|
7
7
|
|
|
8
8
|
const concat = (...arrays: Float32Array[]) => {
|
|
9
9
|
let totalLength = 0;
|
|
@@ -31,7 +31,7 @@ export const MakeVertices = (
|
|
|
31
31
|
new JsiSkVertices(
|
|
32
32
|
CanvasKit,
|
|
33
33
|
CanvasKit.MakeVertices(
|
|
34
|
-
|
|
34
|
+
getEnum(CanvasKit.VertexMode, mode),
|
|
35
35
|
positions.map(({ x, y }) => [x, y]).flat(),
|
|
36
36
|
(textureCoordinates || []).map(({ x, y }) => [x, y]).flat(),
|
|
37
37
|
!colors ? null : colors.reduce((a, c) => concat(a, c)),
|
package/src/values/api.ts
CHANGED
|
@@ -1,8 +1,61 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type {
|
|
2
|
+
AnimationState,
|
|
3
|
+
ISkiaValueApi,
|
|
4
|
+
SkiaAnimation,
|
|
5
|
+
SkiaClockValue,
|
|
6
|
+
SkiaMutableValue,
|
|
7
|
+
SkiaValue,
|
|
8
|
+
} from "./types";
|
|
2
9
|
|
|
3
10
|
declare global {
|
|
4
11
|
var SkiaValueApi: ISkiaValueApi;
|
|
5
12
|
}
|
|
6
13
|
|
|
7
14
|
const { SkiaValueApi } = global;
|
|
8
|
-
|
|
15
|
+
|
|
16
|
+
const deprecatedWarning = () => {
|
|
17
|
+
console.warn(
|
|
18
|
+
`Skia values are deprecated and will be removed in the next Skia release.
|
|
19
|
+
Please use Reanimated instead: https://shopify.github.io/react-native-skia/docs/animations/animations`
|
|
20
|
+
);
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export const ValueApi = {
|
|
24
|
+
/**
|
|
25
|
+
* @deprecated Use Reanimated 3
|
|
26
|
+
* for animating Skia: https://shopify.github.io/react-native-skia/docs/animations/animations
|
|
27
|
+
*/
|
|
28
|
+
createValue<T>(initialValue: T): SkiaMutableValue<T> {
|
|
29
|
+
deprecatedWarning();
|
|
30
|
+
return SkiaValueApi.createValue(initialValue);
|
|
31
|
+
},
|
|
32
|
+
/**
|
|
33
|
+
* @deprecated Use Reanimated 3
|
|
34
|
+
* for animating Skia: https://shopify.github.io/react-native-skia/docs/animations/animations
|
|
35
|
+
*/
|
|
36
|
+
createComputedValue<R>(
|
|
37
|
+
cb: () => R,
|
|
38
|
+
values: SkiaValue<unknown>[]
|
|
39
|
+
): SkiaValue<R> {
|
|
40
|
+
deprecatedWarning();
|
|
41
|
+
return SkiaValueApi.createComputedValue(cb, values);
|
|
42
|
+
},
|
|
43
|
+
/**
|
|
44
|
+
* @deprecated Use Reanimated 3
|
|
45
|
+
* for animating Skia: https://shopify.github.io/react-native-skia/docs/animations/animations
|
|
46
|
+
*/
|
|
47
|
+
createClockValue(): SkiaClockValue {
|
|
48
|
+
deprecatedWarning();
|
|
49
|
+
return SkiaValueApi.createClockValue();
|
|
50
|
+
},
|
|
51
|
+
/**
|
|
52
|
+
* @deprecated Use Reanimated 3
|
|
53
|
+
* for animating Skia: https://shopify.github.io/react-native-skia/docs/animations/animations
|
|
54
|
+
*/
|
|
55
|
+
createAnimation<S extends AnimationState = AnimationState>(
|
|
56
|
+
cb: (t: number, state: S | undefined) => S
|
|
57
|
+
): SkiaAnimation {
|
|
58
|
+
deprecatedWarning();
|
|
59
|
+
return SkiaValueApi.createAnimation(cb);
|
|
60
|
+
},
|
|
61
|
+
};
|
|
@@ -3,6 +3,9 @@ import { useEffect, useMemo } from "react";
|
|
|
3
3
|
import { ValueApi } from "../api";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
+
* @deprecated Use Reanimated 3
|
|
7
|
+
* for animating Skia: https://shopify.github.io/react-native-skia/docs/animations/animations
|
|
8
|
+
*
|
|
6
9
|
* @returns A new value that will be updated on every frame redraw with the
|
|
7
10
|
* number of milliseconds elapsed since the value was started.
|
|
8
11
|
* The clock is created in the stopped state.
|