• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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         std::shared_ptr<RSUIContext> rsUIContext = nullptr);
43     bool GetBitmap(Drawing::Bitmap& bitmap,
44         std::shared_ptr<Drawing::DrawCmdList> drawCmdList = nullptr, const Drawing::Rect* rect = nullptr);
45     bool GetPixelmap(std::shared_ptr<Media::PixelMap> pixelmap,
46         std::shared_ptr<Drawing::DrawCmdList> drawCmdList = nullptr, const Drawing::Rect* rect = nullptr);
47     bool ResetSurface(int width, int height);
48 
49 protected:
50     RSCanvasDrawingNode(
51         bool isRenderServiceNode, bool isTextureExportNode = false, std::shared_ptr<RSUIContext> rsUIContext = nullptr);
52     RSCanvasDrawingNode(const RSCanvasDrawingNode&) = delete;
53     RSCanvasDrawingNode(const RSCanvasDrawingNode&&) = delete;
54     RSCanvasDrawingNode& operator=(const RSCanvasDrawingNode&) = delete;
55     RSCanvasDrawingNode& operator=(const RSCanvasDrawingNode&&) = delete;
56     void CreateRenderNodeForTextureExportSwitch() override;
57 private:
58     void RegisterNodeMap() override;
59 };
60 } // namespace Rosen
61 } // namespace OHOS
62 
63 #endif // RENDER_SERVICE_CLIENT_CORE_UI_RS_CANVAS_DRAWING_NODE_H