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 16 #ifndef HI_GV_CURSOR_H 17 #define HI_GV_CURSOR_H 18 19 #include "hi_type.h" 20 #include "hi_gv_conf.h" 21 #include "hi_gv_widget.h" 22 23 #ifdef HIGV_USE_MODULE_CURSOR 24 25 #ifdef __cplusplus 26 extern "C" { 27 #endif 28 29 #define IMAGE_MAX_SIZE 64 30 #define IMAGE_MIN_SIZE 16 31 32 /* Cursor */ 33 typedef struct { 34 HIGV_HANDLE imageHandle; /* The max size of cursor bitmap is 64x64, and small size is 16x16 */ 35 HI_U32 hotspotX; /* The x of cursor hotspot, */ 36 HI_U32 hotspotY; /* The y of cursor hotspot , */ 37 } HigvCursorInfo; 38 39 typedef enum { 40 HIGV_CURSOR_HW = 0x1, 41 HIGV_CURSOR_SW, 42 HIGV_CURSOR_BUTT 43 } HigvCursorType; 44 45 /* 46 * brief Cursor init. 47 * param[in] type type of cursor. 48 * retval ::HI_SUCCESS 49 * see 50 */ 51 HI_S32 HI_GV_CURSOR_Init(HigvCursorType cursorType); 52 53 /* 54 * brief Cursor init. 55 * param N/A. 56 * retval ::HI_SUCCESS 57 * see 58 */ 59 HI_S32 HI_GV_CURSOR_DeInit(HI_VOID); 60 61 /* 62 * brief Show cursor. 63 * retval ::HI_SUCCESS 64 * retval ::HI_FAILURE 65 */ 66 HI_S32 HI_GV_CURSOR_Show(HI_VOID); 67 68 /* 69 * brief Hide cursor. 70 * attention:If you hide cursor, it will not respond the mouse event. 71 * 72 * param N/A. 73 * retval ::HI_SUCCESS 74 * retval ::HI_FAILURE 75 */ 76 HI_S32 HI_GV_CURSOR_Hide(HI_VOID); 77 78 /* 79 * brief Set map scale of cursor.ӳ 80 * ӳͼ1024*768 720*576Scale_X = 720/1024, Scale_Y = 576/768 81 */ 82 HI_S32 HI_GV_CURSOR_SetMapScale(HI_FLOAT scaleX, HI_FLOAT scaleY); 83 84 /* 85 * brief Set the threshold of cursor. 86 * The threshold is should generate and equal 3, default is 4. 87 * 88 * param[in] threshold of cursor. 89 * retval ::HI_SUCCESS 90 * retval ::HI_FAILURE 91 * see 92 */ 93 HI_S32 HI_GV_CURSOR_SetThreshold(HI_U16 threshold); 94 95 /* 96 * brief Set the aceleration of cursor. 97 * The accelation parameter is should generate 0, default is 4. 98 * 99 * param[in] acceleration Acceleration of cursor. 100 * retval ::HI_SUCCESS 101 * retval ::HI_FAILURE 102 * see 103 */ 104 HI_S32 HI_GV_CURSOR_SetAcceleration(HI_U16 acceleration); 105 106 /* 107 * brief Move the cursor to the position of screen. 108 * param[in] screenPosX x coordinate of screen(unit:pixel). 109 * param[in] screenPosY y coordinate of screen(unit:pixel). 110 * retval ::HI_SUCCESS 111 * retval ::HI_FAILURE 112 */ 113 HI_S32 HI_GV_CURSOR_SetScreenPos(HIGV_CORD screenPosX, HIGV_CORD screenPosY); 114 115 /* 116 * brief Get the coordinate of cursor. 117 * param[out] screenPosX x coordinate of screen(unit:pixel) 118 * param[out] screenPosY y coordinate of screen(unit:pixel) 119 * retval ::HI_SUCCESS 120 * retval ::HI_FAILURE 121 */ 122 HI_S32 HI_GV_CURSOR_GetScreenPos(HIGV_CORD *screenPosX, HIGV_CORD *screenPosY); 123 124 /* 125 * brief Set hotspot of cursor. 126 * 127 * param[in] cursorInfo ͼƬȵϢ 128 * retval ::HI_SUCCESS 129 * retval ::HI_FAILURE 130 */ 131 HI_S32 HI_GV_CURSOR_SetImage(const HigvCursorInfo *cursorInfo); 132 133 /* 134 * brief Get the picture information of cursor. 135 * param[out] cursorInfo Cursor picture information. 136 * retval ::HI_SUCCESS 137 * retval ::HI_FAILURE 138 */ 139 HI_S32 HI_GV_CURSOR_GetImage(HigvCursorInfo *cursorInfo); 140 141 /* 142 * brief Set the range of cursor move. 143 * param[in] regionX x coordinate. 144 * param[in] regionY y coordinate. 145 * param[in] regionWidth Width. 146 * param[in] regionHeight Height. 147 * retval ::HI_SUCCESS 148 */ 149 HI_S32 HI_GV_CURSOR_SetCursorRegion(HI_S32 regionX, HI_S32 regionY, HI_S32 regionWidth, HI_S32 regionHeight); 150 151 /* 152 * brief Get the output device. 153 * attention:When change output device, you should hide the cursor. 154 * 155 * param[out] devID The pointer of output device. 156 * retval ::HI_SUCCESS 157 * retval ::HI_FAILURE 158 */ 159 HI_S32 HI_GV_CURSOR_GetOutputDev(HI_U32 *devID); 160 161 /* 162 * brief Set width and height of output screen. 163 * attention:it is different between the real display and the canvas surface size. 164 * 165 * GUIڲͼsurface720x576ʱĻʵҪ720x480û720x576ͨŴ720x480ͼ 166 * λãҲҪݱӦĴ 167 * param[in] devID cursor device ID. 168 * param[in] screenWidth screen width of cursor output. 169 * param[in] screenHight screen height of cursor output. 170 * retval ::HI_SUCCESS 171 * retval ::HI_FAILURE 172 */ 173 HI_S32 HI_GV_CURSOR_SetDisplayScreen(HI_U32 devID, HI_U32 screenWidth, HI_U32 screenHight); 174 175 /* 176 * brief Attach the cursor to the 177 * layer. 178 * ǴΰͼbufferķΧ 179 * \attention \n 180 * you should set the bitmap and create layer first. 181 * 182 * param[in] layerId Layer ID. 183 * retval ::HI_SUCCESS 184 * retval ::HI_FAILURE 185 */ 186 HI_S32 HI_GV_CURSOR_AttchLayer(HIGO_LAYER_E layerId); 187 188 /* 189 * brief Detach cursor from layer. 190 * attention 191 * param[in] layerId Layer ID. 192 * retval ::HI_SUCCESS 193 * retval ::HI_FAILURE 194 */ 195 HI_S32 HI_GV_CURSOR_DettchLayer(HIGO_LAYER_E layerId); 196 197 /* 198 * brief set whether the cursor always show. 199 * attention if isCursorShow is HI_TRUE, the cursor will always show, even if mouse is not disconnected; 200 * otherwise the cursor show only if the mouse conntected. 201 * 202 * param[in] isCursorShow is cursor always show or not. 203 * retval N/A. 204 */ 205 HI_VOID HI_GV_CURSOR_SetAllwaysShow(const HI_BOOL isCursorShow); 206 207 #ifdef __cplusplus 208 } 209 #endif 210 #endif /* HI_GV_CURSOR_H */ 211 #endif 212