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