• 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 /**
17  * @addtogroup RenderNodeDisplay
18  * @{
19  *
20  * @brief Display render nodes.
21  */
22 
23 /**
24  * @file rs_texture_export.h
25  *
26  * @brief Defines the properties and methods for RSTextureExport class.
27  */
28 
29 #ifndef RENDER_SERVICE_CLIENT_CORE_UI_RS_TEXTURE_EXPORT_H
30 #define RENDER_SERVICE_CLIENT_CORE_UI_RS_TEXTURE_EXPORT_H
31 
32 #include "ui/rs_ui_director.h"
33 #include "ui/rs_node.h"
34 
35 namespace OHOS {
36 namespace Rosen {
37 
38 /**
39  * @class RSTextureExport
40  *
41  * @brief The class for exporting textures from a render service node.
42  */
43 class RSC_EXPORT RSTextureExport {
44 public:
45     /**
46      * @brief Constructor for RSTextureExport.
47      *
48      * @param rootNode The root node of the texture export.
49      * @param surfaceId The ID of the surface to be exported.
50      */
51     RSTextureExport(std::shared_ptr<RSNode> rootNode, SurfaceId surfaceId);
52 
53     /**
54      * @brief Destructor for RSTextureExport.
55      */
56     ~RSTextureExport();
57 
58     /**
59      * @brief Performs the texture export operation.
60      *
61      * @return true if the texture export is successful; otherwise, false.
62      */
63     bool DoTextureExport();
64 
65     /**
66      * @brief Stops the texture export operation.
67      */
68     void StopTextureExport();
69 
70     /**
71      * @brief Updates the buffer information for texture export.
72      *
73      * @param x The x-coordinate of the buffer.
74      * @param y The y-coordinate of the buffer.
75      * @param width The width of the buffer.
76      * @param height The height of the buffer.
77      */
78     void UpdateBufferInfo(float x, float y, float width, float height);
79 private:
80     std::shared_ptr<RSUIDirector> rsUiDirector_;
81     std::shared_ptr<RSNode> rootNode_;
82     SurfaceId surfaceId_;
83     std::shared_ptr<RSSurfaceNode> virtualSurfaceNode_;
84     std::shared_ptr<RSNode> virtualRootNode_;
85 };
86 } // namespace Rosen
87 } // namespace OHOS
88 
89 /** @} */
90 #endif // RENDER_SERVICE_CLIENT_CORE_UI_RS_TEXTURE_EXPORT_H
91