@react-native-ohos/react-native-clippathview 1.1.9-rc.1 → 1.1.9
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/{harmony/clipPath/README.OpenSource → README.OpenSource} +2 -2
- package/README.md +15 -15
- package/harmony/clipPath/index.ets +2 -0
- package/harmony/clipPath/oh-package.json5 +1 -1
- package/harmony/clipPath/src/main/cpp/ClipPathProps.h +120 -63
- package/harmony/clipPath/src/main/cpp/ClipPathViewComponentInstance.cpp +43 -37
- package/harmony/clipPath/src/main/cpp/ClipPathViewComponentInstance.h +6 -1
- package/harmony/clipPath/src/main/cpp/ClipPathViewNoneComponentInstance.cpp +43 -36
- package/harmony/clipPath/src/main/cpp/ClipPathViewNoneNode.cpp +166 -90
- package/harmony/clipPath/src/main/cpp/ClipPathViewNoneNode.h +100 -84
- package/harmony/clipPath/src/main/cpp/RNCClipPathTurboModule.cpp +2 -2
- package/harmony/clipPath/src/main/cpp/RNCClipPathTurboModule.h +10 -7
- package/harmony/clipPath/src/main/cpp/SVGPathParser.cpp +261 -222
- package/harmony/clipPath/src/main/cpp/SVGPathParser.h +4 -4
- package/harmony/clipPath/src/main/cpp/SVGViewBox.cpp +9 -9
- package/harmony/clipPath/src/main/cpp/ShadowNodes.cpp +4 -2
- package/harmony/clipPath/src/main/cpp/pen_style_node.h +20 -4
- package/harmony/clipPath/src/main/ets/{ClipPathPackage.ts → ClipPathPackage.ets} +2 -1
- package/harmony/clipPath.har +0 -0
- package/package.json +10 -8
- package/harmony/clipPath/BuildProfile.ets +0 -6
- package/harmony/clipPath/OAT.xml +0 -39
- package/react-native-clippath.podspec +0 -30
- /package/harmony/clipPath/{ts.ts → ts.ets} +0 -0
|
@@ -55,17 +55,17 @@ private:
|
|
|
55
55
|
static void close(OH_Drawing_Path *cPath_);
|
|
56
56
|
static void arcToBezier(float cx, float cy, float rx, float ry, float sa, float ea, bool clockwise, float rad,
|
|
57
57
|
OH_Drawing_Path *cPath_);
|
|
58
|
-
static void
|
|
58
|
+
static void SetPenDown();
|
|
59
59
|
static double _round(double val);
|
|
60
|
-
static void
|
|
61
|
-
static bool
|
|
60
|
+
static void SkipSpaces();
|
|
61
|
+
static bool IsCmd(char c);
|
|
62
62
|
static bool is_number_start(char c);
|
|
63
63
|
static bool is_absolute(char c);
|
|
64
64
|
static bool parse_flag();
|
|
65
65
|
static float parse_list_number();
|
|
66
66
|
static float parse_number();
|
|
67
67
|
static void parse_list_separator();
|
|
68
|
-
static void
|
|
68
|
+
static void SkipDigits();
|
|
69
69
|
};
|
|
70
70
|
} // namespace rnoh
|
|
71
71
|
#endif // HARMONY_SVGPATHPARSER_H
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* you may not use this file except in compliance with the License.
|
|
5
5
|
* You may obtain a copy of the License at
|
|
6
6
|
*
|
|
7
|
-
*
|
|
7
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
8
8
|
*
|
|
9
9
|
* Unless required by applicable law or agreed to in writing, software
|
|
10
10
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
16
|
#include "SVGViewBox.h"
|
|
17
|
-
#include <
|
|
17
|
+
#include <cmath>
|
|
18
18
|
#include <native_drawing/drawing_matrix.h>
|
|
19
19
|
#include <native_drawing/drawing_rect.h>
|
|
20
20
|
#include <native_drawing/drawing_types.h>
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
#include <glog/logging.h>
|
|
24
24
|
|
|
25
25
|
void rnoh::SVGViewBox::transform(OH_Drawing_Rect *vbRect, OH_Drawing_Rect *eRect, std::string align, int meetOrSlice,
|
|
26
|
-
float density, OH_Drawing_Matrix *result)
|
|
27
|
-
|
|
26
|
+
float density, OH_Drawing_Matrix *result)
|
|
27
|
+
{
|
|
28
28
|
double vbX = OH_Drawing_RectGetLeft(vbRect) * density;
|
|
29
29
|
double vbY = OH_Drawing_RectGetTop(vbRect) * density;
|
|
30
30
|
double vbX2 = OH_Drawing_RectGetRight(vbRect) * density;
|
|
@@ -49,6 +49,7 @@ void rnoh::SVGViewBox::transform(OH_Drawing_Rect *vbRect, OH_Drawing_Rect *eRect
|
|
|
49
49
|
// Initialize translate-y to e-y - (vb-y * scale-y).
|
|
50
50
|
double translateX = eX - (vbX * scaleX);
|
|
51
51
|
double translateY = eY - (vbY * scaleY);
|
|
52
|
+
double point2 = 2.0;
|
|
52
53
|
|
|
53
54
|
// If align is 'none'
|
|
54
55
|
if (meetOrSlice == MOS_NONE) {
|
|
@@ -56,9 +57,8 @@ void rnoh::SVGViewBox::transform(OH_Drawing_Rect *vbRect, OH_Drawing_Rect *eRect
|
|
|
56
57
|
// Assign scale-x and scale-y to scale.
|
|
57
58
|
double scale = scaleX = scaleY = fmin(scaleX, scaleY);
|
|
58
59
|
|
|
59
|
-
translateX += (eWidth - vbWidth * scaleX) /
|
|
60
|
-
translateY += (eHeight - vbHeight * scaleY) /
|
|
61
|
-
|
|
60
|
+
translateX += (eWidth - vbWidth * scaleX) / point2;
|
|
61
|
+
translateY += (eHeight - vbHeight * scaleY) / point2;
|
|
62
62
|
} else {
|
|
63
63
|
// If align is not 'none' and meetOrSlice is 'meet', set the larger of scale-x and scale-y to the smaller.
|
|
64
64
|
// Otherwise, if align is not 'none' and meetOrSlice is 'slice', set the smaller of scale-x and scale-y to the
|
|
@@ -71,7 +71,7 @@ void rnoh::SVGViewBox::transform(OH_Drawing_Rect *vbRect, OH_Drawing_Rect *eRect
|
|
|
71
71
|
|
|
72
72
|
// If align contains 'xMid', add (e-width - vb-width * scale-x) / 2 to translate-x.
|
|
73
73
|
if (align.find("xMid") != std::string::npos) {
|
|
74
|
-
translateX += (eWidth - vbWidth * scaleX) /
|
|
74
|
+
translateX += (eWidth - vbWidth * scaleX) / point2;
|
|
75
75
|
}
|
|
76
76
|
// If align contains 'xMax', add (e-width - vb-width * scale-x) to translate-x.
|
|
77
77
|
if (align.find("xMax") != std::string::npos) {
|
|
@@ -80,7 +80,7 @@ void rnoh::SVGViewBox::transform(OH_Drawing_Rect *vbRect, OH_Drawing_Rect *eRect
|
|
|
80
80
|
|
|
81
81
|
// If align contains 'yMid', add (e-height - vb-height * scale-y) / 2 to translate-y.
|
|
82
82
|
if (align.find("YMid") != std::string::npos) {
|
|
83
|
-
translateY += (eHeight - vbHeight * scaleY) /
|
|
83
|
+
translateY += (eHeight - vbHeight * scaleY) / point2;
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
// If align contains 'yMax', add (e-height - vb-height * scale-y) to translate-y.
|
|
@@ -13,10 +13,12 @@
|
|
|
13
13
|
* limitations under the License.
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
|
+
#include "ShadowNodes.h"
|
|
17
|
+
|
|
16
18
|
namespace facebook {
|
|
17
19
|
namespace react {
|
|
18
20
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
+
const char RNCClipPathViewComponentName[] = "RNCClipPathView";
|
|
22
|
+
const char RNCClipPathViewNoneComponentName[] = "RNCClipPathViewNone";
|
|
21
23
|
} // namespace react
|
|
22
24
|
} // namespace facebook
|
|
@@ -1,10 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2022 Huawei Device Co., Ltd.
|
|
3
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License.
|
|
5
|
+
* You may obtain a copy of the License at
|
|
6
|
+
*
|
|
7
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
*
|
|
9
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
* See the License for the specific language governing permissions and
|
|
13
|
+
* limitations under the License.
|
|
14
|
+
*/
|
|
4
15
|
// Node APIs are not fully supported. To solve the compilation error of the interface cannot be found,
|
|
5
16
|
// please include "napi/native_api.h".
|
|
6
17
|
|
|
18
|
+
#ifndef PEN_STYLE_NODE_H
|
|
19
|
+
#define PEN_STYLE_NODE_H
|
|
20
|
+
|
|
7
21
|
typedef enum {
|
|
8
22
|
CLIP_PEN_STYLE_FILL = 1 << 0,
|
|
9
23
|
CLIP_PEN_STYLE_STROKE = 1 << 1,
|
|
10
|
-
} Clip_PenStyleType;
|
|
24
|
+
} Clip_PenStyleType;
|
|
25
|
+
|
|
26
|
+
#endif
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
import { RNPackage, TurboModulesFactory } from '@rnoh/react-native-openharmony/ts';
|
|
26
26
|
import type { TurboModule, TurboModuleContext } from '@rnoh/react-native-openharmony/ts';
|
|
27
27
|
import { ClipPathTurboModule } from './ClipPathTurboModule';
|
|
28
|
+
import { RNOHPackage } from "@rnoh/react-native-openharmony";
|
|
28
29
|
|
|
29
30
|
class ClipPathTurboModulesFactory extends TurboModulesFactory {
|
|
30
31
|
createTurboModule(name: string): TurboModule | null {
|
|
@@ -39,7 +40,7 @@ class ClipPathTurboModulesFactory extends TurboModulesFactory {
|
|
|
39
40
|
}
|
|
40
41
|
}
|
|
41
42
|
|
|
42
|
-
export class ClipPathPackage extends
|
|
43
|
+
export class ClipPathPackage extends RNOHPackage {
|
|
43
44
|
createTurboModulesFactory(ctx: TurboModuleContext): TurboModulesFactory {
|
|
44
45
|
return new ClipPathTurboModulesFactory(ctx);
|
|
45
46
|
}
|
package/harmony/clipPath.har
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-native-ohos/react-native-clippathview",
|
|
3
3
|
"title": "React Native ClipPath",
|
|
4
|
-
"version": "1.1.9
|
|
4
|
+
"version": "1.1.9",
|
|
5
5
|
"description": "ClipPath Android Web IOS Harmony",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"types": "index.d.ts",
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
},
|
|
19
19
|
"repository": {
|
|
20
20
|
"type": "git",
|
|
21
|
-
"url": "
|
|
22
|
-
"baseUrl": "https://
|
|
21
|
+
"url": "https://gitcode.com/openharmony-sig/rntpc_react-native-clippath.git",
|
|
22
|
+
"baseUrl": "https://gitcode.com/openharmony-sig/rntpc_react-native-clippath"
|
|
23
23
|
},
|
|
24
24
|
"keywords": [
|
|
25
25
|
"harmony",
|
|
@@ -39,10 +39,6 @@
|
|
|
39
39
|
"name": "Juan J LF",
|
|
40
40
|
"email": "justinjlf21@gmail.com"
|
|
41
41
|
},
|
|
42
|
-
"publishConfig": {
|
|
43
|
-
"registry": "https://registry.npmjs.org/",
|
|
44
|
-
"access": "public"
|
|
45
|
-
},
|
|
46
42
|
"license": "MIT",
|
|
47
43
|
"licenseFilename": "LICENSE",
|
|
48
44
|
"readmeFilename": "README.md",
|
|
@@ -59,6 +55,12 @@
|
|
|
59
55
|
"svgpath": "^2.3.1"
|
|
60
56
|
},
|
|
61
57
|
"harmony": {
|
|
62
|
-
"alias": "react-native-clippathview"
|
|
58
|
+
"alias": "react-native-clippathview",
|
|
59
|
+
"autolinking": {
|
|
60
|
+
"etsPackageClassName":"ClipPathPackage",
|
|
61
|
+
"cppPackageClassName":"ClipPathViewPackage",
|
|
62
|
+
"cmakeLibraryTargetName": "rnoh_clip_path",
|
|
63
|
+
"ohPackageName": "@react-native-ohos/react-native-clippathview"
|
|
64
|
+
}
|
|
63
65
|
}
|
|
64
66
|
}
|
package/harmony/clipPath/OAT.xml
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<configuration>
|
|
3
|
-
<oatconfig>
|
|
4
|
-
<licensefile>LICENSE</licensefile>
|
|
5
|
-
<filefilterlist>
|
|
6
|
-
<filefilter name="copyrightPolicyFilter" desc="Filters for compatibility,license header policies">
|
|
7
|
-
<filteritem type="filename" name="hvigorfile.ts" desc="hvigor构建脚本,DevEco Studio自动生成,不需要添加版权头"/>
|
|
8
|
-
<filteritem type="filename" name="*.json5" desc="hvigor工程配置文件,DevEco Studio自动生成,不需要添加版权头"/>
|
|
9
|
-
<filteritem type="filename" name="*.proto" desc="资源文件,不需要添加版权头"/>
|
|
10
|
-
<filteritem type="filename" name="*.json" desc="资源文件,不需要添加版权头"/>
|
|
11
|
-
<filteritem type="filepath" name="hvigorw" desc="工程模板,不修改版权头,以防有修改版权风险"/>
|
|
12
|
-
<filteritem type="filepath" name="hvigorw.bat" desc="工程模板,不修改版权头,以防有修改版权风险"/>
|
|
13
|
-
<filteritem type="filepath" name="hvigor/hvigor-wrapper.js" desc="工程模板,不修改版权头,以防有修改版权风险"/>
|
|
14
|
-
<filteritem type="filename" name="LICENSE" desc="工程文件,不修改版权头"/>
|
|
15
|
-
</filefilter>
|
|
16
|
-
<filefilter name="defaultPolicyFilter" desc="Filters for compatibility,license header policies">
|
|
17
|
-
<filteritem type="filename" name="hvigorfile.ts" desc="hvigor构建脚本,DevEco Studio自动生成,不需要添加许可证头"/>
|
|
18
|
-
<filteritem type="filename" name="*.json5" desc="hvigor工程配置文件,DevEco Studio自动生成,不需要添加许可证头"/>
|
|
19
|
-
<filteritem type="filename" name="LICENSE" desc="原三方库证书文件无需更改,因此添加过滤"/>
|
|
20
|
-
<filteritem type="filename" name="*.proto" desc="资源文件,不需要添加许可证头"/>
|
|
21
|
-
<filteritem type="filename" name="*.json" desc="资源文件,不需要添加许可证头"/>
|
|
22
|
-
<filteritem type="filepath" name="hvigorw" desc="工程模板,不修改版权头,以防有修改版权风险"/>
|
|
23
|
-
<filteritem type="filepath" name="hvigorw.bat" desc="工程模板,不修改版权头,以防有修改版权风险"/>
|
|
24
|
-
<filteritem type="filepath" name="hvigor/hvigor-wrapper.js" desc="工程模板,不修改版权头,以防有修改版权风险"/>
|
|
25
|
-
</filefilter>
|
|
26
|
-
<filefilter name="binaryFileTypePolicyFilter" desc="Filters for resources files policies">
|
|
27
|
-
<filteritem type="filename" name="icon.png" desc="应用图标"/>
|
|
28
|
-
<filteritem type="filename" name="app_icon.png" desc="应用图标"/>
|
|
29
|
-
<filteritem type="filename" name="warn.png" desc="页面展示图标"/>
|
|
30
|
-
<filteritem type="filename" name="*.png" desc="展示图标"/>
|
|
31
|
-
</filefilter>
|
|
32
|
-
</filefilterlist>
|
|
33
|
-
<policylist>
|
|
34
|
-
<policy name="projectPolicy" desc="">
|
|
35
|
-
<policyitem type="license" name="Apache" path="src/.*" desc="license under the Apache"/>
|
|
36
|
-
</policy>
|
|
37
|
-
</policylist>
|
|
38
|
-
</oatconfig>
|
|
39
|
-
</configuration>
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
# react-native-clippath.podspec
|
|
2
|
-
|
|
3
|
-
require "json"
|
|
4
|
-
|
|
5
|
-
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
|
|
6
|
-
|
|
7
|
-
Pod::Spec.new do |s|
|
|
8
|
-
s.name = "react-native-clippath"
|
|
9
|
-
s.version = package["version"]
|
|
10
|
-
s.summary = package["description"]
|
|
11
|
-
s.description = <<-DESC
|
|
12
|
-
ClipPath IOS
|
|
13
|
-
DESC
|
|
14
|
-
s.homepage = "https://github.com/Only-IceSoul/react-native-clippath"
|
|
15
|
-
# brief license entry:
|
|
16
|
-
s.license = "MIT"
|
|
17
|
-
# optional - use expanded license entry instead:
|
|
18
|
-
# s.license = { :type => "MIT", :file => "LICENSE" }
|
|
19
|
-
s.authors = { "Your Name" => "yourname@email.com" }
|
|
20
|
-
s.platforms = { :ios => "10.0" }
|
|
21
|
-
s.source = { :git => "https://github.com/Only-IceSoul/react-native-clippath.git", :tag => "#{s.version}" }
|
|
22
|
-
|
|
23
|
-
s.source_files = "ios/**/*.{h,c,cc,cpp,m,mm,swift}"
|
|
24
|
-
s.requires_arc = true
|
|
25
|
-
|
|
26
|
-
s.dependency "React"
|
|
27
|
-
# ...
|
|
28
|
-
# s.dependency "..."
|
|
29
|
-
end
|
|
30
|
-
|
|
File without changes
|