@shopify/react-native-skia 0.1.158 → 0.1.160
Sign up to get free protection for your applications and to get access to all the features.
- 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 +222 -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 +293 -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 +384 -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 +79 -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 +62 -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 +171 -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 +41 -55
- 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 +24 -66
- 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 +15 -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 +25 -66
- 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 +15 -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 +5 -2
- package/src/dom/nodes/JsiSkDOM.ts +170 -56
- package/src/dom/nodes/RenderNode.ts +1 -1
- package/src/renderer/Canvas.tsx +37 -57
- 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 +9 -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,51 @@
|
|
1
|
+
#pragma once
|
2
|
+
|
3
|
+
#include "JsiDomDrawingNode.h"
|
4
|
+
#include "PointsProp.h"
|
5
|
+
|
6
|
+
#include <memory>
|
7
|
+
|
8
|
+
#pragma clang diagnostic push
|
9
|
+
#pragma clang diagnostic ignored "-Wdocumentation"
|
10
|
+
|
11
|
+
#include <SkCanvas.h>
|
12
|
+
|
13
|
+
#pragma clang diagnostic pop
|
14
|
+
|
15
|
+
namespace RNSkia {
|
16
|
+
|
17
|
+
static PropId PropNamePoints = JsiPropId::get("points");
|
18
|
+
static PropId PropNamePointsMode = JsiPropId::get("mode");
|
19
|
+
|
20
|
+
class JsiPointsNode : public JsiDomDrawingNode,
|
21
|
+
public JsiDomNodeCtor<JsiPointsNode> {
|
22
|
+
public:
|
23
|
+
explicit JsiPointsNode(std::shared_ptr<RNSkPlatformContext> context)
|
24
|
+
: JsiDomDrawingNode(context, "skPoints") {}
|
25
|
+
|
26
|
+
protected:
|
27
|
+
void draw(DrawingContext *context) override {
|
28
|
+
auto mode = _pointModeProp->getDerivedValue();
|
29
|
+
auto points = _pointsProp->getDerivedValue();
|
30
|
+
|
31
|
+
context->getCanvas()->drawPoints(*mode, points->size(), points->data(),
|
32
|
+
*context->getPaint());
|
33
|
+
}
|
34
|
+
|
35
|
+
void defineProperties(NodePropsContainer *container) override {
|
36
|
+
JsiDomDrawingNode::defineProperties(container);
|
37
|
+
_pointModeProp = container->defineProperty(
|
38
|
+
std::make_shared<PointModeProp>(PropNamePointsMode));
|
39
|
+
_pointsProp =
|
40
|
+
container->defineProperty(std::make_shared<PointsProp>(PropNamePoints));
|
41
|
+
|
42
|
+
_pointsProp->require();
|
43
|
+
_pointModeProp->require();
|
44
|
+
}
|
45
|
+
|
46
|
+
private:
|
47
|
+
PointModeProp *_pointModeProp;
|
48
|
+
PointsProp *_pointsProp;
|
49
|
+
};
|
50
|
+
|
51
|
+
} // namespace RNSkia
|
@@ -0,0 +1,34 @@
|
|
1
|
+
#pragma once
|
2
|
+
|
3
|
+
#include "JsiDomDrawingNode.h"
|
4
|
+
#include "RRectProp.h"
|
5
|
+
|
6
|
+
#include <memory>
|
7
|
+
|
8
|
+
namespace RNSkia {
|
9
|
+
|
10
|
+
class JsiRRectNode : public JsiDomDrawingNode,
|
11
|
+
public JsiDomNodeCtor<JsiRRectNode> {
|
12
|
+
public:
|
13
|
+
explicit JsiRRectNode(std::shared_ptr<RNSkPlatformContext> context)
|
14
|
+
: JsiDomDrawingNode(context, "skRRect") {}
|
15
|
+
|
16
|
+
protected:
|
17
|
+
void draw(DrawingContext *context) override {
|
18
|
+
context->getCanvas()->drawRRect(*_rrectProp->getDerivedValue(),
|
19
|
+
*context->getPaint());
|
20
|
+
}
|
21
|
+
|
22
|
+
void defineProperties(NodePropsContainer *container) override {
|
23
|
+
JsiDomDrawingNode::defineProperties(container);
|
24
|
+
|
25
|
+
_rrectProp =
|
26
|
+
container->defineProperty(std::make_shared<RRectProps>(PropNameRect));
|
27
|
+
_rrectProp->require();
|
28
|
+
}
|
29
|
+
|
30
|
+
private:
|
31
|
+
RRectProps *_rrectProp;
|
32
|
+
};
|
33
|
+
|
34
|
+
} // namespace RNSkia
|
@@ -0,0 +1,34 @@
|
|
1
|
+
#pragma once
|
2
|
+
|
3
|
+
#include "JsiDomDrawingNode.h"
|
4
|
+
#include "RectProp.h"
|
5
|
+
|
6
|
+
#include <memory>
|
7
|
+
|
8
|
+
namespace RNSkia {
|
9
|
+
|
10
|
+
class JsiRectNode : public JsiDomDrawingNode,
|
11
|
+
public JsiDomNodeCtor<JsiRectNode> {
|
12
|
+
public:
|
13
|
+
explicit JsiRectNode(std::shared_ptr<RNSkPlatformContext> context)
|
14
|
+
: JsiDomDrawingNode(context, "skRect") {}
|
15
|
+
|
16
|
+
protected:
|
17
|
+
void draw(DrawingContext *context) override {
|
18
|
+
context->getCanvas()->drawRect(*_rectProp->getDerivedValue(),
|
19
|
+
*context->getPaint());
|
20
|
+
}
|
21
|
+
|
22
|
+
void defineProperties(NodePropsContainer *container) override {
|
23
|
+
JsiDomDrawingNode::defineProperties(container);
|
24
|
+
|
25
|
+
_rectProp =
|
26
|
+
container->defineProperty(std::make_shared<RectProps>(PropNameRect));
|
27
|
+
_rectProp->require();
|
28
|
+
}
|
29
|
+
|
30
|
+
private:
|
31
|
+
RectProps *_rectProp;
|
32
|
+
};
|
33
|
+
|
34
|
+
} // namespace RNSkia
|
@@ -0,0 +1,517 @@
|
|
1
|
+
#pragma once
|
2
|
+
|
3
|
+
#include "JsiDomDeclarationNode.h"
|
4
|
+
|
5
|
+
#include "BlendModeProp.h"
|
6
|
+
#include "ColorProp.h"
|
7
|
+
#include "NodeProp.h"
|
8
|
+
#include "NumbersProp.h"
|
9
|
+
#include "TileModeProp.h"
|
10
|
+
#include "TransformsProps.h"
|
11
|
+
#include "UniformsProp.h"
|
12
|
+
|
13
|
+
#include <memory>
|
14
|
+
#include <string>
|
15
|
+
#include <vector>
|
16
|
+
|
17
|
+
#pragma clang diagnostic push
|
18
|
+
#pragma clang diagnostic ignored "-Wdocumentation"
|
19
|
+
|
20
|
+
#include <SkShader.h>
|
21
|
+
|
22
|
+
#pragma clang diagnostic pop
|
23
|
+
|
24
|
+
namespace RNSkia {
|
25
|
+
|
26
|
+
class JsiBaseShaderNode
|
27
|
+
: public JsiDomDeclarationNode<JsiBaseShaderNode, sk_sp<SkShader>> {
|
28
|
+
public:
|
29
|
+
JsiBaseShaderNode(std::shared_ptr<RNSkPlatformContext> context,
|
30
|
+
const char *type)
|
31
|
+
: JsiDomDeclarationNode<JsiBaseShaderNode, sk_sp<SkShader>>(context,
|
32
|
+
type) {}
|
33
|
+
|
34
|
+
protected:
|
35
|
+
sk_sp<SkShader> resolve(std::shared_ptr<JsiDomNode> child) override {
|
36
|
+
auto ptr = std::dynamic_pointer_cast<JsiBaseShaderNode>(child);
|
37
|
+
if (ptr) {
|
38
|
+
return ptr->getCurrent();
|
39
|
+
}
|
40
|
+
return nullptr;
|
41
|
+
}
|
42
|
+
|
43
|
+
void setShader(DrawingContext *context, sk_sp<SkShader> f) {
|
44
|
+
set(context, f);
|
45
|
+
}
|
46
|
+
|
47
|
+
void set(DrawingContext *context, sk_sp<SkShader> shader) override {
|
48
|
+
auto paint = context->getMutablePaint();
|
49
|
+
paint->setShader(shader);
|
50
|
+
setCurrent(shader);
|
51
|
+
}
|
52
|
+
};
|
53
|
+
|
54
|
+
class JsiShaderNode : public JsiBaseShaderNode,
|
55
|
+
public JsiDomNodeCtor<JsiShaderNode> {
|
56
|
+
public:
|
57
|
+
explicit JsiShaderNode(std::shared_ptr<RNSkPlatformContext> context)
|
58
|
+
: JsiBaseShaderNode(context, "skShader") {}
|
59
|
+
|
60
|
+
protected:
|
61
|
+
void decorate(DrawingContext *context) override {
|
62
|
+
if (isChanged(context)) {
|
63
|
+
auto source = _sourceProp->value().getAs<JsiSkRuntimeEffect>();
|
64
|
+
if (source == nullptr) {
|
65
|
+
throw std::runtime_error("Expected runtime effect when reading source "
|
66
|
+
"property of RuntimeEffectImageFilter.");
|
67
|
+
}
|
68
|
+
auto uniforms =
|
69
|
+
_uniformsProp->isSet() ? _uniformsProp->getDerivedValue() : nullptr;
|
70
|
+
auto localMatrix =
|
71
|
+
_transformProp->isSet() ? _transformProp->getDerivedValue() : nullptr;
|
72
|
+
|
73
|
+
// get all children that are shader nodes
|
74
|
+
std::vector<sk_sp<SkShader>> children;
|
75
|
+
children.reserve(getChildren().size());
|
76
|
+
for (auto &child : getChildren()) {
|
77
|
+
auto ptr = std::dynamic_pointer_cast<JsiBaseShaderNode>(child);
|
78
|
+
if (ptr != nullptr) {
|
79
|
+
children.push_back(ptr->getCurrent());
|
80
|
+
}
|
81
|
+
}
|
82
|
+
|
83
|
+
// Update shader
|
84
|
+
setShader(context, source->getObject()->makeShader(
|
85
|
+
uniforms, children.data(), children.size(),
|
86
|
+
localMatrix.get()));
|
87
|
+
}
|
88
|
+
}
|
89
|
+
|
90
|
+
void defineProperties(NodePropsContainer *container) override {
|
91
|
+
JsiBaseDomDeclarationNode::defineProperties(container);
|
92
|
+
_sourceProp = container->defineProperty(
|
93
|
+
std::make_shared<NodeProp>(JsiPropId::get("source")));
|
94
|
+
_uniformsProp = container->defineProperty(std::make_shared<UniformsProp>(
|
95
|
+
JsiPropId::get("uniforms"), _sourceProp));
|
96
|
+
_transformProp = container->defineProperty(
|
97
|
+
std::make_shared<TransformProp>(JsiPropId::get("transform")));
|
98
|
+
|
99
|
+
_sourceProp->require();
|
100
|
+
}
|
101
|
+
|
102
|
+
private:
|
103
|
+
NodeProp *_sourceProp;
|
104
|
+
UniformsProp *_uniformsProp;
|
105
|
+
TransformProp *_transformProp;
|
106
|
+
};
|
107
|
+
|
108
|
+
class JsiImageShaderNode : public JsiBaseShaderNode,
|
109
|
+
public JsiDomNodeCtor<JsiImageShaderNode> {
|
110
|
+
public:
|
111
|
+
explicit JsiImageShaderNode(std::shared_ptr<RNSkPlatformContext> context)
|
112
|
+
: JsiBaseShaderNode(context, "skImageShader") {}
|
113
|
+
|
114
|
+
protected:
|
115
|
+
void decorate(DrawingContext *context) override {
|
116
|
+
if (isChanged(context)) {
|
117
|
+
auto image = _imageProps->getImage();
|
118
|
+
auto rect = _imageProps->getRect();
|
119
|
+
auto lm = _transformProp->isSet()
|
120
|
+
? _transformProp->getDerivedValue().get()
|
121
|
+
: nullptr;
|
122
|
+
|
123
|
+
if (rect != nullptr && lm != nullptr) {
|
124
|
+
auto rc = _imageProps->getDerivedValue();
|
125
|
+
auto m3 = _imageProps->rect2rect(rc->src, rc->dst);
|
126
|
+
lm->preTranslate(m3.x(), m3.y());
|
127
|
+
lm->preScale(m3.width(), m3.height());
|
128
|
+
}
|
129
|
+
|
130
|
+
setShader(
|
131
|
+
context,
|
132
|
+
image->makeShader(
|
133
|
+
*_txProp->getDerivedValue(), *_tyProp->getDerivedValue(),
|
134
|
+
SkSamplingOptions(getFilterModeFromString(
|
135
|
+
_filterModeProp->value().getAsString()),
|
136
|
+
getMipmapModeFromString(
|
137
|
+
_mipmapModeProp->value().getAsString())),
|
138
|
+
lm));
|
139
|
+
}
|
140
|
+
}
|
141
|
+
|
142
|
+
void defineProperties(NodePropsContainer *container) override {
|
143
|
+
JsiBaseDomDeclarationNode::defineProperties(container);
|
144
|
+
_txProp = container->defineProperty(
|
145
|
+
std::make_shared<TileModeProp>(JsiPropId::get("tx")));
|
146
|
+
_tyProp = container->defineProperty(
|
147
|
+
std::make_shared<TileModeProp>(JsiPropId::get("ty")));
|
148
|
+
_filterModeProp = container->defineProperty(
|
149
|
+
std::make_shared<NodeProp>(JsiPropId::get("fm")));
|
150
|
+
_mipmapModeProp = container->defineProperty(
|
151
|
+
std::make_shared<NodeProp>(JsiPropId::get("mm")));
|
152
|
+
|
153
|
+
_imageProps = container->defineProperty(std::make_shared<ImageProps>());
|
154
|
+
_transformProp = container->defineProperty(
|
155
|
+
std::make_shared<TransformProp>(JsiPropId::get("transform")));
|
156
|
+
|
157
|
+
_txProp->require();
|
158
|
+
_tyProp->require();
|
159
|
+
_filterModeProp->require();
|
160
|
+
_mipmapModeProp->require();
|
161
|
+
|
162
|
+
_transformProp->require();
|
163
|
+
|
164
|
+
// Just require the image
|
165
|
+
container
|
166
|
+
->defineProperty(std::make_shared<NodeProp>(JsiPropId::get("image")))
|
167
|
+
->require();
|
168
|
+
}
|
169
|
+
|
170
|
+
private:
|
171
|
+
SkFilterMode getFilterModeFromString(const std::string &value) {
|
172
|
+
if (value == "last") {
|
173
|
+
return SkFilterMode::kLast;
|
174
|
+
} else if (value == "linear") {
|
175
|
+
return SkFilterMode::kLinear;
|
176
|
+
} else if (value == "nearest") {
|
177
|
+
return SkFilterMode::kNearest;
|
178
|
+
}
|
179
|
+
throw std::runtime_error("The value \"" + value +
|
180
|
+
"\" is not a valid Filter Mode.");
|
181
|
+
}
|
182
|
+
|
183
|
+
SkMipmapMode getMipmapModeFromString(const std::string &value) {
|
184
|
+
if (value == "last") {
|
185
|
+
return SkMipmapMode::kLast;
|
186
|
+
} else if (value == "last") {
|
187
|
+
return SkMipmapMode::kLast;
|
188
|
+
} else if (value == "last") {
|
189
|
+
return SkMipmapMode::kLast;
|
190
|
+
} else if (value == "none") {
|
191
|
+
return SkMipmapMode::kNone;
|
192
|
+
}
|
193
|
+
throw std::runtime_error("The value \"" + value +
|
194
|
+
"\" is not a valid Mipmap Mode.");
|
195
|
+
}
|
196
|
+
|
197
|
+
TileModeProp *_txProp;
|
198
|
+
TileModeProp *_tyProp;
|
199
|
+
NodeProp *_filterModeProp;
|
200
|
+
NodeProp *_mipmapModeProp;
|
201
|
+
ImageProps *_imageProps;
|
202
|
+
TransformProp *_transformProp;
|
203
|
+
};
|
204
|
+
|
205
|
+
class JsiColorShaderNode : public JsiBaseShaderNode,
|
206
|
+
public JsiDomNodeCtor<JsiColorShaderNode> {
|
207
|
+
public:
|
208
|
+
explicit JsiColorShaderNode(std::shared_ptr<RNSkPlatformContext> context)
|
209
|
+
: JsiBaseShaderNode(context, "skColorShader") {}
|
210
|
+
|
211
|
+
protected:
|
212
|
+
void decorate(DrawingContext *context) override {
|
213
|
+
if (isChanged(context)) {
|
214
|
+
if (_colorProp->isSet()) {
|
215
|
+
setShader(context, SkShaders::Color(*_colorProp->getDerivedValue()));
|
216
|
+
} else {
|
217
|
+
setShader(context, nullptr);
|
218
|
+
}
|
219
|
+
}
|
220
|
+
}
|
221
|
+
|
222
|
+
void defineProperties(NodePropsContainer *container) override {
|
223
|
+
JsiBaseDomDeclarationNode::defineProperties(container);
|
224
|
+
_colorProp = container->defineProperty(
|
225
|
+
std::make_shared<ColorProp>(JsiPropId::get("color")));
|
226
|
+
_colorProp->require();
|
227
|
+
}
|
228
|
+
|
229
|
+
private:
|
230
|
+
ColorProp *_colorProp;
|
231
|
+
};
|
232
|
+
|
233
|
+
class JsiBasePerlinNoiseNode : public JsiBaseShaderNode {
|
234
|
+
public:
|
235
|
+
JsiBasePerlinNoiseNode(std::shared_ptr<RNSkPlatformContext> context,
|
236
|
+
PropId type)
|
237
|
+
: JsiBaseShaderNode(context, type) {}
|
238
|
+
|
239
|
+
protected:
|
240
|
+
void defineProperties(NodePropsContainer *container) override {
|
241
|
+
JsiBaseDomDeclarationNode::defineProperties(container);
|
242
|
+
_freqXProp = container->defineProperty(
|
243
|
+
std::make_shared<NodeProp>(JsiPropId::get("freqX")));
|
244
|
+
_freqYProp = container->defineProperty(
|
245
|
+
std::make_shared<NodeProp>(JsiPropId::get("freqY")));
|
246
|
+
_octavesProp = container->defineProperty(
|
247
|
+
std::make_shared<NodeProp>(JsiPropId::get("octaves")));
|
248
|
+
_seedProp = container->defineProperty(
|
249
|
+
std::make_shared<NodeProp>(JsiPropId::get("seed")));
|
250
|
+
_tileWidthProp = container->defineProperty(
|
251
|
+
std::make_shared<NodeProp>(JsiPropId::get("tileWidth")));
|
252
|
+
_tileHeightProp = container->defineProperty(
|
253
|
+
std::make_shared<NodeProp>(JsiPropId::get("tileHeight")));
|
254
|
+
|
255
|
+
_freqXProp->require();
|
256
|
+
_freqYProp->require();
|
257
|
+
_octavesProp->require();
|
258
|
+
_seedProp->require();
|
259
|
+
_tileWidthProp->require();
|
260
|
+
_tileHeightProp->require();
|
261
|
+
}
|
262
|
+
|
263
|
+
NodeProp *_freqXProp;
|
264
|
+
NodeProp *_freqYProp;
|
265
|
+
NodeProp *_octavesProp;
|
266
|
+
NodeProp *_seedProp;
|
267
|
+
NodeProp *_tileWidthProp;
|
268
|
+
NodeProp *_tileHeightProp;
|
269
|
+
};
|
270
|
+
|
271
|
+
class JsiTurbulenceNode : public JsiBasePerlinNoiseNode,
|
272
|
+
public JsiDomNodeCtor<JsiTurbulenceNode> {
|
273
|
+
public:
|
274
|
+
explicit JsiTurbulenceNode(std::shared_ptr<RNSkPlatformContext> context)
|
275
|
+
: JsiBasePerlinNoiseNode(context, "skTurbulence") {}
|
276
|
+
|
277
|
+
protected:
|
278
|
+
void decorate(DrawingContext *context) override {
|
279
|
+
if (isChanged(context)) {
|
280
|
+
SkISize size = SkISize::Make(_tileWidthProp->value().getAsNumber(),
|
281
|
+
_tileHeightProp->value().getAsNumber());
|
282
|
+
|
283
|
+
setShader(context, SkPerlinNoiseShader::MakeTurbulence(
|
284
|
+
_freqXProp->value().getAsNumber(),
|
285
|
+
_freqYProp->value().getAsNumber(),
|
286
|
+
_octavesProp->value().getAsNumber(),
|
287
|
+
_seedProp->value().getAsNumber(), &size));
|
288
|
+
}
|
289
|
+
}
|
290
|
+
};
|
291
|
+
|
292
|
+
class JsiFractalNoiseNode : public JsiBasePerlinNoiseNode,
|
293
|
+
public JsiDomNodeCtor<JsiFractalNoiseNode> {
|
294
|
+
public:
|
295
|
+
explicit JsiFractalNoiseNode(std::shared_ptr<RNSkPlatformContext> context)
|
296
|
+
: JsiBasePerlinNoiseNode(context, "skFractalNoise") {}
|
297
|
+
|
298
|
+
protected:
|
299
|
+
void decorate(DrawingContext *context) override {
|
300
|
+
if (isChanged(context)) {
|
301
|
+
SkISize size = SkISize::Make(_tileWidthProp->value().getAsNumber(),
|
302
|
+
_tileHeightProp->value().getAsNumber());
|
303
|
+
|
304
|
+
setShader(context, SkPerlinNoiseShader::MakeFractalNoise(
|
305
|
+
_freqXProp->value().getAsNumber(),
|
306
|
+
_freqYProp->value().getAsNumber(),
|
307
|
+
_octavesProp->value().getAsNumber(),
|
308
|
+
_seedProp->value().getAsNumber(), &size));
|
309
|
+
}
|
310
|
+
}
|
311
|
+
};
|
312
|
+
|
313
|
+
class JsiBaseGradientNode : public JsiBaseShaderNode {
|
314
|
+
public:
|
315
|
+
JsiBaseGradientNode(std::shared_ptr<RNSkPlatformContext> context, PropId type)
|
316
|
+
: JsiBaseShaderNode(context, type) {}
|
317
|
+
|
318
|
+
void defineProperties(NodePropsContainer *container) override {
|
319
|
+
JsiBaseDomDeclarationNode::defineProperties(container);
|
320
|
+
_transformsProps =
|
321
|
+
container->defineProperty(std::make_shared<TransformsProps>());
|
322
|
+
|
323
|
+
_colorsProp = container->defineProperty(
|
324
|
+
std::make_shared<ColorsProp>(JsiPropId::get("colors")));
|
325
|
+
_positionsProp = container->defineProperty(
|
326
|
+
std::make_shared<NumbersProp>(JsiPropId::get("positions")));
|
327
|
+
_modeProp = container->defineProperty(
|
328
|
+
std::make_shared<TileModeProp>(JsiPropId::get("mode")));
|
329
|
+
_flagsProp = container->defineProperty(
|
330
|
+
std::make_shared<NodeProp>(JsiPropId::get("flags")));
|
331
|
+
|
332
|
+
_colorsProp->require();
|
333
|
+
}
|
334
|
+
|
335
|
+
protected:
|
336
|
+
void decorate(DrawingContext *context) override {
|
337
|
+
if (isChanged(context)) {
|
338
|
+
_colors = _colorsProp->getDerivedValue()->data();
|
339
|
+
_colorCount = static_cast<int>(_colorsProp->getDerivedValue()->size());
|
340
|
+
_flags = _flagsProp->isSet() ? _flagsProp->value().getAsNumber() : 0;
|
341
|
+
_mode = _modeProp->isSet() ? *_modeProp->getDerivedValue()
|
342
|
+
: SkTileMode::kClamp;
|
343
|
+
_positions = _positionsProp->isSet()
|
344
|
+
? _positionsProp->getDerivedValue()->data()
|
345
|
+
: nullptr;
|
346
|
+
_matrix = _transformsProps->isSet()
|
347
|
+
? _transformsProps->getDerivedValue().get()
|
348
|
+
: nullptr;
|
349
|
+
}
|
350
|
+
}
|
351
|
+
|
352
|
+
SkColor *_colors;
|
353
|
+
SkTileMode _mode;
|
354
|
+
double _flags;
|
355
|
+
SkScalar *_positions;
|
356
|
+
SkMatrix *_matrix;
|
357
|
+
int _colorCount;
|
358
|
+
|
359
|
+
private:
|
360
|
+
TransformsProps *_transformsProps;
|
361
|
+
ColorsProp *_colorsProp;
|
362
|
+
NumbersProp *_positionsProp;
|
363
|
+
TileModeProp *_modeProp;
|
364
|
+
NodeProp *_flagsProp;
|
365
|
+
};
|
366
|
+
|
367
|
+
class JsiLinearGradientNode : public JsiBaseGradientNode,
|
368
|
+
public JsiDomNodeCtor<JsiLinearGradientNode> {
|
369
|
+
public:
|
370
|
+
explicit JsiLinearGradientNode(std::shared_ptr<RNSkPlatformContext> context)
|
371
|
+
: JsiBaseGradientNode(context, "skLinearGradient") {}
|
372
|
+
|
373
|
+
protected:
|
374
|
+
void decorate(DrawingContext *context) override {
|
375
|
+
JsiBaseGradientNode::decorate(context);
|
376
|
+
|
377
|
+
if (isChanged(context)) {
|
378
|
+
SkPoint pts[] = {*_startProp->getDerivedValue(),
|
379
|
+
*_endProp->getDerivedValue()};
|
380
|
+
setShader(context, SkGradientShader::MakeLinear(pts, _colors, _positions,
|
381
|
+
_colorCount, _mode,
|
382
|
+
_flags, _matrix));
|
383
|
+
}
|
384
|
+
}
|
385
|
+
|
386
|
+
void defineProperties(NodePropsContainer *container) override {
|
387
|
+
JsiBaseGradientNode::defineProperties(container);
|
388
|
+
_startProp = container->defineProperty(
|
389
|
+
std::make_shared<PointProp>(JsiPropId::get("start")));
|
390
|
+
_endProp = container->defineProperty(
|
391
|
+
std::make_shared<PointProp>(JsiPropId::get("end")));
|
392
|
+
|
393
|
+
_startProp->require();
|
394
|
+
_endProp->require();
|
395
|
+
}
|
396
|
+
|
397
|
+
private:
|
398
|
+
PointProp *_startProp;
|
399
|
+
PointProp *_endProp;
|
400
|
+
};
|
401
|
+
|
402
|
+
class JsiRadialGradientNode : public JsiBaseGradientNode,
|
403
|
+
public JsiDomNodeCtor<JsiRadialGradientNode> {
|
404
|
+
public:
|
405
|
+
explicit JsiRadialGradientNode(std::shared_ptr<RNSkPlatformContext> context)
|
406
|
+
: JsiBaseGradientNode(context, "skRadialGradient") {}
|
407
|
+
|
408
|
+
protected:
|
409
|
+
void decorate(DrawingContext *context) override {
|
410
|
+
JsiBaseGradientNode::decorate(context);
|
411
|
+
|
412
|
+
if (isChanged(context)) {
|
413
|
+
auto c = _centerProp->getDerivedValue();
|
414
|
+
auto r = _radiusProp->value().getAsNumber();
|
415
|
+
setShader(context, SkGradientShader::MakeRadial(*c, r, _colors,
|
416
|
+
_positions, _colorCount,
|
417
|
+
_mode, _flags, _matrix));
|
418
|
+
}
|
419
|
+
}
|
420
|
+
|
421
|
+
void defineProperties(NodePropsContainer *container) override {
|
422
|
+
JsiBaseGradientNode::defineProperties(container);
|
423
|
+
_centerProp = container->defineProperty(
|
424
|
+
std::make_shared<PointProp>(JsiPropId::get("c")));
|
425
|
+
_radiusProp = container->defineProperty(
|
426
|
+
std::make_shared<NodeProp>(JsiPropId::get("r")));
|
427
|
+
|
428
|
+
_centerProp->require();
|
429
|
+
_radiusProp->require();
|
430
|
+
}
|
431
|
+
|
432
|
+
private:
|
433
|
+
PointProp *_centerProp;
|
434
|
+
NodeProp *_radiusProp;
|
435
|
+
};
|
436
|
+
|
437
|
+
class JsiSweepGradientNode : public JsiBaseGradientNode,
|
438
|
+
public JsiDomNodeCtor<JsiSweepGradientNode> {
|
439
|
+
public:
|
440
|
+
explicit JsiSweepGradientNode(std::shared_ptr<RNSkPlatformContext> context)
|
441
|
+
: JsiBaseGradientNode(context, "skSweepGradient") {}
|
442
|
+
|
443
|
+
protected:
|
444
|
+
void decorate(DrawingContext *context) override {
|
445
|
+
JsiBaseGradientNode::decorate(context);
|
446
|
+
|
447
|
+
if (isChanged(context)) {
|
448
|
+
auto start = _startProp->isSet() ? _startProp->value().getAsNumber() : 0;
|
449
|
+
auto end = _endProp->isSet() ? _endProp->value().getAsNumber() : 360;
|
450
|
+
auto c = _centerProp->getDerivedValue();
|
451
|
+
|
452
|
+
setShader(context, SkGradientShader::MakeSweep(
|
453
|
+
c->x(), c->y(), _colors, _positions, _colorCount,
|
454
|
+
_mode, start, end, _flags, _matrix));
|
455
|
+
}
|
456
|
+
}
|
457
|
+
|
458
|
+
void defineProperties(NodePropsContainer *container) override {
|
459
|
+
JsiBaseGradientNode::defineProperties(container);
|
460
|
+
_startProp = container->defineProperty(
|
461
|
+
std::make_shared<NodeProp>(JsiPropId::get("start")));
|
462
|
+
_endProp = container->defineProperty(
|
463
|
+
std::make_shared<NodeProp>(JsiPropId::get("end")));
|
464
|
+
_centerProp = container->defineProperty(
|
465
|
+
std::make_shared<PointProp>(JsiPropId::get("c")));
|
466
|
+
}
|
467
|
+
|
468
|
+
private:
|
469
|
+
PointProp *_centerProp;
|
470
|
+
NodeProp *_startProp;
|
471
|
+
NodeProp *_endProp;
|
472
|
+
};
|
473
|
+
|
474
|
+
class JsiTwoPointConicalGradientNode
|
475
|
+
: public JsiBaseGradientNode,
|
476
|
+
public JsiDomNodeCtor<JsiTwoPointConicalGradientNode> {
|
477
|
+
public:
|
478
|
+
explicit JsiTwoPointConicalGradientNode(
|
479
|
+
std::shared_ptr<RNSkPlatformContext> context)
|
480
|
+
: JsiBaseGradientNode(context, "skTwoPointConicalGradient") {}
|
481
|
+
|
482
|
+
protected:
|
483
|
+
void decorate(DrawingContext *context) override {
|
484
|
+
JsiBaseGradientNode::decorate(context);
|
485
|
+
|
486
|
+
if (isChanged(context)) {
|
487
|
+
auto start = _startProp->getDerivedValue();
|
488
|
+
auto end = _endProp->getDerivedValue();
|
489
|
+
auto startR = _startRProp->value().getAsNumber();
|
490
|
+
auto endR = _endRProp->value().getAsNumber();
|
491
|
+
|
492
|
+
setShader(context, SkGradientShader::MakeTwoPointConical(
|
493
|
+
*start, startR, *end, endR, _colors, _positions,
|
494
|
+
_colorCount, _mode, _flags, _matrix));
|
495
|
+
}
|
496
|
+
}
|
497
|
+
|
498
|
+
void defineProperties(NodePropsContainer *container) override {
|
499
|
+
JsiBaseGradientNode::defineProperties(container);
|
500
|
+
_startProp = container->defineProperty(
|
501
|
+
std::make_shared<PointProp>(JsiPropId::get("start")));
|
502
|
+
_startRProp = container->defineProperty(
|
503
|
+
std::make_shared<NodeProp>(JsiPropId::get("startR")));
|
504
|
+
_endProp = container->defineProperty(
|
505
|
+
std::make_shared<PointProp>(JsiPropId::get("end")));
|
506
|
+
_endRProp = container->defineProperty(
|
507
|
+
std::make_shared<NodeProp>(JsiPropId::get("endR")));
|
508
|
+
}
|
509
|
+
|
510
|
+
private:
|
511
|
+
PointProp *_startProp;
|
512
|
+
NodeProp *_startRProp;
|
513
|
+
PointProp *_endProp;
|
514
|
+
NodeProp *_endRProp;
|
515
|
+
};
|
516
|
+
|
517
|
+
} // namespace RNSkia
|
@@ -0,0 +1,47 @@
|
|
1
|
+
#pragma once
|
2
|
+
|
3
|
+
#include "JsiDomDrawingNode.h"
|
4
|
+
|
5
|
+
#include "TextBlobProp.h"
|
6
|
+
|
7
|
+
#include <memory>
|
8
|
+
|
9
|
+
namespace RNSkia {
|
10
|
+
|
11
|
+
class JsiTextBlobNode : public JsiDomDrawingNode,
|
12
|
+
public JsiDomNodeCtor<JsiTextBlobNode> {
|
13
|
+
public:
|
14
|
+
explicit JsiTextBlobNode(std::shared_ptr<RNSkPlatformContext> context)
|
15
|
+
: JsiDomDrawingNode(context, "skTextBlob") {}
|
16
|
+
|
17
|
+
protected:
|
18
|
+
void draw(DrawingContext *context) override {
|
19
|
+
auto blob = _textBlobProp->getDerivedValue();
|
20
|
+
auto x = _xProp->value().getAsNumber();
|
21
|
+
auto y = _yProp->value().getAsNumber();
|
22
|
+
|
23
|
+
context->getCanvas()->drawTextBlob(blob, x, y, *context->getPaint());
|
24
|
+
}
|
25
|
+
|
26
|
+
void defineProperties(NodePropsContainer *container) override {
|
27
|
+
JsiDomDrawingNode::defineProperties(container);
|
28
|
+
|
29
|
+
_textBlobProp = container->defineProperty(
|
30
|
+
std::make_shared<TextBlobProp>(JsiPropId::get("blob")));
|
31
|
+
_xProp = container->defineProperty(
|
32
|
+
std::make_shared<NodeProp>(JsiPropId::get("x")));
|
33
|
+
_yProp = container->defineProperty(
|
34
|
+
std::make_shared<NodeProp>(JsiPropId::get("y")));
|
35
|
+
|
36
|
+
_textBlobProp->require();
|
37
|
+
_xProp->require();
|
38
|
+
_yProp->require();
|
39
|
+
}
|
40
|
+
|
41
|
+
private:
|
42
|
+
TextBlobProp *_textBlobProp;
|
43
|
+
NodeProp *_xProp;
|
44
|
+
NodeProp *_yProp;
|
45
|
+
};
|
46
|
+
|
47
|
+
} // namespace RNSkia
|