@react-native-ohos/react-native-svg 15.12.1-rc.1
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/LICENSE +21 -0
- package/README.OpenSource +11 -0
- package/README.md +13 -0
- package/css/package.json +6 -0
- package/harmony/svg/BuildProfile.ets +17 -0
- package/harmony/svg/build-profile.json5 +9 -0
- package/harmony/svg/hvigorfile.ts +2 -0
- package/harmony/svg/index.ets +7 -0
- package/harmony/svg/oh-package.json5 +13 -0
- package/harmony/svg/src/main/cpp/Attribute.h +52 -0
- package/harmony/svg/src/main/cpp/CMakeLists.txt +32 -0
- package/harmony/svg/src/main/cpp/FallbackProps.h +0 -0
- package/harmony/svg/src/main/cpp/FontHolderBase.cpp +22 -0
- package/harmony/svg/src/main/cpp/FontHolderBase.h +54 -0
- package/harmony/svg/src/main/cpp/SVGPackage.cpp +135 -0
- package/harmony/svg/src/main/cpp/SVGPackage.h +153 -0
- package/harmony/svg/src/main/cpp/SvgArkUINode.cpp +75 -0
- package/harmony/svg/src/main/cpp/SvgArkUINode.h +45 -0
- package/harmony/svg/src/main/cpp/SvgBaseAttribute.h +83 -0
- package/harmony/svg/src/main/cpp/SvgCircle.cpp +29 -0
- package/harmony/svg/src/main/cpp/SvgCircle.h +29 -0
- package/harmony/svg/src/main/cpp/SvgClipPath.h +22 -0
- package/harmony/svg/src/main/cpp/SvgContext.cpp +56 -0
- package/harmony/svg/src/main/cpp/SvgContext.h +71 -0
- package/harmony/svg/src/main/cpp/SvgDefs.h +46 -0
- package/harmony/svg/src/main/cpp/SvgEllipse.cpp +32 -0
- package/harmony/svg/src/main/cpp/SvgEllipse.h +34 -0
- package/harmony/svg/src/main/cpp/SvgFilter.cpp +505 -0
- package/harmony/svg/src/main/cpp/SvgFilter.h +112 -0
- package/harmony/svg/src/main/cpp/SvgGradient.cpp +116 -0
- package/harmony/svg/src/main/cpp/SvgGradient.h +49 -0
- package/harmony/svg/src/main/cpp/SvgGraphic.cpp +553 -0
- package/harmony/svg/src/main/cpp/SvgGraphic.h +77 -0
- package/harmony/svg/src/main/cpp/SvgGroup.cpp +86 -0
- package/harmony/svg/src/main/cpp/SvgGroup.h +41 -0
- package/harmony/svg/src/main/cpp/SvgHost.cpp +27 -0
- package/harmony/svg/src/main/cpp/SvgHost.h +38 -0
- package/harmony/svg/src/main/cpp/SvgImage.cpp +168 -0
- package/harmony/svg/src/main/cpp/SvgImage.h +52 -0
- package/harmony/svg/src/main/cpp/SvgLine.cpp +28 -0
- package/harmony/svg/src/main/cpp/SvgLine.h +32 -0
- package/harmony/svg/src/main/cpp/SvgMarker.cpp +61 -0
- package/harmony/svg/src/main/cpp/SvgMarker.h +86 -0
- package/harmony/svg/src/main/cpp/SvgMask.cpp +72 -0
- package/harmony/svg/src/main/cpp/SvgMask.h +68 -0
- package/harmony/svg/src/main/cpp/SvgNode.cpp +289 -0
- package/harmony/svg/src/main/cpp/SvgNode.h +347 -0
- package/harmony/svg/src/main/cpp/SvgPath.cpp +42 -0
- package/harmony/svg/src/main/cpp/SvgPath.h +29 -0
- package/harmony/svg/src/main/cpp/SvgPattern.cpp +77 -0
- package/harmony/svg/src/main/cpp/SvgPattern.h +64 -0
- package/harmony/svg/src/main/cpp/SvgQuote.h +87 -0
- package/harmony/svg/src/main/cpp/SvgRect.cpp +58 -0
- package/harmony/svg/src/main/cpp/SvgRect.h +33 -0
- package/harmony/svg/src/main/cpp/SvgSvg.cpp +83 -0
- package/harmony/svg/src/main/cpp/SvgSvg.h +52 -0
- package/harmony/svg/src/main/cpp/SvgSymbol.cpp +25 -0
- package/harmony/svg/src/main/cpp/SvgSymbol.h +37 -0
- package/harmony/svg/src/main/cpp/SvgTSpan.cpp +501 -0
- package/harmony/svg/src/main/cpp/SvgTSpan.h +101 -0
- package/harmony/svg/src/main/cpp/SvgText.cpp +48 -0
- package/harmony/svg/src/main/cpp/SvgText.h +29 -0
- package/harmony/svg/src/main/cpp/SvgTextPath.cpp +35 -0
- package/harmony/svg/src/main/cpp/SvgTextPath.h +51 -0
- package/harmony/svg/src/main/cpp/SvgUse.cpp +65 -0
- package/harmony/svg/src/main/cpp/SvgUse.h +46 -0
- package/harmony/svg/src/main/cpp/SvgViewManager.cpp +36 -0
- package/harmony/svg/src/main/cpp/SvgViewManager.h +37 -0
- package/harmony/svg/src/main/cpp/TextBase.cpp +20 -0
- package/harmony/svg/src/main/cpp/TextBase.h +114 -0
- package/harmony/svg/src/main/cpp/componentInstances/RNSVGBaseComponentInstance.h +212 -0
- package/harmony/svg/src/main/cpp/componentInstances/RNSVGCircleComponentInstance.cpp +31 -0
- package/harmony/svg/src/main/cpp/componentInstances/RNSVGCircleComponentInstance.h +27 -0
- package/harmony/svg/src/main/cpp/componentInstances/RNSVGClipPathComponentInstance.cpp +23 -0
- package/harmony/svg/src/main/cpp/componentInstances/RNSVGClipPathComponentInstance.h +27 -0
- package/harmony/svg/src/main/cpp/componentInstances/RNSVGDefsComponentInstance.cpp +23 -0
- package/harmony/svg/src/main/cpp/componentInstances/RNSVGDefsComponentInstance.h +28 -0
- package/harmony/svg/src/main/cpp/componentInstances/RNSVGEllipseComponentInstance.cpp +27 -0
- package/harmony/svg/src/main/cpp/componentInstances/RNSVGEllipseComponentInstance.h +27 -0
- package/harmony/svg/src/main/cpp/componentInstances/RNSVGFeBlendComponentInstance.cpp +40 -0
- package/harmony/svg/src/main/cpp/componentInstances/RNSVGFeBlendComponentInstance.h +48 -0
- package/harmony/svg/src/main/cpp/componentInstances/RNSVGFeColorMatrixComponentInstance.cpp +33 -0
- package/harmony/svg/src/main/cpp/componentInstances/RNSVGFeColorMatrixComponentInstance.h +48 -0
- package/harmony/svg/src/main/cpp/componentInstances/RNSVGFeCompositeComponentInstance.cpp +39 -0
- package/harmony/svg/src/main/cpp/componentInstances/RNSVGFeCompositeComponentInstance.h +55 -0
- package/harmony/svg/src/main/cpp/componentInstances/RNSVGFeFloodComponentInstance.cpp +33 -0
- package/harmony/svg/src/main/cpp/componentInstances/RNSVGFeFloodComponentInstance.h +49 -0
- package/harmony/svg/src/main/cpp/componentInstances/RNSVGFeGaussianBlurComponentInstance.cpp +34 -0
- package/harmony/svg/src/main/cpp/componentInstances/RNSVGFeGaussianBlurComponentInstance.h +48 -0
- package/harmony/svg/src/main/cpp/componentInstances/RNSVGFeOffsetComponentInstance.cpp +35 -0
- package/harmony/svg/src/main/cpp/componentInstances/RNSVGFeOffsetComponentInstance.h +46 -0
- package/harmony/svg/src/main/cpp/componentInstances/RNSVGFilterComponentInstance.cpp +199 -0
- package/harmony/svg/src/main/cpp/componentInstances/RNSVGFilterComponentInstance.h +48 -0
- package/harmony/svg/src/main/cpp/componentInstances/RNSVGGroupComponentInstance.cpp +32 -0
- package/harmony/svg/src/main/cpp/componentInstances/RNSVGGroupComponentInstance.h +27 -0
- package/harmony/svg/src/main/cpp/componentInstances/RNSVGImageComponentInstance.cpp +100 -0
- package/harmony/svg/src/main/cpp/componentInstances/RNSVGImageComponentInstance.h +43 -0
- package/harmony/svg/src/main/cpp/componentInstances/RNSVGLineComponentInstance.cpp +27 -0
- package/harmony/svg/src/main/cpp/componentInstances/RNSVGLineComponentInstance.h +27 -0
- package/harmony/svg/src/main/cpp/componentInstances/RNSVGLinearGradientComponentInstance.cpp +30 -0
- package/harmony/svg/src/main/cpp/componentInstances/RNSVGLinearGradientComponentInstance.h +28 -0
- package/harmony/svg/src/main/cpp/componentInstances/RNSVGMarkerComponentInstance.cpp +35 -0
- package/harmony/svg/src/main/cpp/componentInstances/RNSVGMarkerComponentInstance.h +27 -0
- package/harmony/svg/src/main/cpp/componentInstances/RNSVGMaskComponentInstance.cpp +30 -0
- package/harmony/svg/src/main/cpp/componentInstances/RNSVGMaskComponentInstance.h +27 -0
- package/harmony/svg/src/main/cpp/componentInstances/RNSVGPathComponentInstance.cpp +33 -0
- package/harmony/svg/src/main/cpp/componentInstances/RNSVGPathComponentInstance.h +29 -0
- package/harmony/svg/src/main/cpp/componentInstances/RNSVGPatternComponentInstance.cpp +40 -0
- package/harmony/svg/src/main/cpp/componentInstances/RNSVGPatternComponentInstance.h +27 -0
- package/harmony/svg/src/main/cpp/componentInstances/RNSVGRadialGradientComponentInstance.cpp +32 -0
- package/harmony/svg/src/main/cpp/componentInstances/RNSVGRadialGradientComponentInstance.h +28 -0
- package/harmony/svg/src/main/cpp/componentInstances/RNSVGRectComponentInstance.cpp +36 -0
- package/harmony/svg/src/main/cpp/componentInstances/RNSVGRectComponentInstance.h +27 -0
- package/harmony/svg/src/main/cpp/componentInstances/RNSVGSvgViewComponentInstance.cpp +86 -0
- package/harmony/svg/src/main/cpp/componentInstances/RNSVGSvgViewComponentInstance.h +47 -0
- package/harmony/svg/src/main/cpp/componentInstances/RNSVGSymbolComponentInstance.cpp +30 -0
- package/harmony/svg/src/main/cpp/componentInstances/RNSVGSymbolComponentInstance.h +27 -0
- package/harmony/svg/src/main/cpp/componentInstances/RNSVGTSpanComponentInstance.cpp +27 -0
- package/harmony/svg/src/main/cpp/componentInstances/RNSVGTSpanComponentInstance.h +27 -0
- package/harmony/svg/src/main/cpp/componentInstances/RNSVGTextComponentInstance.cpp +25 -0
- package/harmony/svg/src/main/cpp/componentInstances/RNSVGTextComponentInstance.h +27 -0
- package/harmony/svg/src/main/cpp/componentInstances/RNSVGTextPathComponentInstance.cpp +32 -0
- package/harmony/svg/src/main/cpp/componentInstances/RNSVGTextPathComponentInstance.h +27 -0
- package/harmony/svg/src/main/cpp/componentInstances/RNSVGUseComponentInstance.cpp +32 -0
- package/harmony/svg/src/main/cpp/componentInstances/RNSVGUseComponentInstance.h +32 -0
- package/harmony/svg/src/main/cpp/downloadUtils/HttpTaskProcessor.cpp +207 -0
- package/harmony/svg/src/main/cpp/downloadUtils/HttpTaskProcessor.h +88 -0
- package/harmony/svg/src/main/cpp/downloadUtils/ImageSourceResolver.cpp +106 -0
- package/harmony/svg/src/main/cpp/downloadUtils/ImageSourceResolver.h +97 -0
- package/harmony/svg/src/main/cpp/downloadUtils/LRUCache.h +98 -0
- package/harmony/svg/src/main/cpp/drawing/Brush.cpp +50 -0
- package/harmony/svg/src/main/cpp/drawing/Brush.h +52 -0
- package/harmony/svg/src/main/cpp/drawing/GlyPathBag.cpp +20 -0
- package/harmony/svg/src/main/cpp/drawing/GlyPathBag.h +31 -0
- package/harmony/svg/src/main/cpp/drawing/Matrix.cpp +100 -0
- package/harmony/svg/src/main/cpp/drawing/Matrix.h +68 -0
- package/harmony/svg/src/main/cpp/drawing/Path.cpp +173 -0
- package/harmony/svg/src/main/cpp/drawing/Path.h +127 -0
- package/harmony/svg/src/main/cpp/drawing/Pen.cpp +57 -0
- package/harmony/svg/src/main/cpp/drawing/Pen.h +59 -0
- package/harmony/svg/src/main/cpp/drawing/Rect.cpp +47 -0
- package/harmony/svg/src/main/cpp/drawing/Rect.h +56 -0
- package/harmony/svg/src/main/cpp/drawing/RoundRect.cpp +24 -0
- package/harmony/svg/src/main/cpp/drawing/RoundRect.h +39 -0
- package/harmony/svg/src/main/cpp/drawing/ShaderEffect.cpp +37 -0
- package/harmony/svg/src/main/cpp/drawing/ShaderEffect.h +51 -0
- package/harmony/svg/src/main/cpp/drawing/TextStyle.cpp +49 -0
- package/harmony/svg/src/main/cpp/drawing/TextStyle.h +41 -0
- package/harmony/svg/src/main/cpp/drawing/Typography.cpp +9 -0
- package/harmony/svg/src/main/cpp/drawing/Typography.h +25 -0
- package/harmony/svg/src/main/cpp/drawing/TypographyStyle.cpp +31 -0
- package/harmony/svg/src/main/cpp/drawing/TypographyStyle.h +41 -0
- package/harmony/svg/src/main/cpp/generated/RNOH/generated/components/RNSVGCircleJSIBinder.h +54 -0
- package/harmony/svg/src/main/cpp/generated/RNOH/generated/components/RNSVGClipPathJSIBinder.h +54 -0
- package/harmony/svg/src/main/cpp/generated/RNOH/generated/components/RNSVGDefsJSIBinder.h +38 -0
- package/harmony/svg/src/main/cpp/generated/RNOH/generated/components/RNSVGEllipseJSIBinder.h +55 -0
- package/harmony/svg/src/main/cpp/generated/RNOH/generated/components/RNSVGFeBlendJSIBinder.h +26 -0
- package/harmony/svg/src/main/cpp/generated/RNOH/generated/components/RNSVGFeColorMatrixJSIBinder.h +26 -0
- package/harmony/svg/src/main/cpp/generated/RNOH/generated/components/RNSVGFeCompositeJSIBinder.h +30 -0
- package/harmony/svg/src/main/cpp/generated/RNOH/generated/components/RNSVGFeFloodJSIBinder.h +26 -0
- package/harmony/svg/src/main/cpp/generated/RNOH/generated/components/RNSVGFeGaussianBlurJSIBinder.h +27 -0
- package/harmony/svg/src/main/cpp/generated/RNOH/generated/components/RNSVGFeOffsetJSIBinder.h +26 -0
- package/harmony/svg/src/main/cpp/generated/RNOH/generated/components/RNSVGFilterJSIBinder.h +44 -0
- package/harmony/svg/src/main/cpp/generated/RNOH/generated/components/RNSVGForeignObjectJSIBinder.h +57 -0
- package/harmony/svg/src/main/cpp/generated/RNOH/generated/components/RNSVGGroupJSIBinder.h +54 -0
- package/harmony/svg/src/main/cpp/generated/RNOH/generated/components/RNSVGImageJSIBinder.h +58 -0
- package/harmony/svg/src/main/cpp/generated/RNOH/generated/components/RNSVGLineJSIBinder.h +55 -0
- package/harmony/svg/src/main/cpp/generated/RNOH/generated/components/RNSVGLinearGradientJSIBinder.h +45 -0
- package/harmony/svg/src/main/cpp/generated/RNOH/generated/components/RNSVGMarkerJSIBinder.h +66 -0
- package/harmony/svg/src/main/cpp/generated/RNOH/generated/components/RNSVGMaskJSIBinder.h +60 -0
- package/harmony/svg/src/main/cpp/generated/RNOH/generated/components/RNSVGPathJSIBinder.h +52 -0
- package/harmony/svg/src/main/cpp/generated/RNOH/generated/components/RNSVGPatternJSIBinder.h +67 -0
- package/harmony/svg/src/main/cpp/generated/RNOH/generated/components/RNSVGRadialGradientJSIBinder.h +47 -0
- package/harmony/svg/src/main/cpp/generated/RNOH/generated/components/RNSVGRectJSIBinder.h +57 -0
- package/harmony/svg/src/main/cpp/generated/RNOH/generated/components/RNSVGSvgViewAndroidJSIBinder.h +67 -0
- package/harmony/svg/src/main/cpp/generated/RNOH/generated/components/RNSVGSvgViewJSIBinder.h +36 -0
- package/harmony/svg/src/main/cpp/generated/RNOH/generated/components/RNSVGSymbolJSIBinder.h +60 -0
- package/harmony/svg/src/main/cpp/generated/RNOH/generated/components/RNSVGTSpanJSIBinder.h +66 -0
- package/harmony/svg/src/main/cpp/generated/RNOH/generated/components/RNSVGTextJSIBinder.h +65 -0
- package/harmony/svg/src/main/cpp/generated/RNOH/generated/components/RNSVGTextPathJSIBinder.h +71 -0
- package/harmony/svg/src/main/cpp/generated/RNOH/generated/components/RNSVGUseJSIBinder.h +56 -0
- package/harmony/svg/src/main/cpp/generated/react/renderer/components/react_native_svg/ComponentDescriptors.h +48 -0
- package/harmony/svg/src/main/cpp/generated/react/renderer/components/react_native_svg/EventEmitters.cpp +20 -0
- package/harmony/svg/src/main/cpp/generated/react/renderer/components/react_native_svg/EventEmitters.h +253 -0
- package/harmony/svg/src/main/cpp/generated/react/renderer/components/react_native_svg/Props.cpp +977 -0
- package/harmony/svg/src/main/cpp/generated/react/renderer/components/react_native_svg/Props.h +1280 -0
- package/harmony/svg/src/main/cpp/generated/react/renderer/components/react_native_svg/ShadowNodes.cpp +45 -0
- package/harmony/svg/src/main/cpp/generated/react/renderer/components/react_native_svg/ShadowNodes.h +331 -0
- package/harmony/svg/src/main/cpp/generated/react/renderer/components/react_native_svg/States.cpp +18 -0
- package/harmony/svg/src/main/cpp/generated/react/renderer/components/react_native_svg/States.h +441 -0
- package/harmony/svg/src/main/cpp/properties/Color.cpp +458 -0
- package/harmony/svg/src/main/cpp/properties/Color.h +144 -0
- package/harmony/svg/src/main/cpp/properties/Decoration.cpp +41 -0
- package/harmony/svg/src/main/cpp/properties/Decoration.h +483 -0
- package/harmony/svg/src/main/cpp/properties/Dimension.cpp +64 -0
- package/harmony/svg/src/main/cpp/properties/Dimension.h +243 -0
- package/harmony/svg/src/main/cpp/properties/Font.cpp +166 -0
- package/harmony/svg/src/main/cpp/properties/Font.h +163 -0
- package/harmony/svg/src/main/cpp/properties/Offset.h +119 -0
- package/harmony/svg/src/main/cpp/properties/PaintState.h +240 -0
- package/harmony/svg/src/main/cpp/properties/Rect.h +423 -0
- package/harmony/svg/src/main/cpp/properties/Size.h +246 -0
- package/harmony/svg/src/main/cpp/properties/SvgPaintState.h +452 -0
- package/harmony/svg/src/main/cpp/properties/TextProperties.cpp +91 -0
- package/harmony/svg/src/main/cpp/properties/TextProperties.h +56 -0
- package/harmony/svg/src/main/cpp/properties/ViewBox.h +108 -0
- package/harmony/svg/src/main/cpp/svgImage/RNSVGImageComponentDescriptor.h +41 -0
- package/harmony/svg/src/main/cpp/svgImage/RNSVGImageShadowNode.cpp +62 -0
- package/harmony/svg/src/main/cpp/svgImage/RNSVGImageShadowNode.h +63 -0
- package/harmony/svg/src/main/cpp/svgImage/RNSVGImageState.cpp +17 -0
- package/harmony/svg/src/main/cpp/svgImage/RNSVGImageState.h +58 -0
- package/harmony/svg/src/main/cpp/turboModules/RNSVGImageModule.cpp +54 -0
- package/harmony/svg/src/main/cpp/turboModules/RNSVGImageModule.h +32 -0
- package/harmony/svg/src/main/cpp/turboModules/RNSVGRenderableModule.cpp +101 -0
- package/harmony/svg/src/main/cpp/turboModules/RNSVGRenderableModule.h +32 -0
- package/harmony/svg/src/main/cpp/turboModules/RNSVGSvgViewModule.cpp +71 -0
- package/harmony/svg/src/main/cpp/turboModules/RNSVGSvgViewModule.h +32 -0
- package/harmony/svg/src/main/cpp/utils/DynamicUtils.h +55 -0
- package/harmony/svg/src/main/cpp/utils/FilterManager.h +190 -0
- package/harmony/svg/src/main/cpp/utils/GlyphContext.cpp +221 -0
- package/harmony/svg/src/main/cpp/utils/GlyphContext.h +106 -0
- package/harmony/svg/src/main/cpp/utils/LinearMap.h +69 -0
- package/harmony/svg/src/main/cpp/utils/PathParserUtils.cpp +591 -0
- package/harmony/svg/src/main/cpp/utils/PathParserUtils.h +93 -0
- package/harmony/svg/src/main/cpp/utils/StringUtils.cpp +134 -0
- package/harmony/svg/src/main/cpp/utils/StringUtils.h +644 -0
- package/harmony/svg/src/main/cpp/utils/SvgAttributesParser.cpp +239 -0
- package/harmony/svg/src/main/cpp/utils/SvgAttributesParser.h +277 -0
- package/harmony/svg/src/main/cpp/utils/SvgMarkerPositionUtils.h +200 -0
- package/harmony/svg/src/main/cpp/utils/SvgUtils.h +176 -0
- package/harmony/svg/src/main/cpp/utils/TextPathHelper.cpp +94 -0
- package/harmony/svg/src/main/cpp/utils/TextPathHelper.h +61 -0
- package/harmony/svg/src/main/ets/RNSVGImageModule.ts +21 -0
- package/harmony/svg/src/main/ets/RNSVGRenderableModule.ts +16 -0
- package/harmony/svg/src/main/ets/RNSVGSvgViewModule.ts +18 -0
- package/harmony/svg/src/main/ets/SvgPackage.ts +58 -0
- package/harmony/svg/src/main/module.json5 +7 -0
- package/harmony/svg/src/main/resources/base/element/string.json +8 -0
- package/harmony/svg/src/main/resources/en_US/element/string.json +8 -0
- package/harmony/svg/src/main/resources/zh_CN/element/string.json +8 -0
- package/harmony/svg/ts.ts +8 -0
- package/harmony/svg.har +0 -0
- package/lib/commonjs/css/index.js +55 -0
- package/lib/commonjs/css/index.js.map +1 -0
- package/lib/commonjs/index.js +26 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/module/css/index.js +4 -0
- package/lib/module/css/index.js.map +1 -0
- package/lib/module/index.js +3 -0
- package/lib/module/index.js.map +1 -0
- package/lib/typescript/babel.config.d.ts +8 -0
- package/lib/typescript/babel.config.d.ts.map +1 -0
- package/lib/typescript/example/babel.config.d.ts +3 -0
- package/lib/typescript/example/babel.config.d.ts.map +1 -0
- package/lib/typescript/example/contexts.d.ts +3 -0
- package/lib/typescript/example/contexts.d.ts.map +1 -0
- package/lib/typescript/example/harmony/entry/hvigorfile.d.ts +2 -0
- package/lib/typescript/example/harmony/entry/hvigorfile.d.ts.map +1 -0
- package/lib/typescript/example/harmony/hvigorfile.d.ts +2 -0
- package/lib/typescript/example/harmony/hvigorfile.d.ts.map +1 -0
- package/lib/typescript/example/index.d.ts +2 -0
- package/lib/typescript/example/index.d.ts.map +1 -0
- package/lib/typescript/example/jest.config.d.ts +3 -0
- package/lib/typescript/example/jest.config.d.ts.map +1 -0
- package/lib/typescript/example/metro.config.d.ts +3 -0
- package/lib/typescript/example/metro.config.d.ts.map +1 -0
- package/lib/typescript/example/react-native.config.d.ts +3 -0
- package/lib/typescript/example/react-native.config.d.ts.map +1 -0
- package/lib/typescript/example/scripts/create-build-profile.d.ts +2 -0
- package/lib/typescript/example/scripts/create-build-profile.d.ts.map +1 -0
- package/lib/typescript/example/src/index.d.ts +3 -0
- package/lib/typescript/example/src/index.d.ts.map +1 -0
- package/lib/typescript/src/css/index.d.ts +4 -0
- package/lib/typescript/src/css/index.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +3 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/package.json +54 -0
- package/src/css/index.tsx +20 -0
- package/src/index.tsx +3 -0
- package/tsconfig.json +12 -0
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved
|
|
3
|
+
* Use of this source code is governed by a MIT license that can be
|
|
4
|
+
* found in the LICENSE file.
|
|
5
|
+
*
|
|
6
|
+
* This file incorporates from the OpenHarmony project, licensed under
|
|
7
|
+
* the Apache License, Version 2.0. Specifically:
|
|
8
|
+
* - [OpenHarmony/arkui_ace_engine] (https://gitee.com/openharmony/arkui_ace_engine)
|
|
9
|
+
*
|
|
10
|
+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
|
11
|
+
* use this file except in compliance with the License. You may obtain a copy
|
|
12
|
+
* of the License at:
|
|
13
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
14
|
+
*
|
|
15
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
16
|
+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
17
|
+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
18
|
+
* License for the specific language governing permissions and limitations
|
|
19
|
+
* under the License.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
// from ArkUI "frameworks/base/geometry/size.h"
|
|
23
|
+
#pragma once
|
|
24
|
+
|
|
25
|
+
#include <iomanip>
|
|
26
|
+
#include <limits>
|
|
27
|
+
#include <sstream>
|
|
28
|
+
#include <string>
|
|
29
|
+
|
|
30
|
+
#include "utils/SvgUtils.h"
|
|
31
|
+
|
|
32
|
+
namespace rnoh {
|
|
33
|
+
namespace svg {
|
|
34
|
+
|
|
35
|
+
class Size {
|
|
36
|
+
public:
|
|
37
|
+
static constexpr double INFINITE_SIZE = std::numeric_limits<double>::max();
|
|
38
|
+
Size() = default;
|
|
39
|
+
~Size() = default;
|
|
40
|
+
Size(double width, double height) : width_(width), height_(height) {}
|
|
41
|
+
|
|
42
|
+
inline static bool IsValueInfinite(double inputValue)
|
|
43
|
+
{
|
|
44
|
+
return NearEqual(inputValue, INFINITE_SIZE);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
static Size ErrorSize()
|
|
48
|
+
{
|
|
49
|
+
return Size((std::numeric_limits<double>::max)(), (std::numeric_limits<double>::max)());
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
bool IsErrorSize() const
|
|
53
|
+
{
|
|
54
|
+
return operator==(ErrorSize());
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
double Width() const
|
|
58
|
+
{
|
|
59
|
+
return width_;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
double Height() const
|
|
63
|
+
{
|
|
64
|
+
return height_;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
void SetWidth(double width)
|
|
68
|
+
{
|
|
69
|
+
width_ = width;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
void SetHeight(double height)
|
|
73
|
+
{
|
|
74
|
+
height_ = height;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
void SetSize(const Size& size)
|
|
78
|
+
{
|
|
79
|
+
width_ = size.Width();
|
|
80
|
+
height_ = size.Height();
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
bool IsWidthInfinite() const
|
|
84
|
+
{
|
|
85
|
+
return NearEqual(width_, INFINITE_SIZE);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
bool IsHeightInfinite() const
|
|
89
|
+
{
|
|
90
|
+
return NearEqual(height_, INFINITE_SIZE);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
bool IsInfinite() const
|
|
94
|
+
{
|
|
95
|
+
return NearEqual(width_, INFINITE_SIZE) || NearEqual(height_, INFINITE_SIZE);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
bool IsEmpty() const
|
|
99
|
+
{
|
|
100
|
+
return NearEqual(width_, 0.0) || NearEqual(height_, 0.0);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
Size& AddHeight(double height)
|
|
104
|
+
{
|
|
105
|
+
height_ += height;
|
|
106
|
+
return *this;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
Size& AddWidth(double value)
|
|
110
|
+
{
|
|
111
|
+
width_ += value;
|
|
112
|
+
return *this;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
Size& MinusHeight(double height)
|
|
116
|
+
{
|
|
117
|
+
height_ -= height;
|
|
118
|
+
return *this;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
Size& MinusWidth(double width)
|
|
122
|
+
{
|
|
123
|
+
width_ -= width;
|
|
124
|
+
return *this;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
bool IsValid() const
|
|
128
|
+
{
|
|
129
|
+
return width_ > 0.0 && height_ > 0.0;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
Size operator+(const Size& size) const
|
|
133
|
+
{
|
|
134
|
+
return Size(width_ + size.Width(), height_ + size.Height());
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
Size operator-(const Size& size) const
|
|
138
|
+
{
|
|
139
|
+
return Size(width_ - size.Width(), height_ - size.Height());
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
Size operator*(double value) const
|
|
143
|
+
{
|
|
144
|
+
return Size(width_ * value, height_ * value);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
Size operator/(double value) const
|
|
148
|
+
{
|
|
149
|
+
if (NearZero(value)) {
|
|
150
|
+
return ErrorSize();
|
|
151
|
+
}
|
|
152
|
+
return Size(width_ / value, height_ / value);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
bool operator==(const Size& size) const
|
|
156
|
+
{
|
|
157
|
+
return NearEqual(width_, size.width_) && NearEqual(height_, size.height_);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
bool operator!=(const Size& size) const
|
|
161
|
+
{
|
|
162
|
+
return !operator==(size);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
Size operator+=(const Size& size)
|
|
166
|
+
{
|
|
167
|
+
width_ += size.Width();
|
|
168
|
+
height_ += size.Height();
|
|
169
|
+
return *this;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
Size operator-=(const Size& size)
|
|
173
|
+
{
|
|
174
|
+
width_ -= size.Width();
|
|
175
|
+
height_ -= size.Height();
|
|
176
|
+
return *this;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
void ApplyScale(double scale)
|
|
180
|
+
{
|
|
181
|
+
width_ *= scale;
|
|
182
|
+
height_ *= scale;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/*
|
|
186
|
+
* Please make sure that two sizes are both valid.
|
|
187
|
+
* You can use IsValid() to see if a size is valid.
|
|
188
|
+
*/
|
|
189
|
+
bool operator>(const Size& size) const
|
|
190
|
+
{
|
|
191
|
+
if (IsValid() && size.IsValid()) {
|
|
192
|
+
return GreatOrEqual(width_, size.width_) && GreatOrEqual(height_, size.height_);
|
|
193
|
+
} else {
|
|
194
|
+
return false;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/*
|
|
199
|
+
* Please make sure that two sizes are both valid.
|
|
200
|
+
* You can use IsValid() to see if a size is valid.
|
|
201
|
+
*/
|
|
202
|
+
bool operator<(const Size& size) const
|
|
203
|
+
{
|
|
204
|
+
if (IsValid() && size.IsValid()) {
|
|
205
|
+
return LessOrEqual(width_, size.width_) && LessOrEqual(height_, size.height_);
|
|
206
|
+
} else {
|
|
207
|
+
return false;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
template<class T>
|
|
212
|
+
static double CalcRatio(const T& rectangle)
|
|
213
|
+
{
|
|
214
|
+
if (NearZero(static_cast<double>(rectangle.Height()))) {
|
|
215
|
+
return INFINITE_SIZE;
|
|
216
|
+
}
|
|
217
|
+
return static_cast<double>(rectangle.Width()) / static_cast<double>(rectangle.Height());
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
std::string ToString() const
|
|
221
|
+
{
|
|
222
|
+
std::stringstream ss;
|
|
223
|
+
ss << "[" << std::fixed << std::setprecision(2);
|
|
224
|
+
if (NearEqual(width_, INFINITE_SIZE)) {
|
|
225
|
+
ss << "INFINITE";
|
|
226
|
+
} else {
|
|
227
|
+
ss << width_;
|
|
228
|
+
}
|
|
229
|
+
ss << " x ";
|
|
230
|
+
if (NearEqual(height_, INFINITE_SIZE)) {
|
|
231
|
+
ss << "INFINITE";
|
|
232
|
+
} else {
|
|
233
|
+
ss << height_;
|
|
234
|
+
}
|
|
235
|
+
ss << "]";
|
|
236
|
+
std::string output = ss.str();
|
|
237
|
+
return output;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
private:
|
|
241
|
+
double width_ = 0.0;
|
|
242
|
+
double height_ = 0.0;
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
} // namespace svg
|
|
246
|
+
} // namespace rnoh
|
|
@@ -0,0 +1,452 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved
|
|
3
|
+
* Use of this source code is governed by a MIT license that can be
|
|
4
|
+
* found in the LICENSE file.
|
|
5
|
+
*
|
|
6
|
+
* This file incorporates from the OpenHarmony project, licensed under
|
|
7
|
+
* the Apache License, Version 2.0. Specifically:
|
|
8
|
+
* - [OpenHarmony/arkui_ace_engine] (https://gitee.com/openharmony/arkui_ace_engine)
|
|
9
|
+
*
|
|
10
|
+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
|
11
|
+
* use this file except in compliance with the License. You may obtain a copy
|
|
12
|
+
* of the License at:
|
|
13
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
14
|
+
*
|
|
15
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
16
|
+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
17
|
+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
18
|
+
* License for the specific language governing permissions and limitations
|
|
19
|
+
* under the License.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
// from ArkUI "frameworks/core/components/common/properties/svg_paint_state.h"
|
|
23
|
+
#pragma once
|
|
24
|
+
|
|
25
|
+
#include "Decoration.h"
|
|
26
|
+
#include "properties/Color.h"
|
|
27
|
+
#include "properties/PaintState.h"
|
|
28
|
+
#include "properties/Decoration.h"
|
|
29
|
+
#include <native_drawing/drawing_path.h>
|
|
30
|
+
#include <glog/logging.h>
|
|
31
|
+
|
|
32
|
+
namespace rnoh {
|
|
33
|
+
namespace svg {
|
|
34
|
+
|
|
35
|
+
const char ATTR_NAME_FILL[] = "fill";
|
|
36
|
+
const char ATTR_NAME_STROKE[] = "stroke";
|
|
37
|
+
const char ATTR_NAME_STROKE_WIDTH[] = "stroke-width";
|
|
38
|
+
const char ATTR_NAME_MITER_LIMIT[] = "stroke-miterlimit";
|
|
39
|
+
const char ATTR_NAME_STROKE_DASH_OFFSET[] = "stroke-dashoffset";
|
|
40
|
+
const char ATTR_NAME_FONT_SIZE[] = "font-size";
|
|
41
|
+
const char ATTR_NAME_FILL_OPACITY[] = "fill-opacity";
|
|
42
|
+
const char ATTR_NAME_STROKE_OPACITY[] = "stroke-opacity";
|
|
43
|
+
const char ATTR_NAME_LETTER_SPACING[] = "letter-spacing";
|
|
44
|
+
const char ANIMATOR_TYPE_MOTION[] = "motion";
|
|
45
|
+
const char ATTR_NAME_FILL_RULE_EVENODD[] = "evenodd";
|
|
46
|
+
|
|
47
|
+
class FillState {
|
|
48
|
+
public:
|
|
49
|
+
enum class FillRule {
|
|
50
|
+
FILL_RULE_EVEN_ODD = 0,
|
|
51
|
+
FILL_RULE_NONZERO = 1
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
const Color &GetColor() const { return color_; }
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* set fill color
|
|
58
|
+
* @param color
|
|
59
|
+
* @param isSelf if false the color value inherited from the parent node, otherwise the value is setted by self
|
|
60
|
+
*/
|
|
61
|
+
void SetColor(const Color &color, bool isSelf) {
|
|
62
|
+
color_ = Color(color);
|
|
63
|
+
hasColor_ = isSelf;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
std::optional<Gradient> &GetGradient() { return gradient_; }
|
|
67
|
+
|
|
68
|
+
const std::optional<Gradient> &GetGradient() const { return gradient_; }
|
|
69
|
+
|
|
70
|
+
void SetGradient(const Gradient &gradient, bool isSelf) {
|
|
71
|
+
gradient_ = std::make_optional(gradient);
|
|
72
|
+
hasGradient_ = isSelf;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
void SetGradient(const std::optional<Gradient> &gradient, bool isSelf) {
|
|
76
|
+
gradient_ = gradient;
|
|
77
|
+
hasGradient_ = isSelf;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
std::shared_ptr<PatternAttr> &GetPatternAttr() { return patternAttr_; }
|
|
81
|
+
|
|
82
|
+
const std::shared_ptr<PatternAttr> &GetPatternAttr() const { return patternAttr_; }
|
|
83
|
+
|
|
84
|
+
void SetPattern(std::shared_ptr<PatternAttr> patternAttr) {
|
|
85
|
+
patternAttr_ = patternAttr;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
void SetOpacity(double opacity, bool isSelf) {
|
|
89
|
+
opacity_ = opacity;
|
|
90
|
+
hasOpacity_ = isSelf;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
double GetOpacity() const { return opacity_; }
|
|
94
|
+
|
|
95
|
+
void SetFillRule(const FillState::FillRule fillRule , bool isSelf) {
|
|
96
|
+
fillRule_ = fillRule;
|
|
97
|
+
hasFillRule_ = isSelf;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const FillState::FillRule &GetFillRule() const { return fillRule_; }
|
|
101
|
+
|
|
102
|
+
OH_Drawing_PathFillType GetFillRuleForDraw() const{
|
|
103
|
+
if (IsEvenodd()) {
|
|
104
|
+
return OH_Drawing_PathFillType::PATH_FILL_TYPE_EVEN_ODD;
|
|
105
|
+
} else {
|
|
106
|
+
return OH_Drawing_PathFillType::PATH_FILL_TYPE_WINDING;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
bool IsEvenodd() const { return fillRule_ == FillRule::FILL_RULE_EVEN_ODD; }
|
|
111
|
+
//
|
|
112
|
+
void Inherit(const FillState &parent) {
|
|
113
|
+
if (!hasColor_) {
|
|
114
|
+
color_ = parent.GetColor();
|
|
115
|
+
}
|
|
116
|
+
if (!hasOpacity_) {
|
|
117
|
+
opacity_ = parent.GetOpacity();
|
|
118
|
+
}
|
|
119
|
+
if (!hasFillRule_) {
|
|
120
|
+
fillRule_ = parent.GetFillRule();
|
|
121
|
+
}
|
|
122
|
+
if (!hasGradient_) {
|
|
123
|
+
gradient_ = parent.GetGradient();
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
bool HasColor() const { return hasColor_; }
|
|
128
|
+
|
|
129
|
+
bool HasOpacity() const { return hasOpacity_; }
|
|
130
|
+
|
|
131
|
+
void SetHref(const std::string &href) { href_ = href; }
|
|
132
|
+
|
|
133
|
+
const std::string &GetHref() const { return href_; }
|
|
134
|
+
|
|
135
|
+
protected:
|
|
136
|
+
Color color_ = Color(Color::BLACK);
|
|
137
|
+
double opacity_ = double(1.0);
|
|
138
|
+
FillState::FillRule fillRule_;
|
|
139
|
+
std::optional<Gradient> gradient_;
|
|
140
|
+
std::shared_ptr<PatternAttr> patternAttr_;
|
|
141
|
+
bool hasColor_ = false;
|
|
142
|
+
bool hasOpacity_ = false;
|
|
143
|
+
bool hasFillRule_ = false;
|
|
144
|
+
bool hasGradient_ = false;
|
|
145
|
+
std::string href_;
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
class StrokeState {
|
|
149
|
+
public:
|
|
150
|
+
const Color& GetColor() const
|
|
151
|
+
{
|
|
152
|
+
return color_;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
void SetColor(const Color& color, bool isSelf)
|
|
156
|
+
{
|
|
157
|
+
color_ = color;
|
|
158
|
+
hasColor_ = isSelf;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
std::optional<Gradient> &GetGradient() { return gradient_; }
|
|
162
|
+
|
|
163
|
+
const std::optional<Gradient> &GetGradient() const { return gradient_; }
|
|
164
|
+
|
|
165
|
+
void SetGradient(const Gradient &gradient, bool isSelf) {
|
|
166
|
+
gradient_ = std::make_optional(gradient);
|
|
167
|
+
hasGradient_ = isSelf;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
void SetGradient(const std::optional<Gradient> &gradient, bool isSelf) {
|
|
171
|
+
gradient_ = gradient;
|
|
172
|
+
hasGradient_ = isSelf;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
void SetOpacity(double opacity, bool isSelf)
|
|
176
|
+
{
|
|
177
|
+
opacity_ = opacity;
|
|
178
|
+
hasOpacity_ = isSelf;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
double GetOpacity() const
|
|
182
|
+
{
|
|
183
|
+
return opacity_;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
LineCapStyle GetLineCap() const
|
|
187
|
+
{
|
|
188
|
+
return lineCap_;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
void SetLineCap(LineCapStyle lineCap, bool isSelf)
|
|
192
|
+
{
|
|
193
|
+
lineCap_ = lineCap;
|
|
194
|
+
hasLineCap_ = isSelf;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
LineJoinStyle GetLineJoin() const
|
|
198
|
+
{
|
|
199
|
+
return lineJoin_;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
void SetLineJoin(LineJoinStyle lineJoin, bool isSelf)
|
|
203
|
+
{
|
|
204
|
+
lineJoin_ = lineJoin;
|
|
205
|
+
hasLineJoin_ = isSelf;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
const double& GetLineWidth() const
|
|
209
|
+
{
|
|
210
|
+
return lineWidth_;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
void SetLineWidth(double lineWidth, bool isSelf)
|
|
214
|
+
{
|
|
215
|
+
lineWidth_ = lineWidth;
|
|
216
|
+
hasLineWidth_ = isSelf;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
double GetMiterLimit() const
|
|
220
|
+
{
|
|
221
|
+
return miterLimit_;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
void SetMiterLimit(double miterLimit, bool isSelf)
|
|
225
|
+
{
|
|
226
|
+
miterLimit_ = miterLimit;
|
|
227
|
+
hasMiterLimit_ = isSelf;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
const LineDashParam& GetLineDash() const
|
|
231
|
+
{
|
|
232
|
+
return lineDash_;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
void SetLineDash(const LineDashParam& lineDash, bool isSelf)
|
|
236
|
+
{
|
|
237
|
+
lineDash_ = lineDash;
|
|
238
|
+
hasLineDash_ = isSelf;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
void SetLineDashOffset(double offset, bool isSelf)
|
|
242
|
+
{
|
|
243
|
+
lineDash_.dashOffset = offset;
|
|
244
|
+
hasDashOffset_ = isSelf;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
void SetLineDash(const std::vector<double>& segments, bool isSelf)
|
|
248
|
+
{
|
|
249
|
+
lineDash_.lineDash = segments;
|
|
250
|
+
hasLineDash_ = isSelf;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
void SetStrokeDashOffset(const double& offset, bool isSelf)
|
|
254
|
+
{
|
|
255
|
+
strokeDashOffset_ = offset;
|
|
256
|
+
hasStrokeDashOffset_ = isSelf;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
void SetStrokeDashArray(const std::vector<double>& segments, bool isSelf)
|
|
260
|
+
{
|
|
261
|
+
strokeDashArray_ = segments;
|
|
262
|
+
hasStrokeDashArray_ = isSelf;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
const double& GetStrokeDashOffset() const
|
|
266
|
+
{
|
|
267
|
+
return strokeDashOffset_;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
const std::vector<double>& GetStrokeDashArray() const
|
|
271
|
+
{
|
|
272
|
+
return strokeDashArray_;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
bool HasStroke() const
|
|
276
|
+
{
|
|
277
|
+
// The text outline is drawn only when stroke is set
|
|
278
|
+
return color_ != Color::TRANSPARENT;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
void SetVectorEffect(int VectorEffect)
|
|
282
|
+
{
|
|
283
|
+
vectorEffect_ = VectorEffect;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
const int GetVectorEffect() const
|
|
287
|
+
{
|
|
288
|
+
return vectorEffect_;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
void Inherit(const StrokeState& strokeState)
|
|
292
|
+
{
|
|
293
|
+
if (!hasColor_) {
|
|
294
|
+
color_ = strokeState.GetColor();
|
|
295
|
+
}
|
|
296
|
+
if (!hasOpacity_) {
|
|
297
|
+
opacity_ = strokeState.GetOpacity();
|
|
298
|
+
}
|
|
299
|
+
if (!hasLineCap_) {
|
|
300
|
+
lineCap_ = strokeState.GetLineCap();
|
|
301
|
+
}
|
|
302
|
+
if (!hasLineJoin_) {
|
|
303
|
+
lineJoin_ = strokeState.GetLineJoin();
|
|
304
|
+
}
|
|
305
|
+
DLOG(INFO) << "hasLineWIdth = " << hasLineWidth_ << " to inherit : " << strokeState.GetLineWidth();
|
|
306
|
+
if (!hasLineWidth_) {
|
|
307
|
+
lineWidth_ = strokeState.GetLineWidth();
|
|
308
|
+
}
|
|
309
|
+
if (!hasMiterLimit_) {
|
|
310
|
+
miterLimit_ = strokeState.GetMiterLimit();
|
|
311
|
+
}
|
|
312
|
+
if (!hasLineDash_) {
|
|
313
|
+
lineDash_.lineDash = strokeState.GetLineDash().lineDash;
|
|
314
|
+
}
|
|
315
|
+
if (!hasDashOffset_) {
|
|
316
|
+
lineDash_.dashOffset = strokeState.GetLineDash().dashOffset;
|
|
317
|
+
}
|
|
318
|
+
if (!hasStrokeDashArray_) {
|
|
319
|
+
strokeDashArray_ = strokeState.GetStrokeDashArray();
|
|
320
|
+
}
|
|
321
|
+
if (!hasStrokeDashOffset_) {
|
|
322
|
+
strokeDashOffset_ = strokeState.GetStrokeDashOffset();
|
|
323
|
+
}
|
|
324
|
+
if (!hasGradient_) {
|
|
325
|
+
gradient_ = strokeState.GetGradient();
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
bool HasColor() const
|
|
330
|
+
{
|
|
331
|
+
return hasColor_;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
bool HasOpacity() const
|
|
335
|
+
{
|
|
336
|
+
return hasOpacity_;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
bool HasLineWidth() const
|
|
340
|
+
{
|
|
341
|
+
return hasLineWidth_;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
bool HasMiterLimit() const
|
|
345
|
+
{
|
|
346
|
+
return hasMiterLimit_;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
bool HasDashOffset() const
|
|
350
|
+
{
|
|
351
|
+
return hasDashOffset_;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
void SetHref(const std::string& href)
|
|
355
|
+
{
|
|
356
|
+
href_ = href;
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
const std::string& GetHref() const
|
|
360
|
+
{
|
|
361
|
+
return href_;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
private:
|
|
365
|
+
Color color_ = Color::TRANSPARENT;
|
|
366
|
+
double opacity_ = 1.0;
|
|
367
|
+
LineCapStyle lineCap_ = LineCapStyle::BUTT;
|
|
368
|
+
LineJoinStyle lineJoin_ = LineJoinStyle::MITER;
|
|
369
|
+
double lineWidth_ = 1.0;
|
|
370
|
+
double miterLimit_ = 4.0;
|
|
371
|
+
LineDashParam lineDash_;
|
|
372
|
+
std::vector<double> strokeDashArray_;
|
|
373
|
+
double strokeDashOffset_;
|
|
374
|
+
std::string href_;
|
|
375
|
+
int vectorEffect_ = 0;
|
|
376
|
+
std::optional<Gradient> gradient_;
|
|
377
|
+
|
|
378
|
+
bool hasColor_ = false;
|
|
379
|
+
bool hasOpacity_ = false;
|
|
380
|
+
bool hasLineCap_ = false;
|
|
381
|
+
bool hasLineJoin_ = false;
|
|
382
|
+
bool hasLineWidth_ = false;
|
|
383
|
+
bool hasMiterLimit_ = false;
|
|
384
|
+
bool hasLineDash_ = false;
|
|
385
|
+
bool hasDashOffset_ = false;
|
|
386
|
+
bool hasStrokeDashArray_ = false;
|
|
387
|
+
bool hasStrokeDashOffset_ = false;
|
|
388
|
+
bool hasGradient_ = false;
|
|
389
|
+
};
|
|
390
|
+
|
|
391
|
+
class ClipState {
|
|
392
|
+
public:
|
|
393
|
+
enum class ClipRule {
|
|
394
|
+
CLIP_RULE_EVENODD = 0,
|
|
395
|
+
CLIP_RULE_NONZERO
|
|
396
|
+
};
|
|
397
|
+
|
|
398
|
+
void SetClipRule(const ClipState::ClipRule clipRule, bool isSelf)
|
|
399
|
+
{
|
|
400
|
+
clipRule_ = clipRule;
|
|
401
|
+
hasClipRule_ = isSelf;
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
const ClipState::ClipRule GetClipRule() const
|
|
405
|
+
{
|
|
406
|
+
return clipRule_;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
// Convert different interface values (FILL_RULE_NONZERO <===> PATH_FILL_TYPE_WINDING)
|
|
410
|
+
OH_Drawing_PathFillType GetClipRuleForDraw() {
|
|
411
|
+
if (IsEvenodd()) {
|
|
412
|
+
return OH_Drawing_PathFillType::PATH_FILL_TYPE_EVEN_ODD;
|
|
413
|
+
} else {
|
|
414
|
+
return OH_Drawing_PathFillType::PATH_FILL_TYPE_WINDING;
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
bool IsEvenodd() const
|
|
419
|
+
{
|
|
420
|
+
return clipRule_ == ClipRule::CLIP_RULE_EVENODD;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
void SetHref(const std::string& href, bool isSelf)
|
|
424
|
+
{
|
|
425
|
+
href_ = href;
|
|
426
|
+
hasHref_ = isSelf;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
const std::string& GetHref() const
|
|
430
|
+
{
|
|
431
|
+
return href_;
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
void Inherit(const ClipState& clipState)
|
|
435
|
+
{
|
|
436
|
+
if (!hasClipRule_) {
|
|
437
|
+
clipRule_ = clipState.GetClipRule();
|
|
438
|
+
}
|
|
439
|
+
if (!hasHref_) {
|
|
440
|
+
href_ = clipState.GetHref();
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
private:
|
|
445
|
+
ClipState::ClipRule clipRule_ = ClipState::ClipRule::CLIP_RULE_NONZERO;
|
|
446
|
+
std::string href_;
|
|
447
|
+
bool hasClipRule_ = false;
|
|
448
|
+
bool hasHref_ = false;
|
|
449
|
+
};
|
|
450
|
+
|
|
451
|
+
} // namespace svg
|
|
452
|
+
} // namespace rnoh
|