From 0c9efcdbbad68abae4da1db0a653734ea32c2902 Mon Sep 17 00:00:00 2001 From: lvshiqi Date: Fri, 8 Nov 2024 17:08:38 +0800 Subject: [PATCH] =?UTF-8?q?drawing=E9=83=A8=E5=88=86ndk=E6=8E=A5=E5=8F=A3c?= =?UTF-8?q?=E5=A4=B4=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: lvshiqi Change-Id: Id393712465c14ed8d7a8c5325aabae8e6edb77f8 --- .../native_drawing/drawing_canvas.h | 48 +++++++++++++++++++ .../graphic_2d/native_drawing/drawing_rect.h | 17 +++++++ .../native_drawing/libnative_drawing.ndk.json | 16 +++++++ 3 files changed, 81 insertions(+) diff --git a/graphic/graphic_2d/native_drawing/drawing_canvas.h b/graphic/graphic_2d/native_drawing/drawing_canvas.h index f78e6127f..0e24a1c7a 100644 --- a/graphic/graphic_2d/native_drawing/drawing_canvas.h +++ b/graphic/graphic_2d/native_drawing/drawing_canvas.h @@ -841,6 +841,54 @@ OH_Drawing_ErrorCode OH_Drawing_CanvasGetImageInfo(OH_Drawing_Canvas* canvas, OH * @version 1.0 */ OH_Drawing_ErrorCode OH_Drawing_CanvasDrawRecordCmd(OH_Drawing_Canvas* canvas, OH_Drawing_RecordCmd* recordCmd); + +/** + * @brief Checks whether the canavs is support alpha. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param canvas Indicates the pointer to an OH_Drawing_Canvas object. + * @param isOpaque Indicates if canvas is support alpha. + * @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 isOpaque is nullptr. + * @since 14 + * @version 1.0 + */ +OH_Drawing_ErrorCode OH_Drawing_CanvasIsOpaque(OH_Drawing_Canvas* canvas, bool* isOpaque); + +/** + * @brief Checks if the path has been cut off. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param canvas Indicates the pointer to an OH_Drawing_Canvas object. + * @param path Indicates the pointer to an OH_Drawing_Paht object. + * @param quickReject Indicates if the path has been cut off. + * @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 path is nullptr, + * or quickReject is nullptr. + * @since 14 + * @version 1.0 + */ +OH_Drawing_ErrorCode OH_Drawing_CanvasQuickRejectByPath(OH_Drawing_Canvas* canvas, const OH_Drawing_Path* path, + bool* quickReject); + +/** + * @brief Checks if the rect has been cut off. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param canvas Indicates the pointer to an OH_Drawing_Canvas object. + * @param rect Indicates the pointer to an OH_Drawing_Rect object. + * @param quickReject Indicates if the rect has been cut off. + * @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 rect is nullptr, + * or quickReject is nullptr. + * @since 14 + * @version 1.0 + */ +OH_Drawing_ErrorCode OH_Drawing_CanvasQuickRejectByRect(OH_Drawing_Canvas* canvas, const OH_Drawing_Rect* rect, + bool* quickReject); #ifdef __cplusplus } #endif diff --git a/graphic/graphic_2d/native_drawing/drawing_rect.h b/graphic/graphic_2d/native_drawing/drawing_rect.h index d247e88f7..fcbedcc22 100644 --- a/graphic/graphic_2d/native_drawing/drawing_rect.h +++ b/graphic/graphic_2d/native_drawing/drawing_rect.h @@ -40,6 +40,7 @@ * @version 1.0 */ +#include "drawing_error_code.h" #include "drawing_types.h" #ifdef __cplusplus @@ -272,6 +273,22 @@ OH_Drawing_ErrorCode OH_Drawing_RectGetArrayElement(OH_Drawing_Array* rectArray, */ OH_Drawing_ErrorCode OH_Drawing_RectDestroyArray(OH_Drawing_Array* rectArray); +/** + * @brief Equals the original rectangular object to the destination rectangular object. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param src Indicates the pointer to an OH_Drawing_Rect object. + * @param dst Indicates the pointer to an OH_Drawing_Rect object. + * @param rectEquals Indicates if other object is rect object. + * @return Returns the error code. + * Returns {@link OH_DRAWING_SUCCESS} if the operation is successful. + * Returns {@link OH_DRAWING_ERROR_INVALID_PARAMETER} if src or dst is nullptr, + * or rectEquals is nullptr. + * @since 14 + * @version 1.0 + */ +OH_Drawing_ErrorCode OH_Drawing_RectEquals(OH_Drawing_Rect* src, OH_Drawing_Rect* dst, bool* rectEquals); + #ifdef __cplusplus } #endif diff --git a/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json b/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json index 353ce3f53..ae310a0e9 100644 --- a/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json +++ b/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json @@ -1721,5 +1721,21 @@ { "first_introduced": "14", "name":"OH_Drawing_GetRunGlyphCount" + }, + { + "first_introduced": "14", + "name":"OH_Drawing_CanvasIsOpaque" + }, + { + "first_introduced": "14", + "name":"OH_Drawing_CanvasQuickRejectByPath" + }, + { + "first_introduced": "14", + "name":"OH_Drawing_CanvasQuickRejectByRect" + }, + { + "first_introduced": "14", + "name":"OH_Drawing_RectEquals" } ] \ No newline at end of file -- Gitee