@shopify/react-native-skia 0.1.191 → 0.1.192
Sign up to get free protection for your applications and to get access to all the features.
- package/cpp/api/JsiSkColorFilter.h +2 -17
- package/cpp/api/JsiSkContourMeasure.h +3 -17
- package/cpp/api/JsiSkContourMeasureIter.h +3 -18
- package/cpp/api/JsiSkData.h +1 -18
- package/cpp/api/JsiSkFont.h +4 -14
- package/cpp/api/JsiSkHostObjects.h +85 -10
- package/cpp/api/JsiSkImage.h +1 -12
- package/cpp/api/JsiSkImageFilter.h +1 -17
- package/cpp/api/JsiSkMaskFilter.h +1 -17
- package/cpp/api/JsiSkMatrix.h +3 -6
- package/cpp/api/JsiSkPaint.h +3 -15
- package/cpp/api/JsiSkPath.h +2 -15
- package/cpp/api/JsiSkPathEffect.h +2 -17
- package/cpp/api/JsiSkPicture.h +4 -18
- package/cpp/api/JsiSkPictureRecorder.h +4 -1
- package/cpp/api/JsiSkPoint.h +6 -1
- package/cpp/api/JsiSkRRect.h +6 -1
- package/cpp/api/JsiSkRSXform.h +4 -6
- package/cpp/api/JsiSkRect.h +6 -2
- package/cpp/api/JsiSkRuntimeEffect.h +4 -7
- package/cpp/api/JsiSkRuntimeShaderBuilder.h +2 -10
- package/cpp/api/JsiSkSVG.h +1 -10
- package/cpp/api/JsiSkShader.h +2 -16
- package/cpp/api/JsiSkSurface.h +3 -16
- package/cpp/api/JsiSkTextBlob.h +2 -18
- package/cpp/api/JsiSkTypeface.h +1 -22
- package/cpp/api/JsiSkVertices.h +3 -17
- package/cpp/rnskia/values/RNSkReadonlyValue.h +2 -2
- package/cpp/rnskia/values/RNSkValue.h +1 -1
- package/lib/commonjs/renderer/Canvas.js +17 -1
- package/lib/commonjs/renderer/Canvas.js.map +1 -1
- package/lib/commonjs/skia/core/Data.d.ts +2 -2
- package/lib/commonjs/skia/core/Data.js.map +1 -1
- package/lib/commonjs/skia/types/Data/Data.d.ts +2 -2
- package/lib/commonjs/skia/types/Data/Data.js.map +1 -1
- package/lib/commonjs/skia/types/Image/Image.d.ts +2 -2
- package/lib/commonjs/skia/types/Image/Image.js.map +1 -1
- package/lib/commonjs/skia/types/JsiInstance.d.ts +4 -4
- package/lib/commonjs/skia/types/JsiInstance.js.map +1 -1
- package/lib/commonjs/skia/types/SVG/SVG.d.ts +2 -2
- package/lib/commonjs/skia/types/SVG/SVG.js.map +1 -1
- package/lib/commonjs/skia/types/Typeface/Typeface.d.ts +2 -2
- package/lib/commonjs/skia/types/Typeface/Typeface.js.map +1 -1
- package/lib/commonjs/skia/web/Host.d.ts +1 -0
- package/lib/commonjs/skia/web/Host.js +2 -0
- package/lib/commonjs/skia/web/Host.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkCanvas.d.ts +1 -0
- package/lib/commonjs/skia/web/JsiSkCanvas.js +6 -0
- package/lib/commonjs/skia/web/JsiSkCanvas.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkColorFilter.d.ts +1 -0
- package/lib/commonjs/skia/web/JsiSkColorFilter.js +6 -0
- package/lib/commonjs/skia/web/JsiSkColorFilter.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkContourMeasure.d.ts +1 -0
- package/lib/commonjs/skia/web/JsiSkContourMeasure.js +6 -0
- package/lib/commonjs/skia/web/JsiSkContourMeasure.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkContourMeasureIter.d.ts +1 -0
- package/lib/commonjs/skia/web/JsiSkContourMeasureIter.js +6 -0
- package/lib/commonjs/skia/web/JsiSkContourMeasureIter.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkData.d.ts +1 -1
- package/lib/commonjs/skia/web/JsiSkData.js +4 -2
- package/lib/commonjs/skia/web/JsiSkData.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkFont.d.ts +1 -0
- package/lib/commonjs/skia/web/JsiSkFont.js +6 -0
- package/lib/commonjs/skia/web/JsiSkFont.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkImage.d.ts +1 -1
- package/lib/commonjs/skia/web/JsiSkImage.js +6 -4
- package/lib/commonjs/skia/web/JsiSkImage.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkImageFilter.d.ts +1 -0
- package/lib/commonjs/skia/web/JsiSkImageFilter.js +6 -0
- package/lib/commonjs/skia/web/JsiSkImageFilter.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkMaskFilter.d.ts +1 -0
- package/lib/commonjs/skia/web/JsiSkMaskFilter.js +6 -0
- package/lib/commonjs/skia/web/JsiSkMaskFilter.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkMatrix.d.ts +1 -0
- package/lib/commonjs/skia/web/JsiSkMatrix.js +5 -0
- package/lib/commonjs/skia/web/JsiSkMatrix.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPaint.d.ts +1 -0
- package/lib/commonjs/skia/web/JsiSkPaint.js +6 -0
- package/lib/commonjs/skia/web/JsiSkPaint.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPath.d.ts +1 -0
- package/lib/commonjs/skia/web/JsiSkPath.js +6 -0
- package/lib/commonjs/skia/web/JsiSkPath.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPathEffect.d.ts +1 -0
- package/lib/commonjs/skia/web/JsiSkPathEffect.js +6 -0
- package/lib/commonjs/skia/web/JsiSkPathEffect.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPicture.d.ts +1 -0
- package/lib/commonjs/skia/web/JsiSkPicture.js +6 -1
- package/lib/commonjs/skia/web/JsiSkPicture.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPictureRecorder.d.ts +1 -0
- package/lib/commonjs/skia/web/JsiSkPictureRecorder.js +6 -0
- package/lib/commonjs/skia/web/JsiSkPictureRecorder.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPoint.d.ts +1 -0
- package/lib/commonjs/skia/web/JsiSkPoint.js +5 -0
- package/lib/commonjs/skia/web/JsiSkPoint.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkRRect.d.ts +1 -0
- package/lib/commonjs/skia/web/JsiSkRRect.js +5 -0
- package/lib/commonjs/skia/web/JsiSkRRect.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkRSXform.d.ts +1 -0
- package/lib/commonjs/skia/web/JsiSkRSXform.js +5 -0
- package/lib/commonjs/skia/web/JsiSkRSXform.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkRect.d.ts +1 -0
- package/lib/commonjs/skia/web/JsiSkRect.js +5 -0
- package/lib/commonjs/skia/web/JsiSkRect.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkRuntimeEffect.d.ts +1 -0
- package/lib/commonjs/skia/web/JsiSkRuntimeEffect.js +6 -0
- package/lib/commonjs/skia/web/JsiSkRuntimeEffect.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkShader.d.ts +1 -0
- package/lib/commonjs/skia/web/JsiSkShader.js +6 -0
- package/lib/commonjs/skia/web/JsiSkShader.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkSurface.d.ts +1 -0
- package/lib/commonjs/skia/web/JsiSkSurface.js +6 -0
- package/lib/commonjs/skia/web/JsiSkSurface.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkTextBlob.d.ts +1 -0
- package/lib/commonjs/skia/web/JsiSkTextBlob.js +6 -0
- package/lib/commonjs/skia/web/JsiSkTextBlob.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkTypeface.d.ts +1 -1
- package/lib/commonjs/skia/web/JsiSkTypeface.js +6 -4
- package/lib/commonjs/skia/web/JsiSkTypeface.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkVertices.d.ts +1 -0
- package/lib/commonjs/skia/web/JsiSkVertices.js +6 -0
- package/lib/commonjs/skia/web/JsiSkVertices.js.map +1 -1
- package/lib/commonjs/values/hooks/useComputedValue.js +1 -1
- package/lib/commonjs/values/hooks/useComputedValue.js.map +1 -1
- package/lib/commonjs/values/types.d.ts +1 -1
- package/lib/commonjs/values/types.js.map +1 -1
- package/lib/commonjs/values/web/RNSkComputedValue.d.ts +1 -1
- package/lib/commonjs/values/web/RNSkComputedValue.js +1 -1
- package/lib/commonjs/values/web/RNSkComputedValue.js.map +1 -1
- package/lib/commonjs/values/web/RNSkReadonlyValue.d.ts +1 -1
- package/lib/commonjs/values/web/RNSkReadonlyValue.js +1 -1
- package/lib/commonjs/values/web/RNSkReadonlyValue.js.map +1 -1
- package/lib/commonjs/views/SkiaDomView.web.js +14 -4
- package/lib/commonjs/views/SkiaDomView.web.js.map +1 -1
- package/lib/commonjs/views/types.d.ts +2 -1
- package/lib/commonjs/views/types.js.map +1 -1
- package/lib/module/renderer/Canvas.js +15 -1
- package/lib/module/renderer/Canvas.js.map +1 -1
- package/lib/module/skia/core/Data.d.ts +2 -2
- package/lib/module/skia/core/Data.js.map +1 -1
- package/lib/module/skia/types/Data/Data.d.ts +2 -2
- package/lib/module/skia/types/Data/Data.js.map +1 -1
- package/lib/module/skia/types/Image/Image.d.ts +2 -2
- package/lib/module/skia/types/Image/Image.js.map +1 -1
- package/lib/module/skia/types/JsiInstance.d.ts +4 -4
- package/lib/module/skia/types/JsiInstance.js.map +1 -1
- package/lib/module/skia/types/SVG/SVG.d.ts +2 -2
- package/lib/module/skia/types/SVG/SVG.js.map +1 -1
- package/lib/module/skia/types/Typeface/Typeface.d.ts +2 -2
- package/lib/module/skia/types/Typeface/Typeface.js.map +1 -1
- package/lib/module/skia/web/Host.d.ts +1 -0
- package/lib/module/skia/web/Host.js +2 -0
- package/lib/module/skia/web/Host.js.map +1 -1
- package/lib/module/skia/web/JsiSkCanvas.d.ts +1 -0
- package/lib/module/skia/web/JsiSkCanvas.js +6 -0
- package/lib/module/skia/web/JsiSkCanvas.js.map +1 -1
- package/lib/module/skia/web/JsiSkColorFilter.d.ts +1 -0
- package/lib/module/skia/web/JsiSkColorFilter.js +6 -0
- package/lib/module/skia/web/JsiSkColorFilter.js.map +1 -1
- package/lib/module/skia/web/JsiSkContourMeasure.d.ts +1 -0
- package/lib/module/skia/web/JsiSkContourMeasure.js +6 -0
- package/lib/module/skia/web/JsiSkContourMeasure.js.map +1 -1
- package/lib/module/skia/web/JsiSkContourMeasureIter.d.ts +1 -0
- package/lib/module/skia/web/JsiSkContourMeasureIter.js +6 -0
- package/lib/module/skia/web/JsiSkContourMeasureIter.js.map +1 -1
- package/lib/module/skia/web/JsiSkData.d.ts +1 -1
- package/lib/module/skia/web/JsiSkData.js +4 -2
- package/lib/module/skia/web/JsiSkData.js.map +1 -1
- package/lib/module/skia/web/JsiSkFont.d.ts +1 -0
- package/lib/module/skia/web/JsiSkFont.js +6 -0
- package/lib/module/skia/web/JsiSkFont.js.map +1 -1
- package/lib/module/skia/web/JsiSkImage.d.ts +1 -1
- package/lib/module/skia/web/JsiSkImage.js +6 -4
- package/lib/module/skia/web/JsiSkImage.js.map +1 -1
- package/lib/module/skia/web/JsiSkImageFilter.d.ts +1 -0
- package/lib/module/skia/web/JsiSkImageFilter.js +6 -0
- package/lib/module/skia/web/JsiSkImageFilter.js.map +1 -1
- package/lib/module/skia/web/JsiSkMaskFilter.d.ts +1 -0
- package/lib/module/skia/web/JsiSkMaskFilter.js +6 -0
- package/lib/module/skia/web/JsiSkMaskFilter.js.map +1 -1
- package/lib/module/skia/web/JsiSkMatrix.d.ts +1 -0
- package/lib/module/skia/web/JsiSkMatrix.js +5 -0
- package/lib/module/skia/web/JsiSkMatrix.js.map +1 -1
- package/lib/module/skia/web/JsiSkPaint.d.ts +1 -0
- package/lib/module/skia/web/JsiSkPaint.js +6 -0
- package/lib/module/skia/web/JsiSkPaint.js.map +1 -1
- package/lib/module/skia/web/JsiSkPath.d.ts +1 -0
- package/lib/module/skia/web/JsiSkPath.js +6 -0
- package/lib/module/skia/web/JsiSkPath.js.map +1 -1
- package/lib/module/skia/web/JsiSkPathEffect.d.ts +1 -0
- package/lib/module/skia/web/JsiSkPathEffect.js +6 -0
- package/lib/module/skia/web/JsiSkPathEffect.js.map +1 -1
- package/lib/module/skia/web/JsiSkPicture.d.ts +1 -0
- package/lib/module/skia/web/JsiSkPicture.js +6 -0
- package/lib/module/skia/web/JsiSkPicture.js.map +1 -1
- package/lib/module/skia/web/JsiSkPictureRecorder.d.ts +1 -0
- package/lib/module/skia/web/JsiSkPictureRecorder.js +6 -0
- package/lib/module/skia/web/JsiSkPictureRecorder.js.map +1 -1
- package/lib/module/skia/web/JsiSkPoint.d.ts +1 -0
- package/lib/module/skia/web/JsiSkPoint.js +5 -0
- package/lib/module/skia/web/JsiSkPoint.js.map +1 -1
- package/lib/module/skia/web/JsiSkRRect.d.ts +1 -0
- package/lib/module/skia/web/JsiSkRRect.js +5 -0
- package/lib/module/skia/web/JsiSkRRect.js.map +1 -1
- package/lib/module/skia/web/JsiSkRSXform.d.ts +1 -0
- package/lib/module/skia/web/JsiSkRSXform.js +5 -0
- package/lib/module/skia/web/JsiSkRSXform.js.map +1 -1
- package/lib/module/skia/web/JsiSkRect.d.ts +1 -0
- package/lib/module/skia/web/JsiSkRect.js +5 -0
- package/lib/module/skia/web/JsiSkRect.js.map +1 -1
- package/lib/module/skia/web/JsiSkRuntimeEffect.d.ts +1 -0
- package/lib/module/skia/web/JsiSkRuntimeEffect.js +6 -0
- package/lib/module/skia/web/JsiSkRuntimeEffect.js.map +1 -1
- package/lib/module/skia/web/JsiSkShader.d.ts +1 -0
- package/lib/module/skia/web/JsiSkShader.js +6 -0
- package/lib/module/skia/web/JsiSkShader.js.map +1 -1
- package/lib/module/skia/web/JsiSkSurface.d.ts +1 -0
- package/lib/module/skia/web/JsiSkSurface.js +6 -0
- package/lib/module/skia/web/JsiSkSurface.js.map +1 -1
- package/lib/module/skia/web/JsiSkTextBlob.d.ts +1 -0
- package/lib/module/skia/web/JsiSkTextBlob.js +6 -0
- package/lib/module/skia/web/JsiSkTextBlob.js.map +1 -1
- package/lib/module/skia/web/JsiSkTypeface.d.ts +1 -1
- package/lib/module/skia/web/JsiSkTypeface.js +6 -4
- package/lib/module/skia/web/JsiSkTypeface.js.map +1 -1
- package/lib/module/skia/web/JsiSkVertices.d.ts +1 -0
- package/lib/module/skia/web/JsiSkVertices.js +6 -0
- package/lib/module/skia/web/JsiSkVertices.js.map +1 -1
- package/lib/module/values/hooks/useComputedValue.js +1 -1
- package/lib/module/values/hooks/useComputedValue.js.map +1 -1
- package/lib/module/values/types.d.ts +1 -1
- package/lib/module/values/types.js.map +1 -1
- package/lib/module/values/web/RNSkComputedValue.d.ts +1 -1
- package/lib/module/values/web/RNSkComputedValue.js +1 -1
- package/lib/module/values/web/RNSkComputedValue.js.map +1 -1
- package/lib/module/values/web/RNSkReadonlyValue.d.ts +1 -1
- package/lib/module/values/web/RNSkReadonlyValue.js +1 -1
- package/lib/module/values/web/RNSkReadonlyValue.js.map +1 -1
- package/lib/module/views/SkiaDomView.web.js +13 -4
- package/lib/module/views/SkiaDomView.web.js.map +1 -1
- package/lib/module/views/types.d.ts +2 -1
- package/lib/module/views/types.js.map +1 -1
- package/lib/typescript/src/skia/core/Data.d.ts +2 -2
- package/lib/typescript/src/skia/types/Data/Data.d.ts +2 -2
- package/lib/typescript/src/skia/types/Image/Image.d.ts +2 -2
- package/lib/typescript/src/skia/types/JsiInstance.d.ts +4 -4
- package/lib/typescript/src/skia/types/SVG/SVG.d.ts +2 -2
- package/lib/typescript/src/skia/types/Typeface/Typeface.d.ts +2 -2
- package/lib/typescript/src/skia/web/Host.d.ts +1 -0
- package/lib/typescript/src/skia/web/JsiSkCanvas.d.ts +1 -0
- package/lib/typescript/src/skia/web/JsiSkColorFilter.d.ts +1 -0
- package/lib/typescript/src/skia/web/JsiSkContourMeasure.d.ts +1 -0
- package/lib/typescript/src/skia/web/JsiSkContourMeasureIter.d.ts +1 -0
- package/lib/typescript/src/skia/web/JsiSkData.d.ts +1 -1
- package/lib/typescript/src/skia/web/JsiSkFont.d.ts +1 -0
- package/lib/typescript/src/skia/web/JsiSkImage.d.ts +1 -1
- package/lib/typescript/src/skia/web/JsiSkImageFilter.d.ts +1 -0
- package/lib/typescript/src/skia/web/JsiSkMaskFilter.d.ts +1 -0
- package/lib/typescript/src/skia/web/JsiSkMatrix.d.ts +1 -0
- package/lib/typescript/src/skia/web/JsiSkPaint.d.ts +1 -0
- package/lib/typescript/src/skia/web/JsiSkPath.d.ts +1 -0
- package/lib/typescript/src/skia/web/JsiSkPathEffect.d.ts +1 -0
- package/lib/typescript/src/skia/web/JsiSkPicture.d.ts +1 -0
- package/lib/typescript/src/skia/web/JsiSkPictureRecorder.d.ts +1 -0
- package/lib/typescript/src/skia/web/JsiSkPoint.d.ts +1 -0
- package/lib/typescript/src/skia/web/JsiSkRRect.d.ts +1 -0
- package/lib/typescript/src/skia/web/JsiSkRSXform.d.ts +1 -0
- package/lib/typescript/src/skia/web/JsiSkRect.d.ts +1 -0
- package/lib/typescript/src/skia/web/JsiSkRuntimeEffect.d.ts +1 -0
- package/lib/typescript/src/skia/web/JsiSkShader.d.ts +1 -0
- package/lib/typescript/src/skia/web/JsiSkSurface.d.ts +1 -0
- package/lib/typescript/src/skia/web/JsiSkTextBlob.d.ts +1 -0
- package/lib/typescript/src/skia/web/JsiSkTypeface.d.ts +1 -1
- package/lib/typescript/src/skia/web/JsiSkVertices.d.ts +1 -0
- package/lib/typescript/src/values/types.d.ts +1 -1
- package/lib/typescript/src/values/web/RNSkComputedValue.d.ts +1 -1
- package/lib/typescript/src/values/web/RNSkReadonlyValue.d.ts +1 -1
- package/lib/typescript/src/views/types.d.ts +2 -1
- package/package.json +1 -1
- package/src/renderer/Canvas.tsx +21 -1
- package/src/skia/core/Data.ts +3 -3
- package/src/skia/types/Data/Data.ts +2 -2
- package/src/skia/types/Image/Image.ts +2 -2
- package/src/skia/types/JsiInstance.ts +4 -4
- package/src/skia/types/SVG/SVG.ts +2 -2
- package/src/skia/types/Typeface/Typeface.ts +2 -2
- package/src/skia/web/Host.ts +2 -0
- package/src/skia/web/JsiSkCanvas.ts +4 -0
- package/src/skia/web/JsiSkColorFilter.ts +4 -0
- package/src/skia/web/JsiSkContourMeasure.ts +4 -0
- package/src/skia/web/JsiSkContourMeasureIter.ts +4 -0
- package/src/skia/web/JsiSkData.ts +3 -3
- package/src/skia/web/JsiSkFont.ts +4 -0
- package/src/skia/web/JsiSkImage.ts +2 -2
- package/src/skia/web/JsiSkImageFilter.ts +4 -0
- package/src/skia/web/JsiSkMaskFilter.ts +4 -0
- package/src/skia/web/JsiSkMatrix.ts +4 -0
- package/src/skia/web/JsiSkPaint.ts +4 -0
- package/src/skia/web/JsiSkPath.ts +4 -0
- package/src/skia/web/JsiSkPathEffect.ts +4 -0
- package/src/skia/web/JsiSkPicture.ts +4 -0
- package/src/skia/web/JsiSkPictureRecorder.ts +4 -0
- package/src/skia/web/JsiSkPoint.ts +4 -0
- package/src/skia/web/JsiSkRRect.ts +4 -0
- package/src/skia/web/JsiSkRSXform.ts +4 -0
- package/src/skia/web/JsiSkRect.ts +4 -0
- package/src/skia/web/JsiSkRuntimeEffect.ts +4 -0
- package/src/skia/web/JsiSkShader.ts +4 -0
- package/src/skia/web/JsiSkSurface.ts +4 -0
- package/src/skia/web/JsiSkTextBlob.ts +4 -0
- package/src/skia/web/JsiSkTypeface.ts +2 -2
- package/src/skia/web/JsiSkVertices.ts +4 -0
- package/src/values/hooks/useComputedValue.ts +1 -1
- package/src/values/types.ts +1 -1
- package/src/values/web/RNSkComputedValue.ts +1 -1
- package/src/values/web/RNSkReadonlyValue.ts +1 -1
- package/src/views/SkiaDomView.web.tsx +6 -1
- package/src/views/types.ts +2 -1
@@ -2,6 +2,7 @@ import type { ViewProps } from "react-native";
|
|
2
2
|
import type { GroupProps, RenderNode } from "../dom/types";
|
3
3
|
import type { SkCanvas, SkImage, SkPicture, SkRect, SkSize } from "../skia/types";
|
4
4
|
import type { SkiaMutableValue, SkiaValue } from "../values";
|
5
|
+
import type { SharedValueType } from "../renderer/processors/Animations/Animations";
|
5
6
|
export declare type DrawMode = "continuous" | "default";
|
6
7
|
export declare type NativeSkiaViewProps = ViewProps & {
|
7
8
|
mode?: DrawMode;
|
@@ -70,7 +71,7 @@ export interface SkiaBaseViewProps extends ViewProps {
|
|
70
71
|
* Pass an animated value to the onSize property to get updates when
|
71
72
|
* the Skia view is resized.
|
72
73
|
*/
|
73
|
-
onSize?: SkiaMutableValue<SkSize>;
|
74
|
+
onSize?: SkiaMutableValue<SkSize> | SharedValueType<SkSize>;
|
74
75
|
}
|
75
76
|
export interface SkiaDrawViewProps extends SkiaBaseViewProps {
|
76
77
|
/**
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["TouchType"],"sources":["types.ts"],"sourcesContent":["import type { ViewProps } from \"react-native\";\n\nimport type { GroupProps, RenderNode } from \"../dom/types\";\nimport type {\n SkCanvas,\n SkImage,\n SkPicture,\n SkRect,\n SkSize,\n} from \"../skia/types\";\nimport type { SkiaMutableValue, SkiaValue } from \"../values\";\n\nexport type DrawMode = \"continuous\" | \"default\";\n\nexport type NativeSkiaViewProps = ViewProps & {\n mode?: DrawMode;\n debug?: boolean;\n};\n\nexport enum TouchType {\n Start,\n Active,\n End,\n Cancelled,\n}\n\nexport interface TouchInfo {\n x: number;\n y: number;\n force: number;\n type: TouchType;\n id: number;\n timestamp: number;\n}\n\nexport interface DrawingInfo {\n width: number;\n height: number;\n timestamp: number;\n touches: Array<Array<TouchInfo>>;\n}\n\nexport type ExtendedTouchInfo = TouchInfo & {\n // points per second\n velocityX: number;\n velocityY: number;\n};\n\nexport type TouchHandlers = {\n onStart?: (touchInfo: TouchInfo) => void;\n onActive?: (touchInfo: ExtendedTouchInfo) => void;\n onEnd?: (touchInfo: ExtendedTouchInfo) => void;\n};\n\nexport type TouchHandler = (touchInfo: Array<Array<TouchInfo>>) => void;\n\nexport type RNSkiaDrawCallback = (canvas: SkCanvas, info: DrawingInfo) => void;\n\n/**\n * Listener interface for value changes\n */\nexport interface ValueListener {\n addListener: (callback: () => void) => number;\n removeListener: (id: number) => void;\n}\n\nexport interface ISkiaViewApi {\n setJsiProperty: <T>(nativeId: number, name: string, value: T) => void;\n callJsiMethod: <T extends Array<unknown>>(\n nativeId: number,\n name: string,\n ...args: T\n ) => void;\n registerValuesInView: (\n nativeId: number,\n values: SkiaValue<unknown>[]\n ) => () => void;\n requestRedraw: (nativeId: number) => void;\n makeImageSnapshot: (nativeId: number, rect?: SkRect) => SkImage;\n}\n\nexport interface SkiaBaseViewProps extends ViewProps {\n /**\n * Sets the drawing mode for the skia view. There are two drawing\n * modes, \"continuous\" and \"default\", where the continuous mode will\n * continuously redraw the view, and the default mode will only\n * redraw when any of the regular react properties are changed like\n * sizes and margins.\n */\n mode?: DrawMode;\n /**\n * When set to true the view will display information about the\n * average time it takes to render.\n */\n debug?: boolean;\n /**\n * Pass an animated value to the onSize property to get updates when\n * the Skia view is resized.\n */\n onSize?: SkiaMutableValue<SkSize>;\n}\n\nexport interface SkiaDrawViewProps extends SkiaBaseViewProps {\n /**\n * Draw callback. Will be called whenever the view is invalidated and\n * needs to redraw. This is either caused by a change in a react\n * property, a touch event, or a call to redraw. If the view is in\n * continuous mode the callback will be called 60 frames per second\n * by the native view.\n */\n onDraw?: RNSkiaDrawCallback;\n}\n\nexport interface SkiaPictureViewProps extends SkiaBaseViewProps {\n picture?: SkPicture;\n}\n\nexport interface SkiaDomViewProps extends SkiaBaseViewProps {\n root?: RenderNode<GroupProps>;\n onTouch?: TouchHandler;\n}\n"],"mappings":"
|
1
|
+
{"version":3,"names":["TouchType"],"sources":["types.ts"],"sourcesContent":["import type { ViewProps } from \"react-native\";\n\nimport type { GroupProps, RenderNode } from \"../dom/types\";\nimport type {\n SkCanvas,\n SkImage,\n SkPicture,\n SkRect,\n SkSize,\n} from \"../skia/types\";\nimport type { SkiaMutableValue, SkiaValue } from \"../values\";\nimport type { SharedValueType } from \"../renderer/processors/Animations/Animations\";\n\nexport type DrawMode = \"continuous\" | \"default\";\n\nexport type NativeSkiaViewProps = ViewProps & {\n mode?: DrawMode;\n debug?: boolean;\n};\n\nexport enum TouchType {\n Start,\n Active,\n End,\n Cancelled,\n}\n\nexport interface TouchInfo {\n x: number;\n y: number;\n force: number;\n type: TouchType;\n id: number;\n timestamp: number;\n}\n\nexport interface DrawingInfo {\n width: number;\n height: number;\n timestamp: number;\n touches: Array<Array<TouchInfo>>;\n}\n\nexport type ExtendedTouchInfo = TouchInfo & {\n // points per second\n velocityX: number;\n velocityY: number;\n};\n\nexport type TouchHandlers = {\n onStart?: (touchInfo: TouchInfo) => void;\n onActive?: (touchInfo: ExtendedTouchInfo) => void;\n onEnd?: (touchInfo: ExtendedTouchInfo) => void;\n};\n\nexport type TouchHandler = (touchInfo: Array<Array<TouchInfo>>) => void;\n\nexport type RNSkiaDrawCallback = (canvas: SkCanvas, info: DrawingInfo) => void;\n\n/**\n * Listener interface for value changes\n */\nexport interface ValueListener {\n addListener: (callback: () => void) => number;\n removeListener: (id: number) => void;\n}\n\nexport interface ISkiaViewApi {\n setJsiProperty: <T>(nativeId: number, name: string, value: T) => void;\n callJsiMethod: <T extends Array<unknown>>(\n nativeId: number,\n name: string,\n ...args: T\n ) => void;\n registerValuesInView: (\n nativeId: number,\n values: SkiaValue<unknown>[]\n ) => () => void;\n requestRedraw: (nativeId: number) => void;\n makeImageSnapshot: (nativeId: number, rect?: SkRect) => SkImage;\n}\n\nexport interface SkiaBaseViewProps extends ViewProps {\n /**\n * Sets the drawing mode for the skia view. There are two drawing\n * modes, \"continuous\" and \"default\", where the continuous mode will\n * continuously redraw the view, and the default mode will only\n * redraw when any of the regular react properties are changed like\n * sizes and margins.\n */\n mode?: DrawMode;\n /**\n * When set to true the view will display information about the\n * average time it takes to render.\n */\n debug?: boolean;\n /**\n * Pass an animated value to the onSize property to get updates when\n * the Skia view is resized.\n */\n onSize?: SkiaMutableValue<SkSize> | SharedValueType<SkSize>;\n}\n\nexport interface SkiaDrawViewProps extends SkiaBaseViewProps {\n /**\n * Draw callback. Will be called whenever the view is invalidated and\n * needs to redraw. This is either caused by a change in a react\n * property, a touch event, or a call to redraw. If the view is in\n * continuous mode the callback will be called 60 frames per second\n * by the native view.\n */\n onDraw?: RNSkiaDrawCallback;\n}\n\nexport interface SkiaPictureViewProps extends SkiaBaseViewProps {\n picture?: SkPicture;\n}\n\nexport interface SkiaDomViewProps extends SkiaBaseViewProps {\n root?: RenderNode<GroupProps>;\n onTouch?: TouchHandler;\n}\n"],"mappings":"AAoBA,WAAYA,SAAZ;;WAAYA,S;EAAAA,S,CAAAA,S;EAAAA,S,CAAAA,S;EAAAA,S,CAAAA,S;EAAAA,S,CAAAA,S;GAAAA,S,KAAAA,S"}
|
@@ -1,3 +1,3 @@
|
|
1
|
-
import type { SkData, DataSourceParam,
|
2
|
-
export declare const useRawData: <T extends
|
1
|
+
import type { SkData, DataSourceParam, BaseSkJSIInstance } from "../types";
|
2
|
+
export declare const useRawData: <T extends BaseSkJSIInstance>(source: DataSourceParam, factory: (data: SkData) => T | null, onError?: ((err: Error) => void) | undefined) => T | null;
|
3
3
|
export declare const useData: (source: DataSourceParam, onError?: ((err: Error) => void) | undefined) => SkData | null;
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import type {
|
2
|
-
export declare type SkData = SkJSIInstance<"Data"
|
1
|
+
import type { SkJSIInstance } from "../JsiInstance";
|
2
|
+
export declare type SkData = SkJSIInstance<"Data">;
|
3
3
|
declare type RNModule = number;
|
4
4
|
declare type ESModule = {
|
5
5
|
__esModule: true;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import type { SkMatrix } from "../Matrix";
|
2
|
-
import type {
|
2
|
+
import type { SkJSIInstance } from "../JsiInstance";
|
3
3
|
import type { TileMode } from "../ImageFilter";
|
4
4
|
import type { SkShader } from "../Shader";
|
5
5
|
export declare enum FilterMode {
|
@@ -16,7 +16,7 @@ export declare enum ImageFormat {
|
|
16
16
|
PNG = 4,
|
17
17
|
WEBP = 6
|
18
18
|
}
|
19
|
-
export interface SkImage extends SkJSIInstance<"Image"
|
19
|
+
export interface SkImage extends SkJSIInstance<"Image"> {
|
20
20
|
/**
|
21
21
|
* Returns the possibly scaled height of the image.
|
22
22
|
*/
|
@@ -1,6 +1,6 @@
|
|
1
|
-
export interface
|
2
|
-
__typename__: T;
|
3
|
-
}
|
4
|
-
export interface JsiDisposable {
|
1
|
+
export interface BaseSkJSIInstance {
|
5
2
|
dispose: () => void;
|
6
3
|
}
|
4
|
+
export interface SkJSIInstance<T extends string> extends BaseSkJSIInstance {
|
5
|
+
__typename__: T;
|
6
|
+
}
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import type {
|
2
|
-
export interface SkSVG extends SkJSIInstance<"SVG"
|
1
|
+
import type { SkJSIInstance } from "../JsiInstance";
|
2
|
+
export interface SkSVG extends SkJSIInstance<"SVG"> {
|
3
3
|
width(): number;
|
4
4
|
height(): number;
|
5
5
|
}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import type {
|
2
|
-
export declare type SkTypeface = SkJSIInstance<"Typeface"
|
1
|
+
import type { SkJSIInstance } from "../JsiInstance";
|
2
|
+
export declare type SkTypeface = SkJSIInstance<"Typeface">;
|
@@ -11,6 +11,7 @@ export declare abstract class BaseHostObject<T, N extends string> extends Host i
|
|
11
11
|
readonly __typename__: N;
|
12
12
|
ref: T;
|
13
13
|
constructor(CanvasKit: CanvasKit, ref: T, typename: N);
|
14
|
+
abstract dispose: () => void;
|
14
15
|
}
|
15
16
|
export declare abstract class HostObject<T, N extends string> extends BaseHostObject<T, N> {
|
16
17
|
static fromValue<T>(value: SkJSIInstance<string>): T;
|
@@ -3,6 +3,7 @@ import type { BlendMode, ClipOp, FilterMode, MipmapMode, PointMode, SaveLayerFla
|
|
3
3
|
import { HostObject } from "./Host";
|
4
4
|
export declare class JsiSkCanvas extends HostObject<Canvas, "Canvas"> implements SkCanvas {
|
5
5
|
constructor(CanvasKit: CanvasKit, ref: Canvas);
|
6
|
+
dispose: () => void;
|
6
7
|
drawRect(rect: SkRect, paint: SkPaint): void;
|
7
8
|
drawImage(image: SkImage, x: number, y: number, paint?: SkPaint): void;
|
8
9
|
drawImageRect(img: SkImage, src: SkRect, dest: SkRect, paint: SkPaint, fastSample?: boolean): void;
|
@@ -3,4 +3,5 @@ import type { SkColorFilter } from "../types";
|
|
3
3
|
import { HostObject } from "./Host";
|
4
4
|
export declare class JsiSkColorFilter extends HostObject<ColorFilter, "ColorFilter"> implements SkColorFilter {
|
5
5
|
constructor(CanvasKit: CanvasKit, ref: ColorFilter);
|
6
|
+
dispose: () => void;
|
6
7
|
}
|
@@ -5,4 +5,5 @@ import { JsiSkContourMeasure } from "./JsiSkContourMeasure";
|
|
5
5
|
export declare class JsiSkContourMeasureIter extends HostObject<ContourMeasureIter, "ContourMeasureIter"> implements SkContourMeasureIter {
|
6
6
|
constructor(CanvasKit: CanvasKit, ref: ContourMeasureIter);
|
7
7
|
next(): JsiSkContourMeasure | null;
|
8
|
+
dispose: () => void;
|
8
9
|
}
|
@@ -5,6 +5,7 @@ import { JsiSkRect } from "./JsiSkRect";
|
|
5
5
|
import { JsiSkTypeface } from "./JsiSkTypeface";
|
6
6
|
export declare class JsiSkFont extends HostObject<Font, "Font"> implements SkFont {
|
7
7
|
constructor(CanvasKit: CanvasKit, ref: Font);
|
8
|
+
dispose: () => void;
|
8
9
|
getTextWidth(text: string, paint?: SkPaint | undefined): number;
|
9
10
|
getMetrics(): {
|
10
11
|
ascent: number;
|
@@ -10,6 +10,6 @@ export declare class JsiSkImage extends HostObject<Image, "Image"> implements Sk
|
|
10
10
|
makeShaderCubic(tx: TileMode, ty: TileMode, B: number, C: number, localMatrix?: SkMatrix): SkShader;
|
11
11
|
encodeToBytes(fmt?: ImageFormat, quality?: number): Uint8Array;
|
12
12
|
encodeToBase64(fmt?: ImageFormat, quality?: number): string;
|
13
|
-
dispose()
|
13
|
+
dispose: () => void;
|
14
14
|
makeNonTextureImage(): SkImage;
|
15
15
|
}
|
@@ -3,4 +3,5 @@ import type { SkImageFilter } from "../types";
|
|
3
3
|
import { HostObject } from "./Host";
|
4
4
|
export declare class JsiSkImageFilter extends HostObject<ImageFilter, "ImageFilter"> implements SkImageFilter {
|
5
5
|
constructor(CanvasKit: CanvasKit, ref: ImageFilter);
|
6
|
+
dispose: () => void;
|
6
7
|
}
|
@@ -3,4 +3,5 @@ import type { SkMaskFilter } from "../types";
|
|
3
3
|
import { HostObject } from "./Host";
|
4
4
|
export declare class JsiSkMaskFilter extends HostObject<MaskFilter, "MaskFilter"> implements SkMaskFilter {
|
5
5
|
constructor(CanvasKit: CanvasKit, ref: MaskFilter);
|
6
|
+
dispose: () => void;
|
6
7
|
}
|
@@ -3,6 +3,7 @@ import type { SkMatrix } from "../types";
|
|
3
3
|
import { HostObject } from "./Host";
|
4
4
|
export declare class JsiSkMatrix extends HostObject<Matrix3x3, "Matrix"> implements SkMatrix {
|
5
5
|
constructor(CanvasKit: CanvasKit, ref: Matrix3x3);
|
6
|
+
dispose: () => void;
|
6
7
|
concat(matrix: SkMatrix): this;
|
7
8
|
translate(x: number, y: number): this;
|
8
9
|
scale(x: number, y?: number): this;
|
@@ -3,6 +3,7 @@ import type { StrokeJoin, BlendMode, SkColor, SkColorFilter, SkImageFilter, SkPa
|
|
3
3
|
import { HostObject } from "./Host";
|
4
4
|
export declare class JsiSkPaint extends HostObject<Paint, "Paint"> implements SkPaint {
|
5
5
|
constructor(CanvasKit: CanvasKit, ref: Paint);
|
6
|
+
dispose: () => void;
|
6
7
|
copy(): JsiSkPaint;
|
7
8
|
reset(): void;
|
8
9
|
getAlphaf(): number;
|
@@ -5,6 +5,7 @@ import { JsiSkPoint } from "./JsiSkPoint";
|
|
5
5
|
import { JsiSkRect } from "./JsiSkRect";
|
6
6
|
export declare class JsiSkPath extends HostObject<Path, "Path"> implements SkPath {
|
7
7
|
constructor(CanvasKit: CanvasKit, ref: Path);
|
8
|
+
dispose: () => void;
|
8
9
|
addPath(src: SkPath, matrix?: SkMatrix, extend?: boolean): this;
|
9
10
|
addArc(oval: SkRect, startAngleInDegrees: number, sweepAngleInDegrees: number): this;
|
10
11
|
addOval(oval: SkRect, isCCW?: boolean, startIndex?: number): this;
|
@@ -3,4 +3,5 @@ import type { SkPathEffect } from "../types/PathEffect";
|
|
3
3
|
import { HostObject } from "./Host";
|
4
4
|
export declare class JsiSkPathEffect extends HostObject<PathEffect, "PathEffect"> implements SkPathEffect {
|
5
5
|
constructor(CanvasKit: CanvasKit, ref: PathEffect);
|
6
|
+
dispose: () => void;
|
6
7
|
}
|
@@ -4,6 +4,7 @@ import { HostObject } from "./Host";
|
|
4
4
|
import { JsiSkShader } from "./JsiSkShader";
|
5
5
|
export declare class JsiSkPicture extends HostObject<Picture, "Picture"> implements SkPicture {
|
6
6
|
constructor(CanvasKit: CanvasKit, ref: Picture);
|
7
|
+
dispose: () => void;
|
7
8
|
makeShader(tmx: TileMode, tmy: TileMode, mode: FilterMode, localMatrix?: SkMatrix, tileRect?: SkRect): JsiSkShader;
|
8
9
|
serialize(): Uint8Array | null;
|
9
10
|
}
|
@@ -6,6 +6,7 @@ import { JsiSkCanvas } from "./JsiSkCanvas";
|
|
6
6
|
import { JsiSkPicture } from "./JsiSkPicture";
|
7
7
|
export declare class JsiSkPictureRecorder extends HostObject<PictureRecorder, "PictureRecorder"> implements SkPictureRecorder {
|
8
8
|
constructor(CanvasKit: CanvasKit, ref: PictureRecorder);
|
9
|
+
dispose: () => void;
|
9
10
|
beginRecording(bounds: SkRect): JsiSkCanvas;
|
10
11
|
finishRecordingAsPicture(): JsiSkPicture;
|
11
12
|
}
|
@@ -4,6 +4,7 @@ import { BaseHostObject } from "./Host";
|
|
4
4
|
export declare class JsiSkPoint extends BaseHostObject<Point, "Point"> implements SkPoint {
|
5
5
|
static fromValue(point: SkPoint): Float32Array;
|
6
6
|
constructor(CanvasKit: CanvasKit, ref: Point);
|
7
|
+
dispose: () => void;
|
7
8
|
get x(): number;
|
8
9
|
get y(): number;
|
9
10
|
}
|
@@ -3,6 +3,7 @@ import type { SkRect, SkRRect } from "../types";
|
|
3
3
|
import { BaseHostObject } from "./Host";
|
4
4
|
import { JsiSkRect } from "./JsiSkRect";
|
5
5
|
export declare class JsiSkRRect extends BaseHostObject<RRect, "RRect"> implements SkRRect {
|
6
|
+
dispose: () => void;
|
6
7
|
static fromValue(CanvasKit: CanvasKit, rect: SkRRect): Float32Array;
|
7
8
|
constructor(CanvasKit: CanvasKit, rect: SkRect, rx: number, ry: number);
|
8
9
|
get rx(): number;
|
@@ -3,6 +3,7 @@ import type { SkRect } from "../types";
|
|
3
3
|
import { BaseHostObject } from "./Host";
|
4
4
|
export declare class JsiSkRect extends BaseHostObject<Rect, "Rect"> implements SkRect {
|
5
5
|
static fromValue(CanvasKit: CanvasKit, rect: SkRect): Float32Array;
|
6
|
+
dispose: () => void;
|
6
7
|
constructor(CanvasKit: CanvasKit, ref: Rect);
|
7
8
|
get x(): number;
|
8
9
|
get y(): number;
|
@@ -6,6 +6,7 @@ import { JsiSkShader } from "./JsiSkShader";
|
|
6
6
|
export declare class JsiSkRuntimeEffect extends HostObject<RuntimeEffect, "RuntimeEffect"> implements SkRuntimeEffect {
|
7
7
|
private sksl;
|
8
8
|
constructor(CanvasKit: CanvasKit, ref: RuntimeEffect, sksl: string);
|
9
|
+
dispose: () => void;
|
9
10
|
source(): string;
|
10
11
|
makeShader(uniforms: number[], localMatrix?: SkMatrix): JsiSkShader;
|
11
12
|
makeShaderWithChildren(uniforms: number[], children?: SkShader[], localMatrix?: SkMatrix): JsiSkShader;
|
@@ -3,6 +3,7 @@ import type { SkCanvas, SkImage, SkRect, SkSurface } from "../types";
|
|
3
3
|
import { HostObject } from "./Host";
|
4
4
|
export declare class JsiSkSurface extends HostObject<Surface, "Surface"> implements SkSurface {
|
5
5
|
constructor(CanvasKit: CanvasKit, ref: Surface);
|
6
|
+
dispose: () => void;
|
6
7
|
flush(): void;
|
7
8
|
getCanvas(): SkCanvas;
|
8
9
|
makeImageSnapshot(bounds?: SkRect): SkImage;
|
@@ -4,6 +4,7 @@ import { HostObject } from "./Host";
|
|
4
4
|
import { JsiSkRect } from "./JsiSkRect";
|
5
5
|
export declare class JsiSkVertices extends HostObject<Vertices, "Vertices"> implements SkVertices {
|
6
6
|
constructor(CanvasKit: CanvasKit, ref: Vertices);
|
7
|
+
dispose: () => void;
|
7
8
|
bounds(): JsiSkRect;
|
8
9
|
uniqueID(): number;
|
9
10
|
}
|
@@ -2,6 +2,7 @@ import type { ViewProps } from "react-native";
|
|
2
2
|
import type { GroupProps, RenderNode } from "../dom/types";
|
3
3
|
import type { SkCanvas, SkImage, SkPicture, SkRect, SkSize } from "../skia/types";
|
4
4
|
import type { SkiaMutableValue, SkiaValue } from "../values";
|
5
|
+
import type { SharedValueType } from "../renderer/processors/Animations/Animations";
|
5
6
|
export declare type DrawMode = "continuous" | "default";
|
6
7
|
export declare type NativeSkiaViewProps = ViewProps & {
|
7
8
|
mode?: DrawMode;
|
@@ -70,7 +71,7 @@ export interface SkiaBaseViewProps extends ViewProps {
|
|
70
71
|
* Pass an animated value to the onSize property to get updates when
|
71
72
|
* the Skia view is resized.
|
72
73
|
*/
|
73
|
-
onSize?: SkiaMutableValue<SkSize>;
|
74
|
+
onSize?: SkiaMutableValue<SkSize> | SharedValueType<SkSize>;
|
74
75
|
}
|
75
76
|
export interface SkiaDrawViewProps extends SkiaBaseViewProps {
|
76
77
|
/**
|
package/package.json
CHANGED
package/src/renderer/Canvas.tsx
CHANGED
@@ -17,9 +17,11 @@ import { Skia } from "../skia/Skia";
|
|
17
17
|
import type { TouchHandler, SkiaBaseViewProps } from "../views";
|
18
18
|
import type { SkiaValue } from "../values/types";
|
19
19
|
import { JsiDrawingContext } from "../dom/types";
|
20
|
+
import { useValue } from "../values";
|
20
21
|
|
21
22
|
import { SkiaRoot } from "./Reconciler";
|
22
23
|
import { NATIVE_DOM } from "./HostComponents";
|
24
|
+
import { isValue } from "./processors";
|
23
25
|
|
24
26
|
export const useCanvasRef = () => useRef<SkiaDomView>(null);
|
25
27
|
|
@@ -31,9 +33,27 @@ export interface CanvasProps extends SkiaBaseViewProps {
|
|
31
33
|
|
32
34
|
export const Canvas = forwardRef<SkiaDomView, CanvasProps>(
|
33
35
|
(
|
34
|
-
{
|
36
|
+
{
|
37
|
+
children,
|
38
|
+
style,
|
39
|
+
debug,
|
40
|
+
mode,
|
41
|
+
onTouch,
|
42
|
+
onSize: onSizeReanimatedOrSkia,
|
43
|
+
...props
|
44
|
+
},
|
35
45
|
forwardedRef
|
36
46
|
) => {
|
47
|
+
const size = useValue({ width: 0, height: 0 });
|
48
|
+
const onSize = isValue(onSizeReanimatedOrSkia)
|
49
|
+
? onSizeReanimatedOrSkia
|
50
|
+
: size;
|
51
|
+
useEffect(() => {
|
52
|
+
if (!isValue(onSizeReanimatedOrSkia) && onSizeReanimatedOrSkia) {
|
53
|
+
return size.addListener((v) => (onSizeReanimatedOrSkia.value = v));
|
54
|
+
}
|
55
|
+
return undefined;
|
56
|
+
}, [onSizeReanimatedOrSkia, size]);
|
37
57
|
const innerRef = useCanvasRef();
|
38
58
|
const ref = useCombinedRefs(forwardedRef, innerRef);
|
39
59
|
const redraw = useCallback(() => {
|
package/src/skia/core/Data.ts
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import { useEffect, useRef, useState } from "react";
|
2
2
|
|
3
3
|
import { Skia } from "../Skia";
|
4
|
-
import type { SkData, DataSourceParam,
|
4
|
+
import type { SkData, DataSourceParam, BaseSkJSIInstance } from "../types";
|
5
5
|
import { Platform } from "../../Platform";
|
6
6
|
|
7
7
|
const factoryWrapper = <T>(
|
@@ -37,7 +37,7 @@ const loadData = <T>(
|
|
37
37
|
);
|
38
38
|
}
|
39
39
|
};
|
40
|
-
const useLoading = <T extends
|
40
|
+
const useLoading = <T extends BaseSkJSIInstance>(
|
41
41
|
source: DataSourceParam,
|
42
42
|
loader: () => Promise<T | null>
|
43
43
|
) => {
|
@@ -61,7 +61,7 @@ const useLoading = <T extends JsiDisposable>(
|
|
61
61
|
return data;
|
62
62
|
};
|
63
63
|
|
64
|
-
export const useRawData = <T extends
|
64
|
+
export const useRawData = <T extends BaseSkJSIInstance>(
|
65
65
|
source: DataSourceParam,
|
66
66
|
factory: (data: SkData) => T | null,
|
67
67
|
onError?: (err: Error) => void
|
@@ -1,6 +1,6 @@
|
|
1
|
-
import type {
|
1
|
+
import type { SkJSIInstance } from "../JsiInstance";
|
2
2
|
|
3
|
-
export type SkData = SkJSIInstance<"Data"
|
3
|
+
export type SkData = SkJSIInstance<"Data">;
|
4
4
|
|
5
5
|
type RNModule = number;
|
6
6
|
type ESModule = {
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import type { SkMatrix } from "../Matrix";
|
2
|
-
import type {
|
2
|
+
import type { SkJSIInstance } from "../JsiInstance";
|
3
3
|
import type { TileMode } from "../ImageFilter";
|
4
4
|
import type { SkShader } from "../Shader";
|
5
5
|
|
@@ -20,7 +20,7 @@ export enum ImageFormat {
|
|
20
20
|
WEBP = 6,
|
21
21
|
}
|
22
22
|
|
23
|
-
export interface SkImage extends SkJSIInstance<"Image"
|
23
|
+
export interface SkImage extends SkJSIInstance<"Image"> {
|
24
24
|
/**
|
25
25
|
* Returns the possibly scaled height of the image.
|
26
26
|
*/
|
@@ -1,7 +1,7 @@
|
|
1
|
-
export interface
|
2
|
-
|
1
|
+
export interface BaseSkJSIInstance {
|
2
|
+
dispose: () => void;
|
3
3
|
}
|
4
4
|
|
5
|
-
export interface
|
6
|
-
|
5
|
+
export interface SkJSIInstance<T extends string> extends BaseSkJSIInstance {
|
6
|
+
__typename__: T;
|
7
7
|
}
|
@@ -1,6 +1,6 @@
|
|
1
|
-
import type {
|
1
|
+
import type { SkJSIInstance } from "../JsiInstance";
|
2
2
|
|
3
|
-
export interface SkSVG extends SkJSIInstance<"SVG"
|
3
|
+
export interface SkSVG extends SkJSIInstance<"SVG"> {
|
4
4
|
width(): number;
|
5
5
|
height(): number;
|
6
6
|
}
|
@@ -1,3 +1,3 @@
|
|
1
|
-
import type {
|
1
|
+
import type { SkJSIInstance } from "../JsiInstance";
|
2
2
|
|
3
|
-
export type SkTypeface = SkJSIInstance<"Typeface"
|
3
|
+
export type SkTypeface = SkJSIInstance<"Typeface">;
|
package/src/skia/web/Host.ts
CHANGED
@@ -11,7 +11,7 @@ export class JsiSkData extends HostObject<Data, "Data"> implements SkData {
|
|
11
11
|
super(CanvasKit, ref, "Data");
|
12
12
|
}
|
13
13
|
|
14
|
-
dispose() {
|
15
|
-
// Not implemented in data
|
16
|
-
}
|
14
|
+
dispose = () => {
|
15
|
+
// Not implemented in data - since data is a raw ArrayBuffer
|
16
|
+
};
|
17
17
|
}
|
@@ -20,6 +20,10 @@ export class JsiSkFont extends HostObject<Font, "Font"> implements SkFont {
|
|
20
20
|
super(CanvasKit, ref, "Font");
|
21
21
|
}
|
22
22
|
|
23
|
+
dispose = () => {
|
24
|
+
this.ref.delete();
|
25
|
+
};
|
26
|
+
|
23
27
|
getTextWidth(text: string, paint?: SkPaint | undefined) {
|
24
28
|
const ids = this.getGlyphIDs(text);
|
25
29
|
const widths = this.getGlyphWidths(ids, paint);
|
@@ -110,9 +110,9 @@ export class JsiSkImage extends HostObject<Image, "Image"> implements SkImage {
|
|
110
110
|
return toBase64String(bytes);
|
111
111
|
}
|
112
112
|
|
113
|
-
dispose() {
|
113
|
+
dispose = () => {
|
114
114
|
this.ref.delete();
|
115
|
-
}
|
115
|
+
};
|
116
116
|
|
117
117
|
makeNonTextureImage(): SkImage {
|
118
118
|
return new JsiSkImage(
|
@@ -12,6 +12,10 @@ export class JsiSkMatrix
|
|
12
12
|
super(CanvasKit, ref, "Matrix");
|
13
13
|
}
|
14
14
|
|
15
|
+
dispose = () => {
|
16
|
+
// Do nothing - the matrix is represenetd by a Float32Array
|
17
|
+
};
|
18
|
+
|
15
19
|
concat(matrix: SkMatrix) {
|
16
20
|
this.ref.set(
|
17
21
|
this.CanvasKit.Matrix.multiply(this.ref, JsiSkMatrix.fromValue(matrix))
|