异步绘制ndk接口

Signed-off-by: lvshiqi <liuwei793@h-partners.com>
Change-Id: I454ccb8857b31df951d20579c6ca869d8e5f5fcc
This commit is contained in:
lvshiqi 2024-08-23 10:40:44 +08:00
parent 5b4b79ae17
commit f972c83054
4 changed files with 173 additions and 0 deletions

View File

@ -828,6 +828,19 @@ OH_Drawing_ErrorCode OH_Drawing_CanvasIsClipEmpty(OH_Drawing_Canvas* canvas, boo
*/
OH_Drawing_ErrorCode OH_Drawing_CanvasGetImageInfo(OH_Drawing_Canvas* canvas, OH_Drawing_Image_Info* imageInfo);
/**
* @brief Replay drawing command.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
* @param canvas Indicates the pointer to an <b>OH_Drawing_Canvas</b> object.
* @param recordCmd Indicates the pointer to an <b>OH_Drawing_RecordCmd</b> object.
* @return Returns the error code.
* Returns {@link OH_DRAWING_SUCCESS} if the operation is successful.
* Returns {@link OH_DRAWING_ERROR_INVALID_PARAMETER} if canvas or recordCmd is nullptr.
* @since 13
* @version 1.0
*/
OH_Drawing_ErrorCode OH_Drawing_Drawing_CanvasDrawRecordCmd(OH_Drawing_Canvas* canvas, OH_Drawing_RecordCmd* recordCmd);
#ifdef __cplusplus
}
#endif

View File

@ -0,0 +1,121 @@
/*
* Copyright (c) 2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef C_INCLUDE_DRAWING_RECORD_CMD_H
#define C_INCLUDE_DRAWING_RECORD_CMD_H
/**
* @addtogroup Drawing
* @{
*
* @brief Provides functions such as 2D graphics rendering, text drawing, and image display.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
*
* @since 13
* @version 1.0
*/
/**
* @file drawing_record_cmd.h
*
* @brief Declares functions related to the <b>RecordCmd</b> object in the drawing module.
*
* @library libnative_drawing.so
* @since 13
* @version 1.0
*/
#include "drawing_types.h"
#include "drawing_error_code.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Creates an <b>OH_Drawing_RecordCmdUtils</b> object.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
* @return Returns the pointer to the <b>OH_Drawing_RecordCmdUtils</b> object created.
* @since 13
* @version 1.0
*/
OH_Drawing_RecordCmdUtils* OH_Drawing_RecordCmdUtilsCreate(void);
/**
* @brief Destroys an <b>OH_Drawing_RecordCmdUtils</b> object and reclaims the memory occupied by the object.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
* @param recordCmdUtils Indicates the pointer to an <b>OH_Drawing_RecordCmdUtils</b> object.
* @return Returns the error code.
* Returns {@link OH_DRAWING_SUCCESS} if the operation is successful.
* Returns {@link OH_DRAWING_ERROR_INVALID_PARAMETER} if recordCmdUtils is nullptr.
* @since 13
* @version 1.0
*/
OH_Drawing_ErrorCode OH_Drawing_RecordCmdUtilsDestroy(OH_Drawing_RecordCmdUtils* recordCmdUtils);
/**
* @brief Get the canvas that records the drawing command.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
* @param recordCmdUtils Indicates the pointer to an <b>OH_Drawing_RecordCmdUtils</b> object.
* @param width Width of canvas object.
* @param height Height of canvas object.
* @param canvas Indicates a secondary pointer to an <b>OH_Srawing_Canvas</b>object.
* @return Returns the error code.
* Returns {@link OH_DRAWING_SUCCESS} if the operation is successful.
* Returns {@link OH_DRAWING_ERROR_INVALID_PARAMETER} if recordCmdUtils or canvas is nullptr,
* width less than or equal to 0 or height less than or equal to 0.
* @since 13
* @version 1.0
*/
OH_Drawing_ErrorCode OH_Drawing_RecordCmdUtilsBeginRecording(OH_Drawing_RecordCmdUtils* recordCmdUtils,
int32_t width, int32_t height, OH_Drawing_Canvas** canvas);
/**
* @brief Finish the recording and get the recording command object.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
* @param recordCmdUtils Indicates the pointer to an <b>OH_Drawing_RecordCmdUtils</b> object.
* @param recordCmd Indicates a secondary pointer to an <b>OH_Drawing_RecordCmd</b> object.
* @return Returns the error code.
* Returns {@link OH_DRAWING_SUCCESS} if the operation is successful.
* Returns {@link OH_DRAWING_ERROR_INVALID_PARAMETER} if recordCmdUtils or recordCmd is nullptr.
* @since 13
* @version 1.0
*/
OH_Drawing_ErrorCode OH_Drawing_RecordCmdUtilsFinishingRecording(OH_Drawing_RecordCmdUtils* recordCmdUtils,
OH_Drawing_RecordCmd** recordCmd);
/**
* @brief Destroys an <b>OH_Drawing_RecordCmd</b> object and reclaims the memory occupied by the object.
*
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
* @param recordCmd Indicates the pointer to an <b>OH_Drawing_RecordCmd</b> object.
* @return Returns the error code.
* Returns {@link OH_DRAWING_SUCCESS} if the operation is successful.
* Returns {@link OH_DRAWING_ERROR_INVALID_PARAMETER} if recordCmd is nullptr.
* @since 13
* @version 1.0
*/
OH_Drawing_ErrorCode OH_Drawing_RecordCmdDestroy(OH_Drawing_RecordCmd* recordCmd);
#ifdef __cplusplus
}
#endif
/** @} */
#endif

View File

@ -502,6 +502,21 @@ typedef struct OH_Drawing_FontMgr OH_Drawing_FontMgr;
*/
typedef struct OH_Drawing_FontStyleSet OH_Drawing_FontStyleSet;
/**
* @brief Define OH_Drawing_RecordCmdUtils, which is used to generate drawing commands tool.
*
* @since 13
* @version 1.0
*/
typedef struct OH_Drawing_RecordCmdUtils OH_Drawing_RecordCmdUtils;
/**
* @brief Define OH_Drawing_RecordCmd, which is used to replay drawing commands.
*
* @since 13
* @version 1.0
*/
typedef struct OH_Drawing_RecordCmd OH_Drawing_RecordCmd;
#ifdef __cplusplus
}
#endif

View File

@ -1441,5 +1441,29 @@
{
"first_introduced": "12",
"name":"OH_Drawing_SetTextShadow"
},
{
"first_introduced": "13",
"name":"OH_Drawing_Drawing_CanvasDrawRecordCmd"
},
{
"first_introduced": "13",
"name":"OH_Drawing_RecordCmdUtilsCreate"
},
{
"first_introduced": "13",
"name":"OH_Drawing_RecordCmdUtilsDestroy"
},
{
"first_introduced": "13",
"name":"OH_Drawing_RecordCmdUtilsBeginRecording"
},
{
"first_introduced": "13",
"name":"OH_Drawing_RecordCmdUtilsFinishingRecording"
},
{
"first_introduced": "13",
"name":"OH_Drawing_RecordCmdDestroy"
}
]