@shopify/react-native-skia 0.1.122 → 0.1.125
Sign up to get free protection for your applications and to get access to all the features.
- package/android/CMakeLists.txt +6 -1
- package/android/build.gradle +1 -1
- package/android/cpp/jni/JniSkiaDrawView.cpp +14 -71
- package/android/cpp/jni/JniSkiaManager.cpp +1 -1
- package/android/cpp/jni/include/JniSkiaDrawView.h +18 -22
- package/android/cpp/jni/include/JniSkiaManager.h +4 -4
- package/android/cpp/rnskia-android/RNSkDrawViewImpl.cpp +68 -0
- package/android/cpp/rnskia-android/RNSkDrawViewImpl.h +48 -0
- package/android/cpp/{jni/include/JniPlatformContextWrapper.h → rnskia-android/RNSkPlatformContextImpl.h} +4 -4
- package/android/cpp/{jni → rnskia-android}/SkiaOpenGLRenderer.cpp +39 -54
- package/android/cpp/{jni/include → rnskia-android}/SkiaOpenGLRenderer.h +2 -31
- package/android/src/main/java/com/shopify/reactnative/skia/RNSkiaViewManager.java +1 -1
- package/android/src/main/java/com/shopify/reactnative/skia/SkiaDrawView.java +21 -28
- package/cpp/api/JsiSkApi.h +3 -1
- package/cpp/api/JsiSkCanvas.h +1 -1
- package/cpp/api/JsiSkColor.h +41 -7
- package/cpp/api/JsiSkColorFilterFactory.h +2 -1
- package/cpp/api/JsiSkImageFilter.h +0 -2
- package/cpp/api/JsiSkImageFilterFactory.h +37 -17
- package/cpp/api/JsiSkMatrix.h +44 -2
- package/cpp/api/JsiSkPaint.h +4 -7
- package/cpp/api/JsiSkRuntimeEffect.h +7 -0
- package/cpp/api/JsiSkRuntimeEffectFactory.h +3 -2
- package/cpp/api/JsiSkRuntimeShaderBuilder.h +70 -0
- package/cpp/api/JsiSkShaderFactory.h +2 -2
- package/cpp/api/JsiSkVertices.h +1 -1
- package/cpp/api/third_party/CSSColorParser.cpp +194 -0
- package/cpp/api/third_party/CSSColorParser.h +1 -191
- package/cpp/jsi/JsiSimpleValueWrapper.h +98 -0
- package/cpp/rnskia/RNSkAnimation.h +0 -2
- package/cpp/rnskia/RNSkDrawView.cpp +84 -126
- package/cpp/rnskia/RNSkDrawView.h +7 -37
- package/cpp/rnskia/RNSkJsiViewApi.h +8 -5
- package/cpp/rnskia/RNSkManager.cpp +2 -2
- package/cpp/rnskia/RNSkManager.h +2 -2
- package/cpp/rnskia/RNSkPlatformContext.h +1 -1
- package/cpp/rnskia/RNSkValueApi.h +6 -2
- package/cpp/rnskia/values/RNSkClockValue.h +18 -10
- package/cpp/rnskia/values/RNSkDerivedValue.h +12 -5
- package/cpp/rnskia/values/RNSkReadonlyValue.h +25 -17
- package/cpp/rnskia/values/RNSkValue.h +8 -3
- package/cpp/utils/RNSkTimingInfo.h +13 -1
- package/ios/RNSkia-iOS/PlatformContext.h +30 -4
- package/ios/RNSkia-iOS/RNSkDrawViewImpl.h +8 -10
- package/ios/RNSkia-iOS/RNSkDrawViewImpl.mm +25 -10
- package/ios/RNSkia-iOS/SkiaDrawView.mm +22 -20
- package/lib/commonjs/{values/animation → animation}/decay/decay.js +0 -0
- package/lib/commonjs/{values/animation → animation}/decay/decay.js.map +0 -0
- package/lib/commonjs/{values/animation → animation}/decay/index.js +0 -0
- package/lib/commonjs/{values/animation → animation}/decay/index.js.map +0 -0
- package/lib/commonjs/{values/animation → animation}/decay/runDecay.js +1 -1
- package/lib/commonjs/animation/decay/runDecay.js.map +1 -0
- package/lib/commonjs/{values/animation → animation}/decay/types.js +0 -0
- package/lib/commonjs/{values/animation → animation}/decay/types.js.map +0 -0
- package/lib/commonjs/{values/animation → animation}/functions/index.js +0 -0
- package/lib/commonjs/{values/animation → animation}/functions/index.js.map +0 -0
- package/lib/commonjs/animation/functions/interpolate.js +141 -0
- package/lib/commonjs/animation/functions/interpolate.js.map +1 -0
- package/lib/commonjs/animation/functions/interpolateColors.js +39 -0
- package/lib/commonjs/animation/functions/interpolateColors.js.map +1 -0
- package/lib/commonjs/{values/animation → animation}/index.js +0 -0
- package/lib/commonjs/{values/animation → animation}/index.js.map +0 -0
- package/lib/commonjs/{values/animation → animation}/spring/Spring.js +0 -0
- package/lib/commonjs/{values/animation → animation}/spring/Spring.js.map +0 -0
- package/lib/commonjs/{values/animation → animation}/spring/functions/index.js +0 -0
- package/lib/commonjs/{values/animation → animation}/spring/functions/index.js.map +0 -0
- package/lib/commonjs/{values/animation → animation}/spring/functions/spring.js +0 -0
- package/lib/commonjs/{values/animation → animation}/spring/functions/spring.js.map +0 -0
- package/lib/commonjs/{values/animation → animation}/spring/index.js +0 -0
- package/lib/commonjs/{values/animation → animation}/spring/index.js.map +0 -0
- package/lib/commonjs/{values/animation → animation}/spring/runSpring.js +0 -0
- package/lib/commonjs/animation/spring/runSpring.js.map +1 -0
- package/lib/commonjs/{values/animation → animation}/spring/types.js +0 -0
- package/lib/commonjs/{values/animation → animation}/spring/types.js.map +0 -0
- package/lib/commonjs/{values/animation → animation}/spring/useSpring.js +0 -0
- package/lib/commonjs/animation/spring/useSpring.js.map +1 -0
- package/lib/commonjs/{values/animation → animation}/timing/Easing.js +0 -0
- package/lib/commonjs/{values/animation → animation}/timing/Easing.js.map +0 -0
- package/lib/commonjs/{values/animation → animation}/timing/createTiming.js +1 -1
- package/lib/commonjs/animation/timing/createTiming.js.map +1 -0
- package/lib/commonjs/{values/animation → animation}/timing/functions/bezier.js +0 -0
- package/lib/commonjs/{values/animation → animation}/timing/functions/bezier.js.map +0 -0
- package/lib/commonjs/{values/animation → animation}/timing/functions/getResolvedParams.js +3 -3
- package/lib/commonjs/animation/timing/functions/getResolvedParams.js.map +1 -0
- package/lib/commonjs/{values/animation → animation}/timing/functions/index.js +0 -0
- package/lib/commonjs/{values/animation → animation}/timing/functions/index.js.map +0 -0
- package/lib/commonjs/{values/animation → animation}/timing/functions/timing.js +0 -0
- package/lib/commonjs/{values/animation → animation}/timing/functions/timing.js.map +1 -1
- package/lib/commonjs/{values/animation → animation}/timing/functions/types.js +0 -0
- package/lib/commonjs/{values/animation → animation}/timing/functions/types.js.map +0 -0
- package/lib/commonjs/{values/animation → animation}/timing/index.js +0 -0
- package/lib/commonjs/{values/animation → animation}/timing/index.js.map +0 -0
- package/lib/commonjs/{values/animation → animation}/timing/runTiming.js +0 -0
- package/lib/commonjs/animation/timing/runTiming.js.map +1 -0
- package/lib/commonjs/{values/animation → animation}/timing/useLoop.js +0 -0
- package/lib/commonjs/{values/animation → animation}/timing/useLoop.js.map +0 -0
- package/lib/commonjs/{values/animation → animation}/timing/useTiming.js +1 -1
- package/lib/commonjs/animation/timing/useTiming.js.map +1 -0
- package/lib/commonjs/{values/animation → animation}/types.js +0 -0
- package/lib/commonjs/{values/animation → animation}/types.js.map +0 -0
- package/lib/commonjs/index.js +13 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/renderer/Canvas.js +17 -8
- package/lib/commonjs/renderer/Canvas.js.map +1 -1
- package/lib/commonjs/renderer/components/Paint.js +1 -1
- package/lib/commonjs/renderer/components/Paint.js.map +1 -1
- package/lib/commonjs/renderer/components/colorFilters/BlendColor.js.map +1 -1
- package/lib/commonjs/renderer/components/colorFilters/Lerp.js +1 -1
- package/lib/commonjs/renderer/components/colorFilters/Lerp.js.map +1 -1
- package/lib/commonjs/renderer/components/imageFilters/InnerShadow.js +4 -2
- package/lib/commonjs/renderer/components/imageFilters/InnerShadow.js.map +1 -1
- package/lib/commonjs/renderer/components/imageFilters/RuntimeShader.js +37 -0
- package/lib/commonjs/renderer/components/imageFilters/RuntimeShader.js.map +1 -0
- package/lib/commonjs/renderer/components/imageFilters/index.js +13 -0
- package/lib/commonjs/renderer/components/imageFilters/index.js.map +1 -1
- package/lib/commonjs/renderer/components/shaders/Gradient.js +1 -1
- package/lib/commonjs/renderer/components/shaders/Gradient.js.map +1 -1
- package/lib/commonjs/renderer/components/shaders/Shader.js +2 -2
- package/lib/commonjs/renderer/components/shaders/Shader.js.map +1 -1
- package/lib/commonjs/renderer/components/shapes/Path.js +9 -1
- package/lib/commonjs/renderer/components/shapes/Path.js.map +1 -1
- package/lib/commonjs/renderer/processors/Circles.js +3 -2
- package/lib/commonjs/renderer/processors/Circles.js.map +1 -1
- package/lib/commonjs/renderer/processors/Font.js +1 -1
- package/lib/commonjs/renderer/processors/Font.js.map +1 -1
- package/lib/commonjs/renderer/processors/Paint.js +6 -1
- package/lib/commonjs/renderer/processors/Paint.js.map +1 -1
- package/lib/commonjs/renderer/processors/Rects.js +11 -21
- package/lib/commonjs/renderer/processors/Rects.js.map +1 -1
- package/lib/commonjs/renderer/processors/math/Matrix3.js +42 -63
- package/lib/commonjs/renderer/processors/math/Matrix3.js.map +1 -1
- package/lib/commonjs/renderer/processors/math/Vector.js +4 -5
- package/lib/commonjs/renderer/processors/math/Vector.js.map +1 -1
- package/lib/commonjs/skia/Color.js +14 -38
- package/lib/commonjs/skia/Color.js.map +1 -1
- package/lib/commonjs/skia/ImageFilter/ImageFilterFactory.js.map +1 -1
- package/lib/commonjs/skia/Matrix.js.map +1 -1
- package/lib/commonjs/skia/Paint/Paint.js +13 -1
- package/lib/commonjs/skia/Paint/Paint.js.map +1 -1
- package/lib/commonjs/skia/Paint/usePaint.js +2 -4
- package/lib/commonjs/skia/Paint/usePaint.js.map +1 -1
- package/lib/commonjs/skia/Shader/useShader.js +4 -1
- package/lib/commonjs/skia/Shader/useShader.js.map +1 -1
- package/lib/commonjs/skia/Skia.js +3 -43
- package/lib/commonjs/skia/Skia.js.map +1 -1
- package/lib/commonjs/skia/SkiaApi.js +4 -0
- package/lib/commonjs/skia/SkiaApi.js.map +1 -0
- package/lib/commonjs/values/api.js +4 -6
- package/lib/commonjs/values/api.js.map +1 -1
- package/lib/commonjs/values/api.web.js +18 -0
- package/lib/commonjs/values/api.web.js.map +1 -0
- package/lib/commonjs/values/index.js +0 -13
- package/lib/commonjs/values/index.js.map +1 -1
- package/lib/commonjs/values/web/RNSkAnimation.js +46 -0
- package/lib/commonjs/values/web/RNSkAnimation.js.map +1 -0
- package/lib/commonjs/values/web/RNSkClockValue.js +75 -0
- package/lib/commonjs/values/web/RNSkClockValue.js.map +1 -0
- package/lib/commonjs/values/web/RNSkDerivedValue.js +51 -0
- package/lib/commonjs/values/web/RNSkDerivedValue.js.map +1 -0
- package/lib/commonjs/values/web/RNSkReadonlyValue.js +45 -0
- package/lib/commonjs/values/web/RNSkReadonlyValue.js.map +1 -0
- package/lib/commonjs/values/web/RNSkValue.js +73 -0
- package/lib/commonjs/values/web/RNSkValue.js.map +1 -0
- package/lib/commonjs/values/web/api.js +31 -0
- package/lib/commonjs/values/web/api.js.map +1 -0
- package/lib/commonjs/values/web/index.js +19 -0
- package/lib/commonjs/values/web/index.js.map +1 -0
- package/lib/commonjs/views/SkiaView.js +13 -10
- package/lib/commonjs/views/SkiaView.js.map +1 -1
- package/lib/commonjs/views/api.js +11 -0
- package/lib/commonjs/views/api.js.map +1 -0
- package/lib/commonjs/views/types.js.map +1 -1
- package/lib/module/{values/animation → animation}/decay/decay.js +0 -0
- package/lib/module/{values/animation → animation}/decay/decay.js.map +0 -0
- package/lib/module/{values/animation → animation}/decay/index.js +0 -0
- package/lib/module/{values/animation → animation}/decay/index.js.map +0 -0
- package/lib/module/{values/animation → animation}/decay/runDecay.js +1 -1
- package/lib/module/animation/decay/runDecay.js.map +1 -0
- package/lib/module/{values/animation → animation}/decay/types.js +0 -0
- package/lib/module/{values/animation → animation}/decay/types.js.map +0 -0
- package/lib/module/{values/animation → animation}/functions/index.js +0 -0
- package/lib/module/{values/animation → animation}/functions/index.js.map +0 -0
- package/lib/module/animation/functions/interpolate.js +132 -0
- package/lib/module/animation/functions/interpolate.js.map +1 -0
- package/lib/module/animation/functions/interpolateColors.js +23 -0
- package/lib/module/animation/functions/interpolateColors.js.map +1 -0
- package/lib/module/{values/animation → animation}/index.js +0 -0
- package/lib/module/{values/animation → animation}/index.js.map +0 -0
- package/lib/module/{values/animation → animation}/spring/Spring.js +0 -0
- package/lib/module/{values/animation → animation}/spring/Spring.js.map +0 -0
- package/lib/module/{values/animation → animation}/spring/functions/index.js +0 -0
- package/lib/module/{values/animation → animation}/spring/functions/index.js.map +0 -0
- package/lib/module/{values/animation → animation}/spring/functions/spring.js +0 -0
- package/lib/module/{values/animation → animation}/spring/functions/spring.js.map +0 -0
- package/lib/module/{values/animation → animation}/spring/index.js +0 -0
- package/lib/module/{values/animation → animation}/spring/index.js.map +0 -0
- package/lib/module/{values/animation → animation}/spring/runSpring.js +0 -0
- package/lib/module/animation/spring/runSpring.js.map +1 -0
- package/lib/module/{values/animation → animation}/spring/types.js +0 -0
- package/lib/module/{values/animation → animation}/spring/types.js.map +0 -0
- package/lib/module/{values/animation → animation}/spring/useSpring.js +0 -0
- package/lib/module/animation/spring/useSpring.js.map +1 -0
- package/lib/module/{values/animation → animation}/timing/Easing.js +0 -0
- package/lib/module/{values/animation → animation}/timing/Easing.js.map +0 -0
- package/lib/module/{values/animation → animation}/timing/createTiming.js +1 -1
- package/lib/module/animation/timing/createTiming.js.map +1 -0
- package/lib/module/{values/animation → animation}/timing/functions/bezier.js +0 -0
- package/lib/module/{values/animation → animation}/timing/functions/bezier.js.map +0 -0
- package/lib/module/{values/animation → animation}/timing/functions/getResolvedParams.js +3 -3
- package/lib/module/animation/timing/functions/getResolvedParams.js.map +1 -0
- package/lib/module/{values/animation → animation}/timing/functions/index.js +0 -0
- package/lib/module/{values/animation → animation}/timing/functions/index.js.map +0 -0
- package/lib/module/{values/animation → animation}/timing/functions/timing.js +0 -0
- package/lib/module/{values/animation → animation}/timing/functions/timing.js.map +1 -1
- package/lib/module/{values/animation → animation}/timing/functions/types.js +0 -0
- package/lib/module/{values/animation → animation}/timing/functions/types.js.map +0 -0
- package/lib/module/{values/animation → animation}/timing/index.js +0 -0
- package/lib/module/{values/animation → animation}/timing/index.js.map +0 -0
- package/lib/module/{values/animation → animation}/timing/runTiming.js +0 -0
- package/lib/module/animation/timing/runTiming.js.map +1 -0
- package/lib/module/{values/animation → animation}/timing/useLoop.js +0 -0
- package/lib/module/{values/animation → animation}/timing/useLoop.js.map +0 -0
- package/lib/module/{values/animation → animation}/timing/useTiming.js +1 -1
- package/lib/module/animation/timing/useTiming.js.map +1 -0
- package/lib/module/{values/animation → animation}/types.js +0 -0
- package/lib/module/{values/animation → animation}/types.js.map +0 -0
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/renderer/Canvas.js +12 -6
- package/lib/module/renderer/Canvas.js.map +1 -1
- package/lib/module/renderer/components/Paint.js +2 -2
- package/lib/module/renderer/components/Paint.js.map +1 -1
- package/lib/module/renderer/components/colorFilters/BlendColor.js.map +1 -1
- package/lib/module/renderer/components/colorFilters/Lerp.js +1 -1
- package/lib/module/renderer/components/colorFilters/Lerp.js.map +1 -1
- package/lib/module/renderer/components/imageFilters/InnerShadow.js +3 -2
- package/lib/module/renderer/components/imageFilters/InnerShadow.js.map +1 -1
- package/lib/module/renderer/components/imageFilters/RuntimeShader.js +19 -0
- package/lib/module/renderer/components/imageFilters/RuntimeShader.js.map +1 -0
- package/lib/module/renderer/components/imageFilters/index.js +1 -0
- package/lib/module/renderer/components/imageFilters/index.js.map +1 -1
- package/lib/module/renderer/components/shaders/Gradient.js +2 -2
- package/lib/module/renderer/components/shaders/Gradient.js.map +1 -1
- package/lib/module/renderer/components/shaders/Shader.js +3 -2
- package/lib/module/renderer/components/shaders/Shader.js.map +1 -1
- package/lib/module/renderer/components/shapes/Path.js +9 -2
- package/lib/module/renderer/components/shapes/Path.js.map +1 -1
- package/lib/module/renderer/processors/Circles.js +3 -2
- package/lib/module/renderer/processors/Circles.js.map +1 -1
- package/lib/module/renderer/processors/Font.js +1 -1
- package/lib/module/renderer/processors/Font.js.map +1 -1
- package/lib/module/renderer/processors/Paint.js +6 -1
- package/lib/module/renderer/processors/Paint.js.map +1 -1
- package/lib/module/renderer/processors/Rects.js +9 -21
- package/lib/module/renderer/processors/Rects.js.map +1 -1
- package/lib/module/renderer/processors/math/Matrix3.js +52 -72
- package/lib/module/renderer/processors/math/Matrix3.js.map +1 -1
- package/lib/module/renderer/processors/math/Vector.js +3 -5
- package/lib/module/renderer/processors/math/Vector.js.map +1 -1
- package/lib/module/skia/Color.js +9 -25
- package/lib/module/skia/Color.js.map +1 -1
- package/lib/module/skia/ImageFilter/ImageFilterFactory.js.map +1 -1
- package/lib/module/skia/Matrix.js.map +1 -1
- package/lib/module/skia/Paint/Paint.js +6 -0
- package/lib/module/skia/Paint/Paint.js.map +1 -1
- package/lib/module/skia/Paint/usePaint.js +2 -3
- package/lib/module/skia/Paint/usePaint.js.map +1 -1
- package/lib/module/skia/Shader/useShader.js +4 -1
- package/lib/module/skia/Shader/useShader.js.map +1 -1
- package/lib/module/skia/Skia.js +2 -44
- package/lib/module/skia/Skia.js.map +1 -1
- package/lib/module/skia/SkiaApi.js +2 -0
- package/lib/module/skia/SkiaApi.js.map +1 -0
- package/lib/module/values/api.js +4 -6
- package/lib/module/values/api.js.map +1 -1
- package/lib/module/values/api.web.js +7 -0
- package/lib/module/values/api.web.js.map +1 -0
- package/lib/module/values/index.js +0 -1
- package/lib/module/values/index.js.map +1 -1
- package/lib/module/values/web/RNSkAnimation.js +36 -0
- package/lib/module/values/web/RNSkAnimation.js.map +1 -0
- package/lib/module/values/web/RNSkClockValue.js +65 -0
- package/lib/module/values/web/RNSkClockValue.js.map +1 -0
- package/lib/module/values/web/RNSkDerivedValue.js +41 -0
- package/lib/module/values/web/RNSkDerivedValue.js.map +1 -0
- package/lib/module/values/web/RNSkReadonlyValue.js +36 -0
- package/lib/module/values/web/RNSkReadonlyValue.js.map +1 -0
- package/lib/module/values/web/RNSkValue.js +63 -0
- package/lib/module/values/web/RNSkValue.js.map +1 -0
- package/lib/module/values/web/api.js +19 -0
- package/lib/module/values/web/api.js.map +1 -0
- package/lib/module/values/web/index.js +2 -0
- package/lib/module/values/web/index.js.map +1 -0
- package/lib/module/views/SkiaView.js +1 -3
- package/lib/module/views/SkiaView.js.map +1 -1
- package/lib/module/views/api.js +4 -0
- package/lib/module/views/api.js.map +1 -0
- package/lib/module/views/types.js.map +1 -1
- package/lib/typescript/src/{values/animation → animation}/decay/decay.d.ts +0 -0
- package/lib/typescript/src/{values/animation → animation}/decay/index.d.ts +0 -0
- package/lib/typescript/src/{values/animation → animation}/decay/runDecay.d.ts +2 -2
- package/lib/typescript/src/{values/animation → animation}/decay/types.d.ts +1 -1
- package/lib/typescript/src/{values/animation → animation}/functions/index.d.ts +0 -0
- package/lib/typescript/src/animation/functions/interpolate.d.ts +11 -0
- package/lib/typescript/src/animation/functions/interpolateColors.d.ts +3 -0
- package/lib/typescript/src/{values/animation → animation}/index.d.ts +0 -0
- package/lib/typescript/src/{values/animation → animation}/spring/Spring.d.ts +0 -0
- package/lib/typescript/src/{values/animation → animation}/spring/functions/index.d.ts +0 -0
- package/lib/typescript/src/{values/animation → animation}/spring/functions/spring.d.ts +0 -0
- package/lib/typescript/src/{values/animation → animation}/spring/index.d.ts +0 -0
- package/lib/typescript/src/{values/animation → animation}/spring/runSpring.d.ts +1 -1
- package/lib/typescript/src/{values/animation → animation}/spring/types.d.ts +0 -0
- package/lib/typescript/src/{values/animation → animation}/spring/useSpring.d.ts +1 -1
- package/lib/typescript/src/{values/animation → animation}/timing/Easing.d.ts +0 -0
- package/lib/typescript/src/{values/animation → animation}/timing/createTiming.d.ts +2 -2
- package/lib/typescript/src/{values/animation → animation}/timing/functions/bezier.d.ts +0 -0
- package/lib/typescript/src/{values/animation → animation}/timing/functions/getResolvedParams.d.ts +0 -0
- package/lib/typescript/src/{values/animation → animation}/timing/functions/index.d.ts +0 -0
- package/lib/typescript/src/{values/animation → animation}/timing/functions/timing.d.ts +1 -1
- package/lib/typescript/src/{values/animation → animation}/timing/functions/types.d.ts +0 -0
- package/lib/typescript/src/{values/animation → animation}/timing/index.d.ts +0 -0
- package/lib/typescript/src/{values/animation → animation}/timing/runTiming.d.ts +1 -1
- package/lib/typescript/src/{values/animation → animation}/timing/useLoop.d.ts +0 -0
- package/lib/typescript/src/{values/animation → animation}/timing/useTiming.d.ts +1 -1
- package/lib/typescript/src/{values/animation → animation}/types.d.ts +5 -5
- package/lib/typescript/src/index.d.ts +1 -0
- package/lib/typescript/src/renderer/Canvas.d.ts +6 -0
- package/lib/typescript/src/renderer/components/colorFilters/BlendColor.d.ts +1 -1
- package/lib/typescript/src/renderer/components/imageFilters/RuntimeShader.d.ts +7 -0
- package/lib/typescript/src/renderer/components/imageFilters/index.d.ts +1 -0
- package/lib/typescript/src/renderer/components/shaders/Gradient.d.ts +1 -1
- package/lib/typescript/src/renderer/components/shaders/Shader.d.ts +2 -2
- package/lib/typescript/src/renderer/components/shapes/Circle.d.ts +1 -4
- package/lib/typescript/src/renderer/components/shapes/Path.d.ts +3 -1
- package/lib/typescript/src/renderer/processors/Paint.d.ts +2 -1
- package/lib/typescript/src/renderer/processors/Rects.d.ts +9 -41
- package/lib/typescript/src/renderer/processors/math/Matrix3.d.ts +1 -5
- package/lib/typescript/src/renderer/processors/math/Vector.d.ts +5 -17
- package/lib/typescript/src/skia/Color.d.ts +8 -9
- package/lib/typescript/src/skia/ImageFilter/ImageFilterFactory.d.ts +16 -0
- package/lib/typescript/src/skia/Matrix.d.ts +7 -1
- package/lib/typescript/src/skia/Paint/Paint.d.ts +1 -0
- package/lib/typescript/src/skia/RuntimeEffect/RuntimeEffect.d.ts +2 -1
- package/lib/typescript/src/skia/RuntimeEffect/RuntimeEffectFactory.d.ts +2 -2
- package/lib/typescript/src/skia/Shader/useShader.d.ts +1 -1
- package/lib/typescript/src/skia/Skia.d.ts +28 -95
- package/lib/typescript/src/skia/SkiaApi.d.ts +71 -0
- package/lib/typescript/src/skia/Surface/Surface.d.ts +1 -1
- package/lib/typescript/src/skia/Surface/SurfaceFactory.d.ts +2 -2
- package/lib/typescript/src/values/api.d.ts +2 -25
- package/lib/typescript/src/values/api.web.d.ts +2 -0
- package/lib/typescript/src/values/index.d.ts +0 -1
- package/lib/typescript/src/values/types.d.ts +24 -1
- package/lib/typescript/src/values/web/RNSkAnimation.d.ts +9 -0
- package/lib/typescript/src/values/web/RNSkClockValue.d.ts +13 -0
- package/lib/typescript/src/values/web/RNSkDerivedValue.d.ts +9 -0
- package/lib/typescript/src/values/web/RNSkReadonlyValue.d.ts +11 -0
- package/lib/typescript/src/values/web/RNSkValue.d.ts +14 -0
- package/lib/typescript/src/values/web/api.d.ts +2 -0
- package/lib/typescript/src/values/web/index.d.ts +1 -0
- package/lib/typescript/src/views/SkiaView.d.ts +3 -36
- package/lib/typescript/src/views/api.d.ts +5 -0
- package/lib/typescript/src/views/types.d.ts +32 -0
- package/package.json +2 -2
- package/src/{values/animation → animation}/decay/decay.ts +0 -0
- package/src/{values/animation → animation}/decay/index.ts +0 -0
- package/src/{values/animation → animation}/decay/runDecay.ts +2 -2
- package/src/{values/animation → animation}/decay/types.ts +1 -1
- package/src/{values/animation → animation}/functions/index.ts +0 -0
- package/src/animation/functions/interpolate.ts +182 -0
- package/src/animation/functions/interpolateColors.ts +58 -0
- package/src/{values/animation → animation}/index.ts +0 -0
- package/src/{values/animation → animation}/spring/Spring.ts +0 -0
- package/src/{values/animation → animation}/spring/functions/index.ts +0 -0
- package/src/{values/animation → animation}/spring/functions/spring.ts +0 -0
- package/src/{values/animation → animation}/spring/index.ts +0 -0
- package/src/{values/animation → animation}/spring/runSpring.ts +1 -1
- package/src/{values/animation → animation}/spring/types.ts +0 -0
- package/src/{values/animation → animation}/spring/useSpring.ts +1 -1
- package/src/{values/animation → animation}/timing/Easing.ts +0 -0
- package/src/{values/animation → animation}/timing/createTiming.ts +2 -2
- package/src/{values/animation → animation}/timing/functions/__tests__/timing.spec.ts +0 -0
- package/src/{values/animation → animation}/timing/functions/bezier.ts +0 -0
- package/src/{values/animation → animation}/timing/functions/getResolvedParams.ts +2 -2
- package/src/{values/animation → animation}/timing/functions/index.ts +0 -0
- package/src/{values/animation → animation}/timing/functions/timing.ts +1 -1
- package/src/{values/animation → animation}/timing/functions/types.ts +0 -0
- package/src/{values/animation → animation}/timing/index.ts +0 -0
- package/src/{values/animation → animation}/timing/runTiming.ts +1 -1
- package/src/{values/animation → animation}/timing/useLoop.ts +0 -0
- package/src/{values/animation → animation}/timing/useTiming.ts +2 -2
- package/src/{values/animation → animation}/types.ts +5 -5
- package/src/index.ts +1 -0
- package/src/renderer/Canvas.tsx +13 -6
- package/src/renderer/components/Paint.tsx +2 -2
- package/src/renderer/components/colorFilters/BlendColor.tsx +1 -1
- package/src/renderer/components/colorFilters/Lerp.tsx +1 -1
- package/src/renderer/components/imageFilters/InnerShadow.tsx +4 -2
- package/src/renderer/components/imageFilters/RuntimeShader.tsx +23 -0
- package/src/renderer/components/imageFilters/index.ts +1 -0
- package/src/renderer/components/shaders/Gradient.ts +2 -4
- package/src/renderer/components/shaders/Shader.tsx +3 -3
- package/src/renderer/components/shapes/Path.tsx +11 -3
- package/src/renderer/processors/Circles.ts +2 -1
- package/src/renderer/processors/Font.ts +1 -1
- package/src/renderer/processors/Paint.ts +5 -0
- package/src/renderer/processors/Rects.ts +9 -14
- package/src/renderer/processors/math/Matrix3.ts +24 -105
- package/src/renderer/processors/math/Vector.ts +3 -2
- package/src/skia/Color.ts +13 -27
- package/src/skia/ImageFilter/ImageFilterFactory.ts +20 -0
- package/src/skia/Matrix.ts +8 -1
- package/src/skia/Paint/Paint.ts +7 -0
- package/src/skia/Paint/usePaint.ts +2 -4
- package/src/skia/RuntimeEffect/RuntimeEffect.ts +3 -1
- package/src/skia/RuntimeEffect/RuntimeEffectFactory.ts +2 -2
- package/src/skia/Shader/useShader.ts +4 -1
- package/src/skia/Skia.ts +4 -123
- package/src/skia/SkiaApi.ts +86 -0
- package/src/skia/Surface/Surface.ts +1 -1
- package/src/skia/Surface/SurfaceFactory.ts +2 -2
- package/src/values/api.ts +3 -42
- package/src/values/api.web.ts +5 -0
- package/src/values/index.ts +0 -1
- package/src/values/types.ts +30 -1
- package/src/values/web/RNSkAnimation.ts +33 -0
- package/src/values/web/RNSkClockValue.ts +58 -0
- package/src/values/web/RNSkDerivedValue.ts +38 -0
- package/src/values/web/RNSkReadonlyValue.ts +32 -0
- package/src/values/web/RNSkValue.ts +57 -0
- package/src/values/web/__tests__/RNSkAnimation.spec.ts +21 -0
- package/src/values/web/__tests__/RNSkDerivedValue.spec.ts +15 -0
- package/src/values/web/__tests__/RNSkReadonlyValue.spec.ts +8 -0
- package/src/values/web/__tests__/RNSkValue.spec.ts +11 -0
- package/src/values/web/api.ts +33 -0
- package/src/values/web/index.ts +1 -0
- package/src/views/SkiaView.tsx +3 -49
- package/src/views/api.ts +7 -0
- package/src/views/types.ts +40 -0
- package/lib/commonjs/values/animation/decay/runDecay.js.map +0 -1
- package/lib/commonjs/values/animation/functions/interpolate.js +0 -139
- package/lib/commonjs/values/animation/functions/interpolate.js.map +0 -1
- package/lib/commonjs/values/animation/functions/interpolateColors.js +0 -47
- package/lib/commonjs/values/animation/functions/interpolateColors.js.map +0 -1
- package/lib/commonjs/values/animation/spring/runSpring.js.map +0 -1
- package/lib/commonjs/values/animation/spring/useSpring.js.map +0 -1
- package/lib/commonjs/values/animation/timing/createTiming.js.map +0 -1
- package/lib/commonjs/values/animation/timing/functions/getResolvedParams.js.map +0 -1
- package/lib/commonjs/values/animation/timing/runTiming.js.map +0 -1
- package/lib/commonjs/values/animation/timing/useTiming.js.map +0 -1
- package/lib/module/values/animation/decay/runDecay.js.map +0 -1
- package/lib/module/values/animation/functions/interpolate.js +0 -132
- package/lib/module/values/animation/functions/interpolate.js.map +0 -1
- package/lib/module/values/animation/functions/interpolateColors.js +0 -32
- package/lib/module/values/animation/functions/interpolateColors.js.map +0 -1
- package/lib/module/values/animation/spring/runSpring.js.map +0 -1
- package/lib/module/values/animation/spring/useSpring.js.map +0 -1
- package/lib/module/values/animation/timing/createTiming.js.map +0 -1
- package/lib/module/values/animation/timing/functions/getResolvedParams.js.map +0 -1
- package/lib/module/values/animation/timing/runTiming.js.map +0 -1
- package/lib/module/values/animation/timing/useTiming.js.map +0 -1
- package/lib/typescript/scripts/install-npm.d.ts +0 -1
- package/lib/typescript/src/values/animation/functions/interpolate.d.ts +0 -7
- package/lib/typescript/src/values/animation/functions/interpolateColors.d.ts +0 -3
- package/src/values/animation/functions/interpolate.ts +0 -169
- package/src/values/animation/functions/interpolateColors.ts +0 -62
@@ -18,10 +18,11 @@ public class SkiaDrawView extends TextureView implements TextureView.SurfaceText
|
|
18
18
|
@DoNotStrip
|
19
19
|
private HybridData mHybridData;
|
20
20
|
|
21
|
-
|
21
|
+
@DoNotStrip
|
22
|
+
private boolean mViewRemoved;
|
22
23
|
|
23
24
|
@DoNotStrip
|
24
|
-
private
|
25
|
+
private Surface mSurface;
|
25
26
|
|
26
27
|
public SkiaDrawView(Context ctx) {
|
27
28
|
super(ctx);
|
@@ -36,26 +37,25 @@ public class SkiaDrawView extends TextureView implements TextureView.SurfaceText
|
|
36
37
|
// Texture view does not support setting the background color.
|
37
38
|
}
|
38
39
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
40
|
+
public void releaseSurface() {
|
41
|
+
if(mSurface != null) {
|
42
|
+
mSurface.release();
|
43
|
+
mSurface = null;
|
44
|
+
}
|
45
|
+
// We can only reset the native side when the view was removed from screen.
|
46
|
+
// releasing the surface can also be done when the view is hidden and then
|
47
|
+
// we should only release the surface - and keep the native part around.
|
48
|
+
if(mViewRemoved) {
|
49
|
+
mHybridData.resetNative();
|
50
|
+
}
|
43
51
|
}
|
44
52
|
|
45
|
-
|
46
|
-
|
47
|
-
// We'll mark the view removed since we reset the native part.
|
48
|
-
// This means that none of the native methods should be called after
|
49
|
-
// this point.
|
50
|
-
mIsRemoved = true;
|
51
|
-
mHybridData.resetNative();
|
53
|
+
void onViewRemoved() {
|
54
|
+
mViewRemoved = true;
|
52
55
|
}
|
53
56
|
|
54
57
|
@Override
|
55
58
|
public boolean onTouchEvent(MotionEvent ev) {
|
56
|
-
if(mIsRemoved) {
|
57
|
-
return false;
|
58
|
-
}
|
59
59
|
int action = ev.getAction();
|
60
60
|
int count = ev.getPointerCount();
|
61
61
|
MotionEvent.PointerCoords r = new MotionEvent.PointerCoords();
|
@@ -88,30 +88,23 @@ public class SkiaDrawView extends TextureView implements TextureView.SurfaceText
|
|
88
88
|
|
89
89
|
@Override
|
90
90
|
public void onSurfaceTextureAvailable(SurfaceTexture surface, int width, int height) {
|
91
|
-
if(mIsRemoved) {
|
92
|
-
return;
|
93
|
-
}
|
94
91
|
mSurface = new Surface(surface);
|
95
92
|
surfaceAvailable(mSurface, width, height);
|
96
93
|
}
|
97
94
|
|
98
95
|
@Override
|
99
96
|
public void onSurfaceTextureSizeChanged(SurfaceTexture surface, int width, int height) {
|
100
|
-
if(mIsRemoved) {
|
101
|
-
return;
|
102
|
-
}
|
103
97
|
surfaceSizeChanged(width, height);
|
104
98
|
}
|
105
99
|
|
106
100
|
@Override
|
107
101
|
public boolean onSurfaceTextureDestroyed(SurfaceTexture surface) {
|
108
|
-
if(mIsRemoved) {
|
109
|
-
return true;
|
110
|
-
}
|
111
102
|
surfaceDestroyed();
|
112
|
-
|
113
|
-
|
114
|
-
|
103
|
+
// https://developer.android.com/reference/android/view/TextureView.SurfaceTextureListener#onSurfaceTextureDestroyed(android.graphics.SurfaceTexture)
|
104
|
+
// Invoked when the specified SurfaceTexture is about to be destroyed. If returns true,
|
105
|
+
// no rendering should happen inside the surface texture after this method is invoked.
|
106
|
+
// If returns false, the client needs to call SurfaceTexture#release().
|
107
|
+
return false;
|
115
108
|
}
|
116
109
|
|
117
110
|
@Override
|
package/cpp/api/JsiSkApi.h
CHANGED
@@ -39,6 +39,7 @@
|
|
39
39
|
#include "JsiSkContourMeasureIter.h"
|
40
40
|
#include "JsiSkPictureRecorder.h"
|
41
41
|
#include "JsiSkPictureFactory.h"
|
42
|
+
#include "JsiSkRuntimeShaderBuilder.h"
|
42
43
|
#include "JsiSkColor.h"
|
43
44
|
|
44
45
|
namespace RNSkia
|
@@ -65,10 +66,11 @@ namespace RNSkia
|
|
65
66
|
installFunction("XYWHRect", JsiSkRect::createCtor(context));
|
66
67
|
installFunction("RRectXY", JsiSkRRect::createCtor(context));
|
67
68
|
installFunction("Point", JsiSkPoint::createCtor(context));
|
69
|
+
installFunction("RuntimeShaderBuilder", JsiSkRuntimeShaderBuilder::createCtor(context));
|
68
70
|
installFunction("ContourMeasureIter", JsiSkContourMeasureIter::createCtor(context));
|
69
71
|
installFunction("MakeVertices", JsiSkVertices::createCtor(context));
|
70
72
|
installFunction("PictureRecorder", JsiSkPictureRecorder::createCtor(context));
|
71
|
-
installFunction("
|
73
|
+
installFunction("Color", JsiSkColor::createCtor());
|
72
74
|
|
73
75
|
// Static members
|
74
76
|
installReadonlyProperty("FontMgr",
|
package/cpp/api/JsiSkCanvas.h
CHANGED
@@ -278,7 +278,7 @@ public:
|
|
278
278
|
auto colorsSize = jsiColors.size(runtime);
|
279
279
|
colors.reserve(colorsSize);
|
280
280
|
for (int i = 0; i < colorsSize; i++) {
|
281
|
-
SkColor color = jsiColors.getValueAtIndex(runtime, i)
|
281
|
+
SkColor color = JsiSkColor::fromValue(runtime, jsiColors.getValueAtIndex(runtime, i));
|
282
282
|
colors.push_back(color);
|
283
283
|
}
|
284
284
|
}
|
package/cpp/api/JsiSkColor.h
CHANGED
@@ -26,6 +26,35 @@ namespace RNSkia {
|
|
26
26
|
|
27
27
|
~JsiSkColor() {}
|
28
28
|
|
29
|
+
static jsi::Object toValue(jsi::Runtime &runtime, SkColor color) {
|
30
|
+
auto result = runtime
|
31
|
+
.global()
|
32
|
+
.getPropertyAsFunction(runtime, "Float32Array")
|
33
|
+
.callAsConstructor(runtime, 4)
|
34
|
+
.getObject(runtime);
|
35
|
+
jsi::ArrayBuffer buffer = result
|
36
|
+
.getProperty(runtime, jsi::PropNameID::forAscii(runtime, "buffer"))
|
37
|
+
.asObject(runtime)
|
38
|
+
.getArrayBuffer(runtime);
|
39
|
+
auto bfrPtr = reinterpret_cast<float *>(buffer.data(runtime));
|
40
|
+
auto color4f = SkColor4f::FromColor(color).array();
|
41
|
+
std::copy(color4f.begin(), color4f.end(), bfrPtr);
|
42
|
+
return result;
|
43
|
+
}
|
44
|
+
|
45
|
+
static SkColor fromValue(jsi::Runtime &runtime, const jsi::Value &obj) {
|
46
|
+
const auto& object = obj.asObject(runtime);
|
47
|
+
jsi::ArrayBuffer buffer = object
|
48
|
+
.getProperty(runtime, jsi::PropNameID::forAscii(runtime, "buffer"))
|
49
|
+
.asObject(runtime)
|
50
|
+
.getArrayBuffer(runtime);
|
51
|
+
auto bfrPtr = reinterpret_cast<float *>(buffer.data(runtime));
|
52
|
+
if (bfrPtr[0] > 1 || bfrPtr[1] > 1 || bfrPtr[2] > 1 || bfrPtr[3] > 1) {
|
53
|
+
return SK_ColorBLACK;
|
54
|
+
}
|
55
|
+
return SkColorSetARGB(bfrPtr[3] * 255, bfrPtr[0] * 255, bfrPtr[1] * 255, bfrPtr[2] * 255);
|
56
|
+
}
|
57
|
+
|
29
58
|
/**
|
30
59
|
* Creates the function for construction a new instance of the SkColor
|
31
60
|
* wrapper
|
@@ -35,14 +64,19 @@ namespace RNSkia {
|
|
35
64
|
static const jsi::HostFunctionType
|
36
65
|
createCtor() {
|
37
66
|
return JSI_HOST_FUNCTION_LAMBDA {
|
38
|
-
|
39
|
-
|
40
|
-
if
|
41
|
-
|
67
|
+
if (arguments[0].isNumber()) {
|
68
|
+
return JsiSkColor::toValue(runtime, arguments[0].getNumber());
|
69
|
+
} else if(arguments[0].isString()) {
|
70
|
+
auto text = arguments[0].asString(runtime).utf8(runtime);
|
71
|
+
auto color = CSSColorParser::parse(text);
|
72
|
+
if (color.a == -1.0f) {
|
73
|
+
return JsiSkColor::toValue(runtime, SK_ColorBLACK);
|
74
|
+
}
|
75
|
+
return JsiSkColor::toValue(runtime, SkColorSetARGB(color.a * 255, color.r, color.g, color.b));
|
76
|
+
} else if (arguments[0].isObject()) {
|
77
|
+
return arguments[0].getObject(runtime);
|
42
78
|
}
|
43
|
-
|
44
|
-
// Because JS numbers are unsigned we need to do this conversion
|
45
|
-
return jsi::Value(static_cast<double>(SkColorSetARGB(a, color.r, color.g, color.b) >> 0));
|
79
|
+
return jsi::Value::undefined();
|
46
80
|
};
|
47
81
|
}
|
48
82
|
};
|
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
#include "JsiSkColorFilter.h"
|
4
4
|
#include "JsiSkHostObjects.h"
|
5
|
+
#include "JsiSkColor.h"
|
5
6
|
#include <jsi/jsi.h>
|
6
7
|
#include <utility>
|
7
8
|
|
@@ -34,7 +35,7 @@ public:
|
|
34
35
|
}
|
35
36
|
|
36
37
|
JSI_HOST_FUNCTION(MakeBlend) {
|
37
|
-
auto color = arguments[0]
|
38
|
+
auto color = JsiSkColor::fromValue(runtime, arguments[0]);
|
38
39
|
SkBlendMode blend = (SkBlendMode)arguments[1].asNumber();
|
39
40
|
// Return the newly constructed object
|
40
41
|
return jsi::Object::createFromHostObject(
|
@@ -5,13 +5,11 @@
|
|
5
5
|
|
6
6
|
#include <jsi/jsi.h>
|
7
7
|
|
8
|
-
#include "JsiSkColorFilter.h"
|
9
8
|
#include "JsiSkHostObjects.h"
|
10
9
|
|
11
10
|
#pragma clang diagnostic push
|
12
11
|
#pragma clang diagnostic ignored "-Wdocumentation"
|
13
12
|
|
14
|
-
#include <SkColorFilter.h>
|
15
13
|
#include <SkImageFilters.h>
|
16
14
|
|
17
15
|
#pragma clang diagnostic pop
|
@@ -7,11 +7,12 @@
|
|
7
7
|
|
8
8
|
#include "JsiSkHostObjects.h"
|
9
9
|
#include "JsiSkImageFilter.h"
|
10
|
+
#include "JsiSkRuntimeShaderBuilder.h"
|
10
11
|
|
11
12
|
#pragma clang diagnostic push
|
12
13
|
#pragma clang diagnostic ignored "-Wdocumentation"
|
13
14
|
|
14
|
-
#include <
|
15
|
+
#include <SkImageFilter.h>
|
15
16
|
|
16
17
|
#pragma clang diagnostic pop
|
17
18
|
|
@@ -123,7 +124,7 @@ public:
|
|
123
124
|
auto dy = arguments[1].asNumber();
|
124
125
|
auto sigmaX = arguments[2].asNumber();
|
125
126
|
auto sigmaY = arguments[3].asNumber();
|
126
|
-
auto color = arguments[4]
|
127
|
+
auto color = JsiSkColor::fromValue(runtime, arguments[4]);
|
127
128
|
sk_sp<SkImageFilter> input;
|
128
129
|
if (!arguments[5].isNull() && !arguments[5].isUndefined()) {
|
129
130
|
input = JsiSkImageFilter::fromValue(runtime, arguments[5]);
|
@@ -144,7 +145,7 @@ public:
|
|
144
145
|
auto dy = arguments[1].asNumber();
|
145
146
|
auto sigmaX = arguments[2].asNumber();
|
146
147
|
auto sigmaY = arguments[3].asNumber();
|
147
|
-
auto color = arguments[4]
|
148
|
+
auto color = JsiSkColor::fromValue(runtime, arguments[4]);
|
148
149
|
sk_sp<SkImageFilter> input;
|
149
150
|
if (!arguments[5].isNull() && !arguments[5].isUndefined()) {
|
150
151
|
input = JsiSkImageFilter::fromValue(runtime, arguments[5]);
|
@@ -195,20 +196,39 @@ public:
|
|
195
196
|
getContext(), SkImageFilters::Dilate(rx, ry, std::move(input), cropRect)));
|
196
197
|
}
|
197
198
|
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
199
|
+
JSI_HOST_FUNCTION(MakeRuntimeShader) {
|
200
|
+
auto rtb = JsiSkRuntimeShaderBuilder::fromValue(runtime, arguments[0]);
|
201
|
+
|
202
|
+
const char* childName = nullptr;
|
203
|
+
if (!arguments[1].isNull() && !arguments[1].isUndefined()) {
|
204
|
+
childName = arguments[1].asString(runtime).utf8(runtime).c_str();
|
205
|
+
}
|
206
|
+
|
207
|
+
sk_sp<SkImageFilter> input;
|
208
|
+
if (!arguments[2].isNull() && !arguments[2].isUndefined()) {
|
209
|
+
input = JsiSkImageFilter::fromValue(runtime, arguments[2]);
|
210
|
+
}
|
211
|
+
return jsi::Object::createFromHostObject(
|
212
|
+
runtime,
|
213
|
+
std::make_shared<JsiSkImageFilter>(
|
214
|
+
getContext(), SkImageFilters::RuntimeShader(*rtb, childName, std::move(input)))
|
215
|
+
);
|
216
|
+
}
|
217
|
+
|
218
|
+
JSI_EXPORT_FUNCTIONS(
|
219
|
+
JSI_EXPORT_FUNC(JsiSkImageFilterFactory, MakeBlur),
|
220
|
+
JSI_EXPORT_FUNC(JsiSkImageFilterFactory, MakeOffset),
|
221
|
+
JSI_EXPORT_FUNC(JsiSkImageFilterFactory, MakeColorFilter),
|
222
|
+
JSI_EXPORT_FUNC(JsiSkImageFilterFactory, MakeShader),
|
223
|
+
JSI_EXPORT_FUNC(JsiSkImageFilterFactory, MakeDisplacementMap),
|
224
|
+
JSI_EXPORT_FUNC(JsiSkImageFilterFactory, MakeCompose),
|
225
|
+
JSI_EXPORT_FUNC(JsiSkImageFilterFactory, MakeErode),
|
226
|
+
JSI_EXPORT_FUNC(JsiSkImageFilterFactory, MakeDilate),
|
227
|
+
JSI_EXPORT_FUNC(JsiSkImageFilterFactory, MakeBlend),
|
228
|
+
JSI_EXPORT_FUNC(JsiSkImageFilterFactory, MakeDropShadow),
|
229
|
+
JSI_EXPORT_FUNC(JsiSkImageFilterFactory, MakeDropShadowOnly),
|
230
|
+
JSI_EXPORT_FUNC(JsiSkImageFilterFactory, MakeRuntimeShader)
|
231
|
+
)
|
212
232
|
|
213
233
|
JsiSkImageFilterFactory(std::shared_ptr<RNSkPlatformContext> context)
|
214
234
|
: JsiSkHostObject(std::move(context)) {}
|
package/cpp/api/JsiSkMatrix.h
CHANGED
@@ -25,9 +25,51 @@ public:
|
|
25
25
|
: JsiSkWrappingSharedPtrHostObject<SkMatrix>(
|
26
26
|
context, std::make_shared<SkMatrix>(std::move(m))) {}
|
27
27
|
|
28
|
+
|
29
|
+
JSI_HOST_FUNCTION(preConcat) {
|
30
|
+
auto m3 = JsiSkMatrix::fromValue(runtime, arguments[0]);
|
31
|
+
getObject()->preConcat(*m3);
|
32
|
+
return jsi::Value::undefined();
|
33
|
+
}
|
34
|
+
|
35
|
+
JSI_HOST_FUNCTION(preTranslate) {
|
36
|
+
auto x = arguments[0].asNumber();
|
37
|
+
auto y = arguments[1].asNumber();
|
38
|
+
getObject()->preTranslate(x, y);
|
39
|
+
return jsi::Value::undefined();
|
40
|
+
}
|
41
|
+
|
42
|
+
JSI_HOST_FUNCTION(preScale) {
|
43
|
+
auto x = arguments[0].asNumber();
|
44
|
+
auto y = arguments[1].asNumber();
|
45
|
+
getObject()->preScale(x, y);
|
46
|
+
return jsi::Value::undefined();
|
47
|
+
}
|
48
|
+
|
49
|
+
JSI_HOST_FUNCTION(preSkew) {
|
50
|
+
auto x = arguments[0].asNumber();
|
51
|
+
auto y = arguments[1].asNumber();
|
52
|
+
getObject()->preSkew(x, y);
|
53
|
+
return jsi::Value::undefined();
|
54
|
+
}
|
55
|
+
|
56
|
+
JSI_HOST_FUNCTION(preRotate) {
|
57
|
+
auto a = arguments[0].asNumber();
|
58
|
+
getObject()->preRotate(a);
|
59
|
+
return jsi::Value::undefined();
|
60
|
+
}
|
61
|
+
|
62
|
+
JSI_EXPORT_FUNCTIONS(
|
63
|
+
JSI_EXPORT_FUNC(JsiSkMatrix, preConcat),
|
64
|
+
JSI_EXPORT_FUNC(JsiSkMatrix, preTranslate),
|
65
|
+
JSI_EXPORT_FUNC(JsiSkMatrix, preScale),
|
66
|
+
JSI_EXPORT_FUNC(JsiSkMatrix, preSkew),
|
67
|
+
JSI_EXPORT_FUNC(JsiSkMatrix, preRotate),
|
68
|
+
)
|
69
|
+
|
28
70
|
/**
|
29
|
-
Returns the underlying object from a host object of this type
|
30
|
-
*/
|
71
|
+
* Returns the underlying object from a host object of this type
|
72
|
+
*/
|
31
73
|
static std::shared_ptr<SkMatrix> fromValue(jsi::Runtime &runtime,
|
32
74
|
const jsi::Value &obj) {
|
33
75
|
const auto& object = obj.asObject(runtime);
|
package/cpp/api/JsiSkPaint.h
CHANGED
@@ -8,8 +8,10 @@
|
|
8
8
|
#include <JsiSkHostObjects.h>
|
9
9
|
#include <JsiSkImageFilter.h>
|
10
10
|
#include <JsiSkMaskFilter.h>
|
11
|
+
#include <JsiSkColorFilter.h>
|
11
12
|
#include <JsiSkPathEffect.h>
|
12
13
|
#include <JsiSkShader.h>
|
14
|
+
#include <JsiSkColor.h>
|
13
15
|
|
14
16
|
#pragma clang diagnostic push
|
15
17
|
#pragma clang diagnostic ignored "-Wdocumentation"
|
@@ -38,7 +40,7 @@ public:
|
|
38
40
|
}
|
39
41
|
|
40
42
|
JSI_HOST_FUNCTION(getColor) {
|
41
|
-
return
|
43
|
+
return JsiSkColor::toValue(runtime, getObject()->getColor());
|
42
44
|
}
|
43
45
|
|
44
46
|
JSI_HOST_FUNCTION(getStrokeCap) {
|
@@ -58,7 +60,7 @@ public:
|
|
58
60
|
}
|
59
61
|
|
60
62
|
JSI_HOST_FUNCTION(setColor) {
|
61
|
-
SkColor color = arguments[0]
|
63
|
+
SkColor color = JsiSkColor::fromValue(runtime, arguments[0]);
|
62
64
|
getObject()->setColor(color);
|
63
65
|
return jsi::Value::undefined();
|
64
66
|
}
|
@@ -90,11 +92,6 @@ public:
|
|
90
92
|
case 1:
|
91
93
|
getObject()->setStyle(SkPaint::kStroke_Style);
|
92
94
|
break;
|
93
|
-
// This API is expected to be deprecated
|
94
|
-
// https://github.com/flutter/flutter/issues/5912
|
95
|
-
// case 2:
|
96
|
-
// getObject()->setStyle(SkPaint::kStrokeAndFill_Style);
|
97
|
-
// break;
|
98
95
|
}
|
99
96
|
return jsi::Value::undefined();
|
100
97
|
}
|
@@ -35,6 +35,12 @@ namespace RNSkia
|
|
35
35
|
: public JsiSkWrappingSkPtrHostObject<SkRuntimeEffect>
|
36
36
|
{
|
37
37
|
public:
|
38
|
+
|
39
|
+
static sk_sp<SkRuntimeEffect> fromValue(jsi::Runtime &runtime, const jsi::Value &obj) {
|
40
|
+
const auto& object = obj.asObject(runtime);
|
41
|
+
return object.asHostObject<JsiSkRuntimeEffect>(runtime)->getObject();
|
42
|
+
}
|
43
|
+
|
38
44
|
JSI_HOST_FUNCTION(makeShader)
|
39
45
|
{
|
40
46
|
auto uniforms = castUniforms(runtime, arguments[0]);
|
@@ -213,5 +219,6 @@ namespace RNSkia
|
|
213
219
|
su.slot = (int)(u.offset / sizeof(float));
|
214
220
|
return su;
|
215
221
|
}
|
222
|
+
|
216
223
|
};
|
217
224
|
} // namespace RNSkia
|
@@ -7,7 +7,6 @@
|
|
7
7
|
#include <jsi/jsi.h>
|
8
8
|
|
9
9
|
#include "JsiSkRuntimeEffect.h"
|
10
|
-
#include "JsiSkColorFilter.h"
|
11
10
|
#include "JsiSkHostObjects.h"
|
12
11
|
|
13
12
|
namespace RNSkia {
|
@@ -32,7 +31,9 @@ public:
|
|
32
31
|
runtime, std::make_shared<JsiSkRuntimeEffect>(getContext(), std::move(effect)));
|
33
32
|
}
|
34
33
|
|
35
|
-
JSI_EXPORT_FUNCTIONS(
|
34
|
+
JSI_EXPORT_FUNCTIONS(
|
35
|
+
JSI_EXPORT_FUNC(JsiSkRuntimeEffectFactory, Make)
|
36
|
+
)
|
36
37
|
|
37
38
|
JsiSkRuntimeEffectFactory(std::shared_ptr<RNSkPlatformContext> context)
|
38
39
|
: JsiSkHostObject(std::move(context)) {}
|
@@ -0,0 +1,70 @@
|
|
1
|
+
#pragma once
|
2
|
+
|
3
|
+
#include <memory>
|
4
|
+
#include <utility>
|
5
|
+
|
6
|
+
#include <jsi/jsi.h>
|
7
|
+
|
8
|
+
#include "JsiSkHostObjects.h"
|
9
|
+
|
10
|
+
#pragma clang diagnostic push
|
11
|
+
#pragma clang diagnostic ignored "-Wdocumentation"
|
12
|
+
|
13
|
+
#include "JsiSkRuntimeEffect.h"
|
14
|
+
#include <SkRuntimeEffect.h>
|
15
|
+
|
16
|
+
#pragma clang diagnostic pop
|
17
|
+
|
18
|
+
namespace RNSkia {
|
19
|
+
|
20
|
+
using namespace facebook;
|
21
|
+
|
22
|
+
class JsiSkRuntimeShaderBuilder : public JsiSkWrappingSharedPtrHostObject<SkRuntimeShaderBuilder> {
|
23
|
+
public:
|
24
|
+
|
25
|
+
/**
|
26
|
+
Constructor
|
27
|
+
*/
|
28
|
+
JsiSkRuntimeShaderBuilder(std::shared_ptr<RNSkPlatformContext> context, const SkRuntimeShaderBuilder &rt)
|
29
|
+
: JsiSkWrappingSharedPtrHostObject<SkRuntimeShaderBuilder>(
|
30
|
+
std::move(context), std::make_shared<SkRuntimeShaderBuilder>(rt)){}
|
31
|
+
|
32
|
+
/**
|
33
|
+
Returns the underlying object from a host object of this type
|
34
|
+
*/
|
35
|
+
static std::shared_ptr<SkRuntimeShaderBuilder> fromValue(jsi::Runtime &runtime,
|
36
|
+
const jsi::Value &obj) {
|
37
|
+
const auto& object = obj.asObject(runtime);
|
38
|
+
return object.asHostObject<JsiSkRuntimeShaderBuilder>(runtime)->getObject();
|
39
|
+
|
40
|
+
}
|
41
|
+
|
42
|
+
/**
|
43
|
+
Returns the jsi object from a host object of this type
|
44
|
+
*/
|
45
|
+
static jsi::Value toValue(jsi::Runtime &runtime,
|
46
|
+
std::shared_ptr<RNSkPlatformContext> context,
|
47
|
+
const SkRuntimeShaderBuilder &rt) {
|
48
|
+
return jsi::Object::createFromHostObject(
|
49
|
+
runtime, std::make_shared<JsiSkRuntimeShaderBuilder>(std::move(context), rt));
|
50
|
+
}
|
51
|
+
|
52
|
+
/**
|
53
|
+
* Creates the function for construction a new instance of the SkRect
|
54
|
+
* wrapper
|
55
|
+
* @param context platform context
|
56
|
+
* @return A function for creating a new host object wrapper for the SkRect
|
57
|
+
* class
|
58
|
+
*/
|
59
|
+
static const jsi::HostFunctionType
|
60
|
+
createCtor(std::shared_ptr<RNSkPlatformContext> context) {
|
61
|
+
return JSI_HOST_FUNCTION_LAMBDA {
|
62
|
+
auto rt = JsiSkRuntimeEffect::fromValue(runtime, arguments[0]);
|
63
|
+
auto rtb = SkRuntimeShaderBuilder(rt);
|
64
|
+
// Return the newly constructed object
|
65
|
+
return jsi::Object::createFromHostObject(
|
66
|
+
runtime, std::make_shared<JsiSkRuntimeShaderBuilder>(std::move(context), std::move(rtb)));
|
67
|
+
};
|
68
|
+
}
|
69
|
+
};
|
70
|
+
} // namespace RNSkia
|
@@ -50,7 +50,7 @@ std::vector<SkColor> getColors(jsi::Runtime &runtime, const jsi::Value& value) {
|
|
50
50
|
auto size = jsiColors.size(runtime);
|
51
51
|
colors.reserve(size);
|
52
52
|
for (int i = 0; i < size; i++) {
|
53
|
-
SkColor color = jsiColors.getValueAtIndex(runtime, i)
|
53
|
+
SkColor color = JsiSkColor::fromValue(runtime, jsiColors.getValueAtIndex(runtime, i));
|
54
54
|
colors.push_back(color);
|
55
55
|
}
|
56
56
|
}
|
@@ -191,7 +191,7 @@ public:
|
|
191
191
|
}
|
192
192
|
|
193
193
|
JSI_HOST_FUNCTION(MakeColor) {
|
194
|
-
auto color = arguments[0]
|
194
|
+
auto color = JsiSkColor::fromValue(runtime, arguments[0]);
|
195
195
|
sk_sp<SkShader> gradient = SkShaders::Color(color);
|
196
196
|
return jsi::Object::createFromHostObject(
|
197
197
|
runtime, std::make_shared<JsiSkShader>(getContext(), std::move(gradient)));
|
package/cpp/api/JsiSkVertices.h
CHANGED
@@ -97,7 +97,7 @@ namespace RNSkia {
|
|
97
97
|
auto colorsSize = jsiColors.size(runtime);
|
98
98
|
colors.reserve(colorsSize);
|
99
99
|
for (int i = 0; i < colorsSize; i++) {
|
100
|
-
SkColor color = jsiColors.getValueAtIndex(runtime, i)
|
100
|
+
SkColor color = JsiSkColor::fromValue(runtime, jsiColors.getValueAtIndex(runtime, i));
|
101
101
|
colors.push_back(color);
|
102
102
|
}
|
103
103
|
}
|