diff --git a/graphic/graphic_2d/native_drawing/drawing_point.h b/graphic/graphic_2d/native_drawing/drawing_point.h index 47756fb6537b3deedb9da34b59b62d94389bc291..d047ac41de43a52c0f72f9f49c5f10cc7fc0b2f0 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) 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 @@ -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 353ce3f539771d30cdac90947de31c81c38d3c4d..dc953afd5a896f9c3c086750850bb9914d1c2bd3 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",