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 16 /** 17 * @addtogroup RenderNodeDisplay 18 * @{ 19 * 20 * @brief Display render nodes. 21 */ 22 23 /** 24 * @file rs_effect_node.h 25 * 26 * @brief Defines the properties and methods for RSDEffectNode class. 27 */ 28 29 #ifndef RENDER_SERVICE_CLIENT_CORE_UI_RS_EFFECT_NODE_H 30 #define RENDER_SERVICE_CLIENT_CORE_UI_RS_EFFECT_NODE_H 31 32 #include "ui/rs_node.h" 33 34 namespace OHOS { 35 namespace Rosen { 36 37 /** 38 * @class RSEffectNode 39 * 40 * @brief Represents a effect node in the rendering service. 41 */ 42 class RSC_EXPORT RSEffectNode : public RSNode { 43 public: 44 using WeakPtr = std::weak_ptr<RSEffectNode>; 45 using SharedPtr = std::shared_ptr<RSEffectNode>; 46 static inline constexpr RSUINodeType Type = RSUINodeType::EFFECT_NODE; 47 48 /** 49 * @brief Get the type of the RSNode. 50 * 51 * @return The type of the RSNode. 52 */ GetType()53 RSUINodeType GetType() const override 54 { 55 return Type; 56 } 57 58 /** 59 * @brief Destructor for RSEffectNode. 60 */ 61 ~RSEffectNode() override = default; 62 63 /** 64 * @brief Creates a shared pointer to an RSEffectNode. 65 * 66 * @param isRenderServiceNode Indicates whether the node is a render service node. Defaults to false. 67 * @param isTextureExportNode Indicates whether the node is a texture export node. Defaults to false. 68 * @param rsUIContext A shared pointer to an RSUIContext object. Defaults to nullptr. 69 * @return A shared pointer to the created RS effect node. 70 */ 71 static SharedPtr Create(bool isRenderServiceNode = false, bool isTextureExportNode = false, 72 std::shared_ptr<RSUIContext> rsUIContext = nullptr); 73 74 /** 75 * @brief Sets the freeze state of the node. 76 * 77 * The property is valid only for CanvasNode and SurfaceNode in uniRender. 78 * 79 * @param isFreeze If true, the node will be frozen; if false, the node will be unfrozen. 80 */ 81 void SetFreeze(bool isFreeze) override; 82 83 protected: 84 RSEffectNode( 85 bool isRenderServiceNode, bool isTextureExportNode = false, std::shared_ptr<RSUIContext> rsUIContext = nullptr); 86 RSEffectNode(const RSEffectNode&) = delete; 87 RSEffectNode(const RSEffectNode&&) = delete; 88 RSEffectNode& operator=(const RSEffectNode&) = delete; 89 RSEffectNode& operator=(const RSEffectNode&&) = delete; 90 private: 91 /** 92 * @brief Registers the node in the node map. 93 */ 94 void RegisterNodeMap() override; 95 bool preFreeze_ = false; 96 }; 97 } // namespace Rosen 98 } // namespace OHOS 99 100 /** @} */ 101 #endif // RENDER_SERVICE_CLIENT_CORE_UI_RS_EFFECT_NODE_H 102