• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 HiSilicon (Shanghai) Technologies CO., LIMITED.
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 #ifndef _HI_GO_CURSOR_H
16 #define _HI_GO_CURSOR_H
17 
18 #include "hi_go_comm.h"
19 #include "hi_go_gdev.h"
20 
21 #ifdef __cplusplus
22 #if __cplusplus
23 extern "C" {
24 #endif /* __cplusplus */
25 #endif /* __cplusplus */
26 
27 typedef struct {
28     HI_HANDLE hCursor; /*
29                         * The maximum resolution is 128x128, and the minimum resolution is 16x16 for the cursor
30                         * picture. Both pixel alpha and colorkey are supported.
31                         *
32                         */
33     HI_U32 HotspotX;   /*
34                         * Horizontal coordinate of the cursor hot spot relative to the cursor picture,
35                         *
36                         */
37     HI_U32 HotspotY;  /*
38                        * Vertical coordinate of the cursor+ hot spot relative to the cursor picture,
39                        *
40                        */
41 } HIGO_CURSOR_INFO_S;
42 
43 /* Status of the cursor layer */
44 typedef struct {
45     HI_BOOL bShow; /* Whether to display the cursor layer. */
46 } HIGO_CURSOR_STATUS_S;
47 
48 /*
49  * \brief Initializes the cursor module.
50  * \attention \n
51  * \param N/A.
52  * \retval ::HI_SUCCESS Success.
53  * \retval ::HI_FAILURE The display fails.
54  * \retval ::HIGO_ERR_INITFAILED
55  * \retval ::HIGO_ERR_DEPEND_CURSOR
56  * \see \n
57  * ::HI_GO_DeinitCursor
58  */
59 HI_S32 HI_GO_InitCursor(void);
60 
61 /*
62  * \brief Deinitializes the cursor module.
63  * \attention \n
64  * \param N/A.
65  * \retval ::HI_SUCCESS Success.
66  * \retval ::HI_FAILURE The display fails.
67  * \retval ::HIGO_ERR_NOTINIT
68  * \see \n
69  * ::HI_GO_InitCursor
70  */
71 HI_S32 HI_GO_DeinitCursor(void);
72 
73 /*
74  * \brief  Displays the cursor layer.
75  * \attention \n
76  * 1. The cursor of the output layer is located in the middle of the screen by default.
77  * ĹλĬĻм CNend
78  * 2. You need set the cursor information before the cursor layer is
79  * displayed.
80  * status of the cursor
81  * layer. HI_TRUE: visible; HI_FASLE: invisible.
82  * HI_TRUE:ɼ HI_FASLE:㲻ɼCNend
83  * \retval ::HI_SUCCESS Success.
84  * \retval ::HI_FAILURE The display fails.
85  * \retval ::HIGO_ERR_NOTINIT
86  * \retval ::HIGO_ERR_NOCURSORINF
87  * \retval ::HIGO_ERR_DEPEND_CURSOR
88  * \see \n
89  * ::HI_GO_GetCursorStatus
90  * ::HI_GO_SetCursorInfo
91  */
92 HI_S32 HI_GO_ShowCursor(HI_BOOL bVisible);
93 
94 /*
95  * \brief Obtains the current status of the cursor layer.
96  * \attention \n
97  * N/A.
98  * \param[out] pCursorStatus Pointer to the current status of the cursor layer. The value cannot be
99  * empty.
100  * \retval ::HI_SUCCESS
101  * \retval ::HIGO_ERR_NOTINIT
102  * \retval ::HIGO_ERR_NULLPTR
103  * \retval ::HIGO_ERR_INVHANDLE
104  * \retval ::HIGO_ERR_DEPEND_CURSOR
105  * \see \n
106  * ::HI_GO_ShowLayer
107  */
108 HI_S32 HI_GO_GetCursorStatus(HIGO_CURSOR_STATUS_S *pCursorStatus);
109 
110 /*
111  * \brief Moves the cursor to a specified position on a specified screen.
112  * \attention \n
113  * The cursor position can be changed only when the cursor status is
114  * show.
115  * \param[in] x Horizontal coordinate (in pixel) of the cursor on the screen relative to the canvas surface of a
116  * graphics layer.
117  * \param[in] y Vertical coordinate (in pixel) of the cursor on the screen relative to the canvas surface of a graphics
118  * layer.
119  * \retval ::HIGO_ERR_NOTINIT
120  * \retval ::HI_SUCCESS Success.
121  * \retval ::HI_FAILURE The display fails.
122  * \retval ::HIGO_ERR_DEPEND_CURSOR
123  * \see \n
124  */
125 HI_S32 HI_GO_SetCursorPos(HI_S32 x, HI_S32 y);
126 
127 /*
128  * \brief Obtains the coordinates of the cursor on the screen.
129  * \attention \n
130  * N/A.
131  * \param[out] pX Horizontal coordinate (in pixel) of the cursor on the screen.
132  * \param[out] pY Vertical coordinate (in pixel) of the cursor on the screen.
133  * \retval ::HI_SUCCESS Success.
134  * \retval ::HI_FAILURE The display fails.
135  * \retval ::HIGO_ERR_NOTINIT
136  * \retval ::HIGO_ERR_NULLPTR
137  * \retval ::HIGO_ERR_DEPEND_CURSOR
138  * \see \n
139  */
140 HI_S32 HI_GO_GetCursorPos(HI_S32 *pX, HI_S32 *pY);
141 
142 /*
143  * \brief Sets the hot spot of the displayed cursor picture.
144  * \attention \n
145  * The minimum resolution is 16x16, and the maximum resolution is 128x128 for the cursor picture. Both colorkey and
146  * alpha are supported.
147  * \param[in] pCursorInfo Information about the cursor picture and coordinates of the hot
148  * spot.
149  * \retval ::HI_SUCCESS Success.
150  * \retval ::HI_FAILURE The display fails.
151  * \retval ::HIGO_ERR_NOTINIT
152  * \retval ::HIGO_ERR_NULLPTR
153  * \retval ::HIGO_ERR_INVPARAM
154  * \retval ::HIGO_ERR_INVHANDLE
155  * \retval ::HIGO_ERR_INVSURFACESIZE
156  * \retval ::HIGO_ERR_INVPIXELFMT
157  * \retval ::HIGO_ERR_INVHOTSPOT
158  * \retval ::HIGO_ERR_DEPEND_CURSOR
159  * \see \n
160  */
161 HI_S32 HI_GO_SetCursorInfo(const HIGO_CURSOR_INFO_S *pCursorInfo);
162 
163 /*
164  * \brief Obtains the information about the displayed cursor picture.
165  * \attention \n
166  * \param[in] pCursorInfo Information about the cursor picture and coordinates of the hot
167  * spot.
168  * \retval ::HI_SUCCESS Success.
169  * \retval ::HI_FAILURE The display fails.
170  * \retval ::HIGO_ERR_NOTINIT
171  * \retval ::HIGO_ERR_NULLPTR
172  * \retval ::HIGO_ERR_DEPEND_CURSOR
173  * \see \n
174  */
175 HI_S32 HI_GO_GetCursorInfo(HIGO_CURSOR_INFO_S *pCursorInfo);
176 
177 /*
178  * \brief Attaches the cursor to one or more graphics layers.
179  *
180  * CNend \attention \n The graphics layers to which the cursor is attached must be
181  * opened.
182  * \retval ::HI_SUCCESS Layer ID.
183  * \retval ::HI_FAILURE Success.
184  * \retval ::HIGO_ERR_NOTINIT
185  * \retval ::HIGO_ERR_INVLAYERID
186  * \retval ::HIGO_ERR_NOTOPEN
187  * \retval ::HIGO_ERR_DEPEND_CURSOR
188  * \see \n
189  */
190 HI_S32 HI_GO_AttchCursorToLayer(HI_HANDLE hLayer);
191 
192 /*
193  * \brief Detaches the cursor from graphics layers.
194  * \attention \n
195  * \param[in] hLayer Layer ID.
196  * \retval ::HI_SUCCESS Success.
197  * \retval ::HI_FAILURE The display fails.
198  * \retval ::HIGO_ERR_INVLAYERID
199  * \retval ::HIGO_ERR_DEPEND_CURSOR
200  * \see \n
201  */
202 HI_S32 HI_GO_DetachCursorFromLayer(HI_HANDLE hLayer);
203 
204 #ifdef __cplusplus
205 #if __cplusplus
206 }
207 #endif /* __cplusplus */
208 #endif /* __cplusplus */
209 
210 #endif
211