@shopify/react-native-skia 0.1.158 → 0.1.159
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/CMakeLists.txt +35 -11
- package/android/build.gradle +21 -25
- package/android/cpp/jni/JniLoad.cpp +2 -0
- package/android/cpp/jni/include/JniSkiaDomView.h +89 -0
- package/android/cpp/rnskia-android/SkiaOpenGLRenderer.cpp +4 -3
- package/android/cpp/rnskia-android/SkiaOpenGLRenderer.h +4 -3
- package/android/src/main/java/com/shopify/reactnative/skia/RNSkiaPackage.java +2 -1
- package/android/src/main/java/com/shopify/reactnative/skia/SkiaDomView.java +45 -0
- package/android/src/main/java/com/shopify/reactnative/skia/SkiaDomViewManager.java +64 -0
- package/cpp/api/JsiSkHostObjects.h +6 -0
- package/cpp/api/JsiSkImageFilterFactory.h +1 -1
- package/cpp/api/JsiSkPaint.h +9 -2
- package/cpp/api/JsiSkPath.h +1 -0
- package/cpp/api/JsiSkRuntimeEffect.h +36 -36
- package/cpp/jsi/JsiHostObject.cpp +16 -28
- package/cpp/jsi/JsiHostObject.h +127 -7
- package/cpp/jsi/JsiValue.cpp +346 -0
- package/cpp/jsi/JsiValue.h +222 -0
- package/cpp/jsi/JsiValueWrapper.h +33 -5
- package/cpp/rnskia/RNSkDomView.cpp +220 -0
- package/cpp/rnskia/RNSkDomView.h +140 -0
- package/cpp/rnskia/RNSkJsView.cpp +0 -4
- package/cpp/rnskia/RNSkJsView.h +6 -4
- package/cpp/rnskia/RNSkManager.cpp +7 -0
- package/cpp/rnskia/RNSkPictureView.h +5 -8
- package/cpp/rnskia/RNSkView.h +113 -5
- package/cpp/rnskia/dom/JsiDomApi.h +167 -0
- package/cpp/rnskia/dom/base/BaseNodeProp.h +72 -0
- package/cpp/rnskia/dom/base/DerivedNodeProp.h +187 -0
- package/cpp/rnskia/dom/base/DrawingContext.cpp +227 -0
- package/cpp/rnskia/dom/base/DrawingContext.h +136 -0
- package/cpp/rnskia/dom/base/JsiDependencyManager.h +294 -0
- package/cpp/rnskia/dom/base/JsiDomDeclarationNode.h +176 -0
- package/cpp/rnskia/dom/base/JsiDomDrawingNode.h +50 -0
- package/cpp/rnskia/dom/base/JsiDomNode.h +361 -0
- package/cpp/rnskia/dom/base/JsiDomRenderNode.h +267 -0
- package/cpp/rnskia/dom/base/NodeProp.h +130 -0
- package/cpp/rnskia/dom/base/NodePropsContainer.h +119 -0
- package/cpp/rnskia/dom/nodes/JsiBackdropFilterNode.h +38 -0
- package/cpp/rnskia/dom/nodes/JsiBlendNode.h +112 -0
- package/cpp/rnskia/dom/nodes/JsiBlurMaskNode.h +78 -0
- package/cpp/rnskia/dom/nodes/JsiBoxNode.h +104 -0
- package/cpp/rnskia/dom/nodes/JsiBoxShadowNode.h +33 -0
- package/cpp/rnskia/dom/nodes/JsiCircleNode.h +38 -0
- package/cpp/rnskia/dom/nodes/JsiColorFilterNodes.h +192 -0
- package/cpp/rnskia/dom/nodes/JsiCustomDrawingNode.h +123 -0
- package/cpp/rnskia/dom/nodes/JsiDiffRectNode.h +42 -0
- package/cpp/rnskia/dom/nodes/JsiFillNode.h +22 -0
- package/cpp/rnskia/dom/nodes/JsiGlyphsNode.h +56 -0
- package/cpp/rnskia/dom/nodes/JsiGroupNode.h +26 -0
- package/cpp/rnskia/dom/nodes/JsiImageFilterNodes.h +415 -0
- package/cpp/rnskia/dom/nodes/JsiImageNode.h +34 -0
- package/cpp/rnskia/dom/nodes/JsiImageSvgNode.h +44 -0
- package/cpp/rnskia/dom/nodes/JsiLayerNode.h +64 -0
- package/cpp/rnskia/dom/nodes/JsiLineNode.h +43 -0
- package/cpp/rnskia/dom/nodes/JsiOvalNode.h +34 -0
- package/cpp/rnskia/dom/nodes/JsiPaintNode.h +77 -0
- package/cpp/rnskia/dom/nodes/JsiPatchNode.h +54 -0
- package/cpp/rnskia/dom/nodes/JsiPathEffectNodes.h +315 -0
- package/cpp/rnskia/dom/nodes/JsiPathNode.h +181 -0
- package/cpp/rnskia/dom/nodes/JsiPictureNode.h +32 -0
- package/cpp/rnskia/dom/nodes/JsiPointsNode.h +51 -0
- package/cpp/rnskia/dom/nodes/JsiRRectNode.h +34 -0
- package/cpp/rnskia/dom/nodes/JsiRectNode.h +34 -0
- package/cpp/rnskia/dom/nodes/JsiShaderNodes.h +517 -0
- package/cpp/rnskia/dom/nodes/JsiTextBlobNode.h +47 -0
- package/cpp/rnskia/dom/nodes/JsiTextNode.h +54 -0
- package/cpp/rnskia/dom/nodes/JsiTextPathNode.h +32 -0
- package/cpp/rnskia/dom/nodes/JsiVerticesNode.h +43 -0
- package/cpp/rnskia/dom/props/BezierProps.h +63 -0
- package/cpp/rnskia/dom/props/BlendModeProp.h +101 -0
- package/cpp/rnskia/dom/props/BoxShadowProps.h +61 -0
- package/cpp/rnskia/dom/props/CircleProp.h +46 -0
- package/cpp/rnskia/dom/props/ClipProp.h +62 -0
- package/cpp/rnskia/dom/props/ColorProp.h +80 -0
- package/cpp/rnskia/dom/props/DrawingProp.h +33 -0
- package/cpp/rnskia/dom/props/FontProp.h +34 -0
- package/cpp/rnskia/dom/props/GlyphsProp.h +53 -0
- package/cpp/rnskia/dom/props/ImageProps.h +173 -0
- package/cpp/rnskia/dom/props/LayerProp.h +50 -0
- package/cpp/rnskia/dom/props/MatrixProp.h +33 -0
- package/cpp/rnskia/dom/props/NumbersProp.h +63 -0
- package/cpp/rnskia/dom/props/PaintProps.h +172 -0
- package/cpp/rnskia/dom/props/PathProp.h +55 -0
- package/cpp/rnskia/dom/props/PictureProp.h +38 -0
- package/cpp/rnskia/dom/props/PointProp.h +72 -0
- package/cpp/rnskia/dom/props/PointsProp.h +83 -0
- package/cpp/rnskia/dom/props/RRectProp.h +134 -0
- package/cpp/rnskia/dom/props/RadiusProp.h +43 -0
- package/cpp/rnskia/dom/props/RectProp.h +118 -0
- package/cpp/rnskia/dom/props/StrokeProps.h +75 -0
- package/cpp/rnskia/dom/props/SvgProp.h +37 -0
- package/cpp/rnskia/dom/props/TextBlobProp.h +128 -0
- package/cpp/rnskia/dom/props/TileModeProp.h +50 -0
- package/cpp/rnskia/dom/props/TransformProp.h +80 -0
- package/cpp/rnskia/dom/props/TransformsProps.h +68 -0
- package/cpp/rnskia/dom/props/UniformsProp.h +194 -0
- package/cpp/rnskia/dom/props/VertexModeProp.h +47 -0
- package/cpp/rnskia/dom/props/VerticesProps.h +67 -0
- package/cpp/rnskia/values/RNSkReadonlyValue.h +13 -4
- package/cpp/skia/include/android/SkAndroidFrameworkUtils.h +35 -1
- package/cpp/skia/include/codec/SkAndroidCodec.h +17 -1
- package/cpp/skia/include/codec/SkCodec.h +8 -5
- package/cpp/skia/include/core/SkAnnotation.h +2 -0
- package/cpp/skia/include/core/SkBitmap.h +52 -1
- package/cpp/skia/include/core/SkBlendMode.h +2 -0
- package/cpp/skia/include/core/SkCanvas.h +52 -31
- package/cpp/skia/include/core/SkCapabilities.h +44 -0
- package/cpp/skia/include/core/SkColor.h +7 -0
- package/cpp/skia/include/core/SkColorFilter.h +37 -0
- package/cpp/skia/include/core/SkColorSpace.h +1 -1
- package/cpp/skia/include/core/SkFont.h +4 -0
- package/cpp/skia/include/core/SkFontMgr.h +3 -0
- package/cpp/skia/include/core/SkGraphics.h +9 -0
- package/cpp/skia/include/core/SkImage.h +77 -17
- package/cpp/skia/include/core/SkImageEncoder.h +5 -3
- package/cpp/skia/include/core/SkImageGenerator.h +27 -17
- package/cpp/skia/include/core/SkM44.h +1 -0
- package/cpp/skia/include/core/SkMesh.h +120 -34
- package/cpp/skia/include/core/SkMilestone.h +1 -1
- package/cpp/skia/include/core/SkOverdrawCanvas.h +2 -1
- package/cpp/skia/include/core/SkPaint.h +15 -2
- package/cpp/skia/include/core/SkPath.h +4 -0
- package/cpp/skia/include/core/SkPathBuilder.h +1 -1
- package/cpp/skia/include/core/SkPicture.h +0 -3
- package/cpp/skia/include/core/SkPictureRecorder.h +0 -2
- package/cpp/skia/include/core/SkPixmap.h +19 -0
- package/cpp/skia/include/core/SkRasterHandleAllocator.h +3 -1
- package/cpp/skia/include/core/SkRect.h +11 -4
- package/cpp/skia/include/core/SkRefCnt.h +13 -1
- package/cpp/skia/include/core/SkRegion.h +6 -0
- package/cpp/skia/include/core/SkSamplingOptions.h +8 -6
- package/cpp/skia/include/core/SkScalar.h +6 -25
- package/cpp/skia/include/core/SkShader.h +20 -12
- package/cpp/skia/include/core/SkSpan.h +51 -19
- package/cpp/skia/include/core/SkStream.h +2 -2
- package/cpp/skia/include/core/SkString.h +11 -3
- package/cpp/skia/include/core/SkSurface.h +85 -8
- package/cpp/skia/include/core/SkTextBlob.h +5 -2
- package/cpp/skia/include/core/SkTypes.h +11 -10
- package/cpp/skia/include/docs/SkPDFDocument.h +0 -5
- package/cpp/skia/include/effects/Sk1DPathEffect.h +6 -1
- package/cpp/skia/include/effects/Sk2DPathEffect.h +4 -1
- package/cpp/skia/include/effects/SkColorMatrix.h +1 -0
- package/cpp/skia/include/effects/SkColorMatrixFilter.h +5 -8
- package/cpp/skia/include/effects/SkCornerPathEffect.h +5 -1
- package/cpp/skia/include/effects/SkDashPathEffect.h +5 -1
- package/cpp/skia/include/effects/SkGradientShader.h +68 -38
- package/cpp/skia/include/effects/SkHighContrastFilter.h +5 -1
- package/cpp/skia/include/effects/SkImageFilters.h +5 -4
- package/cpp/skia/include/effects/SkLumaColorFilter.h +4 -1
- package/cpp/skia/include/effects/SkOpPathEffect.h +6 -2
- package/cpp/skia/include/effects/SkOverdrawColorFilter.h +5 -2
- package/cpp/skia/include/effects/SkRuntimeEffect.h +54 -62
- package/cpp/skia/include/effects/SkShaderMaskFilter.h +3 -1
- package/cpp/skia/include/effects/SkTableColorFilter.h +8 -21
- package/cpp/skia/include/effects/SkTableMaskFilter.h +5 -1
- package/cpp/skia/include/effects/SkTrimPathEffect.h +5 -1
- package/cpp/skia/include/encode/SkEncoder.h +17 -0
- package/cpp/skia/include/encode/SkWebpEncoder.h +17 -0
- package/cpp/skia/include/gpu/GpuTypes.h +18 -0
- package/cpp/skia/include/gpu/GrBackendSurface.h +38 -17
- package/cpp/skia/include/gpu/GrBackendSurfaceMutableState.h +6 -71
- package/cpp/skia/include/gpu/GrContextOptions.h +1 -1
- package/cpp/skia/include/gpu/GrContextThreadSafeProxy.h +10 -9
- package/cpp/skia/include/gpu/GrDirectContext.h +42 -22
- package/cpp/skia/include/gpu/GrRecordingContext.h +6 -3
- package/cpp/skia/include/gpu/GrTypes.h +11 -11
- package/cpp/skia/include/gpu/MutableTextureState.h +122 -0
- package/cpp/skia/include/gpu/gl/GrGLFunctions.h +1 -0
- package/cpp/skia/include/gpu/gl/GrGLInterface.h +1 -0
- package/cpp/skia/include/gpu/graphite/BackendTexture.h +7 -0
- package/cpp/skia/include/gpu/graphite/CombinationBuilder.h +195 -0
- package/cpp/skia/include/gpu/graphite/Context.h +47 -55
- package/cpp/skia/include/gpu/graphite/ContextOptions.h +85 -0
- package/cpp/skia/include/gpu/graphite/GraphiteTypes.h +1 -17
- package/cpp/skia/include/gpu/graphite/ImageProvider.h +61 -0
- package/cpp/skia/include/gpu/graphite/Recorder.h +87 -8
- package/cpp/skia/include/gpu/graphite/Recording.h +19 -9
- package/cpp/skia/include/gpu/graphite/TextureInfo.h +40 -8
- package/cpp/skia/include/gpu/graphite/dawn/DawnBackendContext.h +25 -0
- package/cpp/skia/include/gpu/graphite/mtl/MtlBackendContext.h +3 -2
- package/cpp/skia/include/gpu/graphite/vk/VulkanGraphiteTypes.h +69 -0
- package/cpp/skia/include/gpu/mtl/MtlMemoryAllocator.h +39 -0
- package/cpp/skia/include/gpu/vk/GrVkBackendContext.h +21 -19
- package/cpp/skia/include/gpu/vk/GrVkExtensions.h +2 -50
- package/cpp/skia/include/gpu/vk/GrVkMemoryAllocator.h +2 -127
- package/cpp/skia/include/gpu/vk/GrVkTypes.h +5 -43
- package/cpp/skia/include/gpu/vk/VulkanBackendContext.h +46 -0
- package/cpp/skia/include/gpu/vk/VulkanExtensions.h +67 -0
- package/cpp/skia/include/gpu/vk/VulkanMemoryAllocator.h +116 -0
- package/cpp/skia/include/gpu/vk/VulkanTypes.h +59 -0
- package/cpp/skia/include/pathops/SkPathOps.h +1 -1
- package/cpp/skia/include/private/SkColorData.h +10 -40
- package/cpp/skia/include/private/SkEncodedInfo.h +9 -3
- package/cpp/skia/include/private/SkFloatingPoint.h +9 -6
- package/cpp/skia/include/private/SkHalf.h +5 -52
- package/cpp/skia/include/private/SkMacros.h +1 -1
- package/cpp/skia/include/private/SkMalloc.h +4 -0
- package/cpp/skia/include/private/SkPathRef.h +10 -10
- package/cpp/skia/include/private/SkSLModifiers.h +59 -23
- package/cpp/skia/include/private/SkSLProgramKind.h +1 -0
- package/cpp/skia/include/private/SkSLSymbol.h +7 -3
- package/cpp/skia/include/private/SkStringView.h +4 -0
- package/cpp/skia/include/private/SkTArray.h +21 -7
- package/cpp/skia/include/private/SkTDArray.h +173 -285
- package/cpp/skia/include/private/SkTHash.h +33 -32
- package/cpp/skia/include/private/SkTemplates.h +24 -26
- package/cpp/skia/include/private/SkVx.h +218 -135
- package/cpp/skia/include/private/chromium/GrSlug.h +3 -65
- package/cpp/skia/include/private/chromium/SkChromeRemoteGlyphCache.h +6 -3
- package/cpp/skia/include/private/chromium/Slug.h +76 -0
- package/cpp/skia/include/private/gpu/ganesh/GrTypesPriv.h +6 -1
- package/cpp/skia/include/private/gpu/ganesh/GrVkTypesPriv.h +5 -39
- package/cpp/skia/include/private/gpu/graphite/VulkanGraphiteTypesPriv.h +63 -0
- package/cpp/skia/include/{gpu/vk/GrVkVulkan.h → private/gpu/vk/SkiaVulkan.h} +2 -2
- package/cpp/skia/include/private/gpu/vk/VulkanTypesPriv.h +57 -0
- package/cpp/skia/include/sksl/DSL.h +0 -1
- package/cpp/skia/include/sksl/DSLBlock.h +4 -18
- package/cpp/skia/include/sksl/DSLCase.h +2 -8
- package/cpp/skia/include/sksl/DSLCore.h +8 -15
- package/cpp/skia/include/sksl/DSLExpression.h +51 -142
- package/cpp/skia/include/sksl/DSLFunction.h +7 -15
- package/cpp/skia/include/sksl/DSLModifiers.h +5 -2
- package/cpp/skia/include/sksl/DSLStatement.h +4 -39
- package/cpp/skia/include/sksl/DSLSymbols.h +1 -11
- package/cpp/skia/include/sksl/DSLType.h +20 -12
- package/cpp/skia/include/sksl/DSLVar.h +56 -146
- package/cpp/skia/include/sksl/SkSLErrorReporter.h +2 -15
- package/cpp/skia/include/sksl/SkSLOperator.h +62 -59
- package/cpp/skia/include/sksl/SkSLPosition.h +2 -0
- package/cpp/skia/include/sksl/SkSLVersion.h +27 -0
- package/cpp/skia/include/svg/SkSVGCanvas.h +1 -0
- package/cpp/skia/include/utils/SkAnimCodecPlayer.h +1 -1
- package/cpp/skia/include/utils/SkBase64.h +2 -0
- package/cpp/skia/include/utils/SkCustomTypeface.h +24 -11
- package/cpp/skia/include/utils/SkEventTracer.h +12 -1
- package/cpp/skia/include/utils/SkNWayCanvas.h +11 -4
- package/cpp/skia/include/utils/SkPaintFilterCanvas.h +9 -4
- package/cpp/skia/include/utils/SkParse.h +3 -0
- package/cpp/skia/include/utils/SkShadowUtils.h +2 -0
- package/cpp/skia/include/utils/SkTextUtils.h +2 -1
- package/cpp/skia/{include/third_party → modules}/skcms/skcms.h +10 -0
- package/cpp/skia/modules/skcms/skcms_internal.h +56 -0
- package/cpp/skia/modules/skcms/src/Transform_inl.h +1609 -0
- package/cpp/skia/modules/skparagraph/include/DartTypes.h +153 -0
- package/cpp/skia/modules/skparagraph/include/FontArguments.h +46 -0
- package/cpp/skia/modules/skparagraph/include/FontCollection.h +84 -0
- package/cpp/skia/modules/skparagraph/include/Metrics.h +98 -0
- package/cpp/skia/modules/skparagraph/include/Paragraph.h +111 -0
- package/cpp/skia/modules/skparagraph/include/ParagraphBuilder.h +69 -0
- package/cpp/skia/modules/skparagraph/include/ParagraphCache.h +77 -0
- package/cpp/skia/modules/skparagraph/include/ParagraphStyle.h +143 -0
- package/cpp/skia/modules/skparagraph/include/TextShadow.h +30 -0
- package/cpp/skia/modules/skparagraph/include/TextStyle.h +352 -0
- package/cpp/skia/modules/skparagraph/include/TypefaceFontProvider.h +81 -0
- package/cpp/skia/modules/svg/include/SkSVGAttributeParser.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGTypes.h +3 -3
- package/cpp/skia/src/core/SkLRUCache.h +126 -0
- package/cpp/skia/src/core/SkTInternalLList.h +302 -0
- package/cpp/utils/RNSkTimingInfo.h +1 -0
- package/ios/RNSkia-iOS/RNSkMetalCanvasProvider.h +15 -4
- package/ios/RNSkia-iOS/RNSkMetalCanvasProvider.mm +40 -54
- package/ios/RNSkia-iOS/SkiaDomViewManager.h +8 -0
- package/ios/RNSkia-iOS/SkiaDomViewManager.mm +51 -0
- package/lib/commonjs/dom/nodes/JsiSkDOM.js +56 -56
- package/lib/commonjs/dom/nodes/JsiSkDOM.js.map +1 -1
- package/lib/commonjs/dom/nodes/RenderNode.js +1 -1
- package/lib/commonjs/dom/nodes/RenderNode.js.map +1 -1
- package/lib/commonjs/renderer/Canvas.js +19 -63
- package/lib/commonjs/renderer/Canvas.js.map +1 -1
- package/lib/commonjs/renderer/DependencyManager.js +0 -5
- package/lib/commonjs/renderer/DependencyManager.js.map +1 -1
- package/lib/commonjs/renderer/HostComponents.js.map +1 -1
- package/lib/commonjs/renderer/useCanvas.js +4 -18
- package/lib/commonjs/renderer/useCanvas.js.map +1 -1
- package/lib/commonjs/views/SkiaBaseWebView.js +7 -0
- package/lib/commonjs/views/SkiaBaseWebView.js.map +1 -1
- package/lib/commonjs/views/SkiaDomView.js +152 -0
- package/lib/commonjs/views/SkiaDomView.js.map +1 -0
- package/lib/commonjs/views/SkiaDomView.web.js +55 -0
- package/lib/commonjs/views/SkiaDomView.web.js.map +1 -0
- package/lib/commonjs/views/SkiaPictureView.js +16 -2
- package/lib/commonjs/views/SkiaPictureView.js.map +1 -1
- package/lib/commonjs/views/SkiaView.js +17 -2
- package/lib/commonjs/views/SkiaView.js.map +1 -1
- package/lib/commonjs/views/index.js +13 -0
- package/lib/commonjs/views/index.js.map +1 -1
- package/lib/commonjs/views/types.js.map +1 -1
- package/lib/module/dom/nodes/JsiSkDOM.js +56 -56
- package/lib/module/dom/nodes/JsiSkDOM.js.map +1 -1
- package/lib/module/dom/nodes/RenderNode.js +1 -1
- package/lib/module/dom/nodes/RenderNode.js.map +1 -1
- package/lib/module/renderer/Canvas.js +20 -64
- package/lib/module/renderer/Canvas.js.map +1 -1
- package/lib/module/renderer/DependencyManager.js +0 -5
- package/lib/module/renderer/DependencyManager.js.map +1 -1
- package/lib/module/renderer/HostComponents.js.map +1 -1
- package/lib/module/renderer/useCanvas.js +2 -13
- package/lib/module/renderer/useCanvas.js.map +1 -1
- package/lib/module/views/SkiaBaseWebView.js +7 -0
- package/lib/module/views/SkiaBaseWebView.js.map +1 -1
- package/lib/module/views/SkiaDomView.js +128 -0
- package/lib/module/views/SkiaDomView.js.map +1 -0
- package/lib/module/views/SkiaDomView.web.js +41 -0
- package/lib/module/views/SkiaDomView.web.js.map +1 -0
- package/lib/module/views/SkiaPictureView.js +14 -2
- package/lib/module/views/SkiaPictureView.js.map +1 -1
- package/lib/module/views/SkiaView.js +15 -2
- package/lib/module/views/SkiaView.js.map +1 -1
- package/lib/module/views/index.js +1 -0
- package/lib/module/views/index.js.map +1 -1
- package/lib/module/views/types.js.map +1 -1
- package/lib/typescript/src/dom/nodes/JsiSkDOM.d.ts +57 -64
- package/lib/typescript/src/renderer/Canvas.d.ts +5 -8
- package/lib/typescript/src/renderer/DependencyManager.d.ts +0 -2
- package/lib/typescript/src/renderer/HostComponents.d.ts +66 -3
- package/lib/typescript/src/renderer/useCanvas.d.ts +0 -6
- package/lib/typescript/src/views/SkiaBaseWebView.d.ts +4 -0
- package/lib/typescript/src/views/SkiaDomView.d.ts +31 -0
- package/lib/typescript/src/views/SkiaDomView.web.d.ts +7 -0
- package/lib/typescript/src/views/index.d.ts +1 -0
- package/lib/typescript/src/views/types.d.ts +12 -2
- package/libs/android/arm64-v8a/libskia.a +0 -0
- package/libs/android/arm64-v8a/libskottie.a +0 -0
- package/libs/android/arm64-v8a/libskparagraph.a +0 -0
- package/libs/android/arm64-v8a/libsksg.a +0 -0
- package/libs/android/arm64-v8a/libskshaper.a +0 -0
- package/libs/android/arm64-v8a/libskunicode.a +0 -0
- package/libs/android/arm64-v8a/libsvg.a +0 -0
- package/libs/android/armeabi-v7a/libskia.a +0 -0
- package/libs/android/armeabi-v7a/libskottie.a +0 -0
- package/libs/android/armeabi-v7a/libskparagraph.a +0 -0
- package/libs/android/armeabi-v7a/libsksg.a +0 -0
- package/libs/android/armeabi-v7a/libskshaper.a +0 -0
- package/libs/android/armeabi-v7a/libskunicode.a +0 -0
- package/libs/android/armeabi-v7a/libsvg.a +0 -0
- package/libs/android/x86/libskia.a +0 -0
- package/libs/android/x86/libskottie.a +0 -0
- package/libs/android/x86/libskparagraph.a +0 -0
- package/libs/android/x86/libsksg.a +0 -0
- package/libs/android/x86/libskshaper.a +0 -0
- package/libs/android/x86/libskunicode.a +0 -0
- package/libs/android/x86/libsvg.a +0 -0
- package/libs/android/x86_64/libskia.a +0 -0
- package/libs/android/x86_64/libskottie.a +0 -0
- package/libs/android/x86_64/libskparagraph.a +0 -0
- package/libs/android/x86_64/libsksg.a +0 -0
- package/libs/android/x86_64/libskshaper.a +0 -0
- package/libs/android/x86_64/libskunicode.a +0 -0
- package/libs/android/x86_64/libsvg.a +0 -0
- package/libs/ios/libskia.xcframework/ios-arm64_arm64e/libskia.a +0 -0
- package/libs/ios/libskia.xcframework/ios-arm64_arm64e_x86_64-simulator/libskia.a +0 -0
- package/libs/ios/libskottie.xcframework/ios-arm64_arm64e/libskottie.a +0 -0
- package/libs/ios/libskottie.xcframework/ios-arm64_arm64e_x86_64-simulator/libskottie.a +0 -0
- package/libs/ios/libskparagraph.xcframework/Info.plist +42 -0
- package/libs/ios/libskparagraph.xcframework/ios-arm64_arm64e/libskparagraph.a +0 -0
- package/libs/ios/libskparagraph.xcframework/ios-arm64_arm64e_x86_64-simulator/libskparagraph.a +0 -0
- package/libs/ios/libsksg.xcframework/Info.plist +5 -5
- package/libs/ios/libsksg.xcframework/ios-arm64_arm64e/libsksg.a +0 -0
- package/libs/ios/libsksg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsksg.a +0 -0
- package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e/libskshaper.a +0 -0
- package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e_x86_64-simulator/libskshaper.a +0 -0
- package/libs/ios/libskunicode.xcframework/Info.plist +42 -0
- package/libs/ios/libskunicode.xcframework/ios-arm64_arm64e/libskunicode.a +0 -0
- package/libs/ios/libskunicode.xcframework/ios-arm64_arm64e_x86_64-simulator/libskunicode.a +0 -0
- package/libs/ios/libsvg.xcframework/ios-arm64_arm64e/libsvg.a +0 -0
- package/libs/ios/libsvg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsvg.a +0 -0
- package/package.json +5 -3
- package/react-native-skia.podspec +3 -1
- package/src/dom/nodes/JsiSkDOM.ts +170 -56
- package/src/dom/nodes/RenderNode.ts +1 -1
- package/src/renderer/Canvas.tsx +32 -56
- package/src/renderer/DependencyManager.tsx +0 -5
- package/src/renderer/HostComponents.ts +152 -1
- package/src/renderer/useCanvas.ts +1 -15
- package/src/views/SkiaBaseWebView.tsx +4 -0
- package/src/views/SkiaDomView.tsx +120 -0
- package/src/views/SkiaDomView.web.tsx +37 -0
- package/src/views/SkiaPictureView.tsx +10 -2
- package/src/views/SkiaView.tsx +11 -3
- package/src/views/index.ts +1 -0
- package/src/views/types.ts +19 -2
- package/cpp/jsi/JsiSimpleValueWrapper.h +0 -99
- package/cpp/skia/include/c/sk_canvas.h +0 -159
- package/cpp/skia/include/c/sk_colorspace.h +0 -25
- package/cpp/skia/include/c/sk_data.h +0 -65
- package/cpp/skia/include/c/sk_image.h +0 -71
- package/cpp/skia/include/c/sk_imageinfo.h +0 -62
- package/cpp/skia/include/c/sk_maskfilter.h +0 -47
- package/cpp/skia/include/c/sk_matrix.h +0 -49
- package/cpp/skia/include/c/sk_paint.h +0 -145
- package/cpp/skia/include/c/sk_path.h +0 -102
- package/cpp/skia/include/c/sk_picture.h +0 -70
- package/cpp/skia/include/c/sk_shader.h +0 -143
- package/cpp/skia/include/c/sk_surface.h +0 -73
- package/cpp/skia/include/c/sk_types.h +0 -278
- package/cpp/skia/include/gpu/graphite/SkStuff.h +0 -47
- package/cpp/skia/include/private/SkNx.h +0 -430
- package/cpp/skia/include/private/SkNx_neon.h +0 -713
- package/cpp/skia/include/private/SkNx_sse.h +0 -823
- package/cpp/skia/include/sksl/DSLRuntimeEffects.h +0 -32
- package/cpp/skia/include/sksl/DSLWrapper.h +0 -77
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include "DerivedNodeProp.h"
|
|
4
|
+
#include "JsiSkPoint.h"
|
|
5
|
+
|
|
6
|
+
#include <memory>
|
|
7
|
+
#include <string>
|
|
8
|
+
#include <utility>
|
|
9
|
+
#include <vector>
|
|
10
|
+
|
|
11
|
+
#pragma clang diagnostic push
|
|
12
|
+
#pragma clang diagnostic ignored "-Wdocumentation"
|
|
13
|
+
|
|
14
|
+
#include <SkPoint.h>
|
|
15
|
+
|
|
16
|
+
#pragma clang diagnostic pop
|
|
17
|
+
|
|
18
|
+
namespace RNSkia {
|
|
19
|
+
|
|
20
|
+
class PointModeProp : public DerivedProp<SkCanvas::PointMode> {
|
|
21
|
+
public:
|
|
22
|
+
explicit PointModeProp(PropId name) : DerivedProp<SkCanvas::PointMode>() {
|
|
23
|
+
_pointModeProp = addProperty(std::make_shared<NodeProp>(name));
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
void updateDerivedValue() override {
|
|
27
|
+
if (_pointModeProp->isSet()) {
|
|
28
|
+
setDerivedValue(
|
|
29
|
+
getPointModeFromStringValue(_pointModeProp->value().getAsString()));
|
|
30
|
+
} else {
|
|
31
|
+
setDerivedValue(nullptr);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
private:
|
|
36
|
+
static SkCanvas::PointMode
|
|
37
|
+
getPointModeFromStringValue(const std::string &value) {
|
|
38
|
+
if (value == "points") {
|
|
39
|
+
return SkCanvas::PointMode::kPoints_PointMode;
|
|
40
|
+
} else if (value == "lines") {
|
|
41
|
+
return SkCanvas::PointMode::kLines_PointMode;
|
|
42
|
+
} else if (value == "polygon") {
|
|
43
|
+
return SkCanvas::PointMode::kPolygon_PointMode;
|
|
44
|
+
}
|
|
45
|
+
throw std::runtime_error(
|
|
46
|
+
"Expected valid point mode for Points node, got \"" + value + "\".");
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
NodeProp *_pointModeProp;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
class PointsProp : public DerivedProp<std::vector<SkPoint>> {
|
|
53
|
+
public:
|
|
54
|
+
explicit PointsProp(PropId name) : DerivedProp<std::vector<SkPoint>>() {
|
|
55
|
+
_pointsProp = addProperty(std::make_shared<NodeProp>(name));
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
void updateDerivedValue() override {
|
|
59
|
+
if (_pointsProp->isSet()) {
|
|
60
|
+
auto pointsArray = _pointsProp->value().getAsArray();
|
|
61
|
+
std::vector<SkPoint> points;
|
|
62
|
+
points.reserve(pointsArray.size());
|
|
63
|
+
for (size_t i = 0; i < pointsArray.size(); ++i) {
|
|
64
|
+
auto p = pointsArray[i];
|
|
65
|
+
auto point = PointProp::processValue(p);
|
|
66
|
+
if (point != EmptyPoint) {
|
|
67
|
+
points.push_back(point);
|
|
68
|
+
} else {
|
|
69
|
+
throw std::runtime_error(
|
|
70
|
+
"Expected array of points for points property.");
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
setDerivedValue(std::move(points));
|
|
74
|
+
} else {
|
|
75
|
+
setDerivedValue(nullptr);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
private:
|
|
80
|
+
NodeProp *_pointsProp;
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
} // namespace RNSkia
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include "JsiSkRRect.h"
|
|
4
|
+
#include "NodeProp.h"
|
|
5
|
+
#include "RectProp.h"
|
|
6
|
+
|
|
7
|
+
#include <memory>
|
|
8
|
+
|
|
9
|
+
#pragma clang diagnostic push
|
|
10
|
+
#pragma clang diagnostic ignored "-Wdocumentation"
|
|
11
|
+
|
|
12
|
+
#include <SkRRect.h>
|
|
13
|
+
#include <SkRect.h>
|
|
14
|
+
|
|
15
|
+
#pragma clang diagnostic pop
|
|
16
|
+
|
|
17
|
+
namespace RNSkia {
|
|
18
|
+
|
|
19
|
+
static PropId PropNameRx = JsiPropId::get("rx");
|
|
20
|
+
static PropId PropNameRy = JsiPropId::get("ry");
|
|
21
|
+
static PropId PropNameR = JsiPropId::get("r");
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
Reads a rect from a given propety in the node. The name of the property is
|
|
25
|
+
provided on the constructor. The property can either be a Javascript property
|
|
26
|
+
or a host object representing an SkRect.
|
|
27
|
+
*/
|
|
28
|
+
class RRectProp : public DerivedProp<SkRRect> {
|
|
29
|
+
public:
|
|
30
|
+
explicit RRectProp(PropId name) : DerivedProp() {
|
|
31
|
+
_prop = addProperty(std::make_shared<NodeProp>(name));
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
void updateDerivedValue() override {
|
|
35
|
+
if (_prop->isSet()) {
|
|
36
|
+
// Check for JsiSkRRect
|
|
37
|
+
if (_prop->value().getType() == PropType::HostObject) {
|
|
38
|
+
// Try reading as rect
|
|
39
|
+
auto rectPtr = std::dynamic_pointer_cast<JsiSkRRect>(
|
|
40
|
+
_prop->value().getAsHostObject());
|
|
41
|
+
if (rectPtr != nullptr) {
|
|
42
|
+
auto rrect = rectPtr->getObject();
|
|
43
|
+
setDerivedValue(SkRRect::MakeRectXY(
|
|
44
|
+
SkRect::MakeXYWH(rrect->rect().x(), rrect->rect().y(),
|
|
45
|
+
rrect->rect().width(), rrect->rect().height()),
|
|
46
|
+
rrect->getSimpleRadii().x(), rrect->getSimpleRadii().y()));
|
|
47
|
+
}
|
|
48
|
+
} else {
|
|
49
|
+
if (_prop->isSet() && _prop->value().getType() == PropType::Object) {
|
|
50
|
+
auto p = _prop->value();
|
|
51
|
+
if (p.hasValue(PropNameX) && p.hasValue(PropNameY) &&
|
|
52
|
+
p.hasValue(PropNameWidth) && p.hasValue(PropNameHeight) &&
|
|
53
|
+
p.hasValue(PropNameRx) && p.hasValue(PropNameRy)) {
|
|
54
|
+
auto x = _prop->value().getValue(PropNameX);
|
|
55
|
+
auto y = _prop->value().getValue(PropNameY);
|
|
56
|
+
auto width = _prop->value().getValue(PropNameWidth);
|
|
57
|
+
auto height = _prop->value().getValue(PropNameHeight);
|
|
58
|
+
auto rx = _prop->value().getValue(PropNameRx);
|
|
59
|
+
auto ry = _prop->value().getValue(PropNameRy);
|
|
60
|
+
|
|
61
|
+
// Update cache from js object value
|
|
62
|
+
setDerivedValue(SkRRect::MakeRectXY(
|
|
63
|
+
SkRect::MakeXYWH(x.getAsNumber(), y.getAsNumber(),
|
|
64
|
+
width.getAsNumber(), height.getAsNumber()),
|
|
65
|
+
rx.getAsNumber(), ry.getAsNumber()));
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
private:
|
|
73
|
+
NodeProp *_prop;
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
Reads rect properties from a node's properties
|
|
78
|
+
*/
|
|
79
|
+
class RRectPropFromProps : public DerivedProp<SkRRect> {
|
|
80
|
+
public:
|
|
81
|
+
RRectPropFromProps() : DerivedProp<SkRRect>() {
|
|
82
|
+
_x = addProperty(std::make_shared<NodeProp>(PropNameX));
|
|
83
|
+
_y = addProperty(std::make_shared<NodeProp>(PropNameY));
|
|
84
|
+
_width = addProperty(std::make_shared<NodeProp>(PropNameWidth));
|
|
85
|
+
_height = addProperty(std::make_shared<NodeProp>(PropNameHeight));
|
|
86
|
+
_r = addProperty(std::make_shared<NodeProp>(PropNameR));
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
void updateDerivedValue() override {
|
|
90
|
+
if (_x->isSet() && _y->isSet() && _width->isSet() && _height->isSet() &&
|
|
91
|
+
_r->isSet()) {
|
|
92
|
+
setDerivedValue(SkRRect::MakeRectXY(
|
|
93
|
+
SkRect::MakeXYWH(_x->value().getAsNumber(), _y->value().getAsNumber(),
|
|
94
|
+
_width->value().getAsNumber(),
|
|
95
|
+
_height->value().getAsNumber()),
|
|
96
|
+
_r->value().getAsNumber(), _r->value().getAsNumber()));
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
private:
|
|
101
|
+
NodeProp *_x;
|
|
102
|
+
NodeProp *_y;
|
|
103
|
+
NodeProp *_width;
|
|
104
|
+
NodeProp *_height;
|
|
105
|
+
NodeProp *_r;
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
Reads rect props from either a given property or from the property object
|
|
110
|
+
itself.
|
|
111
|
+
*/
|
|
112
|
+
class RRectProps : public DerivedProp<SkRRect> {
|
|
113
|
+
public:
|
|
114
|
+
explicit RRectProps(PropId name) : DerivedProp<SkRRect>() {
|
|
115
|
+
_rectProp = addProperty<RRectProp>(std::make_shared<RRectProp>(name));
|
|
116
|
+
_rectPropFromProps =
|
|
117
|
+
addProperty<RRectPropFromProps>(std::make_shared<RRectPropFromProps>());
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
void updateDerivedValue() override {
|
|
121
|
+
if (_rectProp->isSet()) {
|
|
122
|
+
setDerivedValue(_rectProp->getDerivedValue());
|
|
123
|
+
} else if (_rectPropFromProps->isSet()) {
|
|
124
|
+
setDerivedValue(_rectPropFromProps->getDerivedValue());
|
|
125
|
+
} else {
|
|
126
|
+
setDerivedValue(nullptr);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
private:
|
|
131
|
+
RRectProp *_rectProp;
|
|
132
|
+
RRectPropFromProps *_rectPropFromProps;
|
|
133
|
+
};
|
|
134
|
+
} // namespace RNSkia
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include "NodeProp.h"
|
|
4
|
+
#include "PointProp.h"
|
|
5
|
+
|
|
6
|
+
#include <memory>
|
|
7
|
+
|
|
8
|
+
#pragma clang diagnostic push
|
|
9
|
+
#pragma clang diagnostic ignored "-Wdocumentation"
|
|
10
|
+
|
|
11
|
+
#include <SkPoint.h>
|
|
12
|
+
|
|
13
|
+
#pragma clang diagnostic pop
|
|
14
|
+
|
|
15
|
+
namespace RNSkia {
|
|
16
|
+
|
|
17
|
+
class RadiusProp : public DerivedProp<SkPoint> {
|
|
18
|
+
public:
|
|
19
|
+
explicit RadiusProp(PropId name) : DerivedProp<SkPoint>() {
|
|
20
|
+
_pointProp = addProperty(std::make_shared<PointProp>(name));
|
|
21
|
+
_radiusProp = addProperty(std::make_shared<NodeProp>(name));
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
void updateDerivedValue() override {
|
|
25
|
+
if (_pointProp->isSet()) {
|
|
26
|
+
setDerivedValue(_pointProp->getDerivedValue());
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (_radiusProp->isSet()) {
|
|
31
|
+
setDerivedValue(SkPoint::Make(_radiusProp->value().getAsNumber(),
|
|
32
|
+
_radiusProp->value().getAsNumber()));
|
|
33
|
+
} else {
|
|
34
|
+
setDerivedValue(nullptr);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
private:
|
|
39
|
+
PointProp *_pointProp;
|
|
40
|
+
NodeProp *_radiusProp;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
} // namespace RNSkia
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include "NodeProp.h"
|
|
4
|
+
#include "PointProp.h"
|
|
5
|
+
|
|
6
|
+
#include <memory>
|
|
7
|
+
|
|
8
|
+
#pragma clang diagnostic push
|
|
9
|
+
#pragma clang diagnostic ignored "-Wdocumentation"
|
|
10
|
+
|
|
11
|
+
#include <SkRect.h>
|
|
12
|
+
|
|
13
|
+
#pragma clang diagnostic pop
|
|
14
|
+
|
|
15
|
+
namespace RNSkia {
|
|
16
|
+
|
|
17
|
+
static PropId PropNameRect = JsiPropId::get("rect");
|
|
18
|
+
static PropId PropNameWidth = JsiPropId::get("width");
|
|
19
|
+
static PropId PropNameHeight = JsiPropId::get("height");
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
Reads a rect from a given propety in the node. The name of the property is
|
|
23
|
+
provided on the constructor. The property can either be a Javascript property
|
|
24
|
+
or a host object representing an SkRect.
|
|
25
|
+
*/
|
|
26
|
+
class RectProp : public DerivedProp<SkRect> {
|
|
27
|
+
public:
|
|
28
|
+
explicit RectProp(PropId name) : DerivedProp() {
|
|
29
|
+
_prop = addProperty(std::make_shared<NodeProp>(name));
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
void updateDerivedValue() override {
|
|
33
|
+
if (_prop->isSet()) {
|
|
34
|
+
// Check for JsiSkRect
|
|
35
|
+
if (_prop->value().getType() == PropType::HostObject) {
|
|
36
|
+
auto rectPtr = std::dynamic_pointer_cast<JsiSkRect>(
|
|
37
|
+
_prop->value().getAsHostObject());
|
|
38
|
+
if (rectPtr != nullptr) {
|
|
39
|
+
setDerivedValue(SkRect::MakeXYWH(
|
|
40
|
+
rectPtr->getObject()->x(), rectPtr->getObject()->y(),
|
|
41
|
+
rectPtr->getObject()->width(), rectPtr->getObject()->height()));
|
|
42
|
+
}
|
|
43
|
+
} else {
|
|
44
|
+
auto p = _prop->value();
|
|
45
|
+
if (p.hasValue(PropNameX) && p.hasValue(PropNameY) &&
|
|
46
|
+
p.hasValue(PropNameWidth) && p.hasValue(PropNameHeight)) {
|
|
47
|
+
// Save props for fast access
|
|
48
|
+
auto x = p.getValue(PropNameX);
|
|
49
|
+
auto y = p.getValue(PropNameY);
|
|
50
|
+
auto width = p.getValue(PropNameWidth);
|
|
51
|
+
auto height = p.getValue(PropNameHeight);
|
|
52
|
+
|
|
53
|
+
// Update cache from js object value
|
|
54
|
+
setDerivedValue(SkRect::MakeXYWH(x.getAsNumber(), y.getAsNumber(),
|
|
55
|
+
width.getAsNumber(),
|
|
56
|
+
height.getAsNumber()));
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
private:
|
|
63
|
+
NodeProp *_prop;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
Reads rect properties from a node's properties
|
|
68
|
+
*/
|
|
69
|
+
class RectPropFromProps : public DerivedProp<SkRect> {
|
|
70
|
+
public:
|
|
71
|
+
RectPropFromProps() : DerivedProp<SkRect>() {
|
|
72
|
+
_x = addProperty(std::make_shared<NodeProp>(PropNameX));
|
|
73
|
+
_y = addProperty(std::make_shared<NodeProp>(PropNameY));
|
|
74
|
+
_width = addProperty(std::make_shared<NodeProp>(PropNameWidth));
|
|
75
|
+
_height = addProperty(std::make_shared<NodeProp>(PropNameHeight));
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
void updateDerivedValue() override {
|
|
79
|
+
if (_x->isSet() && _y->isSet() && _width->isSet() && _height->isSet()) {
|
|
80
|
+
setDerivedValue(SkRect::MakeXYWH(
|
|
81
|
+
_x->value().getAsNumber(), _y->value().getAsNumber(),
|
|
82
|
+
_width->value().getAsNumber(), _height->value().getAsNumber()));
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
private:
|
|
87
|
+
NodeProp *_x;
|
|
88
|
+
NodeProp *_y;
|
|
89
|
+
NodeProp *_width;
|
|
90
|
+
NodeProp *_height;
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
Reads rect props from either a given property or from the property object
|
|
95
|
+
itself.
|
|
96
|
+
*/
|
|
97
|
+
class RectProps : public DerivedProp<SkRect> {
|
|
98
|
+
public:
|
|
99
|
+
explicit RectProps(PropId name) : DerivedProp<SkRect>() {
|
|
100
|
+
_rectProp = addProperty(std::make_shared<RectProp>(name));
|
|
101
|
+
_rectPropFromProps = addProperty(std::make_shared<RectPropFromProps>());
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
void updateDerivedValue() override {
|
|
105
|
+
if (_rectProp->isSet()) {
|
|
106
|
+
setDerivedValue(_rectProp->getDerivedValue());
|
|
107
|
+
} else if (_rectPropFromProps->isSet()) {
|
|
108
|
+
setDerivedValue(_rectPropFromProps->getDerivedValue());
|
|
109
|
+
} else {
|
|
110
|
+
setDerivedValue(nullptr);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
private:
|
|
115
|
+
RectProp *_rectProp;
|
|
116
|
+
RectPropFromProps *_rectPropFromProps;
|
|
117
|
+
};
|
|
118
|
+
} // namespace RNSkia
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include "DerivedNodeProp.h"
|
|
4
|
+
|
|
5
|
+
#include <memory>
|
|
6
|
+
#include <string>
|
|
7
|
+
|
|
8
|
+
#pragma clang diagnostic push
|
|
9
|
+
#pragma clang diagnostic ignored "-Wdocumentation"
|
|
10
|
+
|
|
11
|
+
#include <SkPaint.h>
|
|
12
|
+
|
|
13
|
+
#pragma clang diagnostic pop
|
|
14
|
+
|
|
15
|
+
namespace RNSkia {
|
|
16
|
+
|
|
17
|
+
class StrokeCapProp : public DerivedProp<SkPaint::Cap> {
|
|
18
|
+
public:
|
|
19
|
+
explicit StrokeCapProp(PropId name) : DerivedProp<SkPaint::Cap>() {
|
|
20
|
+
_strokeCap = addProperty(std::make_shared<NodeProp>(name));
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
void updateDerivedValue() override {
|
|
24
|
+
if (_strokeCap->isSet() && (_strokeCap->isChanged())) {
|
|
25
|
+
auto capValue = _strokeCap->value().getAsString();
|
|
26
|
+
setDerivedValue(getCapFromString(capValue));
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
static SkPaint::Cap getCapFromString(const std::string &value) {
|
|
31
|
+
if (value == "round") {
|
|
32
|
+
return SkPaint::Cap::kRound_Cap;
|
|
33
|
+
} else if (value == "butt") {
|
|
34
|
+
return SkPaint::Cap::kButt_Cap;
|
|
35
|
+
} else if (value == "square") {
|
|
36
|
+
return SkPaint::Cap::kSquare_Cap;
|
|
37
|
+
}
|
|
38
|
+
throw std::runtime_error("Property value \"" + value +
|
|
39
|
+
"\" is not a legal stroke cap.");
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
private:
|
|
43
|
+
NodeProp *_strokeCap;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
class StrokeJoinProp : public DerivedProp<SkPaint::Join> {
|
|
47
|
+
public:
|
|
48
|
+
explicit StrokeJoinProp(PropId name) : DerivedProp<SkPaint::Join>() {
|
|
49
|
+
_strokeJoin = addProperty(std::make_shared<NodeProp>(name));
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
void updateDerivedValue() override {
|
|
53
|
+
if (_strokeJoin->isSet() && (_strokeJoin->isChanged())) {
|
|
54
|
+
auto joinValue = _strokeJoin->value().getAsString();
|
|
55
|
+
setDerivedValue(getJoinFromString(joinValue));
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
static SkPaint::Join getJoinFromString(const std::string &value) {
|
|
60
|
+
if (value == "miter") {
|
|
61
|
+
return SkPaint::Join::kMiter_Join;
|
|
62
|
+
} else if (value == "round") {
|
|
63
|
+
return SkPaint::Join::kRound_Join;
|
|
64
|
+
} else if (value == "bevel") {
|
|
65
|
+
return SkPaint::Join::kBevel_Join;
|
|
66
|
+
}
|
|
67
|
+
throw std::runtime_error("Property value \"" + value +
|
|
68
|
+
"\" is not a legal stroke join.");
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
private:
|
|
72
|
+
NodeProp *_strokeJoin;
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
} // namespace RNSkia
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include "DerivedNodeProp.h"
|
|
4
|
+
|
|
5
|
+
#include "JsiSkSVG.h"
|
|
6
|
+
|
|
7
|
+
#include <memory>
|
|
8
|
+
|
|
9
|
+
namespace RNSkia {
|
|
10
|
+
|
|
11
|
+
class SvgProp : public DerivedSkProp<SkSVGDOM> {
|
|
12
|
+
public:
|
|
13
|
+
explicit SvgProp(PropId name) : DerivedSkProp<SkSVGDOM>() {
|
|
14
|
+
_imageSvgProp = addProperty(std::make_shared<NodeProp>(name));
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
void updateDerivedValue() override {
|
|
18
|
+
if (_imageSvgProp->value().getType() != PropType::HostObject) {
|
|
19
|
+
throw std::runtime_error(
|
|
20
|
+
"Expected SkSvgDom object for the svg property.");
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
auto ptr = std::dynamic_pointer_cast<JsiSkSVG>(
|
|
24
|
+
_imageSvgProp->value().getAsHostObject());
|
|
25
|
+
if (ptr == nullptr) {
|
|
26
|
+
throw std::runtime_error(
|
|
27
|
+
"Expected SkSvgDom object for the svg property.");
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
setDerivedValue(ptr->getObject());
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
private:
|
|
34
|
+
NodeProp *_imageSvgProp;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
} // namespace RNSkia
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include "DerivedNodeProp.h"
|
|
4
|
+
|
|
5
|
+
#include "JsiSkTextBlob.h"
|
|
6
|
+
|
|
7
|
+
#include <memory>
|
|
8
|
+
#include <string>
|
|
9
|
+
#include <vector>
|
|
10
|
+
|
|
11
|
+
namespace RNSkia {
|
|
12
|
+
|
|
13
|
+
class TextBlobProp : public DerivedSkProp<SkTextBlob> {
|
|
14
|
+
public:
|
|
15
|
+
explicit TextBlobProp(PropId name) : DerivedSkProp<SkTextBlob>() {
|
|
16
|
+
_textBlobProp = addProperty(std::make_shared<NodeProp>(name));
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
void updateDerivedValue() override {
|
|
20
|
+
if (_textBlobProp->value().getType() != PropType::HostObject) {
|
|
21
|
+
throw std::runtime_error("Expected SkTextBlob object for the " +
|
|
22
|
+
std::string(getName()) + " property.");
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
auto ptr = _textBlobProp->value().getAs<JsiSkTextBlob>();
|
|
26
|
+
if (ptr == nullptr) {
|
|
27
|
+
throw std::runtime_error("Expected SkTextBlob object for the " +
|
|
28
|
+
std::string(getName()) + " property.");
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
setDerivedValue(ptr->getObject());
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
private:
|
|
35
|
+
NodeProp *_textBlobProp;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
class TextPathBlobProp : public DerivedSkProp<SkTextBlob> {
|
|
39
|
+
public:
|
|
40
|
+
TextPathBlobProp() : DerivedSkProp<SkTextBlob>() {
|
|
41
|
+
_fontProp = addProperty(std::make_shared<FontProp>(JsiPropId::get("font")));
|
|
42
|
+
_textProp = addProperty(std::make_shared<NodeProp>(JsiPropId::get("text")));
|
|
43
|
+
_pathProp = addProperty(std::make_shared<PathProp>(JsiPropId::get("path")));
|
|
44
|
+
_offsetProp = addProperty(
|
|
45
|
+
std::make_shared<NodeProp>(JsiPropId::get("initialOffset")));
|
|
46
|
+
|
|
47
|
+
_fontProp->require();
|
|
48
|
+
_textProp->require();
|
|
49
|
+
_pathProp->require();
|
|
50
|
+
_offsetProp->require();
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
void updateDerivedValue() override {
|
|
54
|
+
auto font = _fontProp->getDerivedValue();
|
|
55
|
+
auto text = _textProp->value().getAsString();
|
|
56
|
+
auto path = _pathProp->getDerivedValue();
|
|
57
|
+
auto offset = _offsetProp->value().getAsNumber();
|
|
58
|
+
|
|
59
|
+
// Get glyphs
|
|
60
|
+
auto numGlyphIds =
|
|
61
|
+
font->countText(text.c_str(), text.length(), SkTextEncoding::kUTF8);
|
|
62
|
+
|
|
63
|
+
std::vector<SkGlyphID> glyphIds;
|
|
64
|
+
glyphIds.reserve(numGlyphIds);
|
|
65
|
+
auto ids = font->textToGlyphs(
|
|
66
|
+
text.c_str(), text.length(), SkTextEncoding::kUTF8,
|
|
67
|
+
static_cast<SkGlyphID *>(glyphIds.data()), numGlyphIds);
|
|
68
|
+
|
|
69
|
+
// Get glyph widths
|
|
70
|
+
int glyphsSize = static_cast<int>(ids);
|
|
71
|
+
std::vector<SkScalar> widthPtrs;
|
|
72
|
+
widthPtrs.resize(glyphsSize);
|
|
73
|
+
font->getWidthsBounds(glyphIds.data(), numGlyphIds,
|
|
74
|
+
static_cast<SkScalar *>(widthPtrs.data()), nullptr,
|
|
75
|
+
nullptr); // TODO: Should we use paint somehow here?
|
|
76
|
+
|
|
77
|
+
std::vector<SkRSXform> rsx;
|
|
78
|
+
SkContourMeasureIter meas(*path, false, 1);
|
|
79
|
+
|
|
80
|
+
auto cont = meas.next();
|
|
81
|
+
auto dist = offset;
|
|
82
|
+
|
|
83
|
+
for (size_t i = 0; i < text.length() && cont != nullptr; ++i) {
|
|
84
|
+
auto width = widthPtrs[i];
|
|
85
|
+
dist += width / 2;
|
|
86
|
+
if (dist > cont->length()) {
|
|
87
|
+
// jump to next contour
|
|
88
|
+
cont = meas.next();
|
|
89
|
+
if (cont == nullptr) {
|
|
90
|
+
// We have come to the end of the path - terminate the string
|
|
91
|
+
// right here.
|
|
92
|
+
text = text.substr(0, i);
|
|
93
|
+
break;
|
|
94
|
+
}
|
|
95
|
+
dist = width / 2;
|
|
96
|
+
}
|
|
97
|
+
// Gives us the (x, y) coordinates as well as the cos/sin of the tangent
|
|
98
|
+
// line at that position.
|
|
99
|
+
SkPoint pos;
|
|
100
|
+
SkVector tan;
|
|
101
|
+
if (!cont->getPosTan(dist, &pos, &tan)) {
|
|
102
|
+
throw std::runtime_error(
|
|
103
|
+
"Could not calculate distance when resolving text path");
|
|
104
|
+
}
|
|
105
|
+
auto px = pos.x();
|
|
106
|
+
auto py = pos.y();
|
|
107
|
+
auto tx = tan.x();
|
|
108
|
+
auto ty = tan.y();
|
|
109
|
+
|
|
110
|
+
auto adjustedX = px - (width / 2) * tx;
|
|
111
|
+
auto adjustedY = py - (width / 2) * ty;
|
|
112
|
+
|
|
113
|
+
rsx.push_back(SkRSXform::Make(tx, ty, adjustedX, adjustedY));
|
|
114
|
+
dist += width / 2;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
setDerivedValue(SkTextBlob::MakeFromRSXform(text.c_str(), text.length(),
|
|
118
|
+
rsx.data(), *font));
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
private:
|
|
122
|
+
FontProp *_fontProp;
|
|
123
|
+
NodeProp *_textProp;
|
|
124
|
+
PathProp *_pathProp;
|
|
125
|
+
NodeProp *_offsetProp;
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
} // namespace RNSkia
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include "DerivedNodeProp.h"
|
|
4
|
+
|
|
5
|
+
#pragma clang diagnostic push
|
|
6
|
+
#pragma clang diagnostic ignored "-Wdocumentation"
|
|
7
|
+
|
|
8
|
+
#include <SkTileMode.h>
|
|
9
|
+
|
|
10
|
+
#include <memory>
|
|
11
|
+
#include <string>
|
|
12
|
+
|
|
13
|
+
#pragma clang diagnostic pop
|
|
14
|
+
|
|
15
|
+
namespace RNSkia {
|
|
16
|
+
|
|
17
|
+
class TileModeProp : public DerivedProp<SkTileMode> {
|
|
18
|
+
public:
|
|
19
|
+
explicit TileModeProp(PropId name) : DerivedProp<SkTileMode>() {
|
|
20
|
+
_tileModeProp = addProperty(std::make_shared<NodeProp>(name));
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
void updateDerivedValue() override {
|
|
24
|
+
if (_tileModeProp->isSet()) {
|
|
25
|
+
setDerivedValue(
|
|
26
|
+
getTileModeFromStringValue(_tileModeProp->value().getAsString()));
|
|
27
|
+
} else {
|
|
28
|
+
setDerivedValue(nullptr);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
private:
|
|
33
|
+
SkTileMode getTileModeFromStringValue(const std::string &value) {
|
|
34
|
+
if (value == "clamp") {
|
|
35
|
+
return SkTileMode::kClamp;
|
|
36
|
+
} else if (value == "repeat") {
|
|
37
|
+
return SkTileMode::kRepeat;
|
|
38
|
+
} else if (value == "mirror") {
|
|
39
|
+
return SkTileMode::kMirror;
|
|
40
|
+
} else if (value == "decal") {
|
|
41
|
+
return SkTileMode::kDecal;
|
|
42
|
+
}
|
|
43
|
+
throw std::runtime_error("Value \"" + value +
|
|
44
|
+
"\" is not a valid tile mode.");
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
NodeProp *_tileModeProp;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
} // namespace RNSkia
|