1 /*
2  * Copyright (c) 2024 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 C_INCLUDE_DRAWING_RECORD_CMD_H
17 #define C_INCLUDE_DRAWING_RECORD_CMD_H
18 
19 /**
20  * @addtogroup Drawing
21  * @{
22  *
23  * @brief Provides functions such as 2D graphics rendering, text drawing, and image display.
24  *
25  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
26  *
27  * @since 13
28  * @version 1.0
29  */
30 
31 /**
32  * @file drawing_record_cmd.h
33  *
34  * @brief Declares functions related to the <b>RecordCmd</b> object in the drawing module.
35  *
36  * @library libnative_drawing.so
37  * @since 13
38  * @version 1.0
39  */
40 
41 #include "drawing_types.h"
42 #include "drawing_error_code.h"
43 
44 #ifdef __cplusplus
45 extern "C" {
46 #endif
47 
48 /**
49  * @brief Creates an <b>OH_Drawing_RecordCmdUtils</b> object.
50  *
51  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
52  * @return Returns the pointer to the <b>OH_Drawing_RecordCmdUtils</b> object created.
53  * @since 13
54  * @version 1.0
55  */
56 OH_Drawing_RecordCmdUtils* OH_Drawing_RecordCmdUtilsCreate(void);
57 
58 /**
59  * @brief Destroys an <b>OH_Drawing_RecordCmdUtils</b> object and reclaims the memory occupied by the object.
60  *
61  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
62  * @param recordCmdUtils Indicates the pointer to an <b>OH_Drawing_RecordCmdUtils</b> object.
63  * @return Returns the error code.
64  *         Returns {@link OH_DRAWING_SUCCESS} if the operation is successful.
65  *         Returns {@link OH_DRAWING_ERROR_INVALID_PARAMETER} if recordCmdUtils is nullptr.
66  * @since 13
67  * @version 1.0
68  */
69 OH_Drawing_ErrorCode OH_Drawing_RecordCmdUtilsDestroy(OH_Drawing_RecordCmdUtils* recordCmdUtils);
70 
71 /**
72  * @brief Get the canvas that records the drawing command.
73  *
74  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
75  * @param recordCmdUtils Indicates the pointer to an <b>OH_Drawing_RecordCmdUtils</b> object.
76  * @param width Width of canvas object.
77  * @param height Height of canvas object.
78  * @param canvas Indicates a secondary pointer to an <b>OH_Drawing_Canvas</b>object.
79  * @return Returns the error code.
80  *         Returns {@link OH_DRAWING_SUCCESS} if the operation is successful.
81  *         Returns {@link OH_DRAWING_ERROR_INVALID_PARAMETER} if recordCmdUtils or canvas is nullptr,
82  *         width less than or equal to 0 or height less than or equal to 0.
83  *         Returns {@link OH_DRAWING_ERROR_ALLOCATION_FAILED} if no memory.
84  * @since 13
85  * @version 1.0
86  */
87 OH_Drawing_ErrorCode OH_Drawing_RecordCmdUtilsBeginRecording(OH_Drawing_RecordCmdUtils* recordCmdUtils,
88     int32_t width, int32_t height, OH_Drawing_Canvas** canvas);
89 
90 /**
91  * @brief Finish the recording and get the recording command object.
92  *
93  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
94  * @param recordCmdUtils Indicates the pointer to an <b>OH_Drawing_RecordCmdUtils</b> object.
95  * @param recordCmd Indicates a secondary pointer to an <b>OH_Drawing_RecordCmd</b> object.
96  * @return Returns the error code.
97  *         Returns {@link OH_DRAWING_SUCCESS} if the operation is successful.
98  *         Returns {@link OH_DRAWING_ERROR_INVALID_PARAMETER} if recordCmdUtils or recordCmd is nullptr.
99  *         Returns {@link OH_DRAWING_ERROR_ALLOCATION_FAILED} if no memory.
100  * @since 13
101  * @version 1.0
102  */
103 OH_Drawing_ErrorCode OH_Drawing_RecordCmdUtilsFinishRecording(OH_Drawing_RecordCmdUtils* recordCmdUtils,
104     OH_Drawing_RecordCmd** recordCmd);
105 
106 /**
107  * @brief Destroys an <b>OH_Drawing_RecordCmd</b> object and reclaims the memory occupied by the object.
108  *
109  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
110  * @param recordCmd Indicates the pointer to an <b>OH_Drawing_RecordCmd</b> object.
111  * @return Returns the error code.
112  *         Returns {@link OH_DRAWING_SUCCESS} if the operation is successful.
113  *         Returns {@link OH_DRAWING_ERROR_INVALID_PARAMETER} if recordCmd is nullptr.
114  * @since 13
115  * @version 1.0
116  */
117 OH_Drawing_ErrorCode OH_Drawing_RecordCmdDestroy(OH_Drawing_RecordCmd* recordCmd);
118 
119 #ifdef __cplusplus
120 }
121 #endif
122 /** @} */
123 #endif