1 /* 2 * Copyright (c) 2021-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 16 /** 17 * @addtogroup RenderNodeDisplay 18 * @{ 19 * 20 * @brief Display render nodes. 21 */ 22 23 /** 24 * @file rs_node.h 25 * 26 * @brief Defines the properties and methods for RSNode class. 27 */ 28 29 #ifndef RENDER_SERVICE_CLIENT_CORE_UI_RS_NODE_H 30 #define RENDER_SERVICE_CLIENT_CORE_UI_RS_NODE_H 31 32 #include <optional> 33 #include <unordered_map> 34 35 #include "recording/recording_canvas.h" 36 #include "ui_effect/effect/include/background_color_effect_para.h" 37 #include "ui_effect/effect/include/border_light_effect_para.h" 38 #include "ui_effect/effect/include/visual_effect.h" 39 #include "ui_effect/filter/include/filter.h" 40 #include "ui_effect/filter/include/filter_blur_para.h" 41 #include "ui_effect/filter/include/filter_distort_para.h" 42 #include "ui_effect/filter/include/filter_fly_out_para.h" 43 #include "ui_effect/filter/include/filter_hdr_para.h" 44 #include "ui_effect/filter/include/filter_pixel_stretch_para.h" 45 #include "ui_effect/filter/include/filter_radius_gradient_blur_para.h" 46 #include "ui_effect/filter/include/filter_water_ripple_para.h" 47 48 #include "animation/rs_animation_timing_curve.h" 49 #include "animation/rs_animation_timing_protocol.h" 50 #include "animation/rs_motion_path_option.h" 51 #include "animation/rs_particle_params.h" 52 #include "animation/rs_symbol_node_config.h" 53 #include "animation/rs_transition_effect.h" 54 #include "command/rs_animation_command.h" 55 #include "common/rs_vector2.h" 56 #include "common/rs_vector4.h" 57 #include "modifier/rs_modifier_extractor.h" 58 #include "modifier/rs_modifier_type.h" 59 #include "modifier/rs_showing_properties_freezer.h" 60 #include "modifier_ng/rs_modifier_ng_type.h" 61 #include "pipeline/rs_recording_canvas.h" 62 #include "property/rs_properties.h" 63 #include "render/rs_mask.h" 64 #include "render/rs_path.h" 65 #include "transaction/rs_sync_transaction_handler.h" 66 #include "transaction/rs_transaction_handler.h" 67 68 namespace OHOS { 69 namespace Rosen { 70 using DrawFunc = std::function<void(std::shared_ptr<Drawing::Canvas>)>; 71 using PropertyCallback = std::function<void()>; 72 using BoundsChangedCallback = std::function<void (const Rosen::Vector4f&)>; 73 using ExportTypeChangedCallback = std::function<void(bool)>; 74 using DrawNodeChangeCallback = std::function<void(std::shared_ptr<RSNode> rsNode, bool isPositionZ)>; 75 using PropertyNodeChangeCallback = std::function<void()>; 76 class RSAnimation; 77 class RSCommand; 78 class RSImplicitAnimParam; 79 class RSImplicitAnimator; 80 class RSModifier; 81 class RSObjAbsGeometry; 82 class RSUIContext; 83 class RSNGFilterBase; 84 class RSNGShaderBase; 85 enum class CancelAnimationStatus; 86 87 namespace ModifierNG { 88 class RSModifier; 89 class RSCustomModifier; 90 class RSForegroundFilterModifier; 91 class RSBackgroundFilterModifier; 92 enum class RSModifierType : uint16_t; 93 } 94 /** 95 * @class RSNode 96 * 97 * @brief The class for RSNode(render service node). 98 */ 99 class RSC_EXPORT RSNode : public std::enable_shared_from_this<RSNode> { 100 public: 101 using WeakPtr = std::weak_ptr<RSNode>; 102 using SharedPtr = std::shared_ptr<RSNode>; 103 static inline constexpr RSUINodeType Type = RSUINodeType::RS_NODE; 104 /** 105 * @brief Get the type of the RSNode. 106 * 107 * @return The type of the RSNode. 108 */ GetType()109 virtual RSUINodeType GetType() const 110 { 111 return Type; 112 } 113 114 RSNode(const RSNode&) = delete; 115 RSNode(const RSNode&&) = delete; 116 RSNode& operator=(const RSNode&) = delete; 117 RSNode& operator=(const RSNode&&) = delete; 118 119 /** 120 * @brief Destructor for RSNode. 121 */ 122 virtual ~RSNode(); 123 124 /* 125 * <important> 126 * If you want to add a draw interface to RSNode, decide whether to set the draw node type, otherwise, 127 * RSNode will be removed because there is no draw properties. 128 */ 129 void SetDrawNodeType(DrawNodeType nodeType); 130 131 // this id is ONLY used in hierarchy operation commands, this may differ from id_ when the node is a proxy node. GetHierarchyCommandNodeId()132 virtual NodeId GetHierarchyCommandNodeId() const 133 { 134 return id_; 135 } 136 137 /** 138 * @brief Adds a child node to the current node at the specified index. 139 * 140 * @param child The shared pointer to the child node to be added. 141 * @param index The position at which the child node should be inserted. 142 * If the index is -1 (default), the child is added to the end. 143 */ 144 virtual void AddChild(SharedPtr child, int index = -1); 145 146 bool AddCompositeNodeChild(SharedPtr node, int index); 147 148 /** 149 * @brief Moves a child node to a new index within the current node. 150 * 151 * @param child The shared pointer to the child node to be moved. 152 * @param index The new position for the child node. 153 */ 154 void MoveChild(SharedPtr child, int index); 155 156 /** 157 * @brief Removes a child node from the current node. 158 * 159 * @param child The shared pointer to the child node to be removed. 160 */ 161 virtual void RemoveChild(SharedPtr child); 162 void RemoveChildByNodeSelf(WeakPtr child); 163 164 /** 165 * @brief Removes the current node from the node tree 166 */ 167 void RemoveFromTree(); 168 169 /** 170 * @brief Removes all child nodes associated with this node. 171 */ 172 virtual void ClearChildren(); GetChildren()173 const std::vector<WeakPtr>& GetChildren() const 174 { 175 return children_; 176 } 177 // ONLY support index in [0, childrenTotal) or index = -1, otherwise return std::nullopt 178 RSNode::SharedPtr GetChildByIndex(int index) const; 179 180 /** 181 * @brief Adds a child node to the current node. 182 * 183 * Only used as: the child is under multiple parents(e.g. a window cross multi-screens) 184 * 185 * @param child The shared pointer to the child node to be added. 186 * @param index The position at which the child node should be inserted. 187 */ 188 void AddCrossParentChild(SharedPtr child, int index); 189 void RemoveCrossParentChild(SharedPtr child, SharedPtr newParent); 190 191 /** 192 * @brief Sets whether the node is a cross-screen node. 193 * 194 * @param isCrossNode Indicates whether the node is a cross-screen node. 195 */ 196 void SetIsCrossNode(bool isCrossNode); 197 198 // PC extend screen use this 199 void AddCrossScreenChild(SharedPtr child, int index, bool autoClearCloneNode = false); 200 void RemoveCrossScreenChild(SharedPtr child); 201 202 /** 203 * @brief Gets the unique identifier of this node. 204 * 205 * @return The NodeId associated with this node. 206 */ GetId()207 NodeId GetId() const 208 { 209 return id_; 210 } 211 GetFollowType()212 virtual FollowType GetFollowType() const 213 { 214 return FollowType::NONE; 215 } 216 217 /** 218 * @brief Checks if the current node is an instance of the specified RSUINodeType. 219 * 220 * This method determines whether the node's type matches the provided type. 221 * 222 * @param type The RSUINodeType to check against. 223 * @return true if the node is an instance of the specified type; false otherwise. 224 */ 225 bool IsInstanceOf(RSUINodeType type) const; 226 227 /** 228 * @brief Checks if the current node is an instance of the specified template type. 229 * 230 * @return true if the node is an instance of the specified template type; false otherwise. 231 */ 232 template<typename T> 233 RSC_EXPORT bool IsInstanceOf() const; 234 235 /** 236 * @brief Safely casts a shared pointer of RSNode to a shared pointer of the specified type T. 237 * 238 * type-safe reinterpret_cast 239 * 240 * @param node The shared pointer to RSNode to be cast. 241 * @return std::shared_ptr<T> The casted shared pointer if successful, or nullptr if the input is null. 242 */ 243 template<typename T> ReinterpretCast(const std::shared_ptr<RSNode> & node)244 static std::shared_ptr<T> ReinterpretCast(const std::shared_ptr<RSNode>& node) 245 { 246 return node ? node->ReinterpretCastTo<T>() : nullptr; 247 } 248 249 /** 250 * @brief Casts this object to a shared pointer of type T. 251 * 252 * @return std::shared_ptr<T> A shared pointer of type T if the cast is valid; nullptr otherwise. 253 */ 254 template<typename T> ReinterpretCastTo()255 std::shared_ptr<T> ReinterpretCastTo() 256 { 257 return (IsInstanceOf<T>()) ? std::static_pointer_cast<T>(shared_from_this()) : nullptr; 258 } 259 260 /** 261 * @brief Casts this object to a shared pointer of the specified type T. 262 * 263 * @return std::shared_ptr<const T> A shared pointer to the object as type T if the cast is valid, nullptr otherwise. 264 */ 265 template<typename T> ReinterpretCastTo()266 std::shared_ptr<const T> ReinterpretCastTo() const 267 { 268 return (IsInstanceOf<T>()) ? std::static_pointer_cast<const T>(shared_from_this()) : nullptr; 269 } 270 271 /** 272 * @brief Dumps the tree information into the provided output string. 273 * 274 * @param depth The current depth in the tree structure. 275 * @param out The string to which the dump information will be appended. 276 */ 277 void DumpTree(int depth, std::string& out) const; 278 279 /** 280 * @brief Dumps the information of current node into the provided output string. 281 * 282 * @param out The string to which the dump information will be appended. 283 */ 284 virtual void Dump(std::string& out) const; 285 286 /** 287 * @brief Dumps the information of current node into a string. 288 * 289 * @param depth The current depth in the tree structure. 290 * @return std::string A string containing the dump information of the node. 291 */ 292 virtual std::string DumpNode(int depth) const; 293 294 /** 295 * @brief Retrieves the parent node of the current node. 296 * 297 * @return SharedPtr A smart pointer to the parent node, or nullptr if this node has no parent. 298 */ 299 SharedPtr GetParent(); 300 301 /** 302 * @brief Set the id of the current node. 303 * 304 * @param id The NodeId to be set. 305 */ SetId(const NodeId & id)306 void SetId(const NodeId& id) 307 { 308 id_ = id; 309 } 310 311 /** 312 * @brief Checks whether the UniRender feature is enabled for this node. 313 * 314 * @return true if UniRender is enabled; false otherwise. 315 */ 316 bool IsUniRenderEnabled() const; 317 /** 318 * @brief Checks if the current node is a Render Service node. 319 * 320 * @return true if the node is a Render Service node; false otherwise. 321 */ 322 bool IsRenderServiceNode() const; 323 void SetTakeSurfaceForUIFlag(); 324 325 static std::vector<std::shared_ptr<RSAnimation>> Animate(const RSAnimationTimingProtocol& timingProtocol, 326 const RSAnimationTimingCurve& timingCurve, const PropertyCallback& callback, 327 const std::function<void()>& finishCallback = nullptr, const std::function<void()>& repeatCallback = nullptr); 328 329 static std::vector<std::shared_ptr<RSAnimation>> AnimateWithCurrentOptions( 330 const PropertyCallback& callback, const std::function<void()>& finishCallback, bool timingSensitive = true); 331 static std::vector<std::shared_ptr<RSAnimation>> AnimateWithCurrentCallback( 332 const RSAnimationTimingProtocol& timingProtocol, const RSAnimationTimingCurve& timingCurve, 333 const PropertyCallback& callback); 334 335 static void RegisterTransitionPair(NodeId inNodeId, NodeId outNodeId, const bool isInSameWindow); 336 static void UnregisterTransitionPair(NodeId inNodeId, NodeId outNodeId); 337 338 static void OpenImplicitAnimation(const RSAnimationTimingProtocol& timingProtocol, 339 const RSAnimationTimingCurve& timingCurve, const std::function<void()>& finishCallback = nullptr); 340 static std::vector<std::shared_ptr<RSAnimation>> CloseImplicitAnimation(); 341 static bool CloseImplicitCancelAnimation(); 342 static bool IsImplicitAnimationOpen(); 343 344 static void ExecuteWithoutAnimation(const PropertyCallback& callback, 345 const std::shared_ptr<RSUIContext> rsUIContext = nullptr, 346 std::shared_ptr<RSImplicitAnimator> implicitAnimator = nullptr); 347 348 static void AddKeyFrame( 349 float fraction, const RSAnimationTimingCurve& timingCurve, const PropertyCallback& callback); 350 static void AddKeyFrame(float fraction, const PropertyCallback& callback); 351 static void AddDurationKeyFrame( 352 int duration, const RSAnimationTimingCurve& timingCurve, const PropertyCallback& callback); 353 354 // multi-instance 355 static std::vector<std::shared_ptr<RSAnimation>> Animate(const std::shared_ptr<RSUIContext> rsUIContext, 356 const RSAnimationTimingProtocol& timingProtocol, 357 const RSAnimationTimingCurve& timingCurve, const PropertyCallback& callback, 358 const std::function<void()>& finishCallback = nullptr, const std::function<void()>& repeatCallback = nullptr); 359 static std::vector<std::shared_ptr<RSAnimation>> AnimateWithCurrentOptions( 360 const std::shared_ptr<RSUIContext> rsUIContext, const PropertyCallback& callback, 361 const std::function<void()>& finishCallback, bool timingSensitive = true); 362 static std::vector<std::shared_ptr<RSAnimation>> AnimateWithCurrentCallback( 363 const std::shared_ptr<RSUIContext> rsUIContext, const RSAnimationTimingProtocol& timingProtocol, 364 const RSAnimationTimingCurve& timingCurve, const PropertyCallback& callback); 365 366 static void RegisterTransitionPair(const std::shared_ptr<RSUIContext> rsUIContext, 367 NodeId inNodeId, NodeId outNodeId, const bool isInSameWindow); 368 static void UnregisterTransitionPair(const std::shared_ptr<RSUIContext> rsUIContext, 369 NodeId inNodeId, NodeId outNodeId); 370 371 static void OpenImplicitAnimation(const std::shared_ptr<RSUIContext> rsUIContext, 372 const RSAnimationTimingProtocol& timingProtocol, const RSAnimationTimingCurve& timingCurve, 373 const std::function<void()>& finishCallback = nullptr); 374 static std::vector<std::shared_ptr<RSAnimation>> CloseImplicitAnimation( 375 const std::shared_ptr<RSUIContext> rsUIContext); 376 static bool CloseImplicitCancelAnimation(const std::shared_ptr<RSUIContext> rsUIContext); 377 static CancelAnimationStatus CloseImplicitCancelAnimationReturnStatus( 378 const std::shared_ptr<RSUIContext> rsUIContext = nullptr); 379 static bool IsImplicitAnimationOpen(const std::shared_ptr<RSUIContext> rsUIContext); 380 static void AddKeyFrame(const std::shared_ptr<RSUIContext> rsUIContext, float fraction, 381 const RSAnimationTimingCurve& timingCurve, const PropertyCallback& callback); 382 static void AddKeyFrame( 383 const std::shared_ptr<RSUIContext> rsUIContext, float fraction, const PropertyCallback& callback); 384 static void AddDurationKeyFrame(const std::shared_ptr<RSUIContext> rsUIContext, int duration, 385 const RSAnimationTimingCurve& timingCurve, const PropertyCallback& callback); 386 void NotifyTransition(const std::shared_ptr<const RSTransitionEffect>& effect, bool isTransitionIn); 387 388 void AddAnimation(const std::shared_ptr<RSAnimation>& animation, bool isStartAnimation = true); 389 void RemoveAllAnimations(); 390 void RemoveAnimation(const std::shared_ptr<RSAnimation>& animation); 391 void SetMotionPathOption(const std::shared_ptr<RSMotionPathOption>& motionPathOption); 392 393 /** 394 * @brief Retrieves the motion path option associated with this node. 395 * 396 * @return A std::shared_ptr to the RSMotionPathOption instance if set; otherwise, nullptr. 397 */ 398 const std::shared_ptr<RSMotionPathOption> GetMotionPathOption() const; 399 400 void SetMotionPathOptionToProperty( 401 const ModifierNG::RSModifierType& modifierType, const ModifierNG::RSPropertyType& propertyType); 402 403 /** 404 * @brief Draws on the node using the specified modifier type and drawing function. 405 * 406 * [PLANNING]: support SurfaceNode 407 * 408 * @param type The type of modifier to be applied during the drawing process. 409 * @param func The drawing function to be executed on the node. 410 */ DrawOnNode(RSModifierType type,DrawFunc func)411 virtual void DrawOnNode(RSModifierType type, DrawFunc func) {} 412 413 /** 414 * @brief Retrieves the staging properties associated with this node. 415 * 416 * @return A constant reference to the RSModifierExtractor holding the staging properties. 417 */ 418 const RSModifierExtractor& GetStagingProperties() const; 419 420 const RSShowingPropertiesFreezer& GetShowingProperties() const; 421 422 /** 423 * @brief Sets the bounds of the node. 424 * 425 * The bounds typically define the position and size of the node within its parent. 426 * 427 * @param bounds A Vector4f representing the new bounds (X, Y, width, height). 428 */ 429 virtual void SetBounds(const Vector4f& bounds); 430 431 /** 432 * @brief Sets the bounds of the node. 433 * 434 * @param positionX The X coordinate of the new bounds. 435 * @param positionY The Y coordinate of the new bounds. 436 * @param width The width of the new bounds. 437 * @param height The height of the new bounds. 438 */ 439 virtual void SetBounds(float positionX, float positionY, float width, float height); 440 441 /** 442 * @brief Sets the width of bounds. 443 * 444 * @param width The new width to set for the bounds. 445 */ 446 virtual void SetBoundsWidth(float width); 447 448 /** 449 * @brief Sets the height of bounds. 450 * 451 * @param height The new height to set for the bounds. 452 */ 453 virtual void SetBoundsHeight(float height); 454 455 /** 456 * @brief Sets the frame of the node. 457 * 458 * @param frame A Vector4f representing the new frame, containing values for x, y, width, and height. 459 */ 460 virtual void SetFrame(const Vector4f& frame); 461 462 /** 463 * @brief Sets the frame of the node. 464 * 465 * @param positionX The X coordinate of the frame. 466 * @param positionY The Y coordinate of the frame. 467 * @param width The width of the frame. 468 * @param height The height of the frame. 469 */ 470 virtual void SetFrame(float positionX, float positionY, float width, float height); 471 472 /** 473 * @brief Sets the x-coordinate of the node's frame. 474 * 475 * @param positionX The x-coordinate of the frame. 476 */ 477 virtual void SetFramePositionX(float positionX); 478 479 /** 480 * @brief Sets the y-coordinate of the node's frame. 481 * 482 * @param positionY The y-coordinate of the frame. 483 */ 484 virtual void SetFramePositionY(float positionY); 485 486 /** 487 * @brief Freezes current frame data when enabled, preventing content refresh until unfrozen. 488 * 489 * This property is valid only for CanvasNode and SurfaceNode in uniRender. 490 * 491 * @param isFreeze Freeze state flag 492 * - true: Freeze current frame content 493 * - false: Resume dynamic updates 494 * @see RSCanvasNode::SetFreeze(bool isFreeze) 495 * @see RSSurfaceNode::SetFreeze(bool isFreeze) 496 */ 497 virtual void SetFreeze(bool isFreeze); 498 499 /** 500 * @brief Sets the name of the node. 501 * 502 * @param nodeName The new name to assign to the node. 503 */ 504 void SetNodeName(const std::string& nodeName); 505 506 /** 507 * @brief Sets the sandbox of the node. 508 * 509 * @param parentPosition The position of the parent node in the sandbox. 510 */ 511 void SetSandBox(std::optional<Vector2f> parentPosition); 512 513 /** 514 * @brief Sets the Z position of the node. 515 * 516 * @param positionZ The new Z position value for the node. 517 */ 518 void SetPositionZ(float positionZ); 519 520 /** 521 * @brief Sets whether the Z position is applicable for 3D cameras. 522 * 523 * @param isApplicable If true, the Z position will be considered for 3D cameras; otherwise, it will not. 524 */ 525 void SetPositionZApplicableCamera3D(bool isApplicable); 526 527 /** 528 * @brief Sets the pivot point of the node. 529 * 530 * The pivot point is used as the reference point for transformations such as rotation and scaling. 531 * 532 * @param pivot A Vector2f representing the pivot point (X, Y). 533 */ 534 void SetPivot(const Vector2f& pivot); 535 536 /** 537 * @brief Sets the pivot point of the node. 538 * 539 * @param pivotX The X coordinate of the pivot point. 540 * @param pivotY The Y coordinate of the pivot point. 541 */ 542 void SetPivot(float pivotX, float pivotY); 543 544 /** 545 * @brief Sets the pivot point of the node. 546 * 547 * @param pivotX The X coordinate of the pivot point. 548 */ 549 void SetPivotX(float pivotX); 550 551 /** 552 * @brief Sets the pivot point of the node. 553 * 554 * @param pivotY The Y coordinate of the pivot point. 555 */ 556 void SetPivotY(float pivotY); 557 558 /** 559 * @brief Sets the pivot point of the node. 560 * 561 * @param pivotZ The Z coordinate of the pivot point. 562 */ 563 void SetPivotZ(float pivotZ); 564 565 /** 566 * @brief Sets the corner radius of the node. 567 * 568 * @param cornerRadius The new corner radius value. 569 */ 570 void SetCornerRadius(float cornerRadius); 571 572 /** 573 * @brief Sets the corner radius of the node. 574 * 575 * @param cornerRadius A Vector4f representing the corner radius for each corner (top-left, top-right, bottom-right, bottom-left). 576 */ 577 void SetCornerRadius(const Vector4f& cornerRadius); 578 579 /** 580 * @brief Sets the rotation of the node. 581 * 582 * @param quaternion A Quaternion representing the rotation to be applied to the node. 583 */ 584 void SetRotation(const Quaternion& quaternion); 585 586 /** 587 * @brief Sets the rotation of the node. 588 * 589 * @param degreeX The rotation angle around the X-axis in degrees. 590 * @param degreeY The rotation angle around the Y-axis in degrees. 591 * @param degreeZ The rotation angle around the Z-axis in degrees. 592 */ 593 void SetRotation(float degreeX, float degreeY, float degreeZ); 594 595 /** 596 * @brief Sets the rotation of the node. 597 * 598 * @param degree The rotation angle in degrees. 599 */ 600 void SetRotation(float degree); 601 602 /** 603 * @brief Sets the rotation of the node around the X-axis. 604 * 605 * @param degree The rotation angle around the X-axis in degrees. 606 */ 607 void SetRotationX(float degree); 608 609 /** 610 * @brief Sets the rotation of the node around the Y-axis. 611 * 612 * @param degree The rotation angle around the Y-axis in degrees. 613 */ 614 void SetRotationY(float degree); 615 void SetCameraDistance(float cameraDistance); 616 617 /** 618 * @brief Sets the translation vector for this node. 619 * 620 * @param translate A two-dimensional vector representing the translation distances in the x and y axes. 621 */ 622 void SetTranslate(const Vector2f& translate); 623 624 /** 625 * @brief Sets the translation values for the node along the X, Y, and Z axes. 626 * 627 * @param translateX The translation distance along the X-axis. 628 * @param translateY The translation distance along the Y-axis. 629 * @param translateZ The translation distance along the Z-axis. 630 */ 631 void SetTranslate(float translateX, float translateY, float translateZ); 632 633 /** 634 * @brief Sets the translation value for the node along the X-axis. 635 * 636 * @param translate The translation distance along the X-axis. 637 */ 638 void SetTranslateX(float translate); 639 640 /** 641 * @brief Sets the translation value for the node along the Y-axis. 642 * 643 * @param translate The translation distance along the Y-axis. 644 */ 645 void SetTranslateY(float translate); 646 647 /** 648 * @brief Sets the translation value for the node along the Z-axis. 649 * 650 * @param translate The translation distance along the Z-axis. 651 */ 652 void SetTranslateZ(float translate); 653 654 /** 655 * @brief Sets the scale factor for the node. 656 * 657 * Greater than 1.0f will scale up, less than 1.0f will scale down. 658 * 659 * @param scale The scale factor to apply to the node. 660 */ 661 void SetScale(float scale); 662 663 /** 664 * @brief Sets the scale factors for the node along the X and Y axes. 665 * 666 * @param scaleX The scale factor along the X-axis. 667 * @param scaleY The scale factor along the Y-axis. 668 */ 669 void SetScale(float scaleX, float scaleY); 670 671 /** 672 * @brief Sets the scale factor for this node. 673 * 674 * @param scale A Vector2f representing the scale factors for the X and Y axes. 675 */ 676 void SetScale(const Vector2f& scale); 677 678 /** 679 * @brief Sets the horizontal scaling factor for the node. 680 * 681 * No scaling will be applied on the Y-axis. 682 * 683 * @param scaleX The scaling factor to apply on the X-axis. 684 */ 685 void SetScaleX(float scaleX); 686 687 /** 688 * @brief Sets the vertical scaling factor for the node. 689 * 690 * No scaling will be applied on the X-axis. 691 * 692 * @param scaleY The scaling factor to apply on the Y-axis. 693 */ 694 void SetScaleY(float scaleY); 695 696 /** 697 * @brief Sets the scaling factor for the node along the Z-axis. 698 * 699 * @param scaleZ The scaling factor to apply on the Z-axis. 700 */ 701 void SetScaleZ(float scaleZ); 702 703 /** 704 * @brief Sets the skew factor for the node. 705 * 706 * @param skew The skew factor to apply to the node. 707 */ 708 void SetSkew(float skew); 709 710 /** 711 * @brief Sets the skew factors for the node along the X and Y axes. 712 * 713 * @param skewX The skew factor along the X-axis. 714 * @param skewY The skew factor along the Y-axis. 715 */ 716 void SetSkew(float skewX, float skewY); 717 718 /** 719 * @brief Sets the skew factors for the node along the X, Y, and Z axes. 720 * 721 * @param skewX The skew factor along the X-axis. 722 * @param skewY The skew factor along the Y-axis. 723 * @param skewZ The skew factor along the Z-axis. 724 */ 725 void SetSkew(float skewX, float skewY, float skewZ); 726 727 /** 728 * @brief Sets the skew factors for the node. 729 * 730 * @param skew A Vector3f representing the skew factors for the X, Y, and Z axes. 731 */ 732 void SetSkew(const Vector3f& skew); 733 734 /** 735 * @brief Sets the skew factor for the node along the X-axis. 736 * 737 * @param skewX The skew factor to apply on the X-axis. 738 */ 739 void SetSkewX(float skewX); 740 741 /** 742 * @brief Sets the skew factor for the node along the Y-axis. 743 * 744 * @param skewY The skew factor to apply on the Y-axis. 745 */ 746 void SetSkewY(float skewY); 747 748 /** 749 * @brief Sets the skew factor for the node along the Z-axis. 750 * 751 * @param skewZ The skew factor to apply on the Z-axis. 752 */ 753 void SetSkewZ(float skewZ); 754 755 /** 756 * @brief Sets the perspective value for the node. 757 * 758 * @param persp The perspective value to apply. 759 */ 760 void SetPersp(float persp); 761 762 /** 763 * @brief Sets the perspective values for the node. 764 * 765 * @param perspX The perspective value along the X-axis. 766 * @param perspY The perspective value along the Y-axis. 767 */ 768 void SetPersp(float perspX, float perspY); 769 770 /** 771 * @brief Sets the perspective values for the node. 772 * 773 * @param perspX The perspective value along the X-axis. 774 * @param perspY The perspective value along the Y-axis. 775 * @param perspZ The perspective value along the Z-axis. 776 * @param perspW The perspective value along the W-axis. 777 */ 778 void SetPersp(float perspX, float perspY, float perspZ, float perspW); 779 780 /** 781 * @brief Sets the perspective values for the node. 782 * 783 * @param persp A Vector4f representing the perspective values for the X, Y, Z, and W axes. 784 */ 785 void SetPersp(const Vector4f& persp); 786 787 /** 788 * @brief Sets the perspective value for the node along the X-axis. 789 * 790 * If the property is not initialized,perspY,perspZ will be set to 0.0f,and perspW will be set to 1.0f. 791 * 792 * @param perspX The perspective value to apply on the X-axis. 793 */ 794 void SetPerspX(float perspX); 795 796 /** 797 * @brief Sets the perspective value for the node along the Y-axis. 798 * 799 * If the property is not initialized,perspX,perspZ will be set to 0.0f,and perspW will be set to 1.0f. 800 * 801 * @param perspY The perspective value to apply on the Y-axis. 802 */ 803 void SetPerspY(float perspY); 804 805 /** 806 * @brief Sets the perspective value for the node along the Z-axis. 807 * 808 * If the property is not initialized,perspX,perspY will be set to 0.0f,and perspW will be set to 1.0f. 809 * 810 * @param perspZ The perspective value to apply on the Z-axis. 811 */ 812 void SetPerspZ(float perspZ); 813 814 /** 815 * @brief Sets the perspective value for the node along the W-axis. 816 * 817 * If the property is not initialized,perspX,perspY,perspZ will be set to 0.0f 818 * 819 * @param perspW The perspective value to apply on the W-axis. 820 */ 821 void SetPerspW(float perspW); 822 823 /** 824 * @brief Sets the alpha value for the node. 825 * 826 * @param alpha The alpha value to apply (0.0f to 1.0f). 827 */ 828 void SetAlpha(float alpha); 829 830 /** 831 * @brief Sets the alpha value for offscreen rendering. 832 * 833 * @param alphaOffscreen true if offscreen alpha is enabled; false otherwise. 834 */ 835 void SetAlphaOffscreen(bool alphaOffscreen); 836 837 /** 838 * @brief Sets the foreground color of environment. 839 * 840 * @param colorValue The color value to set. 841 */ 842 void SetEnvForegroundColor(uint32_t colorValue); 843 844 /** 845 * @brief Sets the foreground color strategy of environment. 846 * 847 * @param colorType The strategy type to set. 848 */ 849 void SetEnvForegroundColorStrategy(ForegroundColorStrategyType colorType); 850 851 /** 852 * @brief Sets the parameter for the particle effect. 853 * 854 * @param particleParams The parameters for the particle effect. 855 * @param finishCallback The callback function to be executed after setting the parameters. Default is nullptr. 856 */ 857 void SetParticleParams( 858 std::vector<ParticleParams>& particleParams, const std::function<void()>& finishCallback = nullptr); 859 void SetEmitterUpdater(const std::vector<std::shared_ptr<EmitterUpdater>>& para); 860 void SetParticleNoiseFields(const std::shared_ptr<ParticleNoiseFields>& para); 861 862 /** 863 * @brief Sets the foreground color of the node. 864 * 865 * @param colorValue The color value to set. 866 */ 867 void SetForegroundColor(uint32_t colorValue); 868 869 /** 870 * @brief Sets the background color of the node. 871 * 872 * @param colorValue The color value to set. 873 */ 874 void SetBackgroundColor(uint32_t colorValue); 875 876 /** 877 * @brief Sets the background color of the node, support color with different color space. 878 * 879 * @param color The color to set. 880 */ 881 void SetBackgroundColor(RSColor color); 882 883 /** 884 * @brief Sets the background shader for this node. 885 * 886 * @param shader A shared pointer to an RSShader object representing the shader to be applied as the background. 887 */ 888 void SetBackgroundShader(const std::shared_ptr<RSShader>& shader); 889 890 /** 891 * @brief Sets the background shader progress for this node. 892 * 893 * @param process The progress value to set for the background shader. 894 */ 895 void SetBackgroundShaderProgress(const float& process); 896 897 /** 898 * @brief Sets the background image for this node. 899 * 900 * @param image A shared pointer to an RSImage object representing the background image. 901 */ 902 void SetBgImage(const std::shared_ptr<RSImage>& image); 903 904 /** 905 * @brief Sets the inner rectangle area for the background image. 906 * 907 * @param innerRect A Vector4f representing the inner rectangle for the background image. 908 */ 909 void SetBgImageInnerRect(const Vector4f& innerRect); 910 911 /** 912 * @brief Sets the background image size. 913 * 914 * @param width The width of the background image. 915 * @param height The height of the background image. 916 */ 917 void SetBgImageSize(float width, float height); 918 919 /** 920 * @brief Sets the background image width. 921 * 922 * @param width The width of the background image. 923 */ 924 void SetBgImageWidth(float width); 925 926 /** 927 * @brief Sets the background image height. 928 * 929 * @param height The height of the background image. 930 */ 931 void SetBgImageHeight(float height); 932 933 /** 934 * @brief Sets the background image position. 935 * 936 * @param positionX The X coordinate of the background image position. 937 * @param positionY The Y coordinate of the background image position. 938 */ 939 void SetBgImagePosition(float positionX, float positionY); 940 941 /** 942 * @brief Sets the background image position along the X-axis. 943 * 944 * @param positionX The X coordinate of the background image position. 945 */ 946 void SetBgImagePositionX(float positionX); 947 948 /** 949 * @brief Sets the background image position along the Y-axis. 950 * 951 * @param positionY The Y coordinate of the background image position. 952 */ 953 void SetBgImagePositionY(float positionY); 954 955 /** 956 * @brief Sets the border color of the node. 957 * 958 * @param colorValue The color value to set for the border. 959 */ 960 void SetBorderColor(uint32_t colorValue); 961 962 /** 963 * @brief Sets the border color of the node. 964 * 965 * @param left The color value for the left border. 966 * @param top The color value for the top border. 967 * @param right The color value for the right border. 968 * @param bottom The color value for the bottom border. 969 */ 970 void SetBorderColor(uint32_t left, uint32_t top, uint32_t right, uint32_t bottom); 971 972 /** 973 * @brief Sets the border color of the node. 974 * 975 * @param color A Vector4f representing the border color for each side. 976 */ 977 void SetBorderColor(const Vector4<Color>& color); 978 979 /** 980 * @brief Sets the border width of the node. 981 * 982 * @param width The width value to set for the border. 983 */ 984 void SetBorderWidth(float width); 985 986 /** 987 * @brief Sets the border width of the node. 988 * 989 * @param left The width value for the left border. 990 * @param top The width value for the top border. 991 * @param right The width value for the right border. 992 * @param bottom The width value for the bottom border. 993 */ 994 void SetBorderWidth(float left, float top, float right, float bottom); 995 996 /** 997 * @brief Sets the border width of the node. 998 * 999 * @param width A Vector4f representing the border width for each side (left, top, right, bottom). 1000 */ 1001 void SetBorderWidth(const Vector4f& width); 1002 1003 /** 1004 * @brief Sets the border style of the node. 1005 * 1006 * @param styleValue The style value to set for the border. 1007 */ 1008 void SetBorderStyle(uint32_t styleValue); 1009 1010 /** 1011 * @brief Sets the border style of the node. 1012 * 1013 * @param left The style value for the left border. 1014 * @param top The style value for the top border. 1015 * @param right The style value for the right border. 1016 * @param bottom The style value for the bottom border. 1017 */ 1018 void SetBorderStyle(uint32_t left, uint32_t top, uint32_t right, uint32_t bottom); 1019 1020 /** 1021 * @brief Sets the border style of the node. 1022 * 1023 * @param style Indicates border style for each side (left, top, right, bottom). 1024 */ 1025 void SetBorderStyle(const Vector4<BorderStyle>& style); 1026 1027 /** 1028 * @brief Sets the dash width of the border. 1029 * 1030 * @param dashWidth Indicates widths of the dash segments for the border. 1031 */ 1032 void SetBorderDashWidth(const Vector4f& dashWidth); 1033 1034 /** 1035 * @brief Sets the dash gap of the border. 1036 * 1037 * @param dashGap Indicates gaps between the dash segments for the border. 1038 */ 1039 void SetBorderDashGap(const Vector4f& dashGap); 1040 1041 /** 1042 * @brief Sets the color of the outer border. 1043 * 1044 * @param color Indicates outer border color for each side. 1045 */ 1046 void SetOuterBorderColor(const Vector4<Color>& color); 1047 1048 /** 1049 * @brief Sets the width of the outer border. 1050 * 1051 * @param width Indicates outer border width for each side. 1052 */ 1053 void SetOuterBorderWidth(const Vector4f& width); 1054 1055 /** 1056 * @brief Sets the style of the outer border. 1057 * 1058 * @param style Indicates outer border style for each side. 1059 */ 1060 void SetOuterBorderStyle(const Vector4<BorderStyle>& style); 1061 1062 /** 1063 * @brief Sets the radius of the outer border. 1064 * 1065 * @param radius Indicates radius for each side of outer border. 1066 */ 1067 void SetOuterBorderRadius(const Vector4f& radius); 1068 1069 /** 1070 * @brief Sets the outline color of the node. 1071 * 1072 * @param color Indicates outline color,each color contains rgb and alpha. 1073 */ 1074 void SetOutlineColor(const Vector4<Color>& color); 1075 1076 /** 1077 * @brief Sets the outline width of the node. 1078 * 1079 * @param width Indicates outline width for each side. 1080 */ 1081 void SetOutlineWidth(const Vector4f& width); 1082 1083 /** 1084 * @brief Sets the outline style of the node. 1085 * 1086 * @param style Indicates values to be used as the outline style. 1087 */ 1088 void SetOutlineStyle(const Vector4<BorderStyle>& style); 1089 1090 /** 1091 * @brief Sets the dash width for the outline of the node. 1092 * 1093 * @param dashWidth Indicates widths of the dash segments for the outline. 1094 */ 1095 void SetOutlineDashWidth(const Vector4f& dashWidth); 1096 1097 /** 1098 * @brief Sets the dash gap for the outline of the node. 1099 * 1100 * @param dashGap Indicates gaps between the dash segments for the outline. 1101 */ 1102 void SetOutlineDashGap(const Vector4f& dashGap); 1103 1104 /** 1105 * @brief Sets the outline radius of the node. 1106 * 1107 * @param radius Indicates outline radius for each side. 1108 */ 1109 void SetOutlineRadius(const Vector4f& radius); 1110 1111 // UIEffect 1112 /** 1113 * @brief Sets the background filter for the UI. 1114 * 1115 * @param backgroundFilter Pointer to a Filter that defines the background filter effect. 1116 */ 1117 void SetUIBackgroundFilter(const OHOS::Rosen::Filter* backgroundFilter); 1118 1119 /** 1120 * @brief Sets the compositing filter for the UI. 1121 * 1122 * @param compositingFilter Pointer to a Filter that defines the compositing filter effect. 1123 */ 1124 void SetUICompositingFilter(const OHOS::Rosen::Filter* compositingFilter); 1125 1126 /** 1127 * @brief Sets the foreground filter for the UI. 1128 * 1129 * @param foregroundFilter Pointer to a Filter that defines the foreground filter effect. 1130 */ 1131 void SetUIForegroundFilter(const OHOS::Rosen::Filter* foregroundFilter); 1132 1133 /** 1134 * @brief Sets the visual effect for the UI. 1135 * 1136 * @param visualEffect Pointer to a VisualEffect that defines the visual effect. 1137 */ 1138 void SetVisualEffect(const VisualEffect* visualEffect); 1139 1140 /** 1141 * @brief Sets the foreground effect radius. 1142 * 1143 * @param blurRadius Indicates radius of the foreground effect. 1144 */ 1145 void SetForegroundEffectRadius(const float blurRadius); 1146 1147 /** 1148 * @brief Sets the background effect radius. 1149 * 1150 * @param backgroundFilter Indicates the background filter to be applied. 1151 */ 1152 void SetBackgroundFilter(const std::shared_ptr<RSFilter>& backgroundFilter); 1153 1154 /** 1155 * @brief Sets the background filter. 1156 * 1157 * @param backgroundFilter Indicates the background filter to be applied. 1158 */ 1159 void SetBackgroundNGFilter(const std::shared_ptr<RSNGFilterBase>& backgroundFilter); 1160 1161 /** 1162 * @brief Sets the foreground filter. 1163 * 1164 * @param foregroundFilter Indicates the foreground filter to be applied. 1165 */ 1166 void SetForegroundNGFilter(const std::shared_ptr<RSNGFilterBase>& foregroundFilter); 1167 1168 /** 1169 * @brief Sets the background shader. 1170 * 1171 * @param backgroundShader Indicates the background shader to be applied. 1172 */ 1173 void SetBackgroundNGShader(const std::shared_ptr<RSNGShaderBase>& backgroundShader); 1174 1175 /** 1176 * @brief Sets the foreground shader. 1177 * 1178 * @param foregroundShader Indicates the foreground shader to be applied. 1179 */ 1180 void SetForegroundShader(const std::shared_ptr<RSNGShaderBase>& foregroundShader); 1181 1182 /** 1183 * @brief Sets the filter. 1184 * 1185 * @param filter Indicates the filter to be applied. 1186 */ 1187 void SetFilter(const std::shared_ptr<RSFilter>& filter); 1188 1189 /** 1190 * @brief Sets the parameters for linear gradient blur. 1191 * 1192 * @param para Indicates the parameters for linear gradient blur. 1193 */ 1194 void SetLinearGradientBlurPara(const std::shared_ptr<RSLinearGradientBlurPara>& para); 1195 1196 /** 1197 * @brief Sets the parameters for motion blur. 1198 * 1199 * @param radius Indicates the radius for motion blur. 1200 * @param anchor Indicates the anchor for motion blur. 1201 */ 1202 void SetMotionBlurPara(const float radius, const Vector2f& anchor); 1203 1204 /** 1205 * @brief Sets the parameters for magnifier. 1206 * 1207 * @param para Indicates the parameters for magnifier. 1208 */ 1209 void SetMagnifierParams(const std::shared_ptr<RSMagnifierParams>& para); 1210 1211 /** 1212 * @brief Sets the rate for dynamic light. 1213 * 1214 * @param rate Indicates the rate of dynamic light. 1215 */ 1216 void SetDynamicLightUpRate(const float rate); 1217 1218 /** 1219 * @brief Sets the degree of dynamic light up. 1220 * 1221 * @param lightUpDegree Indicates the degree of dynamic light up. 1222 */ 1223 void SetDynamicLightUpDegree(const float lightUpDegree); 1224 void SetDynamicDimDegree(const float dimDegree); 1225 1226 /** 1227 * @brief Sets the Blender. 1228 * 1229 * @param blender Pointer to a Blender object. 1230 */ 1231 void SetBlender(const Blender* blender); 1232 1233 /** 1234 * @brief Sets the parameters for foreground brightness. 1235 * 1236 * @param params Indicates the parameters for foreground brightness. 1237 */ 1238 void SetFgBrightnessParams(const RSDynamicBrightnessPara& params); 1239 1240 /** 1241 * @brief Sets the rates for foreround brightness. 1242 * 1243 * @param rates Indicates the rates for foreground brightness. 1244 */ 1245 void SetFgBrightnessRates(const Vector4f& rates); 1246 1247 /** 1248 * @brief Sets the saturation for foreground brightness. 1249 * 1250 * @param saturation Indicates the saturation for foreground brightness. 1251 */ 1252 void SetFgBrightnessSaturation(const float& saturation); 1253 1254 /** 1255 * @brief Sets the positive coefficient for foreground brightness. 1256 * 1257 * @param coeff Indicates the positive coefficient for foreground brightness. 1258 */ 1259 void SetFgBrightnessPosCoeff(const Vector4f& coeff); 1260 1261 /** 1262 * @brief Sets the negative coefficient for foreground brightness. 1263 * 1264 * @param coeff Indicates the negative coefficient for foreground brightness. 1265 */ 1266 void SetFgBrightnessNegCoeff(const Vector4f& coeff); 1267 void SetFgBrightnessFract(const float& fract); 1268 1269 /** 1270 * @brief Sets the hdr using for foreground brightness. 1271 * 1272 * @param hdr Indicates the hdr using for foreground brightness. 1273 */ 1274 void SetFgBrightnessHdr(const bool hdr); 1275 1276 /** 1277 * @brief Sets the parameters for background brightness. 1278 * 1279 * @param params Indicates the parameters for background brightness. 1280 */ 1281 void SetBgBrightnessParams(const RSDynamicBrightnessPara& params); 1282 1283 /** 1284 * @brief Sets the rates for background brightness. 1285 * 1286 * @param rates Indicates the rates for background brightness. 1287 */ 1288 void SetBgBrightnessRates(const Vector4f& rates); 1289 1290 /** 1291 * @brief Sets the saturation for background brightness. 1292 * 1293 * @param saturation Indicates the saturation for background brightness. 1294 */ 1295 void SetBgBrightnessSaturation(const float& saturation); 1296 1297 /** 1298 * @brief Sets the positive coefficient for background brightness. 1299 * 1300 * @param coeff Indicates the positive coefficient for background brightness. 1301 */ 1302 void SetBgBrightnessPosCoeff(const Vector4f& coeff); 1303 1304 /** 1305 * @brief Sets the negative coefficient for background brightness. 1306 * 1307 * @param coeff Indicates the negative coefficient for background brightness. 1308 */ 1309 void SetBgBrightnessNegCoeff(const Vector4f& coeff); 1310 void SetBgBrightnessFract(const float& fract); 1311 void SetBorderLightShader(std::shared_ptr<VisualEffectPara> visualEffectPara); 1312 1313 1314 /** 1315 * @brief Sets the grey coefficient. 1316 * 1317 * @param greyCoef Indicates the grey coefficient. 1318 */ 1319 void SetGreyCoef(const Vector2f greyCoef); 1320 1321 /** 1322 * @brief Sets the compositing filter. 1323 * 1324 * @param compositingFilter Pointer to a Filter that defines the compositing filter effect. 1325 */ 1326 void SetCompositingFilter(const std::shared_ptr<RSFilter>& compositingFilter); 1327 1328 /** 1329 * @brief Sets the shadow color. 1330 * 1331 * @param colorValue Indicates the color value to be set. 1332 */ 1333 void SetShadowColor(uint32_t colorValue); 1334 1335 /** 1336 * @brief Sets the offset of the shadow. 1337 * 1338 * @param offsetX Indicates the offset value along the X-axis. 1339 * @param offsetY Indicates the offset value along the Y-axis. 1340 */ 1341 void SetShadowOffset(float offsetX, float offsetY); 1342 1343 /** 1344 * @brief Sets the shadow offset along the X-axis. 1345 * 1346 * @param offsetX Indicates the offset value along the X-axis. 1347 */ 1348 void SetShadowOffsetX(float offsetX); 1349 1350 /** 1351 * @brief Sets the shadow offset along the Y-axis. 1352 * 1353 * @param offsetY Indicates the offset value along the Y-axis. 1354 */ 1355 void SetShadowOffsetY(float offsetY); 1356 1357 /** 1358 * @brief Sets the alpha of the shadow 1359 * 1360 * @param alpha Indicates the alpha value to be set. 1361 */ 1362 void SetShadowAlpha(float alpha); 1363 1364 /** 1365 * @brief Sets the elevation of the shadow. 1366 * 1367 * @param elevation Indicates the elevation value to be set. 1368 */ 1369 void SetShadowElevation(float elevation); 1370 1371 /** 1372 * @brief Sets the radius of the shadow. 1373 * 1374 * @param radius Indicates the radius value to be set. 1375 */ 1376 void SetShadowRadius(float radius); 1377 1378 /** 1379 * @brief Sets the path of the shadow. 1380 * 1381 * @param shadowPath Indicates the path of the shadow. 1382 */ 1383 void SetShadowPath(const std::shared_ptr<RSPath>& shadowPath); 1384 1385 /** 1386 * @brief Sets whether a shadow mask should be applied to this node. 1387 * 1388 * @param shadowMask Indicates whether to enable (true) or disable (false) the shadow mask. 1389 */ 1390 void SetShadowMask(bool shadowMask); 1391 1392 /** 1393 * @brief Sets the strategy of the shadow mask. 1394 * 1395 * @param strategy Indicates the strategy of the shadow mask. 1396 */ 1397 void SetShadowMaskStrategy(SHADOW_MASK_STRATEGY strategy); 1398 1399 /** 1400 * @brief Sets whether the shadow should be filled. 1401 * 1402 * @param shadowIsFilled Indicates whether the shadow is filled (true) or not (false). 1403 */ 1404 void SetShadowIsFilled(bool shadowIsFilled); 1405 1406 /** 1407 * @brief Sets the color strategy of the shadow. 1408 * 1409 * @param shadowColorStrategy Indicates the color strategy of the shadow. 1410 */ 1411 void SetShadowColorStrategy(int shadowColorStrategy); 1412 1413 /** 1414 * @brief Sets the gravity for the frame of this node. 1415 * 1416 * @param gravity The gravity value to apply. 1417 */ 1418 void SetFrameGravity(Gravity gravity); 1419 1420 /** 1421 * @brief Sets a rounded rectangle clipping region for the node. 1422 * 1423 * @param clipRect The bounds of the clipping rectangle,represented as (x, y, width, height). 1424 * @param clipRadius The radii for the rectangle's corners,represented as (topLeft, topRight, bottomRight, bottomLeft). 1425 */ 1426 void SetClipRRect(const Vector4f& clipRect, const Vector4f& clipRadius); 1427 1428 /** 1429 * @brief Sets the clipping region of the node to the specified rounded rectangle. 1430 * 1431 * @param rrect A shared pointer to an RRect object that defines the clipping region. 1432 */ 1433 void SetClipRRect(const std::shared_ptr<RRect>& rrect); 1434 1435 /** 1436 * @brief Sets the clipping bounds for this node using the specified path. 1437 * 1438 * @param clipToBounds A shared pointer to an RSPath object that defines the clipping region. 1439 */ 1440 void SetClipBounds(const std::shared_ptr<RSPath>& clipToBounds); 1441 1442 /** 1443 * @brief Sets whether the content of this node should be clipped to its bounds. 1444 * 1445 * @param clipToBounds True to enable clipping to bounds; false to disable. 1446 */ 1447 void SetClipToBounds(bool clipToBounds); 1448 1449 /** 1450 * @brief Sets whether the content of this node should be clipped to its frame. 1451 * 1452 * @param clipToFrame True to enable clipping to frame; false to disable. 1453 */ 1454 void SetClipToFrame(bool clipToFrame); 1455 1456 /** 1457 * @brief Sets custom clipping rectangle. 1458 * 1459 * @param clipRect A Vector4f representing the clipping rectangle (x, y, width, height). 1460 */ 1461 void SetCustomClipToFrame(const Vector4f& clipRect); 1462 1463 /** 1464 * @brief Sets the brightness of HDR (High Dynamic Range). 1465 * 1466 * @param hdrBrightness The HDR brightness value to set. 1467 */ 1468 void SetHDRBrightness(const float& hdrBrightness); 1469 1470 /** 1471 * @brief Sets the HDR brightness factor to display node. 1472 * 1473 * @param factor The HDR brightness factor to set. 1474 */ 1475 void SetHDRBrightnessFactor(float factor); 1476 1477 /** 1478 * @brief Sets the visibility of the node. 1479 * 1480 * @param visible True to make the node visible; false to hide it. 1481 */ 1482 void SetVisible(bool visible); 1483 void SetMask(const std::shared_ptr<RSMask>& mask); 1484 1485 /** 1486 * @brief Sets the spherize degree. 1487 * 1488 * @param spherizeDegree The degree of spherization to apply. 1489 */ 1490 void SetSpherizeDegree(float spherizeDegree); 1491 1492 /** 1493 * @brief Sets the brightness ratio of HDR UI component. 1494 * 1495 * @param hdrUIBrightness The HDR UI component brightness ratio. 1496 */ 1497 void SetHDRUIBrightness(float hdrUIBrightness); 1498 1499 /** 1500 * @brief Sets the degree of light up effect. 1501 * 1502 * @param lightUpEffectDegree The degree of the light up effect to apply. 1503 */ 1504 void SetLightUpEffectDegree(float lightUpEffectDegree); 1505 1506 void SetAttractionEffect(float fraction, const Vector2f& destinationPoint); 1507 void SetAttractionEffectFraction(float fraction); 1508 void SetAttractionEffectDstPoint(const Vector2f& destinationPoint); 1509 1510 void SetPixelStretch(const Vector4f& stretchSize, Drawing::TileMode stretchTileMode = Drawing::TileMode::CLAMP); 1511 void SetPixelStretchPercent(const Vector4f& stretchPercent, 1512 Drawing::TileMode stretchTileMode = Drawing::TileMode::CLAMP); 1513 1514 void SetWaterRippleParams(const RSWaterRipplePara& params, float progress); 1515 void SetFlyOutParams(const RSFlyOutPara& params, float degree); 1516 1517 void SetDistortionK(const float distortionK); 1518 1519 /** 1520 * @brief Sets the paint order for the node. 1521 * 1522 * @param drawContentLast Indicates whether to draw the content of the node last. 1523 */ 1524 void SetPaintOrder(bool drawContentLast); 1525 SetTransitionEffect(const std::shared_ptr<const RSTransitionEffect> & effect)1526 void SetTransitionEffect(const std::shared_ptr<const RSTransitionEffect>& effect) 1527 { 1528 transitionEffect_ = effect; 1529 } 1530 1531 void SetUseEffect(bool useEffect); 1532 void SetUseEffectType(UseEffectType useEffectType); 1533 void SetAlwaysSnapshot(bool enable); 1534 1535 void SetUseShadowBatching(bool useShadowBatching); 1536 1537 void SetColorBlendMode(RSColorBlendMode colorBlendMode); 1538 1539 void SetColorBlendApplyType(RSColorBlendApplyType colorBlendApplyType); 1540 1541 // driven render was shelved, functions will be deleted soon [start] MarkDrivenRender(bool flag)1542 void MarkDrivenRender(bool flag) {} MarkDrivenRenderItemIndex(int index)1543 void MarkDrivenRenderItemIndex(int index) {} MarkDrivenRenderFramePaintState(bool flag)1544 void MarkDrivenRenderFramePaintState(bool flag) {} MarkContentChanged(bool isChanged)1545 void MarkContentChanged(bool isChanged) {} 1546 // driven render was shelved, functions will be deleted soon [end] 1547 1548 void AddModifier(const std::shared_ptr<ModifierNG::RSModifier> modifier); 1549 1550 void RemoveModifier(const std::shared_ptr<ModifierNG::RSModifier> modifier); 1551 1552 const std::shared_ptr<ModifierNG::RSModifier> GetModifierByType(const ModifierNG::RSModifierType& type); 1553 1554 /** 1555 * @brief Sets whether the node is a custom text type. 1556 * 1557 * @param isCustomTextType true if the text type is custom; false otherwise. 1558 */ 1559 void SetIsCustomTextType(bool isCustomTextType); 1560 1561 /** 1562 * @brief Gets whether the node is a custom text type. 1563 * 1564 * @return true if the text type is custom; false otherwise. 1565 */ 1566 bool GetIsCustomTextType(); 1567 1568 void SetIsCustomTypeface(bool isCustomTypeface); 1569 1570 bool GetIsCustomTypeface(); 1571 1572 /** 1573 * @brief Sets the drawing region for the node. 1574 * 1575 * @param rect Indicates a rectF object representing the drawing region. 1576 */ 1577 void SetDrawRegion(std::shared_ptr<RectF> rect); 1578 1579 /** 1580 * @brief Sets if need use the cmdlist drawing region for the node. 1581 * 1582 * @param needUseCmdlistDrawRegion Whether to need use the cmdlist drawing region for this node. 1583 */ 1584 void SetNeedUseCmdlistDrawRegion(bool needUseCmdlistDrawRegion); 1585 1586 /** 1587 * @brief Mark the node as a group node for rendering pipeline optimization 1588 * 1589 * NodeGroup generates off-screen cache containing this node and its entire subtree 1590 * Off-screen cache may exhibit conflicts between background effects 1591 * When using node group optimization, be aware of rendering effect limitations: 1592 * - Avoid co-occurrence of surface capture, blur, brightness adjustment and blend operations 1593 * - These effects may produce visual artifacts or performance degradation 1594 * 1595 * @param isNodeGroup Whether to enable group rendering optimization for this node 1596 * @param isForced When true, forces group marking ignoring system property checks 1597 * @param includeProperty When true, packages node properties with the group 1598 */ 1599 void MarkNodeGroup(bool isNodeGroup, bool isForced = true, bool includeProperty = false); 1600 1601 // Mark opinc node 1602 void MarkSuggestOpincNode(bool isOpincNode, bool isNeedCalculate = false); 1603 // will be abandoned 1604 void MarkUifirstNode(bool isUifirstNode); 1605 // Mark uifirst leash node 1606 void MarkUifirstNode(bool isForceFlag, bool isUifirstEnable); 1607 1608 void SetUIFirstSwitch(RSUIFirstSwitch uiFirstSwitch); 1609 1610 void MarkNodeSingleFrameComposer(bool isNodeSingleFrameComposer); 1611 1612 void MarkRepaintBoundary(const std::string& tag); 1613 void SetGrayScale(float grayScale); 1614 1615 void SetLightIntensity(float lightIntensity); 1616 1617 void SetLightColor(uint32_t lightColorValue); 1618 1619 void SetLightPosition(const Vector4f& lightPosition); 1620 1621 void SetLightPosition(float positionX, float positionY, float positionZ); 1622 1623 void SetIlluminatedBorderWidth(float illuminatedBorderWidth); 1624 1625 void SetIlluminatedType(uint32_t illuminatedType); 1626 1627 void SetBloom(float bloomIntensity); 1628 1629 void SetBrightness(float brightness); 1630 1631 void SetContrast(float contrast); 1632 1633 void SetSaturate(float saturate); 1634 1635 void SetSepia(float sepia); 1636 1637 void SetInvert(float invert); 1638 1639 void SetAiInvert(const Vector4f& aiInvert); 1640 1641 void SetSystemBarEffect(); 1642 1643 void SetHueRotate(float hueRotate); 1644 1645 void SetColorBlend(uint32_t colorValue); 1646 1647 int32_t CalcExpectedFrameRate(const std::string& scene, float speed); 1648 1649 void SetOutOfParent(OutOfParentType outOfParent); 1650 1651 void SetFrameNodeInfo(int32_t id, std::string tag); 1652 1653 virtual void SetTextureExport(bool isTextureExportNode); 1654 1655 void SyncTextureExport(bool isTextureExportNode); 1656 1657 int32_t GetFrameNodeId(); 1658 1659 std::string GetFrameNodeTag(); 1660 SetBoundsChangedCallback(BoundsChangedCallback callback)1661 virtual void SetBoundsChangedCallback(BoundsChangedCallback callback){}; IsTextureExportNode()1662 bool IsTextureExportNode() const 1663 { 1664 return isTextureExportNode_; 1665 } 1666 GetAnimationsCount()1667 size_t GetAnimationsCount() const 1668 { 1669 return animations_.size(); 1670 } 1671 void SetExportTypeChangedCallback(ExportTypeChangedCallback callback); 1672 1673 bool IsGeometryDirty() const; 1674 bool IsAppearanceDirty() const; 1675 void MarkDirty(NodeDirtyType type, bool isDirty); 1676 1677 float GetGlobalPositionX() const; 1678 float GetGlobalPositionY() const; 1679 1680 std::shared_ptr<RSObjAbsGeometry> GetLocalGeometry() const; 1681 std::shared_ptr<RSObjAbsGeometry> GetGlobalGeometry() const; 1682 void UpdateLocalGeometry(); 1683 void UpdateGlobalGeometry(const std::shared_ptr<RSObjAbsGeometry>& parentGlobalGeometry); 1684 1685 std::mutex childrenNodeLock_; // lock for map operation 1686 // key: symbolSpanID, value:nodeid and symbol animation node list 1687 std::unordered_map<uint64_t, std::unordered_map<NodeId, SharedPtr>> canvasNodesListMap_; 1688 1689 // key: status : 0 invalid, 1 appear, value:symbol node animation config 1690 std::array<std::vector<OHOS::Rosen::AnimationNodeConfig>, 2> replaceNodesSwapArr_; 1691 1692 /** 1693 * @brief Sets the id of the instance. 1694 * 1695 * @param instanceId The id of the instance to set. 1696 */ 1697 void SetInstanceId(int32_t instanceId); 1698 1699 /** 1700 * @brief Gets the id of the instance. 1701 * 1702 * @return The id of the instance. 1703 */ GetInstanceId()1704 int32_t GetInstanceId() const 1705 { 1706 return instanceId_; 1707 } 1708 1709 /** 1710 * @brief Get the name of the node. 1711 * 1712 * @return The name of the node as a std::string. 1713 */ GetNodeName()1714 const std::string GetNodeName() const 1715 { 1716 return nodeName_; 1717 } 1718 1719 static DrawNodeChangeCallback drawNodeChangeCallback_; 1720 static void SetDrawNodeChangeCallback(DrawNodeChangeCallback callback); 1721 static PropertyNodeChangeCallback propertyNodeChangeCallback_; 1722 /** 1723 * @brief Sets the callback function for property node change events 1724 * 1725 * @param callback Function pointer to the callback handler 1726 */ 1727 static void SetPropertyNodeChangeCallback(PropertyNodeChangeCallback callback); 1728 1729 /** 1730 * @brief Enables or disables property node change callback notifications 1731 * 1732 * @param needCallback Boolean flag to control callback triggering 1733 */ 1734 static void SetNeedCallbackNodeChange(bool needCallback); 1735 bool GetIsDrawn(); 1736 void SetDrawNode(); 1737 DrawNodeType GetDrawNodeType() const; 1738 void SyncDrawNodeType(DrawNodeType nodeType); 1739 1740 const std::shared_ptr<RSPropertyBase> GetPropertyById(const PropertyId& propertyId); 1741 const std::shared_ptr<RSPropertyBase> GetPropertyByType( 1742 const ModifierNG::RSModifierType& modifierType, const ModifierNG::RSPropertyType& propertyType); 1743 1744 /** 1745 * @brief Gets the context for the RSUI. 1746 * 1747 * @return A shared pointer to the RSUIContext object. 1748 */ GetRSUIContext()1749 std::shared_ptr<RSUIContext> GetRSUIContext() 1750 { 1751 return rsUIContext_.lock(); 1752 } 1753 void SetUIContextToken(); 1754 1755 /** 1756 * @brief Sets the context for the RSUI. 1757 * 1758 * @param rsUIContext A shared pointer to the RSUIContext object. 1759 */ 1760 void SetRSUIContext(std::shared_ptr<RSUIContext> rsUIContext); 1761 1762 /** 1763 * @brief Sets whether to skip check in multi-instance. 1764 * 1765 * @param isSkipCheckInMultiInstance true to skip check; false otherwise. 1766 */ 1767 void SetSkipCheckInMultiInstance(bool isSkipCheckInMultiInstance); 1768 1769 /** 1770 * @brief Gets whether the canvas enables hybrid rendering. 1771 * 1772 * @return true if hybrid rendering is enabled; false otherwise. 1773 */ IsHybridRenderCanvas()1774 bool IsHybridRenderCanvas() const 1775 { 1776 return hybridRenderCanvas_; 1777 } 1778 1779 /** 1780 * @brief Sets whether the canvas enables hybrid rendering. 1781 * 1782 * @param hybridRenderCanvas true to enable hybrid rendering; false otherwise. 1783 */ SetHybridRenderCanvas(bool hybridRenderCanvas)1784 virtual void SetHybridRenderCanvas(bool hybridRenderCanvas) {}; 1785 1786 /** 1787 * @brief Gets whether the node is on the tree. 1788 * 1789 * @return true if the node is on the tree; false otherwise. 1790 */ GetIsOnTheTree()1791 bool GetIsOnTheTree() 1792 { 1793 return isOnTheTree_; 1794 } 1795 1796 /** 1797 * @brief Enables/disables control-level occlusion culling for the node's subtree 1798 * 1799 * When enabled, this node and its entire subtree will participate in 1800 * control-level occlusion culling. The specified key occlusion node acts as the primary 1801 * occluder within the subtree. 1802 * 1803 * @param enable 1804 * - true: Enables occlusion culling for this node and its subtree 1805 * - false: Disables occlusion culling for this node and its subtree 1806 * @param keyOcclusionNodeId 1807 * The ID of the key occluding node within the subtree. This node will be treated as 1808 * the primary occlusion source when determining visibility of other nodes in the subtree. 1809 * Pass INVALID_NODE_ID if no specific occluder is designated. 1810 */ 1811 void UpdateOcclusionCullingStatus(bool enable, NodeId keyOcclusionNodeId); 1812 1813 protected: 1814 explicit RSNode( 1815 bool isRenderServiceNode, bool isTextureExportNode = false, std::shared_ptr<RSUIContext> rsUIContext = nullptr, 1816 bool isOnTheTree = false); 1817 explicit RSNode(bool isRenderServiceNode, NodeId id, bool isTextureExportNode = false, 1818 std::shared_ptr<RSUIContext> rsUIContext = nullptr, bool isOnTheTree = false); 1819 1820 void DumpModifiers(std::string& out) const; 1821 1822 bool isRenderServiceNode_; 1823 bool isTextureExportNode_ = false; 1824 bool skipDestroyCommandInDestructor_ = false; 1825 ExportTypeChangedCallback exportTypeChangedCallback_ = nullptr; 1826 1827 // Used for same layer rendering, to determine whether RT or RS generates renderNode when the type of node switches 1828 bool hasCreateRenderNodeInRT_ = false; 1829 bool hasCreateRenderNodeInRS_ = false; 1830 1831 bool drawContentLast_ = false; 1832 1833 bool hybridRenderCanvas_ = false; 1834 1835 /** 1836 * @brief Called when child nodes are added to this node. 1837 */ 1838 virtual void OnAddChildren(); 1839 1840 /** 1841 * @brief Called when child nodes are removed from this node. 1842 */ 1843 virtual void OnRemoveChildren(); 1844 NeedForcedSendToRemote()1845 virtual bool NeedForcedSendToRemote() const 1846 { 1847 return false; 1848 } 1849 1850 void DoFlushModifier(); 1851 1852 std::vector<PropertyId> GetModifierIds() const; 1853 bool isCustomTextType_ = false; 1854 bool isCustomTypeface_ = false; 1855 1856 /** 1857 * @brief Gets the mutex used for property access. 1858 * 1859 * @return Reference to the internal std::recursive_mutex used for property synchronization. 1860 */ GetPropertyMutex()1861 std::recursive_mutex& GetPropertyMutex() const 1862 { 1863 return propertyMutex_; 1864 } 1865 1866 /** 1867 * @brief Checks if the function is being accessed from multiple threads. 1868 * 1869 * @param func The name of the function to check. 1870 * @return true if accessed from multiple threads; false otherwise. 1871 */ 1872 bool CheckMultiThreadAccess(const std::string& func) const; 1873 1874 /** 1875 * @brief Registers the node map. 1876 */ RegisterNodeMap()1877 virtual void RegisterNodeMap() {} 1878 1879 /** 1880 * @brief Gets the transaction handler for the RS. 1881 * 1882 * @return A shared pointer to the RSTransactionHandler object. 1883 */ 1884 std::shared_ptr<RSTransactionHandler> GetRSTransaction() const; 1885 1886 /** 1887 * @brief Adds a command to the command list. 1888 * 1889 * @param command A unique pointer to the RSCommand to be added. 1890 * @param isRenderServiceCommand Indicates whether the command is a render service command. Default is false. 1891 * @param followType Specifies the follow type for the command. Default is FollowType::NONE. 1892 * @param nodeId The ID of the node associated with the command. Default is 0. 1893 * @return true if the command was successfully added; false otherwise. 1894 */ 1895 bool AddCommand(std::unique_ptr<RSCommand>& command, bool isRenderServiceCommand = false, 1896 FollowType followType = FollowType::NONE, NodeId nodeId = 0) const; 1897 1898 /** 1899 * @brief Sets whether the node is on the tree. 1900 * 1901 * @param flag true if the node is on the tree; false otherwise. 1902 */ 1903 void SetIsOnTheTree(bool flag); 1904 1905 std::array<std::shared_ptr<ModifierNG::RSModifier>, ModifierNG::MODIFIER_TYPE_COUNT> modifiersNGCreatedBySetter_; 1906 private: 1907 static NodeId GenerateId(); 1908 static void InitUniRenderEnabled(); 1909 NodeId id_; 1910 WeakPtr parent_; 1911 int32_t instanceId_ = INSTANCE_ID_UNDEFINED; 1912 int32_t frameNodeId_ = -1; 1913 std::string frameNodeTag_; 1914 std::string nodeName_ = ""; 1915 std::vector<WeakPtr> children_; 1916 void SetParent(WeakPtr parent); 1917 void RemoveChildByNode(SharedPtr child); CreateRenderNodeForTextureExportSwitch()1918 virtual void CreateRenderNodeForTextureExportSwitch() {}; 1919 1920 /** 1921 * @brief Sets a property value for a specific modifier. 1922 * 1923 * If property already exists, it will be updated. 1924 * If property does not exist, it will be created. 1925 * 1926 * @param value The value to assign to the property. 1927 */ 1928 template<typename ModifierType, auto Setter, typename T> 1929 void SetPropertyNG(T value); 1930 1931 /** 1932 * @brief Sets a property value for a specific modifier. 1933 * 1934 * If property already exists, it will be updated. 1935 * If property does not exist, it will be created. 1936 * 1937 * @param value The value to assign to the property. 1938 * @param animatable The property is animatable or not. 1939 */ 1940 template<typename ModifierType, auto Setter, typename T> 1941 void SetPropertyNG(T value, bool animatable); 1942 1943 /** 1944 * @brief Sets a UIFilter property value for a specific modifier. 1945 * 1946 * If property already exists, it will be updated. 1947 * If property does not exist, it will be created. 1948 * 1949 * @param value The value to assign to the property. 1950 */ 1951 template<typename ModifierType, auto Setter, typename T> 1952 void SetUIFilterPropertyNG(T value); 1953 1954 void SetBackgroundBlurRadius(float radius); 1955 void SetBackgroundBlurSaturation(float saturation); 1956 void SetBackgroundBlurBrightness(float brightness); 1957 void SetBackgroundBlurMaskColor(Color maskColor); 1958 void SetBackgroundBlurColorMode(int colorMode); 1959 void SetBackgroundBlurRadiusX(float blurRadiusX); 1960 void SetBackgroundBlurRadiusY(float blurRadiusY); 1961 void SetBgBlurDisableSystemAdaptation(bool disableSystemAdaptation); 1962 1963 void SetForegroundBlurRadius(float radius); 1964 void SetForegroundBlurSaturation(float saturation); 1965 void SetForegroundBlurBrightness(float brightness); 1966 void SetForegroundBlurMaskColor(Color maskColor); 1967 void SetForegroundBlurColorMode(int colorMode); 1968 void SetForegroundBlurRadiusX(float blurRadiusX); 1969 void SetForegroundBlurRadiusY(float blurRadiusY); 1970 void SetFgBlurDisableSystemAdaptation(bool disableSystemAdaptation); 1971 1972 void SetShadowBlenderParams(const RSShadowBlenderPara& params); 1973 1974 void NotifyPageNodeChanged(); 1975 bool AnimationCallback(AnimationId animationId, AnimationCallbackEvent event); 1976 bool HasPropertyAnimation(const PropertyId& id); 1977 std::vector<AnimationId> GetAnimationByPropertyId(const PropertyId& id); 1978 bool FallbackAnimationsToContext(); 1979 void FallbackAnimationsToRoot(); 1980 void AddAnimationInner(const std::shared_ptr<RSAnimation>& animation); 1981 void FinishAnimationByProperty(const PropertyId& id); 1982 void RemoveAnimationInner(const std::shared_ptr<RSAnimation>& animation); 1983 void CancelAnimationByProperty(const PropertyId& id, const bool needForceSync = false); 1984 1985 1986 /** 1987 * @brief Retrieves the modifier associated with the specified property ID. 1988 * 1989 * @param propertyId The identifier of the property whose modifier is to be retrieved. 1990 * @return The shared pointer to the corresponding RSModifier,or nullptr if not found. 1991 */ 1992 const std::shared_ptr<RSModifier> GetModifier(const PropertyId& propertyId); 1993 const std::shared_ptr<RSPropertyBase> GetProperty(const PropertyId& propertyId); 1994 void RegisterProperty(std::shared_ptr<RSPropertyBase> property); 1995 void UnregisterProperty(const PropertyId& propertyId); 1996 1997 1998 /** 1999 * @brief Called when the bounds size of the node has changed. 2000 */ OnBoundsSizeChanged()2001 virtual void OnBoundsSizeChanged() const {}; 2002 void UpdateModifierMotionPathOption(); 2003 void MarkAllExtendModifierDirty(); 2004 void ResetExtendModifierDirty(); 2005 void SetParticleDrawRegion(std::vector<ParticleParams>& particleParams); 2006 2007 void DetachUIFilterProperties(const std::shared_ptr<ModifierNG::RSModifier>& modifier); 2008 2009 /** 2010 * @brief Clears all modifiers associated with this node. 2011 * 2012 * Planning: refactor RSUIAnimationManager and remove this method 2013 */ 2014 void ClearAllModifiers(); 2015 2016 uint32_t dirtyType_ = static_cast<uint32_t>(NodeDirtyType::NOT_DIRTY); 2017 2018 std::shared_ptr<RSObjAbsGeometry> localGeometry_; 2019 std::shared_ptr<RSObjAbsGeometry> globalGeometry_; 2020 2021 float globalPositionX_ = 0.f; 2022 float globalPositionY_ = 0.f; 2023 2024 bool extendModifierIsDirty_ { false }; 2025 2026 bool isNodeGroup_ = false; 2027 bool isRepaintBoundary_ = false; 2028 2029 bool isNodeSingleFrameComposer_ = false; 2030 2031 bool isSuggestOpincNode_ = false; 2032 bool isDrawNode_ = false; 2033 // Used to identify whether the node has real drawing property 2034 DrawNodeType drawNodeType_ = DrawNodeType::PureContainerType; 2035 static bool isNeedCallbackNodeChange_; 2036 2037 bool isUifirstNode_ = true; 2038 bool isForceFlag_ = false; 2039 bool isUifirstEnable_ = false; 2040 bool isSkipCheckInMultiInstance_ = false; 2041 RSUIFirstSwitch uiFirstSwitch_ = RSUIFirstSwitch::NONE; 2042 std::weak_ptr<RSUIContext> rsUIContext_; 2043 2044 RSModifierExtractor stagingPropertiesExtractor_; 2045 RSShowingPropertiesFreezer showingPropertiesFreezer_; 2046 std::map<PropertyId, std::shared_ptr<RSModifier>> modifiers_; 2047 std::map<PropertyId, std::shared_ptr<RSPropertyBase>> properties_; 2048 std::map<uint16_t, std::shared_ptr<RSModifier>> modifiersTypeMap_; 2049 std::map<ModifierId, std::shared_ptr<ModifierNG::RSModifier>> modifiersNG_; 2050 2051 std::shared_ptr<RectF> drawRegion_; 2052 OutOfParentType outOfParent_ = OutOfParentType::UNKNOWN; 2053 2054 std::unordered_map<AnimationId, std::shared_ptr<RSAnimation>> animations_; 2055 std::unordered_map<PropertyId, uint32_t> animatingPropertyNum_; 2056 std::shared_ptr<RSMotionPathOption> motionPathOption_; 2057 std::shared_ptr<const RSTransitionEffect> transitionEffect_; 2058 2059 std::recursive_mutex animationMutex_; 2060 mutable std::recursive_mutex propertyMutex_; 2061 2062 bool isOnTheTree_ = false; 2063 bool isOnTheTreeInit_ = false; 2064 2065 friend class RSUIDirector; 2066 friend class RSTransition; 2067 friend class RSSpringAnimation; 2068 friend class RSShowingPropertiesFreezer; 2069 friend class RSPropertyBase; 2070 friend class RSPropertyAnimation; 2071 friend class RSPathAnimation; 2072 friend class RSModifierExtractor; 2073 friend class ModifierNG::RSModifier; 2074 friend class ModifierNG::RSCustomModifier; 2075 friend class RSBackgroundUIFilterModifier; 2076 friend class RSForegroundUIFilterModifier; 2077 friend class RSKeyframeAnimation; 2078 friend class RSInterpolatingSpringAnimation; 2079 friend class RSImplicitCancelAnimationParam; 2080 friend class RSImplicitAnimator; 2081 friend class RSGeometryTransModifier; 2082 friend class RSExtendedModifier; 2083 friend class RSCurveAnimation; 2084 friend class RSAnimation; 2085 friend class ModifierNG::RSForegroundFilterModifier; 2086 friend class ModifierNG::RSBackgroundFilterModifier; 2087 template<typename T> 2088 friend class RSProperty; 2089 template<typename T> 2090 friend class RSAnimatableProperty; 2091 friend class RSInteractiveImplictAnimator; 2092 }; 2093 // backward compatibility 2094 using RSBaseNode = RSNode; 2095 } // namespace Rosen 2096 } // namespace OHOS 2097 2098 /** @} */ 2099 #endif // RENDER_SERVICE_CLIENT_CORE_UI_RS_NODE_H 2100