1 /*
2 * Copyright (c) 2023 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 */
15 #include "core/interfaces/native/node/common_shape_modifier.h"
16
17 #include "core/components_ng/base/view_abstract.h"
18 #include "core/components_ng/pattern/shape/shape_abstract_model_ng.h"
19 #include "core/components_ng/pattern/shape/shape_model_ng.h"
20
21 namespace OHOS::Ace::NG {
22 constexpr double DEFAULT_MITER_LIMIT = 4.0f;
23 constexpr double DEFAULT_FILL_OPACITY = 1.0f;
24 constexpr double DEFAULT_STROKE_OPACITY = 1.0f;
25 constexpr double DEFAULT_STROKE_WIDTH = 1.0f;
26
27 constexpr int DEFAULT_STROKE_DASH_OFFSET = 0;
28 constexpr int DEFAULT_STROKE_LINE_CAPS = 0;
29 constexpr int DEFAULT_STROKE_LINE_JOIN = 0;
30
SetStrokeMiterLimit(ArkUINodeHandle node,ArkUI_Float32 miterLimit,void * resObjPtr)31 void SetStrokeMiterLimit(ArkUINodeHandle node, ArkUI_Float32 miterLimit, void* resObjPtr)
32 {
33 auto* frameNode = reinterpret_cast<FrameNode*>(node);
34 CHECK_NULL_VOID(frameNode);
35 ShapeModelNG::SetStrokeMiterLimit(frameNode, miterLimit);
36 auto pattern = frameNode->GetPattern();
37 CHECK_NULL_VOID(pattern);
38 pattern->UnRegisterResource("ShapeMiterLimit");
39 if (SystemProperties::ConfigChangePerform() && resObjPtr) {
40 auto resObj = AceType::Claim(reinterpret_cast<ResourceObject*>(resObjPtr));
41 pattern->RegisterResource<double>("ShapeMiterLimit", resObj, miterLimit);
42 }
43 }
44
ResetStrokeMiterLimit(ArkUINodeHandle node)45 void ResetStrokeMiterLimit(ArkUINodeHandle node)
46 {
47 auto* frameNode = reinterpret_cast<FrameNode*>(node);
48 CHECK_NULL_VOID(frameNode);
49 ShapeModelNG::SetStrokeMiterLimit(frameNode, DEFAULT_MITER_LIMIT);
50 auto pattern = frameNode->GetPattern();
51 CHECK_NULL_VOID(pattern);
52 if (SystemProperties::ConfigChangePerform()) {
53 pattern->UnRegisterResource("ShapeMiterLimit");
54 }
55 }
56
SetFillOpacity(ArkUINodeHandle node,ArkUI_Float32 fillOpacity,void * resObjPtr)57 void SetFillOpacity(ArkUINodeHandle node, ArkUI_Float32 fillOpacity, void* resObjPtr)
58 {
59 auto* frameNode = reinterpret_cast<FrameNode*>(node);
60 CHECK_NULL_VOID(frameNode);
61 ShapeModelNG::SetFillOpacity(frameNode, fillOpacity);
62 auto pattern = frameNode->GetPattern();
63 CHECK_NULL_VOID(pattern);
64 pattern->IsEnableChildrenMatchParent() ? pattern->UnRegisterResource("ShapeFillOpacity")
65 : pattern->UnRegisterResource("ShapeAbstractFillOpacity");
66 if (SystemProperties::ConfigChangePerform() && resObjPtr) {
67 auto resObj = AceType::Claim(reinterpret_cast<ResourceObject*>(resObjPtr));
68 pattern->IsEnableChildrenMatchParent()
69 ? pattern->RegisterResource<double>("ShapeFillOpacity", resObj, fillOpacity)
70 : pattern->RegisterResource<double>("ShapeAbstractFillOpacity", resObj, fillOpacity);
71 }
72 }
73
ResetFillOpacity(ArkUINodeHandle node)74 void ResetFillOpacity(ArkUINodeHandle node)
75 {
76 auto* frameNode = reinterpret_cast<FrameNode*>(node);
77 CHECK_NULL_VOID(frameNode);
78 ShapeModelNG::SetFillOpacity(frameNode, DEFAULT_FILL_OPACITY);
79 auto pattern = frameNode->GetPattern();
80 CHECK_NULL_VOID(pattern);
81 if (SystemProperties::ConfigChangePerform()) {
82 pattern->IsEnableChildrenMatchParent() ? pattern->UnRegisterResource("ShapeFillOpacity")
83 : pattern->UnRegisterResource("ShapeAbstractFillOpacity");
84 }
85 }
86
SetStrokeOpacity(ArkUINodeHandle node,ArkUI_Float32 strokeOpacity,void * resObjPtr)87 void SetStrokeOpacity(ArkUINodeHandle node, ArkUI_Float32 strokeOpacity, void* resObjPtr)
88 {
89 auto* frameNode = reinterpret_cast<FrameNode*>(node);
90 CHECK_NULL_VOID(frameNode);
91 ShapeModelNG::SetStrokeOpacity(frameNode, strokeOpacity);
92 auto pattern = frameNode->GetPattern();
93 CHECK_NULL_VOID(pattern);
94 pattern->IsEnableChildrenMatchParent() ? pattern->UnRegisterResource("ShapeStrokeOpacity")
95 : pattern->UnRegisterResource("ShapeAbstractStrokeOpacity");
96 if (SystemProperties::ConfigChangePerform() && resObjPtr) {
97 auto resObj = AceType::Claim(reinterpret_cast<ResourceObject*>(resObjPtr));
98 pattern->IsEnableChildrenMatchParent()
99 ? pattern->RegisterResource<double>("ShapeStrokeOpacity", resObj, strokeOpacity)
100 : pattern->RegisterResource<double>("ShapeAbstractStrokeOpacity", resObj, strokeOpacity);
101 }
102 }
103
ResetStrokeOpacity(ArkUINodeHandle node)104 void ResetStrokeOpacity(ArkUINodeHandle node)
105 {
106 auto* frameNode = reinterpret_cast<FrameNode*>(node);
107 CHECK_NULL_VOID(frameNode);
108 ShapeModelNG::SetStrokeOpacity(frameNode, DEFAULT_STROKE_OPACITY);
109 auto pattern = frameNode->GetPattern();
110 CHECK_NULL_VOID(pattern);
111 if (SystemProperties::ConfigChangePerform()) {
112 pattern->IsEnableChildrenMatchParent() ? pattern->UnRegisterResource("ShapeStrokeOpacity")
113 : pattern->UnRegisterResource("ShapeAbstractStrokeOpacity");
114 }
115 }
116
SetStrokeWidth(ArkUINodeHandle node,ArkUI_Float32 value,int unit,void * resObjPtr)117 void SetStrokeWidth(ArkUINodeHandle node, ArkUI_Float32 value, int unit, void* resObjPtr)
118 {
119 auto* frameNode = reinterpret_cast<FrameNode*>(node);
120 CHECK_NULL_VOID(frameNode);
121 auto unitEnum = static_cast<OHOS::Ace::DimensionUnit>(unit);
122 auto lineWidth = Dimension(value, unitEnum);
123 ShapeModelNG::SetStrokeWidth(frameNode, lineWidth);
124 auto pattern = frameNode->GetPattern();
125 CHECK_NULL_VOID(pattern);
126 pattern->IsEnableChildrenMatchParent() ? pattern->UnRegisterResource("ShapeStrokeWidth")
127 : pattern->UnRegisterResource("ShapeAbstractStrokeWidth");
128 if (SystemProperties::ConfigChangePerform() && resObjPtr) {
129 auto resObj = AceType::Claim(reinterpret_cast<ResourceObject*>(resObjPtr));
130 pattern->IsEnableChildrenMatchParent()
131 ? pattern->RegisterResource<CalcDimension>("ShapeStrokeWidth", resObj, lineWidth)
132 : pattern->RegisterResource<CalcDimension>("ShapeAbstractStrokeWidth", resObj, lineWidth);
133 }
134 }
135
ResetStrokeWidth(ArkUINodeHandle node)136 void ResetStrokeWidth(ArkUINodeHandle node)
137 {
138 auto* frameNode = reinterpret_cast<FrameNode*>(node);
139 CHECK_NULL_VOID(frameNode);
140 ShapeModelNG::SetStrokeWidth(frameNode, Dimension(DEFAULT_STROKE_WIDTH, DimensionUnit::VP));
141 auto pattern = frameNode->GetPattern();
142 CHECK_NULL_VOID(pattern);
143 if (SystemProperties::ConfigChangePerform()) {
144 pattern->IsEnableChildrenMatchParent() ? pattern->UnRegisterResource("ShapeStrokeWidth")
145 : pattern->UnRegisterResource("ShapeAbstractStrokeWidth");
146 }
147 }
148
SetAntiAlias(ArkUINodeHandle node,ArkUI_Bool antiAlias)149 void SetAntiAlias(ArkUINodeHandle node, ArkUI_Bool antiAlias)
150 {
151 auto* frameNode = reinterpret_cast<FrameNode*>(node);
152 CHECK_NULL_VOID(frameNode);
153 ShapeModelNG::SetAntiAlias(frameNode, antiAlias);
154 }
155
ResetAntiAlias(ArkUINodeHandle node)156 void ResetAntiAlias(ArkUINodeHandle node)
157 {
158 auto* frameNode = reinterpret_cast<FrameNode*>(node);
159 CHECK_NULL_VOID(frameNode);
160 ShapeModelNG::SetAntiAlias(frameNode, true);
161 }
162
SetStroke(ArkUINodeHandle node,uint32_t stroke,void * resObjPtr)163 void SetStroke(ArkUINodeHandle node, uint32_t stroke, void* resObjPtr)
164 {
165 auto* frameNode = reinterpret_cast<FrameNode*>(node);
166 CHECK_NULL_VOID(frameNode);
167 auto strokeColor = Color(stroke);
168 ShapeModelNG::SetStroke(frameNode, strokeColor);
169 auto pattern = frameNode->GetPattern();
170 CHECK_NULL_VOID(pattern);
171 pattern->IsEnableChildrenMatchParent() ? pattern->UnRegisterResource("ShapeStroke")
172 : pattern->UnRegisterResource("ShapeAbstractStroke");
173 if (SystemProperties::ConfigChangePerform() && resObjPtr) {
174 auto resObj = AceType::Claim(reinterpret_cast<ResourceObject*>(resObjPtr));
175 pattern->IsEnableChildrenMatchParent()
176 ? pattern->RegisterResource<Color>("ShapeStroke", resObj, strokeColor)
177 : pattern->RegisterResource<Color>("ShapeAbstractStroke", resObj, strokeColor);
178 }
179 }
180
ResetStroke(ArkUINodeHandle node)181 void ResetStroke(ArkUINodeHandle node)
182 {
183 auto* frameNode = reinterpret_cast<FrameNode*>(node);
184 CHECK_NULL_VOID(frameNode);
185 ShapeModelNG::SetStroke(frameNode, Color::TRANSPARENT);
186 auto pattern = frameNode->GetPattern();
187 CHECK_NULL_VOID(pattern);
188 if (SystemProperties::ConfigChangePerform()) {
189 pattern->IsEnableChildrenMatchParent() ? pattern->UnRegisterResource("ShapeStroke")
190 : pattern->UnRegisterResource("ShapeAbstractStroke");
191 }
192 }
193
SetFill(ArkUINodeHandle node,uint32_t fill,void * resObjPtr)194 void SetFill(ArkUINodeHandle node, uint32_t fill, void* resObjPtr)
195 {
196 auto* frameNode = reinterpret_cast<FrameNode*>(node);
197 CHECK_NULL_VOID(frameNode);
198 auto fillColor = Color(fill);
199 ShapeModelNG::SetFill(frameNode, fillColor);
200 auto pattern = frameNode->GetPattern();
201 CHECK_NULL_VOID(pattern);
202 pattern->IsEnableChildrenMatchParent() ? pattern->UnRegisterResource("ShapeFill")
203 : pattern->UnRegisterResource("ShapeAbstractFill");
204 if (SystemProperties::ConfigChangePerform() && resObjPtr) {
205 auto resObj = AceType::Claim(reinterpret_cast<ResourceObject*>(resObjPtr));
206 pattern->IsEnableChildrenMatchParent()
207 ? pattern->RegisterResource<Color>("ShapeFill", resObj, fillColor)
208 : pattern->RegisterResource<Color>("ShapeAbstractFill", resObj, fillColor);
209 }
210 }
211
ResetFill(ArkUINodeHandle node)212 void ResetFill(ArkUINodeHandle node)
213 {
214 auto* frameNode = reinterpret_cast<FrameNode*>(node);
215 CHECK_NULL_VOID(frameNode);
216 ShapeModelNG::SetFill(frameNode, Color::BLACK);
217 auto pattern = frameNode->GetPattern();
218 CHECK_NULL_VOID(pattern);
219 if (SystemProperties::ConfigChangePerform()) {
220 pattern->IsEnableChildrenMatchParent() ? pattern->UnRegisterResource("ShapeFill")
221 : pattern->UnRegisterResource("ShapeAbstractFill");
222 }
223 }
224
SetStrokeDashOffset(ArkUINodeHandle node,ArkUI_Float32 value,int unit,void * resObjPtr)225 void SetStrokeDashOffset(ArkUINodeHandle node, ArkUI_Float32 value, int unit, void* resObjPtr)
226 {
227 auto* frameNode = reinterpret_cast<FrameNode*>(node);
228 CHECK_NULL_VOID(frameNode);
229 auto unitEnum = static_cast<OHOS::Ace::DimensionUnit>(unit);
230 ShapeModelNG::SetStrokeDashOffset(frameNode, Dimension(value, unitEnum));
231 auto pattern = frameNode->GetPattern();
232 CHECK_NULL_VOID(pattern);
233 pattern->UnRegisterResource("ShapeDashOffset");
234 if (SystemProperties::ConfigChangePerform() && resObjPtr) {
235 auto resObj = AceType::Claim(reinterpret_cast<ResourceObject*>(resObjPtr));
236 pattern->RegisterResource<CalcDimension>("ShapeDashOffset", resObj, Dimension(value, unitEnum));
237 }
238 }
239
ResetStrokeDashOffset(ArkUINodeHandle node)240 void ResetStrokeDashOffset(ArkUINodeHandle node)
241 {
242 auto* frameNode = reinterpret_cast<FrameNode*>(node);
243 CHECK_NULL_VOID(frameNode);
244 ShapeModelNG::SetStrokeDashOffset(frameNode, Dimension(DEFAULT_STROKE_DASH_OFFSET));
245 auto pattern = frameNode->GetPattern();
246 CHECK_NULL_VOID(pattern);
247 if (SystemProperties::ConfigChangePerform()) {
248 pattern->UnRegisterResource("ShapeDashOffset");
249 }
250 }
251
SetStrokeLineCap(ArkUINodeHandle node,int strokeLineCap)252 void SetStrokeLineCap(ArkUINodeHandle node, int strokeLineCap)
253 {
254 auto* frameNode = reinterpret_cast<FrameNode*>(node);
255 CHECK_NULL_VOID(frameNode);
256 ShapeModelNG::SetStrokeLineCap(frameNode, strokeLineCap);
257 }
258
ResetStrokeLineCap(ArkUINodeHandle node)259 void ResetStrokeLineCap(ArkUINodeHandle node)
260 {
261 auto* frameNode = reinterpret_cast<FrameNode*>(node);
262 CHECK_NULL_VOID(frameNode);
263 ShapeModelNG::SetStrokeLineCap(frameNode, DEFAULT_STROKE_LINE_CAPS);
264 }
265
SetStrokeLineJoin(ArkUINodeHandle node,int lineJoinStyle)266 void SetStrokeLineJoin(ArkUINodeHandle node, int lineJoinStyle)
267 {
268 auto* frameNode = reinterpret_cast<FrameNode*>(node);
269 CHECK_NULL_VOID(frameNode);
270 ShapeModelNG::SetStrokeLineJoin(frameNode, lineJoinStyle);
271 }
272
ResetStrokeLineJoin(ArkUINodeHandle node)273 void ResetStrokeLineJoin(ArkUINodeHandle node)
274 {
275 auto* frameNode = reinterpret_cast<FrameNode*>(node);
276 CHECK_NULL_VOID(frameNode);
277 ShapeModelNG::SetStrokeLineJoin(frameNode, DEFAULT_STROKE_LINE_JOIN);
278 }
279
SetStrokeDashArray(ArkUINodeHandle node,const ArkUI_Float32 * dashArrayArray,int32_t * dimUnits,int32_t size,void * resObjArray)280 void SetStrokeDashArray(
281 ArkUINodeHandle node, const ArkUI_Float32* dashArrayArray, int32_t* dimUnits, int32_t size, void* resObjArray)
282 {
283 auto* frameNode = reinterpret_cast<FrameNode*>(node);
284 CHECK_NULL_VOID(frameNode);
285 auto pattern = frameNode->GetPattern();
286 CHECK_NULL_VOID(pattern);
287 pattern->IsEnableChildrenMatchParent() ? pattern->UnRegisterResource("ShapeStrokeDashArray")
288 : pattern->UnRegisterResource("ShapeAbstractStrokeDashArray");
289 std::vector<Dimension> dashArray;
290 std::vector<RefPtr<ResourceObject>> resObjArrayResult;
291 RefPtr<ResourceObject>* resObjPtr = static_cast<RefPtr<ResourceObject>*>(resObjArray);
292 bool hasResObj = false;
293 for (int32_t i = 0; i < size; i++) {
294 dashArray.emplace_back(CalcDimension(dashArrayArray[i], (DimensionUnit)dimUnits[i]));
295 if (resObjPtr[i]) {
296 hasResObj = true;
297 }
298 resObjArrayResult.emplace_back(resObjPtr[i]);
299 }
300 if (SystemProperties::ConfigChangePerform() && hasResObj) {
301 pattern->IsEnableChildrenMatchParent()
302 ? ShapeModelNG::SetStrokeDashArray(frameNode, dashArray, resObjArrayResult)
303 : ShapeAbstractModelNG::SetStrokeDashArray(frameNode, dashArray, resObjArrayResult);
304 }
305 ShapeModelNG::SetStrokeDashArray(frameNode, dashArray);
306 }
307
ResetStrokeDashArray(ArkUINodeHandle node)308 void ResetStrokeDashArray(ArkUINodeHandle node)
309 {
310 auto* frameNode = reinterpret_cast<FrameNode*>(node);
311 CHECK_NULL_VOID(frameNode);
312 std::vector<Dimension> dashArray;
313 ShapeModelNG::SetStrokeDashArray(frameNode, dashArray);
314 auto pattern = frameNode->GetPattern();
315 CHECK_NULL_VOID(pattern);
316 pattern->IsEnableChildrenMatchParent() ? pattern->UnRegisterResource("ShapeStrokeDashArray")
317 : pattern->UnRegisterResource("ShapeAbstractStrokeDashArray");
318 }
319
SetShapeWidth(ArkUINodeHandle node,ArkUI_Float32 value,int32_t unit,void * resObjPtr)320 void SetShapeWidth(ArkUINodeHandle node, ArkUI_Float32 value, int32_t unit, void* resObjPtr)
321 {
322 auto* frameNode = reinterpret_cast<FrameNode*>(node);
323 CHECK_NULL_VOID(frameNode);
324 DimensionUnit unitEnum = static_cast<OHOS::Ace::DimensionUnit>(unit);
325 Dimension width = Dimension(value, unitEnum);
326 ShapeAbstractModelNG::SetWidth(frameNode, width);
327 auto pattern = frameNode->GetPattern();
328 CHECK_NULL_VOID(pattern);
329 pattern->UnRegisterResource("ShapeAbstractWidth");
330 if (SystemProperties::ConfigChangePerform() && resObjPtr) {
331 auto resObj = AceType::Claim(reinterpret_cast<ResourceObject*>(resObjPtr));
332 pattern->RegisterResource<CalcDimension>("ShapeAbstractWidth", resObj, width);
333 }
334 }
335
ResetShapeWidth(ArkUINodeHandle node)336 void ResetShapeWidth(ArkUINodeHandle node)
337 {
338 auto* frameNode = reinterpret_cast<FrameNode*>(node);
339 CHECK_NULL_VOID(frameNode);
340 ShapeAbstractModelNG::ResetWidth(frameNode);
341 auto pattern = frameNode->GetPattern();
342 CHECK_NULL_VOID(pattern);
343 if (SystemProperties::ConfigChangePerform()) {
344 pattern->UnRegisterResource("ShapeAbstractWidth");
345 }
346 }
347
SetShapeHeight(ArkUINodeHandle node,ArkUI_Float32 value,int32_t unit,void * resObjPtr)348 void SetShapeHeight(ArkUINodeHandle node, ArkUI_Float32 value, int32_t unit, void* resObjPtr)
349 {
350 auto* frameNode = reinterpret_cast<FrameNode*>(node);
351 CHECK_NULL_VOID(frameNode);
352 DimensionUnit unitEnum = static_cast<OHOS::Ace::DimensionUnit>(unit);
353 Dimension height = Dimension(value, unitEnum);
354 ShapeAbstractModelNG::SetHeight(frameNode, height);
355 auto pattern = frameNode->GetPattern();
356 CHECK_NULL_VOID(pattern);
357 pattern->UnRegisterResource("ShapeAbstractHeight");
358 if (SystemProperties::ConfigChangePerform() && resObjPtr) {
359 auto resObj = AceType::Claim(reinterpret_cast<ResourceObject*>(resObjPtr));
360 pattern->RegisterResource<CalcDimension>("ShapeAbstractHeight", resObj, height);
361 }
362 }
363
ResetShapeHeight(ArkUINodeHandle node)364 void ResetShapeHeight(ArkUINodeHandle node)
365 {
366 auto* frameNode = reinterpret_cast<FrameNode*>(node);
367 CHECK_NULL_VOID(frameNode);
368 ShapeAbstractModelNG::ResetHeight(frameNode);
369 auto pattern = frameNode->GetPattern();
370 CHECK_NULL_VOID(pattern);
371 if (SystemProperties::ConfigChangePerform()) {
372 pattern->UnRegisterResource("ShapeAbstractHeight");
373 }
374 }
375
SetShapeForegroundColor(ArkUINodeHandle node,ArkUI_Bool isColor,uint32_t color,void * resObjPtr)376 void SetShapeForegroundColor(ArkUINodeHandle node, ArkUI_Bool isColor, uint32_t color, void* resObjPtr)
377 {
378 auto* frameNode = reinterpret_cast<FrameNode*>(node);
379 CHECK_NULL_VOID(frameNode);
380 if (isColor) {
381 auto foregroundColor = Color(color);
382 ShapeModelNG::SetFill(frameNode, foregroundColor);
383 ViewAbstract::SetForegroundColor(frameNode, foregroundColor);
384 auto pattern = frameNode->GetPattern();
385 CHECK_NULL_VOID(pattern);
386 pattern->UnRegisterResource("ShapeAbstractForegroundColor");
387 if (SystemProperties::ConfigChangePerform() && resObjPtr) {
388 auto resObj = AceType::Claim(reinterpret_cast<ResourceObject*>(resObjPtr));
389 pattern->RegisterResource<Color>("ShapeAbstractForegroundColor", resObj, foregroundColor);
390 }
391 } else {
392 ShapeModelNG::SetFill(frameNode, Color::FOREGROUND);
393 auto strategy = static_cast<ForegroundColorStrategy>(color);
394 ViewAbstract::SetForegroundColorStrategy(frameNode, strategy);
395 }
396 }
397
ResetShapeForegroundColor(ArkUINodeHandle node)398 void ResetShapeForegroundColor(ArkUINodeHandle node)
399 {
400 auto* frameNode = reinterpret_cast<FrameNode*>(node);
401 CHECK_NULL_VOID(frameNode);
402 auto pattern = frameNode->GetPattern();
403 CHECK_NULL_VOID(pattern);
404 if (SystemProperties::ConfigChangePerform()) {
405 pattern->UnRegisterResource("ShapeAbstractForegroundColor");
406 }
407 }
408
409 namespace NodeModifier {
GetCommonShapeModifier()410 const ArkUICommonShapeModifier* GetCommonShapeModifier()
411 {
412 CHECK_INITIALIZED_FIELDS_BEGIN(); // don't move this line
413 static const ArkUICommonShapeModifier modifier = {
414 .setStrokeDashArray = SetStrokeDashArray,
415 .resetStrokeDashArray = ResetStrokeDashArray,
416 .setStrokeMiterLimit = SetStrokeMiterLimit,
417 .resetStrokeMiterLimit = ResetStrokeMiterLimit,
418 .setFillOpacity = SetFillOpacity,
419 .resetFillOpacity = ResetFillOpacity,
420 .setStrokeOpacity = SetStrokeOpacity,
421 .resetStrokeOpacity = ResetStrokeOpacity,
422 .setStrokeWidth = SetStrokeWidth,
423 .resetStrokeWidth = ResetStrokeWidth,
424 .setAntiAlias = SetAntiAlias,
425 .resetAntiAlias = ResetAntiAlias,
426 .setStroke = SetStroke,
427 .resetStroke = ResetStroke,
428 .setFill = SetFill,
429 .resetFill = ResetFill,
430 .setStrokeDashOffset = SetStrokeDashOffset,
431 .resetStrokeDashOffset = ResetStrokeDashOffset,
432 .setStrokeLineCap = SetStrokeLineCap,
433 .resetStrokeLineCap = ResetStrokeLineCap,
434 .setStrokeLineJoin = SetStrokeLineJoin,
435 .resetStrokeLineJoin = ResetStrokeLineJoin,
436 .setShapeWidth = SetShapeWidth,
437 .resetShapeWidth = ResetShapeWidth,
438 .setShapeHeight = SetShapeHeight,
439 .resetShapeHeight = ResetShapeHeight,
440 .setShapeForegroundColor = SetShapeForegroundColor,
441 .resetShapeForegroundColor = ResetShapeForegroundColor,
442 };
443 CHECK_INITIALIZED_FIELDS_END(modifier, 0, 0, 0); // don't move this line
444 return &modifier;
445 }
446
GetCJUICommonShapeModifier()447 const CJUICommonShapeModifier* GetCJUICommonShapeModifier()
448 {
449 CHECK_INITIALIZED_FIELDS_BEGIN(); // don't move this line
450 static const CJUICommonShapeModifier modifier = {
451 .setStrokeDashArray = SetStrokeDashArray,
452 .resetStrokeDashArray = ResetStrokeDashArray,
453 .setStrokeMiterLimit = SetStrokeMiterLimit,
454 .resetStrokeMiterLimit = ResetStrokeMiterLimit,
455 .setFillOpacity = SetFillOpacity,
456 .resetFillOpacity = ResetFillOpacity,
457 .setStrokeOpacity = SetStrokeOpacity,
458 .resetStrokeOpacity = ResetStrokeOpacity,
459 .setStrokeWidth = SetStrokeWidth,
460 .resetStrokeWidth = ResetStrokeWidth,
461 .setAntiAlias = SetAntiAlias,
462 .resetAntiAlias = ResetAntiAlias,
463 .setStroke = SetStroke,
464 .resetStroke = ResetStroke,
465 .setFill = SetFill,
466 .resetFill = ResetFill,
467 .setStrokeDashOffset = SetStrokeDashOffset,
468 .resetStrokeDashOffset = ResetStrokeDashOffset,
469 .setStrokeLineCap = SetStrokeLineCap,
470 .resetStrokeLineCap = ResetStrokeLineCap,
471 .setStrokeLineJoin = SetStrokeLineJoin,
472 .resetStrokeLineJoin = ResetStrokeLineJoin,
473 .setShapeWidth = SetShapeWidth,
474 .resetShapeWidth = ResetShapeWidth,
475 .setShapeHeight = SetShapeHeight,
476 .resetShapeHeight = ResetShapeHeight,
477 .setShapeForegroundColor = SetShapeForegroundColor,
478 .resetShapeForegroundColor = ResetShapeForegroundColor,
479 };
480 CHECK_INITIALIZED_FIELDS_END(modifier, 0, 0, 0); // don't move this line
481 return &modifier;
482 }
483 }
484 } // namespace OHOS::Ace::NG
485