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 #ifndef RENDER_SERVICE_CLIENT_CORE_UI_RS_CANVAS_DRAWING_NODE_H 17 #define RENDER_SERVICE_CLIENT_CORE_UI_RS_CANVAS_DRAWING_NODE_H 18 19 #include "pixel_map.h" 20 21 #include "ui/rs_canvas_node.h" 22 23 class SkCanvas; 24 25 namespace OHOS { 26 namespace Rosen { 27 class RSNodeMap; 28 29 class RSC_EXPORT RSCanvasDrawingNode : public RSCanvasNode { 30 public: 31 using WeakPtr = std::weak_ptr<RSCanvasDrawingNode>; 32 using SharedPtr = std::shared_ptr<RSCanvasDrawingNode>; 33 static inline constexpr RSUINodeType Type = RSUINodeType::CANVAS_DRAWING_NODE; 34 GetType()35 RSUINodeType GetType() const override 36 { 37 return Type; 38 } 39 40 ~RSCanvasDrawingNode() override; 41 static SharedPtr Create(bool isRenderServiceNode = false, bool isTextureExportNode = false); 42 bool GetBitmap(Drawing::Bitmap& bitmap, 43 std::shared_ptr<Drawing::DrawCmdList> drawCmdList = nullptr, const Drawing::Rect* rect = nullptr); 44 bool GetPixelmap(std::shared_ptr<Media::PixelMap> pixelmap, 45 std::shared_ptr<Drawing::DrawCmdList> drawCmdList = nullptr, const Drawing::Rect* rect = nullptr); 46 bool ResetSurface(int width, int height); 47 48 protected: 49 RSCanvasDrawingNode(bool isRenderServiceNode, bool isTextureExportNode = false); 50 RSCanvasDrawingNode(const RSCanvasDrawingNode&) = delete; 51 RSCanvasDrawingNode(const RSCanvasDrawingNode&&) = delete; 52 RSCanvasDrawingNode& operator=(const RSCanvasDrawingNode&) = delete; 53 RSCanvasDrawingNode& operator=(const RSCanvasDrawingNode&&) = delete; 54 void CreateRenderNodeForTextureExportSwitch() override; 55 }; 56 } // namespace Rosen 57 } // namespace OHOS 58 59 #endif // RENDER_SERVICE_CLIENT_CORE_UI_RS_CANVAS_DRAWING_NODE_H