1 /* 2 * Copyright (c) 2023 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 11 25 * @version 1.0 26 */ 27 28 /** 29 * @file drawing_point.h 30 * 31 * @brief Declares functions related to the <b>point</b> object in the drawing module. 32 * 33 * @kit ArkGraphics2D 34 * @library libnative_drawing.so 35 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 36 * @since 11 37 * @version 1.0 38 */ 39 40 #ifndef C_INCLUDE_DRAWING_POINT_H 41 #define C_INCLUDE_DRAWING_POINT_H 42 43 #include "drawing_error_code.h" 44 #include "drawing_types.h" 45 46 #ifdef __cplusplus 47 extern "C" { 48 #endif 49 50 /** 51 * @brief Creates an <b>OH_Drawing_Point</b> object. 52 * 53 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 54 * @param x Indicates the x-axis coordinates of the point. 55 * @param y Indicates the y-axis coordinates of the point. 56 * @return Returns the pointer to the <b>OH_Drawing_Point</b> object created. 57 * @since 11 58 * @version 1.0 59 */ 60 OH_Drawing_Point* OH_Drawing_PointCreate(float x, float y); 61 62 /** 63 * @brief Gets the x-axis coordinate of the point. 64 * 65 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 66 * @param point Indicates the pointer to an <b>OH_Drawing_Point</b> object. 67 * @param x Indicates the x-axis coordinate of the point. 68 * @return Returns the error code. 69 * Returns {@link OH_DRAWING_SUCCESS} if the operation is successful. 70 * Returns {@link OH_DRAWING_ERROR_INVALID_PARAMETER} if point or x is nullptr. 71 * @since 12 72 * @version 1.0 73 */ 74 OH_Drawing_ErrorCode OH_Drawing_PointGetX(const OH_Drawing_Point* point, float* x); 75 76 /** 77 * @brief Gets the y-axis coordinate of the point. 78 * 79 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 80 * @param point Indicates the pointer to an <b>OH_Drawing_Point</b> object. 81 * @param y Indicates the y-axis coordinate of the point. 82 * @return Returns the error code. 83 * Returns {@link OH_DRAWING_SUCCESS} if the operation is successful. 84 * Returns {@link OH_DRAWING_ERROR_INVALID_PARAMETER} if point or y is nullptr. 85 * @since 12 86 * @version 1.0 87 */ 88 OH_Drawing_ErrorCode OH_Drawing_PointGetY(const OH_Drawing_Point* point, float* y); 89 90 /** 91 * @brief Sets the x-axis and y-axis coordinates of the point. 92 * 93 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 94 * @param point Indicates the pointer to an <b>OH_Drawing_Point</b> object. 95 * @param x Indicates the x-axis coordinate of the point. 96 * @param y Indicates the y-axis coordinate of the point. 97 * @return Returns the error code. 98 * Returns {@link OH_DRAWING_SUCCESS} if the operation is successful. 99 * Returns {@link OH_DRAWING_ERROR_INVALID_PARAMETER} if point is nullptr. 100 * @since 12 101 * @version 1.0 102 */ 103 OH_Drawing_ErrorCode OH_Drawing_PointSet(OH_Drawing_Point* point, float x, float y); 104 105 /** 106 * @brief Destroys an <b>OH_Drawing_Point</b> object and reclaims the memory occupied by the object. 107 * 108 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 109 * @param point Indicates the pointer to an <b>OH_Drawing_Point</b> object. 110 * @since 11 111 * @version 1.0 112 */ 113 void OH_Drawing_PointDestroy(OH_Drawing_Point* point); 114 115 #ifdef __cplusplus 116 } 117 #endif 118 /** @} */ 119 #endif 120