• 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);
42 #ifndef USE_ROSEN_DRAWING
43     bool GetBitmap(SkBitmap& bitmap, std::shared_ptr<DrawCmdList> drawCmdList = nullptr, const SkRect* rect = nullptr);
44     bool GetPixelmap(const std::shared_ptr<Media::PixelMap> pixelmap,
45         std::shared_ptr<DrawCmdList> drawCmdList = nullptr, const SkRect* rect = nullptr);
46 #else
47     bool GetBitmap(Drawing::Bitmap& bitmap,
48         std::shared_ptr<Drawing::DrawCmdList> drawCmdList = nullptr, const Drawing::Rect* rect = nullptr);
49 #endif
50 
51 protected:
52     RSCanvasDrawingNode(bool isRenderServiceNode);
53     RSCanvasDrawingNode(const RSCanvasDrawingNode&) = delete;
54     RSCanvasDrawingNode(const RSCanvasDrawingNode&&) = delete;
55     RSCanvasDrawingNode& operator=(const RSCanvasDrawingNode&) = delete;
56     RSCanvasDrawingNode& operator=(const RSCanvasDrawingNode&&) = delete;
57 };
58 } // namespace Rosen
59 } // namespace OHOS
60 
61 #endif // RENDER_SERVICE_CLIENT_CORE_UI_RS_CANVAS_DRAWING_NODE_H