From 82c2d8d62d1bc8b71d3daf969cf1639fd8075c12 Mon Sep 17 00:00:00 2001 From: lvshiqi Date: Tue, 12 Nov 2024 11:54:21 +0800 Subject: [PATCH 1/2] =?UTF-8?q?point=20=E6=96=B0=E5=A2=9E=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: lvshiqi Change-Id: Iafbd7bbc5859dd45eac1c7a8fe50038c2026a474 --- .../graphic_2d/native_drawing/drawing_point.h | 61 ++++++++++++++++++- .../native_drawing/libnative_drawing.ndk.json | 16 +++++ 2 files changed, 76 insertions(+), 1 deletion(-) diff --git a/graphic/graphic_2d/native_drawing/drawing_point.h b/graphic/graphic_2d/native_drawing/drawing_point.h index 47756fb65..6ba5b4b34 100644 --- a/graphic/graphic_2d/native_drawing/drawing_point.h +++ b/graphic/graphic_2d/native_drawing/drawing_point.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Huawei Device Co., Ltd. + * 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 @@ -102,6 +102,65 @@ OH_Drawing_ErrorCode OH_Drawing_PointGetY(const OH_Drawing_Point* point, float* */ OH_Drawing_ErrorCode OH_Drawing_PointSet(OH_Drawing_Point* point, float x, float y); +/** + * @brief Indicates whether firstPoint are equal to secondPoint. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param firstPoint Indicates the pointer to an OH_Drawing_Point object. + * @param secondPoint Indicates the pointer to an OH_Drawing_Point object. + * @param isEqual Indicates whether firstPoint and secondPoint are equal. + * @return Returns the error code. + * Returns {@link OH_DRAWING_SUCCESS} if the operation is successful. + * Returns {@link OH_DRAWING_ERROR_INVALID_PARAMETER} if firstPoint or secondPoint is nullptr, + * or isEqual is nullptr. + * @since 14 + * @version 1.0 + */ +OH_Drawing_ErrorCode OH_Drawing_PointEquals( + const OH_Drawing_Point *firstPoint, const OH_Drawing_Point *secondPoint, bool *isEqual); + +/** + * @brief Offset the coordinates of the point. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param point Indicates the pointer to an OH_Drawing_Point object. + * @param x Indicates the x offset of the point. + * @param y Indicates the y offset of the point. + * @return Returns the error code. + * Returns {@link OH_DRAWING_SUCCESS} if the operation is successful. + * Returns {@link OH_DRAWING_ERROR_INVALID_PARAMETER} if point is nullptr. + * @since 14 + * @version 1.0 + */ +OH_Drawing_ErrorCode OH_Drawing_PointOffset(OH_Drawing_Point* point, float x, float y); + +/** + * @brief Returns the euclidean distance from (0,0) to (x,y). + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param point Indicates the pointer to an OH_Drawing_Point object. + * @param len Indicates euclidean distance of the point. + * @return Returns the error code. + * Returns {@link OH_DRAWING_SUCCESS} if the operation is successful. + * Returns {@link OH_DRAWING_ERROR_INVALID_PARAMETER} if point or len is nullptr. + * @since 14 + * @version 1.0 + */ +OH_Drawing_ErrorCode OH_Drawing_PointLength(const OH_Drawing_Point* point, float* len); + +/** + * @brief Reverse the coordinates of a point. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param point Indicates the pointer to an OH_Drawing_Point object. + * @return Returns the error code. + * Returns {@link OH_DRAWING_SUCCESS} if the operation is successful. + * Returns {@link OH_DRAWING_ERROR_INVALID_PARAMETER} if point is nullptr. + * @since 14 + * @version 1.0 + */ +OH_Drawing_ErrorCode OH_Drawing_PointNegate(OH_Drawing_Point* point); + /** * @brief Destroys an OH_Drawing_Point object and reclaims the memory occupied by the object. * diff --git a/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json b/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json index 353ce3f53..dc953afd5 100644 --- a/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json +++ b/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json @@ -532,6 +532,22 @@ "first_introduced": "12", "name": "OH_Drawing_PointSet" }, + { + "first_introduced": "14", + "name": "OH_Drawing_PointEquals" + }, + { + "first_introduced": "14", + "name": "OH_Drawing_PointOffset" + }, + { + "first_introduced": "14", + "name": "OH_Drawing_PointLength" + }, + { + "first_introduced": "14", + "name": "OH_Drawing_PointNegate" + }, { "name": "OH_Drawing_ColorSetArgb" }, { "first_introduced": "12", -- Gitee From ff3a411cce23ad3f8a47b9296f4b90b6f26fe3d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E4=BC=9F?= Date: Tue, 12 Nov 2024 06:05:00 +0000 Subject: [PATCH 2/2] update graphic/graphic_2d/native_drawing/drawing_point.h. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 刘伟 --- graphic/graphic_2d/native_drawing/drawing_point.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/graphic/graphic_2d/native_drawing/drawing_point.h b/graphic/graphic_2d/native_drawing/drawing_point.h index 6ba5b4b34..d047ac41d 100644 --- a/graphic/graphic_2d/native_drawing/drawing_point.h +++ b/graphic/graphic_2d/native_drawing/drawing_point.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Huawei Device Co., Ltd. + * Copyright (c) 2023-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 -- Gitee