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